Changeset 3335533
- Timestamp:
- 07/28/2025 06:27:19 PM (5 months ago)
- Location:
- checkview
- Files:
-
- 6 deleted
- 18 edited
- 1 copied
-
tags/2.0.20 (copied) (copied from checkview/trunk)
-
tags/2.0.20/.idea (deleted)
-
tags/2.0.20/README.txt (modified) (3 diffs)
-
tags/2.0.20/admin/class-checkview-admin.php (modified) (2 diffs)
-
tags/2.0.20/checkview.php (modified) (5 diffs)
-
tags/2.0.20/composer.json (modified) (1 diff)
-
tags/2.0.20/includes/API/class-checkview-api.php (modified) (9 diffs)
-
tags/2.0.20/includes/checkview-functions.php (modified) (8 diffs)
-
tags/2.0.20/includes/checkview-helper-functions.php (modified) (1 diff)
-
tags/2.0.20/includes/class-checkview-i18n.php (deleted)
-
tags/2.0.20/includes/class-checkview.php (modified) (9 diffs)
-
tags/2.0.20/includes/woocommercehelper/class-checkview-woo-automated-testing.php (modified) (12 diffs)
-
tags/2.0.20/public (deleted)
-
trunk/.idea (deleted)
-
trunk/README.txt (modified) (3 diffs)
-
trunk/admin/class-checkview-admin.php (modified) (2 diffs)
-
trunk/checkview.php (modified) (5 diffs)
-
trunk/composer.json (modified) (1 diff)
-
trunk/includes/API/class-checkview-api.php (modified) (9 diffs)
-
trunk/includes/checkview-functions.php (modified) (8 diffs)
-
trunk/includes/checkview-helper-functions.php (modified) (1 diff)
-
trunk/includes/class-checkview-i18n.php (deleted)
-
trunk/includes/class-checkview.php (modified) (9 diffs)
-
trunk/includes/woocommercehelper/class-checkview-woo-automated-testing.php (modified) (12 diffs)
-
trunk/public (deleted)
Legend:
- Unmodified
- Added
- Removed
-
checkview/tags/2.0.20/README.txt
r3323842 r3335533 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html 10 Stable tag: 2.0. 1910 Stable tag: 2.0.20 11 11 12 12 [CheckView](https://checkview.io/) is the friendly WordPress automated testing platform for everyone, from developers, shop owners to agencies. … … 86 86 87 87 == Changelog == 88 = 2.0.20 = 89 * Only run testing code for requests with newly required cookie. 90 * Only run relevant test code for the specified test type in the newly required cookie. 91 * Add check for WS Forms before attempting to run code. 92 * Better handle page ID retrieval. 93 * Extract all code from I18n class into a single function. 94 * Extract all code from Public class into a single function. 95 * Make helper methods of Woo class static. 96 * Improve logging. 97 88 98 = 2.0.19 = 89 * Improve logging 90 * Add hooks for disabling WP Forms CAPTCHAs/Turnstiles for tests 91 * Disable test-related hooks on API requests 92 * Disable Fluent Forms token-based spam prevention for tests 93 * Remove Fluent Forms CAPTCHA/Turnstile key swap 94 * Disable Fluent Forms CAPTCHAs using newly provided hook 99 * Improve logging. 100 * Add hooks for disabling WP Forms CAPTCHAs/Turnstiles for tests. 101 * Disable test-related hooks on API requests. 102 * Disable Fluent Forms token-based spam prevention for tests. 103 * Remove Fluent Forms CAPTCHA/Turnstile key swap. 104 * Disable Fluent Forms CAPTCHAs using newly provided hook. 95 105 96 106 = 2.0.18 = … … 368 378 369 379 == Upgrade Notice == 380 = 2.0.20 = 381 * Only run testing code for requests with newly required cookie. 382 * Only run relevant test code for the specified test type in the newly required cookie. 383 * Add check for WS Forms before attempting to run code. 384 * Better handle page ID retrieval. 385 * Extract all code from I18n class into a single function. 386 * Extract all code from Public class into a single function. 387 * Make helper methods of Woo class static. 388 * Improve logging. 389 370 390 = 2.0.19 = 371 391 * Improve logging -
checkview/tags/2.0.20/admin/class-checkview-admin.php
r3323842 r3335533 204 204 * Initializes a test. 205 205 * 206 * Should only be called if the request is a verified CheckView bot. 207 * 206 208 * @return void 207 209 */ … … 217 219 } 218 220 219 // Current Visitor IP.220 221 $visitor_ip = checkview_get_visitor_ip(); 221 // Check view Bot IP. 222 $cv_bot_ip = checkview_get_api_ip(); 223 224 // Skip if visitor ip not equal to CV Bot IP. 225 if ( is_array( $cv_bot_ip ) && ! in_array( $visitor_ip, $cv_bot_ip ) ) { 226 if ( isset( $_REQUEST['checkview_test_id'] ) ) { 227 Checkview_Admin_Logs::add( 'ip-logs', 'Although checkview_test_id is set in the request, exiting test init due to visitor IP [' . $visitor_ip . '] failing bot IP check [' . implode(', ', $cv_bot_ip) . '].' ); 228 } 229 230 if ( 'true' !== get_option( 'cv_ff_keys_set_turnstile' ) ) { 231 return; 232 } 233 234 return; 235 } 236 237 Checkview_Admin_Logs::add( 'ip-logs', 'Visitor IP [' . $visitor_ip . '] determined to be in bot IP list, continuing.' ); 222 223 Checkview_Admin_Logs::add( 'ip-logs', 'Visitor IP [' . $visitor_ip . '] determined to be in bot IP list, continuing with test code.' ); 238 224 239 225 if ( is_plugin_active( 'cleantalk-spam-protect/cleantalk.php' ) ) { -
checkview/tags/2.0.20/checkview.php
r3323842 r3335533 12 12 * Plugin URI: https://checkview.io 13 13 * Description: CheckView is the #1 fully automated solution to test your WordPress forms and detect form problems fast. Automatically test your WordPress forms to ensure you never miss a lead again. 14 * Version: 2.0. 1914 * Version: 2.0.20 15 15 * Author: CheckView 16 16 * Author URI: https://checkview.io/ … … 36 36 * @link https://semver.org 37 37 */ 38 define( 'CHECKVIEW_VERSION', '2.0. 19' );38 define( 'CHECKVIEW_VERSION', '2.0.20' ); 39 39 40 40 if ( ! defined( 'CHECKVIEW_BASE_DIR' ) ) { … … 78 78 Checkview_Activator::activate(); 79 79 } 80 register_activation_hook( __FILE__, 'activate_checkview' ); 80 81 81 82 /** … … 86 87 Checkview_Deactivator::deactivate(); 87 88 } 89 register_deactivation_hook( __FILE__, 'deactivate_checkview' ); 88 90 89 register_activation_hook( __FILE__, 'activate_checkview' );90 register_deactivation_hook( __FILE__, 'deactivate_checkview' );91 91 if ( ! function_exists( 'is_plugin_active' ) ) { 92 92 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 93 93 } 94 94 95 // Load CheckView Helper Plugins. 95 96 require plugin_dir_path( __FILE__ ) . 'includes/checkview-helper-functions.php'; … … 104 105 */ 105 106 function run_checkview() { 106 $plugin = Check view::get_instance();107 $plugin = CheckView::get_instance(); 107 108 $plugin->run(); 108 109 } -
checkview/tags/2.0.20/composer.json
r3111331 r3335533 18 18 "php": "^5.6 || ^7.0 || ^8.0", 19 19 "firebase/php-jwt": "^6.5", 20 "paragonie/sodium_compat": "^1.20" 20 "paragonie/sodium_compat": "^1.20", 21 "ext-json": "*" 21 22 }, 22 23 "require-dev": { -
checkview/tags/2.0.20/includes/API/class-checkview-api.php
r3303097 r3335533 19 19 class CheckView_Api { 20 20 /** 21 * Woo Helper class.22 *23 * @since 1.0.024 * @access private25 *26 * @var bool/Checkview_Woo_Automated_Testing $woo_helper The woo helper of this plugin.27 */28 private $woo_helper;29 /**30 21 * Holds the JWT error. 31 22 * … … 33 24 */ 34 25 public $jwt_error = null; 35 /**36 * Constructor.37 *38 * Sets class properties.39 *40 * @since 1.0.041 *42 * @param Checkview_Woo_Automated_Testing $woo_helper The woohelper class.43 */44 public function __construct( $woo_helper = '' ) {45 $this->woo_helper = $woo_helper;46 }47 26 48 27 /** … … 1016 995 $order_id = isset( $order_id ) ? intval( $order_id ) : null; 1017 996 if ( null === $order_id || empty( $order_id ) ) { 1018 $results = $this->woo_helper->delete_orders_from_backend();997 $results = Checkview_Woo_Automated_Testing::delete_orders_from_backend(); 1019 998 } else { 1020 999 try { … … 1047 1026 } 1048 1027 Checkview_Admin_Logs::add( 'api-logs', 'API failed to delete customer.' ); 1028 1029 $results = false; 1049 1030 } 1050 1031 } … … 1159 1140 ); 1160 1141 } 1161 $active_gateways = $this->woo_helper->get_active_payment_gateways();1142 $active_gateways = Checkview_Woo_Automated_Testing::get_active_payment_gateways(); 1162 1143 if ( $active_gateways ) { 1163 1144 return new WP_REST_Response( … … 1204 1185 ); 1205 1186 } 1206 $customer = $this->woo_helper->checkview_create_test_customer();1187 $customer = Checkview_Woo_Automated_Testing::checkview_create_test_customer(); 1207 1188 if ( $customer ) { 1208 1189 return new WP_REST_Response( … … 1245 1226 ); 1246 1227 } 1247 $customer = $this->woo_helper->checkview_get_test_credentials();1228 $customer = Checkview_Woo_Automated_Testing::checkview_get_test_credentials(); 1248 1229 if ( $customer ) { 1249 1230 return new WP_REST_Response( … … 1437 1418 ); 1438 1419 } 1439 $product = $this->woo_helper->checkview_get_test_product();1420 $product = Checkview_Woo_Automated_Testing::checkview_get_test_product(); 1440 1421 $product_details['checkview_product'] = $product ? get_permalink( $product->get_id() ) : false; 1441 1422 if ( ! empty( $product_details ) && false !== $product_details['checkview_product'] ) { … … 2419 2400 ); 2420 2401 } 2421 $product = $this->woo_helper->checkview_get_test_product();2402 $product = Checkview_Woo_Automated_Testing::checkview_get_test_product(); 2422 2403 $product_id = ! empty( $product->get_id() ) ? $product->get_id() : false; 2423 $status = checkview_update_woocommerce_product_status( $product_id, $checkview_status );2404 $status = checkview_update_woocommerce_product_status( $product_id, $checkview_status ); 2424 2405 if ( 0 != $status && ! is_wp_error( $product_id ) ) { 2425 2406 return new WP_REST_Response( -
checkview/tags/2.0.20/includes/checkview-functions.php
r3323842 r3335533 119 119 */ 120 120 function get_checkview_test_id() { 121 global $wpdb;122 123 121 $cv_test_id = isset( $_REQUEST['checkview_test_id'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['checkview_test_id'] ) ) : ''; 124 122 … … 155 153 * @return void 156 154 */ 157 function complete_checkview_test( $checkview_test_id = '' ) {155 function complete_checkview_test( string $checkview_test_id = '' ) { 158 156 global $wpdb; 159 157 … … 191 189 192 190 if ( ! empty( $form_id ) && ! empty( $entry_id ) ) { 193 $ws_form_submit = new WS_Form_Submit(); 194 $ws_form_submit->id = $entry_id; 195 $ws_form_submit->form_id = $form_id; 196 $ws_form_submit->db_delete( true, true, true ); 191 if ( class_exists( 'WS_Form_Submit' ) ) { 192 $ws_form_submit = new WS_Form_Submit(); 193 $ws_form_submit->id = $entry_id; 194 $ws_form_submit->form_id = $form_id; 195 $ws_form_submit->db_delete( true, true, true ); 196 } else { 197 Checkview_Admin_Logs::add( 'ip-logs', 'WS_Form_Submit class does not exist.' ); 198 } 197 199 } 198 200 … … 666 668 $is_sub_directory = explode( '/', str_replace( '//', '|', $current_url ) ); 667 669 if ( count( $is_sub_directory ) > 1 ) { 668 // remove subdire tory from home url.670 // remove subdirectory from home url. 669 671 $current_url = str_replace( '/' . $is_sub_directory[1], '', $current_url ); 670 672 } … … 687 689 $current_url = $url[0]; 688 690 $page_id = ''; 691 689 692 // Retrieve the current post's ID based on its URL. 690 if ( $current_url ) { 691 $page_id = get_page_by_path( $current_url ); 692 $page_id = $page_id->ID; 693 if ( ! $current_url ) { 694 global $post; 695 696 if ( $post instanceof WP_Post ) { 697 $page_id = $post->ID; 698 } 693 699 } else { 694 global $post; 695 if ( $post ) { 696 $page_id = $post->ID; 697 } 698 } 700 $page = get_page_by_path( $current_url ); 701 702 if ( $page instanceof WP_Post ) { 703 $page_id = $page->ID; 704 } else { 705 global $post; 706 707 if ( $post instanceof WP_Post ) { 708 $page_id = $post->ID; 709 } else { 710 $page_id = get_the_ID(); 711 } 712 } 713 } 714 699 715 $session_table = $wpdb->prefix . 'cv_session'; 700 716 $test_key = 'CF_TEST_' . $page_id; … … 1013 1029 */ 1014 1030 function checkview_get_option_data_handler() { 1015 if ( ! isset( $_POST['_checkview_token'] ) ||empty( $_POST['_checkview_token'] ) ) {1031 if ( empty( $_POST['_checkview_token'] ) ) { 1016 1032 Checkview_Admin_Logs::add( 'api-logs', 'Token absent.' ); 1017 1033 wp_send_json_error( esc_html__( 'There was a technical error while processing your request.', 'checkview' ) ); … … 1031 1047 1032 1048 // Checking for JWT token. 1033 if ( ! isset( $nonce_token ) || empty( $nonce_token ) || is_wp_error( $nonce_token ) ) { 1034 $this->jwt_error = $nonce_token; 1035 // Log the detailed error for internal use. 1049 if ( empty( $nonce_token ) || is_wp_error( $nonce_token ) ) { 1036 1050 Checkview_Admin_Logs::add( 'api-logs', 'Invalid token.' ); 1037 1051 wp_send_json_error( esc_html__( 'There was a technical error while processing your request.', 'checkview' ) ); … … 1133 1147 * @return mixed The first matching element, or null if none found. 1134 1148 */ 1135 function array_find(array $array, callable $callback) : mixed{1149 function array_find(array $array, callable $callback) { 1136 1150 foreach ($array as $key => $value) { 1137 1151 if ($callback($value, $key)) { -
checkview/tags/2.0.20/includes/checkview-helper-functions.php
r3247217 r3335533 17 17 * Validates an IP address. 18 18 * 19 * @param IP$ip IP address.19 * @param string $ip IP address. 20 20 * @return bool 21 21 */ 22 function checkview_validate_ip( $ip ){22 function checkview_validate_ip( string $ip ): bool { 23 23 // Validate that the input is a valid IP address. 24 24 if ( ! empty( $ip ) && ! filter_var( $ip, FILTER_VALIDATE_IP ) ) { -
checkview/tags/2.0.20/includes/class-checkview.php
r3323842 r3335533 17 17 * @author Check View <[email protected]> 18 18 */ 19 class Check view {19 class CheckView { 20 20 21 21 /** … … 55 55 * @access private 56 56 * 57 * @var Check view $instance The instance of the class.57 * @var CheckView $instance The instance of the class. 58 58 */ 59 59 60 60 private static $instance = null; 61 62 /** 63 * Bot cookie name. 64 * 65 * @since 2.0.20 66 * @access private 67 * 68 * @var string $bot_cookie Bot cookie name. 69 */ 70 private static string $bot_cookie = 'cv_running'; 61 71 62 72 /** … … 71 81 $this->version = CHECKVIEW_VERSION; 72 82 } else { 73 $this->version = '2.0. 19';83 $this->version = '2.0.20'; 74 84 } 75 85 $this->plugin_name = 'checkview'; 76 86 77 87 $this->load_dependencies(); 78 $this->define_public_hooks(); 79 $this->set_locale(); 88 89 $this->loader->add_action( 'init', $this, 'load_textdomain' ); 90 $this->loader->add_action( 'wp_enqueue_scripts', $this, 'dequeue_scripts', 20 ); 91 80 92 $this->define_admin_hooks(); 81 93 } … … 92 104 public static function get_instance() { 93 105 if ( null === self::$instance ) { 94 self::$instance = new Check view();106 self::$instance = new CheckView(); 95 107 } 96 108 97 109 return self::$instance; 110 } 111 112 /** 113 * Determine if the request contains the cookie necessary for running testing code. 114 * 115 * Returns one of `woo_checkout`, `form`, or `custom`. False if not set or invalid value. 116 * 117 * @return string|false Validated cookie value, or false. 118 */ 119 public static function has_cookie() { 120 $valid_values = array('woo_checkout', 'form', 'custom'); 121 122 if ( isset( $_COOKIE[self::$bot_cookie] ) && in_array( $_COOKIE[self::$bot_cookie], $valid_values ) ) { 123 return $_COOKIE[self::$bot_cookie]; 124 } 125 126 return false; 127 } 128 129 /** 130 * Determine if the current request is a CheckView bot. 131 * 132 * @return bool 133 */ 134 public static function is_bot(): bool { 135 $visitor_ip = checkview_get_visitor_ip(); 136 $cv_bot_ip = checkview_get_api_ip(); 137 $ip_verified = is_array( $cv_bot_ip ) && in_array( $visitor_ip, $cv_bot_ip ); 138 139 if ( isset( $_REQUEST['checkview_test_id'] ) && ! $ip_verified ) { 140 Checkview_Admin_Logs::add( 'ip-logs', 'Although checkview_test_id is set in the request, failing bot check due to visitor IP [' . $visitor_ip . '] not existing in bot IP list [' . implode(', ', $cv_bot_ip) . '].' ); 141 142 return false; 143 } 144 145 $has_cookie = self::has_cookie(); 146 147 return $has_cookie && $ip_verified; 98 148 } 99 149 … … 124 174 require_once plugin_dir_path( __DIR__ ) . 'includes/checkview-functions.php'; 125 175 require_once plugin_dir_path( __DIR__ ) . 'includes/class-checkview-loader.php'; 126 require_once plugin_dir_path( __DIR__ ) . 'includes/class-checkview-i18n.php';127 176 require_once plugin_dir_path( __DIR__ ) . 'admin/class-checkview-admin.php'; 128 177 require_once plugin_dir_path( __DIR__ ) . 'admin/class-checkview-admin-logs.php'; 129 178 require_once plugin_dir_path( __DIR__ ) . 'admin/settings/class-checkview-admin-settings.php'; 130 require_once plugin_dir_path( __DIR__ ) . 'public/class-checkview-public.php';131 179 132 180 $this->loader = new Checkview_Loader(); 133 181 134 // Current Vsitor IP.182 // Current visitor IP. 135 183 $visitor_ip = checkview_get_visitor_ip(); 136 184 $woo_helper = ''; 137 185 // Check view Bot IP. 138 186 $cv_bot_ip = checkview_get_api_ip(); 187 188 // TODO: What is this for? 139 189 if ( ( 'checkview-saas' === get_option( $visitor_ip ) || isset( $_REQUEST['checkview_test_id'] ) || ( is_array( $cv_bot_ip ) && in_array( $visitor_ip, $cv_bot_ip ) ) ) ) { 140 190 update_option( $visitor_ip, 'checkview-saas', true ); 141 191 } 192 142 193 if ( class_exists( 'WooCommerce' ) ) { 143 194 require_once plugin_dir_path( __DIR__ ) . 'includes/woocommercehelper/class-checkview-woo-automated-testing.php'; 195 144 196 $woo_helper = new Checkview_Woo_Automated_Testing( $this->get_plugin_name(), $this->get_version(), $this->loader ); 145 197 } 198 146 199 $this->loader->add_filter( 147 200 'plugin_action_links_' . CHECKVIEW_BASE_DIR, … … 154 207 155 208 // Initialize the plugin's API. 156 $plugin_api = new CheckView_Api( $woo_helper);209 $plugin_api = new CheckView_Api(); 157 210 158 211 // Hook our routes into WordPress. … … 165 218 166 219 /** 167 * Sets up i18n. 168 * 169 * @since 1.0.0 170 * @access private 171 */ 172 private function set_locale() { 173 174 $plugin_i18n = new Checkview_i18n(); 175 $plugin_i18n->load_plugin_textdomain(); 176 add_action( 177 'plugins_loaded', 178 array( $plugin_i18n, 'load_plugin_textdomain' ) 220 * Loads the CheckView text domain. 221 * 222 * @since 1.0.0 223 */ 224 public function load_textdomain() { 225 load_plugin_textdomain( 226 'checkview', 227 false, 228 dirname( plugin_basename( __FILE__ ) ) . '/languages/' 179 229 ); 180 230 } … … 263 313 ); 264 314 } 265 $this->loader->add_action( 266 'init', 267 $plugin_admin, 268 'checkview_init_current_test' 269 ); 315 316 if ( self::is_bot() ) { 317 $this->loader->add_action( 318 'init', 319 $plugin_admin, 320 'checkview_init_current_test' 321 ); 322 } 323 270 324 $this->loader->add_action( 271 325 'upgrader_process_complete', … … 285 339 * @access private 286 340 */ 287 private function define_public_hooks() { 288 289 $plugin_public = new Checkview_Public( $this->get_plugin_name(), $this->get_version() ); 290 $this->loader->add_action( 291 'wp_enqueue_scripts', 292 $plugin_public, 293 'enqueue_scripts' 294 ); 295 296 // Current Vsitor IP. 297 $visitor_ip = checkview_get_visitor_ip(); 298 // Check view Bot IP. 299 $cv_bot_ip = checkview_get_api_ip(); 300 301 // Proceed if visitor IP is in SaaS IPs. 302 if ( is_array( $cv_bot_ip ) && in_array( $visitor_ip, $cv_bot_ip ) ) { 341 public function dequeue_scripts() { 342 if ( self::is_bot() ) { 343 wp_dequeue_script( 'contact-form-7' ); 344 wp_dequeue_style( 'contact-form-7' ); 345 wp_dequeue_script( 'wpcf7-recaptcha' ); 346 wp_dequeue_style( 'wpcf7-recaptcha' ); 347 303 348 $this->loader->add_action( 304 349 'pre_option_require_name_email', -
checkview/tags/2.0.20/includes/woocommercehelper/class-checkview-woo-automated-testing.php
r3323842 r3335533 204 204 } 205 205 206 // add_filter( 'wp_mail', array( $this, 'checkview_filter_wp_mail' ), 99 );207 206 $this->checkview_test_mode(); 208 207 } … … 262 261 * @return array 263 262 */ 264 public function get_active_payment_gateways() {263 public static function get_active_payment_gateways() { 265 264 $active_gateways = array(); 266 265 $payment_gateways = WC_Payment_Gateways::instance()->payment_gateways(); … … 285 284 * @return WC_Customer 286 285 */ 287 public function checkview_create_test_customer() {288 $customer = $this->checkview_get_test_customer();286 public static function checkview_create_test_customer() { 287 $customer = self::checkview_get_test_customer(); 289 288 $email = CHECKVIEW_EMAIL; 290 289 … … 318 317 * @return WC_Customer|false 319 318 */ 320 public function checkview_get_test_customer() {319 public static function checkview_get_test_customer() { 321 320 $customer_id = get_option( 'checkview_test_user', false ); 322 321 … … 360 359 * @type string $password The newly-generated password for the test user. 361 360 */ 362 public function checkview_get_test_credentials() {361 public static function checkview_get_test_credentials() { 363 362 add_filter( 'pre_wp_mail', '__return_false', PHP_INT_MAX ); 364 363 365 364 $password = wp_generate_password(); 366 $customer = $this->checkview_get_test_customer();365 $customer = self::checkview_get_test_customer(); 367 366 368 367 if ( ! $customer ) { 369 $customer = $this->checkview_create_test_customer();368 $customer = self::checkview_create_test_customer(); 370 369 } 371 370 … … 374 373 375 374 // Schedule the password to be rotated 15min from now. 376 $this->checkview_rotate_password_cron();375 self::checkview_rotate_password_cron(); 377 376 378 377 return array( … … 389 388 add_filter( 'pre_wp_mail', '__return_false', PHP_INT_MAX ); 390 389 391 $customer = $this->checkview_get_test_customer();390 $customer = self::checkview_get_test_customer(); 392 391 393 392 if ( ! $customer ) { … … 404 403 * @return void 405 404 */ 406 public function checkview_rotate_password_cron() {405 public static function checkview_rotate_password_cron() { 407 406 wp_schedule_single_event( time() + 15 * MINUTE_IN_SECONDS, 'checkview_rotate_user_credentials' ); 408 407 } … … 415 414 * @return WC_Product/bool 416 415 */ 417 public function checkview_get_test_product() {416 public static function checkview_get_test_product() { 418 417 $product_id = get_option( 'checkview_woo_product_id' ); 419 418 if ( $product_id ) { … … 564 563 */ 565 564 public function checkview_test_mode() { 566 $visitor_ip = checkview_get_visitor_ip(); 567 $cv_bot_ip = checkview_get_api_ip(); 568 569 if ( ! is_array( $cv_bot_ip ) || ! in_array( $visitor_ip, $cv_bot_ip ) ) { 565 $is_bot = CheckView::is_bot(); 566 567 if ( ! $is_bot ) { 570 568 return; 571 569 } 572 570 573 Checkview_Admin_Logs::add( 'ip-logs', 'Running Woo test mode hooks, visitor IP [' . $visitor_ip . '] matched a bot IP.' ); 571 $cookie = CheckView::has_cookie(); 572 573 if ( $cookie !== 'woo_checkout' ) { 574 return; 575 } 576 577 Checkview_Admin_Logs::add( 'ip-logs', 'Running Woo test mode hooks, visitor is bot and cookie value equals [' . $cookie . '].' ); 574 578 575 579 if ( ! is_admin() && class_exists( 'WooCommerce' ) ) { … … 783 787 * Doesn't run on AJAX requests. 784 788 * 785 * @return void786 */ 787 public function delete_orders_from_backend() {789 * @return boolean 790 */ 791 public static function delete_orders_from_backend() { 788 792 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { 789 return ;790 } 791 792 return $this->checkview_delete_orders();793 return false; 794 } 795 796 return self::checkview_delete_orders(); 793 797 } 794 798 … … 799 803 * @return bool 800 804 */ 801 public function checkview_delete_orders( $order_id = '' ) {805 public static function checkview_delete_orders( $order_id = '' ) { 802 806 Checkview_Admin_Logs::add( 'ip-logs', 'Deleting CheckView orders from the database...' ); 803 807 -
checkview/trunk/README.txt
r3323842 r3335533 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html 10 Stable tag: 2.0. 1910 Stable tag: 2.0.20 11 11 12 12 [CheckView](https://checkview.io/) is the friendly WordPress automated testing platform for everyone, from developers, shop owners to agencies. … … 86 86 87 87 == Changelog == 88 = 2.0.20 = 89 * Only run testing code for requests with newly required cookie. 90 * Only run relevant test code for the specified test type in the newly required cookie. 91 * Add check for WS Forms before attempting to run code. 92 * Better handle page ID retrieval. 93 * Extract all code from I18n class into a single function. 94 * Extract all code from Public class into a single function. 95 * Make helper methods of Woo class static. 96 * Improve logging. 97 88 98 = 2.0.19 = 89 * Improve logging 90 * Add hooks for disabling WP Forms CAPTCHAs/Turnstiles for tests 91 * Disable test-related hooks on API requests 92 * Disable Fluent Forms token-based spam prevention for tests 93 * Remove Fluent Forms CAPTCHA/Turnstile key swap 94 * Disable Fluent Forms CAPTCHAs using newly provided hook 99 * Improve logging. 100 * Add hooks for disabling WP Forms CAPTCHAs/Turnstiles for tests. 101 * Disable test-related hooks on API requests. 102 * Disable Fluent Forms token-based spam prevention for tests. 103 * Remove Fluent Forms CAPTCHA/Turnstile key swap. 104 * Disable Fluent Forms CAPTCHAs using newly provided hook. 95 105 96 106 = 2.0.18 = … … 368 378 369 379 == Upgrade Notice == 380 = 2.0.20 = 381 * Only run testing code for requests with newly required cookie. 382 * Only run relevant test code for the specified test type in the newly required cookie. 383 * Add check for WS Forms before attempting to run code. 384 * Better handle page ID retrieval. 385 * Extract all code from I18n class into a single function. 386 * Extract all code from Public class into a single function. 387 * Make helper methods of Woo class static. 388 * Improve logging. 389 370 390 = 2.0.19 = 371 391 * Improve logging -
checkview/trunk/admin/class-checkview-admin.php
r3323842 r3335533 204 204 * Initializes a test. 205 205 * 206 * Should only be called if the request is a verified CheckView bot. 207 * 206 208 * @return void 207 209 */ … … 217 219 } 218 220 219 // Current Visitor IP.220 221 $visitor_ip = checkview_get_visitor_ip(); 221 // Check view Bot IP. 222 $cv_bot_ip = checkview_get_api_ip(); 223 224 // Skip if visitor ip not equal to CV Bot IP. 225 if ( is_array( $cv_bot_ip ) && ! in_array( $visitor_ip, $cv_bot_ip ) ) { 226 if ( isset( $_REQUEST['checkview_test_id'] ) ) { 227 Checkview_Admin_Logs::add( 'ip-logs', 'Although checkview_test_id is set in the request, exiting test init due to visitor IP [' . $visitor_ip . '] failing bot IP check [' . implode(', ', $cv_bot_ip) . '].' ); 228 } 229 230 if ( 'true' !== get_option( 'cv_ff_keys_set_turnstile' ) ) { 231 return; 232 } 233 234 return; 235 } 236 237 Checkview_Admin_Logs::add( 'ip-logs', 'Visitor IP [' . $visitor_ip . '] determined to be in bot IP list, continuing.' ); 222 223 Checkview_Admin_Logs::add( 'ip-logs', 'Visitor IP [' . $visitor_ip . '] determined to be in bot IP list, continuing with test code.' ); 238 224 239 225 if ( is_plugin_active( 'cleantalk-spam-protect/cleantalk.php' ) ) { -
checkview/trunk/checkview.php
r3323842 r3335533 12 12 * Plugin URI: https://checkview.io 13 13 * Description: CheckView is the #1 fully automated solution to test your WordPress forms and detect form problems fast. Automatically test your WordPress forms to ensure you never miss a lead again. 14 * Version: 2.0. 1914 * Version: 2.0.20 15 15 * Author: CheckView 16 16 * Author URI: https://checkview.io/ … … 36 36 * @link https://semver.org 37 37 */ 38 define( 'CHECKVIEW_VERSION', '2.0. 19' );38 define( 'CHECKVIEW_VERSION', '2.0.20' ); 39 39 40 40 if ( ! defined( 'CHECKVIEW_BASE_DIR' ) ) { … … 78 78 Checkview_Activator::activate(); 79 79 } 80 register_activation_hook( __FILE__, 'activate_checkview' ); 80 81 81 82 /** … … 86 87 Checkview_Deactivator::deactivate(); 87 88 } 89 register_deactivation_hook( __FILE__, 'deactivate_checkview' ); 88 90 89 register_activation_hook( __FILE__, 'activate_checkview' );90 register_deactivation_hook( __FILE__, 'deactivate_checkview' );91 91 if ( ! function_exists( 'is_plugin_active' ) ) { 92 92 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 93 93 } 94 94 95 // Load CheckView Helper Plugins. 95 96 require plugin_dir_path( __FILE__ ) . 'includes/checkview-helper-functions.php'; … … 104 105 */ 105 106 function run_checkview() { 106 $plugin = Check view::get_instance();107 $plugin = CheckView::get_instance(); 107 108 $plugin->run(); 108 109 } -
checkview/trunk/composer.json
r3111331 r3335533 18 18 "php": "^5.6 || ^7.0 || ^8.0", 19 19 "firebase/php-jwt": "^6.5", 20 "paragonie/sodium_compat": "^1.20" 20 "paragonie/sodium_compat": "^1.20", 21 "ext-json": "*" 21 22 }, 22 23 "require-dev": { -
checkview/trunk/includes/API/class-checkview-api.php
r3303097 r3335533 19 19 class CheckView_Api { 20 20 /** 21 * Woo Helper class.22 *23 * @since 1.0.024 * @access private25 *26 * @var bool/Checkview_Woo_Automated_Testing $woo_helper The woo helper of this plugin.27 */28 private $woo_helper;29 /**30 21 * Holds the JWT error. 31 22 * … … 33 24 */ 34 25 public $jwt_error = null; 35 /**36 * Constructor.37 *38 * Sets class properties.39 *40 * @since 1.0.041 *42 * @param Checkview_Woo_Automated_Testing $woo_helper The woohelper class.43 */44 public function __construct( $woo_helper = '' ) {45 $this->woo_helper = $woo_helper;46 }47 26 48 27 /** … … 1016 995 $order_id = isset( $order_id ) ? intval( $order_id ) : null; 1017 996 if ( null === $order_id || empty( $order_id ) ) { 1018 $results = $this->woo_helper->delete_orders_from_backend();997 $results = Checkview_Woo_Automated_Testing::delete_orders_from_backend(); 1019 998 } else { 1020 999 try { … … 1047 1026 } 1048 1027 Checkview_Admin_Logs::add( 'api-logs', 'API failed to delete customer.' ); 1028 1029 $results = false; 1049 1030 } 1050 1031 } … … 1159 1140 ); 1160 1141 } 1161 $active_gateways = $this->woo_helper->get_active_payment_gateways();1142 $active_gateways = Checkview_Woo_Automated_Testing::get_active_payment_gateways(); 1162 1143 if ( $active_gateways ) { 1163 1144 return new WP_REST_Response( … … 1204 1185 ); 1205 1186 } 1206 $customer = $this->woo_helper->checkview_create_test_customer();1187 $customer = Checkview_Woo_Automated_Testing::checkview_create_test_customer(); 1207 1188 if ( $customer ) { 1208 1189 return new WP_REST_Response( … … 1245 1226 ); 1246 1227 } 1247 $customer = $this->woo_helper->checkview_get_test_credentials();1228 $customer = Checkview_Woo_Automated_Testing::checkview_get_test_credentials(); 1248 1229 if ( $customer ) { 1249 1230 return new WP_REST_Response( … … 1437 1418 ); 1438 1419 } 1439 $product = $this->woo_helper->checkview_get_test_product();1420 $product = Checkview_Woo_Automated_Testing::checkview_get_test_product(); 1440 1421 $product_details['checkview_product'] = $product ? get_permalink( $product->get_id() ) : false; 1441 1422 if ( ! empty( $product_details ) && false !== $product_details['checkview_product'] ) { … … 2419 2400 ); 2420 2401 } 2421 $product = $this->woo_helper->checkview_get_test_product();2402 $product = Checkview_Woo_Automated_Testing::checkview_get_test_product(); 2422 2403 $product_id = ! empty( $product->get_id() ) ? $product->get_id() : false; 2423 $status = checkview_update_woocommerce_product_status( $product_id, $checkview_status );2404 $status = checkview_update_woocommerce_product_status( $product_id, $checkview_status ); 2424 2405 if ( 0 != $status && ! is_wp_error( $product_id ) ) { 2425 2406 return new WP_REST_Response( -
checkview/trunk/includes/checkview-functions.php
r3323842 r3335533 119 119 */ 120 120 function get_checkview_test_id() { 121 global $wpdb;122 123 121 $cv_test_id = isset( $_REQUEST['checkview_test_id'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['checkview_test_id'] ) ) : ''; 124 122 … … 155 153 * @return void 156 154 */ 157 function complete_checkview_test( $checkview_test_id = '' ) {155 function complete_checkview_test( string $checkview_test_id = '' ) { 158 156 global $wpdb; 159 157 … … 191 189 192 190 if ( ! empty( $form_id ) && ! empty( $entry_id ) ) { 193 $ws_form_submit = new WS_Form_Submit(); 194 $ws_form_submit->id = $entry_id; 195 $ws_form_submit->form_id = $form_id; 196 $ws_form_submit->db_delete( true, true, true ); 191 if ( class_exists( 'WS_Form_Submit' ) ) { 192 $ws_form_submit = new WS_Form_Submit(); 193 $ws_form_submit->id = $entry_id; 194 $ws_form_submit->form_id = $form_id; 195 $ws_form_submit->db_delete( true, true, true ); 196 } else { 197 Checkview_Admin_Logs::add( 'ip-logs', 'WS_Form_Submit class does not exist.' ); 198 } 197 199 } 198 200 … … 666 668 $is_sub_directory = explode( '/', str_replace( '//', '|', $current_url ) ); 667 669 if ( count( $is_sub_directory ) > 1 ) { 668 // remove subdire tory from home url.670 // remove subdirectory from home url. 669 671 $current_url = str_replace( '/' . $is_sub_directory[1], '', $current_url ); 670 672 } … … 687 689 $current_url = $url[0]; 688 690 $page_id = ''; 691 689 692 // Retrieve the current post's ID based on its URL. 690 if ( $current_url ) { 691 $page_id = get_page_by_path( $current_url ); 692 $page_id = $page_id->ID; 693 if ( ! $current_url ) { 694 global $post; 695 696 if ( $post instanceof WP_Post ) { 697 $page_id = $post->ID; 698 } 693 699 } else { 694 global $post; 695 if ( $post ) { 696 $page_id = $post->ID; 697 } 698 } 700 $page = get_page_by_path( $current_url ); 701 702 if ( $page instanceof WP_Post ) { 703 $page_id = $page->ID; 704 } else { 705 global $post; 706 707 if ( $post instanceof WP_Post ) { 708 $page_id = $post->ID; 709 } else { 710 $page_id = get_the_ID(); 711 } 712 } 713 } 714 699 715 $session_table = $wpdb->prefix . 'cv_session'; 700 716 $test_key = 'CF_TEST_' . $page_id; … … 1013 1029 */ 1014 1030 function checkview_get_option_data_handler() { 1015 if ( ! isset( $_POST['_checkview_token'] ) ||empty( $_POST['_checkview_token'] ) ) {1031 if ( empty( $_POST['_checkview_token'] ) ) { 1016 1032 Checkview_Admin_Logs::add( 'api-logs', 'Token absent.' ); 1017 1033 wp_send_json_error( esc_html__( 'There was a technical error while processing your request.', 'checkview' ) ); … … 1031 1047 1032 1048 // Checking for JWT token. 1033 if ( ! isset( $nonce_token ) || empty( $nonce_token ) || is_wp_error( $nonce_token ) ) { 1034 $this->jwt_error = $nonce_token; 1035 // Log the detailed error for internal use. 1049 if ( empty( $nonce_token ) || is_wp_error( $nonce_token ) ) { 1036 1050 Checkview_Admin_Logs::add( 'api-logs', 'Invalid token.' ); 1037 1051 wp_send_json_error( esc_html__( 'There was a technical error while processing your request.', 'checkview' ) ); … … 1133 1147 * @return mixed The first matching element, or null if none found. 1134 1148 */ 1135 function array_find(array $array, callable $callback) : mixed{1149 function array_find(array $array, callable $callback) { 1136 1150 foreach ($array as $key => $value) { 1137 1151 if ($callback($value, $key)) { -
checkview/trunk/includes/checkview-helper-functions.php
r3247217 r3335533 17 17 * Validates an IP address. 18 18 * 19 * @param IP$ip IP address.19 * @param string $ip IP address. 20 20 * @return bool 21 21 */ 22 function checkview_validate_ip( $ip ){22 function checkview_validate_ip( string $ip ): bool { 23 23 // Validate that the input is a valid IP address. 24 24 if ( ! empty( $ip ) && ! filter_var( $ip, FILTER_VALIDATE_IP ) ) { -
checkview/trunk/includes/class-checkview.php
r3323842 r3335533 17 17 * @author Check View <[email protected]> 18 18 */ 19 class Check view {19 class CheckView { 20 20 21 21 /** … … 55 55 * @access private 56 56 * 57 * @var Check view $instance The instance of the class.57 * @var CheckView $instance The instance of the class. 58 58 */ 59 59 60 60 private static $instance = null; 61 62 /** 63 * Bot cookie name. 64 * 65 * @since 2.0.20 66 * @access private 67 * 68 * @var string $bot_cookie Bot cookie name. 69 */ 70 private static string $bot_cookie = 'cv_running'; 61 71 62 72 /** … … 71 81 $this->version = CHECKVIEW_VERSION; 72 82 } else { 73 $this->version = '2.0. 19';83 $this->version = '2.0.20'; 74 84 } 75 85 $this->plugin_name = 'checkview'; 76 86 77 87 $this->load_dependencies(); 78 $this->define_public_hooks(); 79 $this->set_locale(); 88 89 $this->loader->add_action( 'init', $this, 'load_textdomain' ); 90 $this->loader->add_action( 'wp_enqueue_scripts', $this, 'dequeue_scripts', 20 ); 91 80 92 $this->define_admin_hooks(); 81 93 } … … 92 104 public static function get_instance() { 93 105 if ( null === self::$instance ) { 94 self::$instance = new Check view();106 self::$instance = new CheckView(); 95 107 } 96 108 97 109 return self::$instance; 110 } 111 112 /** 113 * Determine if the request contains the cookie necessary for running testing code. 114 * 115 * Returns one of `woo_checkout`, `form`, or `custom`. False if not set or invalid value. 116 * 117 * @return string|false Validated cookie value, or false. 118 */ 119 public static function has_cookie() { 120 $valid_values = array('woo_checkout', 'form', 'custom'); 121 122 if ( isset( $_COOKIE[self::$bot_cookie] ) && in_array( $_COOKIE[self::$bot_cookie], $valid_values ) ) { 123 return $_COOKIE[self::$bot_cookie]; 124 } 125 126 return false; 127 } 128 129 /** 130 * Determine if the current request is a CheckView bot. 131 * 132 * @return bool 133 */ 134 public static function is_bot(): bool { 135 $visitor_ip = checkview_get_visitor_ip(); 136 $cv_bot_ip = checkview_get_api_ip(); 137 $ip_verified = is_array( $cv_bot_ip ) && in_array( $visitor_ip, $cv_bot_ip ); 138 139 if ( isset( $_REQUEST['checkview_test_id'] ) && ! $ip_verified ) { 140 Checkview_Admin_Logs::add( 'ip-logs', 'Although checkview_test_id is set in the request, failing bot check due to visitor IP [' . $visitor_ip . '] not existing in bot IP list [' . implode(', ', $cv_bot_ip) . '].' ); 141 142 return false; 143 } 144 145 $has_cookie = self::has_cookie(); 146 147 return $has_cookie && $ip_verified; 98 148 } 99 149 … … 124 174 require_once plugin_dir_path( __DIR__ ) . 'includes/checkview-functions.php'; 125 175 require_once plugin_dir_path( __DIR__ ) . 'includes/class-checkview-loader.php'; 126 require_once plugin_dir_path( __DIR__ ) . 'includes/class-checkview-i18n.php';127 176 require_once plugin_dir_path( __DIR__ ) . 'admin/class-checkview-admin.php'; 128 177 require_once plugin_dir_path( __DIR__ ) . 'admin/class-checkview-admin-logs.php'; 129 178 require_once plugin_dir_path( __DIR__ ) . 'admin/settings/class-checkview-admin-settings.php'; 130 require_once plugin_dir_path( __DIR__ ) . 'public/class-checkview-public.php';131 179 132 180 $this->loader = new Checkview_Loader(); 133 181 134 // Current Vsitor IP.182 // Current visitor IP. 135 183 $visitor_ip = checkview_get_visitor_ip(); 136 184 $woo_helper = ''; 137 185 // Check view Bot IP. 138 186 $cv_bot_ip = checkview_get_api_ip(); 187 188 // TODO: What is this for? 139 189 if ( ( 'checkview-saas' === get_option( $visitor_ip ) || isset( $_REQUEST['checkview_test_id'] ) || ( is_array( $cv_bot_ip ) && in_array( $visitor_ip, $cv_bot_ip ) ) ) ) { 140 190 update_option( $visitor_ip, 'checkview-saas', true ); 141 191 } 192 142 193 if ( class_exists( 'WooCommerce' ) ) { 143 194 require_once plugin_dir_path( __DIR__ ) . 'includes/woocommercehelper/class-checkview-woo-automated-testing.php'; 195 144 196 $woo_helper = new Checkview_Woo_Automated_Testing( $this->get_plugin_name(), $this->get_version(), $this->loader ); 145 197 } 198 146 199 $this->loader->add_filter( 147 200 'plugin_action_links_' . CHECKVIEW_BASE_DIR, … … 154 207 155 208 // Initialize the plugin's API. 156 $plugin_api = new CheckView_Api( $woo_helper);209 $plugin_api = new CheckView_Api(); 157 210 158 211 // Hook our routes into WordPress. … … 165 218 166 219 /** 167 * Sets up i18n. 168 * 169 * @since 1.0.0 170 * @access private 171 */ 172 private function set_locale() { 173 174 $plugin_i18n = new Checkview_i18n(); 175 $plugin_i18n->load_plugin_textdomain(); 176 add_action( 177 'plugins_loaded', 178 array( $plugin_i18n, 'load_plugin_textdomain' ) 220 * Loads the CheckView text domain. 221 * 222 * @since 1.0.0 223 */ 224 public function load_textdomain() { 225 load_plugin_textdomain( 226 'checkview', 227 false, 228 dirname( plugin_basename( __FILE__ ) ) . '/languages/' 179 229 ); 180 230 } … … 263 313 ); 264 314 } 265 $this->loader->add_action( 266 'init', 267 $plugin_admin, 268 'checkview_init_current_test' 269 ); 315 316 if ( self::is_bot() ) { 317 $this->loader->add_action( 318 'init', 319 $plugin_admin, 320 'checkview_init_current_test' 321 ); 322 } 323 270 324 $this->loader->add_action( 271 325 'upgrader_process_complete', … … 285 339 * @access private 286 340 */ 287 private function define_public_hooks() { 288 289 $plugin_public = new Checkview_Public( $this->get_plugin_name(), $this->get_version() ); 290 $this->loader->add_action( 291 'wp_enqueue_scripts', 292 $plugin_public, 293 'enqueue_scripts' 294 ); 295 296 // Current Vsitor IP. 297 $visitor_ip = checkview_get_visitor_ip(); 298 // Check view Bot IP. 299 $cv_bot_ip = checkview_get_api_ip(); 300 301 // Proceed if visitor IP is in SaaS IPs. 302 if ( is_array( $cv_bot_ip ) && in_array( $visitor_ip, $cv_bot_ip ) ) { 341 public function dequeue_scripts() { 342 if ( self::is_bot() ) { 343 wp_dequeue_script( 'contact-form-7' ); 344 wp_dequeue_style( 'contact-form-7' ); 345 wp_dequeue_script( 'wpcf7-recaptcha' ); 346 wp_dequeue_style( 'wpcf7-recaptcha' ); 347 303 348 $this->loader->add_action( 304 349 'pre_option_require_name_email', -
checkview/trunk/includes/woocommercehelper/class-checkview-woo-automated-testing.php
r3323842 r3335533 204 204 } 205 205 206 // add_filter( 'wp_mail', array( $this, 'checkview_filter_wp_mail' ), 99 );207 206 $this->checkview_test_mode(); 208 207 } … … 262 261 * @return array 263 262 */ 264 public function get_active_payment_gateways() {263 public static function get_active_payment_gateways() { 265 264 $active_gateways = array(); 266 265 $payment_gateways = WC_Payment_Gateways::instance()->payment_gateways(); … … 285 284 * @return WC_Customer 286 285 */ 287 public function checkview_create_test_customer() {288 $customer = $this->checkview_get_test_customer();286 public static function checkview_create_test_customer() { 287 $customer = self::checkview_get_test_customer(); 289 288 $email = CHECKVIEW_EMAIL; 290 289 … … 318 317 * @return WC_Customer|false 319 318 */ 320 public function checkview_get_test_customer() {319 public static function checkview_get_test_customer() { 321 320 $customer_id = get_option( 'checkview_test_user', false ); 322 321 … … 360 359 * @type string $password The newly-generated password for the test user. 361 360 */ 362 public function checkview_get_test_credentials() {361 public static function checkview_get_test_credentials() { 363 362 add_filter( 'pre_wp_mail', '__return_false', PHP_INT_MAX ); 364 363 365 364 $password = wp_generate_password(); 366 $customer = $this->checkview_get_test_customer();365 $customer = self::checkview_get_test_customer(); 367 366 368 367 if ( ! $customer ) { 369 $customer = $this->checkview_create_test_customer();368 $customer = self::checkview_create_test_customer(); 370 369 } 371 370 … … 374 373 375 374 // Schedule the password to be rotated 15min from now. 376 $this->checkview_rotate_password_cron();375 self::checkview_rotate_password_cron(); 377 376 378 377 return array( … … 389 388 add_filter( 'pre_wp_mail', '__return_false', PHP_INT_MAX ); 390 389 391 $customer = $this->checkview_get_test_customer();390 $customer = self::checkview_get_test_customer(); 392 391 393 392 if ( ! $customer ) { … … 404 403 * @return void 405 404 */ 406 public function checkview_rotate_password_cron() {405 public static function checkview_rotate_password_cron() { 407 406 wp_schedule_single_event( time() + 15 * MINUTE_IN_SECONDS, 'checkview_rotate_user_credentials' ); 408 407 } … … 415 414 * @return WC_Product/bool 416 415 */ 417 public function checkview_get_test_product() {416 public static function checkview_get_test_product() { 418 417 $product_id = get_option( 'checkview_woo_product_id' ); 419 418 if ( $product_id ) { … … 564 563 */ 565 564 public function checkview_test_mode() { 566 $visitor_ip = checkview_get_visitor_ip(); 567 $cv_bot_ip = checkview_get_api_ip(); 568 569 if ( ! is_array( $cv_bot_ip ) || ! in_array( $visitor_ip, $cv_bot_ip ) ) { 565 $is_bot = CheckView::is_bot(); 566 567 if ( ! $is_bot ) { 570 568 return; 571 569 } 572 570 573 Checkview_Admin_Logs::add( 'ip-logs', 'Running Woo test mode hooks, visitor IP [' . $visitor_ip . '] matched a bot IP.' ); 571 $cookie = CheckView::has_cookie(); 572 573 if ( $cookie !== 'woo_checkout' ) { 574 return; 575 } 576 577 Checkview_Admin_Logs::add( 'ip-logs', 'Running Woo test mode hooks, visitor is bot and cookie value equals [' . $cookie . '].' ); 574 578 575 579 if ( ! is_admin() && class_exists( 'WooCommerce' ) ) { … … 783 787 * Doesn't run on AJAX requests. 784 788 * 785 * @return void786 */ 787 public function delete_orders_from_backend() {789 * @return boolean 790 */ 791 public static function delete_orders_from_backend() { 788 792 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { 789 return ;790 } 791 792 return $this->checkview_delete_orders();793 return false; 794 } 795 796 return self::checkview_delete_orders(); 793 797 } 794 798 … … 799 803 * @return bool 800 804 */ 801 public function checkview_delete_orders( $order_id = '' ) {805 public static function checkview_delete_orders( $order_id = '' ) { 802 806 Checkview_Admin_Logs::add( 'ip-logs', 'Deleting CheckView orders from the database...' ); 803 807
Note: See TracChangeset
for help on using the changeset viewer.