Plugin Directory

Changeset 2947522


Ignore:
Timestamp:
08/04/2023 05:52:51 AM (3 years ago)
Author:
querysolutions
Message:

Fix PHP8.2 deprecation notices

Location:
wpcf7-redirect/tags/3.0.0/classes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wpcf7-redirect/tags/3.0.0/classes/actions/class-wpcf7r-action-send-to-api.php

    r2944825 r2947522  
    4343        $this->clear_error_log( $this->post->id() );
    4444
    45         //always save last call results for debugging
     45        // always save last call results for debugging
    4646        $record        = $this->get_record( $submission, $tags_map, $record_type, $template );
    4747        $record['url'] = $base_url;
     
    8585     * @param $submission
    8686     * @param $tags_map
    87      * @param string $type
    88      * @param string $template
     87     * @param string     $type
     88     * @param string     $template
    8989     */
    9090    function get_record( $submission, $tags_map, $type = 'params', $template = '' ) {
     
    9797                if ( is_array( $qs_cf7_form_key ) ) {
    9898
    99                     //arrange checkbox arrays
     99                    // arrange checkbox arrays
    100100                    if ( isset( $submited_data[ $form_key ] ) ) {
    101101                        $value = apply_filters( 'set_record_value', $submited_data[ $form_key ], $qs_cf7_form_key, $form_key );
     
    106106                    $value = apply_filters( 'set_record_value', $value, $qs_cf7_form_key, $form_key );
    107107
    108                     //flattan radio
     108                    // flattan radio
    109109                    if ( is_array( $value ) ) {
    110110                        $value = reset( $value );
     
    112112                }
    113113
    114                 //set defaults
     114                // set defaults
    115115
    116116                if ( ! $value ) {
     
    121121                            foreach ( $this->defaults[ $form_key ] as $key => $sub_value ) {
    122122                                if ( isset( $this->functions[ $key ] ) && $this->functions[ $key ] ) {
    123                                     $sub_value = $this->run_function( $this->functions[ $key ], $sub_value , $key);
     123                                    $sub_value = $this->run_function( $this->functions[ $key ], $sub_value, $key );
    124124                                }
    125125
     
    141141                if ( isset( $this->functions[ $form_key ] ) && $this->functions[ $form_key ] ) {
    142142
    143                     //dont call the function again on arrays (checkvoxes)
     143                    // dont call the function again on arrays (checkvoxes)
    144144
    145145                    if ( ! is_array( $this->functions[ $form_key ] ) ) {
    146                         $value = $this->run_function( $this->functions[ $form_key ], $value , $form_key );
     146                        $value = $this->run_function( $this->functions[ $form_key ], $value, $form_key );
    147147                    }
    148148                }
     
    152152            }
    153153
    154             //replace special mail tags
     154            // replace special mail tags
    155155
    156156            foreach ( WPCF7R_Form::get_special_mail_tags() as $mail_tag ) {
     
    159159            }
    160160
    161             //clean unchanged tags
     161            // clean unchanged tags
    162162
    163163            $template         = $this->replace_tags( $template );
     
    188188                if ( is_array( $qs_cf7_form_key ) ) {
    189189
    190                     //arrange checkbox arrays
     190                    // arrange checkbox arrays
    191191                    foreach ( $submited_data[ $form_key ] as $value ) {
    192192                        if ( $value ) {
     
    201201                    $value = isset( $submited_data[ $form_key ] ) ? $submited_data[ $form_key ] : '';
    202202
    203                     //flattan radio
     203                    // flattan radio
    204204                    if ( is_array( $value ) && count( $value ) === 1 ) {
    205205                        $value = reset( $value );
     
    223223    public function set_defaults_and_run_functions( $record, $tags_map ) {
    224224
    225         //set default values
     225        // set default values
    226226
    227227        if ( $this->defaults && array_values( $this->defaults ) ) {
     
    234234        }
    235235
    236         //run functions on values
     236        // run functions on values
    237237
    238238        if ( $this->functions && array_values( $this->functions ) ) {
     
    242242
    243243                if ( $function && $field_value ) {
    244                     $record['fields'][ $api_key ] = $this->run_function( $function, $field_value , $api_key );
     244                    $record['fields'][ $api_key ] = $this->run_function( $function, $field_value, $api_key );
    245245                }
    246246            }
     
    256256     * @param $field_value
    257257     */
    258     public function run_function( $function, $field_value , $key ) {
     258    public function run_function( $function, $field_value, $key ) {
    259259
    260260        $function = WPCF7r_Utils::get_available_text_functions( $function, 'all' );
     
    264264            $method = $function[1];
    265265
    266             $file_path = $this->get_file_path($key);
    267            
    268             if( $file_path ){
     266            $file_path = $this->get_file_path( $key );
     267
     268            if ( $file_path ) {
    269269                $field_value = $file_path;
    270270            }
    271             //check if this is a file
    272 
    273             return call_user_func( array( $class, $method ), $field_value , $key );
     271            // check if this is a file
     272
     273            return call_user_func( array( $class, $method ), $field_value, $key );
    274274        }
    275275
     
    277277    }
    278278
    279     private function get_file_path($key){
    280         if( $this->files ){
    281             foreach( $this->files as $file_key => $files ){
    282                 if( $key == $file_key ){
    283                     return reset($files);
     279    private function get_file_path( $key ) {
     280        if ( $this->files ) {
     281            foreach ( $this->files as $file_key => $files ) {
     282                if ( $key == $file_key ) {
     283                    return reset( $files );
    284284                }
    285285            }
     
    291291     * @param $record
    292292     * @param boolean $debug
    293      * @param string $method
    294      * @param string $record_type
     293     * @param string  $method
     294     * @param string  $record_type
    295295     */
    296296    private function send_lead( $record, $debug = false, $method = 'GET', $record_type = 'params' ) {
     
    380380            $url  = apply_filters( 'qs_cf7_api_post_url', $url );
    381381            $url  = $this->replace_tags( $url );
    382            
     382
    383383            $result = wp_remote_request( $url, $args );
    384384        }
     
    421421    }
    422422}
    423 
  • wpcf7-redirect/tags/3.0.0/classes/class-wpcf7r-action.php

    r2944825 r2947522  
    9393    private $wpcf7_submission;
    9494
     95    /**
     96     * Hold the action id.
     97     *
     98     * @var [int]
     99     */
     100    public $action_id;
     101   
    95102    /**
    96103     * Class constructor
  • wpcf7-redirect/tags/3.0.0/classes/class-wpcf7r-settings.php

    r2944825 r2947522  
    2525     */
    2626    private $page_slug;
     27
     28    /**
     29     * Fields array.
     30     *
     31     * @var [type]
     32     */
     33    public $fields;
    2734
    2835    public function __construct() {
Note: See TracChangeset for help on using the changeset viewer.