WordPress.org

Plugin Directory

Changeset 1402924


Ignore:
Timestamp:
04/23/16 14:02:02 (18 months ago)
Author:
daggerhart
Message:

update to 2.2.4 - removal of licenses

Location:
widget-wrangler/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • widget-wrangler/trunk/README.txt

    r1239158 r1402924  
    33Tags: widget, admin, widgets, administration, sidebar, manage 
    44Requires at least: 3 
    5 Tested up to: 4.2.2 
     5Tested up to: 4.5 
    66Stable tag: trunk 
    77 
     
    1616* Widgets as a post type 
    1717* PHP in widgets 
    18 * TinyMCE (wysiwyg) for Widgets 
    1918* Custom Widget templates 
    2019* Control Widget visibility on any page (or post type) 
     
    101100== Changelog == 
    102101 
     102= 2.2.4 = 
     103 
     104* Removing licensing concepts which opens the following features to free users: custom presets, manage taxonomies 
     105* Bug fix: Select box in sortable widgets on Firefox 
     106* Bug fix: Hiding widgets from wrangler. 
     107 
    103108= 2.2.3 = 
    104109 
     
    314319== Upgrade Notice == 
    315320 
    316 2.2.3 PHP5 Constructors 
     3212.2.4 Custom Presets, Manage widgets on taxonomies. Bug fix select box in sortable widgets. Bug fix hidden widgets in wrangler. 
  • widget-wrangler/trunk/admin/admin-clone.php

    r1173567 r1402924  
    4848      add_action( "admin_print_footer_scripts", array( $this, 'wp_admin_print_footer_scripts' ) ); 
    4949      add_action( "admin_head", array( $this->ww->admin, '_admin_css' ) ); 
    50        
     50 
    5151      $this->_clone_form(); 
    5252    } 
     
    5959  { 
    6060    global $wpdb,$wp_widget_factory; 
    61      
     61 
    6262    //Start our outputs 
    6363    $this_class_name = ''; 
    6464    $instance = array(); 
    65      
    66     if(isset($posted[$posted['ww-keyname']])){ 
    67       $this_class_name = $posted['ww-classname']; 
     65 
     66    if(isset($posted[$posted['ww-keyname']])) { 
     67            // Sanitize namespace characters that are improperly encoded from input 
     68      $this_class_name = implode("\\", array_filter( explode( "\\", $posted['ww-classname'] ))); 
    6869      foreach($posted[$posted['ww-keyname']] as $i => $settings){ 
    6970        foreach($settings as $key => $value){ 
     
    7475 
    7576    $user = wp_get_current_user(); 
    76      
     77 
    7778    $wp_widget = new $this_class_name; 
    78     $instance = $wp_widget->update($instance, array());   
    79      
     79    $instance = $wp_widget->update($instance, array()); 
     80 
    8081    // prep new widget info for saving 
    8182    $new_widget = array(); 
     
    9293    $new_widget['pinged']         = ''; 
    9394    $new_widget['post_content_filtered'] = ''; 
    94      
     95 
    9596    // insert new widget into db 
    9697    $new_post_id = wp_insert_post($new_widget); 
    9798    $instance['ID'] = $new_post_id; 
    9899    $instance['hide_title'] = ''; 
    99      
     100 
    100101    // post as meta values 
    101102    add_post_meta($new_post_id,'ww-widget-type', 'clone'); 
    102     add_post_meta($new_post_id,'ww-clone-classname', $this_class_name); 
     103    add_post_meta($new_post_id,'ww-clone-classname', \wp_slash($this_class_name)); 
    103104    add_post_meta($new_post_id,'ww-clone-instance', $instance); 
    104      
     105 
    105106    return $new_post_id; 
    106107  } 
    107    
     108 
    108109  /* 
    109110   * Display widgets available for cloning. 
     
    114115    $total_widgets = count($wp_widget_factory->widgets); 
    115116    $half = round($total_widgets/2); 
    116     $i = 0;  
     117    $i = 0; 
    117118    ?> 
    118119    <div class='wrap'> 
     
    132133            <?php 
    133134          } 
    134            
     135 
    135136          ob_start(); 
    136137            $wp_widget = new $classname; 
     
    148149                  </div> 
    149150                </div> 
    150                 <div class='widget-inside'>             
     151                <div class='widget-inside'> 
    151152                  <form action='edit.php?post_type=widget&page=clone&ww_action=insert&noheader=true' method='post'> 
    152153                    <input type='hidden' name='ww-classname' value='<?php print $classname; ?>' /> 
     
    180181    <?php 
    181182  } 
    182      
     183 
    183184} 
  • widget-wrangler/trunk/admin/admin-presets.php

    r1173567 r1402924  
    329329              ?> 
    330330            </ul> 
    331              
    332             <?php 
    333               if ($this->ww->license_status) 
    334               { ?> 
    335                 <div id="presets-add-new"> 
    336                   <h2 class="ww-setting-title">Create New</h2> 
    337                   <div class="ww-setting-content"> 
    338                     <p> 
    339                       <select name="create[variety]"> 
    340                       <?php 
    341                         foreach($this->ww->presets->preset_varieties as $key => $pstype) 
    342                         { 
    343                           if ($key != 'core') 
    344                           { ?> 
    345                             <option value="<?php print $key; ?>"><?php print $pstype['title']; ?></option> 
    346                             <?php 
    347                           } 
    348                         } 
    349                       ?> 
    350                       </select> 
    351                     </p> 
    352                     <p> 
    353                       <input type="submit" name="action[create]" class="button button-primary button-large" value="<?php _e("Create New Preset", 'widgetwrangler'); ?>" /> 
    354                     </p> 
    355                   </div> 
    356                 </div> 
    357                 <?php 
    358               } 
    359             ?> 
     331 
     332            <div id="presets-add-new"> 
     333              <h2 class="ww-setting-title">Create New</h2> 
     334              <div class="ww-setting-content"> 
     335                <p> 
     336                  <select name="create[variety]"> 
     337                  <?php 
     338                    foreach($this->ww->presets->preset_varieties as $key => $pstype) 
     339                    { 
     340                      if ($key != 'core') 
     341                      { ?> 
     342                        <option value="<?php print $key; ?>"><?php print $pstype['title']; ?></option> 
     343                        <?php 
     344                      } 
     345                    } 
     346                  ?> 
     347                  </select> 
     348                </p> 
     349                <p> 
     350                  <input type="submit" name="action[create]" class="button button-primary button-large" value="<?php _e("Create New Preset", 'widgetwrangler'); ?>" /> 
     351                </p> 
     352              </div> 
     353            </div> 
    360354          </div> 
    361355         
  • widget-wrangler/trunk/admin/admin-settings.php

    r1173567 r1402924  
    3939    // (optional) 
    4040    'description' => '', 
    41     // (optional) - defaults to false 
    42     'require_license' => false, 
    4341    // (optional) - something like 0 or array() when needed, defaults to empty string 
    4442    'empty_value' => '', 
     
    165163      'form_action' => array( $this, '_settings_tools_form' ), 
    166164      ); 
    167     $tabs['settings/license'] = array( 
    168       'title' => __('Pro License', 'widgetwrangler'), 
    169       'description' => __('Widget Wrangler Pro provides new features for site developers that can drastically increase efficiency in widget management for complex sites or needs.', 'widgetwrangler'), 
    170       'form_action' => array( $this, '_settings_tools_form' ), 
    171       ); 
    172165    return $tabs; 
    173166  } 
     
    188181      'description' => __('Select which taxonomies can control widgets individually.', 'widgetwrangler'), 
    189182      'empty_value' => $this->ww->settings['taxonomies'], 
    190       'require_license' => true, 
    191183      'form_action' => array( $this, '_default_settings_form_action' ), 
    192184      'execute_action' => array( $this, '_default_settings_execute_action' ), 
     
    195187      'title' => __('Theme Compatibility', 'widgetwrangler'), 
    196188      'empty_value' => 0, 
    197       'form_action' => array( $this, '_default_settings_form_action' ), 
    198       'execute_action' => array( $this, '_default_settings_execute_action' ), 
    199       ); 
    200     $settings['shortcode_tinymce'] = array( 
    201       'title' => __('tinyMCE Shortcode Button', 'widgetwrangler'), 
    202       'empty_value' => 0, 
    203       'require_license' => true, 
    204       'form_action' => array( $this, '_default_settings_form_action' ), 
    205       'execute_action' => array( $this, '_default_settings_execute_action' ), 
    206       ); 
    207     $settings['override_elements'] = array( 
    208       'title' => __('HTML Override Elements', 'widgetwrangler'), 
    209       'description' => __('Allowed elements for override a widget\'s html output.  Place one element per line.', 'widgetwrangler'), 
    210       'empty_value' => $this->ww->settings['override_elements'], 
    211       'require_license' => true, 
    212189      'form_action' => array( $this, '_default_settings_form_action' ), 
    213190      'execute_action' => array( $this, '_default_settings_execute_action' ), 
     
    227204      'execute_action' => array( $this, '_default_settings_execute_action' ), 
    228205      ); 
    229      
     206 
     207    // deprecated 
     208    // only allow people currently using this feature to see it. 
     209    if ( $this->ww->settings['previously_pro'] ||  $this->ww->settings['override_elements_enabled']){ 
     210      $settings['override_elements_enabled'] = array( 
     211        'title' => __('Deprecated: Enable overriding widget HTML from the Post UI.', 'widgetwrangler'), 
     212        'description' => __( 'This is a deprecated feature that is only here for legacy systems.' ). 
     213          '<h3><strong>'.__('Not Recommended, this feature is not available for new installs of Widget Wrangler. ').'</strong></h3> 
     214          <p>Instead, create a reusable template in your theme and set that template in the Custom Template section for a widget.</p>', 
     215        'empty_value' => 0, 
     216        'form_action' => array( $this, '_default_settings_form_action' ), 
     217        'execute_action' => array( $this, '_default_settings_execute_action' ), 
     218        ); 
     219      $settings['override_elements'] = array( 
     220          'title' => __('Deprecated: HTML Override Elements', 'widgetwrangler'), 
     221          'description' => __('Allowed elements for override a widget\'s html output.  Place one element per line.', 'widgetwrangler'), 
     222          'empty_value' => $this->ww->settings['override_elements'], 
     223          'form_action' => array( $this, '_default_settings_form_action' ), 
     224          'execute_action' => array( $this, '_default_settings_execute_action' ), 
     225      ); 
     226    } 
     227 
     228    // deprecated 
     229    // only allow people currently using shortcode tinymce to see this old feature 
     230    if ( $this->ww->settings['previously_pro'] || $this->ww->settings['shortcode_tinymce'] ) { 
     231      $settings['shortcode_tinymce'] = array( 
     232          'title' => __('Deprecated: tinyMCE Shortcode Button', 'widgetwrangler'), 
     233          'description' => __( 'This is a deprecated feature that is only here for legacy systems.' ). 
     234                           '<h3><strong>'.__('Not Recommended, this feature is not available for new installs of Widget Wrangler. ').'</strong></h3> 
     235                           <p>Instead, try this plugin to insert shortcodes into an editor. 
     236                           <a href="https://wordpress.org/plugins/shortcode-ui/">Shortcode UI</a></p>', 
     237          'empty_value' => 0, 
     238          'form_action' => array( $this, '_default_settings_form_action' ), 
     239          'execute_action' => array( $this, '_default_settings_execute_action' ), 
     240      ); 
     241    } 
     242 
    230243    // widget settings 
    231244    $settings['capabilities'] = array( 
     
    248261      'title' => __('Advanced', 'widgetwrangler'), 
    249262      'tab' => 'settings/widget', 
    250       'require_license' => true, 
    251263      'description' => __('Only change these if you know what you\'re doing.', 'widgetwrangler'), 
    252264      'value_keys' => array('rewrite_slug', 'query_var'), 
     
    281293      'execute_action' => array( $this, '_default_settings_execute_action' ), 
    282294      ); 
    283      
    284     // license 
    285     $settings['license_key'] = array( 
    286       'title' => __('License Key', 'widgetwrangler'), 
    287       'tab' => 'settings/license', 
    288       'execute_key' => 'license', 
    289       'description' => __('Enter your license key below.', 'widgetwrangler'), 
    290       'form_action' => array( $this, '_default_settings_form_action' ), 
    291       'execute_action' => array( $this, '_default_settings_execute_action' ), 
    292       ); 
     295 
    293296    return $settings; 
    294297  } 
     
    334337      // default setting values 
    335338      if (!isset($setting['tab'])) $setting['tab'] = 'settings'; 
    336       if (!isset($setting['require_license'])) $setting['require_license'] = false; 
    337339      if (!isset($setting['execute_key'])) $setting['execute_key'] = 'save'; 
    338340      if (!isset($setting['value_keys'])) $setting['value_keys'] = array($setting_key); 
     
    404406      case 'theme_setup': 
    405407        $this->_setup_theme(); 
    406         break; 
    407        
    408       case 'license': 
    409         $this->_handle_license(); 
    410408        break; 
    411409    } 
     
    502500        <?php 
    503501        break; 
     502 
     503      case 'override_elements_enabled': 
     504        $checked = (!empty($setting['form_values']['override_elements_enabled'])) ? "checked='checked'" : ""; 
     505        ?> 
     506          <label class="ww-checkbox"> 
     507            <input name="settings[<?php print $setting_key; ?>]" type="checkbox" <?php print $checked; ?> value="1" /> - <?php _e('Enable Overriding Widget HTML from the Post UI. Not recommended.', 'widgetwrangler'); ?> 
     508          </label> 
     509        <?php 
     510        break; 
    504511       
    505512      // widget settings 
     
    577584        <?php 
    578585        break; 
    579        
    580       // license 
    581       case 'license_key':     
    582         $license    = get_option( 'ww_pro_license_key' ); 
    583         $status     = get_option( 'ww_pro_license_status' ); 
    584         $valid = $this->ww->license_status ? true : false; 
    585         $status_indicator = ( $valid ) ? "<small style='color: green;'>".__('active', 'widgetwrangler') . "</small>": "<small style='color: red;'>".__('inactive', 'widgetwrangler') . "</small>"; 
    586          
    587         $action_title = __("Activate License", 'widgetwrangler'); 
    588         $button_name = "ww_pro_license_activate"; 
    589         if( $valid ){ 
    590           $action_title = __("Deactivate License", 'widgetwrangler'); 
    591           $button_name = "ww_pro_license_deactivate"; 
    592         } 
    593         ?> 
    594           <form method="post" action="<?php print $this->current_settings_form_tab['tab_url']; ?>&ww_action=license&noheader=true">   
    595               <p> 
    596                 <input id="ww_pro_license_key" name="ww_pro_license_key" type="text" class="regular-text" value="<?php esc_attr_e( $license ); ?>" /> 
    597                 <?php print $status_indicator; ?> 
    598               </p> 
    599               <p> 
    600                 <input type="submit" class="button-secondary" name="<?php print $button_name; ?>" value="<?php print $action_title; ?>"/> 
    601               </p> 
    602           </form> 
    603            
    604           <h2><?php _e('About Widget Wrangler Pro', 'widgetwrangler'); ?></h2> 
    605           <p> 
    606             <?php _e('Widget Wrangler Pro offers new features for a whole new level of control over your widgets.  Manage the widgets on archive (category) pages, create as many presets as you want, and many more!'); ?> 
    607             <a target="_blank" href="http://wranglerplugins.com/plugins/widget-wrangler/#compare"><?php _e('View Pro Features', 'widgetwrangler'); ?></a> 
    608           </p> 
    609         <?php 
    610         break; 
    611        
     586 
    612587      case 'override_elements': 
    613588        $rows = count($setting['form_values']['override_elements']) + 1; 
     
    674649      <div class="ww-admin-tab"> 
    675650        <?php 
     651          if ( isset($_GET['debug']) ) { $this->ww->__d($this->ww->settings); } 
    676652          foreach ($this->settings_form_items as $setting_key => $setting){ 
    677653            // only settings on this tab 
    678654            if ($setting['tab'] == $this->current_settings_form_tab['tab_key']){ 
    679               // skip settings that require a license if license invalid 
    680               if ($setting['require_license'] && !$this->ww->license_status){ 
    681                 continue; 
    682               } 
    683                
    684655              $this->_theme_settings_form_item($setting); 
    685656            } 
     
    753724    $this->ww->settings = $settings;     
    754725  } 
    755      
    756   // 
    757   // check license 
    758   // 
    759   function _handle_license() { 
    760     // run a quick security check  
    761     //if( ! check_admin_referer( 'ww_nonce', 'ww_nonce' ) )     { 
    762       //return; // get out if we didn't click the Activate button 
    763     //} 
    764      
    765     if ( isset( $_POST['ww_pro_license_activate'] ) ) { 
    766       $new = trim($_POST['ww_pro_license_key']); 
    767       $old = trim( get_option( 'ww_pro_license_key' ) ); 
    768        
    769       if($old != $new ) { 
    770         update_option( 'ww_pro_license_key', $new); 
    771         delete_option( 'ww_pro_license_status' ); // new license has been entered, so must reactivate 
    772       } 
    773        
    774       // retrieve the license from the database 
    775       $license = get_option( 'ww_pro_license_key' ); 
    776          
    777       // data to send in our API request 
    778       $api_params = array(  
    779         'edd_action'=> 'activate_license',  
    780         'license'   => $license,  
    781         'item_name' => urlencode( WW_PRO_NAME ) // the name of our product in EDD 
    782       ); 
    783        
    784       // Call the custom API. 
    785       $response = wp_remote_get( add_query_arg( $api_params, WW_PRO_URL ), array( 'timeout' => 15, 'sslverify' => false ) ); 
    786    
    787       // make sure the response came back okay 
    788       if ( is_wp_error( $response ) ){ 
    789         return false; 
    790       } 
    791    
    792       // decode the license data 
    793       $license_data = json_decode( wp_remote_retrieve_body( $response ) ); 
    794        
    795       // $license_data->license will be either "valid" or "invalid" 
    796       update_option( 'ww_pro_license_status', $license_data ); 
    797     } 
    798    
    799     // listen for our activate button to be clicked 
    800     else if( isset( $_POST['ww_pro_license_deactivate'] ) ) 
    801     { 
    802       // retrieve the license from the database 
    803       $license = get_option( 'ww_pro_license_key' ); 
    804          
    805       // data to send in our API request 
    806       $api_params = array(  
    807         'edd_action'=> 'deactivate_license',  
    808         'license'   => $license,  
    809         'item_name' => urlencode( WW_PRO_NAME ) // the name of our product in EDD 
    810       ); 
    811        
    812       // Call the custom API. 
    813       $response = wp_remote_get( add_query_arg( $api_params, WW_PRO_URL ), array( 'timeout' => 15, 'sslverify' => false ) ); 
    814    
    815       // make sure the response came back okay 
    816       if ( is_wp_error( $response ) ){ 
    817         return false; 
    818       } 
    819    
    820       // decode the license data 
    821       $license_data = json_decode( wp_remote_retrieve_body( $response ) ); 
    822        
    823       // $license_data->license will be either "deactivated" or "failed" 
    824       if( $license_data->license == 'deactivated' ){ 
    825         delete_option( 'ww_pro_license_status' ); 
    826       } 
    827     } 
    828   } 
    829    
     726 
    830727  // 
    831728  // Empty wp sidebars, 
  • widget-wrangler/trunk/admin/admin-shortcode-tinymce.php

    r1173567 r1402924  
    2222  function wp_admin_init(){ 
    2323    // shortcode inserter 
    24     if (!empty($this->ww->settings['shortcode_tinymce']) && 
    25         $this->ww->admin->_is_editing_enabled_post_type() && 
    26         $this->ww->_check_license()) 
     24    if ($this->ww->settings['shortcode_tinymce'] && 
     25        $this->ww->admin->_is_editing_enabled_post_type()) 
    2726    { 
    2827      add_action('admin_head', array($this, 'wp_admin_head')); 
  • widget-wrangler/trunk/admin/js/sortable-widgets.js

    r1167344 r1402924  
    6666      WidgetWrangler.sortable.update_widget_weights(); 
    6767      WidgetWrangler.sortable.message(); 
    68     }) 
    69     .disableSelection(); 
     68    }); 
    7069     
    7170 
  • widget-wrangler/trunk/admin/sortable.php

    r1167344 r1402924  
    217217                    <option value="0">-- <?php _e('Select a Widget', 'widgetwrangler'); ?> --</option> 
    218218                    <?php foreach ( $this->all_widgets as $widget ){ ?> 
     219                        <?php if ( ! $widget->hide_from_wrangler ) : ?> 
    219220                        <option value="<?php print esc_attr( $widget->ID ); ?>"><?php print $widget->post_title; ?></option> 
     221                        <?php endif; ?> 
    220222                    <?php } ?> 
    221223                </select> 
  • widget-wrangler/trunk/common/wp-posttype-widget.php

    r1126700 r1402924  
    233233      // let the widget update itself 
    234234      $classname = $_POST['ww-data']['clone']['clone-class']; 
     235      $classname = implode("\\", array_filter( explode( "\\", $classname ))); 
    235236      if (class_exists($classname)) { 
    236237        $wp_widget = new $classname; 
     
    257258    if (isset($posted['ww-data']['clone'])) { 
    258259      $clone_class = $posted['ww-data']['clone']['clone-class']; 
     260      $clone_class = implode("\\", array_filter( explode( "\\", $clone_class ))); 
    259261      $option_name = "widget-".$wp_widget_factory->widgets[$clone_class]->control_options['id_base']; 
    260262      $instance = array(); 
     
    468470        </div> 
    469471 
    470         <?php if ($this->ww->_check_license()) { ?> 
     472        <?php if ($this->ww->settings['override_elements_enabled']) { ?> 
    471473          <hr /> 
    472474          <h4><?php _e("Override HTML Output", 'widgetwrangler'); ?></h4> 
     
    508510            </div> 
    509511          </div> 
    510         <?php } ?> 
     512        <?php  } ?> 
    511513      </div> 
    512514    <?php 
     
    611613              if (isset($suggestions)) { ?> 
    612614               
    613                 <?php if ($this->ww->_check_license()){ ?> 
    614615                  <h4><?php _e("Custom template suggestion", 'widgetwrangler'); ?></h4> 
    615616                  <ul class="ww-custom-template-suggestion"> 
     
    620621                    <li><?php _e("If defined, the custom suggestion will take precedence.", 'widgetwrangler'); ?></li> 
    621622                  </ul> 
    622                 <?php } ?> 
    623                  
     623 
    624624                <h4><?php _e("Template Suggestions", 'widgetwrangler'); ?></h4> 
    625625                <p class="description"><?php _e("Corral specific templates will not be detected here unless you set the 'Preview Corral Context' in the preview pane.", 'widgetwrangler'); ?></p> 
  • widget-wrangler/trunk/widget-wrangler.php

    r1239158 r1402924  
    55Description: Widget Wrangler gives the WordPress admin a clean interface for managing widgets on a page by page basis. It also provides widgets as a post type, the ability to clone existing WordPress widgets, and granular control over widget templates. 
    66Author: Jonathan Daggerhart 
    7 Version: 2.2.3 
     7Version: 2.2.4 
    88Author URI: http://daggerhart.com 
    99Text Domain: widgetwrangler 
     
    2525 
    2626// versioning for now 
    27 define('WW_VERSION', 2); 
    28 define('WW_SCRIPT_VERSION', '2.2.2'); 
    29 define('WW_PRO_NAME', 'Widget Wrangler Pro' ); 
    30 define('WW_PRO_URL', 'http://wranglerplugins.com' );  
     27define('WW_VERSION', '2.2.4'); 
     28define('WW_SCRIPT_VERSION', '2.2.4'); 
    3129 
    3230define('WW_PLUGIN_FILE', __FILE__); 
     
    6866  var $corrals = array(); 
    6967   
    70   // licensing 
    71   var $license_status = FALSE; 
    72    
    7368  // altered sidebars 
    7469  var $altered_sidebars = array(); 
     
    8782        'taxonomies' => array(), 
    8883        'override_elements' => array( 
    89           'div', 'h2', 'h3', 'aside', 'strong', 'span',  
     84          'div', 'h2', 'h3', 'aside', 'strong', 'span', 
    9085        ), 
    9186        'legacy_template_suggestions' => 0, 
     87 
     88        // begin the weaning of features that will be removed 
     89        // dead end features:  override html elements, shortcode tinymce 
     90        'previously_pro' => 0, 
     91        'override_elements_enabled' => 0, 
     92        'shortcode_tinymce' => 0, 
    9293      ); 
    9394 
     
    113114    $this->_get_settings(); 
    114115    $this->_get_corrals(); 
    115     $this->_check_license(); 
    116116     
    117117    // early wp hooks 
     
    286286      $settings['override_elements'] = $this->default_settings['override_elements']; 
    287287    } 
    288      
     288 
     289    // debug 
     290    //$settings['previously_pro'] = 1; 
     291 
    289292    $this->settings = $settings; 
    290293    return $this->settings; 
     
    397400   * Simple check 
    398401   * 
    399    * @return (bool) - Whether or not the license is valid 
    400    */ 
    401   function _check_license() {     
    402     $status = get_option('ww_pro_license_status'); 
    403     $this->license_status = (isset($status->license) && $status->license === "valid") ? TRUE : FALSE; 
    404     return $this->license_status; 
     402   * @return (bool) - Whether or not WW was previously_pro 
     403   */ 
     404  function _check_previously_pro() { 
     405    $status = get_option('ww_pro_license_status', false ); 
     406    if ( ! $status ){ 
     407      return false; 
     408    } 
     409 
     410    return (isset($status->license) && $status->license === "valid") ? TRUE : FALSE; 
    405411  } 
    406412   
     
    585591    // upgrade, if an old version exists 
    586592    if ($old_version = get_option('ww_version', FALSE)){ 
    587       if ((float) $old_version < WW_VERSION){ 
     593      if ( version_compare( $old_version, WW_VERSION, '<') ){ 
    588594         
    589595        // upgrade from 1x to 2x 
    590         if ((float) $old_version < 2){ 
     596        if ( version_compare( $old_version, 2, '<' ) ){ 
    591597          $this->_upgrade_from_1x_to_2x(); 
     598        } 
     599 
     600        // abandonment of pro 
     601        if ( get_option('ww_pro_license_status', false ) ){ 
     602          $this->_upgrade_from_freemium_to_free(); 
    592603        } 
    593604         
     
    661672      update_option('ww_previous_main_version', 1); 
    662673    }     
     674  } 
     675 
     676  /* 
     677   * Migration after abandonment of "Pro" version 
     678   */ 
     679  function _upgrade_from_freemium_to_free(){ 
     680 
     681    // only modifications are for versions that used to be PRO 
     682    if ( $this->_check_previously_pro() ){ 
     683      $settings = get_option( 'ww_settings', array() ); 
     684 
     685      // this site used to be a paid-for WW Pro version 
     686      $settings['previously_pro'] = 1; 
     687 
     688      // enable the override html legacy feature 
     689      $settings['override_elements_enabled'] = 1; 
     690 
     691      update_option('ww_settings', $settings ); 
     692      $this->_get_settings(); 
     693    } 
     694 
     695    delete_option('ww_pro_license_status'); 
    663696  } 
    664697   
Note: See TracChangeset for help on using the changeset viewer.