diff --git a/README.md b/README.md index 1a42027..d042ee6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # woo-book-chapter-tab -Extends WooCommerce to allow you to display the Chapters and Sections of a book, ebook or documentation in a new tab on the single product page. +Extends WC to allow you to display the Chapters and Sections of a book, ebook or documentation in a new tab on the single product page. diff --git a/includes/class-woocommerce-book-chapter-tab-settings.php b/includes/class-ecommerce-book-chapter-tab-settings.php similarity index 84% rename from includes/class-woocommerce-book-chapter-tab-settings.php rename to includes/class-ecommerce-book-chapter-tab-settings.php index b6a2823..28f0111 100644 --- a/includes/class-woocommerce-book-chapter-tab-settings.php +++ b/includes/class-ecommerce-book-chapter-tab-settings.php @@ -2,10 +2,10 @@ if ( ! defined( 'ABSPATH' ) ) exit; -class WooCommerce_Book_Chapter_Tab_Settings { +class ECommerce_Book_Chapter_Tab_Settings { /** - * The single instance of WooCommerce_Book_Chapter_Tab_Settings. + * The single instance of ECommerce_Book_Chapter_Tab_Settings. * @var object * @access private * @since 1.0.0 @@ -53,7 +53,7 @@ public function __construct ( $parent ) { add_action( 'admin_menu' , array( $this, 'add_menu_items' ) ); // Add settings link to plugins page - add_filter( 'plugin_action_links_' . plugin_basename( $this->parent->file ) , array( $this, 'add_settings_link' ) ); + add_filter( 'plugin_action_links', array($this,'add_settings_link'),10,2); } /** @@ -84,7 +84,7 @@ public function add_setting_page() { add_menu_page( 'rew_plugin_panel', 'Code Market', 'nosuchcapability', 'rew_plugin_panel', NULL, $logo, $position ); } - add_submenu_page( 'rew_plugin_panel', 'Book Chapter Tab', 'Book Chapter Tab', 'manage_options', 'woocommerce-book-chapter-tab', array( $this, 'settings_page' ) ); + add_submenu_page( 'rew_plugin_panel', 'Book Chapter Tab', 'Book Chapter Tab', 'manage_options', 'ecommerce-book-chapter-tab', array( $this, 'settings_page' ) ); remove_submenu_page( 'rew_plugin_panel', 'rew_plugin_panel' ); } @@ -123,11 +123,16 @@ public function settings_assets () { * @param array $links Existing links * @return array Modified links */ - public function add_settings_link ( $links ) { + public function add_settings_link( $links, $file ) { - $settings_link = '' . __( 'Settings', 'woocommerce-book-chapter-tab' ) . ''; - array_push( $links, $settings_link ); - return $links; + if( strpos( $file, basename( $this->parent->file ) ) !== false ) { + + $settings_link = '' . __( 'Settings', 'ecommerce-book-chapter-tab' ) . ''; + + array_push( $links, $settings_link ); + } + + return $links; } /** @@ -151,13 +156,13 @@ public function register_settings () { $current_section = ''; if ( isset( $_POST['tab'] ) && $_POST['tab'] ) { - $current_section = $_POST['tab']; + $current_section = sanitize_text_field($_POST['tab']); } else { if ( isset( $_GET['tab'] ) && $_GET['tab'] ) { - $current_section = $_GET['tab']; + $current_section = sanitize_text_field($_GET['tab']); } } @@ -193,7 +198,7 @@ public function register_settings () { public function settings_section ( $section ) { $html = '

' . $this->settings[ $section['id'] ]['description'] . '

' . "\n"; - echo $html; + echo wp_kses_normalize_entities($html); } /** @@ -207,7 +212,7 @@ public function settings_page () { // Build page HTML $html = '
' . "\n"; - $html .= '

' . __( $plugin_data['Name'] , 'woocommerce-book-chapter-tab' ) . '

' . "\n"; + $html .= '

' . __( $plugin_data['Name'] , 'ecommerce-book-chapter-tab' ) . '

' . "\n"; $tab = ''; if ( isset( $_GET['tab'] ) && $_GET['tab'] ) { @@ -264,18 +269,18 @@ public function settings_page () { $html .= '
'; - echo $html; + echo wp_kses_normalize_entities($html); } /** - * Main WooCommerce_Book_Chapter_Tab_Settings Instance + * Main ECommerce_Book_Chapter_Tab_Settings Instance * - * Ensures only one instance of WooCommerce_Book_Chapter_Tab_Settings is loaded or can be loaded. + * Ensures only one instance of ECommerce_Book_Chapter_Tab_Settings is loaded or can be loaded. * * @since 1.0.0 * @static - * @see WooCommerce_Book_Chapter_Tab() - * @return Main WooCommerce_Book_Chapter_Tab_Settings instance + * @see ECommerce_Book_Chapter_Tab() + * @return Main ECommerce_Book_Chapter_Tab_Settings instance */ public static function instance ( $parent ) { if ( is_null( self::$_instance ) ) { diff --git a/includes/class-woocommerce-book-chapter-tab.php b/includes/class-ecommerce-book-chapter-tab.php similarity index 86% rename from includes/class-woocommerce-book-chapter-tab.php rename to includes/class-ecommerce-book-chapter-tab.php index 32594c6..9c1a395 100644 --- a/includes/class-woocommerce-book-chapter-tab.php +++ b/includes/class-ecommerce-book-chapter-tab.php @@ -2,10 +2,10 @@ if ( ! defined( 'ABSPATH' ) ) exit; -class WooCommerce_Book_Chapter_Tab { +class ECommerce_Book_Chapter_Tab { /** - * The single instance of WooCommerce_Book_Chapter_Tab. + * The single instance of ECommerce_Book_Chapter_Tab. * @var object * @access private * @since 1.0.0 @@ -107,7 +107,7 @@ public function __construct ( $file = '', $version = '1.0.0' ) { $this->_version = $version; - $this->_token = 'woocommerce-book-chapter-tab'; + $this->_token = 'ecommerce-book-chapter-tab'; $this->_base = 'wbch_'; $this->premium_url = 'https://code.recuweb.com/download/woocommerce-book-chapter-tab/'; @@ -117,14 +117,14 @@ public function __construct ( $file = '', $version = '1.0.0' ) { $this->dir = dirname( $this->file ); $this->views = trailingslashit( $this->dir ) . 'views'; $this->assets_dir = trailingslashit( $this->dir ) . 'assets'; - $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $this->file ) ) ); + $this->assets_url = home_url( trailingslashit( str_replace( ABSPATH, '', $this->dir )) . 'assets/' ); $this->script_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; - WooCommerce_Book_Chapter_Tab::$plugin_prefix = $this->_base; - WooCommerce_Book_Chapter_Tab::$plugin_basefile = $this->file; - WooCommerce_Book_Chapter_Tab::$plugin_url = plugin_dir_url($this->file); - WooCommerce_Book_Chapter_Tab::$plugin_path = trailingslashit($this->dir); + ECommerce_Book_Chapter_Tab::$plugin_prefix = $this->_base; + ECommerce_Book_Chapter_Tab::$plugin_basefile = $this->file; + ECommerce_Book_Chapter_Tab::$plugin_url = plugin_dir_url($this->file); + ECommerce_Book_Chapter_Tab::$plugin_path = trailingslashit($this->dir); // register plugin activation hook @@ -140,11 +140,11 @@ public function __construct ( $file = '', $version = '1.0.0' ) { // Load API for generic admin functions - $this->admin = new WooCommerce_Book_Chapter_Tab_Admin_API($this); + $this->admin = new ECommerce_Book_Chapter_Tab_Admin_API($this); /* Localisation */ - $locale = apply_filters('plugin_locale', get_locale(), 'woocommerce-book-chapter-tab'); + $locale = apply_filters('plugin_locale', get_locale(), 'ecommerce-book-chapter-tab'); load_textdomain('wc_book_chapter', WP_PLUGIN_DIR . "/".plugin_basename(dirname(__FILE__)).'/lang/wc_book_chapter-'.$locale.'.mo'); load_plugin_textdomain('wc_book_chapter', false, dirname(plugin_basename(__FILE__)).'/lang/'); @@ -277,7 +277,7 @@ public function __construct ( $file = '', $version = '1.0.0' ) { } // End __construct () /** - * Init WooCommerce Book Chapter Tab extension once we know WooCommerce is active + * Init Book Chapter Tab extension once we know ECommerce is active */ public function init(){ @@ -310,7 +310,7 @@ public function init(){ } else{ - $this->notices->add_error('WooCommerce Book Chapter Tab '.__('requires at least WooCommerce ' . $this->woo_version . ' in order to work. Please upgrade WooCommerce first.', 'wc_book_chapter')); + $this->notices->add_error('Book Chapter Tab '.__('requires at least ECommerce ' . $this->woo_version . ' in order to work. Please upgrade ECommerce first.', 'wc_book_chapter')); } } @@ -459,7 +459,7 @@ public function add_support_link($links, $file){ return $links; } - if($file == WooCommerce_Book_Chapter_Tab::$plugin_basefile){ + if($file == ECommerce_Book_Chapter_Tab::$plugin_basefile){ $links[] = ''.__('Docs', 'wc_book_chapter').''; } @@ -510,7 +510,7 @@ public function get_product_book_chapters($product_id){ /** * Write the images tab on the product view page for WC 2.0+. - * In WooCommerce these are handled by templates. + * In ECommerce these are handled by templates. */ public function chapters($tabs){ @@ -524,7 +524,7 @@ public function chapters($tabs){ $tabs['chapters'] = array( - 'title' => __($this->title, 'woocommerce-book-chapter-tab').' ('.$countItems.')', + 'title' => __($this->title, 'ecommerce-book-chapter-tab').' ('.$countItems.')', 'priority' => $this->priority, 'callback' => array($this, 'book_chapters_panel') ); @@ -535,7 +535,7 @@ public function chapters($tabs){ /** * Write the images tab panel on the product view page. - * In WooCommerce these are handled by templates. + * In ECommerce these are handled by templates. */ public function book_chapters_panel(){ @@ -589,7 +589,7 @@ public function book_chapters_panel(){ echo '
  • showDots == 'yes' ? ' style="background: url(' . $this->assets_url . 'images/dot.png) center center repeat-x;"' : '' ) . '>'; - echo '' . $section . ''; + echo '' . $section . ''; echo '
  • '; } @@ -616,7 +616,7 @@ public function register_post_type ( $post_type = '', $plural = '', $single = '' if ( ! $post_type || ! $plural || ! $single ) return; - $post_type = new WooCommerce_Book_Chapter_Tab_Post_Type( $post_type, $plural, $single, $description, $options ); + $post_type = new ECommerce_Book_Chapter_Tab_Post_Type( $post_type, $plural, $single, $description, $options ); return $post_type; } @@ -633,7 +633,7 @@ public function register_taxonomy ( $taxonomy = '', $plural = '', $single = '', if ( ! $taxonomy || ! $plural || ! $single ) return; - $taxonomy = new WooCommerce_Book_Chapter_Tab_Taxonomy( $taxonomy, $plural, $single, $post_types, $taxonomy_args ); + $taxonomy = new ECommerce_Book_Chapter_Tab_Taxonomy( $taxonomy, $plural, $single, $post_types, $taxonomy_args ); return $taxonomy; } @@ -646,9 +646,12 @@ public function register_taxonomy ( $taxonomy = '', $plural = '', $single = '', */ public function enqueue_styles () { - wp_register_style( $this->_token . '-frontend', esc_url( $this->assets_url ) . 'css/frontend-1.0.1.css', array(), $this->_version ); - wp_enqueue_style( $this->_token . '-frontend' ); - + if( is_product() ){ + + wp_register_style( $this->_token . '-frontend', esc_url( $this->assets_url ) . 'css/frontend-1.0.1.css', array(), $this->_version ); + wp_enqueue_style( $this->_token . '-frontend' ); + } + } // End enqueue_styles () /** @@ -659,13 +662,16 @@ public function enqueue_styles () { */ public function enqueue_scripts () { - if( $this->accordion == 'yes' ){ - - wp_register_script( $this->_token . '-jquery-accordion', esc_url( $this->assets_url ) . 'js/jquery.accordion.js', array( 'jquery' ), $this->_version ); - wp_enqueue_script( $this->_token . '-jquery-accordion' ); + if( is_product() ){ + + if( $this->accordion == 'yes' ){ - wp_register_script( $this->_token . '-frontend', esc_url( $this->assets_url ) . 'js/frontend.js', array( 'jquery' ), $this->_version ); - wp_enqueue_script( $this->_token . '-frontend' ); + wp_register_script( $this->_token . '-jquery-accordion', esc_url( $this->assets_url ) . 'js/jquery.accordion.js', array( 'jquery' ), $this->_version ); + wp_enqueue_script( $this->_token . '-jquery-accordion' ); + + wp_register_script( $this->_token . '-frontend', esc_url( $this->assets_url ) . 'js/frontend.js', array( 'jquery' ), $this->_version ); + wp_enqueue_script( $this->_token . '-frontend' ); + } } } // End enqueue_scripts () @@ -681,7 +687,7 @@ public function admin_enqueue_styles ( $hook = '' ) { wp_register_style( $this->_token . '-admin', esc_url( $this->assets_url ) . 'css/admin.css', array(), $this->_version ); wp_enqueue_style( $this->_token . '-admin' ); - if( isset($_GET['page']) && $_GET['page'] == 'woocommerce-book-chapter-tab' ){ + if( isset($_GET['page']) && $_GET['page'] == 'ecommerce-book-chapter-tab' ){ wp_register_style( $this->_token . '-simpleLightbox', esc_url( $this->assets_url ) . 'css/simpleLightbox.min.css', array(), $this->_version ); wp_enqueue_style( $this->_token . '-simpleLightbox' ); @@ -700,7 +706,7 @@ public function admin_enqueue_scripts ( $hook = '' ) { wp_register_script( $this->_token . '-admin', esc_url( $this->assets_url ) . 'js/admin.js', array( 'jquery' ), $this->_version ); wp_enqueue_script( $this->_token . '-admin' ); - if( isset($_GET['page']) && $_GET['page'] == 'woocommerce-book-chapter-tab' ){ + if( isset($_GET['page']) && $_GET['page'] == 'ecommerce-book-chapter-tab' ){ wp_register_script( $this->_token . '-simpleLightbox', esc_url( $this->assets_url ) . 'js/simpleLightbox.min.js', array( 'jquery' ), $this->_version ); wp_enqueue_script( $this->_token . '-simpleLightbox' ); @@ -718,7 +724,7 @@ public function admin_enqueue_scripts ( $hook = '' ) { * @return void */ public function load_localisation () { - load_plugin_textdomain( 'woocommerce-book-chapter-tab', false, dirname( plugin_basename( $this->file ) ) . '/lang/' ); + load_plugin_textdomain( 'ecommerce-book-chapter-tab', false, dirname( plugin_basename( $this->file ) ) . '/lang/' ); } // End load_localisation () /** @@ -729,7 +735,7 @@ public function load_localisation () { */ public function load_plugin_textdomain () { - $domain = 'woocommerce-book-chapter-tab'; + $domain = 'ecommerce-book-chapter-tab'; $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); @@ -738,14 +744,14 @@ public function load_plugin_textdomain () { } // End load_plugin_textdomain () /** - * Main WooCommerce_Book_Chapter_Tab Instance + * Main ECommerce_Book_Chapter_Tab Instance * - * Ensures only one instance of WooCommerce_Book_Chapter_Tab is loaded or can be loaded. + * Ensures only one instance of ECommerce_Book_Chapter_Tab is loaded or can be loaded. * * @since 1.0.0 * @static - * @see WooCommerce_Book_Chapter_Tab() - * @return Main WooCommerce_Book_Chapter_Tab instance + * @see ECommerce_Book_Chapter_Tab() + * @return Main ECommerce_Book_Chapter_Tab instance */ public static function instance ( $file = '', $version = '1.0.0' ) { diff --git a/includes/lib/class-woocommerce-book-chapter-tab-admin-api.php b/includes/lib/class-ecommerce-book-chapter-tab-admin-api.php similarity index 96% rename from includes/lib/class-woocommerce-book-chapter-tab-admin-api.php rename to includes/lib/class-ecommerce-book-chapter-tab-admin-api.php index 2ca1556..b6d7b0b 100644 --- a/includes/lib/class-woocommerce-book-chapter-tab-admin-api.php +++ b/includes/lib/class-ecommerce-book-chapter-tab-admin-api.php @@ -2,7 +2,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; -class WooCommerce_Book_Chapter_Tab_Admin_API { +class ECommerce_Book_Chapter_Tab_Admin_API { /** * Constructor function @@ -160,8 +160,8 @@ public function display_field ( $data = array(), $post = false, $echo = true ) { $image_thumb = wp_get_attachment_thumb_url( $data ); } $html .= '
    ' . "\n"; - $html .= '' . "\n"; - $html .= '' . "\n"; + $html .= '' . "\n"; + $html .= '' . "\n"; $html .= '
    ' . "\n"; break; @@ -291,10 +291,10 @@ public function display_field ( $data = array(), $post = false, $echo = true ) { } if ( ! $echo ) { - return $html; + return wp_kses_normalize_entities($html); } - echo $html; + echo wp_kses_normalize_entities($html); } diff --git a/includes/lib/class-woocommerce-book-chapter-tab-admin-notices.php b/includes/lib/class-ecommerce-book-chapter-tab-admin-notices.php similarity index 98% rename from includes/lib/class-woocommerce-book-chapter-tab-admin-notices.php rename to includes/lib/class-ecommerce-book-chapter-tab-admin-notices.php index 04d5ccc..3a5817e 100644 --- a/includes/lib/class-woocommerce-book-chapter-tab-admin-notices.php +++ b/includes/lib/class-ecommerce-book-chapter-tab-admin-notices.php @@ -2,10 +2,10 @@ if ( ! defined( 'ABSPATH' ) ) exit; - class WooCommerce_Book_Chapter_Tab_Admin_Notices { + class ECommerce_Book_Chapter_Tab_Admin_Notices { /** - * The single instance of WooCommerce_Book_Chapter_Tab_Admin_Notices. + * The single instance of ECommerce_Book_Chapter_Tab_Admin_Notices. * @var object * @access private * @since 1.0.0 diff --git a/includes/lib/class-woocommerce-book-chapter-tab-post-type.php b/includes/lib/class-ecommerce-book-chapter-tab-post-type.php similarity index 60% rename from includes/lib/class-woocommerce-book-chapter-tab-post-type.php rename to includes/lib/class-ecommerce-book-chapter-tab-post-type.php index d05f3e0..e4046d8 100644 --- a/includes/lib/class-woocommerce-book-chapter-tab-post-type.php +++ b/includes/lib/class-ecommerce-book-chapter-tab-post-type.php @@ -2,7 +2,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; -class WooCommerce_Book_Chapter_Tab_Post_Type { +class ECommerce_Book_Chapter_Tab_Post_Type { /** * The name for the custom post type. @@ -73,15 +73,15 @@ public function register_post_type () { 'name' => $this->plural, 'singular_name' => $this->single, 'name_admin_bar' => $this->single, - 'add_new' => _x( 'Add New', $this->post_type , 'woocommerce-book-chapter-tab' ), - 'add_new_item' => sprintf( __( 'Add New %s' , 'woocommerce-book-chapter-tab' ), $this->single ), - 'edit_item' => sprintf( __( 'Edit %s' , 'woocommerce-book-chapter-tab' ), $this->single ), - 'new_item' => sprintf( __( 'New %s' , 'woocommerce-book-chapter-tab' ), $this->single ), - 'all_items' => sprintf( __( 'All %s' , 'woocommerce-book-chapter-tab' ), $this->plural ), - 'view_item' => sprintf( __( 'View %s' , 'woocommerce-book-chapter-tab' ), $this->single ), - 'search_items' => sprintf( __( 'Search %s' , 'woocommerce-book-chapter-tab' ), $this->plural ), - 'not_found' => sprintf( __( 'No %s Found' , 'woocommerce-book-chapter-tab' ), $this->plural ), - 'not_found_in_trash' => sprintf( __( 'No %s Found In Trash' , 'woocommerce-book-chapter-tab' ), $this->plural ), + 'add_new' => _x( 'Add New', $this->post_type , 'ecommerce-book-chapter-tab' ), + 'add_new_item' => sprintf( __( 'Add New %s' , 'ecommerce-book-chapter-tab' ), $this->single ), + 'edit_item' => sprintf( __( 'Edit %s' , 'ecommerce-book-chapter-tab' ), $this->single ), + 'new_item' => sprintf( __( 'New %s' , 'ecommerce-book-chapter-tab' ), $this->single ), + 'all_items' => sprintf( __( 'All %s' , 'ecommerce-book-chapter-tab' ), $this->plural ), + 'view_item' => sprintf( __( 'View %s' , 'ecommerce-book-chapter-tab' ), $this->single ), + 'search_items' => sprintf( __( 'Search %s' , 'ecommerce-book-chapter-tab' ), $this->plural ), + 'not_found' => sprintf( __( 'No %s Found' , 'ecommerce-book-chapter-tab' ), $this->plural ), + 'not_found_in_trash' => sprintf( __( 'No %s Found In Trash' , 'ecommerce-book-chapter-tab' ), $this->plural ), 'parent_item_colon' => sprintf( __( 'Parent %s' ), $this->single ), 'menu_name' => $this->plural, ); @@ -124,16 +124,16 @@ public function updated_messages ( $messages = array() ) { $messages[ $this->post_type ] = array( 0 => '', - 1 => sprintf( __( '%1$s updated. %2$sView %3$s%4$s.' , 'woocommerce-book-chapter-tab' ), $this->single, '', $this->single, '' ), - 2 => __( 'Custom field updated.' , 'woocommerce-book-chapter-tab' ), - 3 => __( 'Custom field deleted.' , 'woocommerce-book-chapter-tab' ), - 4 => sprintf( __( '%1$s updated.' , 'woocommerce-book-chapter-tab' ), $this->single ), - 5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s.' , 'woocommerce-book-chapter-tab' ), $this->single, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, - 6 => sprintf( __( '%1$s published. %2$sView %3$s%4s.' , 'woocommerce-book-chapter-tab' ), $this->single, '', $this->single, '' ), - 7 => sprintf( __( '%1$s saved.' , 'woocommerce-book-chapter-tab' ), $this->single ), - 8 => sprintf( __( '%1$s submitted. %2$sPreview post%3$s%4$s.' , 'woocommerce-book-chapter-tab' ), $this->single, '', $this->single, '' ), - 9 => sprintf( __( '%1$s scheduled for: %2$s. %3$sPreview %4$s%5$s.' , 'woocommerce-book-chapter-tab' ), $this->single, '' . date_i18n( __( 'M j, Y @ G:i' , 'woocommerce-book-chapter-tab' ), strtotime( $post->post_date ) ) . '', '', $this->single, '' ), - 10 => sprintf( __( '%1$s draft updated. %2$sPreview %3$s%4$s.' , 'woocommerce-book-chapter-tab' ), $this->single, '', $this->single, '' ), + 1 => sprintf( __( '%1$s updated. %2$sView %3$s%4$s.' , 'ecommerce-book-chapter-tab' ), $this->single, '', $this->single, '' ), + 2 => __( 'Custom field updated.' , 'ecommerce-book-chapter-tab' ), + 3 => __( 'Custom field deleted.' , 'ecommerce-book-chapter-tab' ), + 4 => sprintf( __( '%1$s updated.' , 'ecommerce-book-chapter-tab' ), $this->single ), + 5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s.' , 'ecommerce-book-chapter-tab' ), $this->single, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, + 6 => sprintf( __( '%1$s published. %2$sView %3$s%4s.' , 'ecommerce-book-chapter-tab' ), $this->single, '', $this->single, '' ), + 7 => sprintf( __( '%1$s saved.' , 'ecommerce-book-chapter-tab' ), $this->single ), + 8 => sprintf( __( '%1$s submitted. %2$sPreview post%3$s%4$s.' , 'ecommerce-book-chapter-tab' ), $this->single, '', $this->single, '' ), + 9 => sprintf( __( '%1$s scheduled for: %2$s. %3$sPreview %4$s%5$s.' , 'ecommerce-book-chapter-tab' ), $this->single, '' . date_i18n( __( 'M j, Y @ G:i' , 'ecommerce-book-chapter-tab' ), strtotime( $post->post_date ) ) . '', '', $this->single, '' ), + 10 => sprintf( __( '%1$s draft updated. %2$sPreview %3$s%4$s.' , 'ecommerce-book-chapter-tab' ), $this->single, '', $this->single, '' ), ); return $messages; @@ -148,11 +148,11 @@ public function updated_messages ( $messages = array() ) { public function bulk_updated_messages ( $bulk_messages = array(), $bulk_counts = array() ) { $bulk_messages[ $this->post_type ] = array( - 'updated' => sprintf( _n( '%1$s %2$s updated.', '%1$s %3$s updated.', $bulk_counts['updated'], 'woocommerce-book-chapter-tab' ), $bulk_counts['updated'], $this->single, $this->plural ), - 'locked' => sprintf( _n( '%1$s %2$s not updated, somebody is editing it.', '%1$s %3$s not updated, somebody is editing them.', $bulk_counts['locked'], 'woocommerce-book-chapter-tab' ), $bulk_counts['locked'], $this->single, $this->plural ), - 'deleted' => sprintf( _n( '%1$s %2$s permanently deleted.', '%1$s %3$s permanently deleted.', $bulk_counts['deleted'], 'woocommerce-book-chapter-tab' ), $bulk_counts['deleted'], $this->single, $this->plural ), - 'trashed' => sprintf( _n( '%1$s %2$s moved to the Trash.', '%1$s %3$s moved to the Trash.', $bulk_counts['trashed'], 'woocommerce-book-chapter-tab' ), $bulk_counts['trashed'], $this->single, $this->plural ), - 'untrashed' => sprintf( _n( '%1$s %2$s restored from the Trash.', '%1$s %3$s restored from the Trash.', $bulk_counts['untrashed'], 'woocommerce-book-chapter-tab' ), $bulk_counts['untrashed'], $this->single, $this->plural ), + 'updated' => sprintf( _n( '%1$s %2$s updated.', '%1$s %3$s updated.', $bulk_counts['updated'], 'ecommerce-book-chapter-tab' ), $bulk_counts['updated'], $this->single, $this->plural ), + 'locked' => sprintf( _n( '%1$s %2$s not updated, somebody is editing it.', '%1$s %3$s not updated, somebody is editing them.', $bulk_counts['locked'], 'ecommerce-book-chapter-tab' ), $bulk_counts['locked'], $this->single, $this->plural ), + 'deleted' => sprintf( _n( '%1$s %2$s permanently deleted.', '%1$s %3$s permanently deleted.', $bulk_counts['deleted'], 'ecommerce-book-chapter-tab' ), $bulk_counts['deleted'], $this->single, $this->plural ), + 'trashed' => sprintf( _n( '%1$s %2$s moved to the Trash.', '%1$s %3$s moved to the Trash.', $bulk_counts['trashed'], 'ecommerce-book-chapter-tab' ), $bulk_counts['trashed'], $this->single, $this->plural ), + 'untrashed' => sprintf( _n( '%1$s %2$s restored from the Trash.', '%1$s %3$s restored from the Trash.', $bulk_counts['untrashed'], 'ecommerce-book-chapter-tab' ), $bulk_counts['untrashed'], $this->single, $this->plural ), ); return $bulk_messages; diff --git a/includes/lib/class-woocommerce-book-chapter-tab-taxonomy.php b/includes/lib/class-ecommerce-book-chapter-tab-taxonomy.php similarity index 69% rename from includes/lib/class-woocommerce-book-chapter-tab-taxonomy.php rename to includes/lib/class-ecommerce-book-chapter-tab-taxonomy.php index 8a6228a..7776f57 100644 --- a/includes/lib/class-woocommerce-book-chapter-tab-taxonomy.php +++ b/includes/lib/class-ecommerce-book-chapter-tab-taxonomy.php @@ -2,7 +2,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; -class WooCommerce_Book_Chapter_Tab_Taxonomy { +class ECommerce_Book_Chapter_Tab_Taxonomy { /** * The name for the taxonomy. @@ -72,20 +72,20 @@ public function register_taxonomy () { 'name' => $this->plural, 'singular_name' => $this->single, 'menu_name' => $this->plural, - 'all_items' => sprintf( __( 'All %s' , 'woocommerce-book-chapter-tab' ), $this->plural ), - 'edit_item' => sprintf( __( 'Edit %s' , 'woocommerce-book-chapter-tab' ), $this->single ), - 'view_item' => sprintf( __( 'View %s' , 'woocommerce-book-chapter-tab' ), $this->single ), - 'update_item' => sprintf( __( 'Update %s' , 'woocommerce-book-chapter-tab' ), $this->single ), - 'add_new_item' => sprintf( __( 'Add New %s' , 'woocommerce-book-chapter-tab' ), $this->single ), - 'new_item_name' => sprintf( __( 'New %s Name' , 'woocommerce-book-chapter-tab' ), $this->single ), - 'parent_item' => sprintf( __( 'Parent %s' , 'woocommerce-book-chapter-tab' ), $this->single ), - 'parent_item_colon' => sprintf( __( 'Parent %s:' , 'woocommerce-book-chapter-tab' ), $this->single ), - 'search_items' => sprintf( __( 'Search %s' , 'woocommerce-book-chapter-tab' ), $this->plural ), - 'popular_items' => sprintf( __( 'Popular %s' , 'woocommerce-book-chapter-tab' ), $this->plural ), - 'separate_items_with_commas' => sprintf( __( 'Separate %s with commas' , 'woocommerce-book-chapter-tab' ), $this->plural ), - 'add_or_remove_items' => sprintf( __( 'Add or remove %s' , 'woocommerce-book-chapter-tab' ), $this->plural ), - 'choose_from_most_used' => sprintf( __( 'Choose from the most used %s' , 'woocommerce-book-chapter-tab' ), $this->plural ), - 'not_found' => sprintf( __( 'No %s found' , 'woocommerce-book-chapter-tab' ), $this->plural ), + 'all_items' => sprintf( __( 'All %s' , 'ecommerce-book-chapter-tab' ), $this->plural ), + 'edit_item' => sprintf( __( 'Edit %s' , 'ecommerce-book-chapter-tab' ), $this->single ), + 'view_item' => sprintf( __( 'View %s' , 'ecommerce-book-chapter-tab' ), $this->single ), + 'update_item' => sprintf( __( 'Update %s' , 'ecommerce-book-chapter-tab' ), $this->single ), + 'add_new_item' => sprintf( __( 'Add New %s' , 'ecommerce-book-chapter-tab' ), $this->single ), + 'new_item_name' => sprintf( __( 'New %s Name' , 'ecommerce-book-chapter-tab' ), $this->single ), + 'parent_item' => sprintf( __( 'Parent %s' , 'ecommerce-book-chapter-tab' ), $this->single ), + 'parent_item_colon' => sprintf( __( 'Parent %s:' , 'ecommerce-book-chapter-tab' ), $this->single ), + 'search_items' => sprintf( __( 'Search %s' , 'ecommerce-book-chapter-tab' ), $this->plural ), + 'popular_items' => sprintf( __( 'Popular %s' , 'ecommerce-book-chapter-tab' ), $this->plural ), + 'separate_items_with_commas' => sprintf( __( 'Separate %s with commas' , 'ecommerce-book-chapter-tab' ), $this->plural ), + 'add_or_remove_items' => sprintf( __( 'Add or remove %s' , 'ecommerce-book-chapter-tab' ), $this->plural ), + 'choose_from_most_used' => sprintf( __( 'Choose from the most used %s' , 'ecommerce-book-chapter-tab' ), $this->plural ), + 'not_found' => sprintf( __( 'No %s found' , 'ecommerce-book-chapter-tab' ), $this->plural ), ); $args = array( diff --git a/readme.txt b/readme.txt index a327255..b3b6a97 100644 --- a/readme.txt +++ b/readme.txt @@ -1,10 +1,10 @@ -=== WooCommerce Book Chapter Tab === +=== Book Chapter Tab === Contributors: rafasashi Tags: ecommerce, e-commerce, woocommerce, book, ebook, documentation, chapter, chapters, sections, product tab Donate link: https://code.recuweb.com/download/woocommerce-book-chapter-tab/ Requires at least: 4.6 -Tested up to: 5.3 -Stable tag: 3.0.6 +Tested up to: 6.1.1 +Stable tag: 3.0.8 License: GPLv3 License URI: https://code.recuweb.com/product-licenses/ @@ -12,7 +12,7 @@ Allows you to display the Chapters and Sections of a book or ebook in a new tab == Description == -Extends WooCommerce to allow you to display the Chapters and Sections of a book, ebook or documentation in a new tab on the single product page. +Extends WC to allow you to display the Chapters and Sections of a book, ebook or documentation in a new tab on the single product page. = Free Features = @@ -29,7 +29,7 @@ Extends WooCommerce to allow you to display the Chapters and Sections of a book, – TAB POSITION – Change the position of the Tab name in the frontend. – SHOW EMPTY – Show or hide empty Tab when a product doesn't contain any Chapters. -More information about [WooCommerce Book Chapter Tab](https://code.recuweb.com/download/woocommerce-book-chapter-tab/) +More information about [Book Chapter Tab](https://code.recuweb.com/download/woocommerce-book-chapter-tab/) = Localization = @@ -43,13 +43,13 @@ For all documentation on this plugin go to: [https://code.recuweb.com/download/w = Minimum Requirements = -* WooCommerce 2.0 or higher. +* WC 2.0 or higher. = Automatic installation = -Automatic installation is the easiest option as WordPress handles the file transfers itself and you don't even need to leave your web browser. To do an automatic install of WooCommerce Book Chapter Tab, log in to your WordPress admin panel, navigate to the Plugins menu and click Add New. +Automatic installation is the easiest option as WordPress handles the file transfers itself and you don't even need to leave your web browser. To do an automatic install of Book Chapter Tab, log in to your WordPress admin panel, navigate to the Plugins menu and click Add New. -In the search field type "WooCommerce Book Chapter Tab" and click Search Plugins. Once you've found my plugin extension you can view details about it such as the the point release, rating and description. Most importantly of course, you can install it by simply clicking Install Now. After clicking that link you will be asked if you're sure you want to install the plugin. Click yes and WordPress will automatically complete the installation. +In the search field type "Book Chapter Tab" and click Search Plugins. Once you've found my plugin extension you can view details about it such as the the point release, rating and description. Most importantly of course, you can install it by simply clicking Install Now. After clicking that link you will be asked if you're sure you want to install the plugin. Click yes and WordPress will automatically complete the installation. = Manual installation = diff --git a/views/premium.php b/views/premium.php index 08087d6..56b38c0 100644 --- a/views/premium.php +++ b/views/premium.php @@ -201,7 +201,7 @@

    Upgrade to the premium version - of WooCommerce Book Chapter Tab to benefit from all features! + of Book Chapter Tab to benefit from all features!

    GET LICENSE @@ -319,7 +319,7 @@

    Upgrade to the premium version - of WooCommerce Book Chapter Tab to benefit from all features! + of Book Chapter Tab to benefit from all features!

    GET LICENSE diff --git a/woocommerce-book-chapter-tab.php b/woocommerce-book-chapter-tab.php index b4f60dd..71bd60b 100644 --- a/woocommerce-book-chapter-tab.php +++ b/woocommerce-book-chapter-tab.php @@ -1,13 +1,13 @@ notices ) ) { - $instance->notices = WooCommerce_Book_Chapter_Tab_Admin_Notices::instance( $instance ); + $instance->notices = ECommerce_Book_Chapter_Tab_Admin_Notices::instance( $instance ); } if ( is_null( $instance->settings ) ) { - $instance->settings = WooCommerce_Book_Chapter_Tab_Settings::instance( $instance ); + $instance->settings = ECommerce_Book_Chapter_Tab_Settings::instance( $instance ); } return $instance; } - // Checks if the WooCommerce plugins is installed and active. + // Checks if the ECommerce plugins is installed and active. $plugins = apply_filters('active_plugins', get_option('active_plugins')); if(in_array('woocommerce/woocommerce.php', $plugins)){ - if(!in_array('woo-book-chapter-tab-premium/woocommerce-book-chapter-tab-premium.php', $plugins)){ + if(!in_array('woo-book-chapter-tab-premium/ecommerce-book-chapter-tab-premium.php', $plugins)){ - WooCommerce_Book_Chapter_Tab(); + ECommerce_Book_Chapter_Tab(); } } else{ @@ -77,7 +77,7 @@ function WooCommerce_Book_Chapter_Tab() { if($current_screen->parent_base == 'plugins'){ - echo '

    WooCommerce Book Chapter Tab '.__('requires WooCommerce to be activated in order to work. Please install and activate WooCommerce first.', 'wc_book_chapter').'

    '; + echo '

    Book Chapter Tab '.__('requires ECommerce to be activated in order to work. Please install and activate ECommerce first.', 'wc_book_chapter').'

    '; } }); }