/** * Add the Key Image field to the post publication form, and allow it to be set from silos * @param FormUI $form * @param Post $post */ public function action_form_publish_entry($form, $post) { $form->insert('publish_controls', new FormControlText('keyimage', $post, 'Key Image', 'admincontrol_text')); $imageinsert = $form->insert('content', 'static', 'imageinsert', ''); $imageinsert->caption = <<<CAPTION_SCRIPT <script type="text/javascript"> function add_photo_to_set(fileindex, fileobj) { \t\$('#keyimage').val(fileobj.url); } \$(function(){ \t\$.extend(habari.media.output.image_jpeg, { \t\tset_key_image: add_photo_to_set \t}); \t\$.extend(habari.media.output.image_png, { \t\tset_key_image: add_photo_to_set \t}); \t\$.extend(habari.media.output.image_gif, { \t\tset_key_image: add_photo_to_set \t}); \t\$.extend(habari.media.output.flickr, { \t\tset_key_image: add_photo_to_set \t}); }); </script> CAPTION_SCRIPT; }
public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { switch ($action) { case _('Configure'): $ui = new FormUI(strtolower(get_class($this))); // present the user with a list of // URL shortening services $service = $ui->append('select', 'service', 'lilliputian__service', _t('The URL shortening service to use: ')); $services = array(); $services['internal'] = 'internal'; $list = Utils::glob(dirname(__FILE__) . '/*.helper.php'); if (count($list) > 0) { foreach ($list as $item) { $item = basename($item, '.helper.php'); $services[$item] = $item; } } $service->options = $services; if (Options::get('lilliputian__service') == 'internal') { $secret = $ui->append('text', 'secret', 'lilliputian__secret', _t('The secret word that must be passed when generating short URLs. May be blank to disable this security feature.')); } $ui->append('submit', 'save', _t('Save')); $ui->out(); break; } } }
/** * Simple plugin configuration * @return FormUI The configuration form **/ public function configure() { $form = new FormUI('postmark'); $form->append(new FormControlText('apikey', 'postmark__apikey', 'API Key')); $form->append(new FormControlSubmit('save', _t('Save'))); return $form; }
public function configure() { $form = new FormUI(__CLASS__); $form->append('checkbox', 'hide_social', __CLASS__ . 'hide_social', _t('Hide social area in fullsize image view', __CLASS__)); $form->append('submit', 'submit', _t('Save')); return $form; }
/** * Respond to the user selecting an action on the plugin page * @param string $plugin_id The string id of the acted-upon plugin * @param string $action The action string supplied via the filter_plugin_config hook **/ public function action_plugin_ui($plugin_id, $action) { if ($plugin_id === $this->plugin_id()) { switch ($action) { case _t('Configure', $this->class_name): $ui = new FormUI($this->class_name); $type = $ui->append('select', 'type', 'option:' . $this->class_name . '__type', _t('Photostream Type', $this->class_name)); $type->options = array('public' => _t('Public photos & video', $this->class_name), 'user' => _t('Public photos & video from you', $this->class_name), 'friends' => _t('Your friends’ photostream', $this->class_name), 'faves' => _t('Public favorites from you', $this->class_name), 'group' => _t('Group pool', $this->class_name)); $type->add_validator('validate_required'); $user_id = $ui->append('text', 'user_id', 'option:' . $this->class_name . '__user_id', _t('Flickr ID (You can get it from <a href="http://idgettr.com">idGettr</a>)', $this->class_name)); $user_id->add_validator('validate_flickr_id'); $num_item = $ui->append('text', 'num_item', 'option:' . $this->class_name . '__num_item', _t('№ of Photos', $this->class_name)); $num_item->add_validator('validate_uint'); $num_item->add_validator('validate_required'); $size = $ui->append('select', 'size', 'option:' . $this->class_name . '__size', _t('Photo Size', $this->class_name)); $size->options = array('square' => _t('Square', $this->class_name), 'thumbnail' => _t('Thumbnail', $this->class_name), 'small' => _t('Small', $this->class_name), 'medium' => _t('Medium', $this->class_name), 'large' => _t('Large', $this->class_name), 'original' => _t('Original', $this->class_name)); $size->add_validator('validate_required'); $tags = $ui->append('text', 'tags', 'option:' . $this->class_name . '__tags', _t('Tags (comma separated, no space)', $this->class_name)); $cache_expiry = $ui->append('text', 'cache_expiry', 'option:' . $this->class_name . '__cache_expiry', _t('Cache Expiry (in seconds)', $this->class_name)); $cache_expiry->add_validator('validate_uint'); $cache_expiry->add_validator('validate_required'); // When the form is successfully completed, call $this->updated_config() $ui->append('submit', 'save', _t('Save', $this->class_name)); $ui->set_option('success_message', _t('Options saved', $this->class_name)); $ui->out(); break; } } }
public function configure() { $ui = new FormUI(strtolower(get_class($this))); $clientcode = $ui->append('textarea', 'clientcode', 'freestyle__css', _t('FreeStyle CSS')); $ui->append('submit', 'save', _t('Save')); return $ui; }
/** * Create a configuration form for this plugin * **/ public function configure() { $form = new FormUI('popular_posts'); $form->append('checkbox', 'loggedintoo', 'popular_posts__loggedintoo', _t('Track views of logged-in users too', 'popular_posts')); $form->append('submit', 'save', 'Save'); $form->out(); }
/** * Executes when the admin plugins page wants to display the UI for a particular plugin action. * Displays the plugin's UI. * * @param string $plugin_id The unique id of a plugin * @param string $action The action to display */ public function action_plugin_ui($plugin_id, $action) { // Display the UI for this plugin? if ($plugin_id == $this->plugin_id) { // Depending on the action specified, do different things switch ($action) { // For the action 'configure': case 'Configure': // Create a new Form called 'lifestream' $ui = new FormUI('lifestream'); // Add a text control for the feed URL $feedurl = $ui->append('text', 'feedurl', 'lifestream__feedurl', _t('Feed URL')); // Mark the field as required $feedurl->add_validator('validate_required'); // Mark the field as requiring a valid URL $feedurl->add_validator('validate_url'); // Add a text control for the rewrite base $rewritebase = $ui->append('text', 'lifeurl', 'lifestream__lifeurl', _t('Lifestream URL')); // Mark the field as required $rewritebase->add_validator('validate_required'); // Add a text control for the entries per page $perpage = $ui->append('text', 'perpage', 'lifestream__perpage', _t('Items Per Page')); // Mark the field as required $perpage->add_validator('validate_required'); $submit = $ui->append('submit', 'submit', _t('Save')); // Display the form $ui->out(); break; } } }
public function configure() { $ui = new FormUI('acronyms'); $iam_key = $ui->append('textarea', 'acronyms', 'acronyms__acronyms', _t('Acronyms')); $ui->append('submit', 'save', _t('Save')); $ui->out(); }
/** * Respond to the user selecting an action on the plugin page * * @param string $plugin_id The string id of the acted-upon plugin * @param string $action The action string supplied via the filter_plugin_config hook */ public function configure() { $ui = new FormUI(strtolower(get_class($this))); $ping_services = $ui->append('textmulti', 'ping_services', 'option:autopinger__pingservices', _t('Ping Service URLs:')); $ui->append('submit', 'save', 'Save'); $ui->out(); }
public function configure() { $form = new FormUI(strtolower(get_class($this))); $form->append('static', 'why_suppress', _t('<small>If you suppress the list, you can add them manually using the $post->footnotes array.</small>')); $form->append('checkbox', 'suppress_list', 'footnotes__suppress_list', _t('Don\'t append the footnote list to posts')); $form->append('submit', 'save', _t('Save')); return $form; }
public function action_form_publish_event(FormUI $form, $post, $context) { $event_data = $form->insert('publish_controls', new FormControlFieldset('event_data', _t('Event Data'), 'admincontrol_fieldset')); $start = $event_data->append(new FormControlTags('event_start', $post, 'Event Start', 'optionscontrol_text')); $start->add_validator('validate_datetime')->add_validator('validate_required'); $end = $event_data->append(new FormControlTags('event_end', $post, 'Event End', 'optionscontrol_text')); $end->add_validator('validate_datetime')->add_validator('validate_required'); }
public function configure() { $form = new FormUI('slugsync'); $form->append('checkbox', 'draft_updates', 'slugsync__draftupdates', _t('Only update when post status is draft: ', 'slugsync')); $form->append('submit', 'save', 'Save'); $form->set_option('success_message', _t('Slugsync options saved.', 'slugsync')); return $form; }
/** * Respond to the user selecting Configure on the plugin page **/ public function configure() { $ui = new FormUI(strtolower(get_class($this))); $ui->append('text', 'count', 'related_posts__count', _t('No. of posts to be shown')); $ui->append('text', 'header', 'related_posts__header', _t('Header for Related Posts list')); $ui->append('submit', 'save', _t('Save')); return $ui; }
public function configure() { $class_name = strtolower(get_class($this)); $ui = new FormUI($class_name); $add_title = $ui->append('checkbox', 'add_title', $class_name . '__add_title', _t('Include title words in count?')); $ui->append('submit', 'save', 'save'); return $ui; }
public function configure() { $ui = new FormUI('mpango_config'); $ui->append('text', 'github_id', 'mpango__github_id', _t('GitHub ID (optional)')); $ui->append('text', 'github_secret', 'mpango__github_secret', _t('GitHub Secret (optional)')); $ui->append('submit', 'save', _t('Save')); return $ui; }
/** * Creates a UI form to handle the plugin configuration * * @param string $plugin_id The id of a plugin * @param array $actions An array of actions that apply to this plugin */ public function action_plugin_ui($plugin_id, $action) { if ($this->plugin_id() == $plugin_id && $action == 'Configure') { $form = new FormUI(strtolower(get_class($this))); $form->append('checkbox', 'enable SmartyPants', 'option:habarimarkdown__smarty', _t('Enable SmartyPants')); $form->append('submit', 'save', _t('Save')); $form->out(); } }
public function updated_config(FormUI $ui) { $blacklist = explode("\n", $ui->blacklist->value); $blacklist = array_unique($blacklist); natsort($blacklist); $_POST[$ui->blacklist->field] = implode("\n", $blacklist); Session::notice(_t('Blacklist saved.', 'simpleblacklist')); $ui->save(); }
public function configure() { $ui = new FormUI('ieadmin'); $ver = $ui->append('text', 'ieversion', 'ieadmin__ieversion', _t('IE version to be compatible with (e.g. 8)', 'ieadmin')); $ver->add_validator('validate_regex', '/^[7-9]*$/', _t('Please enter a valid version number between 7-9.', 'ieadmin')); $ui->append('text', 'jsversion', 'ieadmin__jsversion', _t('Script version, if not using "' . self::JS_VERSION . '"', 'isadmin')); $ui->append('submit', 'save', 'save'); return $ui; }
public function configure() { $class_name = strtolower(get_class($this)); $form = new FormUI($class_name); $form->append('select', 'frequency', 'database_optimizer__frequency', _t('Optimization Frequency'), array('hourly' => 'hourly', 'daily' => 'daily', 'weekly' => 'weekly', 'monthly' => 'monthly')); $form->append('submit', 'save', _t('Save')); $form->on_success(array($this, 'updated_config')); $form->out(); }
/** * Show options on plugins admin page */ public function configure() { $ui = new FormUI(strtolower(get_class($this))); $ui->append('textarea', 'original_text', 'linkblog__original', _t('Text to use for describing original in feeds:')); $ui->original_text->rows = 2; $ui->append('checkbox', 'atom_permalink', 'linkblog__atom_permalink', _t('Override atom permalink with link URL')); $ui->append('submit', 'save', _t('Save')); return $ui; }
public function configure() { $form = new FormUI('preapproved'); $form->append('text', 'approved_count', 'option:preapproved__approved_count', _t('Required number of approved comments: ')); $form->approved_count->add_validator(array($this, 'validate_integer')); $form->append('submit', 'save', _t('Save')); $form->set_option('success_message', _t('Configuration saved')); $form->out(); }
public function configure() { $form = new FormUI('threaded_comment'); $depth = $form->append('text', 'threaded_depth', 'threaded_comment__depth', _t('Max depth of thread:')); $depth->add_validator('validate_regex', '/^[0-9]*$/', _t('Please enter a valid positive integer.')); $form->append('submit', 'save', _t('Save')); $form->set_option('success_message', _t('Configuration saved')); return $form; }
public function configure() { $ui = new FormUI(strtolower(get_class($this))); $css_location = $ui->append('text', 'css_location', 'option:freestyleadmin__css_location', _t('FreeStyle CSS Location', 'FreeStyleAdmin')); $css_location->add_validator('validate_required'); $ui->append('submit', 'save', _t('Save', 'FreeStyleAdmin')); $ui->set_option('success_message', _t('Configuration saved', 'FreeStyleAdmin')); return $ui; }
public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { $ui = new FormUI('urlapprove'); $ui->append('checkbox', 'redirect_default', 'urlapprove__redirect_default', _t('Redirect all comment author links by default', 'urlapprove')); $ui->append('textarea', 'whitelist', 'urlapprove__whitelist', _t('Whitelist of domains that will not be redirected, one per line (does not auto-approve)')); $ui->append('submit', 'submit', 'Submit'); $ui->out(); } }
/** * Add fields to the publish page for all content types * * @param FormUI $form The publish form * @param Post $post The post being published */ public function action_form_publish($form, $post) { $form->insert('tags', 'text', 'summary', 'null:null', _t('Summary')); $form->summary->raw = true; $form->summary->value = $post->info->summary; $form->summary->tabindex = 3; $form->tags->tabindex = 4; $form->buttons->save->tabindex = 5; $form->summary->template = 'admincontrol_text'; }
/** * Add the Add Item form to the theme for display */ public function get_additem_form() { $additem_form = new FormUI('dash_additem'); $additem_form->append('select', 'module', 'null:unused'); $additem_form->module->options = Plugins::filter('dashboard_block_list', array()); $additem_form->append('submit', 'submit', _t('+')); //$form->on_success( array( $this, 'dash_additem' ) ); $additem_form->properties['onsubmit'] = "dashboard.add(); return false;"; $this->theme->additem_form = $additem_form->get(); }
/** * Add the configuration to the user page * @param FormUI $form The user form * @param User $user User object */ public function action_form_user($form, $user) { $fieldset = $form->append('wrapper', 'login_redirect_fieldset', 'Login Redirect'); $fieldset->class = 'container settings'; $fieldset->append('static', 'login_redirect_title', '<h2>Login Redirect</h2>'); $activate = $fieldset->append('text', 'login_redirect', 'null:null', _t('Redirect to this URL after login:'******'item clear'; $activate->value = $user->info->login_redirect; $form->move_before($fieldset, $form->page_controls); }
/** * Add fields to the publish page for photos * * @param FormUI $form The publish form * @param Post $post * @return array */ public function action_form_publish($form, $post) { if ($form->content_type->value == Post::type('entry')) { $form->insert('content', 'text', 'photo', 'null:null', _t('Photo URL')); if (isset($post->info->photo)) { $form->photo->value = $post->info->photo; } $form->photo->template = 'admincontrol_text'; } }
public function configure() { $groups_array = array(); foreach (UserGroups::get_all() as $group) { $groups_array[$group->id] = $group->name; } $form = new FormUI('proposal'); $form->append(new FormControlSelect('type', 'staff__group', 'Group To Use for Staff', $groups_array)); $form->append(new FormControlSubmit('save', _t('Save'))); return $form; }