Example #1
0
/**
 * Executes a query for attachments. An array of WP_Query arguments
 * can be passed in, which will override the arguments set by this function.
 *
 * @since 2.5.0
 * @uses apply_filters() Calls 'upload_per_page' on posts_per_page argument
 *
 * @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal.
 * @return array
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $post_type = get_post_type_object('attachment');
    $states = 'inherit';
    if (current_user_can($post_type->cap->read_private_posts)) {
        $states .= ',private';
    }
    $q['post_status'] = isset($q['status']) && 'trash' == $q['status'] ? 'trash' : $states;
    $media_per_page = (int) get_user_option('upload_per_page');
    if (empty($media_per_page) || $media_per_page < 1) {
        $media_per_page = 20;
    }
    $q['posts_per_page'] = apply_filters('upload_per_page', $media_per_page);
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    if (isset($q['detached'])) {
        add_filter('posts_where', '_edit_attachments_query_helper');
    }
    wp($q);
    if (isset($q['detached'])) {
        remove_filter('posts_where', '_edit_attachments_query_helper');
    }
    return array($post_mime_types, $avail_post_mime_types);
}
Example #2
0
/**
 * Executes a query for attachments. An array of WP_Query arguments
 * can be passed in, which will override the arguments set by this function.
 *
 * @since 2.5.0
 *
 * @param array|false $q Array of query variables to use to build the query or false to use $_GET superglobal.
 * @return array
 */
function wp_edit_attachments_query($q = false)
{
    wp(wp_edit_attachments_query_vars($q));
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    return array($post_mime_types, $avail_post_mime_types);
}
Example #3
0
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $q
 * @return unknown
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $q['post_status'] = isset($q['status']) && 'trash' == $q['status'] ? 'trash' : 'inherit';
    $media_per_page = (int) get_user_option('upload_per_page', 0, false);
    if (empty($media_per_page) || $media_per_page < 1) {
        $media_per_page = 20;
    }
    $q['posts_per_page'] = apply_filters('upload_per_page', $media_per_page);
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    wp($q);
    return array($post_mime_types, $avail_post_mime_types);
}
Example #4
0
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $q
 * @return unknown
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $q['post_status'] = 'any';
    $q['posts_per_page'] = 15;
    $post_mime_types = array('image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')), 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')), 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')));
    $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    wp($q);
    return array($post_mime_types, $avail_post_mime_types);
}
Example #5
0
    $_GET['paged'] = 1;
}
if (isset($_GET['detached'])) {
    if (!empty($lost)) {
        $start = ($_GET['paged'] - 1) * 50;
        $page_links_total = ceil(count($lost) / 50);
        $lost = implode(',', $lost);
        $orphans = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_type = 'attachment' AND ID IN ({$lost}) LIMIT {$start}, 50");
    } else {
        $start = ($_GET['paged'] - 1) * 25;
        $orphans = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_parent < 1 LIMIT {$start}, 25");
        $page_links_total = ceil($wpdb->get_var("SELECT FOUND_ROWS()") / 25);
    }
    $post_mime_types = array('image' => array(__('Images'), __('Manage Images'), _n_noop('Image (%s)', 'Images (%s)')), 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio (%s)', 'Audio (%s)')), 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video (%s)', 'Video (%s)')));
    $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($_GET['post_mime_type']) && !array_intersect((array) $_GET['post_mime_type'], array_keys($post_mime_types))) {
        unset($_GET['post_mime_type']);
    }
} else {
    list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
}
wp_enqueue_script('media');
require_once 'admin-header.php';
?>

<?php 
if (isset($_GET['posted']) && (int) $_GET['posted']) {
    $_GET['message'] = '1';
    $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
}
Example #6
0
/**
 * Executes a query for attachments. An array of WP_Query arguments
 * can be passed in, which will override the arguments set by this function.
 *
 * @since 2.5.0
 *
 * @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal.
 * @return array
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $post_type = get_post_type_object('attachment');
    $states = 'inherit';
    if (current_user_can($post_type->cap->read_private_posts)) {
        $states .= ',private';
    }
    $q['post_status'] = isset($q['status']) && 'trash' == $q['status'] ? 'trash' : $states;
    $q['post_status'] = isset($q['attachment-filter']) && 'trash' == $q['attachment-filter'] ? 'trash' : $states;
    $media_per_page = (int) get_user_option('upload_per_page');
    if (empty($media_per_page) || $media_per_page < 1) {
        $media_per_page = 20;
    }
    /**
     * Filter the number of items to list per page when listing media items.
     *
     * @since 2.9.0
     *
     * @param int $media_per_page Number of media to list. Default 20.
     */
    $q['posts_per_page'] = apply_filters('upload_per_page', $media_per_page);
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    foreach (array_keys($post_mime_types) as $type) {
        if (isset($q['attachment-filter']) && "post_mime_type:{$type}" == $q['attachment-filter']) {
            $q['post_mime_type'] = $type;
            break;
        }
    }
    if (isset($q['detached']) || isset($q['attachment-filter']) && 'detached' == $q['attachment-filter']) {
        $q['post_parent'] = 0;
    }
    wp($q);
    return array($post_mime_types, $avail_post_mime_types);
}
function wp_edit_attachments_query( $q = false ) {
	global $wpdb;
	if ( false === $q )
		$q = $_GET;
	$q['m']   = (int) $q['m'];
	$q['cat'] = (int) $q['cat'];
	$q['post_type'] = 'attachment';
	$q['post_status'] = 'any';
	$q['posts_per_page'] = 15;
	$post_mime_types = array(	//	array( adj, noun )
				'image' => array(__('Images'), __('Manage Images'), __ngettext_noop('Image (%s)', 'Images (%s)')),
				'audio' => array(__('Audio'), __('Manage Audio'), __ngettext_noop('Audio (%s)', 'Audio (%s)')),
				'video' => array(__('Video'), __('Manage Video'), __ngettext_noop('Video (%s)', 'Video (%s)')),
			);
	$post_mime_types = apply_filters('post_mime_types', $post_mime_types);

	$avail_post_mime_types = get_available_post_mime_types('attachment');

	if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) )
		unset($q['post_mime_type']);

	wp($q);

	return array($post_mime_types, $avail_post_mime_types);
}
    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 
    }
Example #9
0
    function on_edit_widget_filter_exceptions()
    {
        global $xtreme_widget_manager;
        if (!current_user_can('edit_theme_options') && !$xtreme_widget_manager->current_user_has_right()) {
            _e("You do not have the permission to change widget filter exceptions.", XF_TEXTDOMAIN);
            ?>
			<div class="widget-control-actions">
				<a id="x-portlet-editing-close" href="#"><span class="ui-icon ui-icon-close"></span><?php 
            _e('Close', XF_TEXTDOMAIN);
            ?>
</a>
			</div>
			<?php 
            exit;
        }
        $filter = $_POST["filter"];
        if (!isset($_POST['content']) || empty($_POST['content'])) {
            $_POST['content'] = "standard";
        }
        if (in_array($filter, $xtreme_widget_manager->filters_with_exceptions)) {
            $filtername = $xtreme_widget_manager->filters[$filter];
            ?>
			<div class="x-portlet-wrapper-label"><?php 
            _e('Edit Filter Exceptions for:', XF_TEXTDOMAIN);
            ?>
 <strong><?php 
            echo esc_attr($filtername);
            ?>
</strong></div>
			<?php 
            if (is_rtl()) {
                ?>
				<image src="<?php 
                echo XF_ADMIN_URL;
                ?>
/images/filter-arrow-rtl.png" class="x-filter-arrow" />
			<?php 
            } else {
                ?>
				<image src="<?php 
                echo XF_ADMIN_URL;
                ?>
/images/filter-arrow.png" class="x-filter-arrow" />
			<?php 
            }
            ?>
			<div class="x-portlet-wrapper-label">
				<small><?php 
            _e('Sidebar:', XF_TEXTDOMAIN);
            ?>
 <strong><?php 
            echo esc_attr($_POST['sidebar']);
            ?>
</strong>&nbsp;|&nbsp;
				<?php 
            _e('Widget:', XF_TEXTDOMAIN);
            ?>
 <strong><?php 
            echo esc_attr($_POST['widget']);
            ?>
</strong></small>
			</div>
			<div class="x-portlet-wrapper">
			<?php 
            $this->setup_data();
            $this->navigation("top", __('Search', XF_TEXTDOMAIN), "xtreme-dialog");
            if ($filter == 'is_attachment') {
                echo '<div class="x-media-types"><b>' . __('Media Types', XF_TEXTDOMAIN) . ':</b>&nbsp;';
                $mt = get_available_post_mime_types('attachment');
                $ma = array('<a href="#" class="x-media-type' . ($_POST['s_media'] == 'all' ? ' x-media-type-active' : '') . '" rel="all">' . __('All', XF_TEXTDOMAIN) . '</a>');
                if (isset($_POST['callback_id']) && !empty($_POST['callback_id'])) {
                    $ma[] = '<a href="#" class="x-media-type' . ($_POST['s_media'] == 'image/' ? ' x-media-type-active' : '') . '" rel="image/">' . __('Images', XF_TEXTDOMAIN) . '</a>';
                }
                foreach ($mt as $m) {
                    $p = explode('/', $m);
                    if (isset($_POST['callback_id']) && !empty($_POST['callback_id']) && !preg_match('|^image/|', $m)) {
                        continue;
                    }
                    $ma[] = '<a href="#" class="x-media-type' . ($_POST['s_media'] == $m ? ' x-media-type-active' : '') . '" rel="' . $m . '">' . $p[1] . '</a>';
                }
                echo implode('', $ma);
                echo "</div>";
            }
            ?>
			<table cellspacing="0" class="widefat fixed">
			<thead>
				<tr>	
					<th class="column-cb check-column" scope="col"><input class="fex-maintoggle" type="checkbox"></th>
					<th class="column-title" scope="col"><?php 
            _e("Title", XF_TEXTDOMAIN);
            ?>
</th>
					<?php 
            if ($filter == 'is_attachment') {
                ?>
					<th class="column-icon" scope="col"><?php 
                _e("Media Link", XF_TEXTDOMAIN);
                ?>
</th>
					<?php 
            } else {
                ?>
					<th class="column-parentcolumn-title" scope="col"><?php 
                _e("Excerpt", XF_TEXTDOMAIN);
                ?>
</th>
					<?php 
            }
            ?>
				</tr>
			</thead>
			<tbody>
			<?php 
            foreach ($this->results as $data) {
                $class = in_array($data['id'], $this->selected_items) ? ' class="fex-selected"' : '';
                $checked = in_array($data['id'], $this->selected_items) ? ' checked="checked"' : '';
                ?>
				<tr>
					<td<?php 
                echo $class;
                ?>
><input class="fex-checkbox" type="checkbox" value="<?php 
                echo $data['id'];
                ?>
"<?php 
                echo $checked;
                ?>
></td>
					<td<?php 
                echo $class;
                ?>
>
						<strong><?php 
                echo $data['title'];
                ?>
</strong>
					</td>
					<td<?php 
                echo $class;
                ?>
><?php 
                echo $data['extra'];
                ?>
</td>
				</tr>
			<?php 
            }
            ?>
			</tbody>
			</table>
			<?php 
            $this->navigation("bottom", __('Search', XF_TEXTDOMAIN), "xtreme-dialog");
            ?>
			</div>
			<div class="widget-control-actions">
				<span id="x-portlet-editing-selected">&nbsp;|&nbsp;<?php 
            _e('Selected Items:', XF_TEXTDOMAIN);
            ?>
 <b><?php 
            echo count($this->selected_items);
            ?>
</b></span>
				<a id="x-portlet-editing-assigned" class="dlg-selection<?php 
            echo $_POST['content'] != "standard" ? " hidden" : "";
            ?>
" href="#"><span class="ui-icon ui-icon-zoomin"></span><?php 
            _e('Show Selection', XF_TEXTDOMAIN);
            ?>
</a>
				<a id="x-portlet-editing-standard" class="dlg-selection<?php 
            echo $_POST['content'] == "standard" ? " hidden" : "";
            ?>
" href="#"><span class="ui-icon ui-icon-zoomout"></span><?php 
            _e('Show Overview', XF_TEXTDOMAIN);
            ?>
</a>
				<?php 
            if ($_POST['dlg_type'] == 'x-dlg-exceptions') {
                ?>
					<a id="x-portlet-editing-close" href="#"><span class="ui-icon ui-icon-close"></span><?php 
                _e('Close', XF_TEXTDOMAIN);
                ?>
</a>
					<a id="x-portlet-editing-apply" href="#"><span class="ui-icon ui-icon-disk"></span><?php 
                _e('Apply', XF_TEXTDOMAIN);
                ?>
</a>
				<?php 
            } else {
                ?>
					<a id="x-portlet-editing-back" href="#"><span class="ui-icon ui-icon-arrowrefresh-1-w"></span><?php 
                _e('Back to Condition Editor', XF_TEXTDOMAIN);
                ?>
</a>
					<a id="x-portlet-editing-apply" href="#"><span class="ui-icon ui-icon-disk"></span><?php 
                _e('Apply', XF_TEXTDOMAIN);
                ?>
</a>
				<?php 
            }
            ?>
			</div>
			<script type="text/javascript">
			xtreme_dialog_data = {
				'action' 		: '<?php 
            echo $_POST['action'];
            ?>
',
				'dlg_type'		: '<?php 
            echo $_POST['dlg_type'];
            ?>
',
				'filter' 		: '<?php 
            echo $_POST['filter'];
            ?>
',
				'widget'		: '<?php 
            echo $_POST['widget'];
            ?>
',
				'sidebar'		: '<?php 
            echo $_POST['sidebar'];
            ?>
',
				'target_input'	: '<?php 
            echo $_POST['target_input'];
            ?>
',
				'value'			: '<?php 
            echo $_POST['value'];
            ?>
',
				's'				: '<?php 
            echo $_POST['s'];
            ?>
',
				's_media'		: '<?php 
            echo $_POST['s_media'];
            ?>
',
				'page'			: <?php 
            echo $this->current_page;
            ?>
,
				'content'		: '<?php 
            echo $_POST['content'];
            ?>
',
				'perform'		: '',
				'callback_id'	: '<?php 
            echo $_POST['callback_id'];
            ?>
'
			};
			<?php 
            if ($_POST['perform'] == 'apply-changes') {
                ?>
				
				<?php 
                if (!empty($_POST['callback_id'])) {
                    ?>
					</script>
					<?php 
                    do_action('xtreme-dlg-apply-changes_' . $_POST['callback_id'], $_POST['value']);
                    ?>
					<script type="text/javascript">
					jQuery('#x-portlet-editing-close').trigger('click'); //close it now.
				<?php 
                } else {
                    ?>
					jQuery('input[name="<?php 
                    echo $_POST['target_input'];
                    ?>
"]').val(xtreme_dialog_data.value);
					var cnt = 0;
					if(xtreme_dialog_data.value.length != 0) {
						cnt = xtreme_dialog_data.value.split(',').length;
					}
					<?php 
                    if ($_POST['dlg_type'] == 'x-dlg-exceptions') {
                        ?>
						jQuery('input[name="<?php 
                        echo $_POST['target_input'];
                        ?>
"]').closest('.xtreme-fex').find('input').each(function(i, e) {
							if (jQuery(this).val().length > 0) 
								cnt++;
						});
						if(cnt == 0)
							jQuery('input[name="<?php 
                        echo $_POST['target_input'];
                        ?>
"]').closest('.x-filter').removeClass("fex-selected");
						else
							jQuery('input[name="<?php 
                        echo $_POST['target_input'];
                        ?>
"]').closest('.x-filter').addClass("fex-selected");
						xtreme_dialog_data.value = '';
						jQuery('#x-portlet-editing-close').trigger('click'); //close it now.
						jQuery('body').trigger('visualize_filter_state');
					<?php 
                    } else {
                        ?>
						jQuery('input[name="<?php 
                        echo $_POST['target_input'];
                        ?>
"]').closest('li').find('b').html(cnt);
						jQuery('#x-portlet-editing-back').trigger('click');
					<?php 
                    }
                    ?>
				<?php 
                }
                ?>
			<?php 
            }
            ?>
			</script>
			<?php 
        }
        exit;
    }