Plugin Directory

Changeset 1379030


Ignore:
Timestamp:
03/25/2016 08:15:25 PM (10 years ago)
Author:
WWGate
Message:

tagging 1.0.5

Location:
wp-cloaker
Files:
31 added
7 edited

Legend:

Unmodified
Added
Removed
  • wp-cloaker/trunk/README.txt

    r1374737 r1379030  
    55Requires at least: 4.0.0
    66Tested up to: 4.4.2
    7 Stable tag: 1.0.4
     7Stable tag: 1.0.5
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1717From the reports page you can generate reports and filter by Link Title, Month/Year, Link category OR country.
    1818
    19 Here are some Features of **WP Cloaker** plugin:
     19Features of **WP Cloaker** plugin:
    2020
    21211. Hide, shorten your links.
    22 2. Custom redirection type: 301,302,303,307 and Javascript redirection. 
     222. Custom redirection type: 301,302,303,307 and Javascript redirection.
    23233. Categorize your links.
    24 4. Custom permalinks e.g : www.yoursite.com/visit/link-category-slug/link-slug.
    25 5. Track links clicks, each time a visitor click on any link, the plugin will store the visitor information like (IP address, click date/time, Country, etc..).
    26 6. Generate clicks reports with some options to filter the report.
     244. Custom permalink prefix e.g: (go,out,visit, etc.).
     255. Custom permalinks e.g : www.yoursite.com/visit/link-category-slug/link-slug.
     266. Track links clicks, each time a visitor click on any link, the plugin will store the visitor information like (IP address, click date/time, Country, etc..).
     277. Generate clicks reports with some options to filter the report.
     288. Option to disable collecting data on link redirection ( it will make redirection much faster).
     29
    2730
    2831If you have any question or features request, please don't hesitiate to contact us at support[@]wwgate.net
     
    8689= 1.0.4 =
    8790add warning message to settings page
     91
     92= 1.0.5 =
     931. delete wp_cloaker_version option when uninstall.
     942. wp_cloaker_clicks_count table deleted.
     954. added option to disable collecting data on redirection.
     96
     97
     98
  • wp-cloaker/trunk/assets/views/single-wp_cloaker_link.php

    r1371076 r1379030  
    11<?php
    2 
    3 require_once(wp_cloaker_path.'classes/class-wp-cloaker-clicks.php');
    42$linkOptions = get_post_meta($post->ID);
    53$link = $linkOptions['wp_cloaker_link'][0];
    64
    7 
    8 
    9 /*//print out 3rd parthy traking code
    10 if(get_option( 'wp_cloaker_link_tracking_code')){
    11     echo "<script>". esc_attr( get_option( 'wp_cloaker_link_tracking_code' ) )."</script>";
    12 }*/
    135$cusOptions = $linkOptions['wp_cloaker_link_custom_options'][0];
    146if($cusOptions){
     
    179    $redirect = esc_attr( get_option( 'wp_cloaker_link_redirection','301' ) );
    1810}
    19 //get visitor information from IP-API
    20 //get link category id
    21 $terms = wp_get_post_terms( $post->ID, 'wp_cloaker_link_category');
    22 $term_id = ( !empty($terms) ) ? $terms[0]->term_id : null;
    23 //add visitor information to db
    24 $clicks = new WP_Cloaker_Clicks();
    25 //register this click to db
    26 $clicks->wp_cloaker_click_count( $post->ID,$term_id);
    27 $clicks->getIPInfo($post->ID);
     11echo get_option('wp_cloaker_link_collect_data','yes');
     12if(get_option('wp_cloaker_link_collect_data','yes') == 'yes'){
    2813
     14    //get visitor information
     15    //add visitor information to db
     16    require_once(wp_cloaker_path.'classes/class-wp-cloaker-clicks.php');
     17    $clicks = new WP_Cloaker_Clicks();
     18    //register this click to db
     19    $clicks->getIPInfo($post->ID);
     20}
    2921
    3022switch($redirect){
  • wp-cloaker/trunk/classes/class-wp-cloaker-admin.php

    r1374737 r1379030  
    127127        add_settings_field( 'wp_cloaker_link_redirection', 'Link Redirection', array($this,'wp_cloaker_link_redirection_callback'), 'wp_cloaker_link_settings', 'default_settings' );
    128128
     129        register_setting( 'wp_cloaker_settings_group', 'wp_cloaker_link_collect_data' );
     130        add_settings_field( 'wp_cloaker_link_collect_data', 'Collect user data on redirection', array($this,'wp_cloaker_link_collect_data_callback'), 'wp_cloaker_link_settings', 'default_settings' );
     131
    129132        /*register_setting( 'wp_cloaker_settings_group', 'wp_cloaker_link_cat_prefix' );
    130133        add_settings_field( 'wp_cloaker_link_cat_prefix', 'Include Category Slug in link url?', array($this,'wp_cloaker_link_cat_prefix_callback'), 'wp_cloaker_link_settings', 'default_settings' );
     
    155158            <option value="307" <?php echo $linkRedirection == "307" ?  'selected="selected"':''; ?>>307 redirection</option>
    156159            <option value="js" <?php echo $linkRedirection == "js" ?  'selected="selected"':''; ?>>JavaScript redirection</option>
     160        </select><?php
     161    }
     162    public function wp_cloaker_link_collect_data_callback(){
     163        $collect = esc_attr( get_option( 'wp_cloaker_link_collect_data','1' ) );?>
     164        <select name="wp_cloaker_link_collect_data">
     165            <option value="yes" <?php echo $collect == "yes" ?  'selected="selected"':''; ?>>Yes</option>
     166            <option value="no" <?php echo $collect == "no" ?  'selected="selected"':''; ?>>No</option>
    157167        </select><?php
    158168    }
  • wp-cloaker/trunk/classes/class-wp-cloaker-clicks.php

    r1371080 r1379030  
    1515        global $wpdb;
    1616        $wpdb->wp_cloaker_clicks_table = "{$wpdb->prefix}cloaker_clicks";
    17         $wpdb->wp_cloaker_clicks_count_table = "{$wpdb->prefix}cloaker_clicks_count";
    1817    }   
    1918   
     
    4039        ) $charset_collate";
    4140        dbDelta($create_table_sql);
     41
     42        $v = get_option('wp_cloaker_version','1.0.4');
     43        if( version_compare($v,'1.0.5') < 0 ){
     44            global $wpdb;
     45            $click_count_tbl = "{$wpdb->prefix}cloaker_clicks_count";
     46            //drop click_count table
     47            $sql = "DROP TABLE IF EXISTS {$click_count_tbl}";
     48            $wpdb->query($sql);
     49        }
     50        update_option( 'wp_cloaker_version', '1.0.5');
    4251    }
    4352    //return wp_cloaker_clicks_table columns
     
    5766    }
    5867   
    59     // create wp_cloaker_clicks_count_table
    60     public function wp_cloaker_create_clicks_count_table(){
    61         global $wpdb;
    62         global $charset_collate;
    63         require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    64         $this->wp_cloaker_register_clicks_table();
    65         $create_table_sql = "CREATE TABLE IF NOT EXISTS {$wpdb->wp_cloaker_clicks_count_table}(
    66             count_id bigint(20) unsigned NOT NULL auto_increment,
    67             link_id bigint(20) unsigned NOT NULL default '0',
    68             cat_id bigint(20) unsigned NULL default '0',
    69             counter bigint(20)  NOT NULL default '0',
    70             PRIMARY KEY  (count_id),
    71             KEY link (link_id)
    72         ) $charset_collate";
    73         dbDelta($create_table_sql);
    74     }
    75     //return wp_cloaker_clicks_count_table columns
    76     public function wp_cloaker_clicks_count_table_columns(){
    77         return array(
    78             'count_id'=> '%d',
    79             'link_id'=> '%d',
    80             'cat_id'=> '%d',
    81             'counter'=>'%d'
    82         );
    83     }
    8468    /*
    8569    * insert click data to the database
     
    10488        $wpdb->insert_id;
    10589    }
    106     /*
    107     * insert or update click count data to the database
    108     *@param $data array An array of key => value pairs to be inserted
    109     *@return int The ID of the created click count row. Or WP_Error or false on failure.
    110     */
    111     public function wp_cloaker_click_count( $link_id,$cat_id){
    112         global $wpdb;       
    113  
    114         //link ID must be positive integer
    115         $link_id = absint($link_id);     
    116         if( empty($link_id) )
    117              return false;
    118         $last_count_sql = "SELECT counter FROM {$wpdb->wp_cloaker_clicks_count_table}
    119         WHERE link_id=$link_id";
    120         $last_count = $wpdb->get_var($last_count_sql);
    121         if($last_count){
    122             $new_count = (int)$last_count+1;
    123            
    124             $data = array('counter'=>$new_count);
    125             if ( false === $wpdb->update($wpdb->wp_cloaker_clicks_count_table, $data, array('link_id'=>$link_id)) ) {
    126              return false;
    127             }
    128            
    129             return true;
    130         }else{
    131             $data = array(
    132                 'link_id'=>$link_id,
    133                 'cat_id'=>$cat_id,
    134                 'counter'=>1
    135             );
    136             //insert data into database
    137             $wpdb->insert($wpdb->wp_cloaker_clicks_count_table, $data);
    138             return $wpdb->insert_id;
    139         }
    140     }
     90   
    14191    /*
    14292    * get GEO information from visitor IP address
     
    206156    public function getClickCountByPostID($ID){
    207157        global $wpdb;
    208         $sql = "SELECT counter FROM {$wpdb->wp_cloaker_clicks_count_table} where link_id=$ID";
     158        $sql = "SELECT count(1) FROM {$wpdb->wp_cloaker_clicks_table} where link_id=$ID";
    209159        return $wpdb->get_var($sql);
    210160    }
     
    215165    public function getClickCountByCatID($ID){
    216166        global $wpdb;
    217         $sql = "SELECT SUM(counter) as total FROM {$wpdb->wp_cloaker_clicks_count_table} where cat_id=$ID GROUP BY cat_id";
     167        // get cat posts ids
     168        $post_ids = get_posts(array(
     169                'post_type'         => 'wp_cloaker_link',
     170            'numberposts'   => -1, // get all posts.
     171            'tax_query'     => array(
     172                array(
     173                    'taxonomy'  => 'wp_cloaker_link_category',
     174                    'field'     => 'id',
     175                    'terms'     => $ID,
     176                ),
     177            ),
     178            'fields'        => 'ids', // Only get post IDs
     179        ));
     180        $ids = implode(',',$post_ids);
     181        $sql = "SELECT COUNT(1) as total FROM {$wpdb->wp_cloaker_clicks_table} where link_id IN ($ids)";
    218182        $sum = $wpdb->get_var($sql);
    219183        return $sum;
     
    235199    public function getClicksDetailsTotalBYID($ID){
    236200        global $wpdb;
    237         $sql = "SELECT count(*) FROM {$wpdb->wp_cloaker_clicks_table} where link_id=$ID";
     201        $sql = "SELECT count(1) FROM {$wpdb->wp_cloaker_clicks_table} where link_id=$ID";
    238202        $result = $wpdb->get_var($sql);
    239203        return $result;
  • wp-cloaker/trunk/classes/class-wp-cloaker.php

    r1374737 r1379030  
    2323        //hook the single post template
    2424        add_filter('single_template', array($this,'wp_cloaker_link_template'));
    25        
    26         add_option( 'wp_cloaker_version', '1.0.4');
     25
    2726    }
    2827
  • wp-cloaker/trunk/uninstall.php

    r1203774 r1379030  
    99    $wpdb->wp_cloaker_clicks_count_table = "{$wpdb->prefix}cloaker_clicks_count";
    1010    //drop plugin tables
    11     $sql = "DROP TABLE IF EXISTS $wpdb->wp_cloaker_clicks_table,$wpdb->wp_cloaker_clicks_count_table";
     11    $sql = "DROP TABLE IF EXISTS $wpdb->wp_cloaker_clicks_table";
    1212    $wpdb->query($sql);
    1313    //delete all posts of wp_cloaker_link post type
     
    2020    $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy=%s",$tax ) );
    2121 
    22         // Delete Terms
     22  // Delete Terms
    2323    foreach ( $terms as $term ) {
    2424        $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
     
    3232   
    3333    // delete plugin options
     34    delete_option( 'wp_cloaker_version' );
    3435    delete_option( 'wp_cloaker_link_prefix' );
    3536    delete_option( 'wp_cloaker_link_redirection' );
  • wp-cloaker/trunk/wp-cloaker.php

    r1374737 r1379030  
    44plugin URI:http://www.wwgate.net
    55Description: WP Cloaker gives you the ability to shorten your affiliate ugly links and keep track of how many clicks on each link.
    6 Version:1.0.4
     6Version:1.0.5
    77Author: Fadi Ismail
    88Author URI: http://www.wwgate.net
     
    1111define('wp_cloaker_url', plugins_url('',__FILE__) );
    1212define('wp_cloaker_path', WP_PLUGIN_DIR.DIRECTORY_SEPARATOR.'wp-cloaker'.DIRECTORY_SEPARATOR );
    13 define('wp_cloaker_version', '1.0.4' );
     13define('wp_cloaker_version', '1.0.5' );
    1414
    1515// if the file is called directly, abort
     
    2727    $wp_cloaker_admin = new WP_Cloaker_Admin();
    2828   
    29     //register_uninstall_hook(__FILE__, 'wp_cloaker_uninstall');
    3029    register_activation_hook(__FILE__,array(&$wp_cloaker_clicks,'wp_cloaker_create_clicks_table'));
    31     register_activation_hook(__FILE__,array(&$wp_cloaker_clicks,'wp_cloaker_create_clicks_count_table'));
     30   
    3231}
    3332wp_Cloaker_Start();
Note: See TracChangeset for help on using the changeset viewer.