コード例 #1
0
 public function table_row($row, $formdata, $errors = array())
 {
     $input = scbForms::input($row, $formdata);
     // If row has an error, highlight it
     $style = in_array($row['name'], $errors) ? 'style= "background-color: #FFCCCC"' : '';
     return html('tr', html("th {$style} scope='row'", $row['title']), html("td {$style}", $input));
 }
コード例 #2
0
 /**
  *
  * @since 2.0.0
  *
  * @return string
  */
 public function render()
 {
     $parts = array(html('div class="intro-text"', html('h2', __('Get Started with Postmatic', 'Postmatic')), html('p', __('Build relationships, engage your community, and grow your platform using Postmatic.', 'Postmatic'))));
     $parts[] = $this->feature_chooser_html();
     $table_entries = array(array('title' => __('Postmatic Api Key', 'Postmatic'), 'type' => 'text', 'name' => 'prompt_key', 'extra' => array('class' => 'regular-text last-submit')));
     $this->override_entries($table_entries);
     $parts[] = $this->table($table_entries, $this->options->get()) . html('div class="opt-in"', html('div', html('h3', __('Improve your site by making Postmatic even better', 'Postmatic')), html('p', __('We rely on users like you to help shape our development roadmap. By checking the box below you will be helping us know more about your site and how we can make Postmatic even better.', 'Postmatic'))), scbForms::input(array('type' => 'checkbox', 'name' => 'enable_collection', 'desc' => html('strong', __('Yes, send periodic usage statistics to Postmatic.', 'Postmatic'))), $this->options->get()));
     return $this->form_wrap(implode('', $parts));
 }
コード例 #3
0
function appthemes_list_gateway_dropdown($input_name = 'payment_gateway')
{
    $gateways = array();
    foreach (APP_Gateway_Registry::get_gateways() as $gateway) {
        // Skip disabled gateways
        if (!APP_Gateway_registry::is_gateway_enabled($gateway->identifier())) {
            continue;
        }
        $gateways[$gateway->identifier()] = $gateway->display_name('dropdown');
    }
    echo scbForms::input(array('type' => 'select', 'name' => $input_name, 'values' => $gateways, 'extra' => array('class' => 'required')));
}
コード例 #4
0
 protected function render_dropdown()
 {
     $direction = $this->ctype->flip_direction()->get_direction();
     $labels = $this->ctype->get('current', 'labels');
     if (isset($labels->dropdown_title)) {
         $title = $labels->dropdown_title;
     } elseif (isset($labels->column_title)) {
         $title = $labels->column_title;
     } else {
         $title = $this->title;
     }
     return scbForms::input(array('type' => 'select', 'name' => array('p2p', $this->ctype->name, $direction), 'choices' => self::get_choices($this->ctype), 'text' => $title), $_GET);
 }
コード例 #5
0
ファイル: class-meta-box.php プロジェクト: kalushta/darom
 /**
  * Returns table row.
  *
  * @param array $row
  * @param array $formdata
  * @param array $errors (optional)
  *
  * @return string
  */
 public function table_row($row, $formdata, $errors = array())
 {
     if (empty($row['tip'])) {
         $tip = '';
     } else {
         $tip = html("i", array('class' => 'at at-tip', 'data-tooltip' => APP_ToolTips::supports_wp_pointer() ? $row['tip'] : __('Click for more info', APP_TD)));
         if (!APP_ToolTips::supports_wp_pointer()) {
             $tip .= html("div class='tip-content'", $row['tip']);
         }
     }
     if (isset($row['desc'])) {
         $row['desc'] = html('span class="app-description"', $row['desc']);
     }
     $input = scbForms::input($row, $formdata);
     // If row has an error, highlight it
     $style = in_array($row['name'], $errors) ? 'style= "background-color: #FFCCCC"' : '';
     return html('tr', html("th {$style} scope='row'", html('label for="' . esc_attr($row['title']) . '"', $row['title']) . $tip), html("td {$style}", $input));
 }
コード例 #6
0
ファイル: Widget.php プロジェクト: realfluid/umbaugh
	protected function input( $args, $formdata = array() ) {
		// Add default class
		if ( !isset( $args['extra'] ) )
			$args['extra'] = 'class="regular-text"';

		// Add default label position
		if ( !in_array( $args['type'], array( 'checkbox', 'radio' ) ) && empty( $args['desc_pos'] ) )
			$args['desc_pos'] = 'before';

		// Then add prefix to names and formdata
		$new_formdata = array();
		foreach ( ( array ) $args['name'] as $name )
			$new_formdata[$this->scb_get_field_name( $name )] = @$formdata[$name];
		$new_names = array_keys( $new_formdata );

		// Finally, replace the old names
		if ( 1 == count( $new_names ) )
			$args['name'] = $new_names[0];
		else
			$args['name'] = $new_names;

		return scbForms::input( $args, $new_formdata );
	}
コード例 #7
0
ファイル: settings.php プロジェクト: kalushta/darom
 function permalink_section_add_option($option)
 {
     global $cp_options;
     echo scbForms::input(array('type' => 'text', 'name' => 'cp_options[' . $option['id'] . ']', 'extra' => array('size' => 53), 'value' => $cp_options->{$option}['id']));
 }
コード例 #8
0
ファイル: AdminPage.php プロジェクト: realfluid/umbaugh
	function input( $args, $formdata = array() ) {
		if ( empty( $formdata ) )
			$formdata = $this->formdata;

		if ( isset( $args['name_tree'] ) ) {
			$tree = ( array ) $args['name_tree'];
			unset( $args['name_tree'] );

			$value = $formdata;
			$name = $this->option_name;
			foreach ( $tree as $key ) {
				$value = $value[$key];
				$name .= '[' . $key . ']';
			}

			$args['name'] = $name;
			unset( $args['names'] );

			unset( $args['values'] );

			$formdata = array( $name => $value );
		}

		return scbForms::input( $args, $formdata );
	}
コード例 #9
0
ファイル: AdminPage.php プロジェクト: sontv1003/vtcacademy
 function submit_button($value = '', $action = 'action', $class = "button")
 {
     if (is_array($value)) {
         extract(wp_parse_args($value, array('value' => __('Save Changes', $this->textdomain), 'action' => 'action', 'class' => 'button', 'ajax' => true)));
         if (!$ajax) {
             $class .= ' no-ajax';
         }
     } else {
         if (empty($value)) {
             $value = __('Save Changes', $this->textdomain);
         }
     }
     $input_args = array('type' => 'submit', 'names' => $action, 'values' => $value, 'extra' => '', 'desc' => false);
     if (!empty($class)) {
         $input_args['extra'] = "class='{$class}'";
     }
     $output = "<p class='submit'>\n" . scbForms::input($input_args) . "</p>\n";
     return $output;
 }
コード例 #10
0
 function submit_button($value = '', $action = 'action', $class = "button")
 {
     if (is_array($value)) {
         extract(wp_parse_args($value, array('value' => __('Save Changes', $this->textdomain), 'action' => 'action', 'class' => 'button', 'ajax' => true)));
         if (!$ajax) {
             $class .= ' no-ajax';
         }
     } else {
         if (empty($value)) {
             $value = __('Save Changes', $this->textdomain);
         }
     }
     $input_args = array('type' => 'submit', 'name' => $action, 'value' => $value, 'extra' => '', 'desc' => false, 'wrap' => html('p class="submit"', scbForms::TOKEN));
     if (!empty($class)) {
         $input_args['extra'] = compact('class');
     }
     return scbForms::input($input_args);
 }
コード例 #11
0
ファイル: user.php プロジェクト: postmatic/beta-dist
 /**
  * @since 1.0.0
  *
  * @param Prompt_Interface_Subscribable $list
  * @return string
  */
 protected function profile_subscription_checkbox(Prompt_Interface_Subscribable $list)
 {
     $name = strtolower(get_class($list)) . '_subscribed[]';
     return scbForms::input(array('name' => $name, 'type' => 'checkbox', 'value' => $list->id(), 'desc' => $list->subscribe_prompt(), 'checked' => $list->is_subscribed($this->id), 'extra' => array('disabled' => !$list->is_subscribed($this->id) and !$this->is_current_user())));
 }
コード例 #12
0
 public function render_form()
 {
     $form_html = '';
     if ('publish' == $this->post->post_status or count($this->sent_recipient_ids) >= count($this->recipient_ids)) {
         return $form_html;
     }
     $form_html .= html('p', scbForms::input(array('type' => 'checkbox', 'name' => self::$no_email_name, 'desc' => __('Do not deliver this post via email.', 'Postmatic'), 'checked' => self::suppress_email($this->post->ID))));
     $form_html .= html('p', scbForms::input(array('type' => 'checkbox', 'name' => self::$excerpt_only_name, 'desc' => __('Include only the post excerpt in email.', 'Postmatic'), 'checked' => self::excerpt_only($this->post->ID))));
     if (Prompt_Enum_Email_Transports::API == Prompt_Core::$options->get('email_transport')) {
         $form_html .= html('p', scbForms::input(array('type' => 'checkbox', 'name' => self::$no_featured_image_name, 'desc' => __('Do not use the featured image in email.', 'Postmatic'), 'checked' => self::suppress_featured_image($this->post->ID))));
     }
     $form_html .= html('p', html('input', array('type' => 'submit', 'name' => self::$preview_email_name, 'value' => __('Send me a preview email', 'Postmatic'), 'class' => 'button')));
     return $form_html;
 }
コード例 #13
0
 public function table_row($field, $formdata = false)
 {
     if (empty($field['tip'])) {
         $tip = '';
     } else {
         $tip = html("img", array('class' => 'tip-icon', 'title' => __('Help', APP_TD), 'src' => appthemes_framework_image('help.png')));
         $tip .= html("div class='tip-content'", $field['tip']);
     }
     if (isset($field['desc'])) {
         $field['desc'] = html('span class="description"', $field['desc']);
     }
     return html("tr", html("th scope='row'", $field['title']), html("td class='tip'", $tip), html("td", scbForms::input($field, $this->options->get())));
 }
コード例 #14
0
ファイル: class-tabs-page.php プロジェクト: kalushta/darom
 public function table_row($field, $formdata = false)
 {
     if (empty($field['tip'])) {
         $tip = '';
     } else {
         $tip = html('i', array('class' => 'at at-tip', 'data-tooltip' => APP_ToolTips::supports_wp_pointer() ? $field['tip'] : __('Click for more info', APP_TD)));
         if (!APP_ToolTips::supports_wp_pointer()) {
             $tip .= html("div class='tip-content'", $field['tip']);
         }
     }
     if (isset($field['desc'])) {
         // wrap textareas and regular-text fields in <p> tag
         // TODO: doesn't catch wrap_upload() instances for buttons
         if (in_array($field['type'], array('text', 'textarea', 'submit'))) {
             if (!isset($field['extra']['class']) || strpos($field['extra']['class'], 'small-text') === false) {
                 $field['desc'] = html('p class="description"', $field['desc']);
             }
         }
     }
     $input = scbForms::input($field, $formdata);
     // wrap radio buttons in a <fieldset> tag following what WP also does
     if ('radio' == $field['type']) {
         $input = html('fieldset', $input);
     }
     return html("tr", html("th scope='row app-row'", html('label for="' . esc_attr($field['title']) . '"', $field['title']) . $tip), html("td", $input));
 }
コード例 #15
0
 public static function after_form()
 {
     if (!Prompt_Core::$options->get('enable_comment_delivery') or empty(self::$prompt_post)) {
         return;
     }
     $current_user = Prompt_User_Handling::current_user();
     if (!$current_user or !self::$prompt_post->is_subscribed($current_user->ID)) {
         return;
     }
     echo html('div class="prompt-unsubscribe"', html('div class=".loading-indicator" style="display: none;"', html('img', array('src' => path_join(Prompt_Core::$url_path, 'media/ajax-loader.gif')))), html('p', __('You are subscribed to new comments on this post.', 'Postmatic')), scbForms::input(array('type' => 'submit', 'name' => self::UNSUBSCRIBE_ACTION, 'value' => __('Unsubscribe', 'Postmatic'))));
 }
コード例 #16
0
 function render_cronjob_fields($section, $section_id)
 {
     $output = '';
     if (empty($section['fields'])) {
         $output = __('You haven&#39;t created any cron job tasks yet.', APP_TD);
         echo $this->table_wrap($output);
         return;
     }
     $output .= html("tr", html("th", html('strong', __('Hook Name', APP_TD))), html("th", html('strong', __('Frequency', APP_TD))), html("th", html('strong', __('Next Run Date', APP_TD))));
     $fields = $this->cronjob_fields();
     foreach ($fields as $field) {
         if (isset($field['desc'])) {
             $field['desc'] = html('span class="description"', $field['desc']);
         }
         $output .= html("tr", html("th scope='row'", $field['title']), html("td class='frequency'", html('span class="description"', $field['tip'])), html("td", scbForms::input($field, $this->options->get())));
     }
     echo $this->table_wrap($output);
 }
コード例 #17
0
 function input($args, $options = NULL)
 {
     if ($options === NULL) {
         $options = $this->formdata;
     }
     return scbForms::input($args, $options);
 }
コード例 #18
0
ファイル: AdminPage.php プロジェクト: bi0xid/youare-plugins
 function submit_button($value = 'Save Changes', $action = 'action', $class = "button")
 {
     if (empty($value)) {
         return;
     }
     $args = array('type' => 'submit', 'names' => $action, 'values' => $value, 'extra' => '', 'desc' => false);
     if (!empty($class)) {
         $args['extra'] = "class='{$class}'";
     }
     $output = "<p class='submit'>\n" . parent::input($args) . "</p>\n";
     return $output;
 }
コード例 #19
0
ファイル: gateway-functions.php プロジェクト: kalushta/darom
/**
 * Displays a dropdown form with currently active gateways
 * @param  string $input_name Name of the input field
 * @return void
 */
function appthemes_list_gateway_dropdown($input_name = 'payment_gateway', $recurring = false, $args = array())
{
    if (is_array($input_name)) {
        $args = $input_name;
        $input_name = 'payment_gateway';
    }
    $args = wp_parse_args($args, array('input_name' => $input_name, 'recurring' => $recurring, 'service' => 'instant', 'empty_text' => __('No payment gateways are available.', APP_TD), 'disabled_text' => __(' (disabled)', APP_TD), 'admin_text' => __('Note: Disabled gateways are only available to administrators.', APP_TD)));
    $gateways = array();
    foreach (APP_Gateway_Registry::get_gateways($args['service']) as $gateway) {
        if ($args['recurring'] && !$gateway->is_recurring()) {
            continue;
        }
        $text = $gateway->display_name('dropdown');
        if (!APP_Gateway_registry::is_gateway_enabled($gateway->identifier(), $args['service'])) {
            if (current_user_can('manage_options')) {
                $text .= $args['disabled_text'];
            } else {
                continue;
            }
        }
        $gateways[$gateway->identifier()] = $text;
    }
    if (empty($gateways)) {
        $gateways[''] = $args['empty_text'];
    }
    echo scbForms::input(array('type' => 'select', 'name' => $input_name, 'values' => $gateways, 'extra' => array('class' => 'required')));
    if (current_user_can('manage_options')) {
        echo html('p', array(), $args['admin_text']);
    }
}
コード例 #20
0
ファイル: dropdown.php プロジェクト: Nsteinel/jmb
 protected function render_dropdown()
 {
     $direction = $this->ctype->flip_direction()->get_direction();
     return scbForms::input(array('type' => 'select', 'name' => array('p2p', $this->ctype->name, $direction), 'choices' => self::get_choices($this->ctype), 'text' => $this->title), $_GET);
 }
コード例 #21
0
 /**
  * Returns table row.
  *
  * @param array $row
  * @param array $formdata
  *
  * @return string
  */
 public function table_row($row, $formdata)
 {
     $name = $row['name'];
     // Wrap description in span tag
     if (isset($row['desc'])) {
         $row['desc'] = $this->wrap_desc($row['desc']);
     }
     // Get input html
     $input = scbForms::input($row, $formdata);
     // Remove unnecessary label wrapper
     $input = str_replace(array('<label>', '</label>'), '', $input);
     // Wrap into table row
     return html('tr', html('th', html('label', array('for' => $name), $row['title'])), html('td', $input));
 }
コード例 #22
0
ファイル: Forms.php プロジェクト: sontv1003/vtcacademy
 function input($args)
 {
     $value = scbForms::get_value($args['name'], $this->data);
     if (!is_null($value)) {
         switch ($args['type']) {
             case 'select':
             case 'radio':
                 $args['selected'] = $value;
                 break;
             case 'checkbox':
                 if (is_array($value)) {
                     $args['checked'] = $value;
                 } else {
                     $args['checked'] = $value || isset($args['value']) && $value == $args['value'];
                 }
                 break;
             default:
                 $args['value'] = $value;
         }
     }
     if (!empty($this->prefix)) {
         $args['name'] = array_merge($this->prefix, (array) $args['name']);
     }
     return scbForms::input($args);
 }