Plugin Directory

Changeset 1191569


Ignore:
Timestamp:
07/03/2015 02:58:56 AM (11 years ago)
Author:
iterative
Message:

Bug fixes.

Location:
iterative-headlines
Files:
3 edited
16 copied

Legend:

Unmodified
Added
Removed
  • iterative-headlines/tags/1.3/headlines.php

    r1190469 r1191569  
    55Description: Test your post titles and headlines with state-of-the-art artificial intelligence.
    66Author: Iterative Research Inc.
    7 Version: 1.2
     7Version: 1.3
    88Author URI: mailto:joe@iterative.ca
    99License: GPLv2+
     
    1616require_once dirname(__FILE__) . "/headlines_pointer.php";
    1717require_once dirname(__FILE__) . "/headlines_options.php";
     18require_once dirname(__FILE__) . "/headlines_functions.php";
    1819require_once dirname(__FILE__) . "/headlines_calculator.php";
    1920
     
    117118
    118119function iterative_add_javascript() {
    119     //if(!is_admin()) {
     120    if(!is_admin()) {
    120121        echo "<script type='text/javascript' src='" . IterativeAPI::getTrackerURL() . "'></script>";
    121122
    122123        // record a click conversion
    123124
    124         if(is_single() && parse_url(wp_get_referer(), PHP_URL_HOST) == parse_url($_SERVER["HTTP_HOST"], PHP_URL_HOST)) {
     125        if(is_single() && (iterative_get_referring_host() == iterative_remove_www(parse_url($_SERVER["HTTP_HOST"], PHP_URL_HOST)))) {
    125126            global $post;
    126127            $id = $post->ID;
     
    128129
    129130            $variant = IterativeAPI::selectVariant($id, array_keys($variants));
    130            
    131131            if(count($variants) >= 1) {
    132132                echo "<script type='text/javascript' src='" . IterativeAPI::getSuccessURL(ITERATIVE_GOAL_CLICKS, $variant, $id) . "'></script>";
     
    146146            unset($_SESSION['iterative_comments_posted']);
    147147        }
    148     //}
     148    }
    149149}
    150150
     
    168168    if ( isset( $_REQUEST['iterative_post_title_variants'] ) ) {
    169169        $result = array();
     170
    170171        foreach($_REQUEST['iterative_post_title_variants'] as $iptv) {
    171172            $iptv = trim($iptv);
     
    174175            $result[] = $iptv;
    175176        }
    176        
    177         if(!empty($result))
    178             update_post_meta( $post_id, 'iterative_post_title_variants', $result); // ( $_REQUEST['iterative_post_title_variants'] ) );
     177        update_post_meta( $post_id, 'iterative_post_title_variants', $result); // ( $_REQUEST['iterative_post_title_variants'] ) );
    179178    }
    180179
  • iterative-headlines/tags/1.3/headlines_api.php

    r1190425 r1191569  
    88    //          -> Receive probabilities for each variant.
    99    private static $api_endpoint = "http://api.pathfinding.ca/";
    10     private static $api_version = 1.2;
     10    private static $api_version = 1.3;
    1111    private static $reject_age = 86400;
    1212    private static $request_age = 14440;
     
    110110
    111111        // get the most recent parameters. if they don't exist, call serverProbabilities.
    112         if($model_type === null) die("NO MT?");
    113112        $post_meta = get_post_meta($post_id, "_iterative_parameters_{$model_type}_{$type}", true);
    114113        if($post_meta == "" || $response['timestamp'] > time()+static::$request_age)
     
    261260    public static function getTrackerURL() {
    262261        // the logger should set an identical UID/hash cookie on api.pathfinding.ca
    263         return static::$api_endpoint . "js/log?user=" . static::getUserID() . "&unique_id=" . static::getGUID();
     262        return static::$api_endpoint . "js/log?user=" . static::getUserID() . "&unique_id=" . static::getGUID() . "&refclass=" . iterative_get_referring_type();;
    264263    }
    265264    public static function getSuccessURL($type, $variant_id, $experiment_id) {
  • iterative-headlines/tags/1.3/readme.txt

    r1190443 r1191569  
    44Requires at least: 3.0.1
    55Tested up to: 4.2.2
    6 Stable tag: 1.2
     6Stable tag: 1.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • iterative-headlines/trunk/headlines.php

    r1190469 r1191569  
    55Description: Test your post titles and headlines with state-of-the-art artificial intelligence.
    66Author: Iterative Research Inc.
    7 Version: 1.2
     7Version: 1.3
    88Author URI: mailto:joe@iterative.ca
    99License: GPLv2+
     
    1616require_once dirname(__FILE__) . "/headlines_pointer.php";
    1717require_once dirname(__FILE__) . "/headlines_options.php";
     18require_once dirname(__FILE__) . "/headlines_functions.php";
    1819require_once dirname(__FILE__) . "/headlines_calculator.php";
    1920
     
    117118
    118119function iterative_add_javascript() {
    119     //if(!is_admin()) {
     120    if(!is_admin()) {
    120121        echo "<script type='text/javascript' src='" . IterativeAPI::getTrackerURL() . "'></script>";
    121122
    122123        // record a click conversion
    123124
    124         if(is_single() && parse_url(wp_get_referer(), PHP_URL_HOST) == parse_url($_SERVER["HTTP_HOST"], PHP_URL_HOST)) {
     125        if(is_single() && (iterative_get_referring_host() == iterative_remove_www(parse_url($_SERVER["HTTP_HOST"], PHP_URL_HOST)))) {
    125126            global $post;
    126127            $id = $post->ID;
     
    128129
    129130            $variant = IterativeAPI::selectVariant($id, array_keys($variants));
    130            
    131131            if(count($variants) >= 1) {
    132132                echo "<script type='text/javascript' src='" . IterativeAPI::getSuccessURL(ITERATIVE_GOAL_CLICKS, $variant, $id) . "'></script>";
     
    146146            unset($_SESSION['iterative_comments_posted']);
    147147        }
    148     //}
     148    }
    149149}
    150150
     
    168168    if ( isset( $_REQUEST['iterative_post_title_variants'] ) ) {
    169169        $result = array();
     170
    170171        foreach($_REQUEST['iterative_post_title_variants'] as $iptv) {
    171172            $iptv = trim($iptv);
     
    174175            $result[] = $iptv;
    175176        }
    176        
    177         if(!empty($result))
    178             update_post_meta( $post_id, 'iterative_post_title_variants', $result); // ( $_REQUEST['iterative_post_title_variants'] ) );
     177        update_post_meta( $post_id, 'iterative_post_title_variants', $result); // ( $_REQUEST['iterative_post_title_variants'] ) );
    179178    }
    180179
  • iterative-headlines/trunk/headlines_api.php

    r1190425 r1191569  
    88    //          -> Receive probabilities for each variant.
    99    private static $api_endpoint = "http://api.pathfinding.ca/";
    10     private static $api_version = 1.2;
     10    private static $api_version = 1.3;
    1111    private static $reject_age = 86400;
    1212    private static $request_age = 14440;
     
    110110
    111111        // get the most recent parameters. if they don't exist, call serverProbabilities.
    112         if($model_type === null) die("NO MT?");
    113112        $post_meta = get_post_meta($post_id, "_iterative_parameters_{$model_type}_{$type}", true);
    114113        if($post_meta == "" || $response['timestamp'] > time()+static::$request_age)
     
    261260    public static function getTrackerURL() {
    262261        // the logger should set an identical UID/hash cookie on api.pathfinding.ca
    263         return static::$api_endpoint . "js/log?user=" . static::getUserID() . "&unique_id=" . static::getGUID();
     262        return static::$api_endpoint . "js/log?user=" . static::getUserID() . "&unique_id=" . static::getGUID() . "&refclass=" . iterative_get_referring_type();;
    264263    }
    265264    public static function getSuccessURL($type, $variant_id, $experiment_id) {
  • iterative-headlines/trunk/readme.txt

    r1190443 r1191569  
    44Requires at least: 3.0.1
    55Tested up to: 4.2.2
    6 Stable tag: 1.2
     6Stable tag: 1.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.