Plugin Directory

Changeset 3482917


Ignore:
Timestamp:
03/15/2026 07:00:50 AM (3 weeks ago)
Author:
assafadscale
Message:

Woocommerce marketplace changes

Location:
adscale-ai/trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • adscale-ai/trunk/adscale-ai.php

    r3457682 r3482917  
    88 * Plugin URI: https://www.adscale.com/integration/#woocommerce
    99 * 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.16
     10 * Version: 2.2.17
    1111 * Author: AdScale LTD
    1212 * Author URI: https://www.adscale.com
     
    1414 * Requires at least: 6.2
    1515 * Requires PHP: 7.4
     16 * Tested up to: 6.9.3
    1617 * 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
    1919 * License: GPL-2.0+
    2020 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2323defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
    2424use AdScale\App;
    25 define( 'ADSCALE_INTERNAL_MODULE_VERSION', 'v20260209-M' );
     25define( 'ADSCALE_INTERNAL_MODULE_VERSION', 'v20260311-M' );
    2626define( 'ADSCALE_PLUGIN_DIR', __DIR__ );
    2727define( 'ADSCALE_PLUGIN_FILE', __FILE__ );
  • adscale-ai/trunk/changelog.txt

    r3457682 r3482917  
    11*** AdScale AI Changelog ***
     2
     32026-03-11 - version 2.1.17
     4* Fix: Woo QIT compatibility and security compliance improvements.
    25
    362026-02-09 - version 2.1.16
  • adscale-ai/trunk/readme.txt

    r3457682 r3482917  
    33Tags: woocommerce, google ads, facebook ads, ecommerce, advertising
    44Requires at least: 6.2
    5 Tested up to: 6.9
     5Tested up to: 6.9.3
    66Requires PHP: 7.4
    7 Stable tag: 2.2.16
     7Stable tag: 2.2.17
    88License: GPL-2.0+
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • adscale-ai/trunk/src/Exception/AdScaleException.php

    r3414062 r3482917  
    1212    protected $message_front;
    1313   
    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 = '' ) {
    1515       
    1616        $this->action        = $action;
  • adscale-ai/trunk/src/Handlers/Assets.php

    r3414062 r3482917  
    2121        self::enqueue_admin_script();
    2222        self::enqueue_admin_style();
     23        self::enqueue_admin_common_js_vars();
    2324    }
    2425
     
    258259    public static function enqueue_js_vars( array $js_vars, $as_window_prop = true ) {
    259260        $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
    263268        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' );
    272283        }
    273284    }
  • adscale-ai/trunk/src/Handlers/GoToAdscale.php

    r3414062 r3482917  
    5050       
    5151        $url = self::getGoToAdscaleUrl();
     52
    5253       
    5354        if ( $url ) {
    5455            Logger::log( $url, 'getUrl : success : ', 'GoToAdscale' );
    5556           
    56             wp_redirect( $url );
     57            Helper::safe_external_redirect($url);
    5758            exit;
    5859        } else {
  • adscale-ai/trunk/src/Handlers/PluginActivation.php

    r3414062 r3482917  
    3939            update_option( 'adscale__need_activation_redirect', 0 );
    4040            if ( ! isset( $_GET['activate-multi'] ) ) {
    41                 wp_redirect( GoToAdscale::getGoToAdscaleUrl() );
     41                Helper::safe_external_redirect( GoToAdscale::getGoToAdscaleUrl());
    4242                exit;
    4343            }
  • adscale-ai/trunk/src/Handlers/Status.php

    r3414062 r3482917  
    343343            'debug' => $server_architecture,
    344344        ];
     345        $server_software = isset( $_SERVER['SERVER_SOFTWARE'] )
     346            ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) )
     347            : '';
    345348        $info['server']['fields']['httpd_software']          = [
    346349            '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' ),
    357352        ];
    358353        $info['server']['fields']['php_version']             = [
  • adscale-ai/trunk/src/Helpers/Helper.php

    r3457682 r3482917  
    14321432        return @$rsa->verify(self::get_shop_domain(), $key);
    14331433    }
     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    }
    14341450}
  • adscale-ai/trunk/src/Helpers/Logger.php

    r3414062 r3482917  
    77
    88class 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
    1121    protected static $config = [];
    12    
    13    
     22
     23
    1424    public static function _log(
    1525        $var,
     
    1929        $no_print_r = false
    2030    ) {
    21        
     31
    2232        if ( ! self::isLoggerEnabled() ) {
    2333            return;
    2434        }
    25        
     35
    2636        if ( ! $log_file_destination ) {
    2737            return;
    2838        }
    29        
     39
    3040        $dirname = dirname( $log_file_destination );
    31        
     41
    3242        // try to make directory if not exists
    3343        if ( ! self::resolveDir( $dirname ) ) {
    3444            return;
    3545        }
    36        
     46
    3747        self::resolveDenyHtaccess( $dirname );
    38        
     48
    3949        if ( $clear_log ) {
    4050            file_put_contents( $log_file_destination, '' );
    4151        }
    42        
     52
    4353        if ( self::isLoggerTimeInMS() ) {
    4454            $time_mark = '[' . self::getMicroTime() . '] ';
     
    4656            $time_mark = '[' . gmdate( 'Y-m-d H:i:s' ) . '] ';
    4757        }
    48        
     58
    4959        if ( $no_print_r ) {
    5060            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 );
    5262            } 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 );
    5464            } 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 );
    5666            } 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 );
    5868            } 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 );
    6070            }
    6171        } 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 );
    6373        }
    6474       
  • adscale-ai/trunk/src/PluginApi/Order.php

    r3425442 r3482917  
    5353   
    5454    public static function checkRequest() {
     55        // nosemgrep: scanner.php.wp.security.csrf.nonce-check-not-dying
    5556        parent::checkRequest();
    5657        // Nonce verification (accepts both query/body and two common names)
  • adscale-ai/trunk/src/PluginApi/PluginApiBase.php

    r3425442 r3482917  
    178178        ];
    179179
    180         if ( defined( 'E_STRICT' ) && $errno === 2048 ) {
     180        $errno_value = $errno;
     181
     182        if ( defined( 'E_STRICT' ) && $errno_value === 2048 ) {
    181183            $type = 'Runtime Notice';
    182184        } 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 ) {
    224191            Logger::log( $errorMessage, 'PHP Notice > ', 'PluginApi_' . self::getCalledClassShortName(), 0, 1 );
    225192            return true;
    226193        }
    227194
    228         switch ( $errno ) {
     195        switch ( $errno_value ) {
    229196            case E_DEPRECATED:
    230197            case E_USER_DEPRECATED:
  • adscale-ai/trunk/src/Repository/AdscaleEntityChanges.php

    r3414062 r3482917  
    4848           
    4949            if ( self::checkIsTableExists( $table ) ) {
    50                 $wpdb->{self::$tableBase} = $table;
    51                
    5250                return true;
    5351            }
    54            
    55             return false;
    56         }
    57        
    58         $wpdb->{self::$tableBase} = $table;
     52
     53            return false;
     54        }
    5955       
    6056        return true;
  • adscale-ai/trunk/src/ServiceApi/ServiceApiBase.php

    r3414062 r3482917  
    171171            E_USER_WARNING      => 'User warning',
    172172            E_USER_NOTICE       => 'User notice',
    173             E_STRICT            => 'Runtime Notice', // handle at shutdown
    174173            E_RECOVERABLE_ERROR => 'Recoverable error',
    175174            E_DEPRECATED        => 'Deprecated notice',
    176175            E_USER_DEPRECATED   => 'Deprecated notice',
    177176        ];
    178        
     177        if ( defined( 'E_STRICT' ) ) {
     178            $errorType[ E_STRICT ] = 'Runtime Notice'; // handle at shutdown
     179        }
     180
    179181        $type = isset( $errorType[ $errno ] ) ? $errorType[ $errno ] : 'Unknown error';
    180        
     182
    181183        $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
    218187        switch ( $errno ) {
    219188            case E_DEPRECATED:
     
    222191            case E_NOTICE:
    223192            case E_USER_NOTICE:
    224             case E_STRICT:
    225193                Logger::log( $errorMessage, 'PHP Notice > ', 'ServiceApi_' . self::getCalledClassShortName(), 0, 1 );
    226194                break;
     
    243211                );
    244212        }
    245        
     213        if ( defined( 'E_STRICT' ) && $errno === E_STRICT ) {
     214            Logger::log( $errorMessage, 'PHP Notice > ', 'ServiceApi_' . self::getCalledClassShortName(), 0, 1 );
     215        }
    246216        return true;
    247217    }
    248    
    249    
    250    
    251    
     218
     219
     220
     221
    252222    public static function errorShutdownHandler() {
    253223        $error_types_to_handle = [
     
    259229            E_COMPILE_WARNING,
    260230            E_USER_ERROR,
    261             E_STRICT,
    262231        ];
    263232       
Note: See TracChangeset for help on using the changeset viewer.