Exemplo n.º 1
0
function authors_block($options)
{
    $mydirname = empty($options[0]) ? 'xpress' : $options[0];
    $this_template = empty($options[1]) ? 'db:' . $mydirname . '_block_authors.html' : trim($options[1]);
    $optioncount = empty($options[2]) ? 0 : 1;
    $exclude_admin = empty($options[3]) ? 0 : 1;
    $show_fullname = empty($options[4]) ? 0 : 1;
    $hide_empty = empty($options[5]) ? 0 : 1;
    $mydirpath = get_xpress_dir_path();
    if (xpress_is_wp_version('<', '2.3')) {
        $param_str = 'optioncount=' . $optioncount . '&exclude_admin=' . $exclude_admin . '&show_fullname=' . $show_fullname . '&hide_empty=' . $hide_empty;
        ob_start();
        wp_list_authors($param_str);
        //WP2011 wp_list_authors() used only parse_str()
        $list_authors = ob_get_contents();
        ob_end_clean();
    } else {
        $param = array('optioncount' => $optioncount, 'exclude_admin' => $exclude_admin, 'show_fullname' => $show_fullname, 'hide_empty' => $hide_empty, 'feed' => '', 'feed_image' => '', 'echo' => false);
        $list_authors = wp_list_authors($param);
    }
    if (xpress_is_multi_user()) {
        $all_link = '<li>' . '<a href="' . get_bloginfo('url') . '" title="' . __('All Authors', 'xpress') . '">' . __('All Authors', 'xpress') . '</a></li>';
    } else {
        $all_link = '';
    }
    $output = "<ul>\n" . $all_link . $list_authors . "\n</ul>\n";
    $block['authors'] = $output;
    return $block;
}
Exemplo n.º 2
0
function page_block($options)
{
	$mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
	$this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_page_block.html' : trim( $options[1] );
	$sort_column = empty( $options[2] ) ? 'post_title' : $options[2] ;
	$sort_order = empty( $options[3] ) ? 'asc' : $options[3] ;
	$exclude = empty( $options[4] ) ? '' : $options[4] ;
	$exclude_tree = empty( $options[5] ) ? '' : $options[5] ;
	$includes = empty( $options[6] ) ? '' : $options[6] ;
	$depth  = !is_numeric( $options[7] ) ? 0 : $options[7] ;
	$child_of  = !is_numeric( $options[8] ) ? 0 : $options[8] ;
	$show_date = empty( $options[9] ) ? 'none' : $options[9] ;
	$date_format = empty( $options[10] ) ? '' : $options[10] ;
	$hierarchical = empty( $options[11] ) ? false : true ;
	$meta_key = empty( $options[12] ) ? '' : $options[12] ;
	$meta_value = empty( $options[13] ) ? '' : $options[13] ;

	if (empty($date_format)) $date_format = get_option('date_format');
	if ($exclude_tree == 0 ) $exclude_tree = '';
	if ($show_date == 'none' ) $show_date = '';
	
	if (xpress_is_wp_version('>=','2.2')){
		$parm = array(
	    	'sort_column'	=> $sort_column, 
	    	'sort_order'	=> $sort_order, 
	    	'exclude'		=> $exclude,
	    	'exclude_tree'	=> $exclude_tree,
	    	'include'		=> $includes,
	    	'depth'			=> $depth, 
	    	'child_of'		=> $child_of,
	    	'show_date'		=> $show_date,
	    	'date_format'	=> $date_format,
	    	'title_li'		=> '',
	    	'echo'			=> 0,
	    	'hierarchical'	=> $hierarchical,
	    	'meta_key'		=> $meta_key,
	    	'meta_value'	=> $meta_value
	    );
		$output = "<ul>\n" . wp_list_pages($parm) . "\n</ul>\n";
	} else {
		$output = "<ul>\n";
		ob_start();
			wp_list_pages($parm);
			$output .= ob_get_contents();
		ob_end_clean();
		$output .="\n</ul>\n";
	}
	$block['list_pages'] = $output;
	return $block ;	
}
Exemplo n.º 3
0
function category_block($options)
{
    $mydirname = empty($options[0]) ? 'xpress' : $options[0];
    $this_template = empty($options[1]) ? 'db:' . $mydirname . '_block_category.html' : trim($options[1]);
    $show_option_all = empty($options[2]) ? '' : $options[2];
    $orderby = empty($options[3]) ? 'name' : $options[3];
    $order = empty($options[4]) ? 'ASC' : $options[4];
    $show_last_updated = empty($options[5]) ? false : true;
    $show_count = empty($options[6]) ? false : true;
    $hide_empty = empty($options[7]) ? false : true;
    $use_desc_for_title = empty($options[8]) ? false : true;
    $exclude = empty($options[9]) ? '' : $options[9];
    $includes = empty($options[10]) ? '' : $options[10];
    $hierarchical = empty($options[11]) ? false : true;
    $depth = !is_numeric($options[12]) ? 0 : $options[12];
    if (function_exists('wp_list_categories')) {
        $param = array('show_option_all' => $show_option_all, 'orderby' => $orderby, 'order' => $order, 'show_last_update' => $show_last_updated, 'style' => 'list', 'show_count' => $show_count, 'hide_empty' => $hide_empty, 'use_desc_for_title' => $use_desc_for_title, 'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => $exclude, 'include' => $includes, 'hierarchical' => $hierarchical, 'title_li' => '', 'number' => '', 'echo' => 0, 'depth' => $depth);
        if (xpress_is_wp_version('>=', '2.3')) {
            $block['categories'] = wp_list_categories($param);
        } else {
            // not suport echo flag
            ob_start();
            wp_list_categories($param);
            $block['categories'] = ob_get_contents();
            ob_end_clean();
        }
    } else {
        if (empty($show_option_all)) {
            $optionall = 0;
        } else {
            $optionall = 1;
        }
        $param = array('optionall' => $optionall, 'all' => $show_option_all, 'sort_column' => $orderby, 'sort_order' => $order, 'show_last_update' => $show_last_updated, 'optioncount' => $show_count, 'hide_empty' => $hide_empty, 'use_desc_for_title' => $use_desc_for_title, 'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => $exclude, 'hierarchical' => $hierarchical, 'recurse' => 1);
        ob_start();
        wp_list_cats($param);
        $block['categories'] = ob_get_contents();
        ob_end_clean();
    }
    return $block;
}
Exemplo n.º 4
0
        if ('open' == $post->ping_status) {
            printf(__('You can <a href="%s" rel="trackback">trackback</a> from your own site.', 'xpress'), trackback_url(false));
        } else {
            _e('Pinging is currently not allowed.', 'xpress');
        }
        ?>
						</small></p>
						<?php 
        xpress_pings_list('echo=1');
        ?>
					
					</div>
							
					<div id ="xpress-comments-block">
						<?php 
        if (xpress_is_wp_version('<', '2.7')) {
            comments_template();
        } else {
            comments_template('', true);
        }
        ?>
					</div>
				</div>
				
				<div class="xpress-navi-bar">
					<div class="alignleft"><?php 
        xpress_left_arrow_post_link('echo=1');
        ?>
</div>
					<div class="alignright"><?php 
        xpress_right_arrow_post_link('echo=1');
function recent_comments_block($options)
{
	$mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
	$this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_recent_comments_block.html' : trim( $options[1] );
	$disp_count = empty( $options[2] ) ? '10' : $options[2] ;
	$disp_length = empty( $options[3] ) ? '30' : $options[3] ;
	$date_format = empty( $options[4] ) ? '' : $options[4] ;
	$time_format = empty( $options[5] ) ? '' : $options[5] ;
	$com_select = empty( $options[6] ) ? '0' : $options[6] ;

	$selected = explode(',' , $com_select);

	$mydirpath = get_xpress_dir_path();
	
	if (empty($date_format)) $date_format = get_settings('date_format');
	if (empty($time_format)) $time_format = get_settings('time_format');
	
	$disp_all = in_array('0',$selected);
	$disp_comment = in_array('1',$selected);
	$disp_trackback = in_array('2',$selected);
	$disp_pingback = in_array('3',$selected);
	
	$type_select = '';
	if (!$disp_all){			
		if ($disp_comment){
			$in_where =  "''";
		}
		if ($disp_trackback){
			if (empty($in_where)) $in_where =  "'trackback' "; else $in_where .=  ",'trackback'";
		}
				
		if ($disp_pingback){
			if (empty($in_where)) $in_where =  "'pingback' "; else $in_where .=  ",'pingback'";
		}
		
		if (! empty($in_where)){
			$type_select = " AND comment_type IN($in_where) ";				
		}
	}
	
	global $wpdb;
	$block = array();
		
	if (!is_null($wpdb)){
		$comment_sql  = "SELECT comment_ID,comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_content, comment_type,UNIX_TIMESTAMP(comment_date) as comment_unix_time ";
		$comment_sql .= "FROM $wpdb->comments LEFT JOIN $wpdb->posts ON  $wpdb->posts.ID = $wpdb->comments.comment_post_ID ";
		if (xpress_is_wp_version('<','2.1')){
			$comment_sql .= "WHERE comment_approved = '1' AND post_status = 'publish' $type_select ";
		} else {
			$comment_sql .= "WHERE comment_approved = '1' AND post_type = 'post'  AND post_status = 'publish' $type_select ";
		}
		$comment_sql .= "ORDER BY comment_date_gmt DESC LIMIT $disp_count";
		$comments = $wpdb->get_results($comment_sql);
		
		if ( $comments ) {
			$output .= '<ul>';
			$item_no = 0;
			foreach ($comments as $comment){
				$comment_content = $comment->comment_content;
				$comment_excerpt = ($disp_length>0 ? xpress_substr($comment_content, 0, $disp_length): $comment->comment_content);
				if (xpress_is_wp_version('<','2.7')){
					$comment_link = get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID;
				} else {
					$comment_link = clean_url(get_comment_link($comment->comment_ID));
				}
				$comment_title = $comment_excerpt;
				$comment_title_link = "<a href='$comment_link' rel='external nofollow' class='url'>$comment_title</a>";

				$post_link = get_permalink($comment->comment_post_ID);
				$post_title = get_the_title($comment->comment_post_ID);
				$post_title_link = '<a href="'. $post_link . '">' . $post_title . '</a>';
				
				$author_link = $comment->comment_author_url;
				$author_name = $comment->comment_author;
				$author_name_link = (( empty( $author_link ) || 'http://' == $author_link ) ? $author_name : "<a href='$author_link' rel='external nofollow' class='url'>$author_name</a>");

				$comment_type = (empty($comment->comment_type) ? 'comment': $comment->comment_type);
				
				$post_title_comment_link = '<a href="'. $comment_link . '">' . $post_title . '</a>';
				$from_auther_to_post = sprintf(__('%1$s on %2$s','xpress'), $author_name_link , $post_title_comment_link );

				$row_data = array(
					'comment_ID' 		=> $comment->comment_ID ,
					'comment_post_ID'	=> $comment->comment_post_ID ,
					'comment_date' 		=> date($date_format,$comment->comment_unix_time) ,
					'comment_date_time' => date($date_format . ' ' . $time_format,$comment->comment_unix_time) ,
					'comment_content' 	=> $comment_content ,
					'comment_excerpt' 	=> $comment_excerpt ,
					'comment_link' 		=> $comment_link,
					'comment_title' 	=> $comment_title ,
					'comment_title_link' => $comment_title_link ,
					'post_link' 		=> $post_link,
					'post_title' 		=> $post_title,
					'post_title_link' 	=> $post_title_link,
					'author_link' 		=> $author_link,
					'author_name' 		=> $author_name,
					'author_name_link' 	=> $author_name_link,
					'comment_type' 		=> $comment_type,
					'from_auther_to_post' => $from_auther_to_post
				);
				
				$block['contents']['item'.$item_no] = $row_data;
				$item_no++;
			}
			$block['data_count'] = $item_no;
		}
	}
	return $block ;
}
function global_recent_comments_block($options)
{
    $mydirname = empty($options[0]) ? 'xpress' : $options[0];
    $this_template = empty($options[1]) ? 'db:' . $mydirname . '_global_recent_comments_block.html' : trim($options[1]);
    $disp_count = empty($options[2]) ? '10' : $options[2];
    $disp_length = empty($options[3]) ? '30' : $options[3];
    $date_format = empty($options[4]) ? '' : $options[4];
    $time_format = empty($options[5]) ? '' : $options[5];
    $com_select = empty($options[6]) ? '0' : $options[6];
    $selected = explode(',', $com_select);
    $mydirpath = get_xpress_dir_path();
    if (empty($date_format)) {
        $date_format = get_settings('date_format');
    }
    if (empty($time_format)) {
        $time_format = get_settings('time_format');
    }
    $disp_all = in_array('0', $selected);
    $disp_comment = in_array('1', $selected);
    $disp_trackback = in_array('2', $selected);
    $disp_pingback = in_array('3', $selected);
    $type_select = '';
    if (!$disp_all) {
        if ($disp_comment) {
            $in_where = "''";
        }
        if ($disp_trackback) {
            if (empty($in_where)) {
                $in_where = "'trackback' ";
            } else {
                $in_where .= ",'trackback'";
            }
        }
        if ($disp_pingback) {
            if (empty($in_where)) {
                $in_where = "'pingback' ";
            } else {
                $in_where .= ",'pingback'";
            }
        }
        if (!empty($in_where)) {
            $type_select = " AND comment_type IN({$in_where}) ";
        }
    }
    global $wpdb, $wp_rewrite, $switched, $blog_id;
    $block = array();
    $comment_array = array();
    if (xpress_is_multiblog()) {
        $blogs = get_blog_list(0, 'all');
        foreach ($blogs as $blog) {
            switch_to_blog($blog['blog_id']);
            $wp_rewrite->init();
            if (!is_null($wpdb)) {
                $comment_sql = "SELECT comment_ID,comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_content, comment_type,UNIX_TIMESTAMP(comment_date) as comment_unix_time ";
                $comment_sql .= "FROM {$wpdb->comments} LEFT JOIN {$wpdb->posts} ON  {$wpdb->posts}.ID = {$wpdb->comments}.comment_post_ID ";
                if (xpress_is_wp_version('<', '2.1')) {
                    $comment_sql .= "WHERE comment_approved = '1' AND post_status = 'publish' {$type_select} ";
                } else {
                    $comment_sql .= "WHERE comment_approved = '1' AND post_type = 'post'  AND post_status = 'publish' {$type_select} ";
                }
                $comment_sql .= "ORDER BY comment_date_gmt DESC LIMIT {$disp_count}";
                $comments = $wpdb->get_results($comment_sql);
                if ($comments) {
                    $blog_title = get_bloginfo('name');
                    $blog_link = get_bloginfo('url');
                    $blog_title_link = '<a href="' . $blog_link . '">' . $blog_title . '</a>';
                    foreach ($comments as $comment) {
                        $comment_content = $comment->comment_content;
                        $comment_unix_time = $comment->comment_unix_time;
                        $comment_excerpt = $disp_length > 0 ? xpress_substr($comment_content, 0, $disp_length) : $comment->comment_content;
                        $comment_link = get_comment_link($comment->comment_ID);
                        $comment_title = $comment_excerpt;
                        $comment_title_link = "<a href='{$comment_link}' rel='external nofollow' class='url'>{$comment_title}</a>";
                        $post_link = get_permalink($comment->comment_post_ID);
                        $post_title = get_the_title($comment->comment_post_ID);
                        $post_title_link = '<a href="' . $post_link . '">' . $post_title . '</a>';
                        $author_link = $comment->comment_author_url;
                        $author_name = $comment->comment_author;
                        $author_name_link = empty($author_link) || 'http://' == $author_link ? $author_name : "<a href='{$author_link}' rel='external nofollow' class='url'>{$author_name}</a>";
                        $comment_type = empty($comment->comment_type) ? 'comment' : $comment->comment_type;
                        $post_title_comment_link = '<a href="' . $comment_link . '">' . $post_title . '</a>';
                        $from_auther_to_post = sprintf(__('%1$s on %2$s', 'xpress'), $author_name_link, $post_title_comment_link);
                        $row_data = array('blog_title' => $blog_title, 'blog_link' => $blog_link, 'blog_title_link' => $blog_title_link, 'comment_ID' => $comment->comment_ID, 'comment_post_ID' => $comment->comment_post_ID, 'comment_unix_time' => $comment_unix_time, 'comment_date' => date($date_format, $comment->comment_unix_time), 'comment_date_time' => date($date_format . ' ' . $time_format, $comment->comment_unix_time), 'comment_content' => $comment_content, 'comment_excerpt' => $comment_excerpt, 'comment_link' => $comment_link, 'comment_title' => $comment_title, 'comment_title_link' => $comment_title_link, 'post_link' => $post_link, 'post_title' => $post_title, 'post_title_link' => $post_title_link, 'author_link' => $author_link, 'author_name' => $author_name, 'author_name_link' => $author_name_link, 'comment_type' => $comment_type, 'from_auther_to_post' => $from_auther_to_post);
                        $comment_array[] = $row_data;
                    }
                    $block['data_count'] = $item_no;
                }
            }
            restore_current_blog();
            $wp_rewrite->init();
        }
        // end of foreach
        usort($comment_array, "the_comment_time_cmp");
        if (!empty($disp_count)) {
            $comment_array = array_slice($comment_array, 0, $disp_count);
        }
        $item_no = 0;
        foreach ($comment_array as $comment) {
            $block['contents']['item' . $item_no] = $comment;
            $item_no++;
        }
        $block['data_count'] = $item_no;
    } else {
        $block['err_message'] = __('This blog is not set to the multi blog.', 'xpress');
    }
    return $block;
}
Exemplo n.º 7
0
function meta_block($options)
{
	$mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
	$this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_block_meta.html' : trim( $options[1] );
	$wp_link = empty( $options[2] ) ? false : true ;
	$xoops_link = empty( $options[3] ) ? false : true ;
	$post_rss = empty( $options[4] ) ? false : true ;
	$comment_rss = empty( $options[5] ) ? false : true ;
	$post_new = empty( $options[6] ) ? false : true ;
	$admin_edit = empty( $options[7] ) ? false : true ;
	$readme = empty( $options[8] ) ? false : true ;
	$ch_style = empty( $options[9] ) ? false : true ;
	
	$output ="<ul>\n";
	
	if ($wp_link){
		$output .= '<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform." target="_blank">WordPress</a></li>';
	}
	if ($xoops_link){
		$output .= '<li><a href="http://xoopscube.sourceforge.net/" title="Powered by XOOPS Cube, state-of-the-art Content Management Portal." target="_blank">XOOPS cube</a></li>';
	}
	if ($post_rss){	
		$output .= '<li><a href="'.get_bloginfo('rss2_url').'" title="'. __('Posts RSS', 'xpress') .'">'. __('Posts RSS', 'xpress') .'</a></li>';
	}
	if ($comment_rss){	
		$output .= '<li><a href="'.get_bloginfo('comments_rss2_url').'" title="'. __('Comments RSS', 'xpress') .'">'. __('Comments RSS', 'xpress') .'</a></li>';
	}

	if (is_user_logged_in()) { 
		global $current_user;

		$Now_user_level = $current_user->user_level;
		
		if ($post_new){
			if($Now_user_level > 0){
				if (xpress_is_wp_version('<','2.1') ){
					$output .=
					'<li>'.
					'<a href="'.get_settings('siteurl').'/wp-admin/post.php" title="'. __('Add New', 'xpress') .'">'. __('Add New', 'xpress') .'</a>'.
					'</li>';
				} else {
					$output .=
					'<li>'.
					'<a href="'.get_settings('siteurl').'/wp-admin/post-new.php" title="'. __('Add New', 'xpress') .'">'. __('Add New', 'xpress') .'</a>'.
					'</li>';
				}
			}
		}
		if ($admin_edit){
			if($Now_user_level > 7){
				$output .=	
				'<li>'.
				'<a href="'.get_settings('siteurl').'/wp-admin/" title="'. __('Site Admin', 'xpress') .'">'. __('Site Admin', 'xpress') .'</a>'.
				'</li>';
			}
		}
		$output .=
				'<li>'.
				'<a href="'.get_settings('siteurl').'/wp-admin/profile.php" title="' . __('User Profile', 'xpress') .'">'. __('User Profile', 'xpress') .'</a>'.
				'</li>';				
		

		if (defined('S2VERSION')){
			if($Now_user_level > 7){
					$output .=
					'<li>'.
					'<a href="'.get_settings('siteurl').'/wp-admin/users.php?page=subscribe2/subscribe2.php" title="'. __('Subscription management', 'xpress') .'">'. __('Subscription management', 'xpress') .'</a>'.
					'</li>';
			} else {
					$output .=
					'<li>'.
					'<a href="'.get_settings('siteurl').'/wp-admin/profile.php?page=subscribe2/subscribe2.php" title="'. __('Subscription management', 'xpress') .'">'. __('Subscription management', 'xpress') .'</a>'.
					'</li>';
			}
		}
			
	}
	
	if ($readme){
		$output .='<li>'.'<a href="'.get_settings('siteurl').'/readme.html" title="' .  __('ReadMe', 'xpress') . '">' . __('ReadMe', 'xpress') . '</a>'.'</li>';
	}
	$output .= disp_mode_set();
	if (function_exists('wp_theme_switcher') ) {
		ob_start();
			echo '<li>' . __('Themes') . ':';
			wp_theme_switcher('dropdown');
			echo '</li>';
			$output .= ob_get_contents();
		ob_end_clean();
	}
	$output .= '</ul>';
	$block['meta_info'] = $output;
	return $block ;	
}
Exemplo n.º 8
0
function xpress_post_new_link($args ='')
{
	global $xoops_config;
	
	$defaults = array(
		'link_title'=> 'Post New',
		'echo' => 1
	);
	$r = wp_parse_args( $args, $defaults );

	extract( $r );

	
	if (xpress_is_wp_version('>=','2.1')){
		$output = '<a href="'. get_bloginfo('url') . '/wp-admin/post-new.php' . '">' . $link_title . '</a>';
	} else {
		$output = '<a href="'. get_bloginfo('url') . '/wp-admin/post.php' . '">' . $link_title . '</a>';
	}	
	if ($echo)
		echo $output;
	else
		return $output;
}
Exemplo n.º 9
0
    /**
     * Creates the edit form for the widget.
     *
     */
    function form($instance)
    {
        global $xpress_config, $xoops_config;
        if (xpress_is_wp_version('<', '2.1')) {
            $addnew = get_settings('siteurl') . '/wp-admin/post.php';
        } else {
            $addnew = get_settings('siteurl') . '/wp-admin/post-new.php';
        }
        $type = array();
        $type[0] = __('Link', 'xpressme');
        $type[1] = __('Site Home', 'xpressme');
        $type[2] = __('Add New', 'xpressme');
        $type[3] = __('User Profile', 'xpressme');
        $type[4] = __('WordPress Admin', 'xpressme');
        $type[5] = __('Module Admin', 'xpressme');
        $type[6] = __('XPressME Setting', 'xpressme');
        $type[7] = __('Display Mode Select', 'xpressme');
        $auto_setting = __('Auto Setting', 'xpressme');
        //Defaults
        $instance = wp_parse_args((array) $instance, array('title' => __('User Menu', 'xpressme'), 'Type_0' => 1, 'Title_0' => __('Site Home', 'xpressme'), 'URL_0' => get_xoops_url(), 'Visible_0' => 1, 'Type_1' => 2, 'Title_1' => __('Add New', 'xpressme'), 'URL_1' => $auto_setting, 'Visible_1' => 1, 'Type_2' => 3, 'Title_2' => __('User Profile', 'xpressme'), 'URL_2' => __('Auto Setting', 'xpressme'), 'Visible_2' => 1, 'Weight_2' => 3, 'Type_3' => 4, 'Title_3' => __('WordPress Admin', 'xpressme'), 'URL_3' => $auto_setting, 'Visible_3' => 1, 'Type_4' => 5, 'Title_4' => __('Module Admin', 'xpressme'), 'URL_4' => $auto_setting, 'Visible_4' => 1, 'Type_5' => 6, 'Title_5' => __('XPressME Setting', 'xpressme'), 'URL_5' => $auto_setting, 'Visible_5' => 1, 'Type_6' => 7, 'Title_6' => $auto_setting, 'URL_6' => $auto_setting, 'Visible_6' => 1, 'Type_7' => 0, 'Title_7' => __('Link', 'xpressme'), 'URL_7' => '', 'Visible_7' => 0, 'Type_8' => 0, 'Title_8' => __('Link', 'xpressme'), 'URL_8' => '', 'Visible_8' => 0, 'Type_9' => 0, 'Title_9' => __('Link', 'xpressme'), 'URL_9' => '', 'Visible_9' => 0));
        echo '
		<script type="text/javascript">
		    function TypeSelect(type_id,title_id,url_id){
				var type=document.getElementById(type_id);
				var title=document.getElementById(title_id);
				var link_url=document.getElementById(url_id);
				var auto_set = \'' . $auto_setting . '\';
				title.value = type[type.value].text;
				if(type.value > 1){
					link_url.value = auto_set;
					link_url.disabled = true;
					link_url.style.backgroundColor = \'transparent\';
		        } else {
		        	if (link_url.value == auto_set) link_url.value = \'\';
					link_url.disabled = false;
					link_url.style.backgroundColor = \'#FFFFEE\';
				}
		        if(type.value == 1){
					link_url.value = \'' . get_xoops_url() . '\';
		        }
				if(type.value == 7){
					title.value = auto_set;
					title.disabled = true;
					title.style.backgroundColor = \'transparent\';
		        } else {
		        	if (title.value == auto_set) title.value = \'\';
					title.disabled = false;
					title.style.backgroundColor = \'#FFFFEE\';
				}

		    }
		</script>';
        // Output the options
        echo '<p><label for="' . $this->get_field_name('title') . '">' . "\n";
        echo __('Title:') . '<input style="width: 200px;" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . $instance['title'] . '" /></label></p>' . "\n";
        echo "\r\n\t\t    <table width='100%' class='outer' cellpadding='4' cellspacing='1' border=\"1\" bordercolor=\"#888888\">\r\n\t\t    <tr valign='middle' align='center' style=\"background-color:#2E323B;color:#FFFFFF\">\r\n\t\t    <th width='10%'>Type</th>\r\n\t\t    <th width='15%'>Title</th>\r\n\t\t    <th width='10%'>URL</th>\r\n\t\t    <th width='10px'>Visible</th>\r\n\t\t\t</tr>\r\n\t\t";
        for ($i = 0; $i < 10; $i++) {
            $even = $i % 2;
            if ($even) {
                $back_color = ' style="background-color:#E3E3E3"';
            } else {
                $back_color = ' style="background-color:#F5F5F5"';
            }
            $text_back_color = ' style="background-color:#FFFFEE"';
            echo "<tr {$back_color}>";
            $select_arg = "'" . $this->get_field_id('Type_' . $i) . "','" . $this->get_field_id('Title_' . $i) . "','" . $this->get_field_id('URL_' . $i) . "'";
            echo '<th><select id="' . $this->get_field_id('Type_' . $i) . '" name="' . $this->get_field_name('Type_' . $i) . '" ' . $back_color . 'onchange="TypeSelect(' . $select_arg . ')">';
            for ($j = 0; $j < 8; $j++) {
                if ($instance['Type_' . $i] == $j) {
                    $select = ' selected="selected"';
                } else {
                    $select = '';
                }
                echo '<option ' . $select . 'value="' . $j . '">' . $type[$j] . '</option>';
            }
            echo '</select></th>';
            if ($instance['Type_' . $i] == 7) {
                $title_disible = 'disabled=disabled';
                $title_back_color = $back_color;
                $title_value = $auto_setting;
            } else {
                $title_disible = '';
                $title_back_color = $text_back_color;
                $title_value = $instance['Title_' . $i];
            }
            echo '<th style="padding:2px"><input size="24" id="' . $this->get_field_id('Title_' . $i) . '" name="' . $this->get_field_name('Title_' . $i) . '" type="text" value="' . $title_value . '" ' . $title_back_color . $title_disible . '/></th>' . "\n";
            if ($instance['Type_' . $i] > 1) {
                $url_disible = 'disabled=disabled';
                $url_back_color = $back_color;
                $url_value = $auto_setting;
            } else {
                $url_disible = '';
                $url_back_color = $text_back_color;
                $url_value = $instance['URL_' . $i];
            }
            echo '<th style="padding:2px"><input size="40" id="' . $this->get_field_id('URL_' . $i) . '" name="' . $this->get_field_name('URL_' . $i) . '" type="text" value="' . $url_value . '" ' . $url_back_color . $url_disible . '/></th>' . "\n";
            if ($instance['Visible_' . $i]) {
                $check = ' checked="checked"';
            } else {
                $check = '';
            }
            echo '<th><input size="4" id="' . $this->get_field_id('Visible_' . $i) . '" name="' . $this->get_field_name('Visible_' . $i) . '" type="checkbox" value="1"' . $check . ' /></th>' . "\n";
            echo '</tr>';
        }
        echo '</table>';
    }
Exemplo n.º 10
0
        if (isset($_POST['submit_reset'])) {
            $xpress_config->setDefault();
            $xpress_config->SettingValueWrite('update');
        }
    }
    echo '<div class="wrap">' . "\n";
    echo '<div id="icon-options-general" class="icon32"><br /></div>' . "\n";
    echo '<h2>' . __('XPressME Other Setting', 'xpressme') . "</h2><br>\n";
    //		echo 		'<div align="right"><a href="' . $xoops_admin_url . '"><h3>'. __('to XOOPS Modules Admin Page', 'xpressme') . '</h3></a></div>';
    echo '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">' . "\n";
    echo '<table class="form-table">' . "\n";
    echo $xpress_config->yes_no_radio_option('is_save_post_revision', __('The change tracking of the post is preserved', 'xpressme'), __('YES', 'xpressme'), __('NO', 'xpressme'));
    echo $xpress_config->yes_no_radio_option('is_multi_user', __('Select Multi user mode', 'xpressme'), __('YES', 'xpressme'), __('NO', 'xpressme'));
    echo $xpress_config->yes_no_radio_option('is_author_view_count', __('Is the posts author views counted?', 'xpressme'), __('YES', 'xpressme'), __('NO', 'xpressme'));
    echo $xpress_config->header_meta_option();
    echo $xpress_config->yes_no_radio_option('is_sql_debug', __('Is SQL debugging window displayed?', 'xpressme'), __('YES', 'xpressme'), __('NO', 'xpressme'));
    echo $xpress_config->yes_no_radio_option('is_block_error_display', __('Select warning display of block file version check', 'xpressme'), __('Do display', 'xpressme'), __('Do not display', 'xpressme'));
    echo "</table>\n";
    echo '<p class="submit">' . "\n";
    echo '<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />' . "\n";
    echo '<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />' . "\n";
    echo "</p>\n";
    echo "</form>\n";
    echo "</div>\n";
}
include_once dirname(__FILE__) . '/include/xpress_upgrade.php';
add_action('admin_notices', 'xpress_update_check', 3);
include_once dirname(__FILE__) . '/include/dashboard_feed.php';
if (xpress_is_wp_version('>=', '2.8')) {
    include_once dirname(__FILE__) . '/xpressme_widget_class.php';
}
Exemplo n.º 11
0
function xpress_query_filter($query)
{
    if (is_admin()) {
        return $query;
    }
    $author_cookie = 'select_' . get_xpress_dir_name() . "_author";
    if (strpos($query, 'SELECT') === false) {
        return $query;
    }
    $select_pattern = "SELECT(.*)post_author(.*)FROM";
    if (preg_match("/" . $select_pattern . "/i", $query, $select_match)) {
        return $query;
    }
    $query = preg_replace('/\\s\\s+/', ' ', $query);
    if (!empty($_COOKIE[$author_cookie])) {
        if (xpress_is_wp_version('<', '2.1')) {
            $pattern = "WHERE.*AND\\s?\\(*post_author\\s*=";
            if (preg_match("/" . $pattern . "/i", $query, $match)) {
                return $query;
            }
            $pattern = "WHERE\\s?post_author\\s*=";
            // get_usernumposts()
            if (preg_match("/" . $pattern . "/i", $query, $match)) {
                return $query;
            }
            $pattern = "WHERE.*post_status\\s*=\\s*'publish'\\s*\\)?";
            if (preg_match("/" . $pattern . "/i", $query, $match)) {
                $where_str = "{$match['0']}";
                $where_arry = split(' ', $where_str);
                $post_prefix = '';
                foreach ($where_arry as $p) {
                    if (preg_match("/post_status/", $p, $match3)) {
                        $post_prefix = preg_replace("/post_status/", "", $p);
                        $post_prefix = preg_replace("/\\(/", "", $post_prefix);
                        break;
                    }
                }
                $patern = 'WHERE';
                $replace = "WHERE {$post_prefix}post_author = " . intval($_COOKIE[$author_cookie]) . " AND ";
                $query = preg_replace("/{$patern}/", $replace, $query);
            }
        } else {
            $pattern = "WHERE.*post_type\\s*=\\s*'post'\\s*\\)?";
            if (preg_match("/" . $pattern . "/i", $query, $match)) {
                $where_str = "{$match['0']}";
                $where_arry = split(' ', $where_str);
                $post_prefix = '';
                foreach ($where_arry as $p) {
                    if (preg_match("/post_type/", $p, $match3)) {
                        $post_prefix = preg_replace("/post_type/", "", $p);
                        $post_prefix = preg_replace("/\\(/", "", $post_prefix);
                        break;
                    }
                }
                preg_match("/post_type(.*)/", $where_str, $p_match);
                $patern_s = $p_match[0];
                $patern = preg_replace('/\\)/', '\\)', $patern_s);
                $replace = $patern_s . " AND {$post_prefix}post_author = " . intval($_COOKIE[$author_cookie]) . " ";
                $query = preg_replace("/{$patern}/", $replace, $query);
            }
        }
    }
    //	xpress_show_sql_quary($query);
    return $query;
}