예제 #1
0
    /**
     * Displays the widget control options in the Widgets admin screen.
     * @since 0.6.0
     */
    function form($instance)
    {
        /* Set up the default form values. */
        $defaults = array('title' => esc_attr__('Pages', 'hybrid-core'), 'depth' => 0, 'number' => '', 'offset' => '', 'child_of' => '', 'include' => array(), 'exclude' => array(), 'exclude_tree' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => array(), 'link_before' => '', 'link_after' => '', 'show_date' => '', 'hierarchical' => true, 'sort_column' => 'post_title', 'sort_order' => 'ASC', 'date_format' => get_option('date_format'));
        /* Merge the user-selected arguments with the defaults. */
        $instance = wp_parse_args((array) $instance, $defaults);
        $posts = get_posts(array('post_type' => 'page', 'post_status' => 'any', 'post_mime_type' => '', 'orderby' => 'title', 'order' => 'ASC', 'numberposts' => -1));
        $authors = array();
        foreach ($posts as $post) {
            $authors[$post->post_author] = get_the_author_meta('display_name', $post->post_author);
        }
        $sort_order = array('ASC' => esc_attr__('Ascending', 'hybrid-core'), 'DESC' => esc_attr__('Descending', 'hybrid-core'));
        $sort_column = array('post_author' => esc_attr__('Author', 'hybrid-core'), 'post_date' => esc_attr__('Date', 'hybrid-core'), 'ID' => esc_attr__('ID', 'hybrid-core'), 'menu_order' => esc_attr__('Menu Order', 'hybrid-core'), 'post_modified' => esc_attr__('Modified', 'hybrid-core'), 'post_name' => esc_attr__('Slug', 'hybrid-core'), 'post_title' => esc_attr__('Title', 'hybrid-core'));
        $show_date = array('' => '', 'created' => esc_attr__('Created', 'hybrid-core'), 'modified' => esc_attr__('Modified', 'hybrid-core'));
        $meta_key = array_merge(array(''), (array) get_meta_keys());
        ?>

		<div class="hybrid-widget-controls columns-3">
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', 'hybrid-core');
        ?>
</label>
			<input type="text" class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('sort_order');
        ?>
"><code>sort_order</code></label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('sort_order');
        ?>
" name="<?php 
        echo $this->get_field_name('sort_order');
        ?>
">
				<?php 
        foreach ($sort_order as $option_value => $option_label) {
            ?>
					<option value="<?php 
            echo esc_attr($option_value);
            ?>
" <?php 
            selected($instance['sort_order'], $option_value);
            ?>
><?php 
            echo esc_html($option_label);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('sort_column');
        ?>
"><code>sort_column</code></label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('sort_column');
        ?>
" name="<?php 
        echo $this->get_field_name('sort_column');
        ?>
">
				<?php 
        foreach ($sort_column as $option_value => $option_label) {
            ?>
					<option value="<?php 
            echo esc_attr($option_value);
            ?>
" <?php 
            selected($instance['sort_column'], $option_value);
            ?>
><?php 
            echo esc_html($option_label);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('depth');
        ?>
"><code>depth</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('depth');
        ?>
" name="<?php 
        echo $this->get_field_name('depth');
        ?>
" value="<?php 
        echo esc_attr($instance['depth']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('number');
        ?>
"><code>number</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('number');
        ?>
" name="<?php 
        echo $this->get_field_name('number');
        ?>
" value="<?php 
        echo esc_attr($instance['number']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('offset');
        ?>
"><code>offset</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('offset');
        ?>
" name="<?php 
        echo $this->get_field_name('offset');
        ?>
" value="<?php 
        echo esc_attr($instance['offset']);
        ?>
"  />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('child_of');
        ?>
"><code>child_of</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('child_of');
        ?>
" name="<?php 
        echo $this->get_field_name('child_of');
        ?>
" value="<?php 
        echo esc_attr($instance['child_of']);
        ?>
" />
		</p>
		</div>

		<div class="hybrid-widget-controls columns-3">
		<p>
			<label for="<?php 
        echo $this->get_field_id('include');
        ?>
"><code>include</code></label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('include');
        ?>
" name="<?php 
        echo $this->get_field_name('include');
        ?>
[]" size="4" multiple="multiple">
				<?php 
        foreach ($posts as $post) {
            ?>
					<option value="<?php 
            echo esc_attr($post->ID);
            ?>
" <?php 
            echo in_array($post->ID, (array) $instance['include']) ? 'selected="selected"' : '';
            ?>
><?php 
            echo esc_html($post->post_title);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('exclude');
        ?>
"><code>exclude</code></label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('exclude');
        ?>
" name="<?php 
        echo $this->get_field_name('exclude');
        ?>
[]" size="4" multiple="multiple">
				<?php 
        foreach ($posts as $post) {
            ?>
					<option value="<?php 
            echo esc_attr($post->ID);
            ?>
" <?php 
            echo in_array($post->ID, (array) $instance['exclude']) ? 'selected="selected"' : '';
            ?>
><?php 
            echo esc_html($post->post_title);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('exclude_tree');
        ?>
"><code>exclude_tree</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('exclude_tree');
        ?>
" name="<?php 
        echo $this->get_field_name('exclude_tree');
        ?>
" value="<?php 
        echo esc_attr($instance['exclude_tree']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('meta_key');
        ?>
"><code>meta_key</code></label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('meta_key');
        ?>
" name="<?php 
        echo $this->get_field_name('meta_key');
        ?>
">
				<?php 
        foreach ($meta_key as $meta) {
            ?>
					<option value="<?php 
            echo esc_attr($meta);
            ?>
" <?php 
            selected($instance['meta_key'], $meta);
            ?>
><?php 
            echo esc_html($meta);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('meta_value');
        ?>
"><code>meta_value</code></label>
			<input type="text" class="widefat code" id="<?php 
        echo $this->get_field_id('meta_value');
        ?>
" name="<?php 
        echo $this->get_field_name('meta_value');
        ?>
" value="<?php 
        echo esc_attr($instance['meta_value']);
        ?>
" />
		</p>
		</div>

		<div class="hybrid-widget-controls columns-3 column-last">
		<p>
			<label for="<?php 
        echo $this->get_field_id('authors');
        ?>
"><code>authors</code></label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('authors');
        ?>
" name="<?php 
        echo $this->get_field_name('authors');
        ?>
[]" size="4" multiple="multiple">
				<?php 
        foreach ($authors as $option_value => $option_label) {
            ?>
					<option value="<?php 
            echo esc_attr($option_value);
            ?>
" <?php 
            echo in_array($option_value, (array) $instance['authors']) ? 'selected="selected"' : '';
            ?>
><?php 
            echo esc_html($option_label);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('link_before');
        ?>
"><code>link_before</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('link_before');
        ?>
" name="<?php 
        echo $this->get_field_name('link_before');
        ?>
" value="<?php 
        echo esc_attr($instance['link_before']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('link_after');
        ?>
"><code>link_after</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('link_after');
        ?>
" name="<?php 
        echo $this->get_field_name('link_after');
        ?>
" value="<?php 
        echo esc_attr($instance['link_after']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_date');
        ?>
"><code>show_date</code></label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('show_date');
        ?>
" name="<?php 
        echo $this->get_field_name('show_date');
        ?>
">
				<?php 
        foreach ($show_date as $option_value => $option_label) {
            ?>
					<option value="<?php 
            echo esc_attr($option_value);
            ?>
" <?php 
            selected($instance['show_date'], $option_value);
            ?>
><?php 
            echo esc_html($option_label);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('date_format');
        ?>
"><code>date_format</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('date_format');
        ?>
" name="<?php 
        echo $this->get_field_name('date_format');
        ?>
" value="<?php 
        echo esc_attr($instance['date_format']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('hierarchical');
        ?>
">
			<input class="checkbox" type="checkbox" <?php 
        checked($instance['hierarchical'], true);
        ?>
 id="<?php 
        echo $this->get_field_id('hierarchical');
        ?>
" name="<?php 
        echo $this->get_field_name('hierarchical');
        ?>
" /> <?php 
        _e('Hierarchical?', 'hybrid-core');
        ?>
 <code>hierarchical</code></label>
		</p>
		</div>
		<div style="clear:both;">&nbsp;</div>
	<?php 
    }
예제 #2
0
    /**
     * Displays the widget control options in the Widgets admin screen.
     *
     * @since 0.6.0
     */
    function form($instance)
    {
        /* Merge the user-selected arguments with the defaults. */
        $instance = wp_parse_args((array) $instance, $this->defaults);
        $post_types = get_post_types(array('public' => true, 'hierarchical' => true), 'objects');
        $sort_order = array('ASC' => esc_attr__('Ascending', 'hybrid-core'), 'DESC' => esc_attr__('Descending', 'hybrid-core'));
        $sort_column = array('post_author' => esc_attr__('Author', 'hybrid-core'), 'post_date' => esc_attr__('Date', 'hybrid-core'), 'ID' => esc_attr__('ID', 'hybrid-core'), 'menu_order' => esc_attr__('Menu Order', 'hybrid-core'), 'post_modified' => esc_attr__('Modified', 'hybrid-core'), 'post_name' => esc_attr__('Slug', 'hybrid-core'), 'post_title' => esc_attr__('Title', 'hybrid-core'));
        $show_date = array('' => '', 'created' => esc_attr__('Created', 'hybrid-core'), 'modified' => esc_attr__('Modified', 'hybrid-core'));
        $meta_key = array_merge(array(''), (array) get_meta_keys());
        ?>

		<div class="hybrid-widget-controls columns-3">
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', 'hybrid-core');
        ?>
</label>
			<input type="text" class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('post_type');
        ?>
"><code>post_type</code></label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('post_type');
        ?>
" name="<?php 
        echo $this->get_field_name('post_type');
        ?>
">
				<?php 
        foreach ($post_types as $post_type) {
            ?>
					<option value="<?php 
            echo esc_attr($post_type->name);
            ?>
" <?php 
            selected($instance['post_type'], $post_type->name);
            ?>
><?php 
            echo esc_html($post_type->labels->singular_name);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('sort_order');
        ?>
"><code>sort_order</code></label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('sort_order');
        ?>
" name="<?php 
        echo $this->get_field_name('sort_order');
        ?>
">
				<?php 
        foreach ($sort_order as $option_value => $option_label) {
            ?>
					<option value="<?php 
            echo esc_attr($option_value);
            ?>
" <?php 
            selected($instance['sort_order'], $option_value);
            ?>
><?php 
            echo esc_html($option_label);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('sort_column');
        ?>
"><code>sort_column</code></label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('sort_column');
        ?>
" name="<?php 
        echo $this->get_field_name('sort_column');
        ?>
">
				<?php 
        foreach ($sort_column as $option_value => $option_label) {
            ?>
					<option value="<?php 
            echo esc_attr($option_value);
            ?>
" <?php 
            selected($instance['sort_column'], $option_value);
            ?>
><?php 
            echo esc_html($option_label);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('depth');
        ?>
"><code>depth</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('depth');
        ?>
" name="<?php 
        echo $this->get_field_name('depth');
        ?>
" value="<?php 
        echo esc_attr($instance['depth']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('number');
        ?>
"><code>number</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('number');
        ?>
" name="<?php 
        echo $this->get_field_name('number');
        ?>
" value="<?php 
        echo esc_attr($instance['number']);
        ?>
" />
		</p>
		</div>

		<div class="hybrid-widget-controls columns-3">
		<p>
			<label for="<?php 
        echo $this->get_field_id('offset');
        ?>
"><code>offset</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('offset');
        ?>
" name="<?php 
        echo $this->get_field_name('offset');
        ?>
" value="<?php 
        echo esc_attr($instance['offset']);
        ?>
"  />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('child_of');
        ?>
"><code>child_of</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('child_of');
        ?>
" name="<?php 
        echo $this->get_field_name('child_of');
        ?>
" value="<?php 
        echo esc_attr($instance['child_of']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('include');
        ?>
"><code>include</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('include');
        ?>
" name="<?php 
        echo $this->get_field_name('include');
        ?>
" value="<?php 
        echo esc_attr($instance['include']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('exclude');
        ?>
"><code>exclude</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('exclude');
        ?>
" name="<?php 
        echo $this->get_field_name('exclude');
        ?>
" value="<?php 
        echo esc_attr($instance['exclude']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('exclude_tree');
        ?>
"><code>exclude_tree</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('exclude_tree');
        ?>
" name="<?php 
        echo $this->get_field_name('exclude_tree');
        ?>
" value="<?php 
        echo esc_attr($instance['exclude_tree']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('meta_key');
        ?>
"><code>meta_key</code></label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('meta_key');
        ?>
" name="<?php 
        echo $this->get_field_name('meta_key');
        ?>
">
				<?php 
        foreach ($meta_key as $meta) {
            ?>
					<option value="<?php 
            echo esc_attr($meta);
            ?>
" <?php 
            selected($instance['meta_key'], $meta);
            ?>
><?php 
            echo esc_html($meta);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('meta_value');
        ?>
"><code>meta_value</code></label>
			<input type="text" class="widefat code" id="<?php 
        echo $this->get_field_id('meta_value');
        ?>
" name="<?php 
        echo $this->get_field_name('meta_value');
        ?>
" value="<?php 
        echo esc_attr($instance['meta_value']);
        ?>
" />
		</p>
		</div>

		<div class="hybrid-widget-controls columns-3 column-last">
		<p>
			<label for="<?php 
        echo $this->get_field_id('authors');
        ?>
"><code>authors</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('authors');
        ?>
" name="<?php 
        echo $this->get_field_name('authors');
        ?>
" value="<?php 
        echo esc_attr($instance['authors']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('link_before');
        ?>
"><code>link_before</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('link_before');
        ?>
" name="<?php 
        echo $this->get_field_name('link_before');
        ?>
" value="<?php 
        echo esc_attr($instance['link_before']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('link_after');
        ?>
"><code>link_after</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('link_after');
        ?>
" name="<?php 
        echo $this->get_field_name('link_after');
        ?>
" value="<?php 
        echo esc_attr($instance['link_after']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_date');
        ?>
"><code>show_date</code></label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('show_date');
        ?>
" name="<?php 
        echo $this->get_field_name('show_date');
        ?>
">
				<?php 
        foreach ($show_date as $option_value => $option_label) {
            ?>
					<option value="<?php 
            echo esc_attr($option_value);
            ?>
" <?php 
            selected($instance['show_date'], $option_value);
            ?>
><?php 
            echo esc_html($option_label);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('date_format');
        ?>
"><code>date_format</code></label>
			<input type="text" class="smallfat code" id="<?php 
        echo $this->get_field_id('date_format');
        ?>
" name="<?php 
        echo $this->get_field_name('date_format');
        ?>
" value="<?php 
        echo esc_attr($instance['date_format']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('hierarchical');
        ?>
">
			<input class="checkbox" type="checkbox" <?php 
        checked($instance['hierarchical'], true);
        ?>
 id="<?php 
        echo $this->get_field_id('hierarchical');
        ?>
" name="<?php 
        echo $this->get_field_name('hierarchical');
        ?>
" /> <?php 
        _e('Hierarchical?', 'hybrid-core');
        ?>
 <code>hierarchical</code></label>
		</p>
		</div>
		<div style="clear:both;">&nbsp;</div>
	<?php 
    }
    public function form($instance = array())
    {
        wp_enqueue_script('ithoughts-plugins-statizer-options');
        wp_enqueue_style('ithoughts-plugins-statizer-taggle');
        $instance = wp_parse_args($instance, array('title' => __('Plugin stat', 'ithoughts_plugins_statizer'), "theme" => "various", 'plugins' => array(), 'postmeta' => "", 'days' => 10, 'ajaxed' => true));
        $options = ithoughts_plugins_statizer_interface::getiThoughtsPluginsStatizer()->getOptions();
        $pluginsMonitored = '<option value="">' . __("( None )", "ithoughts_plugins_statizer") . '</option>';
        foreach ($options["plugins"] as $plugin) {
            $pluginsMonitored .= "<option value=\"{$plugin}\"" . (in_array($plugin, $instance["plugins"]) ? " selected=\"selected\"" : "") . ">{$plugin}</option>";
        }
        $metaKeys = get_meta_keys();
        $metaDatalist = "";
        foreach ($metaKeys as $metaKey) {
            $metaDatalist .= "<option value=\"{$metaKey}\">";
        }
        ?>
<table>
	<tr>
		<td>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title', 'ithoughts_tooltip_glossary');
        ?>
</label>
		</td>
		<td>
			<input autocomplete="off" class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" />
		</td>
	</tr>
	<tr>
		<td>
			<label for="<?php 
        echo $this->get_field_id('theme');
        ?>
"><?php 
        _e("Theme", "ithoughts_plugins_statizer");
        ?>
</label>
		</td>
		<td>
			<input type="text" id="<?php 
        echo $this->get_field_id('theme');
        ?>
" name="<?php 
        echo $this->get_field_name('theme');
        ?>
" value="<?php 
        echo $instance["theme"];
        ?>
"/>
		</td>
	</tr>
	<tr>
		<td>
			<label for="<?php 
        echo $this->get_field_id('plugins[]');
        ?>
"><?php 
        _e("Plugins monitored", "ithoughts_plugins_statizer");
        ?>
</label>
		</td>
		<td>
			<select id="<?php 
        echo $this->get_field_id('plugins[]');
        ?>
" name="<?php 
        echo $this->get_field_name('plugins[]');
        ?>
" multiple="multiple">
				<?php 
        echo $pluginsMonitored;
        ?>
			</select>
		</td>
	</tr>
	<tr>
		<td>
			<label for="<?php 
        echo $this->get_field_id('postmeta');
        ?>
"><?php 
        _e("Or post-meta", "ithoughts_plugins_statizer");
        ?>
</label>
		</td>
		<td>
			<input type="text" list="metaDatalist" id="<?php 
        echo $this->get_field_id('postmeta');
        ?>
" name="<?php 
        echo $this->get_field_name('postmeta');
        ?>
" value="<?php 
        echo $instance["postmeta"];
        ?>
"/>
			<datalist id="metaDatalist">
				<?php 
        echo $metaDatalist;
        ?>
			</datalist>
		</td>
	</tr>
	<tr>
		<td>
			<label for="<?php 
        echo $this->get_field_id('days');
        ?>
"><?php 
        _e("Days displayed", "ithoughts_plugins_statizer");
        ?>
</label>
		</td>
		<td>
			<input type="number" min="0" id="<?php 
        echo $this->get_field_id('days');
        ?>
" name="<?php 
        echo $this->get_field_name('days');
        ?>
" value="<?php 
        echo $instance["days"];
        ?>
"/>
		</td>
	</tr>
	<tr>
		<td>
			<label for="<?php 
        echo $this->get_field_id('ajaxed');
        ?>
"><?php 
        _e("Load via Ajax", "ithoughts_plugins_statizer");
        ?>
</label>
		</td>
		<td>
			<input type="checkbox" id="<?php 
        echo $this->get_field_id('ajaxed');
        ?>
" name="<?php 
        echo $this->get_field_name('ajaxed');
        ?>
" value="ajaxed" <?php 
        echo $instance["ajaxed"] ? " checked" : "";
        ?>
/>
		</td>
	</tr>
</table>
<?php 
    }
예제 #4
0
    function form($instance)
    {
        /* Set up the defaults. */
        $defaults = array('title' => '', 'display' => 'ul', 'post_status' => array('publish'), 'post_type' => array('post'), 'post_mime_type' => array(''), 'order' => 'DESC', 'orderby' => 'date', 'caller_get_posts' => true, 'enable_pagination' => true, 'posts_per_page' => get_option('posts_per_page'), 'offset' => '0', 'author' => '', 'wp_reset_query' => true, 'meta_compare' => '', 'meta_key' => '', 'meta_value' => '', 'year' => '', 'monthnum' => '', 'w' => '', 'day' => '', 'hour' => '', 'minute' => '', 'second' => '', 'post_parent' => '', 'entry_container' => 'div', 'show_entry_title' => true, 'entry_title' => 'h2', 'wp_link_pages' => true, 'error_message' => __('Apologies, but no results were found.', 'bizzthemes'), 'post_author' => false, 'post_date' => true, 'post_comments' => true, 'post_categories' => false, 'post_tags' => false, 'post_edit' => false, 'thumb_display' => false, 'thumb_selflink' => false, 'thumb_width' => 150, 'thumb_height' => 150, 'thumb_align' => 'alignright', 'thumb_cropp' => 'c', 'thumb_filter' => '', 'thumb_sharpen' => '', 'post_columns' => 1, 'remove_posts' => false, 'full_posts' => false, 'read_more' => true, 'read_more_text' => __('Continue reading', 'bizzthemes'));
        $instance = wp_parse_args((array) $instance, $defaults);
        $number_posts = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20");
        $thumb_align = array("alignleft" => "Left", "aligncenter" => "Center", "alignright" => "Right");
        $post_columns = array("1" => "One Column", "2" => "Two Columns", "3" => "Three Columns", "4" => "Four Columns");
        $thumb_cropp = array("c" => "Center", "t" => "Top", "tr" => "Top Right", "tl" => "Top Left", "b" => "Bottom", "bl" => "Bottom Left", "br" => "Bottom Right", "l" => "Left", "r" => "Right");
        ?>


		<div class="bizz-widget-controls" style="float:left;width:23%;"><?php 
        /* Widget title. */
        query_posts_input_text('Title:', $this->get_field_id('title'), $this->get_field_name('title'), $instance['title']);
        echo '<small class="section">Select Posts</small>';
        /* Post statuses. */
        $stati = get_post_stati('', 'objects');
        foreach ($stati as $status) {
            $statuses[$status->name] = $status->label;
        }
        $statuses['inherit'] = __('Inherit', 'bizzthemes');
        query_posts_select_multiple('Post status:', $this->get_field_id('post_status'), $this->get_field_name('post_status'), $instance['post_status'], $statuses, false);
        /* Post types. */
        $post_types = array('any' => __('Any', 'bizzthemes'));
        foreach (get_post_types(array('publicly_queryable' => true), 'objects') as $post_type) {
            $type_label = isset($post_type->singular_label) && $post_type->singular_label ? $post_type->singular_label : $post_type->label;
            $post_types[$post_type->name] = $type_label;
        }
        query_posts_select_multiple('Post type:', $this->get_field_id('post_type'), $this->get_field_name('post_type'), $instance['post_type'], $post_types, false);
        /* Post mime type. */
        $post_mime_types = get_available_post_mime_types();
        foreach ($post_mime_types as $post_mime_type) {
            $mime_types[$post_mime_type] = $post_mime_type;
        }
        $mime_types = isset($mime_types) ? $mime_types : '';
        query_posts_select_multiple('Post mime type:', $this->get_field_id('post_mime_type'), $this->get_field_name('post_mime_type'), $instance['post_mime_type'], $mime_types, false);
        /* Meta key. */
        foreach (get_meta_keys() as $meta) {
            $meta_keys[$meta] = $meta;
        }
        query_posts_select_single('Meta key:', $this->get_field_id('meta_key'), $this->get_field_name('meta_key'), $instance['meta_key'], $meta_keys, true);
        /* Meta value. */
        query_posts_input_text('Meta value:', $this->get_field_id('meta_value'), $this->get_field_name('meta_value'), $instance['meta_value']);
        /* Meta compare. */
        $operators = array('=' => '=', '!=' => '!=', '>' => '>', '>=' => '>=', '<' => '<', '<=' => '<=');
        query_posts_select_single('Meta compare:', $this->get_field_id('meta_compare'), $this->get_field_name('meta_compare'), $instance['meta_compare'], $operators, true);
        ?>
</div>

		<div class="bizz-widget-controls" style="float:left;width:23%;margin-left:2%;"><?php 
        /* Order. */
        query_posts_select_single('Order:', $this->get_field_id('order'), $this->get_field_name('order'), $instance['order'], array('ASC' => __('Ascending', 'bizzthemes'), 'DESC' => __('Descending', 'bizzthemes')), false);
        /* Order By. */
        $orderby_options = array('author' => __('Author', 'bizzthemes'), 'comment_count' => __('Comment Count', 'bizzthemes'), 'date' => __('Date', 'bizzthemes'), 'ID' => __('ID', 'bizzthemes'), 'menu_order' => __('Menu Order', 'bizzthemes'), 'meta_value' => __('Meta Value', 'bizzthemes'), 'modified' => __('Modified', 'bizzthemes'), 'none' => __('None', 'bizzthemes'), 'parent' => __('Parent', 'bizzthemes'), 'rand' => __('Random', 'bizzthemes'), 'title' => __('Title', 'bizzthemes'));
        query_posts_select_single('Order by:', $this->get_field_id('orderby'), $this->get_field_name('orderby'), $instance['orderby'], $orderby_options, false);
        echo '<small class="section">Pagination</small>';
        /* Enable pagination. */
        query_posts_input_checkbox(__('Enable pagination', 'bizzthemes'), $this->get_field_id('enable_pagination'), $this->get_field_name('enable_pagination'), checked($instance['enable_pagination'], true, false));
        /* Posts per page. */
        query_posts_input_text('Posts per page:', $this->get_field_id('posts_per_page'), $this->get_field_name('posts_per_page'), $instance['posts_per_page']);
        /* Offset. */
        query_posts_input_text('Offset:', $this->get_field_id('offset'), $this->get_field_name('offset'), $instance['offset']);
        echo '<small class="section">Date Filter</small>';
        /* Year. */
        query_posts_input_text_small('Years:', $this->get_field_id('year'), $this->get_field_name('year'), $instance['year']);
        /* Months. */
        query_posts_select_single('Month:', $this->get_field_id('monthnum'), $this->get_field_name('monthnum'), $instance['monthnum'], range(1, 12), true, 'smallfat', 'float:right;');
        /* Weeks. */
        query_posts_select_single('Week:', $this->get_field_id('w'), $this->get_field_name('w'), $instance['w'], range(1, 53), true, 'smallfat', 'float:right;');
        /* Days. */
        query_posts_select_single('Day:', $this->get_field_id('day'), $this->get_field_name('day'), $instance['day'], range(1, 31), true, 'smallfat', 'float:right;');
        /* Hours. */
        query_posts_select_single('Hour:', $this->get_field_id('hour'), $this->get_field_name('hour'), $instance['hour'], range(1, 23), true, 'smallfat', 'float:right;');
        /* Minutes. */
        query_posts_select_single('Minute;', $this->get_field_id('minute'), $this->get_field_name('minute'), $instance['minute'], range(1, 60), true, 'smallfat', 'float:right;');
        /* Seconds. */
        query_posts_select_single('Second:', $this->get_field_id('second'), $this->get_field_name('second'), $instance['second'], range(1, 60), true, 'smallfat', 'float:right;');
        ?>
</div>

		<div class="bizz-widget-controls" style="float:left;width:23%;margin-left:2%;"><?php 
        echo '<small class="section">Post Container</small>';
        /* Stickies. */
        query_posts_input_checkbox(__('Disable sticky posts', 'bizzthemes'), $this->get_field_id('caller_get_posts'), $this->get_field_name('caller_get_posts'), checked($instance['caller_get_posts'], true, false));
        /* Post container. */
        $containers = array('widget' => 'widget', 'div' => 'div', 'ul' => 'ul', 'ol' => 'ol');
        query_posts_select_single('Entry container', $this->get_field_id('entry_container'), $this->get_field_name('entry_container'), $instance['entry_container'], $containers, true);
        ?>

		<p>
			<label for="<?php 
        echo $this->get_field_id('post_columns');
        ?>
">Columns?</label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('post_columns');
        ?>
" name="<?php 
        echo $this->get_field_name('post_columns');
        ?>
">
				<?php 
        foreach ($post_columns as $option_value => $option_label) {
            ?>

					<option value="<?php 
            echo $option_value;
            ?>
" <?php 
            selected($instance['post_columns'], $option_value);
            ?>
><?php 
            echo $option_label;
            ?>
</option>
				<?php 
        }
        ?>

			</select>
		</p>
		<?php 
        /* Error message. */
        query_posts_textarea('Error message', $this->get_field_id('error_message'), $this->get_field_name('error_message'), $instance['error_message']);
        echo '<small class="section">Post Title</small>';
        /* Entry title. */
        query_posts_input_checkbox(__('Enable entry titles', 'bizzthemes'), $this->get_field_id('show_entry_title'), $this->get_field_name('show_entry_title'), checked($instance['show_entry_title'], true, false));
        /* Page links wp_link_pages(). */
        query_posts_input_checkbox(__('Enable title links', 'bizzthemes'), $this->get_field_id('wp_link_pages'), $this->get_field_name('wp_link_pages'), checked($instance['wp_link_pages'], true, false));
        /* Entry title markup. */
        $elements = array('h1' => 'h1', 'h2' => 'h2', 'h3' => 'h3', 'h4' => 'h4', 'h5' => 'h5', 'h6' => 'h6', 'p' => 'p', 'div' => 'div', 'span' => 'span');
        query_posts_select_single('Entry title', $this->get_field_id('entry_title'), $this->get_field_name('entry_title'), $instance['entry_title'], $elements, true);
        echo '<small class="section">Post Content</small>';
        /* Remove post content. */
        query_posts_input_checkbox(__('Remove post content', 'bizzthemes'), $this->get_field_id('remove_posts'), $this->get_field_name('remove_posts'), checked($instance['remove_posts'], true, false));
        /* Display full posts. */
        query_posts_input_checkbox(__('Display full content', 'bizzthemes'), $this->get_field_id('full_posts'), $this->get_field_name('full_posts'), checked($instance['full_posts'], true, false));
        /* Enable read more text. */
        query_posts_input_checkbox(__('Read More... text', 'bizzthemes'), $this->get_field_id('read_more'), $this->get_field_name('read_more'), checked($instance['read_more'], true, false));
        /* Read more text. */
        query_posts_input_text('', $this->get_field_id('read_more_text'), $this->get_field_name('read_more_text'), $instance['read_more_text']);
        ?>
</div>

		<div class="bizz-widget-controls" style="float:left;width:23%;margin-left:2%;">
		<small class="section">Post Meta</small>
		<p>
			<label for="<?php 
        echo $this->get_field_id('post_author');
        ?>
">
			<input class="checkbox" type="checkbox" <?php 
        checked($instance['post_author'], true);
        ?>
 id="<?php 
        echo $this->get_field_id('post_author');
        ?>
" name="<?php 
        echo $this->get_field_name('post_author');
        ?>
" /> <?php 
        _e('Post Author', 'bizzthemes');
        ?>
</label><br/>
			<label for="<?php 
        echo $this->get_field_id('post_date');
        ?>
">
			<input class="checkbox" type="checkbox" <?php 
        checked($instance['post_date'], true);
        ?>
 id="<?php 
        echo $this->get_field_id('post_date');
        ?>
" name="<?php 
        echo $this->get_field_name('post_date');
        ?>
" /> <?php 
        _e('Post Date', 'bizzthemes');
        ?>
</label><br/>
			<label for="<?php 
        echo $this->get_field_id('post_comments');
        ?>
">
			<input class="checkbox" type="checkbox" <?php 
        checked($instance['post_comments'], true);
        ?>
 id="<?php 
        echo $this->get_field_id('post_comments');
        ?>
" name="<?php 
        echo $this->get_field_name('post_comments');
        ?>
" /> <?php 
        _e('Post Comments', 'bizzthemes');
        ?>
</label><br/>
			<label for="<?php 
        echo $this->get_field_id('post_categories');
        ?>
">
			<input class="checkbox" type="checkbox" <?php 
        checked($instance['post_categories'], true);
        ?>
 id="<?php 
        echo $this->get_field_id('post_categories');
        ?>
" name="<?php 
        echo $this->get_field_name('post_categories');
        ?>
" /> <?php 
        _e('Post Categories', 'bizzthemes');
        ?>
</label><br/>
			<label for="<?php 
        echo $this->get_field_id('post_tags');
        ?>
">
			<input class="checkbox" type="checkbox" <?php 
        checked($instance['post_tags'], true);
        ?>
 id="<?php 
        echo $this->get_field_id('post_tags');
        ?>
" name="<?php 
        echo $this->get_field_name('post_tags');
        ?>
" /> <?php 
        _e('Post Tags', 'bizzthemes');
        ?>
</label><br/>
			<label for="<?php 
        echo $this->get_field_id('post_edit');
        ?>
">
			<input class="checkbox" type="checkbox" <?php 
        checked($instance['post_edit'], true);
        ?>
 id="<?php 
        echo $this->get_field_id('post_edit');
        ?>
" name="<?php 
        echo $this->get_field_name('post_edit');
        ?>
" /> <?php 
        _e('Edit Post', 'bizzthemes');
        ?>
</label>
		</p>
		<small class="section">Featured Image</small>
		<p>
			<label for="<?php 
        echo $this->get_field_id('thumb_display');
        ?>
">
			<input class="checkbox" type="checkbox" <?php 
        checked($instance['thumb_display'], true);
        ?>
 id="<?php 
        echo $this->get_field_id('thumb_display');
        ?>
" name="<?php 
        echo $this->get_field_name('thumb_display');
        ?>
" /> <?php 
        _e('Featured images?', 'bizzthemes');
        ?>
</label><br/>
			<label for="<?php 
        echo $this->get_field_id('thumb_selflink');
        ?>
">
			<input class="checkbox" type="checkbox" <?php 
        checked($instance['thumb_selflink'], true);
        ?>
 id="<?php 
        echo $this->get_field_id('thumb_selflink');
        ?>
" name="<?php 
        echo $this->get_field_name('thumb_selflink');
        ?>
" /> <?php 
        _e('Link to images?', 'bizzthemes');
        ?>
</label>
		</p>
		<p>
		    <label for="<?php 
        echo $this->get_field_id('thumb_width');
        ?>
">Image Width</label>
			<input type="text" class="widefat code" id="<?php 
        echo $this->get_field_id('thumb_width');
        ?>
" name="<?php 
        echo $this->get_field_name('thumb_width');
        ?>
" value="<?php 
        echo $instance['thumb_width'];
        ?>
" />
		</p>
		<p>
		    <label for="<?php 
        echo $this->get_field_id('thumb_height');
        ?>
">Image Height</label>
			<input type="text" class="widefat code" id="<?php 
        echo $this->get_field_id('thumb_height');
        ?>
" name="<?php 
        echo $this->get_field_name('thumb_height');
        ?>
" value="<?php 
        echo $instance['thumb_height'];
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('thumb_align');
        ?>
">Image Align</label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('thumb_align');
        ?>
" name="<?php 
        echo $this->get_field_name('thumb_align');
        ?>
">
				<?php 
        foreach ($thumb_align as $option_value => $option_label) {
            ?>

					<option value="<?php 
            echo $option_value;
            ?>
" <?php 
            selected($instance['thumb_align'], $option_value);
            ?>
><?php 
            echo $option_label;
            ?>
</option>
				<?php 
        }
        ?>

			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('thumb_cropp');
        ?>
">Image Crop</label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('thumb_cropp');
        ?>
" name="<?php 
        echo $this->get_field_name('thumb_cropp');
        ?>
">
				<?php 
        foreach ($thumb_cropp as $option_value => $option_label) {
            ?>

					<option value="<?php 
            echo $option_value;
            ?>
" <?php 
            selected($instance['thumb_cropp'], $option_value);
            ?>
><?php 
            echo $option_label;
            ?>
</option>
				<?php 
        }
        ?>

			</select>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('thumb_filter');
        ?>
">Image Filter (from 1 to 13)</label>
			<input type="text" class="widefat code" id="<?php 
        echo $this->get_field_id('thumb_filter');
        ?>
" name="<?php 
        echo $this->get_field_name('thumb_filter');
        ?>
" value="<?php 
        echo $instance['thumb_filter'];
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('thumb_sharpen');
        ?>
">Image Sharpen (1 or 2)</label>
			<input type="text" class="widefat code" id="<?php 
        echo $this->get_field_id('thumb_sharpen');
        ?>
" name="<?php 
        echo $this->get_field_name('thumb_sharpen');
        ?>
" value="<?php 
        echo $instance['thumb_sharpen'];
        ?>
" />
		</p>
		
		</div>

		<div class="bizz-widget-controls" style="clear: left;"><?php 
        echo '<small class="section">Filter by IDs</small><div style="clear: both;"></div>';
        /* Posts by post_type. */
        $post_types = get_post_types('', 'names');
        $i = 0;
        foreach ($post_types as $type) {
            echo '<div style="float:left;width:23%;margin-right:' . (++$i % 4 ? '2' : '0') . '%;">';
            $instance[$type] = isset($instance[$type]) ? $instance[$type] : '';
            query_posts_input_text($type . ' (IDs):', $this->get_field_id($type), $this->get_field_name($type), $instance[$type]);
            echo '</div>';
        }
        /* Taxonomies. */
        $taxonomies = query_posts_get_taxonomies();
        $i = 0;
        foreach ($taxonomies as $taxonomy) {
            echo '<div style="float:left;width:23%;margin-right:' . (++$i % 4 ? '2' : '0') . '%;">';
            $instance[$taxonomy] = isset($instance[$taxonomy]) ? $instance[$taxonomy] : '';
            query_posts_input_text($taxonomy . ' (IDs):', $this->get_field_id($taxonomy), $this->get_field_name($taxonomy), $instance[$taxonomy]);
            echo '</div>';
        }
        /* Parent. */
        echo '<div style="float:left;width:23%;margin-right:2%;">';
        query_posts_input_text('Parent (ID):', $this->get_field_id('post_parent'), $this->get_field_name('post_parent'), $instance['post_parent']);
        echo '</div>';
        /* Authors. */
        echo '<div style="float:left;width:23%;margin-right:2%;">';
        query_posts_input_text('Authors (IDs):', $this->get_field_id('author'), $this->get_field_name('author'), $instance['author']);
        echo '</div>';
        ?>

		</div>
		<div class="clear">&nbsp;</div>
	<?php 
    }