Plugin Directory

Changeset 3379088


Ignore:
Timestamp:
10/15/2025 06:42:48 PM (5 months ago)
Author:
w3scloud
Message:

Some php error and warning fixing

Location:
w3swoozoho/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • w3swoozoho/trunk/inc/Admin.php

    r3154946 r3379088  
    7070                'updating'                        => __( 'Updating Plugin: %s', 'w3swoozoho' ),
    7171                'oops'                            => __( 'Something went wrong with the plugin API.', 'w3swoozoho' ),
     72                /* translators: 1: plugin name(s). */
    7273                'notice_can_install_required'     => _n_noop(
    73                     /* translators: 1: plugin name(s). */
    7474                    'This theme requires the following plugin: %1$s.',
    7575                    'This theme requires the following plugins: %1$s.',
    7676                    'w3swoozoho'
    7777                ),
     78                /* translators: 1: plugin name(s). */
    7879                'notice_can_install_recommended'  => _n_noop(
    79                     /* translators: 1: plugin name(s). */
    8080                    'This theme recommends the following plugin: %1$s.',
    8181                    'This theme recommends the following plugins: %1$s.',
    8282                    'w3swoozoho'
    8383                ),
     84                /* translators: 1: plugin name(s). */
    8485                'notice_ask_to_update'            => _n_noop(
    85                     /* translators: 1: plugin name(s). */
    8686                    'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
    8787                    'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
    8888                    'w3swoozoho'
    8989                ),
     90                /* translators: 1: plugin name(s). */
    9091                'notice_ask_to_update_maybe'      => _n_noop(
    91                     /* translators: 1: plugin name(s). */
    9292                    'There is an update available for: %1$s.',
    9393                    'There are updates available for the following plugins: %1$s.',
    9494                    'w3swoozoho'
    9595                ),
     96                /* translators: 1: plugin name(s). */
    9697                'notice_can_activate_required'    => _n_noop(
    97                     /* translators: 1: plugin name(s). */
    9898                    'The following required plugin is currently inactive: %1$s.',
    9999                    'The following required plugins are currently inactive: %1$s.',
    100100                    'w3swoozoho'
    101101                ),
     102                /* translators: 1: plugin name(s). */
    102103                'notice_can_activate_recommended' => _n_noop(
    103                     /* translators: 1: plugin name(s). */
    104104                    'The following recommended plugin is currently inactive: %1$s.',
    105105                    'The following recommended plugins are currently inactive: %1$s.',
  • w3swoozoho/trunk/inc/Admin/Settings/Authorize.php

    r3154946 r3379088  
    3434            return;
    3535        }
    36 
     36        // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    3737        if ( ! isset( $_GET['code'] ) || ! isset( $_GET['accounts-server'] ) ) {
    3838            return;
     
    4242        $upload_dir      = trailingslashit( $upload['basedir'] );
    4343        $log             = $upload_dir . 'ZCRMClientLibrary.log';
    44         $code            = sanitize_text_field( $_GET['code'] );
    4544        $redirect_url    = admin_url( 'admin.php?page=w3swoozoho_settings' );
    46         $account_url     = esc_url( $_GET['accounts-server'] );
    47         $server_location = sanitize_text_field( $_GET['location'] );
     45        // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     46        $code = sanitize_text_field( wp_unslash( $_GET['code'] ) );
     47        // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     48        $accounts_server = esc_url_raw( wp_unslash( $_GET['accounts-server'] ) );
     49        // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     50        $server_location = isset( $_GET['location'] ) ? sanitize_text_field( wp_unslash( $_GET['location'] ) ) : '';
    4851        $reflector       = new \ReflectionClass( CRMOAuthPersistence::class );
    4952        $auth_class_path = $reflector->getFileName();
    5053
    51         if ( ! file_exists( $log ) ) {
    52             touch( $log );
     54        require_once ABSPATH . 'wp-admin/includes/file.php';
     55        WP_Filesystem();
     56        global $wp_filesystem;
     57
     58        // Create the log file if it doesn’t exist.
     59        if ( ! $wp_filesystem->exists( $log ) ) {
     60            $wp_filesystem->put_contents( $log, '', FS_CHMOD_FILE );
     61        } else {
     62            // WordPress 6.2+ supports touch() through WP_Filesystem_Direct.
     63            if ( method_exists( $wp_filesystem, 'touch' ) ) {
     64                $wp_filesystem->touch( $log );
     65            }
    5366        }
    5467
     68       
    5569        switch ( $server_location ) {
    5670            case 'us':
     
    107121     */
    108122    public function show_notice() {
     123        // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    109124        if ( ! isset( $_GET['authorized'] ) ) {
    110125            return;
    111126        }
     127        // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash
    112128        if ( sanitize_text_field( $_GET['authorized'] ) == 'true' ) {
    113129            Notice::success( 'Authorization Successful! ' );
  • w3swoozoho/trunk/inc/Zoho/Auth/CRMOAuthPersistence.php

    r3154946 r3379088  
    2727            self::deleteOAuthTokens( $zohoOAuthTokens->getUserEmailId() );
    2828
    29             $inserted = $wpdb->insert(
    30                 $wpdb->prefix . 'w3swoozoho_auths',
    31                 array(
    32                     'useridentifier' => $zohoOAuthTokens->getUserEmailId(),
    33                     'accesstoken'    => $zohoOAuthTokens->getAccessToken(),
    34                     'refreshtoken'   => $zohoOAuthTokens->getRefreshToken(),
    35                     'expirytime'     => $zohoOAuthTokens->getExpiryTime(),
    36                 ),
    37                 array(
    38                     '%s',
    39                     '%s',
    40                     '%s',
    41                     '%d',
    42                 )
    43             );
     29
     30                $inserted = $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
     31                    $wpdb->prefix . 'w3swoozoho_auths',
     32                    array(
     33                        'useridentifier' => sanitize_email( $zohoOAuthTokens->getUserEmailId() ),
     34                        'accesstoken'    => sanitize_text_field( $zohoOAuthTokens->getAccessToken() ),
     35                        'refreshtoken'   => sanitize_text_field( $zohoOAuthTokens->getRefreshToken() ),
     36                        'expirytime'     => absint( $zohoOAuthTokens->getExpiryTime() ),
     37                    ),
     38                    array(
     39                        '%s',
     40                        '%s',
     41                        '%s',
     42                        '%d',
     43                    )
     44                );
    4445
    4546            if ( ! $inserted ) {
     
    6465        $o_auth_tokens = new ZohoOAuthTokens();
    6566        try {
    66             $result_array = $wpdb->get_results(
    67                 $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}w3swoozoho_auths WHERE useridentifier=%s", $userEmailId )
     67            $result_array = $wpdb->get_results( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
     68                $wpdb->prepare(
     69                    "SELECT * FROM {$wpdb->prefix}w3swoozoho_auths WHERE useridentifier = %s",
     70                    $userEmailId
     71                )
    6872            );
     73
    6974            if ( ! $result_array ) {
    7075                Logger::severe( 'Getting result set failed:' );
     
    9398        global $wpdb;
    9499        try {
    95             $deleted = $wpdb->delete(
     100            $deleted = $wpdb->delete( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    96101                $wpdb->prefix . 'w3swoozoho_auths',
    97102                array( 'useridentifier' => $userEmailId ),
  • w3swoozoho/trunk/inc/Zoho/Settings_API.php

    r3154946 r3379088  
    77 */
    88class Settings_API {
    9 
    109    /**
    1110     * settings sections array
     
    101100            if ( isset( $section['desc'] ) && ! empty( $section['desc'] ) ) {
    102101                $section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
    103                 $callback        = function() use ( $section ) {
    104                     echo str_replace( '"', '\"', $section['desc'] );
     102
     103                $callback = function() use ( $section ) {
     104                    echo wp_kses_post( $section['desc'] );
    105105                };
    106106            } elseif ( isset( $section['callback'] ) ) {
     
    116116        foreach ( $this->settings_fields as $section => $field ) {
    117117            foreach ( $field as $option ) {
    118 
    119118                $name     = $option['name'];
    120119                $type     = isset( $option['type'] ) ? $option['type'] : 'text';
     
    171170     */
    172171    function callback_text( $args ) {
    173 
     172        // Escape attributes
    174173        $value       = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
    175         $size        = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
    176         $type        = isset( $args['type'] ) ? $args['type'] : 'text';
    177         $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
    178 
    179         $html  = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder );
    180         $html .= $this->get_field_description( $args );
    181 
    182         echo $html;
     174        $size        = isset( $args['size'] ) && ! is_null( $args['size'] ) ? esc_attr( $args['size'] ) : 'regular';
     175        $type        = isset( $args['type'] ) ? esc_attr( $args['type'] ) : 'text';
     176        $section     = esc_attr( $args['section'] );
     177        $id          = esc_attr( $args['id'] );
     178        $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . esc_attr( $args['placeholder'] ) . '"';
     179
     180        printf(
     181            '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>%7$s',
     182            esc_attr( $type ),
     183            esc_attr( $size ),
     184            esc_attr( $section ),
     185            esc_attr( $id ),
     186            esc_attr( $value ),
     187            esc_attr($placeholder),
     188            wp_kses_post( $this->get_field_description( $args ) )
     189        );
     190
    183191    }
    184192
     
    206214        $step        = ( $args['step'] == '' ) ? '' : ' step="' . $args['step'] . '"';
    207215
    208         $html  = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step );
    209         $html .= $this->get_field_description( $args );
    210 
    211         echo $html;
     216        // Output directly with escaping
     217        printf(
     218            '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>%10$s',
     219            esc_attr($type),
     220            esc_attr($size),
     221            esc_attr($section),
     222            esc_attr($id),
     223            esc_attr($value),
     224            esc_attr($placeholder),
     225            esc_attr($min),
     226            esc_attr($max),
     227            esc_attr($step),
     228            wp_kses_post( $this->get_field_description( $args ) )
     229        );
    212230    }
    213231
     
    218236     */
    219237    function callback_checkbox( $args ) {
    220 
    221238        $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
    222239
     
    227244        $html .= sprintf( '%1$s</label>', $args['desc'] );
    228245        $html .= '</fieldset>';
    229 
     246       
     247        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    230248        echo $html;
    231249    }
     
    237255     */
    238256    function callback_multicheck( $args ) {
    239 
    240257        $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
    241258        $html  = '<fieldset>';
     
    250267        $html .= $this->get_field_description( $args );
    251268        $html .= '</fieldset>';
    252 
     269        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    253270        echo $html;
    254271    }
     
    260277     */
    261278    function callback_radio( $args ) {
    262 
    263279        $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
    264280        $html  = '<fieldset>';
     
    272288        $html .= $this->get_field_description( $args );
    273289        $html .= '</fieldset>';
    274 
     290        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    275291        echo $html;
    276292    }
     
    282298     */
    283299    function callback_select( $args ) {
    284 
    285300        $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
    286301        $size  = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
     
    293308        $html .= sprintf( '</select>' );
    294309        $html .= $this->get_field_description( $args );
    295 
     310        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    296311        echo $html;
    297312    }
     
    303318     */
    304319    function callback_textarea( $args ) {
    305 
    306320        $value       = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
    307321        $size        = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
     
    310324        $html  = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value );
    311325        $html .= $this->get_field_description( $args );
    312 
     326        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    313327        echo $html;
    314328    }
     
    321335     */
    322336    function callback_html( $args ) {
     337        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    323338        echo $this->get_field_description( $args );
    324339    }
     
    330345     */
    331346    function callback_wysiwyg( $args ) {
    332 
    333347        $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
    334348        $size  = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : '500px';
    335349
    336         echo '<div style="max-width: ' . $size . ';">';
     350        echo '<div style="max-width: ' . esc_attr($size) . ';">';
    337351
    338352        $editor_settings = array(
     
    349363
    350364        echo '</div>';
    351 
     365        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    352366        echo $this->get_field_description( $args );
    353367    }
     
    359373     */
    360374    function callback_file( $args ) {
    361 
    362375        $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
    363376        $size  = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
    364377        $id    = $args['section'] . '[' . $args['id'] . ']';
    365         $label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File' );
     378        $label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __('Choose File', 'w3swoozoho');
    366379
    367380        $html  = sprintf( '<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
    368381        $html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />';
    369382        $html .= $this->get_field_description( $args );
    370 
     383        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    371384        echo $html;
    372385    }
     
    378391     */
    379392    function callback_password( $args ) {
    380 
    381393        $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
    382394        $size  = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
     
    384396        $html  = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
    385397        $html .= $this->get_field_description( $args );
    386 
     398        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    387399        echo $html;
    388400    }
     
    394406     */
    395407    function callback_color( $args ) {
    396 
    397408        $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
    398409        $size  = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
     
    400411        $html  = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
    401412        $html .= $this->get_field_description( $args );
    402 
    403         echo $html;
    404     }
    405 
     413        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     414        echo $html;
     415    }
    406416
    407417    /**
     
    411421     */
    412422    function callback_pages( $args ) {
    413 
    414423        $dropdown_args = array(
    415424            'selected' => esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ),
     
    418427            'echo'     => 0,
    419428        );
     429        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    420430        $html          = wp_dropdown_pages( $dropdown_args );
     431   
     432        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    421433        echo $html;
    422434    }
     
    428440     */
    429441    function sanitize_options( $options ) {
    430 
    431442        if ( ! $options ) {
    432443            return $options;
     
    482493     */
    483494    function get_option( $option, $section, $default = '' ) {
    484 
    485495        $options = get_option( $section );
    486496
     
    512522
    513523        $html .= '</h2>';
    514 
     524        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    515525        echo $html;
    516526    }
     
    525535        <div class="metabox-holder">
    526536            <?php foreach ( $this->settings_sections as $form ) { ?>
    527                 <div id="<?php echo $form['id']; ?>" class="group" style="display: none;">
     537                <div id="<?php echo esc_attr( $form['id'] ); ?>" class="group" style="display: none;">
    528538                    <form method="post" action="options.php">
    529539                        <?php
     
    578588                    $('.group:first').fadeIn();
    579589                }
     590
    580591                $('.group .collapsed').each(function(){
    581592                    $(this).find('input:checked').parent().parent().parent().nextAll().each(
     
    585596                            return false;
    586597                        }
     598
    587599                        $(this).filter('.hidden').removeClass('hidden');
    588600                    });
     
    591603                if (activetab != '' && $(activetab + '-tab').length ) {
    592604                    $(activetab + '-tab').addClass('nav-tab-active');
    593                 }
    594                 else {
     605                } else {
    595606                    $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
    596607                }
     608
    597609                $('.nav-tab-wrapper a').click(function(evt) {
    598610                    $('.nav-tab-wrapper a').removeClass('nav-tab-active');
     
    602614                        localStorage.setItem("activetab", $(this).attr('href'));
    603615                    }
     616
    604617                    $('.group').hide();
    605618                    $(clicked_group).fadeIn();
  • w3swoozoho/trunk/lib/class-tgm-plugin-activation.php

    r3154949 r3379088  
    11<?php
     2// phpcs:ignoreFile
    23/**
    34 * Plugin installation and activation for WordPress themes.
     
    339340                'updating'                        => __( 'Updating Plugin: %s', 'tgmpa' ),
    340341                'oops'                            => __( 'Something went wrong with the plugin API.', 'tgmpa' ),
     342                /* translators: 1: plugin name(s). */
    341343                'notice_can_install_required'     => _n_noop(
    342                     /* translators: 1: plugin name(s). */
    343344                    'This theme requires the following plugin: %1$s.',
    344345                    'This theme requires the following plugins: %1$s.',
    345346                    'tgmpa'
    346347                ),
     348                /* translators: 1: plugin name(s). */
    347349                'notice_can_install_recommended'  => _n_noop(
    348                     /* translators: 1: plugin name(s). */
    349350                    'This theme recommends the following plugin: %1$s.',
    350351                    'This theme recommends the following plugins: %1$s.',
    351352                    'tgmpa'
    352353                ),
     354                /* translators: 1: plugin name(s). */
    353355                'notice_ask_to_update'            => _n_noop(
    354                     /* translators: 1: plugin name(s). */
    355356                    'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
    356357                    'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
    357358                    'tgmpa'
    358359                ),
     360                /* translators: 1: plugin name(s). */
    359361                'notice_ask_to_update_maybe'      => _n_noop(
    360                     /* translators: 1: plugin name(s). */
    361362                    'There is an update available for: %1$s.',
    362363                    'There are updates available for the following plugins: %1$s.',
    363364                    'tgmpa'
    364365                ),
     366                /* translators: 1: plugin name(s). */
    365367                'notice_can_activate_required'    => _n_noop(
    366                     /* translators: 1: plugin name(s). */
    367368                    'The following required plugin is currently inactive: %1$s.',
    368369                    'The following required plugins are currently inactive: %1$s.',
    369370                    'tgmpa'
    370371                ),
     372                /* translators: 1: plugin name(s). */
    371373                'notice_can_activate_recommended' => _n_noop(
    372                     /* translators: 1: plugin name(s). */
    373374                    'The following recommended plugin is currently inactive: %1$s.',
    374375                    'The following recommended plugins are currently inactive: %1$s.',
  • w3swoozoho/trunk/readme.txt

    r3376531 r3379088  
    44Tags: Zoho CRM, Zoho, W3SCloud, Woocommerce, CRM
    55Requires at least: 5.2
    6 Tested up to: 6.6.2
    7 Stable tag: trunk
     6Tested up to: 6.8
     7Stable tag: 1.3.2
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    2929
    3030= PREMIUM VERSION =
    31 WooCommerce to Zoho CRM Plugin has a Premium version which comes with several additional features.
    32 [Upgrade to Pro version](https://w3scloud.com/ "WooCommerce to Zoho CRM Pro")
     31W3S Connector for WooCommerce and Zoho CRM Plugin has a Premium version which comes with several additional features.
     32[Upgrade to Pro version](https://w3scloud.com/ "W3S Connector for WooCommerce and Zoho CRM Pro")
    3333
    3434= Additional Benefits: =
Note: See TracChangeset for help on using the changeset viewer.