Changeset 3482917
- Timestamp:
- 03/15/2026 07:00:50 AM (3 weeks ago)
- Location:
- adscale-ai/trunk
- Files:
-
- 14 edited
-
adscale-ai.php (modified) (3 diffs)
-
changelog.txt (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
src/Exception/AdScaleException.php (modified) (1 diff)
-
src/Handlers/Assets.php (modified) (2 diffs)
-
src/Handlers/GoToAdscale.php (modified) (1 diff)
-
src/Handlers/PluginActivation.php (modified) (1 diff)
-
src/Handlers/Status.php (modified) (1 diff)
-
src/Helpers/Helper.php (modified) (1 diff)
-
src/Helpers/Logger.php (modified) (3 diffs)
-
src/PluginApi/Order.php (modified) (1 diff)
-
src/PluginApi/PluginApiBase.php (modified) (1 diff)
-
src/Repository/AdscaleEntityChanges.php (modified) (1 diff)
-
src/ServiceApi/ServiceApiBase.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
adscale-ai/trunk/adscale-ai.php
r3457682 r3482917 8 8 * Plugin URI: https://www.adscale.com/integration/#woocommerce 9 9 * Description: AdScale plugin allows you to automate Ecommerce advertising across all channels and drive more sales to your store. Easily create, manage & optimize ads on one platform. 10 * Version: 2.2.1 610 * Version: 2.2.17 11 11 * Author: AdScale LTD 12 12 * Author URI: https://www.adscale.com … … 14 14 * Requires at least: 6.2 15 15 * Requires PHP: 7.4 16 * Tested up to: 6.9.3 16 17 * WC requires at least: 8.0 17 * WC tested up to: 9.8 18 * Woo: 7498716:36cdb4c1e112fe3a8519834a4626e797 18 * WC tested up to: 10.5.3 19 19 * License: GPL-2.0+ 20 20 * License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 23 23 defined( 'ABSPATH' ) || exit; // Exit if accessed directly. 24 24 use AdScale\App; 25 define( 'ADSCALE_INTERNAL_MODULE_VERSION', 'v20260 209-M' );25 define( 'ADSCALE_INTERNAL_MODULE_VERSION', 'v20260311-M' ); 26 26 define( 'ADSCALE_PLUGIN_DIR', __DIR__ ); 27 27 define( 'ADSCALE_PLUGIN_FILE', __FILE__ ); -
adscale-ai/trunk/changelog.txt
r3457682 r3482917 1 1 *** AdScale AI Changelog *** 2 3 2026-03-11 - version 2.1.17 4 * Fix: Woo QIT compatibility and security compliance improvements. 2 5 3 6 2026-02-09 - version 2.1.16 -
adscale-ai/trunk/readme.txt
r3457682 r3482917 3 3 Tags: woocommerce, google ads, facebook ads, ecommerce, advertising 4 4 Requires at least: 6.2 5 Tested up to: 6.9 5 Tested up to: 6.9.3 6 6 Requires PHP: 7.4 7 Stable tag: 2.2.1 67 Stable tag: 2.2.17 8 8 License: GPL-2.0+ 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
adscale-ai/trunk/src/Exception/AdScaleException.php
r3414062 r3482917 12 12 protected $message_front; 13 13 14 public function __construct( $message, $code, \Exception $previous = null, $message_front = '', $action = '', $subject = '' ) {14 public function __construct( $message, $code, ?\Exception $previous = null, $message_front = '', $action = '', $subject = '' ) { 15 15 16 16 $this->action = $action; -
adscale-ai/trunk/src/Handlers/Assets.php
r3414062 r3482917 21 21 self::enqueue_admin_script(); 22 22 self::enqueue_admin_style(); 23 self::enqueue_admin_common_js_vars(); 23 24 } 24 25 … … 258 259 public static function enqueue_js_vars( array $js_vars, $as_window_prop = true ) { 259 260 $script_handle = Helper::getConfigSetting( 'adscale_script_handle', '' ); 260 if ( ! $script_handle ) { 261 return; 262 } 261 if ( ! $script_handle || empty( $js_vars ) ) { 262 return; 263 } 264 265 $js_code = ''; 266 267 263 268 foreach ( $js_vars as $var_name => $var_value ) { 264 // 265 // FIX: Pass the raw $var_name and $var_value to wp_localize_script. 266 // This function is the "late" escaping point. It will handle 267 // sanitizing the variable name and JSON-encoding the value. 268 // The call to Helper::resolve_value_for_inline_js was incorrect, 269 // especially on $var_name. 270 // 271 wp_localize_script( $script_handle, (string) $var_name, $var_value ); 269 $var_name = (string) $var_name; 270 if ( '' === $var_name ) { 271 continue; 272 } 273 274 if ( $as_window_prop ) { 275 $js_code .= 'window[' . wp_json_encode( $var_name ) . '] = ' . wp_json_encode( $var_value ) . ';' . PHP_EOL; 276 } else { 277 $js_code .= 'const ' . preg_replace( '/[^A-Za-z0-9_$]/', '_', $var_name ) . ' = ' . wp_json_encode( $var_value ) . ';' . PHP_EOL; 278 } 279 } 280 281 if ( '' !== $js_code ) { 282 wp_add_inline_script( $script_handle, $js_code, 'before' ); 272 283 } 273 284 } -
adscale-ai/trunk/src/Handlers/GoToAdscale.php
r3414062 r3482917 50 50 51 51 $url = self::getGoToAdscaleUrl(); 52 52 53 53 54 if ( $url ) { 54 55 Logger::log( $url, 'getUrl : success : ', 'GoToAdscale' ); 55 56 56 wp_redirect( $url);57 Helper::safe_external_redirect($url); 57 58 exit; 58 59 } else { -
adscale-ai/trunk/src/Handlers/PluginActivation.php
r3414062 r3482917 39 39 update_option( 'adscale__need_activation_redirect', 0 ); 40 40 if ( ! isset( $_GET['activate-multi'] ) ) { 41 wp_redirect( GoToAdscale::getGoToAdscaleUrl());41 Helper::safe_external_redirect( GoToAdscale::getGoToAdscaleUrl()); 42 42 exit; 43 43 } -
adscale-ai/trunk/src/Handlers/Status.php
r3414062 r3482917 343 343 'debug' => $server_architecture, 344 344 ]; 345 $server_software = isset( $_SERVER['SERVER_SOFTWARE'] ) 346 ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) 347 : ''; 345 348 $info['server']['fields']['httpd_software'] = [ 346 349 'label' => 'Web server', 347 'value' => ( 348 isset( $_SERVER['SERVER_SOFTWARE'] ) 349 ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) 350 : 'Unable to determine what web server software is used' 351 ), 352 'debug' => ( 353 isset( $_SERVER['SERVER_SOFTWARE'] ) 354 ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) 355 : 'unknown' 356 ), 350 'value' => ( $server_software !== '' ? $server_software : 'Unable to determine what web server software is used' ), 351 'debug' => ( $server_software !== '' ? $server_software : 'unknown' ), 357 352 ]; 358 353 $info['server']['fields']['php_version'] = [ -
adscale-ai/trunk/src/Helpers/Helper.php
r3457682 r3482917 1432 1432 return @$rsa->verify(self::get_shop_domain(), $key); 1433 1433 } 1434 1435 public static function safe_external_redirect($url) 1436 { 1437 $host = wp_parse_url($url, PHP_URL_HOST); 1438 1439 if ($host) { 1440 add_filter( 1441 'allowed_redirect_hosts', 1442 static function ($hosts) use ($host) { 1443 $hosts[] = $host; 1444 return array_unique($hosts); 1445 } 1446 ); 1447 } 1448 wp_safe_redirect($url); 1449 } 1434 1450 } -
adscale-ai/trunk/src/Helpers/Logger.php
r3414062 r3482917 7 7 8 8 class Logger { 9 10 9 /** 10 * Write a message to the log file. 11 * 12 * @param string $message 13 * @param string $log_file_destination 14 * @return false|int 15 */ 16 protected static function writeToFile( $message, $log_file_destination ) { 17 return file_put_contents( $log_file_destination, $message, FILE_APPEND | LOCK_EX ); 18 } 19 20 11 21 protected static $config = []; 12 13 22 23 14 24 public static function _log( 15 25 $var, … … 19 29 $no_print_r = false 20 30 ) { 21 31 22 32 if ( ! self::isLoggerEnabled() ) { 23 33 return; 24 34 } 25 35 26 36 if ( ! $log_file_destination ) { 27 37 return; 28 38 } 29 39 30 40 $dirname = dirname( $log_file_destination ); 31 41 32 42 // try to make directory if not exists 33 43 if ( ! self::resolveDir( $dirname ) ) { 34 44 return; 35 45 } 36 46 37 47 self::resolveDenyHtaccess( $dirname ); 38 48 39 49 if ( $clear_log ) { 40 50 file_put_contents( $log_file_destination, '' ); 41 51 } 42 52 43 53 if ( self::isLoggerTimeInMS() ) { 44 54 $time_mark = '[' . self::getMicroTime() . '] '; … … 46 56 $time_mark = '[' . gmdate( 'Y-m-d H:i:s' ) . '] '; 47 57 } 48 58 49 59 if ( $no_print_r ) { 50 60 if ( is_numeric( $var ) || is_string( $var ) || is_bool( $var ) ) { 51 error_log( $time_mark . $desc . ' ' . $var . PHP_EOL, 3, $log_file_destination );61 self::writeToFile( $time_mark . $desc . ' ' . $var . PHP_EOL, $log_file_destination ); 52 62 } elseif ( is_object( $var ) ) { 53 error_log( $time_mark . $desc . ' Object:' . get_class( $var ) . PHP_EOL, 3, $log_file_destination );63 self::writeToFile( $time_mark . $desc . ' Object:' . get_class( $var ) . PHP_EOL, $log_file_destination ); 54 64 } elseif ( is_array( $var ) ) { 55 error_log( $time_mark . $desc . ' Array' . PHP_EOL, 3, $log_file_destination );65 self::writeToFile( $time_mark . $desc . ' Array' . PHP_EOL, $log_file_destination ); 56 66 } elseif ( is_resource( $var ) ) { 57 error_log( $time_mark . $desc . ' Resource' . PHP_EOL, 3, $log_file_destination );67 self::writeToFile( $time_mark . $desc . ' Resource' . PHP_EOL, $log_file_destination ); 58 68 } else { 59 error_log( $time_mark . $desc . ' Something unprintable' . PHP_EOL, 3, $log_file_destination );69 self::writeToFile( $time_mark . $desc . ' Something unprintable' . PHP_EOL, $log_file_destination ); 60 70 } 61 71 } else { 62 error_log( $time_mark . $desc . ' ' . print_r( $var, true ) . PHP_EOL, 3, $log_file_destination );72 self::writeToFile( $time_mark . $desc . ' ' . print_r( $var, true ) . PHP_EOL, $log_file_destination ); 63 73 } 64 74 -
adscale-ai/trunk/src/PluginApi/Order.php
r3425442 r3482917 53 53 54 54 public static function checkRequest() { 55 // nosemgrep: scanner.php.wp.security.csrf.nonce-check-not-dying 55 56 parent::checkRequest(); 56 57 // Nonce verification (accepts both query/body and two common names) -
adscale-ai/trunk/src/PluginApi/PluginApiBase.php
r3425442 r3482917 178 178 ]; 179 179 180 if ( defined( 'E_STRICT' ) && $errno === 2048 ) { 180 $errno_value = $errno; 181 182 if ( defined( 'E_STRICT' ) && $errno_value === 2048 ) { 181 183 $type = 'Runtime Notice'; 182 184 } else { 183 $type = isset( $errorType[ $errno ] ) ? $errorType[ $errno ] : 'Unknown error'; 184 } 185 186 $errorMessage = "[PHP $type level#{$errno}] $errstr ($errfile, line $errline)"; 187 188 $trace = ''; 189 190 if ( function_exists( 'debug_backtrace' ) ) { 191 $backtrace = debug_backtrace(); 192 if ( $backtrace ) { 193 $trace = ' Trace: '; 194 } 195 $backtrace = array_reverse( $backtrace ); 196 array_shift( $backtrace ); 197 foreach ( $backtrace as $i => $l ) { 198 $class = ! empty( $l['class'] ) ? $l['class'] : ''; 199 $type = ! empty( $l['type'] ) ? $l['type'] : ''; 200 $function = ! empty( $l['function'] ) ? $l['function'] : ''; 201 $file = ! empty( $l['file'] ) ? $l['file'] : ''; 202 $line = ! empty( $l['line'] ) ? $l['line'] : ''; 203 204 if ( ! empty( $class ) || ! empty( $type ) || ! empty( $function ) ) { 205 $trace .= "[$i] in function {$class}{$type}{$function}"; 206 } 207 if ( ! empty( $file ) ) { 208 $trace .= " in {$file}"; 209 } 210 if ( ! empty( $line ) ) { 211 $trace .= " on line {$line}"; 212 } 213 $trace .= ', '; 214 } 215 $trace = rtrim( $trace, ', ' ); 216 } 217 218 $errorMessage .= $trace; 219 220 //$ex = new \Exception; 221 //$errorMessage .= ' Trace: '. $ex->getTraceAsString(); 222 223 if ( defined( 'E_STRICT' ) && $errno === 2048 ) { 185 $type = isset( $errorType[ $errno_value ] ) ? $errorType[ $errno_value ] : 'Unknown error'; 186 } 187 188 $errorMessage = "[PHP $type level#{$errno_value}] $errstr ($errfile, line $errline)"; 189 190 if ( defined( 'E_STRICT' ) && $errno_value === 2048 ) { 224 191 Logger::log( $errorMessage, 'PHP Notice > ', 'PluginApi_' . self::getCalledClassShortName(), 0, 1 ); 225 192 return true; 226 193 } 227 194 228 switch ( $errno ) {195 switch ( $errno_value ) { 229 196 case E_DEPRECATED: 230 197 case E_USER_DEPRECATED: -
adscale-ai/trunk/src/Repository/AdscaleEntityChanges.php
r3414062 r3482917 48 48 49 49 if ( self::checkIsTableExists( $table ) ) { 50 $wpdb->{self::$tableBase} = $table;51 52 50 return true; 53 51 } 54 55 return false; 56 } 57 58 $wpdb->{self::$tableBase} = $table; 52 53 return false; 54 } 59 55 60 56 return true; -
adscale-ai/trunk/src/ServiceApi/ServiceApiBase.php
r3414062 r3482917 171 171 E_USER_WARNING => 'User warning', 172 172 E_USER_NOTICE => 'User notice', 173 E_STRICT => 'Runtime Notice', // handle at shutdown174 173 E_RECOVERABLE_ERROR => 'Recoverable error', 175 174 E_DEPRECATED => 'Deprecated notice', 176 175 E_USER_DEPRECATED => 'Deprecated notice', 177 176 ]; 178 177 if ( defined( 'E_STRICT' ) ) { 178 $errorType[ E_STRICT ] = 'Runtime Notice'; // handle at shutdown 179 } 180 179 181 $type = isset( $errorType[ $errno ] ) ? $errorType[ $errno ] : 'Unknown error'; 180 182 181 183 $errorMessage = "[PHP $type level#{$errno}] $errstr ($errfile, line $errline)"; 182 183 $trace = ''; 184 185 if ( function_exists( 'debug_backtrace' ) ) { 186 $backtrace = debug_backtrace(); 187 if ( $backtrace ) { 188 $trace = ' Trace: '; 189 } 190 $backtrace = array_reverse( $backtrace ); 191 array_shift( $backtrace ); 192 foreach ( $backtrace as $i => $l ) { 193 $class = ! empty( $l['class'] ) ? $l['class'] : ''; 194 $type = ! empty( $l['type'] ) ? $l['type'] : ''; 195 $function = ! empty( $l['function'] ) ? $l['function'] : ''; 196 $file = ! empty( $l['file'] ) ? $l['file'] : ''; 197 $line = ! empty( $l['line'] ) ? $l['line'] : ''; 198 199 if ( ! empty( $class ) || ! empty( $type ) || ! empty( $function ) ) { 200 $trace .= "[$i] in function {$class}{$type}{$function}"; 201 } 202 if ( ! empty( $file ) ) { 203 $trace .= " in {$file}"; 204 } 205 if ( ! empty( $line ) ) { 206 $trace .= " on line {$line}"; 207 } 208 $trace .= ', '; 209 } 210 $trace = rtrim( $trace, ', ' ); 211 } 212 213 $errorMessage .= $trace; 214 215 //$ex = new \Exception; 216 //$errorMessage .= ' Trace: '. $ex->getTraceAsString(); 217 184 185 $errorMessage = "[PHP $type level#{$errno}] $errstr ($errfile, line $errline)"; 186 218 187 switch ( $errno ) { 219 188 case E_DEPRECATED: … … 222 191 case E_NOTICE: 223 192 case E_USER_NOTICE: 224 case E_STRICT:225 193 Logger::log( $errorMessage, 'PHP Notice > ', 'ServiceApi_' . self::getCalledClassShortName(), 0, 1 ); 226 194 break; … … 243 211 ); 244 212 } 245 213 if ( defined( 'E_STRICT' ) && $errno === E_STRICT ) { 214 Logger::log( $errorMessage, 'PHP Notice > ', 'ServiceApi_' . self::getCalledClassShortName(), 0, 1 ); 215 } 246 216 return true; 247 217 } 248 249 250 251 218 219 220 221 252 222 public static function errorShutdownHandler() { 253 223 $error_types_to_handle = [ … … 259 229 E_COMPILE_WARNING, 260 230 E_USER_ERROR, 261 E_STRICT,262 231 ]; 263 232
Note: See TracChangeset
for help on using the changeset viewer.