Plugin Directory

Changeset 2172087


Ignore:
Timestamp:
10/12/2019 06:52:20 AM (6 years ago)
Author:
socialrocket
Message:

Version 1.2.2 update

Location:
social-rocket/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • social-rocket/trunk/admin/css/admin.css

    r2147131 r2172087  
    16081608    border-radius: 2px;
    16091609    display: inline-block;
    1610     font-size: 15px;
     1610    font-size: 12px;
    16111611    line-height: 38px;
    16121612    cursor: pointer;
     1613    white-space: nowrap;
    16131614    width: 90%;
    16141615}
    16151616.social-rocket-settings-networks-selector .social-rocket-button i {
     1617    font-size: 15px;
    16161618    padding: 5px 5px 4px;
    16171619    margin: 7px 5px;
    16181620    vertical-align: middle;
     1621}
     1622@media (max-width: 1365px) and (min-width: 782px) {
     1623    .social-rocket-settings-networks-selector {
     1624        width: 33.33333%;
     1625    }
     1626}
     1627@media (max-width: 782px) and (min-width: 480px) {
     1628    .social-rocket-settings-networks-selector {
     1629        width: 33.33333%;
     1630    }
     1631}
     1632@media (max-width: 480px) {
     1633    .social-rocket-settings-networks-selector {
     1634        width: 50%;
     1635    }
    16191636}
    16201637
  • social-rocket/trunk/includes/class-social-rocket-background-process.php

    r2147131 r2172087  
    8585        $SR = Social_Rocket::get_instance();
    8686       
     87        $master_throttle = apply_filters( 'social_rocket_master_throttle', 1 );
     88       
    8789        // Actions to perform
    8890        switch ( $item['task'] ) {
     
    106108                if ( $now - $last < $throttle ) {
    107109                    // too soon. save this for later
    108                     $master_throttle = apply_filters( 'social_rocket_master_throttle', 1 );
    109110                    sleep( $master_throttle );
    110111                    return $item;
     
    116117                $success = $SR->update_share_count( $network, $id, $type, $url, $force );
    117118               
    118                 if ( ! $success ) {
     119                if ( $success ) {
     120                    // finished, remove the item from the queue
     121                    $item = false;
     122                } else {
    119123                    // something went wrong. try again later
     124                    sleep( $master_throttle );
    120125                    return $item;
    121126                }
     
    125130        }
    126131       
    127         return false;
     132        $item = apply_filters( 'social_rocket_background_process_task', $item );
     133       
     134        return $item;
    128135    }
    129136
  • social-rocket/trunk/includes/class-social-rocket-cron.php

    r2089576 r2172087  
    3434        $idle = $SR->background_processor->is_idle();
    3535       
    36         if ( class_exists( 'Social_Rocket_Pro' ) ) {
    37             $SRP = Social_Rocket_Pro::get_instance();
    38             if ( ! $SRP->background_processor->is_idle() ) {
    39                 $idle = false;
    40             }
    41         }
    42        
    4336        if ( ! $idle ) {
    4437            return;
  • social-rocket/trunk/includes/class-social-rocket.php

    r2147131 r2172087  
    20822082               
    20832083                // %title%
    2084                 if ( $type === 'post' ) {
    2085                     $title = html_entity_decode( the_title_attribute( 'echo=0' ) );
    2086                 } else {
    2087                     $title = html_entity_decode( wp_title( null, false ) );
    2088                 }
     2084                $title = $this->get_title( $id, $type, $url );
    20892085                $output = str_replace( '%title%', rawurlencode( $title ), $output );
    20902086       
     
    20972093       
    20982094        return apply_filters( 'social_rocket_get_share_url', $output, $id, $type, $url, $network, $scope );
     2095    }
     2096   
     2097   
     2098    public function get_title( $id = 0, $type = 'post', $url = '' ) {
     2099   
     2100        if ( ! $id ) {
     2101            $loc  = $this->where_we_at();
     2102            $id   = $loc['id'];
     2103            $type = $loc['type'];;
     2104            $url  = $loc['url'];
     2105        }
     2106       
     2107        $title = '';
     2108       
     2109        if ( $type === 'post' ) {
     2110           
     2111            // 1) check for Social Rocket setting
     2112            $title = get_post_meta( $id, 'social_rocket_og_title', true );
     2113           
     2114            // 2) if nothing, check Yoast
     2115            if ( ! $title && class_exists( 'WPSEO_OpenGraph' ) ) {
     2116                $title = get_post_meta( $id, '_yoast_wpseo_opengraph-title', true );
     2117            }
     2118           
     2119            // 3) if still nothing, use the title
     2120            if ( ! $title ) {
     2121                $title = get_the_title( $id );
     2122            }
     2123           
     2124        } elseif ( $type === 'term' ) {
     2125           
     2126            // 1) check for Social Rocket setting
     2127            $title = get_term_meta( $id, 'social_rocket_og_title', true );
     2128           
     2129            // 2) if nothing, check Yoast
     2130            if ( ! $title && class_exists( 'WPSEO_OpenGraph' ) ) {
     2131                $title = get_term_meta( $id, '_yoast_wpseo_opengraph-title', true );
     2132            }
     2133           
     2134            // 3) if still nothing, use the title
     2135            if ( ! $title ) {
     2136                $title = get_the_archive_title();
     2137            }
     2138           
     2139        } else {
     2140           
     2141            $title = wp_get_document_title();
     2142           
     2143        }
     2144       
     2145        return $title;
    20992146    }
    21002147   
     
    26952742        }
    26962743        return $content . $this->insert_inline_buttons_item_content( false );
     2744    }
     2745   
     2746
     2747   
     2748    /*
     2749     * Determine if current request is for some non-countable WordPress thing, like
     2750     * an autosave, block renderer call, some rest api nonsense, etc.
     2751     *
     2752     * @since 1.2.2
     2753     *
     2754     * @return boolean Whether current request is non-countable.
     2755     */
     2756    public function is_non_countable_request() {
     2757       
     2758        // is an admin page, or an ajax request
     2759        if ( is_admin() ) {
     2760            return true;
     2761        }
     2762       
     2763        // for rest api calls, the following is based on an idea from
     2764        // https://wordpress.stackexchange.com/questions/221202/does-something-like-is-rest-exist,
     2765        // with some modifications:
     2766        /**
     2767         * Case #1: After WP_REST_Request initialisation
     2768         * Case #2: Support "plain" permalink settings
     2769         * Case #3: It can happen that WP_Rewrite is not yet initialized,
     2770         *          so do this (wp-settings.php)
     2771         * Case #4: URL Path begins with wp-json/ (your REST prefix)
     2772         *          Also supports WP installations in subfolders
     2773         */
     2774        if (
     2775            // (#1)
     2776            ( defined( 'REST_REQUEST' ) && REST_REQUEST )
     2777            ||
     2778            // (#2)
     2779            (
     2780                isset( $_GET['rest_route'] )
     2781                && strpos( trim( $_GET['rest_route'], '\\/' ), rest_get_url_prefix(), 0 ) === 0
     2782            )
     2783        ) {
     2784            return true;
     2785        }
     2786        // (#3)
     2787        global $wp_rewrite;
     2788        if ( $wp_rewrite === null ) {
     2789            $wp_rewrite = new WP_Rewrite();
     2790        }
     2791        // (#4)
     2792        $rest_url = wp_parse_url( trailingslashit( rest_url() ) );
     2793        $current_url = wp_parse_url( add_query_arg( array() ) );
     2794        if ( strpos( $current_url['path'], $rest_url['path'], 0 ) === 0 ) {
     2795            return true;
     2796        }
     2797       
     2798        return false;
    26972799    }
    26982800   
     
    35733675        $data = $this->get_count_data( $id, $type );
    35743676       
    3575         if ( ! $force && is_admin() ) {
     3677        if ( ! $force && $this->is_non_countable_request() ) {
    35763678            // don't get counts for admin pages
    35773679            return $data;
     
    39864088        $url = $url[0];
    39874089       
     4090        // now there is one and only one query argument we will put back, because
     4091        // of WP's "plain" permalinks structure:
     4092        if ( isset( $_REQUEST['p'] ) ) {
     4093            $url = $url . '?p=' . $_REQUEST['p'];
     4094        }
     4095       
    39884096        // now figure out where we are within the WP universe... 
    39894097        $result = array(
  • social-rocket/trunk/readme.txt

    r2147131 r2172087  
    66Tested up to: 5.2
    77Requires PHP: 5.5
    8 Stable tag: 1.2.1
     8Stable tag: 1.2.2
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8383
    8484== Changelog ==
     85= 1.2.2 =
     86* FIX: issue with share URL when using "plain" permalinks.
     87* FIX: don't try to get counts for autosaves, rest api calls, etc.
     88* UPDATE: minor CSS update.
     89
    8590= 1.2.1 =
    8691* UPDATE: increased popup window height
  • social-rocket/trunk/social-rocket.php

    r2147131 r2172087  
    33 * Plugin Name: Social Rocket
    44 * Description: Social Sharing... to the Moon!
    5  * Version: 1.2.1
     5 * Version: 1.2.2
    66 * Author: Social Rocket
    77 * Author URI: http://wpsocialrocket.com/
     
    1717}
    1818
    19 define( 'SOCIAL_ROCKET_VERSION', '1.2.1' );
     19define( 'SOCIAL_ROCKET_VERSION', '1.2.2' );
    2020define( 'SOCIAL_ROCKET_DBVERSION', '3' );
    2121define( 'SOCIAL_ROCKET_PATH', plugin_dir_path( __FILE__ ) );
Note: See TracChangeset for help on using the changeset viewer.