Plugin Directory

Changeset 740878


Ignore:
Timestamp:
07/15/2013 08:04:09 AM (13 years ago)
Author:
yuka2py
Message:

updated v0.4.3

Location:
wp-over-network
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wp-over-network/tags/0.4.3/WPONW_RecentPostsWidget.php

    r739008 r740878  
    1212
    1313
     14
    1415    function __construct() {
    1516        $widget_ops = array(
     
    1819        );
    1920        parent::__construct( self::IDENTIFIER, __( 'Recent Posts over Network', wponw::WPONW_PREFIX ), $widget_ops );
    20         $this->alt_option_name = 'WPONW_RecentPostsWidget';
     21        // $this->alt_option_name = 'WPONW_RecentPostsWidget';
    2122
    2223        add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
  • wp-over-network/tags/0.4.3/readme.txt

    r739023 r740878  
    55Requires at least: 3.5
    66Tested up to: 3.5.1
    7 Stable tag: 0.4.2
     7Stable tag: 0.4.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7171= Using as Shortcode =
    7272
    73 Arguments, can be used the same as `wponw::render_post_archive_to_string`.
    74 
    7573**Display with default.**
    7674
    7775    [wponw_recent_post_list]
     76
     77Arguments, can be used the same as `wponw::render_post_archive_to_string`.
    7878
    7979**Use your template file, includes 3 post types**
     
    9191You create the new page, and write the below shortcode in the post content.
    9292
    93     [wponw_recent_post_list post_type=products,updates]
     93    [wponw_recent_post_list post_type=post exclude_blog_ids=1 affect_wp_query=true]
    9494
    9595
     
    112112== Upgrade Notice ==
    113113
     114= 0.4.3 =
     115* Deprecated the `wponw_recent_post_list`. Please use the `wponw_post_list` instead.
     116
    114117= 0.4.2 =
    115118* I changed the file name, for the plug-in file management issues on.
    116 
    117119
    118120= 0.4.0 / 0.4.1 =
     
    127129
    128130== Changelog ==
     131
     132= 0.4.3 =
     133* Added the shortcode of `wponw_reset_query` and `wponw_post_list`.
     134* Deprecated the `wponw_recent_post_list`. Please use the `wponw_post_list` instead.
    129135
    130136= 0.4.2 =
  • wp-over-network/tags/0.4.3/wp-over-network.php

    r739020 r740878  
    66Author: HissyNC, yuka2py
    77Author URI: https://github.com/yuka2py/wp_over_network
    8 Version: 0.4.2
     8Version: 0.4.3
    99*/
    1010
     
    4848     */
    4949    static public function setup() {
    50 
    5150        //Loading transration.
    5251        load_plugin_textdomain( wponw::WPONW_PREFIX, false, 'wp_over_network/languages' );
     
    5958
    6059        //Add shortcode.
    61         add_shortcode('wponw_recent_post_list', array( 'wponw', 'render_post_archive_to_string' ) );
     60        add_shortcode('wponw_recent_post_list', array( 'wponw', 'render_post_archive_to_string' ) ); //deprecation
     61        add_shortcode('wponw_post_list', array( 'wponw', 'render_post_archive_to_string' ) );
     62        add_shortcode('wponw_reset_query', 'wp_reset_query' );
    6263    }
    6364
     
    8485    /**
    8586     * Get posts over network.
    86      * @param  mixed  $args
     87     * @param  mixed[optional]  $args
    8788     *    numberposts    Max number of posts to get。Default is 5.
    8889     *    offset    Offset number to get. Default is false. If specified, it takes precedence over 'paged'.
     
    9495     *    blog_ids    IDs of the blog to get. Default is null.
    9596     *    exclude_blog_ids    IDs of the blog that you want to exclude. Default is null.
     97     *    blog_conditions    get_blogs
    9698     *    affect_wp_query    Whether or not affect the $wp_query. Default is false, means NOT affect. Specify true for the plugins that depend on $wp_query.
    9799     *    transient_expires_in  Specify seconds of the expiry for the cache. Default is 0, means Transient not use.
     
    110112            'order' => 'DESC',
    111113            'post_status' => 'publish',
     114            'affect_wp_query' => false,
    112115            'blog_ids' => null,
    113116            'exclude_blog_ids' => null,
    114             'affect_wp_query' => false,
    115             'transient_expires_in' => 0,
     117            'blog_conditions' => array(),
     118            'transient_expires_in' => false,
    116119        ) );
    117120
     
    137140            }
    138141
    139             //Get blog information
    140             $blogs = self::get_blogs( compact( 'blog_ids', 'exclude_blog_ids', 'transient_expires_in' ) );
     142            //Get blogs
     143            $blog_conditions = (array) $blog_conditions;
     144            if ( ! empty( $blog_ids ) ) {
     145                $blog_conditions['blog_ids'] = $blog_ids;
     146            }
     147            if ( ! empty( $exclude_blog_ids ) ) {
     148                $blog_conditions['exclude_blog_ids'] = $exclude_blog_ids;
     149            }
     150            $blogs = self::get_blogs( $blog_conditions );
    141151
    142152            //Prepare common where clause.
     
    169179            //Execute query
    170180            $posts = $wpdb->get_results( $query );
     181           
    171182            $found_posts = $wpdb->get_results( 'SELECT FOUND_ROWS() as count' );
    172183            $found_posts = $found_posts[0]->count;
     
    198209     * Get blog list.
    199210     * Object to be returned, including the Home URL and blog name in addition to the blog data.
    200      * @param  mixed  $args
     211     * @param  mixed[optional]  $args
    201212     *    blog_ids    Specifies the blog ID to get. Default is null.
    202213     *    exclude_blog_ids    Specifies the blog ID to exclude. Default is null.
     214     *    public   Default is 1.
     215     *    archived    Default is 0.
     216     *    mature    Default is 0.
     217     *    spam    Default is 0.
     218     *    deleted    Default is 0.
    203219     *    transient_expires_in    Specify when using the Transient API. specify the value, in seconds. Default is false, means not use Transient API.
    204220     * @return  array<stdClass>
     
    211227            'blog_ids' => null,
    212228            'exclude_blog_ids' => null,
     229            'public' => 1,
     230            'archived' => 0,
     231            'mature' => 0,
     232            'spam' => 0,
     233            'deleted' => 0,
    213234            'transient_expires_in' => false,
    214235        ) );
     
    223244        extract( $args );
    224245
    225         if ( empty( $blogs ) ) {
    226             //If necessary, prepare the where clause
     246        if ( empty( $blogs ) )
     247        {
    227248            $where = array();
    228             if ( $blog_ids ) {
     249            if ( ! is_null( $public ) )
     250                $where[] = sprintf( 'public = %d', $public );
     251            if ( ! is_null( $archived ) )
     252                $where[] = sprintf( 'archived = \'%s\'', (int) $archived );
     253            if ( ! is_null( $mature ) )
     254                $where[] = sprintf( 'mature = %d', $mature );
     255            if ( ! is_null( $spam ) )
     256                $where[] = sprintf( 'spam = %d', $spam );
     257            if ( ! is_null( $deleted ) )
     258                $where[] = sprintf( 'deleted = %d', $deleted );
     259            if ( $blog_ids )
    229260                $where[] = sprintf( 'blog_id IN (%s)', self::cleanids( $blog_ids ) );
    230             }
    231             if ( $exclude_blog_ids ) {
     261            if ( $exclude_blog_ids )
    232262                $where[] = sprintf( 'blog_id NOT IN (%s)', self::cleanids( $exclude_blog_ids ) );
    233             }
    234263
    235264            //Build query
     
    320349        if ( empty( $args['renderer'] ) ) {
    321350            $args['posts'] = $posts;
    322             return self::render_to_string( $args['template'], $args );
     351            $rendered = self::render_to_string( $args['template'], $args );
    323352        } else {
    324353            ob_start();
    325354            call_user_func( $args['renderer'], $posts, $args );
    326             return ob_get_clean();
    327         }
     355            $rendered = ob_get_clean();
     356        }
     357
     358        return $rendered;
    328359    }
    329360
     
    409440
    410441
    411     static public function cleanids($ids) {
    412         if ( is_array( $ids ) ) {
    413             $ids = array_map( 'intval', $ids );
    414         } else {
    415             $ids = preg_split( '/[^\d]+/', strval( $ids ), -1, PREG_SPLIT_NO_EMPTY );
    416         }
    417         $ids = implode(',', $ids);
    418         return $ids;
     442    static public function cleanids( $ids ) {
     443        return implode( ',', wp_parse_id_list( $ids ) );
    419444    }
    420445
  • wp-over-network/trunk/WPONW_RecentPostsWidget.php

    r739008 r740878  
    1212
    1313
     14
    1415    function __construct() {
    1516        $widget_ops = array(
     
    1819        );
    1920        parent::__construct( self::IDENTIFIER, __( 'Recent Posts over Network', wponw::WPONW_PREFIX ), $widget_ops );
    20         $this->alt_option_name = 'WPONW_RecentPostsWidget';
     21        // $this->alt_option_name = 'WPONW_RecentPostsWidget';
    2122
    2223        add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
  • wp-over-network/trunk/readme.txt

    r739023 r740878  
    55Requires at least: 3.5
    66Tested up to: 3.5.1
    7 Stable tag: 0.4.2
     7Stable tag: 0.4.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7171= Using as Shortcode =
    7272
    73 Arguments, can be used the same as `wponw::render_post_archive_to_string`.
    74 
    7573**Display with default.**
    7674
    7775    [wponw_recent_post_list]
     76
     77Arguments, can be used the same as `wponw::render_post_archive_to_string`.
    7878
    7979**Use your template file, includes 3 post types**
     
    9191You create the new page, and write the below shortcode in the post content.
    9292
    93     [wponw_recent_post_list post_type=products,updates]
     93    [wponw_recent_post_list post_type=post exclude_blog_ids=1 affect_wp_query=true]
    9494
    9595
     
    112112== Upgrade Notice ==
    113113
     114= 0.4.3 =
     115* Deprecated the `wponw_recent_post_list`. Please use the `wponw_post_list` instead.
     116
    114117= 0.4.2 =
    115118* I changed the file name, for the plug-in file management issues on.
    116 
    117119
    118120= 0.4.0 / 0.4.1 =
     
    127129
    128130== Changelog ==
     131
     132= 0.4.3 =
     133* Added the shortcode of `wponw_reset_query` and `wponw_post_list`.
     134* Deprecated the `wponw_recent_post_list`. Please use the `wponw_post_list` instead.
    129135
    130136= 0.4.2 =
  • wp-over-network/trunk/wp-over-network.php

    r739020 r740878  
    66Author: HissyNC, yuka2py
    77Author URI: https://github.com/yuka2py/wp_over_network
    8 Version: 0.4.2
     8Version: 0.4.3
    99*/
    1010
     
    4848     */
    4949    static public function setup() {
    50 
    5150        //Loading transration.
    5251        load_plugin_textdomain( wponw::WPONW_PREFIX, false, 'wp_over_network/languages' );
     
    5958
    6059        //Add shortcode.
    61         add_shortcode('wponw_recent_post_list', array( 'wponw', 'render_post_archive_to_string' ) );
     60        add_shortcode('wponw_recent_post_list', array( 'wponw', 'render_post_archive_to_string' ) ); //deprecation
     61        add_shortcode('wponw_post_list', array( 'wponw', 'render_post_archive_to_string' ) );
     62        add_shortcode('wponw_reset_query', 'wp_reset_query' );
    6263    }
    6364
     
    8485    /**
    8586     * Get posts over network.
    86      * @param  mixed  $args
     87     * @param  mixed[optional]  $args
    8788     *    numberposts    Max number of posts to get。Default is 5.
    8889     *    offset    Offset number to get. Default is false. If specified, it takes precedence over 'paged'.
     
    9495     *    blog_ids    IDs of the blog to get. Default is null.
    9596     *    exclude_blog_ids    IDs of the blog that you want to exclude. Default is null.
     97     *    blog_conditions    get_blogs
    9698     *    affect_wp_query    Whether or not affect the $wp_query. Default is false, means NOT affect. Specify true for the plugins that depend on $wp_query.
    9799     *    transient_expires_in  Specify seconds of the expiry for the cache. Default is 0, means Transient not use.
     
    110112            'order' => 'DESC',
    111113            'post_status' => 'publish',
     114            'affect_wp_query' => false,
    112115            'blog_ids' => null,
    113116            'exclude_blog_ids' => null,
    114             'affect_wp_query' => false,
    115             'transient_expires_in' => 0,
     117            'blog_conditions' => array(),
     118            'transient_expires_in' => false,
    116119        ) );
    117120
     
    137140            }
    138141
    139             //Get blog information
    140             $blogs = self::get_blogs( compact( 'blog_ids', 'exclude_blog_ids', 'transient_expires_in' ) );
     142            //Get blogs
     143            $blog_conditions = (array) $blog_conditions;
     144            if ( ! empty( $blog_ids ) ) {
     145                $blog_conditions['blog_ids'] = $blog_ids;
     146            }
     147            if ( ! empty( $exclude_blog_ids ) ) {
     148                $blog_conditions['exclude_blog_ids'] = $exclude_blog_ids;
     149            }
     150            $blogs = self::get_blogs( $blog_conditions );
    141151
    142152            //Prepare common where clause.
     
    169179            //Execute query
    170180            $posts = $wpdb->get_results( $query );
     181           
    171182            $found_posts = $wpdb->get_results( 'SELECT FOUND_ROWS() as count' );
    172183            $found_posts = $found_posts[0]->count;
     
    198209     * Get blog list.
    199210     * Object to be returned, including the Home URL and blog name in addition to the blog data.
    200      * @param  mixed  $args
     211     * @param  mixed[optional]  $args
    201212     *    blog_ids    Specifies the blog ID to get. Default is null.
    202213     *    exclude_blog_ids    Specifies the blog ID to exclude. Default is null.
     214     *    public   Default is 1.
     215     *    archived    Default is 0.
     216     *    mature    Default is 0.
     217     *    spam    Default is 0.
     218     *    deleted    Default is 0.
    203219     *    transient_expires_in    Specify when using the Transient API. specify the value, in seconds. Default is false, means not use Transient API.
    204220     * @return  array<stdClass>
     
    211227            'blog_ids' => null,
    212228            'exclude_blog_ids' => null,
     229            'public' => 1,
     230            'archived' => 0,
     231            'mature' => 0,
     232            'spam' => 0,
     233            'deleted' => 0,
    213234            'transient_expires_in' => false,
    214235        ) );
     
    223244        extract( $args );
    224245
    225         if ( empty( $blogs ) ) {
    226             //If necessary, prepare the where clause
     246        if ( empty( $blogs ) )
     247        {
    227248            $where = array();
    228             if ( $blog_ids ) {
     249            if ( ! is_null( $public ) )
     250                $where[] = sprintf( 'public = %d', $public );
     251            if ( ! is_null( $archived ) )
     252                $where[] = sprintf( 'archived = \'%s\'', (int) $archived );
     253            if ( ! is_null( $mature ) )
     254                $where[] = sprintf( 'mature = %d', $mature );
     255            if ( ! is_null( $spam ) )
     256                $where[] = sprintf( 'spam = %d', $spam );
     257            if ( ! is_null( $deleted ) )
     258                $where[] = sprintf( 'deleted = %d', $deleted );
     259            if ( $blog_ids )
    229260                $where[] = sprintf( 'blog_id IN (%s)', self::cleanids( $blog_ids ) );
    230             }
    231             if ( $exclude_blog_ids ) {
     261            if ( $exclude_blog_ids )
    232262                $where[] = sprintf( 'blog_id NOT IN (%s)', self::cleanids( $exclude_blog_ids ) );
    233             }
    234263
    235264            //Build query
     
    320349        if ( empty( $args['renderer'] ) ) {
    321350            $args['posts'] = $posts;
    322             return self::render_to_string( $args['template'], $args );
     351            $rendered = self::render_to_string( $args['template'], $args );
    323352        } else {
    324353            ob_start();
    325354            call_user_func( $args['renderer'], $posts, $args );
    326             return ob_get_clean();
    327         }
     355            $rendered = ob_get_clean();
     356        }
     357
     358        return $rendered;
    328359    }
    329360
     
    409440
    410441
    411     static public function cleanids($ids) {
    412         if ( is_array( $ids ) ) {
    413             $ids = array_map( 'intval', $ids );
    414         } else {
    415             $ids = preg_split( '/[^\d]+/', strval( $ids ), -1, PREG_SPLIT_NO_EMPTY );
    416         }
    417         $ids = implode(',', $ids);
    418         return $ids;
     442    static public function cleanids( $ids ) {
     443        return implode( ',', wp_parse_id_list( $ids ) );
    419444    }
    420445
Note: See TracChangeset for help on using the changeset viewer.