Exemplo n.º 1
0
    /**
     * Display the settings update form.
     */
    function form($instance)
    {
        $instance = wp_parse_args((array) $instance, $this->defaults);
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title', 'calibrefx');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" class="widefat" />
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('num_posts');
        ?>
"><?php 
        _e('Number of posts to show', 'calibrefx');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('num_posts');
        ?>
" name="<?php 
        echo $this->get_field_name('num_posts');
        ?>
" value="<?php 
        echo absint($instance['num_posts']);
        ?>
" size="3" />
		</p>
		
		<p>
			<input id="<?php 
        echo $this->get_field_id('show_detail');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_detail');
        ?>
" value="1"<?php 
        checked($instance['show_detail']);
        ?>
 />
			<label for="<?php 
        echo $this->get_field_id('show_detail');
        ?>
"><?php 
        _e('Show Content', 'calibrefx');
        ?>
</label>
		</p>
		
		<p>
			<label for="<?php 
        echo $this->get_field_id('detail_length');
        ?>
"><?php 
        _e('Content Length', 'calibrefx');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('detail_length');
        ?>
" name="<?php 
        echo $this->get_field_name('detail_length');
        ?>
" value="<?php 
        echo absint($instance['detail_length']);
        ?>
" size="3" />
		</p>

		<hr class="div" />

		<p>
			<input id="<?php 
        echo $this->get_field_id('show_thumbnail');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_thumbnail');
        ?>
" value="1"<?php 
        checked($instance['show_thumbnail']);
        ?>
 />
			<label for="<?php 
        echo $this->get_field_id('show_thumbnail');
        ?>
"><?php 
        _e('Show Thumbnail', 'calibrefx');
        ?>
</label>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('image_size');
        ?>
"><?php 
        _e('Image Size', 'calibrefx');
        ?>
:</label>
			<select id="<?php 
        echo $this->get_field_id('image_size');
        ?>
" name="<?php 
        echo $this->get_field_name('image_size');
        ?>
">
				<option value="thumbnail">thumbnail (<?php 
        echo get_option('thumbnail_size_w');
        ?>
x<?php 
        echo get_option('thumbnail_size_h');
        ?>
)</option>
				<?php 
        $sizes = calibrefx_get_additional_image_sizes();
        foreach ((array) $sizes as $name => $size) {
            echo '<option value="' . $name . '" ' . selected($name, $instance['image_size'], false) . '>' . $name . ' ( ' . $size['width'] . 'x' . $size['height'] . ' )</option>';
        }
        ?>
			</select>
		</p>

<?php 
    }
Exemplo n.º 2
0
    /**
     * Display the settings update form.
     */
    function form($instance)
    {
        $instance = wp_parse_args((array) $instance, $this->defaults);
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title', 'calibrefx');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" class="widefat" />
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('page_id');
        ?>
"><?php 
        _e('Page', 'calibrefx');
        ?>
:</label>
			<?php 
        wp_dropdown_pages(array('name' => $this->get_field_name('page_id'), 'selected' => $instance['page_id']));
        ?>
		</p>

		<hr class="div" />
		
		<p>
			<input id="<?php 
        echo $this->get_field_id('show_image');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_image');
        ?>
" value="1"<?php 
        checked($instance['show_image']);
        ?>
 />
			<label for="<?php 
        echo $this->get_field_id('show_image');
        ?>
"><?php 
        _e('Show Featured Image', 'calibrefx');
        ?>
</label>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('image_size');
        ?>
"><?php 
        _e('Image Size', 'calibrefx');
        ?>
:</label>
			<select id="<?php 
        echo $this->get_field_id('image_size');
        ?>
" name="<?php 
        echo $this->get_field_name('image_size');
        ?>
">
				<option value="thumbnail">thumbnail (<?php 
        echo get_option('thumbnail_size_w');
        ?>
x<?php 
        echo get_option('thumbnail_size_h');
        ?>
)</option>
				<?php 
        $sizes = calibrefx_get_additional_image_sizes();
        foreach ((array) $sizes as $name => $size) {
            echo '<option value="' . $name . '" ' . selected($name, $instance['image_size'], false) . '>' . $name . ' ( ' . $size['width'] . 'x' . $size['height'] . ' )</option>';
        }
        ?>
			</select>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('image_alignment');
        ?>
"><?php 
        _e('Image Alignment', 'calibrefx');
        ?>
:</label>
			<select id="<?php 
        echo $this->get_field_id('image_alignment');
        ?>
" name="<?php 
        echo $this->get_field_name('image_alignment');
        ?>
">
				<option value="alignnone">- <?php 
        _e('None', 'calibrefx');
        ?>
 -</option>
				<option value="alignleft" <?php 
        selected('alignleft', $instance['image_alignment']);
        ?>
><?php 
        _e('Left', 'calibrefx');
        ?>
</option>
				<option value="alignright" <?php 
        selected('alignright', $instance['image_alignment']);
        ?>
><?php 
        _e('Right', 'calibrefx');
        ?>
</option>
			</select>
		</p>

		<hr class="div" />
		
		<p>
			<input id="<?php 
        echo $this->get_field_id('show_title');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_title');
        ?>
" value="1"<?php 
        checked($instance['show_title']);
        ?>
 />
			<label for="<?php 
        echo $this->get_field_id('show_title');
        ?>
"><?php 
        _e('Show Page Title', 'calibrefx');
        ?>
</label>
		</p>

		<p>
			<input id="<?php 
        echo $this->get_field_id('show_content');
        ?>
" type="checkbox" name="<?php 
        echo $this->get_field_name('show_content');
        ?>
" value="1"<?php 
        checked($instance['show_content']);
        ?>
 />
			<label for="<?php 
        echo $this->get_field_id('show_content');
        ?>
"><?php 
        _e('Show Page Content', 'calibrefx');
        ?>
</label>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('content_limit');
        ?>
"><?php 
        _e('Content Character Limit', 'calibrefx');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('content_limit');
        ?>
" name="<?php 
        echo $this->get_field_name('content_limit');
        ?>
" value="<?php 
        echo esc_attr($instance['content_limit']);
        ?>
" size="3" />
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('more_text');
        ?>
"><?php 
        _e('More Text', 'calibrefx');
        ?>
:</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('more_text');
        ?>
" name="<?php 
        echo $this->get_field_name('more_text');
        ?>
" value="<?php 
        echo esc_attr($instance['more_text']);
        ?>
" />
		</p>
<?php 
    }
Exemplo n.º 3
0
/**
 * Get all image sizes
 *
 * @return array
 */
function calibrefx_get_image_sizes()
{
    $builtin_sizes = array('large' => array('width' => get_option('large_size_w'), 'height' => get_option('large_size_h')), 'medium' => array('width' => get_option('medium_size_w'), 'height' => get_option('medium_size_h')), 'thumbnail' => array('width' => get_option('thumbnail_size_w'), 'height' => get_option('thumbnail_size_h')));
    $additional_sizes = calibrefx_get_additional_image_sizes();
    return array_merge($builtin_sizes, $additional_sizes);
}