Plugin Directory

Changeset 983255


Ignore:
Timestamp:
09/06/2014 08:24:58 PM (12 years ago)
Author:
ulih
Message:

Update to version 0.7.7

Location:
tessa-authorship
Files:
132 added
5 edited

Legend:

Unmodified
Added
Removed
  • tessa-authorship/trunk/assets/css/admin.css

    r812655 r983255  
     1/*
    12#menu-posts-authorship .wp-menu-image {
    23  background: none;
     
    2223  }
    2324}
     25*/
     26#menu-posts-authorship div.wp-menu-image:before {
     27  /*font-family: WooCommerce !important;*/
     28  content: "\f488" !important;
     29  font-size: 1.3em !important;
     30}
  • tessa-authorship/trunk/classes/tessa-authorship-tasrpas.php

    r903699 r983255  
    783783        return trim( $t, "\"'\n\r " );
    784784    }   
     785
    785786    /**
    786787     * Ajax callback function to find authors.
     
    788789     * @access public
    789790     * @since 0.1.0
     791     * @changed 0.7.7
    790792     * @return Object
    791793     * @modified 0.4.0 WPML Support
     
    793795    public function tasrpas_ajax_find_authors()
    794796    {
    795         global $tessa_authorship, $tasrpas_options, $wpdb;
     797        global $tessa_authorship, $tasrpas_options, $wpdb, $sitepress;
    796798        check_ajax_referer( 'find-authors' );
    797799
     
    811813        $searchand = $search = '';
    812814        foreach ( (array)$search_terms as $term ) {
    813             $term = esc_sql( like_escape( $term ) );
     815            $term = esc_sql( $this->tasrpas_like_escape( $term ) );//like_escape( $term ) );
    814816            $search .= "{$searchand}(($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%'))";
    815817            $searchand = ' AND ';
    816818        }
    817         $term = esc_sql( like_escape( $s ) );
     819        $term = esc_sql( $this->tasrpas_like_escape( $s ) ); //like_escape( $s ) );
    818820        if ( count($search_terms) > 1 && $search_terms[0] != $s ) {
    819821            $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')";
     
    823825            //get the lang code for the post as we are currently in default language
    824826            $post_lang = $this->tasrpas_get_language_for_element($_POST['pid'], 'post_' . $_POST['ppt']);
     827            //$def_lang = $sitepress->get_default_language();
    825828            if ( isset($post_lang) && $post_lang ) :
    826829                $lang_code = $post_lang;
     
    828831            $db_icltable = $wpdb->base_prefix . 'icl_translations';
    829832            $query_str = "
    830                 SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_status, $wpdb->posts.post_date, $wpdb->posts.post_type, {$db_icltable}.language_code
    831                 FROM $wpdb->posts, $db_icltable
    832                 WHERE $wpdb->posts.post_type = 'authorship' AND $wpdb->posts.post_status != 'revision' AND $wpdb->posts.ID = {$db_icltable}.element_id AND {$db_icltable}.language_code = '$lang_code' AND ($search)
     833                SELECT DISTINCT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_status, $wpdb->posts.post_date, $wpdb->posts.post_type, b.language_code
     834                FROM $wpdb->posts, (SELECT DISTINCT $db_icltable.element_id AS id, $db_icltable.language_code FROM $db_icltable WHERE $db_icltable.language_code = '$lang_code' AND $db_icltable.element_type = 'post_authorship') AS b
     835                WHERE $wpdb->posts.post_type = 'authorship' AND $wpdb->posts.post_status != 'revision' AND $wpdb->posts.ID = b.id AND ($search)
    833836                ORDER BY $wpdb->posts.post_date_gmt DESC LIMIT 50
    834837            ";
    835838        else :
    836839            $query_str = "
    837                 SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_status, $wpdb->posts.post_date, $wpdb->posts.post_type
     840                SELECT DISTINCT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_status, $wpdb->posts.post_date, $wpdb->posts.post_type
    838841                FROM $wpdb->posts
    839842                WHERE $wpdb->posts.post_type = 'authorship' AND $wpdb->posts.post_status != 'revision' AND ($search)
     
    842845        endif;
    843846        $posts = $wpdb->get_results( $query_str );
    844    
    845847        //try to get results if wpml is not enabled on our post-type
    846848        if ( !$posts && $wpml ) :
    847849            $wpml = false;
    848850            $query_str = "
    849                 SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_status, $wpdb->posts.post_date, $wpdb->posts.post_type
     851                SELECT DISTINCT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_status, $wpdb->posts.post_date, $wpdb->posts.post_type
    850852                FROM $wpdb->posts
    851853                WHERE $wpdb->posts.post_type = 'authorship' AND $wpdb->posts.post_status != 'revision' AND ($search)
     
    897899                */
    898900                $html .= '<tr class="authors-found"><td class="found-radio"><input type="checkbox" id="found-author-'.$post->ID.'" name="found_author_id[]" value="' . esc_attr($post->ID) . '"></td>';
    899                 $html .= '<td><label for="found-'.$post->ID.'">'.esc_html( $post->post_title ).'</label></td><td>'.esc_html( $lang_code ).'</td><td>'.esc_html( $time ).'</td><td>'.esc_html( $stat ).'</td></tr>'."\n\n";
     901                $html .= '<td><label for="found-'.$post->ID.'">'. $post->ID . ': ' .esc_html( $post->post_title ).'</label></td><td>'.esc_html( $lang_code ).'</td><td>'.esc_html( $time ).'</td><td>'.esc_html( $stat ).'</td></tr>'."\n\n";
    900902            else :
    901903                $html .= '<tr class="authors-found"><td class="found-radio"><input type="checkbox" id="found-author-'.$post->ID.'" name="found_author_id[]" value="' . esc_attr($post->ID) . '"></td>';
     
    905907        }
    906908        $html .= '</tbody></table>';
    907 
    908909        $x = new WP_Ajax_Response();
    909910        $x->add( array(
     
    920921     * @access public
    921922     * @since 0.4.0
     923     * @changed 0.7.7   
    922924     * @return Object
    923925     */
     
    944946        $in_array = array_intersect( $pt, $tasrpas_options['post_types'] );
    945947        if ( !empty($_POST['post_type'] ) && !empty( $in_array ) ) :
    946             $what = "'" . implode( "','", $in_array ) . "'";
     948            //make compatible with php < 5.3
     949            $what = implode( ",", array_map( create_function( '$at', 'return "\'" . $at . "\'";'), $in_array ) );
    947950        else :
    948951            $what = 'post';
     
    954957        $searchand = $search = '';
    955958        foreach ( (array)$search_terms as $term ) {
    956             $term = esc_sql( like_escape( $term ) );
     959            $term = esc_sql( $this->tasrpas_like_escape( $term ) );//like_escape( $term ) );
    957960            $search .= "{$searchand}(($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%'))";
    958961            $searchand = ' AND ';
    959962        }
    960         $term = esc_sql( like_escape( $s ) );
     963        $term = esc_sql( $this->tasrpas_like_escape( $s ) );//like_escape( $s ) );
    961964        if ( count($search_terms) > 1 && $search_terms[0] != $s ) {
    962965            $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')";
     
    971974           
    972975            $db_icltable = $wpdb->base_prefix . 'icl_translations';
     976            $pt_icl = explode( ",", $what );
     977            //make compatible with php < 5.3
     978            $what_icl = implode( ",", array_map( create_function( '$at', 'return "\'post_" . str_replace( "\'", "", $at ) . "\'";'), $pt_icl ) );
     979           
    973980            $query_str = "
    974                 SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_status, $wpdb->posts.post_date, $wpdb->posts.post_type, {$db_icltable}.language_code
    975                 FROM $wpdb->posts, $db_icltable
    976                 WHERE $wpdb->posts.post_type IN ($what) AND $wpdb->posts.post_status != 'revision' AND $wpdb->posts.ID = {$db_icltable}.element_id AND {$db_icltable}.language_code = '$lang_code' AND ($search)
     981                SELECT DISTINCT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_status, $wpdb->posts.post_date, $wpdb->posts.post_type, b.language_code
     982                FROM $wpdb->posts, (SELECT DISTINCT $db_icltable.element_id AS id, $db_icltable.language_code FROM $db_icltable WHERE $db_icltable.language_code = '$lang_code' AND $db_icltable.element_type IN ($what_icl) ) AS b
     983                WHERE $wpdb->posts.post_type IN ($what) AND $wpdb->posts.post_status != 'revision' AND $wpdb->posts.ID = b.id AND ($search)
    977984                ORDER BY $wpdb->posts.post_date_gmt DESC LIMIT 50
    978             ";         
     985            ";
    979986        else :
    980987            $query_str = "
     
    986993        endif;
    987994        $posts = $wpdb->get_results( $query_str );
    988        
    989995        //try to get results if wpml is not enabled on post-types
    990996        if ( !$posts && $wpml ) :
     
    11031109    <?php
    11041110    }
     1111
     1112    /*
     1113     * Avoid deprecated for like_escape for WP 4.0+
     1114     * @since 0.7.7
     1115     * @param string $term
     1116     * @return string $term
     1117     */
     1118    public function tasrpas_like_escape( $term ) {
     1119        global $wpdb, $wp_version;
     1120        if ( version_compare( $wp_version, '4.0', '>=' ) ) :
     1121            return $wpdb->esc_like( $term );
     1122        else :
     1123            return like_escape( $term );
     1124        endif;     
     1125    }
     1126   
    11051127}
  • tessa-authorship/trunk/classes/tessa-authorship.php

    r878948 r983255  
    5353            add_action( 'save_post', array( $this, 'meta_box_save' ) );
    5454            add_filter( 'enter_title_here', array( $this, 'enter_title_here' ) );
    55             add_action( 'admin_print_styles', array( $this, 'enqueue_admin_styles' ), 10 );
     55            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ), 10 );
    5656            add_filter( 'post_updated_messages', array( $this, 'updated_messages' ) );
    5757
     
    528528     * @return   void
    529529     */
    530     public function enqueue_admin_styles () {
    531         wp_register_style( 'tessa-authorship-admin', $this->assets_url . '/css/admin.css', array(), '1.0.1' );
    532         wp_enqueue_style( 'tessa-authorship-admin' );
     530    public function enqueue_admin_styles ($hook_suffix) {
     531        if ( $hook_suffix == 'edit.php' || $hook_suffix == 'authorship_page_tessa-authorship' ) :
     532            wp_register_style( 'tessa-authorship-admin', $this->assets_url . '/css/admin.css', array(), '1.0.1' );
     533            wp_enqueue_style( 'tessa-authorship-admin' );
     534        endif;
    533535    } // End enqueue_admin_styles()
    534536
  • tessa-authorship/trunk/readme.txt

    r914017 r983255  
    44Tags: tessa authorship, authorship, biography, bio, bio box, related, related post, related author, link post, link author, relation, relationship, biography box, twitter, facebook, linkedin, googleplus, google+, delicious, flickr, picasa, vimeo, youtube, reddit, website, about, author, user, about author, user box, author box, contributors, author bio, author biography, user biography, avatar, gravatar, guest post, guest author, publisher, copyright, gallery, exposition, third-party content, widget, shortcode, template-tag, social, fusion, collaboration, custom post-type, post-type, custom post type, post type
    55Requires at least: 3.4.2
    6 Tested up to: 3.9.0
    7 Stable tag: 0.7.6
     6Tested up to: 4.0
     7Stable tag: 0.7.7
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    9595
    9696= Related Authors References / Related Content References =
    97 Lists for related authors or related posts on the authors page can be shown or automatically activating the content filter in the settings or you have to use for example:
     97Lists for related authors on content pages and related posts on author pages can be shown automatically by activating the content filter in the settings page. If you don't want to add this automaticaly you can add related posts or authors manually using the following code:
    9898
    9999`<?php do_action( 'tessa_authorship' ); ?>`
     
    277277 == Changelog ==
    278278
     279 = 0.7.7 =
     280
     281* Fix and improve content or author selection in WPML context
     282* Fix for WP 4.0 deprecated like_escape-function used in the plugin
     283* Get rid off pixelated menu icon, use WP 3.8 dashicon font icon instead
     284
    279285 = 0.7.6 =
    280286
  • tessa-authorship/trunk/tessa-authorship.php

    r914017 r983255  
    55 * Description: Add wordpress independent authorship information on posts, pages, create lists of authors, reflect related content on author's page
    66 * Author: Uli Hake
    7  * Version: 0.7.6
     7 * Version: 0.7.7
    88 * Author URI: http://takebarcelona.com/authorship/uli-hake/
    99 * @author Uli Hake
     
    5151//load into global
    5252$tessa_authorship = new Tessa_Authorship( __FILE__ );
    53 $tessa_authorship->version = '0.7.3';
     53$tessa_authorship->version = '0.7.7';
    5454
    5555register_uninstall_hook( __FILE__, 'tasrpas_uninstaller' );
Note: See TracChangeset for help on using the changeset viewer.