WordPress.org

Plugin Directory

Changeset 534560


Ignore:
Timestamp:
04/21/12 20:06:15 (2 years ago)
Author:
goldenapples
Message:

Updated plugin version number, tested to number,
and a couple of bugfixes related to installation
and archive pagination.

Location:
recommended-links
Files:
10 edited
4 copied

Legend:

Unmodified
Added
Removed
  • recommended-links/tags/0.4.1/admin-functions.php

    r509618 r534560  
    150150        return; 
    151151 
    152     if ( 'reclink' === $_POST['post_type'] ) 
     152    if ( isset( $_POST['post_type'] ) && 'reclink' === $_POST['post_type'] ) 
    153153        update_post_meta( $post_ID, '_href', $_POST['_href'] ); 
    154154 
  • recommended-links/tags/0.4.1/display-filters.php

    r509618 r534560  
    257257        return $content;     
    258258 
    259     global $wp_the_query, $wp_query; 
     259    global $wp_the_query, $wp_query, $paged; 
    260260 
    261261    if ( $wp_query !== $wp_the_query ) 
    262262        return $content; 
    263263 
    264     $links_paged = ( isset( $wp_query->query_vars['paged'] ) ) ? $wp_query->query_vars['paged'] : 1; 
     264    $links_paged = ( isset( $wp_query->query['paged'] ) ) ? $wp_query->query['paged'] : 1; 
    265265    $posts_per_page = ( isset( $plugin_settings['posts_per_page'] ) ) ? $plugin_settings['posts_per_page'] : 25; 
    266266 
     267    // Backup old query, so it doesn't throw off conditionals elsewhere 
    267268    $old_query = $wp_query; 
     269    $old_paged = $paged; 
     270 
    268271    $wp_query = new WP_Query( array( 
    269272        'post_type' => 'reclink', 
     
    272275        'paged' => $links_paged 
    273276    ) ); 
    274  
     277    $paged = $links_paged; 
    275278 
    276279    /* 
     
    282285    $links_navigation = '<div class="links-navigation">' ; 
    283286 
    284     if ( $links_paged > 1 )  
     287    if ( $paged > 1 )  
    285288        $links_navigation .= '<div class="nav-previous">' . get_previous_posts_link() . '</div>'; 
    286289     
    287     if ( $found_posts > $posts_per_page * $links_paged ) 
     290    if ( $found_posts > $posts_per_page * $paged ) 
    288291        $links_navigation .= '<div class="nav-next">' . get_next_posts_link() . '</div>'; 
    289292 
     
    296299 
    297300    $wp_query = $old_query; 
     301    $paged = $old_paged; 
    298302    wp_reset_query(); 
    299303 
  • recommended-links/tags/0.4.1/plugin-activation.php

    r509618 r534560  
    22 
    33/** 
    4  * @function    reclinks_install() 
     4 * An all-purpose upgrade/install handler for this plugin. 
    55 * 
    6  * Runs on initial plugin activation. Checks for existence of tables from previous 
     6 * Handles creating new options when upgrading from one version of the plugin to the next. 
     7 * 
     8 * @uses    reclinks_install    If $from is false, calls reclinks_install() to create initial 
     9 *                              database tables 
     10 * 
     11 * @param   int|false           the db version being upgraded from 
     12 *                              // ie get_option( 'reclinks_db_version' ) 
     13 * 
     14 **/ 
     15function reclinks_db_option_upgrade( $from ) { 
     16 
     17    $current_version = 5; 
     18 
     19    if ( $from === $current_version ) return; 
     20 
     21    if ( $from === false ) 
     22        reclinks_install(); 
     23 
     24 
     25    $old_settings = ( $from ) ? get_option( 'reclinks_plugin_options' ) : array(); 
     26 
     27    /* DB version 5, reflects plugin version 0.4early. Introduces bookmarklet settings options. 
     28    /* DB version 4, reflects plugin version 0.4early. Includes 'vote-on-comments' settings. */ 
     29    /* DB version 3, reflects plugin version 0.3. Includes 'tax' string. */ 
     30    $reclinks_plugin_defaults = array( 
     31        'vote-values' => array( 
     32            'minus' => array( 'value' => -1, 'text' => '-' ), 
     33            'plus' => array( 'value' => 1, 'text' => '+' ) 
     34        ), 
     35        'page_for_reclinks' => false, 
     36        'sort_order' => 'current', 
     37        'allow-unregistered-vote' => false, 
     38        'allow-unregistered-post' => false, 
     39        'vote-on-comments' => true, 
     40        'tax' => array(), 
     41        'bookmarklet_text' => sprintf( __( 'Post to %s', 'reclinks' ), get_option( 'blogname' ) ), 
     42        'bookmarklet_class' => 'reclinks-bookmarklet', 
     43        'bookmarklet_header' => '' 
     44    ); 
     45 
     46    $options_to_set = wp_parse_args( $old_settings, $reclinks_plugin_defaults ); 
     47 
     48    update_option( 'reclinks_plugin_options', $options_to_set ); 
     49    update_option( 'reclinks_db_version', 5 ); 
     50 
     51} 
     52 
     53 
     54/** 
     55 * Should run on initial plugin activation. Checks for existence of tables from previous 
    756 * version of plugin, and if present, imports all old link and vote entries into new  
    857 * custom post type and comments. Also should set default options for the plugin, if  
     
    3988        dbDelta($sql); 
    4089    } 
    41  
    42     // Create default options in database settings 
    43     $v = get_option( 'reclinks_db_version' ); 
    44     reclinks_db_option_upgrade( $v ); 
    45  
    46 } 
    47  
    48  
    49 /** 
    50  * Create default options settings. 
    51  * 
    52  * Handles creating new options when upgrading from one version of the plugin to the next. 
    53  * 
    54  * @param   int     the db version being upgraded from 
    55  *                  // ie get_option( 'reclinks_db_version' ) 
    56  * 
    57  **/ 
    58 function reclinks_db_option_upgrade( $from ) { 
    59  
    60     if ( $from === 5 ) return; 
    61  
    62     $old_settings = ( $from ) ? get_option( 'reclinks_plugin_options' ) : array(); 
    63  
    64     /* DB version 5, reflects plugin version 0.4early. Introduces bookmarklet settings options. 
    65     /* DB version 4, reflects plugin version 0.4early. Includes 'vote-on-comments' settings. */ 
    66     /* DB version 3, reflects plugin version 0.3. Includes 'tax' string. */ 
    67     $reclinks_plugin_defaults = array( 
    68         'vote-values' => array( 
    69             'minus' => array( 'value' => -1, 'text' => '-' ), 
    70             'plus' => array( 'value' => 1, 'text' => '+' ) 
    71         ), 
    72         'page_for_reclinks' => false, 
    73         'sort_order' => 'current', 
    74         'allow-unregistered-vote' => false, 
    75         'allow-unregistered-post' => false, 
    76         'vote-on-comments' => true, 
    77         'tax' => array(), 
    78         'bookmarklet_text' => sprintf( __( 'Post to %s', 'reclinks' ), get_option( 'blogname' ) ), 
    79         'bookmarklet_class' => 'reclinks-bookmarklet', 
    80         'bookmarklet_header' => '' 
    81     ); 
    82  
    83     $options_to_set = wp_parse_args( $old_settings, $reclinks_plugin_defaults ); 
    84  
    85     update_option( 'reclinks_plugin_options', $options_to_set ); 
    86     update_option( 'reclinks_db_version', 5 ); 
    8790 
    8891} 
     
    155158    $wpdb->query( "DROP TABLE IF EXISTS $reclinks_old_votes_table" ); 
    156159    $wpdb->query( "DROP TABLE IF EXISTS $reclinks_old_table;" ); 
     160 
    157161} 
    158162 
  • recommended-links/tags/0.4.1/readme.txt

    r509618 r534560  
    44Tags: social bookmarking, sharing, voting, reddit, digg 
    55Requires at least: 3.2.1 
    6 Tested up to: 3.3.1 
    7 Stable tag: 0.4 
     6Tested up to: 3.4 
     7Stable tag: 0.4.1 
    88 
    99A sort of "Reddit clone" that allows users to post links, up- or down-vote them, and comment on them. 
     
    2020 
    2121== Changelog == 
     22 
     23= 0.4.1 = 
     24 
     25Fixes pagination bug when reclinks archive is set to front page and bug in install hook function. 
    2226 
    2327= 0.4 = 
  • recommended-links/tags/0.4.1/recommended-links.php

    r509618 r534560  
    8282 
    8383// Activation / deactivation 
    84 include_once( plugin_dir_path( __FILE__ ) . 'plugin-activation.php' ); 
    85 register_activation_hook( __FILE__, 'reclinks_install' ); 
    86 register_deactivation_hook( __FILE__, 'reclinks_uninstall'); 
    87  
    88  
    8984add_action( 'admin_init', 'gad_check_db_tables' ); 
    9085 
    9186function gad_check_db_tables() { 
    9287    $v = get_option( 'reclinks_db_version' ); 
    93     if ( !$v || $v < 5 ) 
    94         reclinks_db_option_upgrade( $v ); 
     88    if ( !$v || $v < 5 ) { 
     89            include_once( plugin_dir_path( __FILE__ ) . 'plugin-activation.php' ); 
     90            reclinks_db_option_upgrade( $v ); 
     91    } 
    9592} 
    9693 
  • recommended-links/trunk/admin-functions.php

    r509618 r534560  
    150150        return; 
    151151 
    152     if ( 'reclink' === $_POST['post_type'] ) 
     152    if ( isset( $_POST['post_type'] ) && 'reclink' === $_POST['post_type'] ) 
    153153        update_post_meta( $post_ID, '_href', $_POST['_href'] ); 
    154154 
  • recommended-links/trunk/display-filters.php

    r509618 r534560  
    257257        return $content;     
    258258 
    259     global $wp_the_query, $wp_query; 
     259    global $wp_the_query, $wp_query, $paged; 
    260260 
    261261    if ( $wp_query !== $wp_the_query ) 
    262262        return $content; 
    263263 
    264     $links_paged = ( isset( $wp_query->query_vars['paged'] ) ) ? $wp_query->query_vars['paged'] : 1; 
     264    $links_paged = ( isset( $wp_query->query['paged'] ) ) ? $wp_query->query['paged'] : 1; 
    265265    $posts_per_page = ( isset( $plugin_settings['posts_per_page'] ) ) ? $plugin_settings['posts_per_page'] : 25; 
    266266 
     267    // Backup old query, so it doesn't throw off conditionals elsewhere 
    267268    $old_query = $wp_query; 
     269    $old_paged = $paged; 
     270 
    268271    $wp_query = new WP_Query( array( 
    269272        'post_type' => 'reclink', 
     
    272275        'paged' => $links_paged 
    273276    ) ); 
    274  
     277    $paged = $links_paged; 
    275278 
    276279    /* 
     
    282285    $links_navigation = '<div class="links-navigation">' ; 
    283286 
    284     if ( $links_paged > 1 )  
     287    if ( $paged > 1 )  
    285288        $links_navigation .= '<div class="nav-previous">' . get_previous_posts_link() . '</div>'; 
    286289     
    287     if ( $found_posts > $posts_per_page * $links_paged ) 
     290    if ( $found_posts > $posts_per_page * $paged ) 
    288291        $links_navigation .= '<div class="nav-next">' . get_next_posts_link() . '</div>'; 
    289292 
     
    296299 
    297300    $wp_query = $old_query; 
     301    $paged = $old_paged; 
    298302    wp_reset_query(); 
    299303 
  • recommended-links/trunk/plugin-activation.php

    r509618 r534560  
    22 
    33/** 
    4  * @function    reclinks_install() 
     4 * An all-purpose upgrade/install handler for this plugin. 
    55 * 
    6  * Runs on initial plugin activation. Checks for existence of tables from previous 
     6 * Handles creating new options when upgrading from one version of the plugin to the next. 
     7 * 
     8 * @uses    reclinks_install    If $from is false, calls reclinks_install() to create initial 
     9 *                              database tables 
     10 * 
     11 * @param   int|false           the db version being upgraded from 
     12 *                              // ie get_option( 'reclinks_db_version' ) 
     13 * 
     14 **/ 
     15function reclinks_db_option_upgrade( $from ) { 
     16 
     17    $current_version = 5; 
     18 
     19    if ( $from === $current_version ) return; 
     20 
     21    if ( $from === false ) 
     22        reclinks_install(); 
     23 
     24 
     25    $old_settings = ( $from ) ? get_option( 'reclinks_plugin_options' ) : array(); 
     26 
     27    /* DB version 5, reflects plugin version 0.4early. Introduces bookmarklet settings options. 
     28    /* DB version 4, reflects plugin version 0.4early. Includes 'vote-on-comments' settings. */ 
     29    /* DB version 3, reflects plugin version 0.3. Includes 'tax' string. */ 
     30    $reclinks_plugin_defaults = array( 
     31        'vote-values' => array( 
     32            'minus' => array( 'value' => -1, 'text' => '-' ), 
     33            'plus' => array( 'value' => 1, 'text' => '+' ) 
     34        ), 
     35        'page_for_reclinks' => false, 
     36        'sort_order' => 'current', 
     37        'allow-unregistered-vote' => false, 
     38        'allow-unregistered-post' => false, 
     39        'vote-on-comments' => true, 
     40        'tax' => array(), 
     41        'bookmarklet_text' => sprintf( __( 'Post to %s', 'reclinks' ), get_option( 'blogname' ) ), 
     42        'bookmarklet_class' => 'reclinks-bookmarklet', 
     43        'bookmarklet_header' => '' 
     44    ); 
     45 
     46    $options_to_set = wp_parse_args( $old_settings, $reclinks_plugin_defaults ); 
     47 
     48    update_option( 'reclinks_plugin_options', $options_to_set ); 
     49    update_option( 'reclinks_db_version', 5 ); 
     50 
     51} 
     52 
     53 
     54/** 
     55 * Should run on initial plugin activation. Checks for existence of tables from previous 
    756 * version of plugin, and if present, imports all old link and vote entries into new  
    857 * custom post type and comments. Also should set default options for the plugin, if  
     
    3988        dbDelta($sql); 
    4089    } 
    41  
    42     // Create default options in database settings 
    43     $v = get_option( 'reclinks_db_version' ); 
    44     reclinks_db_option_upgrade( $v ); 
    45  
    46 } 
    47  
    48  
    49 /** 
    50  * Create default options settings. 
    51  * 
    52  * Handles creating new options when upgrading from one version of the plugin to the next. 
    53  * 
    54  * @param   int     the db version being upgraded from 
    55  *                  // ie get_option( 'reclinks_db_version' ) 
    56  * 
    57  **/ 
    58 function reclinks_db_option_upgrade( $from ) { 
    59  
    60     if ( $from === 5 ) return; 
    61  
    62     $old_settings = ( $from ) ? get_option( 'reclinks_plugin_options' ) : array(); 
    63  
    64     /* DB version 5, reflects plugin version 0.4early. Introduces bookmarklet settings options. 
    65     /* DB version 4, reflects plugin version 0.4early. Includes 'vote-on-comments' settings. */ 
    66     /* DB version 3, reflects plugin version 0.3. Includes 'tax' string. */ 
    67     $reclinks_plugin_defaults = array( 
    68         'vote-values' => array( 
    69             'minus' => array( 'value' => -1, 'text' => '-' ), 
    70             'plus' => array( 'value' => 1, 'text' => '+' ) 
    71         ), 
    72         'page_for_reclinks' => false, 
    73         'sort_order' => 'current', 
    74         'allow-unregistered-vote' => false, 
    75         'allow-unregistered-post' => false, 
    76         'vote-on-comments' => true, 
    77         'tax' => array(), 
    78         'bookmarklet_text' => sprintf( __( 'Post to %s', 'reclinks' ), get_option( 'blogname' ) ), 
    79         'bookmarklet_class' => 'reclinks-bookmarklet', 
    80         'bookmarklet_header' => '' 
    81     ); 
    82  
    83     $options_to_set = wp_parse_args( $old_settings, $reclinks_plugin_defaults ); 
    84  
    85     update_option( 'reclinks_plugin_options', $options_to_set ); 
    86     update_option( 'reclinks_db_version', 5 ); 
    8790 
    8891} 
     
    155158    $wpdb->query( "DROP TABLE IF EXISTS $reclinks_old_votes_table" ); 
    156159    $wpdb->query( "DROP TABLE IF EXISTS $reclinks_old_table;" ); 
     160 
    157161} 
    158162 
  • recommended-links/trunk/readme.txt

    r509618 r534560  
    44Tags: social bookmarking, sharing, voting, reddit, digg 
    55Requires at least: 3.2.1 
    6 Tested up to: 3.3.1 
    7 Stable tag: 0.4 
     6Tested up to: 3.4 
     7Stable tag: 0.4.1 
    88 
    99A sort of "Reddit clone" that allows users to post links, up- or down-vote them, and comment on them. 
     
    2020 
    2121== Changelog == 
     22 
     23= 0.4.1 = 
     24 
     25Fixes pagination bug when reclinks archive is set to front page and bug in install hook function. 
    2226 
    2327= 0.4 = 
  • recommended-links/trunk/recommended-links.php

    r509618 r534560  
    8282 
    8383// Activation / deactivation 
    84 include_once( plugin_dir_path( __FILE__ ) . 'plugin-activation.php' ); 
    85 register_activation_hook( __FILE__, 'reclinks_install' ); 
    86 register_deactivation_hook( __FILE__, 'reclinks_uninstall'); 
    87  
    88  
    8984add_action( 'admin_init', 'gad_check_db_tables' ); 
    9085 
    9186function gad_check_db_tables() { 
    9287    $v = get_option( 'reclinks_db_version' ); 
    93     if ( !$v || $v < 5 ) 
    94         reclinks_db_option_upgrade( $v ); 
     88    if ( !$v || $v < 5 ) { 
     89            include_once( plugin_dir_path( __FILE__ ) . 'plugin-activation.php' ); 
     90            reclinks_db_option_upgrade( $v ); 
     91    } 
    9592} 
    9693 
Note: See TracChangeset for help on using the changeset viewer.