commit
f5ff10711d
|
@ -2,14 +2,15 @@
|
||||||
/**
|
/**
|
||||||
* Adds settings to the permalinks admin settings page.
|
* Adds settings to the permalinks admin settings page.
|
||||||
*
|
*
|
||||||
|
* @class WC_Admin_Permalink_Settings
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package WooCommerce/Admin
|
* @package WooCommerce/Admin
|
||||||
* @version 2.1.0
|
* @version 2.3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit; // Exit if accessed directly
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! class_exists( 'WC_Admin_Permalink_Settings' ) ) :
|
if ( ! class_exists( 'WC_Admin_Permalink_Settings' ) ) :
|
||||||
|
@ -28,7 +29,7 @@ class WC_Admin_Permalink_Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init our settings
|
* Init our settings.
|
||||||
*/
|
*/
|
||||||
public function settings_init() {
|
public function settings_init() {
|
||||||
// Add a section to the permalinks page
|
// Add a section to the permalinks page
|
||||||
|
@ -89,7 +90,7 @@ class WC_Admin_Permalink_Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the settings
|
* Show the settings.
|
||||||
*/
|
*/
|
||||||
public function settings() {
|
public function settings() {
|
||||||
echo wpautop( __( 'These settings control the permalinks used for products. These settings only apply when <strong>not using "default" permalinks above</strong>.', 'woocommerce' ) );
|
echo wpautop( __( 'These settings control the permalinks used for products. These settings only apply when <strong>not using "default" permalinks above</strong>.', 'woocommerce' ) );
|
||||||
|
@ -153,7 +154,7 @@ class WC_Admin_Permalink_Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the settings
|
* Save the settings.
|
||||||
*/
|
*/
|
||||||
public function settings_save() {
|
public function settings_save() {
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
|
||||||
exit; // Exit if accessed directly
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comments
|
* Comments
|
||||||
*
|
*
|
||||||
* Handle comments (reviews and order notes)
|
* Handle comments (reviews and order notes)
|
||||||
*
|
*
|
||||||
* @class WC_Post_types
|
* @class WC_Comments
|
||||||
* @version 2.3.0
|
* @version 2.3.0
|
||||||
* @package WooCommerce/Classes/Products
|
* @package WooCommerce/Classes/Products
|
||||||
* @category Class
|
* @category Class
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
class WC_Comments {
|
class WC_Comments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook in methods
|
* Hook in methods.
|
||||||
*/
|
*/
|
||||||
public static function init() {
|
public static function init() {
|
||||||
|
|
||||||
// Rating posts
|
// Rating posts
|
||||||
add_filter( 'preprocess_comment', array( __CLASS__, 'check_comment_rating' ), 0 );
|
add_filter( 'preprocess_comment', array( __CLASS__, 'check_comment_rating' ), 0 );
|
||||||
add_action( 'comment_post', array( __CLASS__, 'add_comment_rating' ), 1 );
|
add_action( 'comment_post', array( __CLASS__, 'add_comment_rating' ), 1 );
|
||||||
|
|
||||||
// clear transients
|
// Clear transients
|
||||||
add_action( 'wp_update_comment_count', array( __CLASS__, 'clear_transients' ) );
|
add_action( 'wp_update_comment_count', array( __CLASS__, 'clear_transients' ) );
|
||||||
|
|
||||||
// Secure order notes
|
// Secure order notes
|
||||||
|
@ -41,7 +42,7 @@ class WC_Comments {
|
||||||
// Count comments
|
// Count comments
|
||||||
add_filter( 'wp_count_comments', array( __CLASS__, 'wp_count_comments' ), 10, 2 );
|
add_filter( 'wp_count_comments', array( __CLASS__, 'wp_count_comments' ), 10, 2 );
|
||||||
|
|
||||||
// support avatars for `review` comment type
|
// Support avatars for `review` comment type
|
||||||
add_filter( 'get_avatar_comment_types', array( __CLASS__, 'add_avatar_for_review_comment_type' ) );
|
add_filter( 'get_avatar_comment_types', array( __CLASS__, 'add_avatar_for_review_comment_type' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +54,6 @@ class WC_Comments {
|
||||||
* shop managers can view orders anyway.
|
* shop managers can view orders anyway.
|
||||||
*
|
*
|
||||||
* The frontend view order pages get around this filter by using remove_filter('comments_clauses', array( 'WC_Comments' ,'exclude_order_comments'), 10, 1 );
|
* The frontend view order pages get around this filter by using remove_filter('comments_clauses', array( 'WC_Comments' ,'exclude_order_comments'), 10, 1 );
|
||||||
*
|
|
||||||
* @param array $clauses
|
* @param array $clauses
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -83,7 +83,6 @@ class WC_Comments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude order comments from queries and RSS
|
* Exclude order comments from queries and RSS
|
||||||
*
|
|
||||||
* @param string $join
|
* @param string $join
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -99,7 +98,6 @@ class WC_Comments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude order comments from queries and RSS
|
* Exclude order comments from queries and RSS
|
||||||
*
|
|
||||||
* @param string $where
|
* @param string $where
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -117,7 +115,6 @@ class WC_Comments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude webhook comments from queries and RSS
|
* Exclude webhook comments from queries and RSS
|
||||||
*
|
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
* @param array $clauses
|
* @param array $clauses
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -144,7 +141,6 @@ class WC_Comments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude webhook comments from queries and RSS
|
* Exclude webhook comments from queries and RSS
|
||||||
*
|
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
* @param string $join
|
* @param string $join
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -161,7 +157,6 @@ class WC_Comments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude webhook comments from queries and RSS
|
* Exclude webhook comments from queries and RSS
|
||||||
*
|
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
* @param string $where
|
* @param string $where
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -180,7 +175,6 @@ class WC_Comments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate the comment ratings.
|
* Validate the comment ratings.
|
||||||
*
|
|
||||||
* @param array $comment_data
|
* @param array $comment_data
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -196,7 +190,6 @@ class WC_Comments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rating field for comments.
|
* Rating field for comments.
|
||||||
*
|
|
||||||
* @param int $comment_id
|
* @param int $comment_id
|
||||||
*/
|
*/
|
||||||
public static function add_comment_rating( $comment_id ) {
|
public static function add_comment_rating( $comment_id ) {
|
||||||
|
@ -211,7 +204,6 @@ class WC_Comments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear transients for a review.
|
* Clear transients for a review.
|
||||||
*
|
|
||||||
* @param int $post_id
|
* @param int $post_id
|
||||||
*/
|
*/
|
||||||
public static function clear_transients( $post_id ) {
|
public static function clear_transients( $post_id ) {
|
||||||
|
@ -229,7 +221,6 @@ class WC_Comments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove order notes from wp_count_comments()
|
* Remove order notes from wp_count_comments()
|
||||||
*
|
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
* @param object $stats
|
* @param object $stats
|
||||||
* @param int $post_id
|
* @param int $post_id
|
||||||
|
@ -276,7 +267,6 @@ class WC_Comments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure WP displays avatars for comments with the `review` type
|
* Make sure WP displays avatars for comments with the `review` type
|
||||||
*
|
|
||||||
* @since 2.3
|
* @since 2.3
|
||||||
* @param array $comment_types
|
* @param array $comment_types
|
||||||
* @return array
|
* @return array
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
|
||||||
exit; // Exit if accessed directly
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle frontend scripts
|
* Handle frontend scripts
|
||||||
*
|
*
|
||||||
|
@ -13,6 +8,14 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
* @category Class
|
* @category Class
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WC_Frontend_Scripts Class
|
||||||
|
*/
|
||||||
class WC_Frontend_Scripts {
|
class WC_Frontend_Scripts {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +31,7 @@ class WC_Frontend_Scripts {
|
||||||
private static $wp_localize_scripts = array();
|
private static $wp_localize_scripts = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook in methods
|
* Hook in methods.
|
||||||
*/
|
*/
|
||||||
public static function init() {
|
public static function init() {
|
||||||
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'load_scripts' ) );
|
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'load_scripts' ) );
|
||||||
|
@ -37,7 +40,7 @@ class WC_Frontend_Scripts {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get styles for the frontend
|
* Get styles for the frontend.
|
||||||
* @access private
|
* @access private
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -65,7 +68,7 @@ class WC_Frontend_Scripts {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a script for use
|
* Register a script for use.
|
||||||
*
|
*
|
||||||
* @uses wp_register_script()
|
* @uses wp_register_script()
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -81,7 +84,7 @@ class WC_Frontend_Scripts {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register and enqueue a script for use
|
* Register and enqueue a script for use.
|
||||||
*
|
*
|
||||||
* @uses wp_enqueue_script()
|
* @uses wp_enqueue_script()
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -100,8 +103,6 @@ class WC_Frontend_Scripts {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register/queue frontend scripts.
|
* Register/queue frontend scripts.
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
*/
|
*/
|
||||||
public static function load_scripts() {
|
public static function load_scripts() {
|
||||||
global $post;
|
global $post;
|
||||||
|
@ -196,7 +197,7 @@ class WC_Frontend_Scripts {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return data for script handles
|
* Return data for script handles.
|
||||||
* @access private
|
* @access private
|
||||||
* @param string $handle
|
* @param string $handle
|
||||||
* @return array|bool
|
* @return array|bool
|
||||||
|
|
|
@ -1,24 +1,27 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
|
||||||
exit; // Exit if accessed directly
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post types
|
* Post Types
|
||||||
*
|
*
|
||||||
* Registers post types and taxonomies
|
* Registers post types and taxonomies
|
||||||
*
|
*
|
||||||
* @class WC_Post_types
|
* @class WC_Post_types
|
||||||
* @version 2.2.0
|
* @version 2.3.0
|
||||||
* @package WooCommerce/Classes/Products
|
* @package WooCommerce/Classes/Products
|
||||||
* @category Class
|
* @category Class
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WC_Post_types Class
|
||||||
|
*/
|
||||||
class WC_Post_types {
|
class WC_Post_types {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook in methods
|
* Hook in methods.
|
||||||
*/
|
*/
|
||||||
public static function init() {
|
public static function init() {
|
||||||
add_action( 'init', array( __CLASS__, 'register_taxonomies' ), 5 );
|
add_action( 'init', array( __CLASS__, 'register_taxonomies' ), 5 );
|
||||||
|
@ -28,7 +31,7 @@ class WC_Post_types {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register WooCommerce taxonomies.
|
* Register core taxonomies.
|
||||||
*/
|
*/
|
||||||
public static function register_taxonomies() {
|
public static function register_taxonomies() {
|
||||||
if ( taxonomy_exists( 'product_type' ) ) {
|
if ( taxonomy_exists( 'product_type' ) ) {
|
||||||
|
@ -210,7 +213,7 @@ class WC_Post_types {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register core post types
|
* Register core post types.
|
||||||
*/
|
*/
|
||||||
public static function register_post_types() {
|
public static function register_post_types() {
|
||||||
if ( post_type_exists('product') ) {
|
if ( post_type_exists('product') ) {
|
||||||
|
@ -404,7 +407,7 @@ class WC_Post_types {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register our custom post statuses, used for order status
|
* Register our custom post statuses, used for order status.
|
||||||
*/
|
*/
|
||||||
public static function register_post_status() {
|
public static function register_post_status() {
|
||||||
register_post_status( 'wc-pending', array(
|
register_post_status( 'wc-pending', array(
|
||||||
|
@ -466,7 +469,7 @@ class WC_Post_types {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add Product Support to Jetpack Omnisearch
|
* Add Product Support to Jetpack Omnisearch.
|
||||||
*/
|
*/
|
||||||
public static function support_jetpack_omnisearch() {
|
public static function support_jetpack_omnisearch() {
|
||||||
if ( class_exists( 'Jetpack_Omnisearch_Posts' ) ) {
|
if ( class_exists( 'Jetpack_Omnisearch_Posts' ) ) {
|
||||||
|
|
|
@ -21,15 +21,15 @@ class WC_Unit_Test_Case extends WP_UnitTestCase {
|
||||||
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// add custom factories
|
// Add custom factories
|
||||||
$this->factory = new WC_Unit_Test_Factory();
|
$this->factory = new WC_Unit_Test_Factory();
|
||||||
|
|
||||||
// setup mock WC session handler
|
// Setup mock WC session handler
|
||||||
add_filter( 'woocommerce_session_handler', array( $this, 'set_mock_session_handler' ) );
|
add_filter( 'woocommerce_session_handler', array( $this, 'set_mock_session_handler' ) );
|
||||||
|
|
||||||
$this->setOutputCallback( array( $this, 'filter_output' ) );
|
$this->setOutputCallback( array( $this, 'filter_output' ) );
|
||||||
|
|
||||||
// register post types before each test
|
// Register post types before each test
|
||||||
WC_Post_types::register_post_types();
|
WC_Post_types::register_post_types();
|
||||||
WC_Post_types::register_taxonomies();
|
WC_Post_types::register_taxonomies();
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ class WC_Unit_Test_Case extends WP_UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* Asserts thing is WP_Error
|
* Asserts thing is WP_Error
|
||||||
*
|
*
|
||||||
* @param $actual
|
* @param mixed $actual
|
||||||
* @param string $message
|
* @param string $message
|
||||||
*/
|
*/
|
||||||
public function assertIsWPError( $actual, $message = '' ) {
|
public function assertIsWPError( $actual, $message = '' ) {
|
||||||
|
|
Loading…
Reference in New Issue