function form($instance) { echo Util::html('p', $this->input(array('type' => 'text', 'name' => 'title', 'desc' => __('Title:', WPPM_DOMAIN)), $instance)); echo Util::html('p', $this->input(array('type' => 'url', 'name' => 'facebook_url', 'desc' => __('Facebook Url:', WPPM_DOMAIN)), $instance)); echo Util::html('p', $this->input(array('type' => 'url', 'name' => 'twitter_url', 'desc' => __('Twitter Url:', WPPM_DOMAIN)), $instance)); echo Util::html('p', $this->input(array('type' => 'url', 'name' => 'linkedin_url', 'desc' => __('LinkedIn Url:', WPPM_DOMAIN)), $instance)); echo Util::html('p', $this->input(array('type' => 'url', 'name' => 'gplus_url', 'desc' => __('Google plus Url:', WPPM_DOMAIN)), $instance)); }
/** * Generate the corresponding HTML for a field. * * @param array $args * * @return string */ protected function _render_specific($args) { $args = wp_parse_args($args, array('text' => false, 'extra' => array())); $options = array(); if (false !== $args['text']) { $options[] = array('value' => '', 'selected' => $args['selected'] === array('foo'), 'title' => $args['text']); } foreach ($args['choices'] as $value => $title) { $value = (string) $value; $options[] = array('value' => $value, 'selected' => $value == $args['selected'], 'title' => $title); } $opts = ''; foreach ($options as $option) { $opts .= Util::html('option', array('value' => $option['value'], 'selected' => $option['selected']), $option['title']); } $args['extra']['name'] = $args['name']; $input = Util::html('select', $args['extra'], $opts); return FormField::add_label($input, $args['desc'], $args['desc_pos']); }
/** * Wraps a content in a table row. * * @param string $title * @param string $content * * @return string */ public static function row_wrap($title, $content) { return Util::html('tr', Util::html("th scope='row'", $title), Util::html('td', $content)); }
/** * Displays notices. * * @param array|string $notices * @param string $class (optional) * * @return void */ public function display_notices($notices, $class = 'updated') { // add inline class so the notices stays in metabox $class .= ' inline'; foreach ((array) $notices as $notice) { echo Util::admin_notice($notice, $class); } }
/** * Wraps a form field in a label, and position field description. * * @param string $input * @param string $desc * @param string $desc_pos * * @return string */ protected static function add_label($input, $desc, $desc_pos) { return Util::html('label', self::add_desc($input, $desc, $desc_pos)) . "\n"; }