Changeset 889445
- Timestamp:
- 04/08/2014 03:08:22 PM (12 years ago)
- Location:
- woocommerce-product-faqs
- Files:
-
- 7 edited
- 4 copied
-
tags/2.0.2 (copied) (copied from woocommerce-product-faqs/trunk)
-
tags/2.0.2/README.txt (copied) (copied from woocommerce-product-faqs/trunk/README.txt) (1 diff)
-
tags/2.0.2/admin/class-woocommerce-product-faqs-admin.php (modified) (47 diffs)
-
tags/2.0.2/admin/views/admin-class.php (modified) (2 diffs)
-
tags/2.0.2/public/class-woocommerce-product-faqs.php (copied) (copied from woocommerce-product-faqs/trunk/public/class-woocommerce-product-faqs.php) (1 diff)
-
tags/2.0.2/woocommerce-faqs.php (copied) (copied from woocommerce-product-faqs/trunk/woocommerce-faqs.php) (1 diff)
-
trunk/README.txt (modified) (1 diff)
-
trunk/admin/class-woocommerce-product-faqs-admin.php (modified) (47 diffs)
-
trunk/admin/views/admin-class.php (modified) (2 diffs)
-
trunk/public/class-woocommerce-product-faqs.php (modified) (1 diff)
-
trunk/woocommerce-faqs.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
woocommerce-product-faqs/tags/2.0.2/README.txt
r888839 r889445 5 5 Requires at least: 3.5.1 6 6 Tested up to: 3.7 7 Stable tag: 2.0. 17 Stable tag: 2.0.2 8 8 License: GPLv2 or later 9 9 License 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 69 69 */ 70 70 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'); 74 74 75 75 //load upgrade functions … … 97 97 //custom post table columns 98 98 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' ) ); 100 100 101 101 … … 103 103 //custom post table columns content 104 104 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 ); 106 106 107 107 //meta boxes … … 175 175 function upgrade_actions() { 176 176 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() ) { 180 180 181 181 switch ($current_version) { … … 187 187 global $wpdb; 188 188 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') ); 190 190 191 191 break; … … 193 193 } 194 194 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() ); 196 196 197 197 } … … 212 212 $screen = get_current_screen(); 213 213 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() ); 217 217 218 218 } … … 230 230 echo '<style type="text/css" media="screen"> 231 231 232 #menu-posts-' . $this::$plugin->p('post_type') . ' .wp-menu-image {232 #menu-posts-' . self::$plugin->p('post_type') . ' .wp-menu-image { 233 233 234 234 background: url(' . plugins_url( '/assets/images/icon.png', __FILE__ ) . ') no-repeat 0 -32px !important; … … 236 236 } 237 237 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 { 239 239 240 240 background-position:0 0 !important; … … 242 242 } 243 243 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;} 245 245 246 246 </style>'; … … 260 260 //we need to load this script on the edit page for our post type 261 261 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() ); 265 265 266 266 $localize = array( … … 280 280 //and localize the color with a filter, so it can be changed either by user or maybe later as a settings option 281 281 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' ); 283 283 284 284 } 285 285 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 ); 287 287 288 288 } … … 323 323 //check for our post type 324 324 325 if ( $post->post_type == $this::$plugin->p('post_type') ) {325 if ( $post->post_type == self::$plugin->p('post_type') ) { 326 326 327 327 $post_type_object = get_post_type_object( $post->post_type ); … … 364 364 global $post; 365 365 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 ) ); 369 369 370 370 $publish = ( $post->post_status == 'publish' ? 'view' : 'preview' ); … … 452 452 } 453 453 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' ); 457 457 458 458 return array( … … 464 464 'type' => 'title', 465 465 466 'id' => $this::$plugin->p('option_prefix') . 'general',466 'id' => self::$plugin->p('option_prefix') . 'general', 467 467 468 468 'desc' => '' … … 474 474 $title => __('Expand FAQ content by default', $this->plugin_slug ), 475 475 476 'id' => $this::$plugin->p('option_prefix') . 'expand_faqs',476 'id' => self::$plugin->p('option_prefix') . 'expand_faqs', 477 477 478 478 'type' => 'checkbox', … … 490 490 $title => __('Disable asking functionality', $this->plugin_slug ), 491 491 492 'id' => $this::$plugin->p('option_prefix') . 'disable_ask',492 'id' => self::$plugin->p('option_prefix') . 'disable_ask', 493 493 494 494 'type' => 'checkbox', … … 506 506 $title => __('FAQ notification email address', $this->plugin_slug ), 507 507 508 'id' => $this::$plugin->p('option_prefix') . 'answerer_email',508 'id' => self::$plugin->p('option_prefix') . 'answerer_email', 509 509 510 510 'type' => 'text', … … 520 520 $title => __('FAQ notification from name', $this->plugin_slug ), 521 521 522 'id' => $this::$plugin->p('option_prefix') . 'from_name',522 'id' => self::$plugin->p('option_prefix') . 'from_name', 523 523 524 524 'type' => 'text', … … 534 534 'type' => 'sectionend', 535 535 536 'id' => $this::$plugin->p('option_prefix') . 'general'536 'id' => self::$plugin->p('option_prefix') . 'general' 537 537 538 538 ), … … 544 544 'type' => 'title', 545 545 546 'id' => $this::$plugin->p('option_prefix') . 'antispam',546 'id' => self::$plugin->p('option_prefix') . 'antispam', 547 547 548 548 'desc' => __('Please choose your Anti-Spam settings.' . … … 560 560 $title => __('Use Are You A Human antispam?', $this->plugin_slug ), 561 561 562 'id' => $this::$plugin->p('option_prefix') . 'use_antispam',562 'id' => self::$plugin->p('option_prefix') . 'use_antispam', 563 563 564 564 'type' => 'checkbox', … … 572 572 $title => __('Publisher Key', $this->plugin_slug ), 573 573 574 'id' => $this::$plugin->p('option_prefix') . 'publisher_key',574 'id' => self::$plugin->p('option_prefix') . 'publisher_key', 575 575 576 576 'type' => 'text', … … 584 584 $title => __('Public/Scoring Key', $this->plugin_slug ), 585 585 586 'id' => $this::$plugin->p('option_prefix') . 'scoring_key',586 'id' => self::$plugin->p('option_prefix') . 'scoring_key', 587 587 588 588 'type' => 'text', … … 596 596 'type' => 'sectionend', 597 597 598 'id' => $this::$plugin->p('option_prefix') . 'antispam'598 'id' => self::$plugin->p('option_prefix') . 'antispam' 599 599 600 600 ), … … 606 606 'type' => 'title', 607 607 608 'id' => $this::$plugin->p('option_prefix') . 'tab_settings'608 'id' => self::$plugin->p('option_prefix') . 'tab_settings' 609 609 610 610 ), … … 614 614 $title => __('Tab Title', $this->plugin_slug ), 615 615 616 'id' => $this::$plugin->p('option_prefix') . 'tab_title',616 'id' => self::$plugin->p('option_prefix') . 'tab_title', 617 617 618 618 'type' => 'text' … … 624 624 $title => __('Tab Priority', $this->plugin_slug ), 625 625 626 'id' => $this::$plugin->p('option_prefix') . 'tab_priority',626 'id' => self::$plugin->p('option_prefix') . 'tab_priority', 627 627 628 628 'type' => 'text' … … 634 634 'type' => 'sectionend', 635 635 636 'id' => $this::$plugin->p('option_prefix') . 'tab_settings'636 'id' => self::$plugin->p('option_prefix') . 'tab_settings' 637 637 638 638 ), … … 650 650 function update_old_wc_options() { 651 651 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'] ) ); 663 663 664 664 } … … 704 704 case 'asker' : 705 705 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 ); 707 707 708 708 break; … … 710 710 case 'asker_email' : 711 711 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 ); 713 713 714 714 break; … … 726 726 function meta_boxes() { 727 727 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' ); 729 729 730 730 } … … 740 740 //get current value 741 741 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 ); 743 743 744 744 //get current value 745 745 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 ); 751 751 752 752 //nonce 753 753 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' ); 755 755 756 756 //get all products … … 770 770 //Product relationship label 771 771 772 echo '<p><label for="_' . '_' . $this::$plugin->p('post_type') . '_product">';772 echo '<p><label for="_' . '_' . self::$plugin->p('post_type') . '_product">'; 773 773 774 774 _e( 'Product this question is shown on.', $this->plugin_slug ); … … 778 778 //Product relationship select 779 779 780 echo '<p><select name="' . '_' . $this::$plugin->p('post_type') . '_product">';780 echo '<p><select name="' . '_' . self::$plugin->p('post_type') . '_product">'; 781 781 782 782 echo '<option ' . selected( $current_product, '0', false ) . ' value="0">' . __( 'No product selection (use category only)', $this->plugin_slug ) . '</option>'; … … 808 808 //Product relationship label 809 809 810 echo '<p><label for="_' . '_' . $this::$plugin->p('post_type') . '_categories">';810 echo '<p><label for="_' . '_' . self::$plugin->p('post_type') . '_categories">'; 811 811 812 812 _e( 'Categories this question is shown on.', $this->plugin_slug ); … … 838 838 'hierarchical' => 0, 839 839 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', 843 843 844 844 'class' => 'postform', … … 870 870 //author's name 871 871 872 echo '<p><label for="_' . $this::$plugin->p('post_type') . '_author_name">';872 echo '<p><label for="_' . self::$plugin->p('post_type') . '_author_name">'; 873 873 874 874 _e('Author: ', $this->plugin_slug ); … … 876 876 echo '</label>'; 877 877 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>'; 879 879 880 880 //author's email 881 881 882 echo '<p><label for="_' . $this::$plugin->p('post_type') . '_author_email">';882 echo '<p><label for="_' . self::$plugin->p('post_type') . '_author_email">'; 883 883 884 884 _e('Author Email: ', $this->plugin_slug ); … … 886 886 echo '</label>'; 887 887 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>'; 889 889 890 890 } … … 909 909 // Secondly we need to check if the user intended to change this value. 910 910 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__ ) ) ) { 912 912 913 913 return; … … 915 915 } 916 916 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 ); 928 928 929 929 if( isset( $product ) ) { … … 931 931 932 932 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 ); 934 934 935 935 } … … 939 939 940 940 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 ); 946 946 947 947 } … … 958 958 remove_filter( 'gettext', array( $this, 'filter_gettext' ), 10, 3 ); 959 959 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') ) ) { 961 961 962 962 $strings = array( -
woocommerce-product-faqs/tags/2.0.2/admin/views/admin-class.php
r886901 r889445 46 46 public function __construct() { 47 47 48 $this::$plugin = WooCommerce_FAQs_Admin::get_instance();48 self::$plugin = WooCommerce_FAQs_Admin::get_instance(); 49 49 50 50 $this->id = 'faqs'; … … 63 63 public function get_settings() { 64 64 65 return $this::$plugin->get_settings();65 return self::$plugin->get_settings(); 66 66 67 67 } -
woocommerce-product-faqs/tags/2.0.2/public/class-woocommerce-product-faqs.php
r888841 r889445 31 31 * @var string 32 32 */ 33 const VERSION = '2.0. 1';33 const VERSION = '2.0.2'; 34 34 35 35 /** -
woocommerce-product-faqs/tags/2.0.2/woocommerce-faqs.php
r888841 r889445 16 16 * Plugin URI: http://redactweb.com/woocommerce-faqs 17 17 * Description: Enables your WooComerce powered site to utilize a FAQ 18 * Version: 2.0. 118 * Version: 2.0.2 19 19 * Author: Josh Levinson 20 20 * Author URI: http://joshlevinson.me -
woocommerce-product-faqs/trunk/README.txt
r888839 r889445 5 5 Requires at least: 3.5.1 6 6 Tested up to: 3.7 7 Stable tag: 2.0. 17 Stable tag: 2.0.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
woocommerce-product-faqs/trunk/admin/class-woocommerce-product-faqs-admin.php
r886901 r889445 69 69 */ 70 70 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'); 74 74 75 75 //load upgrade functions … … 97 97 //custom post table columns 98 98 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' ) ); 100 100 101 101 … … 103 103 //custom post table columns content 104 104 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 ); 106 106 107 107 //meta boxes … … 175 175 function upgrade_actions() { 176 176 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() ) { 180 180 181 181 switch ($current_version) { … … 187 187 global $wpdb; 188 188 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') ); 190 190 191 191 break; … … 193 193 } 194 194 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() ); 196 196 197 197 } … … 212 212 $screen = get_current_screen(); 213 213 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() ); 217 217 218 218 } … … 230 230 echo '<style type="text/css" media="screen"> 231 231 232 #menu-posts-' . $this::$plugin->p('post_type') . ' .wp-menu-image {232 #menu-posts-' . self::$plugin->p('post_type') . ' .wp-menu-image { 233 233 234 234 background: url(' . plugins_url( '/assets/images/icon.png', __FILE__ ) . ') no-repeat 0 -32px !important; … … 236 236 } 237 237 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 { 239 239 240 240 background-position:0 0 !important; … … 242 242 } 243 243 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;} 245 245 246 246 </style>'; … … 260 260 //we need to load this script on the edit page for our post type 261 261 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() ); 265 265 266 266 $localize = array( … … 280 280 //and localize the color with a filter, so it can be changed either by user or maybe later as a settings option 281 281 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' ); 283 283 284 284 } 285 285 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 ); 287 287 288 288 } … … 323 323 //check for our post type 324 324 325 if ( $post->post_type == $this::$plugin->p('post_type') ) {325 if ( $post->post_type == self::$plugin->p('post_type') ) { 326 326 327 327 $post_type_object = get_post_type_object( $post->post_type ); … … 364 364 global $post; 365 365 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 ) ); 369 369 370 370 $publish = ( $post->post_status == 'publish' ? 'view' : 'preview' ); … … 452 452 } 453 453 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' ); 457 457 458 458 return array( … … 464 464 'type' => 'title', 465 465 466 'id' => $this::$plugin->p('option_prefix') . 'general',466 'id' => self::$plugin->p('option_prefix') . 'general', 467 467 468 468 'desc' => '' … … 474 474 $title => __('Expand FAQ content by default', $this->plugin_slug ), 475 475 476 'id' => $this::$plugin->p('option_prefix') . 'expand_faqs',476 'id' => self::$plugin->p('option_prefix') . 'expand_faqs', 477 477 478 478 'type' => 'checkbox', … … 490 490 $title => __('Disable asking functionality', $this->plugin_slug ), 491 491 492 'id' => $this::$plugin->p('option_prefix') . 'disable_ask',492 'id' => self::$plugin->p('option_prefix') . 'disable_ask', 493 493 494 494 'type' => 'checkbox', … … 506 506 $title => __('FAQ notification email address', $this->plugin_slug ), 507 507 508 'id' => $this::$plugin->p('option_prefix') . 'answerer_email',508 'id' => self::$plugin->p('option_prefix') . 'answerer_email', 509 509 510 510 'type' => 'text', … … 520 520 $title => __('FAQ notification from name', $this->plugin_slug ), 521 521 522 'id' => $this::$plugin->p('option_prefix') . 'from_name',522 'id' => self::$plugin->p('option_prefix') . 'from_name', 523 523 524 524 'type' => 'text', … … 534 534 'type' => 'sectionend', 535 535 536 'id' => $this::$plugin->p('option_prefix') . 'general'536 'id' => self::$plugin->p('option_prefix') . 'general' 537 537 538 538 ), … … 544 544 'type' => 'title', 545 545 546 'id' => $this::$plugin->p('option_prefix') . 'antispam',546 'id' => self::$plugin->p('option_prefix') . 'antispam', 547 547 548 548 'desc' => __('Please choose your Anti-Spam settings.' . … … 560 560 $title => __('Use Are You A Human antispam?', $this->plugin_slug ), 561 561 562 'id' => $this::$plugin->p('option_prefix') . 'use_antispam',562 'id' => self::$plugin->p('option_prefix') . 'use_antispam', 563 563 564 564 'type' => 'checkbox', … … 572 572 $title => __('Publisher Key', $this->plugin_slug ), 573 573 574 'id' => $this::$plugin->p('option_prefix') . 'publisher_key',574 'id' => self::$plugin->p('option_prefix') . 'publisher_key', 575 575 576 576 'type' => 'text', … … 584 584 $title => __('Public/Scoring Key', $this->plugin_slug ), 585 585 586 'id' => $this::$plugin->p('option_prefix') . 'scoring_key',586 'id' => self::$plugin->p('option_prefix') . 'scoring_key', 587 587 588 588 'type' => 'text', … … 596 596 'type' => 'sectionend', 597 597 598 'id' => $this::$plugin->p('option_prefix') . 'antispam'598 'id' => self::$plugin->p('option_prefix') . 'antispam' 599 599 600 600 ), … … 606 606 'type' => 'title', 607 607 608 'id' => $this::$plugin->p('option_prefix') . 'tab_settings'608 'id' => self::$plugin->p('option_prefix') . 'tab_settings' 609 609 610 610 ), … … 614 614 $title => __('Tab Title', $this->plugin_slug ), 615 615 616 'id' => $this::$plugin->p('option_prefix') . 'tab_title',616 'id' => self::$plugin->p('option_prefix') . 'tab_title', 617 617 618 618 'type' => 'text' … … 624 624 $title => __('Tab Priority', $this->plugin_slug ), 625 625 626 'id' => $this::$plugin->p('option_prefix') . 'tab_priority',626 'id' => self::$plugin->p('option_prefix') . 'tab_priority', 627 627 628 628 'type' => 'text' … … 634 634 'type' => 'sectionend', 635 635 636 'id' => $this::$plugin->p('option_prefix') . 'tab_settings'636 'id' => self::$plugin->p('option_prefix') . 'tab_settings' 637 637 638 638 ), … … 650 650 function update_old_wc_options() { 651 651 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'] ) ); 663 663 664 664 } … … 704 704 case 'asker' : 705 705 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 ); 707 707 708 708 break; … … 710 710 case 'asker_email' : 711 711 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 ); 713 713 714 714 break; … … 726 726 function meta_boxes() { 727 727 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' ); 729 729 730 730 } … … 740 740 //get current value 741 741 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 ); 743 743 744 744 //get current value 745 745 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 ); 751 751 752 752 //nonce 753 753 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' ); 755 755 756 756 //get all products … … 770 770 //Product relationship label 771 771 772 echo '<p><label for="_' . '_' . $this::$plugin->p('post_type') . '_product">';772 echo '<p><label for="_' . '_' . self::$plugin->p('post_type') . '_product">'; 773 773 774 774 _e( 'Product this question is shown on.', $this->plugin_slug ); … … 778 778 //Product relationship select 779 779 780 echo '<p><select name="' . '_' . $this::$plugin->p('post_type') . '_product">';780 echo '<p><select name="' . '_' . self::$plugin->p('post_type') . '_product">'; 781 781 782 782 echo '<option ' . selected( $current_product, '0', false ) . ' value="0">' . __( 'No product selection (use category only)', $this->plugin_slug ) . '</option>'; … … 808 808 //Product relationship label 809 809 810 echo '<p><label for="_' . '_' . $this::$plugin->p('post_type') . '_categories">';810 echo '<p><label for="_' . '_' . self::$plugin->p('post_type') . '_categories">'; 811 811 812 812 _e( 'Categories this question is shown on.', $this->plugin_slug ); … … 838 838 'hierarchical' => 0, 839 839 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', 843 843 844 844 'class' => 'postform', … … 870 870 //author's name 871 871 872 echo '<p><label for="_' . $this::$plugin->p('post_type') . '_author_name">';872 echo '<p><label for="_' . self::$plugin->p('post_type') . '_author_name">'; 873 873 874 874 _e('Author: ', $this->plugin_slug ); … … 876 876 echo '</label>'; 877 877 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>'; 879 879 880 880 //author's email 881 881 882 echo '<p><label for="_' . $this::$plugin->p('post_type') . '_author_email">';882 echo '<p><label for="_' . self::$plugin->p('post_type') . '_author_email">'; 883 883 884 884 _e('Author Email: ', $this->plugin_slug ); … … 886 886 echo '</label>'; 887 887 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>'; 889 889 890 890 } … … 909 909 // Secondly we need to check if the user intended to change this value. 910 910 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__ ) ) ) { 912 912 913 913 return; … … 915 915 } 916 916 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 ); 928 928 929 929 if( isset( $product ) ) { … … 931 931 932 932 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 ); 934 934 935 935 } … … 939 939 940 940 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 ); 946 946 947 947 } … … 958 958 remove_filter( 'gettext', array( $this, 'filter_gettext' ), 10, 3 ); 959 959 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') ) ) { 961 961 962 962 $strings = array( -
woocommerce-product-faqs/trunk/admin/views/admin-class.php
r886901 r889445 46 46 public function __construct() { 47 47 48 $this::$plugin = WooCommerce_FAQs_Admin::get_instance();48 self::$plugin = WooCommerce_FAQs_Admin::get_instance(); 49 49 50 50 $this->id = 'faqs'; … … 63 63 public function get_settings() { 64 64 65 return $this::$plugin->get_settings();65 return self::$plugin->get_settings(); 66 66 67 67 } -
woocommerce-product-faqs/trunk/public/class-woocommerce-product-faqs.php
r888841 r889445 31 31 * @var string 32 32 */ 33 const VERSION = '2.0. 1';33 const VERSION = '2.0.2'; 34 34 35 35 /** -
woocommerce-product-faqs/trunk/woocommerce-faqs.php
r888841 r889445 16 16 * Plugin URI: http://redactweb.com/woocommerce-faqs 17 17 * Description: Enables your WooComerce powered site to utilize a FAQ 18 * Version: 2.0. 118 * Version: 2.0.2 19 19 * Author: Josh Levinson 20 20 * Author URI: http://joshlevinson.me
Note: See TracChangeset
for help on using the changeset viewer.