update oembed and widgets plugins settings form
This commit is contained in:
parent
c5cddc7428
commit
762bb8de79
5 changed files with 65 additions and 39 deletions
|
@ -25,9 +25,9 @@ function oembed_uninstall() {
|
||||||
function oembed_settings_post($a,$b){
|
function oembed_settings_post($a,$b){
|
||||||
if(! local_user())
|
if(! local_user())
|
||||||
return;
|
return;
|
||||||
if (isset($_POST['oembed-submit'])){
|
if (x($_POST,'oembed-submit')){
|
||||||
set_pconfig(local_user(), 'oembed', 'use_for_youtube', (isset($_POST['oembed_use_for_youtube'])? intval($_POST['oembed_use_for_youtube']):0));
|
set_pconfig(local_user(), 'oembed', 'use_for_youtube', (x($_POST,'oembed_use_for_youtube')? intval($_POST['oembed_use_for_youtube']):0));
|
||||||
notice( t('OEmbed settings updated') . EOL);
|
info( t('OEmbed settings updated') . EOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,21 +36,13 @@ function oembed_settings(&$a,&$o) {
|
||||||
return;
|
return;
|
||||||
$uofy = intval(get_pconfig(local_user(), 'oembed', 'use_for_youtube' ));
|
$uofy = intval(get_pconfig(local_user(), 'oembed', 'use_for_youtube' ));
|
||||||
|
|
||||||
$o.='
|
$t = file_get_contents( dirname(__file__). "/settings.tpl" );
|
||||||
<div class="settings-block">
|
$o .= replace_macros($t, array(
|
||||||
<h3 class="settings-heading">OEmbed</h3>
|
'$submit' => t('Submit'),
|
||||||
<div id="settings-username-wrapper">
|
'$title' => "OEmbed",
|
||||||
<label for="oembed_use_for_youtube">'
|
'$useoembed' => array('oembed_use_for_youtube', t('Use OEmbed for YouTube videos'), $uofy, ""),
|
||||||
.t('Use OEmbed for YouTube videos: ')
|
));
|
||||||
.'</label><input type="checkbox" id="oembed_use_for_youtube" name="oembed_use_for_youtube" value="1"'
|
|
||||||
. ($uofy==1?'checked="true"':'')
|
|
||||||
.' />
|
|
||||||
</div>
|
|
||||||
<div id="settings-username-end"></div>
|
|
||||||
<div class="settings-submit-wrapper">
|
|
||||||
<input type="submit" value="'.t('Submit').'" class="settings-submit" name="oembed-submit" />
|
|
||||||
</div>
|
|
||||||
</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
7
addon/oembed/settings.tpl
Normal file
7
addon/oembed/settings.tpl
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<div class="settings-block">
|
||||||
|
<h3 class="settings-heading">$title</h3>
|
||||||
|
{{ inc field_checkbox.tpl with $field=$useoembed }}{{ endinc }}
|
||||||
|
<div class="settings-submit-wrapper">
|
||||||
|
<input type="submit" value="$submit" class="settings-submit" name="oembed-submit" />
|
||||||
|
</div>
|
||||||
|
</div>
|
19
addon/widgets/settings.tpl
Normal file
19
addon/widgets/settings.tpl
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<div class="settings-block">
|
||||||
|
<h3 class="settings-heading">$title</h3>
|
||||||
|
<div class='field noedit'>
|
||||||
|
<label>$label</label>
|
||||||
|
<tt>$key</tt>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="settings-submit-wrapper">
|
||||||
|
<input type="submit" value="$submit" class="settings-submit" name="widgets-submit" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4>$widgets_h</h4>
|
||||||
|
<ul>
|
||||||
|
{{ for $widgets as $w }}
|
||||||
|
<li><a href="$baseurl/widgets/$w.0/?k=$key&p=1">$w.1</a></li>
|
||||||
|
{{ endfor }}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
|
@ -34,32 +34,30 @@ function widgets_settings(&$a,&$o) {
|
||||||
$key = get_pconfig(local_user(), 'widgets', 'key' );
|
$key = get_pconfig(local_user(), 'widgets', 'key' );
|
||||||
if ($key=='') { $key = mt_rand(); set_pconfig(local_user(), 'widgets', 'key', $key); }
|
if ($key=='') { $key = mt_rand(); set_pconfig(local_user(), 'widgets', 'key', $key); }
|
||||||
|
|
||||||
$o .='<h3 class="settings-heading">Widgets</h3>';
|
$widgets = array();
|
||||||
|
|
||||||
|
|
||||||
$o.='
|
|
||||||
<div id="settings-username-wrapper">
|
|
||||||
'. t('Widgets key: ') .'<strong>'.$key.'</strong>
|
|
||||||
</div>
|
|
||||||
<div id="settings-username-end"></div>
|
|
||||||
<div class="settings-submit-wrapper">
|
|
||||||
<input type="submit" value="'.t('Generate new key').'" class="settings-submit" name="widgets-submit">
|
|
||||||
</div>';
|
|
||||||
|
|
||||||
|
|
||||||
$o.='<h4>Widgets:</h4>';
|
|
||||||
$o .= '<ul>';
|
|
||||||
$d = dir(dirname(__file__));
|
$d = dir(dirname(__file__));
|
||||||
while(false !== ($f = $d->read())) {
|
while(false !== ($f = $d->read())) {
|
||||||
if(substr($f,0,7)=="widget_") {
|
if(substr($f,0,7)=="widget_") {
|
||||||
preg_match("|widget_([^.]+).php|", $f, $m);
|
preg_match("|widget_([^.]+).php|", $f, $m);
|
||||||
$w=$m[1];
|
$w=$m[1];
|
||||||
require_once($f);
|
require_once($f);
|
||||||
$o.='<li><a href="'.$a->get_baseurl().'/widgets/'.$w.'/?k='.$key.'&p=1">'. call_user_func($w."_widget_name") .'</a></li>';
|
$widgets[] = array($w, call_user_func($w."_widget_name"));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$o .= '</ul>';
|
|
||||||
|
|
||||||
|
$t = file_get_contents( dirname(__file__). "/settings.tpl" );
|
||||||
|
$o .= replace_macros($t, array(
|
||||||
|
'$submit' => t('Generate new key'),
|
||||||
|
'$baseurl' => $a->get_baseurl(),
|
||||||
|
'$title' => "Widgets",
|
||||||
|
'$label' => t('Widgets key'),
|
||||||
|
'$key' => $key,
|
||||||
|
'$widgets_h' => t('Widgets available'),
|
||||||
|
'$widgets' => $widgets,
|
||||||
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2541,6 +2541,15 @@ a.mail-list-link {
|
||||||
filter:alpha(opacity=100);
|
filter:alpha(opacity=100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugins settings
|
||||||
|
*/
|
||||||
|
|
||||||
|
.settings-block > h3,
|
||||||
|
.settings-heading {
|
||||||
|
border-bottom: 1px solid #babdb6
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form fields
|
* Form fields
|
||||||
|
@ -2554,7 +2563,6 @@ a.mail-list-link {
|
||||||
.field label {
|
.field label {
|
||||||
float: left;
|
float: left;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
font-weight: bold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.field input,
|
.field input,
|
||||||
|
@ -2599,7 +2607,9 @@ a.mail-list-link {
|
||||||
#adminpage h3 {
|
#adminpage h3 {
|
||||||
border-bottom: 1px solid #cccccc;
|
border-bottom: 1px solid #cccccc;
|
||||||
}
|
}
|
||||||
|
#adminpage .field label {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
#adminpage .submit {
|
#adminpage .submit {
|
||||||
clear:left;
|
clear:left;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
|
Loading…
Reference in a new issue