public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { $frequencies = array('manually' => _t('Manually', 'exportsnapshot'), 'hourly' => _t('Hourly', 'exportsnapshot'), 'daily' => _t('Daily', 'exportsnapshot'), 'weekly' => _t('Weekly', 'exportsnapshot'), 'monthly' => _t('Monthly', 'exportsnapshot')); $types = array('blogml' => _t('BlogML', 'exportsnapshot'), 'wxr' => _t('WXR', 'exportsnapshot')); switch ($action) { case _t('Configure'): $ui = new FormUI('export'); $ui->append('text', 'exportsnapshot_max_snapshots', 'option:exportsnapshot__max_snapshots', _t('Max Snapshots to Save:', 'exportsnapshot')); $ui->append('select', 'exportsnapshot_freq', 'option:exportsnapshot__frequency', _t('Auto Snapshot frequency:', 'exportsnapshot'), $frequencies); $ui->append('select', 'exportsnapshot_type', 'option:exportsnapshot__type', _t('Type of export:', 'exportsnapshot'), $types); $ui->append('submit', 'save', _t('Save')); $ui->on_success(array($this, 'updated_config')); $ui->out(); break; case _t('Take Snapshot'): self::run('manual'); Session::notice(_t('Snapshot saved!', 'exportsnapshot')); //CronTab::add_single_cron('snapshot_single', array( 'ExportSnapshot', 'run' ), HabariDateTime::date_create(), 'Run a single snapshot.' ); //Session::notice( _t( 'Snapshot scheduled for next cron run.' ) ); // don't display the configuration page, just redirect back to the plugin page Utils::redirect(URL::get('admin', 'page=plugins')); break; } } }
/** * Create the configuration FromUI */ public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { switch ($action) { case _t('Configure'): $ui = new FormUI(strtolower(get_class($this))); // add language selector $ui->append('select', 'lang', 'option:autokeyword__lang', _t('Language'), array('en' => 'English')); // add single word entries $ui->append('text', 'min_1word_length', 'option:autokeyword__min_1word_length', _t('Minimum length for one word keywords')); $ui->append('text', 'min_1word_occur', 'option:autokeyword__min_1word_occur', _t('Minimum occurance for one word keywords')); // add two word phrase entries $ui->append('text', 'min_2word_length', 'option:autokeyword__min_2word_length', _t('Minimum length for single words in two word phrases')); $ui->append('text', 'min_2phrase_length', 'option:autokeyword__min_2phrase_length', _t('Minimum length for entire two word phrase')); $ui->append('text', 'min_2phrase_occur', 'option:autokeyword__min_2phrase_occur', _t('Minimum occurance for entire two word phrase')); // add three word phrase entries $ui->append('text', 'min_3word_length', 'option:autokeyword__min_3word_length', _t('Minimum length for single words in three word phrases')); $ui->append('text', 'min_3phrase_length', 'option:autokeyword__min_3phrase_length', _t('Minimum length for entire three word phrase')); $ui->append('text', 'min_3phrase_occur', 'option:autokeyword__min_3phrase_occur', _t('Minimum occurance for entire three word phrase')); // misc $ui->append('submit', 'save', 'Save'); $ui->on_success(array($this, 'updated_config')); $ui->out(); break; } } }
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(); }
public function action_plugin_ui_login() { $ui = new FormUI('linkit_login'); $ui->append('text', 'email', 'linkit__email', _t('Your email address:')); $ui->append('password', 'password', 'linkit__password', _t('Your password:'******'submit', 'login', _t('Log In')); $ui->on_success(array($this, 'do_login')); $ui->out(); }
public function action_plugin_ui_configure() { $ui = new FormUI('autoclose'); $age_in_days = $ui->append('text', 'age_in_days', 'autoclose__age_in_days', _t('Post age (days) for autoclose', 'autoclose')); $age_in_days->add_validator('validate_required'); $ui->append('submit', 'save', _t('Save', 'autoclose')); $ui->set_option('success_message', _t('Configuration saved', 'autoclose')); $ui->on_success(array($this, 'updated_config')); $ui->out(); }
public function configure() { $ui = new FormUI('tracfeed'); $connection_string = $ui->append('text', 'connection_string', 'tracfeed__connection_string', _t('Connection String:', 'tracfeed')); $username = $ui->append('text', 'username', 'tracfeed__username', _t('Username (or blank for sqlite):', 'tracfeed')); $password = $ui->append('password', 'password', 'tracfeed__password', _t('Password (or blank for sqlite):', 'tracfeed')); $ui->on_success(array($this, 'updated_config')); $ui->append('submit', 'save', _t('Save', 'tracfeed')); return $ui; }
public function configure() { $form = new FormUI('lipsum'); // $form->set_settings( array( 'use_session_errors' => true ) ); $form->append(FormControlText::create('num_posts', 'option:lipsum__num_posts')->add_validator('validate_lipsum_numbers')->label(_t('Number of posts to have present:', __CLASS__))); $form->append(FormControlText::create('num_comments', 'option:lipsum__num_comments')->add_validator('validate_lipsum_numbers')->label(_t('Max number of comments for each post:', __CLASS__))); $form->append(FormControlText::create('num_tags', 'option:lipsum__num_tags')->add_validator('validate_lipsum_numbers')->label(_t('Max number of tags for each post:', __CLASS__))); $form->append(FormControlSubmit::create('save')->set_caption('Save')); $form->on_success(array($this, 'updated_config')); echo $form->get(); }
/** * Handles POST requests from the options admin page */ public function post_options() { $option_items = array(); $timezones = DateTimeZone::listIdentifiers(); $timezones = array_merge(array('' => ''), array_combine(array_values($timezones), array_values($timezones))); $option_items[_t('Name & Tagline')] = array('title' => array('label' => _t('Site Name'), 'type' => 'text', 'helptext' => ''), 'tagline' => array('label' => _t('Site Tagline'), 'type' => 'text', 'helptext' => ''), 'about' => array('label' => _t('About'), 'type' => 'textarea', 'helptext' => '')); $option_items[_t('Publishing')] = array('pagination' => array('label' => _t('Items per Page'), 'type' => 'text', 'helptext' => ''), 'atom_entries' => array('label' => _t('Entries to show in Atom feed'), 'type' => 'text', 'helptext' => ''), 'comments_require_id' => array('label' => _t('Require Comment Author Info'), 'type' => 'checkbox', 'helptext' => ''), 'spam_percentage' => array('label' => _t('Comment SPAM Threshold'), 'type' => 'text', 'helptext' => _t('The likelihood a comment is considered SPAM, in percent.'))); $option_items[_t('Time & Date')] = array('timezone' => array('label' => _t('Time Zone'), 'type' => 'select', 'selectarray' => $timezones, 'helptext' => _t('Current Date Time: %s', array(HabariDateTime::date_create()->format()))), 'dateformat' => array('label' => _t('Date Format'), 'type' => 'text', 'helptext' => _t('Current Date: %s', array(HabariDateTime::date_create()->date))), 'timeformat' => array('label' => _t('Time Format'), 'type' => 'text', 'helptext' => _t('Current Time: %s', array(HabariDateTime::date_create()->time)))); $option_items[_t('Language')] = array('locale' => array('label' => _t('Locale'), 'type' => 'select', 'selectarray' => array_merge(array('' => 'default'), array_combine(HabariLocale::list_all(), HabariLocale::list_all())), 'helptext' => _t('International language code')), 'system_locale' => array('label' => _t('System Locale'), 'type' => 'text', 'helptext' => _t('The appropriate locale code for your server'))); $option_items[_t('Troubleshooting')] = array('log_min_severity' => array('label' => _t('Minimum Severity'), 'type' => 'select', 'selectarray' => LogEntry::list_severities(), 'helptext' => _t('Only log entries with a this or higher severity.')), 'log_backtraces' => array('label' => _t('Log Backtraces'), 'type' => 'checkbox', 'helptext' => _t('Logs error backtraces to the log table\'s data column. Can drastically increase log size!'))); /*$option_items[_t('Presentation')] = array( 'encoding' => array( 'label' => _t('Encoding'), 'type' => 'select', 'selectarray' => array( 'UTF-8' => 'UTF-8' ), 'helptext' => '', ), );*/ $option_items = Plugins::filter('admin_option_items', $option_items); $form = new FormUI('Admin Options'); $tab_index = 3; foreach ($option_items as $name => $option_fields) { $fieldset = $form->append('wrapper', Utils::slugify(_u($name)), $name); $fieldset->class = 'container settings'; $fieldset->append('static', $name, '<h2>' . htmlentities($name, ENT_COMPAT, 'UTF-8') . '</h2>'); foreach ($option_fields as $option_name => $option) { $field = $fieldset->append($option['type'], $option_name, $option_name, $option['label']); $field->template = 'optionscontrol_' . $option['type']; $field->class = 'item clear'; if ($option['type'] == 'select' && isset($option['selectarray'])) { $field->options = $option['selectarray']; } $field->tabindex = $tab_index; $tab_index++; if (isset($option['helptext'])) { $field->helptext = $option['helptext']; } else { $field->helptext = ''; } } } /* @todo: filter for additional options from plugins * We could either use existing config forms and simply extract * the form controls, or we could create something different */ $submit = $form->append('submit', 'apply', _t('Apply'), 'admincontrol_submit'); $submit->tabindex = $tab_index; $form->on_success(array($this, 'form_options_success')); $this->theme->form = $form->get(); $this->theme->option_names = array_keys($option_items); $this->theme->display('options'); }
/** * Implement the simple plugin configuration. * @return FormUI The configuration form */ public function configure() { $ui = new FormUI('maintenance_mode'); // Add a text control for the maintenance mode text $ui->append('textarea', 'mm_text', self::OPTION_NAME . '__text', _t('Display Text: ')); // Add checkbox to put in/out of maintenance mode $ui->append('checkbox', 'in_maintenance', self::OPTION_NAME . '__in_maintenance', _t('In Maintenance Mode')); $ui->append('checkbox', 'display_feeds', self::OPTION_NAME . '__display_feeds', _t('Display Feeds When In Maintenance Mode')); $ui->append('submit', 'save', _t('Save')); $ui->on_success(array($this, 'updated_config')); $ui->out(); }
/** * Implement the simple plugin configuration. * @return FormUI The configuration form */ public function configure() { $form = new FormUI('piwik'); $form->append('text', 'siteurl', 'option:piwik__siteurl', _t('Piwik site URL', 'piwik')); $form->append('text', 'sitenum', 'option:piwik__sitenum', _t('Piwik site number', 'piwik')); $form->append('text', 'auth_token', 'option:piwik__auth_token', _t('Piwik Auth Token', 'piwik')); $form->append('checkbox', 'trackloggedin', 'option:piwik__trackloggedin', _t('Track logged-in users', 'piwik')); $form->append('checkbox', 'use_clickheat', 'option:piwik__use_clickheat', _t('Include PiWik Click Heat Plugin JS', 'piwik')); $form->append('submit', 'save', _t('Save', 'piwik')); $form->on_success(array($this, 'save_config')); return $form->get(); }
public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { if ($action == _t('Configure')) { $class_name = strtolower(get_class($this)); $form = new FormUI($class_name); $form->append('select', 'format', 'dateyurl__format', _t('URL Format'), array('date' => '/{year}/{month}/{day}/{slug}', 'month' => '/{year}/{month}/{slug}')); $form->append('textmulti', 'rules', 'dateyurl__rules', _t('Rules to Change')); $form->append('submit', 'save', _t('Save')); $form->on_success(array($this, 'updated_config')); $form->out(); } } }
/** * Method that responds to the user selecting an action on the plugin page * @param string $plugin_id String containning the id of the plugin * @param string $action The action string suplied 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'): $ui = new FormUI(strtolower(get_class($this))); $colophontitle = $ui->add('text', 'colophon_title', _t('Enter your Title:')); $colophontext = $ui->add('textarea', 'colophon_text', _t('Enter your Text:')); $ui->on_success(array($this, 'updated_config')); $ui->out(); break; } } }
/** * Plugin UI - Displays the various config options depending on the "option" * chosen. * * @access public * @param string $plugin_id * @param string $action * @return void */ public function action_plugin_ui($plugin_id, $action) { $ui = new FormUI(strtolower(__CLASS__)); switch ($action) { case _t('Configure'): $ui = new FormUI(strtolower(__CLASS__)); $post_fieldset = $ui->append('fieldset', 'post_settings', _t('Fetch trac tickets using custom query', 'tracdashmodule')); $trac_query = $post_fieldset->append('textmulti', 'trac_query', 'tracdashmodule__trac_query', _t('Enter custom query:', 'tracdashmodule')); $ui->on_success(array($this, 'updated_config')); $ui->append('submit', 'save', _t('Save', 'tracdashmodule')); $ui->out(); break; } }
public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { switch ($action) { case _t('Configure'): $ui = new FormUI(strtolower(get_class($this))); $max_dimension = $ui->append('text', 'max_dimension', 'photology__maxdim', _t('Maximum size of thumbnail (length and width)')); $max_dimension->add_validator(array($this, 'validate_numeric')); $ui->append('submit', 'save', _t('Save')); $ui->on_success(array($this, 'update_config')); $ui->out(); break; } } }
/** * Creates a UI form to handle the plguin configurations * * @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 == _t('Configure')) { $form = new FormUI(strtolower(get_class($this))); $form->append('fieldset', 'fieldset1', _t('Tag Registered Users', 'woopra')); $tag_registered = $form->fieldset1->append('checkbox', 'tag_registered', 'option:woopra__tag_registered', _t('Enabled', 'woopra')); $label2 = $form->fieldset1->append('label', 'label2', _t('Display users avatars', 'woopra')); $display_avatar = $form->fieldset1->append('radio', 'display_avatar', 'option:woopra__display_avatar', _t('Display users avatars', 'woopra'), array('no' => 'Disabled', 'userimage' => 'Local user image', 'gravatar' => 'Gravatar')); $form->append('fieldset', 'fieldset2', _t('Exclude Users', 'woopra')); $excluded_users = $form->fieldset2->append('textmulti', 'excluded_users', 'option:woopra__excluded_users', _t('Don\'t track visits from the following user names', 'woopra')); $form->append('submit', 'save', _t('Save')); $form->on_success(array($this, 'save_config')); $form->out(); } }
public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { switch ($action) { case _t('Configure'): $form = new FormUI(__CLASS__); $admins = $form->append('text', 'admins', 'share__fb_admins', _t('Facebook admin user IDs')); $form->append('static', 'admins_text', _t('<p>This is a comma-separated list of the IDs of the Facebook users allowed to admin this page.</p>')); $form->append('submit', 'save', 'Save'); $form->on_success(array($this, 'updated_config')); $form->out(); break; } } }
/** * Add Spamspan Configuration user interface */ public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { switch ($action) { case _t('Configure'): $ui = new FormUI(strtolower(get_class($this))); $ui->append('text', 'custom_at', 'spamspan__at', _t('Custom replacement for "@"')); $ui->append('checkbox', 'enable_graphics', 'spamspan__graphics', _t('Use a graphical replacement for "@"')); $ui->append('submit', 'save', _t('Save')); $ui->on_success(array($this, 'updated_config')); $ui->out(); break; } } }
/** * Plugin UI * * @access public * @param string $plugin_id * @param string $action * @return void */ public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { switch ($action) { case _t('Configure'): $ui = new FormUI(strtolower(__CLASS__)); $ui->append('static', 'insert_desc', _t('There are two methods in which you can link to the Google hosts libraries. Here you can choose your preferred method.')); $ui->append('radio', 'direct_link', __CLASS__ . '__direct_link', _t('Insert Method'), array(TRUE => _t('Direct links'), FALSE => _t('google.load()'))); $ui->append('submit', 'save', _t('Save')); $ui->on_success(array($this, 'storeOpts')); $ui->out(); break; } } }
/** * action: plugin_ui * * @access public * @param string $plugin_id * @param string $action * @return void */ public function action_plugin_ui($plugin_id, $action) { if ($plugin_id != $this->plugin_id()) { return; } if ($action == _t('Configure')) { $form = new FormUI(strtolower(get_class($this))); $form->on_success(array($this, 'on_success')); $refresh_interval = $form->append('text', 'refresh_interval', 'fireeagle__refresh_interval', _t('Refresh Interval (sec): ', 'fireeagle')); $refresh_interval->add_validator('validate_regex', '/^[0-9]+$/'); $form->append('submit', 'save', _t('Save')); $form->out(); } elseif ($action == _t('Authorize', 'fireeagle')) { // get request token $fireeagle = new FireEagleAPI($this->consumer_key, $this->consumer_secret); $token = $fireeagle->getRequestToken(); if (!$token || empty($token['oauth_token'])) { echo 'Invalid Response'; return; } $_SESSION['fireeagle']['req_token'] = $token['oauth_token']; $_SESSION['fireeagle']['req_token_secret'] = $token['oauth_token_secret']; $_SESSION['fireeagle']['state'] = 1; $oauth_callback = URL::get('admin', array('page' => 'plugins', 'configure' => $plugin_id, 'configaction' => '_callback')) . '#plugin_' . $plugin_id; ob_end_clean(); header('Location: ' . $fireeagle->getAuthorizeURL($token) . '&oauth_callback=' . urlencode($oauth_callback)); exit; } elseif ($action == _t('De-Authorize', 'fireeagle')) { Options::set('fireeagle__access_token_' . User::identify()->id, ''); Options::set('fireeagle__access_token_secret_' . User::identify()->id, ''); echo 'Fire Eagle De-authorization successfully.'; } elseif ($action == '_callback') { if (empty($_GET['oauth_token']) || $_GET['oauth_token'] != $_SESSION['fireeagle']['req_token']) { echo 'Invalid Token'; return; } // get access token $fireeagle = new FireEagleAPI($this->consumer_key, $this->consumer_secret, $_SESSION['fireeagle']['req_token'], $_SESSION['fireeagle']['req_token_secret']); $token = $fireeagle->getAccessToken(); if (!$token || empty($token['oauth_token'])) { echo 'Invalid Response'; return; } Options::set('fireeagle__access_token_' . User::identify()->id, $token['oauth_token']); Options::set('fireeagle__access_token_secret_' . User::identify()->id, $token['oauth_token_secret']); echo 'Fire Eagle Authorization successfully.'; } }
public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { switch ($action) { case _t('Configure'): $class_name = strtolower(get_class($this)); $ui = new FormUI($class_name); $embed = $ui->append('text', 'embed', 'typekit__embed', _t('Embed Code (required)')); $embed->add_validator('validate_required'); $ui->append('static', 'clarification', _t('<p>Typically this will look like <i>http://use.typekit.com/abcdef.js</i>, and can be found if you click <u>Embed Code</u> in the Kit Editor.</p>')); $ui->on_success(array($this, 'update_config')); $ui->append('submit', 'save', 'save'); $ui->out(); break; } } }
public function configure() { $ui = new FormUI(strtolower(get_class($this))); $blacklist = $ui->append('textarea', 'blacklist', 'option:simpleblacklist__blacklist', _t('Items to blacklist (words, IP addresses, URLs, etc):', 'simpleblacklist')); $blacklist->rows = 8; $blacklist->class[] = 'resizable'; $frequency = $ui->append('checkbox', 'frequency', 'option:simpleblacklist__frequency', _t('Bypass blacklist for frequent commenters:', 'simpleblacklist')); $keep = $ui->append('checkbox', 'keepcomments', 'option:simpleblacklist__keepcomments', _t('Keep comments (only mark them as spam):', 'simpleblacklist')); $ui->append('fieldset', 'learning', _t('Learning from spam', 'simpleblacklist')); $ui->learning->append('checkbox', 'blacklistauthor', 'option:simpleblacklist__blacklistauthor', _t('Auto-blacklist author', 'simpleblacklist')); $ui->learning->append('checkbox', 'blacklistmail', 'option:simpleblacklist__blacklistmail', _t('Auto-blacklist mail', 'simpleblacklist')); $ui->learning->append('checkbox', 'blacklisturl', 'option:simpleblacklist__blacklisturl', _t('Auto-blacklist url', 'simpleblacklist')); $ui->learning->append('checkbox', 'blacklistip', 'option:simpleblacklist__blacklistip', _t('Auto-blacklist ip', 'simpleblacklist')); $ui->on_success(array($this, 'updated_config')); $ui->append('submit', 'save', _t('Save', 'simpleblacklist')); return $ui; }
public function action_plugin_ui_configure() { $ui = new FormUI(strtolower(get_class($this))); $ui->append('static', 'null:null', _t('These settings are only effective for themes using the legacy implementation method (See Help). If you plan to use blocks, you can must set these settings on a per-block basis.', 'lastrecent')); $user = $ui->append('text', 'user', 'lastrecent__user', _t('Last.fm username: '******'lastrecent')); $limit = $ui->append('select', 'limit', 'lastrecent__limit', _t('Number of tracks to display: ', 'lastrecent')); $options = array(); for ($i = 1; $i <= 10; $i++) { $options[$i] = $i; } $limit->options = $options; $images = $ui->append('select', 'images', 'lastrecent__images', _t('Show images: ', 'lastrecent')); $images->options = array('none' => _t('None', 'lastrecent'), 'small' => _t('Small', 'lastrecent'), 'medium' => _t('Medium', 'lastrecent'), 'large' => _t('Large', 'lastrecent'), 'extralarge' => _t('Extralarge', 'lastrecent')); $ui->append('submit', 'save', _t('Save')); $ui->on_success(array($this, 'saveOptions')); $ui->out(); }
/** * Create configuration panel */ public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { switch ($action) { case _t('Replace'): $form = new FormUI(strtolower(get_class($this))); $form->append('text', 'search', 'null:null', _t('Search:')); $form->search->add_validator('validate_required'); $form->append('text', 'replace', 'null:null', _t('Replace:')); $form->replace->add_validator('validate_required'); $form->append('submit', 'save', _t('Replace')); $form->on_success('do_replace'); $form->out(); break; } } }
public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { switch ($action) { case _t('Configure'): $form = new FormUI(__CLASS__); $login = $form->append('text', 'login', 'bitly__login', _t('Login')); $login->add_validator('validate_required'); $apiKey = $form->append('text', 'api_key', 'bitly__api_key', _t('API Key')); $apiKey->add_validator('validate_required'); $form->append('submit', 'save', 'Save'); $form->on_success(array($this, 'updated_config')); $form->out(); break; } } }
/** * Simple plugin configuration * @return FormUI The configuration form **/ public function configure() { $ui = new FormUI('fontdeck'); $code = $ui->append('textarea', 'code', 'fontdeck__code', _t('Header code.<p>From the textarea "Paste this code into the <code><head></code> of your web page:"</p>', 'fontdeck')); $code->rows = 4; $code->cols = 50; $code->raw = true; $code->add_validator('validate_required'); $embed = $ui->append('textarea', 'stack', 'fontdeck__stack', _t('Selectors and font stacks.<p>From the textarea "Paste these CSS rules into your stylesheet and adapt the selectors as you need to:"</p>', 'fontdeck')); $embed->rows = 4; $embed->cols = 50; $embed->raw = true; $embed->add_validator('validate_required'); $ui->on_success(array($this, 'updated_config')); $ui->append('submit', 'save', 'save'); return $ui; // should probably do this in Twitter?? }
public function action_plugin_ui($plugin_id, $action) { if ($this->plugin_id() == $plugin_id) { $this->downloadplugin_pluginsPath = HABARI_PATH . '/user/plugins/'; $ui = new FormUI('Plugin download'); if (is_writable($this->downloadplugin_pluginsPath)) { $url = $ui->append('text', 'pluginurl', 'null:null', _t('Plugin URL:', 'plugin_locale')); $ui->append('submit', 'Download', _t('Download', 'plugin_locale')); $url->add_validator('url_validator', _t('The plugin_url field value must be a valid URL')); $ui->on_success(array($this, 'formui_submit')); //replace with width 100% when will be possible $ui->pluginurl->size = 70; } else { $ui->append('static', 'disclaimer', _t('<p><em><small>Plugins directory is not writable, check permissions and reload this page</small></em></p>')); } $ui->out(); } }
public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { switch ($action) { case _t('Configure'): $ui = new FormUI(strtolower(get_class($this))); $head = $ui->append('textarea', 'htmlheader', 'option:htmleverywhere_header', _t('Your header code:', 'htmleverywhere')); $head->raw = true; $side = $ui->append('textarea', 'htmlsidebar', 'option:htmleverywhere_sidebar', _t('Your sidebar code:', 'htmleverywhere')); $side->raw = true; $foot = $ui->append('textarea', 'htmlfooter', 'option:htmleverywhere_footer', _t('Your footer code:', 'htmleverywhere')); $foot->raw = true; $ui->append('submit', 'savecode', _t('Save code', 'htmleverywhere')); $ui->on_success(array($this, 'formui_submit')); $ui->out(); } } }
public function action_plugin_ui($plugin_id, $action) { $types = array('html' => 'html', 'markdown' => 'markdown', 'textile' => 'textile'); $skins = array('simple' => 'Simple', 'markitup' => 'MarkItUp'); if ($plugin_id == $this->plugin_id()) { switch ($action) { case _t('Configure'): $form = new FormUI('markup'); $form->append('select', 'markup_type', 'Markup__markup_type', _t('Markup Type ')); $form->markup_type->options = $types; $form->append('select', 'skin', 'Markup__skin', _t('Editor Skin ')); $form->skin->options = $skins; $form->append('submit', 'save', _t('Save')); $form->on_success(array($this, 'config_success')); $form->out(); break; } } }
public function get_jambo_form() { // borrow default values from the comment forms $commenter_name = ''; $commenter_email = ''; $commenter_url = ''; $commenter_content = ''; $user = User::identify(); if (isset($_SESSION['comment'])) { $details = Session::get_set('comment'); $commenter_name = $details['name']; $commenter_email = $details['email']; $commenter_url = $details['url']; $commenter_content = $details['content']; } elseif ($user->loggedin) { $commenter_name = $user->displayname; $commenter_email = $user->email; $commenter_url = Site::get_url('habari'); } // Now start the form. $form = new FormUI('jambo'); // $form->set_option( 'form_action', URL::get( 'submit_feedback', array( 'id' => $this->id ) ) ); // Create the Name field $form->append('text', 'jambo_name', 'null:null', _t('Name'), 'formcontrol_text')->add_validator('validate_required', _t('Your Name is required.'))->id = 'jambo_name'; $form->jambo_name->tabindex = 1; $form->jambo_name->value = $commenter_name; // Create the Email field $form->append('text', 'jambo_email', 'null:null', _t('Email'), 'formcontrol_text')->add_validator('validate_email', _t('Your Email must be a valid address.'))->id = 'jambo_email'; $form->jambo_email->tabindex = 2; $form->jambo_email->caption = _t('Email'); $form->jambo_email->value = $commenter_email; // Create the Message field $form->append('text', 'jambo_message', 'null:null', _t('Message', 'jambo'), 'formcontrol_textarea')->add_validator('validate_required', _t('Your message cannot be blank.', 'jambo'))->id = 'jambo_message'; $form->jambo_message->tabindex = 4; // Create the Submit button $form->append('submit', 'jambo_submit', _t('Submit'), 'formcontrol_submit'); $form->jambo_submit->tabindex = 5; // Set up form processing $form->on_success(array($this, 'process_jambo')); // Return the form object return $form; }
public function action_plugin_ui($plugin_id, $action) { if ($plugin_id == $this->plugin_id()) { switch ($action) { case _t('Configure', 'mollom'): $ui = new FormUI('mollom'); $public_key = $ui->append('text', 'public_key', 'option:mollom__public_key', _t('Mollom Public Key: ', 'mollom')); $public_key->add_validator('validate_required'); $public_key->add_validator(array($this, 'validate_public_key')); $private_key = $ui->append('text', 'private_key', 'option:mollom__private_key', _t('Mollom Private Key: ', 'mollom')); $private_key->add_validator('validate_required'); $private_key->add_validator(array($this, 'validate_private_key')); $register = $ui->append('static', 'register', '<a href="http://mollom.com/user/register">' . _t('Get A New Mollom API Key.', 'mollom') . '</a>'); $ui->append('submit', 'save', _t('Save')); $ui->on_success(array($this, 'formui_submit')); $ui->out(); break; } } }