Plugin Directory

Changeset 2632041


Ignore:
Timestamp:
11/18/2021 11:40:41 AM (4 years ago)
Author:
alexx123939
Message:

change saving data method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • crypto-voucher-widget/trunk/cv_widget_image.php

    r2632036 r2632041  
    6161   */
    6262  public function form( $instance ) {
    63       if ( isset( $instance[ 'label' ] ) ) {
    64         $label = esc_attr($instance[ 'label' ]);
    65       }
    66       else {
    67         $label = __( 'Buy Cryptocurrency Directly', 'text_domain' );
    68       } 
     63      $label = ! empty( $instance['label'] ) ? $instance['label'] : __( 'Buy Cryptocurrency Directly', 'text_domain' );
     64      $referenceId = ! empty( $instance['referenceId'] ) ? $instance['referenceId'] : '';
    6965
    70       if ( isset( $istance[ 'referenceId'] ) ) {
    71         $referenceId = esc_attr($instance[ 'referenceId' ]);
    72       } else {
    73         $referenceId = null;
    74       }
     66
     67      register_setting( 'first_tab_options', 'first_tab_items' );
    7568      ?>
    7669      <div
     
    121114   */
    122115  public function update( $new_instance, $old_instance ) {
    123       $instance = array();
    124       $instance['title'] = ( !empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : 'Buy Cryptocurrency Directly';
    125       $instance['referenceId'] = ( !empty( $new_instance['referenceId'] ) ) ? strip_tags( $new_instance['referenceId'] ) : 'null';
    126       $instance['primaryColor'] = ( !empty( $new_instance['primaryColor'] ) ) ? strip_tags( $new_instance['primaryColor'] ) : 'null';
    127       $instance['logo'] = ( !empty( $new_instance['logo'] ) ) ? strip_tags( $new_instance['logo'] ) : 'null';
     116      $instance = $old_instance;
     117      $instance['title'] = ( !empty( $$new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : 'Buy Cryptocurrency Directly';
     118      $instance['referenceId'] = strip_tags( $new_instance['referenceId'] );
     119      $instance['primaryColor'] = strip_tags( $new_instance['primaryColor'] );
     120      $instance['logo'] = strip_tags( $new_instance['logo'] );
    128121
    129122      return $instance;
Note: See TracChangeset for help on using the changeset viewer.