Plugin Directory

Changeset 1019742


Ignore:
Timestamp:
11/04/2014 07:38:56 PM (11 years ago)
Author:
bendoh
Message:

2.2.1: Added Omniture tracking for better feedback

Location:
getty-images/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • getty-images/trunk/getty-images.css

    r998658 r1019742  
    478478        background-color: #f5f5f5;
    479479        -webkit-transform: translate(-50%, 0);
    480         left: 50%;
    481     }
     480    }
     481@media only screen and (max-width: 900px) {
     482    .getty-title-link .getty-prompt-login.getty-user-panel {
     483        left: -50%;
     484    }
     485}
    482486    .getty-prompt-login .getty-user-chevron {
    483487        border-left: 15px solid transparent;
     
    488492        top: -15px;
    489493    }
     494@media only screen and (max-width: 900px) {
     495    .getty-prompt-login .getty-user-chevron {
     496        right: 13em;
     497    }
     498}
    490499        .getty-user-chevron span {
    491500            border-left: 14px solid transparent;
     
    753762
    754763/**
     764 * Welcome screen with opt-in
     765 */
     766.getty-welcome {
     767    position: absolute;
     768    top: 20%;
     769    bottom: 20%;
     770    left: 20%;
     771    right: 20%;
     772}
     773@media only screen and (max-width: 640px), screen and (max-height: 400px) {
     774    .getty-welcome {
     775        top: 80px;
     776        bottom: 5px;
     777    }
     778}
     779@media only screen and (max-height: 400px) {
     780    .getty-welcome {
     781        top: 5px;
     782    }
     783}
     784@media screen and (max-width: 640px) {
     785    .getty-welcome {
     786        left: 5px;
     787        right: 5px;
     788    }
     789}
     790    .getty-welcome-opt-in,
     791    .getty-welcome-continue {
     792        position: absolute;
     793        bottom: 0;
     794    }
     795    .getty-welcome-opt-in {
     796        left: 0;
     797    }
     798    .getty-welcome-continue {
     799        right: 0;
     800    }
     801
     802/**
    755803 * Choose mode
    756804 */
  • getty-images/trunk/getty-images.php

    r998660 r1019742  
    66Author: gettyImages
    77Author URI: http://gettyimages.com/
    8 Version: 2.1.1
     8Version: 2.2.1
    99*/
    1010
     
    132132        wp_register_script( 'jquery-cookie', plugins_url( '/js/jquery.cookie.js', __FILE__ ), array( 'jquery' ), '2006', true );
    133133
     134        $isWPcom = self::isWPcom();
     135
     136        // Determine if the Omniture Javascript should be loaded
     137        $load_omniture = true;
     138        if ( $isWPcom ) {
     139            $settings = isset( $_COOKIE['wpGIc'] ) ? json_decode( stripslashes( $_COOKIE['wpGIc'] ) ) : false;
     140            if ( isset( $settings->{'omniture-opt-in'} ) && ! $settings->{'omniture-opt-in'} ) {
     141                // Don't load the s_code script if the user has opted out
     142                $load_omniture = false;
     143            }
     144        }
     145
    134146        wp_enqueue_script( 'spin-js', plugins_url( '/js/spin.js', __FILE__ ), array(), 1, true );
    135         wp_enqueue_script( 'getty-omniture-scode', plugins_url( '/js/s_code.js', __FILE__ ), array(), 1, true );
    136147        wp_enqueue_script( 'getty-images-filters', plugins_url( '/js/getty-filters.js', __FILE__ ), array(), 1, true );
    137148        wp_enqueue_script( 'getty-images-views', plugins_url( '/js/getty-views.js', __FILE__ ), array( 'getty-images-filters', 'spin-js' ), 1, true );
    138         wp_enqueue_script( 'getty-images-models', plugins_url( '/js/getty-models.js', __FILE__ ), array( 'jquery-cookie', 'getty-omniture-scode' ), 1, true );
    139         wp_enqueue_script( 'getty-images', plugins_url( '/js/getty-images.js', __FILE__ ), array( 'getty-images-views', 'getty-images-models', 'getty-omniture-scode' ), 1, true );
    140 
     149
     150        // Register Omniture s-code
     151        wp_register_script( 'getty-omniture-scode', apply_filters( 'getty_images_s_code_js_url', plugins_url( '/js/s_code.js', __FILE__ ) ), array(), 1, true );
     152
     153        // Optionally load it as a dependency
     154        $models_depend = $load_omniture ? array( 'jquery-cookie', 'getty-omniture-scode' ) : array( 'jquery-cookie' );
     155
     156        wp_enqueue_script( 'getty-images-models', plugins_url( '/js/getty-models.js', __FILE__ ), $models_depend, 1, true );
     157        wp_enqueue_script( 'getty-images', plugins_url( '/js/getty-images.js', __FILE__ ), array( 'getty-images-views', 'getty-images-models' ), 1, true );
    141158
    142159        wp_enqueue_style( 'getty-images', plugins_url( '/getty-images.css', __FILE__ ) );
     
    147164                'nonce' => wp_create_nonce( 'getty-images' ),
    148165                'sizes' => $this->get_possible_image_sizes(),
    149                 'isWPcom' => function_exists( 'wpcom_is_vip' ) && wpcom_is_vip(),
     166                'isWPcom' => $isWPcom,
    150167                'text' => array(
    151168                    // Getty Images search field placeholder
     
    215232    }
    216233
     234    static function isWPcom() {
     235        return isset( $_GET['gettyTestWPcomIsVip'] ) || ( function_exists( 'wpcom_is_vip' ) && wpcom_is_vip() );
     236    }
     237
    217238    /**
    218239     * Add "Getty Images..." button to edit screen
     
    471492    }
    472493}
     494
    473495Getty_Images::instance();
  • getty-images/trunk/getty-templates.php

    r998658 r1019742  
    5858    <div class="getty-title-links">
    5959        <# var loggedIn = gettyImages.user.get('loggedIn'); #>
    60         <# if(gettyImages.isWPcom || data.mode == 'login' && loggedIn) { #>
     60        <# if((gettyImages.isWPcom && gettyImages.user.settings.get('omniture-opt-in') !== undefined) || data.mode == 'login' && loggedIn) { #>
    6161        <span class="getty-title-link">
    6262            <a class="getty-login-toggle getty-title-link {{ loggedIn ? 'getty-logged-in' : '' }}">{{ loggedIn ? gettyImages.user.get('username') : "<?php esc_html_e( "Log in", 'getty-images' ); ?>" }}</a>
     
    470470</script>
    471471
     472<script type="text/html" id="tmpl-getty-welcome">
     473    <h1>Welcome</h1>
     474
     475    <p><?php _e( "Getty Images tracks usage of this plugin via a third party tool that sets cookies in your browser. We use the statistics collected this way to help improve the plugin. However, you may opt out of this tracking, which will not affect the operation of this plugin. For more information, please <a href=\"http://www.gettyimages.com/Corporate/PrivacyPolicy.aspx\" target=\"_getty\">refer to our privacy policy</a>.", 'getty-images' ); ?></p>
     476
     477    <p class="getty-welcome-opt-in">
     478        <label><input type="checkbox" name="getty-images-omniture-opt-in" value="1" <# if(data.optIn) { #>checked="checked"<# } #> /> Agree to third-party tracking</label>
     479    </p>
     480
     481    <p class="getty-welcome-continue">
     482        <button class="button-primary">Continue</button>
     483    </p>
     484
     485</script>
     486
    472487<script type="text/html" id="tmpl-getty-choose-mode">
    473488    <# if(data.mode != 'login') { #>
  • getty-images/trunk/js/getty-images.js

    r923152 r1019742  
    99    var media = wp.media;
    1010    var getty = gettyImages;
    11     var s = window.getty_s;
    1211
    1312    // The Getty User session, which handles authentication needs and maintains
     
    1514    getty.user = new media.model.GettyUser();
    1615    getty.user.restore();
     16
     17    // Omniture tracking
     18    if ( getty.isWPcom ) {
     19        getty.t = function() {
     20            var s = window.getty_s;
     21            if(getty.user.settings.get('omniture-opt-in') && s && s.t) {
     22                s.t();
     23            }
     24        };
     25        getty.tl = function() {
     26            var s = window.getty_s;
     27            if(getty.user.settings.get('omniture-opt-in') && s && s.tl) {
     28                s.tl();
     29            }
     30        };
     31    } else {
     32        getty.t = function() {
     33            var s = window.getty_s;
     34            if(s && s.t) {
     35                s.t();
     36            }
     37        };
     38        getty.tl = function() {
     39            var s = window.getty_s;
     40            if(s && s.tl) {
     41                s.tl();
     42            }
     43        };
     44    }
    1745
    1846    /**
     
    3058            'content:activate:getty-images-browse': 'activateBrowser',
    3159            'toolbar:create:getty-images-toolbar': 'createToolbar',
     60            'content:create:getty-welcome': 'createWelcome',
    3261            'content:create:getty-mode-select': 'createModeSelect',
    3362            'toolbar:create:blank-toolbar': 'createBlankToolbar',
     
    5786            }
    5887
    59             getty.user.settings.on('change:mode', this.setMode, this);
     88            getty.user.settings.on('change:mode change:omniture-opt-in', this.setMode, this);
    6089            getty.user.on('change:loggedIn', this.setMode, this);
    6190        },
     
    77106            this.turnBindings('on');
    78107
    79             s && s.t();
     108            getty.t();
    80109
    81110            this.setMode();
     
    84113        setMode: function() {
    85114            if(getty.isWPcom) {
     115                if(getty.user.settings.get('omniture-opt-in') === undefined) {
     116                    this.set('content', 'getty-welcome');
     117                    this.set('toolbar', 'blank-toolbar');
     118                }
     119                else {
     120                    getty.user.settings.set('mode', 'login');
     121                    this.set('content', 'getty-images-browse');
     122                    this.set('toolbar', 'getty-images-toolbar');
     123                }
     124
    86125                return;
    87126            }
     
    122161
    123162            content.view = new media.view.GettyModeSelect({
     163                controller: this.frame,
     164                model:      this
     165            });
     166        },
     167
     168        createWelcome: function(content) {
     169            content.view = new media.view.GettyWelcome({
    124170                controller: this.frame,
    125171                model:      this
  • getty-images/trunk/js/getty-models.js

    r923152 r1019742  
    88    var media = wp.media;
    99    var getty = gettyImages;
    10     var s = window.getty_s;
    1110    var GettyAttachments;
    1211
     
    326325        // Image downloaded! Yay!
    327326        downloaded: function(response) {
     327            var s = window.getty_s;
    328328            this.set('attachment', new media.model.Attachment(response));
    329329
     
    333333                s.prop1 = s.eVar1 = s.prop2 = s.eVar2 = '';
    334334                s.prop3 = s.eVar3 = this.get('ImageId');
    335                 s.tl();
     335                getty.tl();
    336336            }
    337337        },
     
    410410        // Perform a search with queued search properties
    411411        search: function() {
    412             var searchTerm = this.propsQueue.get('search');
     412            var searchTerm = this.propsQueue.get('search'),
     413                s = window.getty_s;
    413414
    414415            if(typeof searchTerm != 'string' || !searchTerm.match(/[^\s]/)) {
     
    444445                    s.prop1 = s.eVar1 = s.prop3 = s.eVar3 = '';
    445446                    s.prop2 = s.eVar2 = this.props.get('search');
    446                     s.tl();
     447                    getty.tl();
    447448                }
    448449            }
     
    926927
    927928        login: function(password) {
     929            var s = window.getty_s;
     930
    928931            this.set('loggingIn', true);
    929932            this.unset('error');
     
    945948                        s.prop2 = s.eVar2 = s.prop3 = s.eVar3 = '';
    946949                        s.prop1 = s.eVar1 = self.get('username');
    947                         s.tl();
     950                        getty.tl();
    948951                    }
    949952                })
  • getty-images/trunk/js/getty-views.js

    r923152 r1019742  
    88    var media = wp.media;
    99    var getty = gettyImages;
    10     var s = window.getty_s;
    11     var l10n = media.view.l10n;
     10    var l10n = media.view.l10n;
    1211
    1312    // Turn a number string into a comma-separated triplet human-readable number,
     
    274273        createSingle: function() {
    275274            var sidebar = this.sidebar,
    276                 single = this.options.selection.single();
     275                single = this.options.selection.single(),
     276                s = window.getty_s;
    277277
    278278            var attachment = single.id ? media.model.GettyAttachments.all.get(single.id) : false;
     
    299299                    s.prop1 = s.eVar1 = s.prop2 = s.eVar2 = '';
    300300                    s.prop3 = s.eVar3 = single.id;
    301                     s.tl();
     301                    getty.tl();
    302302                }
    303303            }
     
    656656            // Create user view using the globalized, persistent user model
    657657            if(gettyImages.isWPcom || this.controller.get('mode') == 'login') {
    658                 this.updateMode(this.controller, this.controller.get('mode'));
    659             }
    660 
    661             getty.user.settings.on('change:mode', this.render, this);
     658                this.updateMode(this.controller, 'login');
     659            }
     660
     661            getty.user.settings.on('change:mode change:omniture-opt-in', this.render, this);
    662662            getty.user.settings.on('change:mode', this.updateMode, this);
    663663
     
    11551155
    11561156        insertImage: function() {
    1157             var image = this.collection.single();
     1157            var image = this.collection.single(),
     1158                s = window.getty_s;
    11581159
    11591160            if(this.controller.state().get('mode') != 'embed' && !image.get('attachment')) {
     
    11751176                    s.prop1 = s.eVar1 = s.prop2 = s.eVar2 = '';
    11761177                    s.prop3 = s.eVar3 = image.get('id');
    1177                     s.tl();
     1178                    s.prop5 = s.eVar5 = this.controller.state().get('mode') === 'embed' ? "Embed" : "License";
     1179                    getty.tl();
    11781180                }
    11791181
     
    11831185
    11841186        insertComp: function() {
    1185             var image = this.controller.state().get('selection').single();
     1187            var image = this.controller.state().get('selection').single(),
     1188                s = window.getty_s;
    11861189
    11871190            if(s && image) {
     
    11891192                s.prop1 = s.eVar1 = s.prop2 = s.eVar2 = '';
    11901193                s.prop3 = s.eVar3 = image.get('id');
    1191                 s.tl();
     1194                getty.tl();
    11921195            }
    11931196
     
    13171320
    13181321    /**
     1322     * Welcome screen + opt-in
     1323     */
     1324    media.view.GettyWelcome = media.View.extend({
     1325        tagName:   'div',
     1326        className: 'getty-welcome',
     1327        template:  media.template('getty-welcome'),
     1328
     1329        events: {
     1330            'click .getty-welcome-continue button': 'save',
     1331        },
     1332
     1333        save: function() {
     1334            var checked = this.$el.find('.getty-welcome-opt-in input').prop('checked');
     1335
     1336            if ( ! checked ) {
     1337                delete window.getty_s;
     1338            }
     1339            getty.user.settings.set('omniture-opt-in', checked);
     1340        },
     1341
     1342        prepare: function() {
     1343            var optIn = getty.user.settings.get('omniture-opt-in');
     1344
     1345            if(optIn === undefined) {
     1346                optIn = true;
     1347            }
     1348
     1349            return {
     1350                optIn: optIn
     1351            }
     1352        },
     1353    });
     1354
     1355    /**
    13191356     * Mode selection
    13201357     */
  • getty-images/trunk/readme.txt

    r998659 r1019742  
    44Requires at least: 3.9
    55Tested up to: 4.0
    6 Stable tag: 2.1.1
     6Stable tag: 2.2.1
    77License: GPLv2 or later
    88
     
    5151== Changelog ==
    5252
     53= 2.2.1 =
     54Fold in optimizations from VIP, ht Jeff Bowen @ Automattic
     55
     56= 2.2 =
     57Added Omniture Opt-in for WordPress.com VIP
     58
    5359= 2.1.1 =
    5460Updated library size language
Note: See TracChangeset for help on using the changeset viewer.