Plugin Directory

Changeset 3083885


Ignore:
Timestamp:
05/09/2024 11:16:52 AM (22 months ago)
Author:
flowdee
Message:

Update to version 2.1.3 from GitHub

Location:
clickwhale
Files:
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • clickwhale/tags/2.1.3/clickwhale.php

    r3078528 r3083885  
    1010 * Plugin URI:        https://clickwhale.pro
    1111 * Description:       Link Manager, Link Shortener and Click Tracker for Affiliate Links & Link Pages.
    12  * Version:           2.1.2
     12 * Version:           2.1.3
    1313 * Requires at least: 5.0
    1414 * Requires PHP:      7.4
     
    3131     * Current plugin version.
    3232     */
    33     define( 'CLICKWHALE_VERSION', '2.1.2' );
     33    define( 'CLICKWHALE_VERSION', '2.1.3' );
    3434    define( 'CLICKWHALE_NAME', 'clickwhale' );
    3535    /**
     
    6565                    'public_key'      => 'pk_07a5633bd94c00467e7e58c200504',
    6666                    'is_premium'      => false,
    67                     'premium_suffix'  => 'Pro',
     67                    'premium_suffix'  => '(Pro)',
    6868                    'has_addons'      => false,
    6969                    'has_paid_plans'  => true,
  • clickwhale/tags/2.1.3/includes/Clickwhale_Activator.php

    r3040533 r3083885  
    212212            );
    213213        }
     214
     215        /* @since 2.1.3 */
     216        if ( version_compare( CLICKWHALE_VERSION, '2.1.3', '>=' ) &&
     217            ! get_option( 'clickwhale_updated_links_table_url_column' )
     218        ){
     219            $query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}clickwhale_links MODIFY COLUMN url varchar(1000) DEFAULT '' NOT NULL" );
     220
     221            if ( $query ) {
     222                add_option( 'clickwhale_updated_links_table_url_column', CLICKWHALE_VERSION );
     223            }
     224        }
    214225    }
    215226
  • clickwhale/tags/2.1.3/includes/admin/links/Clickwhale_Link_Edit.php

    r3070750 r3083885  
    1111class Clickwhale_Link_Edit extends Clickwhale_Instance_Edit {
    1212
    13     public function __construct() {
     13    /**
     14     * @var string
     15     */
     16    private $links_table;
     17
     18    public function __construct() {
    1419        parent::__construct( 'links', 'link' );
     20
     21        $this->links_table = Helper::get_db_table_name( $this->instance_plural );
    1522    }
    1623
     
    5360        global $wpdb;
    5461
    55         $links_table        = Helper::get_db_table_name( $this->instance_plural );
    56         $item               = array_intersect_key( $_POST, $this->get_defaults() );
    57 
     62        /* @since 2.1.3 */
     63        if ( version_compare( CLICKWHALE_VERSION, '2.1.3', '>=' ) &&
     64            ! get_option( 'clickwhale_updated_links_table_url_column' )
     65        ){
     66            require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     67            $query = $wpdb->query( "ALTER TABLE $this->links_table MODIFY COLUMN url varchar(1000) DEFAULT '' NOT NULL" );
     68
     69            if ( $query ) {
     70                add_option( 'clickwhale_updated_links_table_url_column', CLICKWHALE_VERSION );
     71            }
     72        }
     73
     74        $item = array_intersect_key( $_POST, $this->get_defaults() );
    5875        $item['categories'] = isset( $item['categories'] ) ? implode( ',', $item['categories'] ) : '';
    5976        $item['nofollow']   = isset( $item['nofollow'] );
     
    6683        if ( Links_Helper::get_by_id( intval( $item['id'] ) ) ) {
    6784            $wpdb->update(
    68                 $links_table,
     85                $this->links_table,
    6986                $item,
    7087                array( 'id' => $item['id'] )
     
    7491        } else {
    7592            $wpdb->insert(
    76                 $links_table,
     93                $this->links_table,
    7794                $item
    7895            );
  • clickwhale/tags/2.1.3/includes/front/tracking/Clickwhale_Click_Track.php

    r3040533 r3083885  
    22namespace clickwhale\includes\front\tracking;
    33
    4 use clickwhale\includes\front\tracking\Clickwhale_Visitor_Track;
    54use clickwhale\includes\helpers\Linkpages_Helper;
    65
     
    1716     */
    1817    protected $link_id;
    19     protected $linkage_id;
    2018    protected $user;
    2119    protected $visitor;
     
    4341    }
    4442
    45     private function get_linkpage_id() {
     43    private function get_linkpage_id(): int {
    4644        $url = strtolower( $this->get_link_referer() );
    4745
     
    5452        $result = Linkpages_Helper::get_by_slug( $url );
    5553
    56         return $result['id'];
     54        return $result['id'] ?? 0;
    5755    }
    5856
     
    6563        $item['link_id']        = ! $this->is_custom ? $this->link_id : 0;
    6664        $item['custom_link_id'] = $this->is_custom ? $this->link_id : '';
    67         $item['linkpage_id']    = $this->get_linkpage_id() ? $this->get_linkpage_id() : 0;
     65        $item['linkpage_id']    = $this->get_linkpage_id();
    6866        $item['visitor_id']     = $visitor_id;
    6967        $item['referer']        = $this->get_link_referer();
  • clickwhale/tags/2.1.3/includes/front/tracking/Clickwhale_Parser.php

    r3040533 r3083885  
    55    exit;
    66}
    7 
    8 use clickwhale\includes\front\tracking\{
    9     Clickwhale_Bot,
    10     Clickwhale_Device,
    11     Clickwhale_OS
    12 };
    137
    148class Clickwhale_Parser {
  • clickwhale/tags/2.1.3/includes/front/tracking/Clickwhale_Visitor_Track.php

    r3070750 r3083885  
    22namespace clickwhale\includes\front\tracking;
    33
    4 use clickwhale\includes\admin\Clickwhale_Settings;
    54use clickwhale\includes\admin\Clickwhale_WP_User;
    6 use clickwhale\includes\Clickwhale;
    7 use clickwhale\includes\front\tracking\Clickwhale_Parser;
    85use clickwhale\includes\helpers\Helper;
    96
  • clickwhale/tags/2.1.3/readme.txt

    r3078528 r3083885  
    66Requires PHP: 7.4.0
    77Tested up to: 6.5
    8 Stable tag: 2.1.2
     8Stable tag: 2.1.3
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    115115
    116116== Changelog ==
     117= Version 2.1.3 (9th May 2024) =
     118* Fix: Fixed issue when long links were not stored to DB
     119* Fix: Fixed "Trying to access array offset on value of type null" PHP warning
     120* Info: WordPress v6.5.3 compatibility
     121
    117122= Version 2.1.2 (29th April 2024) =
    118123* New: Added "Upgrade to PRO" sidebar for admin pages
  • clickwhale/trunk/clickwhale.php

    r3078528 r3083885  
    1010 * Plugin URI:        https://clickwhale.pro
    1111 * Description:       Link Manager, Link Shortener and Click Tracker for Affiliate Links & Link Pages.
    12  * Version:           2.1.2
     12 * Version:           2.1.3
    1313 * Requires at least: 5.0
    1414 * Requires PHP:      7.4
     
    3131     * Current plugin version.
    3232     */
    33     define( 'CLICKWHALE_VERSION', '2.1.2' );
     33    define( 'CLICKWHALE_VERSION', '2.1.3' );
    3434    define( 'CLICKWHALE_NAME', 'clickwhale' );
    3535    /**
     
    6565                    'public_key'      => 'pk_07a5633bd94c00467e7e58c200504',
    6666                    'is_premium'      => false,
    67                     'premium_suffix'  => 'Pro',
     67                    'premium_suffix'  => '(Pro)',
    6868                    'has_addons'      => false,
    6969                    'has_paid_plans'  => true,
  • clickwhale/trunk/includes/Clickwhale_Activator.php

    r3040533 r3083885  
    212212            );
    213213        }
     214
     215        /* @since 2.1.3 */
     216        if ( version_compare( CLICKWHALE_VERSION, '2.1.3', '>=' ) &&
     217            ! get_option( 'clickwhale_updated_links_table_url_column' )
     218        ){
     219            $query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}clickwhale_links MODIFY COLUMN url varchar(1000) DEFAULT '' NOT NULL" );
     220
     221            if ( $query ) {
     222                add_option( 'clickwhale_updated_links_table_url_column', CLICKWHALE_VERSION );
     223            }
     224        }
    214225    }
    215226
  • clickwhale/trunk/includes/admin/links/Clickwhale_Link_Edit.php

    r3070750 r3083885  
    1111class Clickwhale_Link_Edit extends Clickwhale_Instance_Edit {
    1212
    13     public function __construct() {
     13    /**
     14     * @var string
     15     */
     16    private $links_table;
     17
     18    public function __construct() {
    1419        parent::__construct( 'links', 'link' );
     20
     21        $this->links_table = Helper::get_db_table_name( $this->instance_plural );
    1522    }
    1623
     
    5360        global $wpdb;
    5461
    55         $links_table        = Helper::get_db_table_name( $this->instance_plural );
    56         $item               = array_intersect_key( $_POST, $this->get_defaults() );
    57 
     62        /* @since 2.1.3 */
     63        if ( version_compare( CLICKWHALE_VERSION, '2.1.3', '>=' ) &&
     64            ! get_option( 'clickwhale_updated_links_table_url_column' )
     65        ){
     66            require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     67            $query = $wpdb->query( "ALTER TABLE $this->links_table MODIFY COLUMN url varchar(1000) DEFAULT '' NOT NULL" );
     68
     69            if ( $query ) {
     70                add_option( 'clickwhale_updated_links_table_url_column', CLICKWHALE_VERSION );
     71            }
     72        }
     73
     74        $item = array_intersect_key( $_POST, $this->get_defaults() );
    5875        $item['categories'] = isset( $item['categories'] ) ? implode( ',', $item['categories'] ) : '';
    5976        $item['nofollow']   = isset( $item['nofollow'] );
     
    6683        if ( Links_Helper::get_by_id( intval( $item['id'] ) ) ) {
    6784            $wpdb->update(
    68                 $links_table,
     85                $this->links_table,
    6986                $item,
    7087                array( 'id' => $item['id'] )
     
    7491        } else {
    7592            $wpdb->insert(
    76                 $links_table,
     93                $this->links_table,
    7794                $item
    7895            );
  • clickwhale/trunk/includes/front/tracking/Clickwhale_Click_Track.php

    r3040533 r3083885  
    22namespace clickwhale\includes\front\tracking;
    33
    4 use clickwhale\includes\front\tracking\Clickwhale_Visitor_Track;
    54use clickwhale\includes\helpers\Linkpages_Helper;
    65
     
    1716     */
    1817    protected $link_id;
    19     protected $linkage_id;
    2018    protected $user;
    2119    protected $visitor;
     
    4341    }
    4442
    45     private function get_linkpage_id() {
     43    private function get_linkpage_id(): int {
    4644        $url = strtolower( $this->get_link_referer() );
    4745
     
    5452        $result = Linkpages_Helper::get_by_slug( $url );
    5553
    56         return $result['id'];
     54        return $result['id'] ?? 0;
    5755    }
    5856
     
    6563        $item['link_id']        = ! $this->is_custom ? $this->link_id : 0;
    6664        $item['custom_link_id'] = $this->is_custom ? $this->link_id : '';
    67         $item['linkpage_id']    = $this->get_linkpage_id() ? $this->get_linkpage_id() : 0;
     65        $item['linkpage_id']    = $this->get_linkpage_id();
    6866        $item['visitor_id']     = $visitor_id;
    6967        $item['referer']        = $this->get_link_referer();
  • clickwhale/trunk/includes/front/tracking/Clickwhale_Parser.php

    r3040533 r3083885  
    55    exit;
    66}
    7 
    8 use clickwhale\includes\front\tracking\{
    9     Clickwhale_Bot,
    10     Clickwhale_Device,
    11     Clickwhale_OS
    12 };
    137
    148class Clickwhale_Parser {
  • clickwhale/trunk/includes/front/tracking/Clickwhale_Visitor_Track.php

    r3070750 r3083885  
    22namespace clickwhale\includes\front\tracking;
    33
    4 use clickwhale\includes\admin\Clickwhale_Settings;
    54use clickwhale\includes\admin\Clickwhale_WP_User;
    6 use clickwhale\includes\Clickwhale;
    7 use clickwhale\includes\front\tracking\Clickwhale_Parser;
    85use clickwhale\includes\helpers\Helper;
    96
  • clickwhale/trunk/readme.txt

    r3078528 r3083885  
    66Requires PHP: 7.4.0
    77Tested up to: 6.5
    8 Stable tag: 2.1.2
     8Stable tag: 2.1.3
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    115115
    116116== Changelog ==
     117= Version 2.1.3 (9th May 2024) =
     118* Fix: Fixed issue when long links were not stored to DB
     119* Fix: Fixed "Trying to access array offset on value of type null" PHP warning
     120* Info: WordPress v6.5.3 compatibility
     121
    117122= Version 2.1.2 (29th April 2024) =
    118123* New: Added "Upgrade to PRO" sidebar for admin pages
Note: See TracChangeset for help on using the changeset viewer.