Plugin Directory

Changeset 1669720


Ignore:
Timestamp:
06/02/2017 03:54:49 PM (9 years ago)
Author:
webmasterjunkie
Message:

Upgrade to 1.1.4

Location:
ph-publisher/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ph-publisher/trunk/assets/ph_publisher.js

    r1669507 r1669720  
    8181                longname : "PH Publisher Links",
    8282                author : "Performance Horizon",
    83                 version : "1"
     83                version : "1.1.4"
    8484            };
    8585        }
  • ph-publisher/trunk/functions.php

    r1669507 r1669720  
    22
    33defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
     4
     5function ph_publisher_update_db_check()
     6{
     7    if ( ! current_user_can( 'update_plugins' ) )
     8    {
     9        return;
     10    }
     11
     12    $str_current_version = get_option( '_ph_publisher_version' );
     13
     14    if ($str_current_version != PH_PUBLISHER_VERSION)
     15    {
     16        ph_publisher_upgrade_install( $str_current_version, PH_PUBLISHER_VERSION);
     17    }
     18}
     19add_action( 'plugins_loaded', 'ph_publisher_update_db_check' );
     20
     21/**
     22 * Will be used to manage the upgrades should any DB data need changing
     23 * @param  String $str_current_version The version last registered with this WP install
     24 * @param  String $str_release_version The current version of this plugin
     25 */
     26function ph_publisher_upgrade_install( $str_current_version, $str_release_version )
     27{
     28    update_option( '_ph_publisher_version', $str_release_version );
     29}
    430
    531/**
  • ph-publisher/trunk/ph_publisher.php

    r1669581 r1669720  
    55    Plugin URI: #
    66    Description: Load your Performance Horizon publisher credentials for access to PH data. You will be able to quickly add your tracking links to any new post you create.
    7     Version: 1.1.3
     7    Version: 1.1.4
    88    Author: Performance Horizon
    99    Author URI: http://www.performancehorizon.com/
     
    1313defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    1414
    15 define( 'PH_PUBLISHER_VERSION', '1.1.3' );
     15define( 'PH_PUBLISHER_VERSION', '1.1.4' );
    1616
    1717require_once( plugin_dir_path( __FILE__ ) . "functions.php" );
     
    3333    require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    3434
    35     $sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ph_publisher_participation` (
    36         ID int(11) AUTO_INCREMENT NOT NULL,
    37         auth_id int(11) NOT NULL,
    38         campaign_id varchar(100) NOT NULL,
    39         campaign_title text NOT NULL,
    40         camref varchar(100) NOT NULL UNIQUE,
    41         tracking_link text NOT NULL,
    42         is_cpc enum('y','n') NOT NULL DEFAULT 'n',
    43         PRIMARY KEY (ID)
    44     ) $charset_collate;";
    45 
    46     dbDelta( $sql );
    47 
    48     $sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}ph_publisher_auth` (
    49         ID int(11) AUTO_INCREMENT NOT NULL,
    50         wp_user_id int(11) NOT NULL UNIQUE,
    51         application_api_key varchar(100) NOT NULL,
    52         user_api_key varchar(100) NOT NULL,
    53         publisher_id varchar(100) NOT NULL,
    54         PRIMARY KEY (ID)
    55     ) $charset_collate;";
    56 
    57     dbDelta( $sql );
    58 
    59     add_option( '_ph_auth_table',           'ph_publisher_auth' );
    60     add_option( '_ph_participation_table',  'ph_publisher_participation' );
    61     add_option( '_ph_publisher_version',    PH_PUBLISHER_VERSION );
     35    $str_table_name = $wpdb->prefix . 'ph_publisher_participation';
     36    if ($wpdb->get_var("SHOW TABLES LIKE '{$str_table_name}'") !== $str_table_name)
     37    {
     38        $sql = "CREATE TABLE IF NOT EXISTS `{$str_table_name}` (
     39            ID int(11) AUTO_INCREMENT NOT NULL,
     40            auth_id int(11) NOT NULL,
     41            campaign_id varchar(100) NOT NULL,
     42            campaign_title text NOT NULL,
     43            camref varchar(100) NOT NULL UNIQUE,
     44            tracking_link text NOT NULL,
     45            is_cpc enum('y','n') NOT NULL DEFAULT 'n',
     46            PRIMARY KEY (ID)
     47        ) $charset_collate;";
     48        dbDelta( $sql );
     49    }
     50
     51    $str_table_name = $wpdb->prefix . 'ph_publisher_auth';
     52    if ($wpdb->get_var("SHOW TABLES LIKE '{$str_table_name}'") !== $str_table_name)
     53    {
     54        $sql = "CREATE TABLE IF NOT EXISTS `{$str_table_name}` (
     55            ID int(11) AUTO_INCREMENT NOT NULL,
     56            wp_user_id int(11) NOT NULL UNIQUE,
     57            application_api_key varchar(100) NOT NULL,
     58            user_api_key varchar(100) NOT NULL,
     59            publisher_id varchar(100) NOT NULL,
     60            PRIMARY KEY (ID)
     61        ) $charset_collate;";
     62        dbDelta( $sql );
     63    }
     64
     65    if ( get_option( '_ph_auth_table' ) === FALSE)
     66    {
     67        add_option( '_ph_auth_table', 'ph_publisher_auth' );
     68    }
     69    if ( get_option( '_ph_participation_table' ) === FALSE)
     70    {
     71        add_option( '_ph_participation_table', 'ph_publisher_participation' );
     72    }
     73    if ( get_option( '_ph_publisher_version' ) === FALSE)
     74    {
     75        add_option( '_ph_publisher_version', PH_PUBLISHER_VERSION );
     76    }
    6277}
    6378register_activation_hook( __FILE__, 'ph_publisher_install' );
     
    6984function ph_publisher_uninstall()
    7085{
     86    if ( ! current_user_can( 'update_plugins' ))
     87    {
     88        return;
     89    }
     90
    7191    global $wpdb;
    7292
  • ph-publisher/trunk/readme.txt

    r1669581 r1669720  
    1212
    1313== Description ==
    14 This will add a settings page to the Admin dashboard so you can provided your Performance Horizon (PH) API credentials. The plugin will then query the PH API to obtain all of your available, and approved, affiliate marketing campaigns. When you add a new post to the site there will be an option in Editor to select your tracking link and add any of the available parameters to the URL.
     14This will add a settings page to the Admin dashboard so you can provide your Performance Horizon (PH) API credentials. The plugin will then query the PH API to obtain all of your available, and approved, affiliate marketing campaigns. When you add a new post to the site there will be an option in Editor to select your tracking link and add any of the available parameters to the URL.
    1515
    1616== Installation ==
     
    2424
    2525== Changelog ==
     26= 1.1.4 =
     27* Fix spelling mistake in description
     28* Add Plugin management authentication
     29* Add update checks and functionality
     30
    2631= 1.1.3 =
    2732* Added admin menu icon
Note: See TracChangeset for help on using the changeset viewer.