Plugin Directory

Changeset 889445


Ignore:
Timestamp:
04/08/2014 03:08:22 PM (12 years ago)
Author:
joshlevinson
Message:

tagging 2.0.2

Location:
woocommerce-product-faqs
Files:
7 edited
4 copied

Legend:

Unmodified
Added
Removed
  • woocommerce-product-faqs/tags/2.0.2/README.txt

    r888839 r889445  
    55Requires at least: 3.5.1
    66Tested up to: 3.7
    7 Stable tag: 2.0.1
     7Stable tag: 2.0.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • woocommerce-product-faqs/tags/2.0.2/admin/class-woocommerce-product-faqs-admin.php

    r886901 r889445  
    6969        */
    7070
    71         $this::$plugin = WooCommerce_FAQs::get_instance();
    72 
    73         $this->plugin_slug = $this::$plugin->p('plugin_slug');
     71        self::$plugin = WooCommerce_FAQs::get_instance();
     72
     73        $this->plugin_slug = self::$plugin->p('plugin_slug');
    7474
    7575        //load upgrade functions
     
    9797        //custom post table columns
    9898
    99         add_filter( 'manage_edit-'.$this::$plugin->p('post_type').'_columns', array( $this, 'set_custom_edit_columns' ) );
     99        add_filter( 'manage_edit-'.self::$plugin->p('post_type').'_columns', array( $this, 'set_custom_edit_columns' ) );
    100100
    101101       
     
    103103        //custom post table columns content
    104104
    105         add_action( 'manage_'.$this::$plugin->p('post_type').'_posts_custom_column' , array( $this, 'custom_column' ), 1, 2 );
     105        add_action( 'manage_'.self::$plugin->p('post_type').'_posts_custom_column' , array( $this, 'custom_column' ), 1, 2 );
    106106
    107107        //meta boxes
     
    175175    function upgrade_actions() {
    176176
    177         $current_version = get_option( $this::$plugin->p('option_prefix') . 'plugin_version', '1.0.9' );
    178 
    179         if($current_version != $this::$plugin->get_version() ) {
     177        $current_version = get_option( self::$plugin->p('option_prefix') . 'plugin_version', '1.0.9' );
     178
     179        if($current_version != self::$plugin->get_version() ) {
    180180
    181181            switch ($current_version) {
     
    187187                    global $wpdb;
    188188
    189                     $wpdb->update($table = $wpdb->posts, $data = array('comment_status'=>'open'), $where = array( 'post_type'=>$this::$plugin->p('post_type') ), $format = array('%s'), $where_format = array('%s') );
     189                    $wpdb->update($table = $wpdb->posts, $data = array('comment_status'=>'open'), $where = array( 'post_type'=>self::$plugin->p('post_type') ), $format = array('%s'), $where_format = array('%s') );
    190190
    191191                    break;
     
    193193            }
    194194
    195             update_option( $this::$plugin->p('option_prefix') . 'plugin_version', $this::$plugin->get_version() );
     195            update_option( self::$plugin->p('option_prefix') . 'plugin_version', self::$plugin->get_version() );
    196196
    197197        }
     
    212212        $screen = get_current_screen();
    213213
    214         if ( $screen->id == $this::$plugin->p('plugin_screen_hook_suffix') ) {
    215 
    216             wp_enqueue_style( $this->plugin_slug .'-admin-styles', plugins_url( '/assets/css/admin.css', __FILE__ ), array(), $this::$plugin->get_version() );
     214        if ( $screen->id == self::$plugin->p('plugin_screen_hook_suffix') ) {
     215
     216            wp_enqueue_style( $this->plugin_slug .'-admin-styles', plugins_url( '/assets/css/admin.css', __FILE__ ), array(), self::$plugin->get_version() );
    217217
    218218        }
     
    230230        echo '<style type="text/css" media="screen">
    231231
    232             #menu-posts-' . $this::$plugin->p('post_type') . ' .wp-menu-image {
     232            #menu-posts-' . self::$plugin->p('post_type') . ' .wp-menu-image {
    233233
    234234                background: url(' . plugins_url( '/assets/images/icon.png', __FILE__ ) . ') no-repeat 0 -32px !important;
     
    236236            }
    237237
    238         #menu-posts-' . $this::$plugin->p('post_type') . ':hover .wp-menu-image, #menu-posts-' . $this::$plugin->p('post_type') . '.wp-has-current-submenu .wp-menu-image {
     238        #menu-posts-' . self::$plugin->p('post_type') . ':hover .wp-menu-image, #menu-posts-' . self::$plugin->p('post_type') . '.wp-has-current-submenu .wp-menu-image {
    239239
    240240                background-position:0 0 !important;
     
    242242            }
    243243
    244         #icon-edit.icon32-posts-' . $this::$plugin->p('post_type') . ' {background: url(' . plugins_url( '/assets/images/full-32x32.png', __FILE__ ) . ') no-repeat 0px 0px !important;}
     244        #icon-edit.icon32-posts-' . self::$plugin->p('post_type') . ' {background: url(' . plugins_url( '/assets/images/full-32x32.png', __FILE__ ) . ') no-repeat 0px 0px !important;}
    245245
    246246        </style>';
     
    260260        //we need to load this script on the edit page for our post type
    261261
    262         if ( $screen->id == 'edit-' . $this::$plugin->p('post_type') ) {
    263 
    264             wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( '/assets/js/admin.js', __FILE__ ), array( 'jquery' ), $this::$plugin->get_version() );
     262        if ( $screen->id == 'edit-' . self::$plugin->p('post_type') ) {
     263
     264            wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( '/assets/js/admin.js', __FILE__ ), array( 'jquery' ), self::$plugin->get_version() );
    265265
    266266            $localize = array(
     
    280280                //and localize the color with a filter, so it can be changed either by user or maybe later as a settings option
    281281
    282                 $localize['faq_highlight_color'] = apply_filters( $this::$plugin->p('option_prefix') . 'admin_faq_highlight_color', '#9ED1D6' );
     282                $localize['faq_highlight_color'] = apply_filters( self::$plugin->p('option_prefix') . 'admin_faq_highlight_color', '#9ED1D6' );
    283283
    284284            }
    285285
    286             wp_localize_script( $this->plugin_slug . '-admin-script', $this::$plugin->p('option_prefix') . 'data', $localize );
     286            wp_localize_script( $this->plugin_slug . '-admin-script', self::$plugin->p('option_prefix') . 'data', $localize );
    287287
    288288        }
     
    323323        //check for our post type
    324324
    325         if ( $post->post_type == $this::$plugin->p('post_type') ) {
     325        if ( $post->post_type == self::$plugin->p('post_type') ) {
    326326
    327327            $post_type_object = get_post_type_object( $post->post_type );
     
    364364        global $post;
    365365
    366         if( $post->post_type == $this::$plugin->p('post_type') ) {
    367 
    368             $preview_link = get_permalink( (int)get_post_meta( $post->ID, '_' . $this::$plugin->p('post_type') . '_product', true ) );
     366        if( $post->post_type == self::$plugin->p('post_type') ) {
     367
     368            $preview_link = get_permalink( (int)get_post_meta( $post->ID, '_' . self::$plugin->p('post_type') . '_product', true ) );
    369369
    370370            $publish = ( $post->post_status == 'publish' ? 'view' : 'preview' );
     
    452452        }
    453453
    454         $publisher = get_option( $this::$plugin->p('option_prefix') . 'publisher_key' );
    455 
    456         $scoring = get_option( $this::$plugin->p('option_prefix') . 'scoring_key' );
     454        $publisher = get_option( self::$plugin->p('option_prefix') . 'publisher_key' );
     455
     456        $scoring = get_option( self::$plugin->p('option_prefix') . 'scoring_key' );
    457457
    458458        return array(
     
    464464                    'type'      => 'title',
    465465
    466                     'id'        => $this::$plugin->p('option_prefix') . 'general',
     466                    'id'        => self::$plugin->p('option_prefix') . 'general',
    467467
    468468                    'desc'      => ''
     
    474474                    $title      => __('Expand FAQ content by default', $this->plugin_slug ),
    475475
    476                     'id'        => $this::$plugin->p('option_prefix') . 'expand_faqs',
     476                    'id'        => self::$plugin->p('option_prefix') . 'expand_faqs',
    477477
    478478                    'type'      => 'checkbox',
     
    490490                    $title      => __('Disable asking functionality', $this->plugin_slug ),
    491491
    492                     'id'        => $this::$plugin->p('option_prefix') . 'disable_ask',
     492                    'id'        => self::$plugin->p('option_prefix') . 'disable_ask',
    493493
    494494                    'type'      => 'checkbox',
     
    506506                    $title      => __('FAQ notification email address', $this->plugin_slug ),
    507507
    508                     'id'        => $this::$plugin->p('option_prefix') . 'answerer_email',
     508                    'id'        => self::$plugin->p('option_prefix') . 'answerer_email',
    509509
    510510                    'type'      => 'text',
     
    520520                    $title      => __('FAQ notification from name', $this->plugin_slug ),
    521521
    522                     'id'        => $this::$plugin->p('option_prefix') . 'from_name',
     522                    'id'        => self::$plugin->p('option_prefix') . 'from_name',
    523523
    524524                    'type'      => 'text',
     
    534534                    'type'      => 'sectionend',
    535535
    536                     'id'        => $this::$plugin->p('option_prefix') . 'general'
     536                    'id'        => self::$plugin->p('option_prefix') . 'general'
    537537
    538538                ),
     
    544544                    'type'      => 'title',
    545545
    546                     'id'        => $this::$plugin->p('option_prefix') . 'antispam',
     546                    'id'        => self::$plugin->p('option_prefix') . 'antispam',
    547547
    548548                    'desc'      => __('Please choose your Anti-Spam settings.' .
     
    560560                    $title      => __('Use Are You A Human antispam?', $this->plugin_slug ),
    561561
    562                     'id'        => $this::$plugin->p('option_prefix') . 'use_antispam',
     562                    'id'        => self::$plugin->p('option_prefix') . 'use_antispam',
    563563
    564564                    'type'      => 'checkbox',
     
    572572                    $title      => __('Publisher Key', $this->plugin_slug ),
    573573
    574                     'id'        => $this::$plugin->p('option_prefix') . 'publisher_key',
     574                    'id'        => self::$plugin->p('option_prefix') . 'publisher_key',
    575575
    576576                    'type'      => 'text',
     
    584584                    $title      => __('Public/Scoring Key', $this->plugin_slug ),
    585585
    586                     'id'        => $this::$plugin->p('option_prefix') . 'scoring_key',
     586                    'id'        => self::$plugin->p('option_prefix') . 'scoring_key',
    587587
    588588                    'type'      => 'text',
     
    596596                    'type'      => 'sectionend',
    597597
    598                     'id'        => $this::$plugin->p('option_prefix') . 'antispam'
     598                    'id'        => self::$plugin->p('option_prefix') . 'antispam'
    599599
    600600                ),
     
    606606                    'type'      => 'title',
    607607
    608                     'id'        => $this::$plugin->p('option_prefix') . 'tab_settings'
     608                    'id'        => self::$plugin->p('option_prefix') . 'tab_settings'
    609609
    610610                ),
     
    614614                    $title      => __('Tab Title', $this->plugin_slug ),
    615615
    616                     'id'        => $this::$plugin->p('option_prefix') . 'tab_title',
     616                    'id'        => self::$plugin->p('option_prefix') . 'tab_title',
    617617
    618618                    'type'      => 'text'
     
    624624                    $title      => __('Tab Priority', $this->plugin_slug ),
    625625
    626                     'id'        => $this::$plugin->p('option_prefix') . 'tab_priority',
     626                    'id'        => self::$plugin->p('option_prefix') . 'tab_priority',
    627627
    628628                    'type'      => 'text'
     
    634634                    'type'      => 'sectionend',
    635635
    636                     'id'        => $this::$plugin->p('option_prefix') . 'tab_settings'
     636                    'id'        => self::$plugin->p('option_prefix') . 'tab_settings'
    637637
    638638                ),
     
    650650    function update_old_wc_options() {
    651651
    652         update_option( $this::$plugin->p('option_prefix') . 'publisher_key', sanitize_text_field( $_POST[$this::$plugin->p('option_prefix') . 'publisher_key'] ) );
    653 
    654         update_option( $this::$plugin->p('option_prefix') . 'faqs_scoring_key', sanitize_text_field( $_POST[$this::$plugin->p('option_prefix') . 'scoring_key'] ) );
    655 
    656         $use_antispam = ( sanitize_text_field( $_POST[$this::$plugin->p('option_prefix') . 'use_antispam'] ) == 1 ? 'yes' : 'no');
    657 
    658         update_option( $this::$plugin->p('option_prefix') . 'use_antispam', $use_antispam );
    659 
    660         update_option( $this::$plugin->p('option_prefix') . 'tab_title', sanitize_text_field( $_POST[$this::$plugin->p('option_prefix') . 'tab_title'] ) );
    661 
    662         update_option( $this::$plugin->p('option_prefix') . 'tab_priority', sanitize_text_field( $_POST[$this::$plugin->p('option_prefix') . 'tab_priority'] ) );
     652        update_option( self::$plugin->p('option_prefix') . 'publisher_key', sanitize_text_field( $_POST[self::$plugin->p('option_prefix') . 'publisher_key'] ) );
     653
     654        update_option( self::$plugin->p('option_prefix') . 'faqs_scoring_key', sanitize_text_field( $_POST[self::$plugin->p('option_prefix') . 'scoring_key'] ) );
     655
     656        $use_antispam = ( sanitize_text_field( $_POST[self::$plugin->p('option_prefix') . 'use_antispam'] ) == 1 ? 'yes' : 'no');
     657
     658        update_option( self::$plugin->p('option_prefix') . 'use_antispam', $use_antispam );
     659
     660        update_option( self::$plugin->p('option_prefix') . 'tab_title', sanitize_text_field( $_POST[self::$plugin->p('option_prefix') . 'tab_title'] ) );
     661
     662        update_option( self::$plugin->p('option_prefix') . 'tab_priority', sanitize_text_field( $_POST[self::$plugin->p('option_prefix') . 'tab_priority'] ) );
    663663
    664664    }
     
    704704            case 'asker' :
    705705
    706                 echo get_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_author_name', true );
     706                echo get_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_author_name', true );
    707707
    708708                break;
     
    710710            case 'asker_email' :
    711711
    712                 echo get_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_author_email', true );
     712                echo get_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_author_email', true );
    713713
    714714                break;
     
    726726    function meta_boxes() {
    727727
    728         add_meta_box( $this::$plugin->p('post_type') . '_product', __( 'FAQ Details', $this->plugin_slug ), array( $this, 'metabox' ), $this::$plugin->p('post_type'), 'normal', 'high' );
     728        add_meta_box( self::$plugin->p('post_type') . '_product', __( 'FAQ Details', $this->plugin_slug ), array( $this, 'metabox' ), self::$plugin->p('post_type'), 'normal', 'high' );
    729729
    730730    }
     
    740740        //get current value
    741741
    742         $current_product = get_post_meta( $post->ID, '_' . $this::$plugin->p('post_type') . '_product', true );
     742        $current_product = get_post_meta( $post->ID, '_' . self::$plugin->p('post_type') . '_product', true );
    743743
    744744        //get current value
    745745
    746         $category = get_post_meta( $post->ID, '_' . $this::$plugin->p('post_type') . '_categories', true );
    747 
    748         $author_name = get_post_meta( $post->ID, '_' . $this::$plugin->p('post_type') . '_author_name', true );
    749 
    750         $author_email = get_post_meta( $post->ID, '_' . $this::$plugin->p('post_type') . '_author_email', true );
     746        $category = get_post_meta( $post->ID, '_' . self::$plugin->p('post_type') . '_categories', true );
     747
     748        $author_name = get_post_meta( $post->ID, '_' . self::$plugin->p('post_type') . '_author_name', true );
     749
     750        $author_email = get_post_meta( $post->ID, '_' . self::$plugin->p('post_type') . '_author_email', true );
    751751
    752752        //nonce
    753753
    754         wp_nonce_field( plugin_basename( __FILE__ ), $this::$plugin->p('post_type') . 'meta_nonce' );
     754        wp_nonce_field( plugin_basename( __FILE__ ), self::$plugin->p('post_type') . 'meta_nonce' );
    755755
    756756        //get all products
     
    770770            //Product relationship label
    771771
    772             echo '<p><label for="_' . '_' . $this::$plugin->p('post_type') . '_product">';
     772            echo '<p><label for="_' . '_' . self::$plugin->p('post_type') . '_product">';
    773773
    774774            _e( 'Product this question is shown on.', $this->plugin_slug );
     
    778778            //Product relationship select
    779779
    780             echo '<p><select name="' . '_' . $this::$plugin->p('post_type') . '_product">';
     780            echo '<p><select name="' . '_' . self::$plugin->p('post_type') . '_product">';
    781781
    782782            echo '<option ' . selected( $current_product, '0', false ) . ' value="0">' . __( 'No product selection (use category only)', $this->plugin_slug ) . '</option>';
     
    808808        //Product relationship label
    809809
    810             echo '<p><label for="_' . '_' . $this::$plugin->p('post_type') . '_categories">';
     810            echo '<p><label for="_' . '_' . self::$plugin->p('post_type') . '_categories">';
    811811
    812812            _e( 'Categories this question is shown on.', $this->plugin_slug );
     
    838838                'hierarchical'       => 0,
    839839
    840                 'name'               => '_' . $this::$plugin->p('post_type') . '_categories',
    841 
    842                 'id'                 => '_' . $this::$plugin->p('post_type') . '_categories',
     840                'name'               => '_' . self::$plugin->p('post_type') . '_categories',
     841
     842                'id'                 => '_' . self::$plugin->p('post_type') . '_categories',
    843843
    844844                'class'              => 'postform',
     
    870870        //author's name
    871871
    872         echo '<p><label for="_' . $this::$plugin->p('post_type') . '_author_name">';
     872        echo '<p><label for="_' . self::$plugin->p('post_type') . '_author_name">';
    873873
    874874        _e('Author: ', $this->plugin_slug );
     
    876876        echo '</label>';
    877877
    878         echo '<input type="text" name="_' . $this::$plugin->p('post_type') . '_author_name" value="' . $author_name . '"/></p>';
     878        echo '<input type="text" name="_' . self::$plugin->p('post_type') . '_author_name" value="' . $author_name . '"/></p>';
    879879
    880880        //author's email
    881881
    882         echo '<p><label for="_' . $this::$plugin->p('post_type') . '_author_email">';
     882        echo '<p><label for="_' . self::$plugin->p('post_type') . '_author_email">';
    883883
    884884        _e('Author Email: ', $this->plugin_slug );
     
    886886        echo '</label>';
    887887
    888         echo '<input type="email" name="_' . $this::$plugin->p('post_type') . '_author_email" value="' . $author_email . '"/></p>';
     888        echo '<input type="email" name="_' . self::$plugin->p('post_type') . '_author_email" value="' . $author_email . '"/></p>';
    889889
    890890    }
     
    909909        // Secondly we need to check if the user intended to change this value.
    910910
    911         if ( ! isset( $_POST[$this::$plugin->p('post_type') . 'meta_nonce'] ) || ! wp_verify_nonce( $_POST[$this::$plugin->p('post_type') . 'meta_nonce'], plugin_basename( __FILE__ ) ) ) {
     911        if ( ! isset( $_POST[self::$plugin->p('post_type') . 'meta_nonce'] ) || ! wp_verify_nonce( $_POST[self::$plugin->p('post_type') . 'meta_nonce'], plugin_basename( __FILE__ ) ) ) {
    912912
    913913            return;
     
    915915        }
    916916
    917         $author_name = sanitize_text_field( $_POST['_' . $this::$plugin->p('post_type') . '_author_name'] );
    918 
    919         $author_email = sanitize_text_field( $_POST['_' . $this::$plugin->p('post_type') . '_author_email'] );
    920 
    921         $product = sanitize_text_field( $_POST['_' . $this::$plugin->p('post_type') . '_product'] );
    922 
    923         $category = intval( $_POST['_' . $this::$plugin->p('post_type') . '_categories'] );
    924 
    925         if($author_name) update_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_author_name', $author_name );
    926 
    927         if($author_email) update_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_author_email', $author_email );
     917        $author_name = sanitize_text_field( $_POST['_' . self::$plugin->p('post_type') . '_author_name'] );
     918
     919        $author_email = sanitize_text_field( $_POST['_' . self::$plugin->p('post_type') . '_author_email'] );
     920
     921        $product = sanitize_text_field( $_POST['_' . self::$plugin->p('post_type') . '_product'] );
     922
     923        $category = intval( $_POST['_' . self::$plugin->p('post_type') . '_categories'] );
     924
     925        if($author_name) update_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_author_name', $author_name );
     926
     927        if($author_email) update_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_author_email', $author_email );
    928928
    929929        if( isset( $product ) ) {
     
    931931           
    932932
    933             update_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_product', $product );
     933            update_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_product', $product );
    934934
    935935        }
     
    939939           
    940940
    941             delete_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_product' );
    942 
    943         }
    944 
    945         if( isset( $category ) && $category >= 0) update_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_categories', $category );
     941            delete_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_product' );
     942
     943        }
     944
     945        if( isset( $category ) && $category >= 0) update_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_categories', $category );
    946946
    947947    }
     
    958958        remove_filter( 'gettext', array( $this, 'filter_gettext' ), 10, 3 );
    959959
    960         if( ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] == $this::$plugin->p('post_type') ) || ( isset($_REQUEST['post']) && get_post_type( $_REQUEST['post'] ) == $this::$plugin->p('post_type') ) ) {
     960        if( ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] == self::$plugin->p('post_type') ) || ( isset($_REQUEST['post']) && get_post_type( $_REQUEST['post'] ) == self::$plugin->p('post_type') ) ) {
    961961
    962962            $strings = array(
  • woocommerce-product-faqs/tags/2.0.2/admin/views/admin-class.php

    r886901 r889445  
    4646    public function __construct() {
    4747
    48         $this::$plugin = WooCommerce_FAQs_Admin::get_instance();
     48        self::$plugin = WooCommerce_FAQs_Admin::get_instance();
    4949
    5050        $this->id    = 'faqs';
     
    6363    public function get_settings() {
    6464
    65         return $this::$plugin->get_settings();
     65        return self::$plugin->get_settings();
    6666
    6767    }
  • woocommerce-product-faqs/tags/2.0.2/public/class-woocommerce-product-faqs.php

    r888841 r889445  
    3131     * @var     string
    3232     */
    33     const VERSION = '2.0.1';
     33    const VERSION = '2.0.2';
    3434
    3535    /**
  • woocommerce-product-faqs/tags/2.0.2/woocommerce-faqs.php

    r888841 r889445  
    1616 * Plugin URI:        http://redactweb.com/woocommerce-faqs
    1717 * Description:       Enables your WooComerce powered site to utilize a FAQ
    18  * Version:           2.0.1
     18 * Version:           2.0.2
    1919 * Author:            Josh Levinson
    2020 * Author URI:        http://joshlevinson.me
  • woocommerce-product-faqs/trunk/README.txt

    r888839 r889445  
    55Requires at least: 3.5.1
    66Tested up to: 3.7
    7 Stable tag: 2.0.1
     7Stable tag: 2.0.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • woocommerce-product-faqs/trunk/admin/class-woocommerce-product-faqs-admin.php

    r886901 r889445  
    6969        */
    7070
    71         $this::$plugin = WooCommerce_FAQs::get_instance();
    72 
    73         $this->plugin_slug = $this::$plugin->p('plugin_slug');
     71        self::$plugin = WooCommerce_FAQs::get_instance();
     72
     73        $this->plugin_slug = self::$plugin->p('plugin_slug');
    7474
    7575        //load upgrade functions
     
    9797        //custom post table columns
    9898
    99         add_filter( 'manage_edit-'.$this::$plugin->p('post_type').'_columns', array( $this, 'set_custom_edit_columns' ) );
     99        add_filter( 'manage_edit-'.self::$plugin->p('post_type').'_columns', array( $this, 'set_custom_edit_columns' ) );
    100100
    101101       
     
    103103        //custom post table columns content
    104104
    105         add_action( 'manage_'.$this::$plugin->p('post_type').'_posts_custom_column' , array( $this, 'custom_column' ), 1, 2 );
     105        add_action( 'manage_'.self::$plugin->p('post_type').'_posts_custom_column' , array( $this, 'custom_column' ), 1, 2 );
    106106
    107107        //meta boxes
     
    175175    function upgrade_actions() {
    176176
    177         $current_version = get_option( $this::$plugin->p('option_prefix') . 'plugin_version', '1.0.9' );
    178 
    179         if($current_version != $this::$plugin->get_version() ) {
     177        $current_version = get_option( self::$plugin->p('option_prefix') . 'plugin_version', '1.0.9' );
     178
     179        if($current_version != self::$plugin->get_version() ) {
    180180
    181181            switch ($current_version) {
     
    187187                    global $wpdb;
    188188
    189                     $wpdb->update($table = $wpdb->posts, $data = array('comment_status'=>'open'), $where = array( 'post_type'=>$this::$plugin->p('post_type') ), $format = array('%s'), $where_format = array('%s') );
     189                    $wpdb->update($table = $wpdb->posts, $data = array('comment_status'=>'open'), $where = array( 'post_type'=>self::$plugin->p('post_type') ), $format = array('%s'), $where_format = array('%s') );
    190190
    191191                    break;
     
    193193            }
    194194
    195             update_option( $this::$plugin->p('option_prefix') . 'plugin_version', $this::$plugin->get_version() );
     195            update_option( self::$plugin->p('option_prefix') . 'plugin_version', self::$plugin->get_version() );
    196196
    197197        }
     
    212212        $screen = get_current_screen();
    213213
    214         if ( $screen->id == $this::$plugin->p('plugin_screen_hook_suffix') ) {
    215 
    216             wp_enqueue_style( $this->plugin_slug .'-admin-styles', plugins_url( '/assets/css/admin.css', __FILE__ ), array(), $this::$plugin->get_version() );
     214        if ( $screen->id == self::$plugin->p('plugin_screen_hook_suffix') ) {
     215
     216            wp_enqueue_style( $this->plugin_slug .'-admin-styles', plugins_url( '/assets/css/admin.css', __FILE__ ), array(), self::$plugin->get_version() );
    217217
    218218        }
     
    230230        echo '<style type="text/css" media="screen">
    231231
    232             #menu-posts-' . $this::$plugin->p('post_type') . ' .wp-menu-image {
     232            #menu-posts-' . self::$plugin->p('post_type') . ' .wp-menu-image {
    233233
    234234                background: url(' . plugins_url( '/assets/images/icon.png', __FILE__ ) . ') no-repeat 0 -32px !important;
     
    236236            }
    237237
    238         #menu-posts-' . $this::$plugin->p('post_type') . ':hover .wp-menu-image, #menu-posts-' . $this::$plugin->p('post_type') . '.wp-has-current-submenu .wp-menu-image {
     238        #menu-posts-' . self::$plugin->p('post_type') . ':hover .wp-menu-image, #menu-posts-' . self::$plugin->p('post_type') . '.wp-has-current-submenu .wp-menu-image {
    239239
    240240                background-position:0 0 !important;
     
    242242            }
    243243
    244         #icon-edit.icon32-posts-' . $this::$plugin->p('post_type') . ' {background: url(' . plugins_url( '/assets/images/full-32x32.png', __FILE__ ) . ') no-repeat 0px 0px !important;}
     244        #icon-edit.icon32-posts-' . self::$plugin->p('post_type') . ' {background: url(' . plugins_url( '/assets/images/full-32x32.png', __FILE__ ) . ') no-repeat 0px 0px !important;}
    245245
    246246        </style>';
     
    260260        //we need to load this script on the edit page for our post type
    261261
    262         if ( $screen->id == 'edit-' . $this::$plugin->p('post_type') ) {
    263 
    264             wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( '/assets/js/admin.js', __FILE__ ), array( 'jquery' ), $this::$plugin->get_version() );
     262        if ( $screen->id == 'edit-' . self::$plugin->p('post_type') ) {
     263
     264            wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( '/assets/js/admin.js', __FILE__ ), array( 'jquery' ), self::$plugin->get_version() );
    265265
    266266            $localize = array(
     
    280280                //and localize the color with a filter, so it can be changed either by user or maybe later as a settings option
    281281
    282                 $localize['faq_highlight_color'] = apply_filters( $this::$plugin->p('option_prefix') . 'admin_faq_highlight_color', '#9ED1D6' );
     282                $localize['faq_highlight_color'] = apply_filters( self::$plugin->p('option_prefix') . 'admin_faq_highlight_color', '#9ED1D6' );
    283283
    284284            }
    285285
    286             wp_localize_script( $this->plugin_slug . '-admin-script', $this::$plugin->p('option_prefix') . 'data', $localize );
     286            wp_localize_script( $this->plugin_slug . '-admin-script', self::$plugin->p('option_prefix') . 'data', $localize );
    287287
    288288        }
     
    323323        //check for our post type
    324324
    325         if ( $post->post_type == $this::$plugin->p('post_type') ) {
     325        if ( $post->post_type == self::$plugin->p('post_type') ) {
    326326
    327327            $post_type_object = get_post_type_object( $post->post_type );
     
    364364        global $post;
    365365
    366         if( $post->post_type == $this::$plugin->p('post_type') ) {
    367 
    368             $preview_link = get_permalink( (int)get_post_meta( $post->ID, '_' . $this::$plugin->p('post_type') . '_product', true ) );
     366        if( $post->post_type == self::$plugin->p('post_type') ) {
     367
     368            $preview_link = get_permalink( (int)get_post_meta( $post->ID, '_' . self::$plugin->p('post_type') . '_product', true ) );
    369369
    370370            $publish = ( $post->post_status == 'publish' ? 'view' : 'preview' );
     
    452452        }
    453453
    454         $publisher = get_option( $this::$plugin->p('option_prefix') . 'publisher_key' );
    455 
    456         $scoring = get_option( $this::$plugin->p('option_prefix') . 'scoring_key' );
     454        $publisher = get_option( self::$plugin->p('option_prefix') . 'publisher_key' );
     455
     456        $scoring = get_option( self::$plugin->p('option_prefix') . 'scoring_key' );
    457457
    458458        return array(
     
    464464                    'type'      => 'title',
    465465
    466                     'id'        => $this::$plugin->p('option_prefix') . 'general',
     466                    'id'        => self::$plugin->p('option_prefix') . 'general',
    467467
    468468                    'desc'      => ''
     
    474474                    $title      => __('Expand FAQ content by default', $this->plugin_slug ),
    475475
    476                     'id'        => $this::$plugin->p('option_prefix') . 'expand_faqs',
     476                    'id'        => self::$plugin->p('option_prefix') . 'expand_faqs',
    477477
    478478                    'type'      => 'checkbox',
     
    490490                    $title      => __('Disable asking functionality', $this->plugin_slug ),
    491491
    492                     'id'        => $this::$plugin->p('option_prefix') . 'disable_ask',
     492                    'id'        => self::$plugin->p('option_prefix') . 'disable_ask',
    493493
    494494                    'type'      => 'checkbox',
     
    506506                    $title      => __('FAQ notification email address', $this->plugin_slug ),
    507507
    508                     'id'        => $this::$plugin->p('option_prefix') . 'answerer_email',
     508                    'id'        => self::$plugin->p('option_prefix') . 'answerer_email',
    509509
    510510                    'type'      => 'text',
     
    520520                    $title      => __('FAQ notification from name', $this->plugin_slug ),
    521521
    522                     'id'        => $this::$plugin->p('option_prefix') . 'from_name',
     522                    'id'        => self::$plugin->p('option_prefix') . 'from_name',
    523523
    524524                    'type'      => 'text',
     
    534534                    'type'      => 'sectionend',
    535535
    536                     'id'        => $this::$plugin->p('option_prefix') . 'general'
     536                    'id'        => self::$plugin->p('option_prefix') . 'general'
    537537
    538538                ),
     
    544544                    'type'      => 'title',
    545545
    546                     'id'        => $this::$plugin->p('option_prefix') . 'antispam',
     546                    'id'        => self::$plugin->p('option_prefix') . 'antispam',
    547547
    548548                    'desc'      => __('Please choose your Anti-Spam settings.' .
     
    560560                    $title      => __('Use Are You A Human antispam?', $this->plugin_slug ),
    561561
    562                     'id'        => $this::$plugin->p('option_prefix') . 'use_antispam',
     562                    'id'        => self::$plugin->p('option_prefix') . 'use_antispam',
    563563
    564564                    'type'      => 'checkbox',
     
    572572                    $title      => __('Publisher Key', $this->plugin_slug ),
    573573
    574                     'id'        => $this::$plugin->p('option_prefix') . 'publisher_key',
     574                    'id'        => self::$plugin->p('option_prefix') . 'publisher_key',
    575575
    576576                    'type'      => 'text',
     
    584584                    $title      => __('Public/Scoring Key', $this->plugin_slug ),
    585585
    586                     'id'        => $this::$plugin->p('option_prefix') . 'scoring_key',
     586                    'id'        => self::$plugin->p('option_prefix') . 'scoring_key',
    587587
    588588                    'type'      => 'text',
     
    596596                    'type'      => 'sectionend',
    597597
    598                     'id'        => $this::$plugin->p('option_prefix') . 'antispam'
     598                    'id'        => self::$plugin->p('option_prefix') . 'antispam'
    599599
    600600                ),
     
    606606                    'type'      => 'title',
    607607
    608                     'id'        => $this::$plugin->p('option_prefix') . 'tab_settings'
     608                    'id'        => self::$plugin->p('option_prefix') . 'tab_settings'
    609609
    610610                ),
     
    614614                    $title      => __('Tab Title', $this->plugin_slug ),
    615615
    616                     'id'        => $this::$plugin->p('option_prefix') . 'tab_title',
     616                    'id'        => self::$plugin->p('option_prefix') . 'tab_title',
    617617
    618618                    'type'      => 'text'
     
    624624                    $title      => __('Tab Priority', $this->plugin_slug ),
    625625
    626                     'id'        => $this::$plugin->p('option_prefix') . 'tab_priority',
     626                    'id'        => self::$plugin->p('option_prefix') . 'tab_priority',
    627627
    628628                    'type'      => 'text'
     
    634634                    'type'      => 'sectionend',
    635635
    636                     'id'        => $this::$plugin->p('option_prefix') . 'tab_settings'
     636                    'id'        => self::$plugin->p('option_prefix') . 'tab_settings'
    637637
    638638                ),
     
    650650    function update_old_wc_options() {
    651651
    652         update_option( $this::$plugin->p('option_prefix') . 'publisher_key', sanitize_text_field( $_POST[$this::$plugin->p('option_prefix') . 'publisher_key'] ) );
    653 
    654         update_option( $this::$plugin->p('option_prefix') . 'faqs_scoring_key', sanitize_text_field( $_POST[$this::$plugin->p('option_prefix') . 'scoring_key'] ) );
    655 
    656         $use_antispam = ( sanitize_text_field( $_POST[$this::$plugin->p('option_prefix') . 'use_antispam'] ) == 1 ? 'yes' : 'no');
    657 
    658         update_option( $this::$plugin->p('option_prefix') . 'use_antispam', $use_antispam );
    659 
    660         update_option( $this::$plugin->p('option_prefix') . 'tab_title', sanitize_text_field( $_POST[$this::$plugin->p('option_prefix') . 'tab_title'] ) );
    661 
    662         update_option( $this::$plugin->p('option_prefix') . 'tab_priority', sanitize_text_field( $_POST[$this::$plugin->p('option_prefix') . 'tab_priority'] ) );
     652        update_option( self::$plugin->p('option_prefix') . 'publisher_key', sanitize_text_field( $_POST[self::$plugin->p('option_prefix') . 'publisher_key'] ) );
     653
     654        update_option( self::$plugin->p('option_prefix') . 'faqs_scoring_key', sanitize_text_field( $_POST[self::$plugin->p('option_prefix') . 'scoring_key'] ) );
     655
     656        $use_antispam = ( sanitize_text_field( $_POST[self::$plugin->p('option_prefix') . 'use_antispam'] ) == 1 ? 'yes' : 'no');
     657
     658        update_option( self::$plugin->p('option_prefix') . 'use_antispam', $use_antispam );
     659
     660        update_option( self::$plugin->p('option_prefix') . 'tab_title', sanitize_text_field( $_POST[self::$plugin->p('option_prefix') . 'tab_title'] ) );
     661
     662        update_option( self::$plugin->p('option_prefix') . 'tab_priority', sanitize_text_field( $_POST[self::$plugin->p('option_prefix') . 'tab_priority'] ) );
    663663
    664664    }
     
    704704            case 'asker' :
    705705
    706                 echo get_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_author_name', true );
     706                echo get_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_author_name', true );
    707707
    708708                break;
     
    710710            case 'asker_email' :
    711711
    712                 echo get_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_author_email', true );
     712                echo get_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_author_email', true );
    713713
    714714                break;
     
    726726    function meta_boxes() {
    727727
    728         add_meta_box( $this::$plugin->p('post_type') . '_product', __( 'FAQ Details', $this->plugin_slug ), array( $this, 'metabox' ), $this::$plugin->p('post_type'), 'normal', 'high' );
     728        add_meta_box( self::$plugin->p('post_type') . '_product', __( 'FAQ Details', $this->plugin_slug ), array( $this, 'metabox' ), self::$plugin->p('post_type'), 'normal', 'high' );
    729729
    730730    }
     
    740740        //get current value
    741741
    742         $current_product = get_post_meta( $post->ID, '_' . $this::$plugin->p('post_type') . '_product', true );
     742        $current_product = get_post_meta( $post->ID, '_' . self::$plugin->p('post_type') . '_product', true );
    743743
    744744        //get current value
    745745
    746         $category = get_post_meta( $post->ID, '_' . $this::$plugin->p('post_type') . '_categories', true );
    747 
    748         $author_name = get_post_meta( $post->ID, '_' . $this::$plugin->p('post_type') . '_author_name', true );
    749 
    750         $author_email = get_post_meta( $post->ID, '_' . $this::$plugin->p('post_type') . '_author_email', true );
     746        $category = get_post_meta( $post->ID, '_' . self::$plugin->p('post_type') . '_categories', true );
     747
     748        $author_name = get_post_meta( $post->ID, '_' . self::$plugin->p('post_type') . '_author_name', true );
     749
     750        $author_email = get_post_meta( $post->ID, '_' . self::$plugin->p('post_type') . '_author_email', true );
    751751
    752752        //nonce
    753753
    754         wp_nonce_field( plugin_basename( __FILE__ ), $this::$plugin->p('post_type') . 'meta_nonce' );
     754        wp_nonce_field( plugin_basename( __FILE__ ), self::$plugin->p('post_type') . 'meta_nonce' );
    755755
    756756        //get all products
     
    770770            //Product relationship label
    771771
    772             echo '<p><label for="_' . '_' . $this::$plugin->p('post_type') . '_product">';
     772            echo '<p><label for="_' . '_' . self::$plugin->p('post_type') . '_product">';
    773773
    774774            _e( 'Product this question is shown on.', $this->plugin_slug );
     
    778778            //Product relationship select
    779779
    780             echo '<p><select name="' . '_' . $this::$plugin->p('post_type') . '_product">';
     780            echo '<p><select name="' . '_' . self::$plugin->p('post_type') . '_product">';
    781781
    782782            echo '<option ' . selected( $current_product, '0', false ) . ' value="0">' . __( 'No product selection (use category only)', $this->plugin_slug ) . '</option>';
     
    808808        //Product relationship label
    809809
    810             echo '<p><label for="_' . '_' . $this::$plugin->p('post_type') . '_categories">';
     810            echo '<p><label for="_' . '_' . self::$plugin->p('post_type') . '_categories">';
    811811
    812812            _e( 'Categories this question is shown on.', $this->plugin_slug );
     
    838838                'hierarchical'       => 0,
    839839
    840                 'name'               => '_' . $this::$plugin->p('post_type') . '_categories',
    841 
    842                 'id'                 => '_' . $this::$plugin->p('post_type') . '_categories',
     840                'name'               => '_' . self::$plugin->p('post_type') . '_categories',
     841
     842                'id'                 => '_' . self::$plugin->p('post_type') . '_categories',
    843843
    844844                'class'              => 'postform',
     
    870870        //author's name
    871871
    872         echo '<p><label for="_' . $this::$plugin->p('post_type') . '_author_name">';
     872        echo '<p><label for="_' . self::$plugin->p('post_type') . '_author_name">';
    873873
    874874        _e('Author: ', $this->plugin_slug );
     
    876876        echo '</label>';
    877877
    878         echo '<input type="text" name="_' . $this::$plugin->p('post_type') . '_author_name" value="' . $author_name . '"/></p>';
     878        echo '<input type="text" name="_' . self::$plugin->p('post_type') . '_author_name" value="' . $author_name . '"/></p>';
    879879
    880880        //author's email
    881881
    882         echo '<p><label for="_' . $this::$plugin->p('post_type') . '_author_email">';
     882        echo '<p><label for="_' . self::$plugin->p('post_type') . '_author_email">';
    883883
    884884        _e('Author Email: ', $this->plugin_slug );
     
    886886        echo '</label>';
    887887
    888         echo '<input type="email" name="_' . $this::$plugin->p('post_type') . '_author_email" value="' . $author_email . '"/></p>';
     888        echo '<input type="email" name="_' . self::$plugin->p('post_type') . '_author_email" value="' . $author_email . '"/></p>';
    889889
    890890    }
     
    909909        // Secondly we need to check if the user intended to change this value.
    910910
    911         if ( ! isset( $_POST[$this::$plugin->p('post_type') . 'meta_nonce'] ) || ! wp_verify_nonce( $_POST[$this::$plugin->p('post_type') . 'meta_nonce'], plugin_basename( __FILE__ ) ) ) {
     911        if ( ! isset( $_POST[self::$plugin->p('post_type') . 'meta_nonce'] ) || ! wp_verify_nonce( $_POST[self::$plugin->p('post_type') . 'meta_nonce'], plugin_basename( __FILE__ ) ) ) {
    912912
    913913            return;
     
    915915        }
    916916
    917         $author_name = sanitize_text_field( $_POST['_' . $this::$plugin->p('post_type') . '_author_name'] );
    918 
    919         $author_email = sanitize_text_field( $_POST['_' . $this::$plugin->p('post_type') . '_author_email'] );
    920 
    921         $product = sanitize_text_field( $_POST['_' . $this::$plugin->p('post_type') . '_product'] );
    922 
    923         $category = intval( $_POST['_' . $this::$plugin->p('post_type') . '_categories'] );
    924 
    925         if($author_name) update_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_author_name', $author_name );
    926 
    927         if($author_email) update_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_author_email', $author_email );
     917        $author_name = sanitize_text_field( $_POST['_' . self::$plugin->p('post_type') . '_author_name'] );
     918
     919        $author_email = sanitize_text_field( $_POST['_' . self::$plugin->p('post_type') . '_author_email'] );
     920
     921        $product = sanitize_text_field( $_POST['_' . self::$plugin->p('post_type') . '_product'] );
     922
     923        $category = intval( $_POST['_' . self::$plugin->p('post_type') . '_categories'] );
     924
     925        if($author_name) update_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_author_name', $author_name );
     926
     927        if($author_email) update_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_author_email', $author_email );
    928928
    929929        if( isset( $product ) ) {
     
    931931           
    932932
    933             update_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_product', $product );
     933            update_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_product', $product );
    934934
    935935        }
     
    939939           
    940940
    941             delete_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_product' );
    942 
    943         }
    944 
    945         if( isset( $category ) && $category >= 0) update_post_meta( $post_id, '_' . $this::$plugin->p('post_type') . '_categories', $category );
     941            delete_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_product' );
     942
     943        }
     944
     945        if( isset( $category ) && $category >= 0) update_post_meta( $post_id, '_' . self::$plugin->p('post_type') . '_categories', $category );
    946946
    947947    }
     
    958958        remove_filter( 'gettext', array( $this, 'filter_gettext' ), 10, 3 );
    959959
    960         if( ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] == $this::$plugin->p('post_type') ) || ( isset($_REQUEST['post']) && get_post_type( $_REQUEST['post'] ) == $this::$plugin->p('post_type') ) ) {
     960        if( ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] == self::$plugin->p('post_type') ) || ( isset($_REQUEST['post']) && get_post_type( $_REQUEST['post'] ) == self::$plugin->p('post_type') ) ) {
    961961
    962962            $strings = array(
  • woocommerce-product-faqs/trunk/admin/views/admin-class.php

    r886901 r889445  
    4646    public function __construct() {
    4747
    48         $this::$plugin = WooCommerce_FAQs_Admin::get_instance();
     48        self::$plugin = WooCommerce_FAQs_Admin::get_instance();
    4949
    5050        $this->id    = 'faqs';
     
    6363    public function get_settings() {
    6464
    65         return $this::$plugin->get_settings();
     65        return self::$plugin->get_settings();
    6666
    6767    }
  • woocommerce-product-faqs/trunk/public/class-woocommerce-product-faqs.php

    r888841 r889445  
    3131     * @var     string
    3232     */
    33     const VERSION = '2.0.1';
     33    const VERSION = '2.0.2';
    3434
    3535    /**
  • woocommerce-product-faqs/trunk/woocommerce-faqs.php

    r888841 r889445  
    1616 * Plugin URI:        http://redactweb.com/woocommerce-faqs
    1717 * Description:       Enables your WooComerce powered site to utilize a FAQ
    18  * Version:           2.0.1
     18 * Version:           2.0.2
    1919 * Author:            Josh Levinson
    2020 * Author URI:        http://joshlevinson.me
Note: See TracChangeset for help on using the changeset viewer.