Plugin Directory

Changeset 1248862

Timestamp:
09/18/2015 10:23:40 PM (9 years ago)
Author:
scribu
Message:

deploy from git

Location:
smarter-navigation/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • smarter-navigation/trunk/main.php

    r692862 r1248862  
    44Description: Generates more specific previous / next post links based on referrer.
    55Author: scribu, versusbassz
    6 Version: 1.3.2
     6Version: 1.
    77Plugin URI: http://wordpress.org/extend/plugins/smarter-navigation/
    88*/
     
    1414    static $data = false;
    1515
    16     function init() {
     16    function init() {
    1717        add_action( 'template_redirect', array( __CLASS__, 'manage_cookie' ) );
    1818        add_action( 'posts_clauses', array( __CLASS__, 'posts_clauses' ), 10, 2 );
    1919    }
    2020
    21     function manage_cookie() {
     21    function manage_cookie() {
    2222        // Default conditions
    2323        $clear_condition = false;
     
    3333    }
    3434
    35     private function read_cookie() {
     35    private function read_cookie() {
    3636        if ( empty( $_COOKIE[self::NAME] ) )
    3737            return;
     
    6464    }
    6565
    66     public function set_cookie( $data = '' ) {
     66    public function set_cookie( $data = '' ) {
    6767        $data = wp_parse_args( $data, array(
    6868            'query' => json_encode( $GLOBALS['wp_query']->query ),
     
    7575    }
    7676
    77     public function clear_cookie() {
     77    public function clear_cookie() {
    7878        if ( empty( $_COOKIE[self::NAME] ) )
    7979            return;
     
    8383    }
    8484
    85     private function get_name( $key ) {
     85    private function get_name( $key ) {
    8686        return self::NAME . '[' . $key . ']';
    8787    }
  • smarter-navigation/trunk/readme.txt

    r692862 r1248862  
    44Requires at least: 3.2
    55Tested up to: 3.5
    6 Stable tag: 1.3.2
     6Stable tag: 1.
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6969== Changelog ==
    7070
     71
     72
     73
     74
    7175= 1.3.2 =
    7276* fix case when plugin worked incorrect with pagination
  • smarter-navigation/trunk/template-tags.php

    r598633 r1248862  
    33// Replaces previous_post_link()
    44// if $fallback is set to true, previous_post_link() will be called if there is no post found
    5 function previous_post_smart( $format = '« %link', $title = '%title', $fallback = true, $in_same_cat = true, $excluded_categories = '' ) {
    6     return Smarter_Navigation::adjacent_post( $format, $title, true, $fallback, $in_same_cat, $excluded_categories );
     5function previous_post_smart( $format = '« %link', $title = '%title', $fallback = true, $in_same_' ) {
     6    return Smarter_Navigation::adjacent_post( $format, $title, true, $fallback, $in_same_ );
    77}
    88
    99// Replaces next_post_link()
    1010// if $fallback is set to true, next_post_link() will be called if there is no post found
    11 function next_post_smart( $format = '%link »', $title = '%title', $fallback = true, $in_same_cat = true, $excluded_categories = '' ) {
    12     return Smarter_Navigation::adjacent_post( $format, $title, false, $fallback, $in_same_cat, $excluded_categories );
     11function next_post_smart( $format = '%link »', $title = '%title', $fallback = true, $in_same_' ) {
     12    return Smarter_Navigation::adjacent_post( $format, $title, false, $fallback, $in_same_ );
    1313}
    1414
     
    2323}
    2424
    25 // Retrieve the category, based on the referrer URL. Useful if you have posts with multiple categories
    26 function get_referrer_category() {
     25// Retrieve the term, based on the referrer URL. Useful if you have posts with multiple terms
     26// $taxonomy defaults to 'category'. Can be changed to custom taxonomy
     27function get_referrer_term( $taxonomy = 'category' ) {
    2728    global $posts;
    2829
     
    3031        return false;
    3132
    32     foreach ( get_the_category( $posts[0]->ID ) as $cat ) {
    33         $cat_link = get_category_link( $cat->term_id );
     33    foreach ( get_the_ ) {
     34        $ );
    3435
    35         if ( false !== strpos( $referrer_url, $cat_link ) )
    36             return $cat;
     36        if ( false !== strpos( $referrer_url, $_link ) )
     37            return $;
    3738    }
    3839
    3940    return false;
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
    4053}
    4154
Note: See TracChangeset for help on using the changeset viewer.