Plugin Directory

Changeset 1703090


Ignore:
Timestamp:
07/26/2017 12:40:13 PM (9 years ago)
Author:
adtechmedia
Message:

fixing configuration area

Location:
adtechmedia/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • adtechmedia/trunk/adtechmedia-optionsmanager.php

    r1703025 r1703090  
    535535        $plugin_meta_data_class = get_class( $this ) . '-data-settings-group';
    536536
    537         // Save Posted Options.
    538         if ( isset( $_POST['option_page'] )
    539             && isset( $_POST['_wpnonce'] )
    540             && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), $main_data_class . '-options' )
    541             && sanitize_text_field( wp_unslash( $_POST['option_page'] ) ) == $main_data_class
    542         ) {
    543             $this->try_to_save_post( $main_data, $_POST );
    544             Adtechmedia_Request::property_update(
    545                 $this->get_plugin_option( 'id' ),
    546                 $this->get_plugin_option( 'support_email' ),
    547                 $this->get_plugin_option( 'country' ),
    548                 $this->get_plugin_option( 'key' )
    549             );
    550             $this->update_prop();
    551         } elseif ( isset( $_POST['option_page'] )
    552             && isset( $_POST['_wpnonce'] )
    553             && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), $plugin_meta_data_class . '-options' )
    554             && sanitize_text_field( wp_unslash( $_POST['option_page'] ) ) == $plugin_meta_data_class
    555         ) {
    556             $this->try_to_save_post( $plugin_meta_data, $_POST );
    557             $this->update_prop();
    558         }
    559 
    560537        Adtechmedia_Plugin::api_to_plugin_options();
    561538        require_once 'views/admin.php';
    562     }
    563 
    564     /**
    565      * Try to save data from request
    566      *
    567      * @param array $options request data.
    568      * @param array $post request data.
    569      */
    570     public function try_to_save_post( $options, $post ) {
    571         if ( null != $options ) {
    572             foreach ( $options as $a_option_key => $a_option_meta ) {
    573                 if ( isset( $post[ $a_option_key ] ) ) {
    574                     $this->update_plugin_option( $a_option_key, $post[ $a_option_key ] );
    575                 }
    576             }
    577         }
    578539    }
    579540
  • adtechmedia/trunk/adtechmedia-plugin.php

    r1703025 r1703090  
    342342
    343343    /**
    344      * Call function update_appearance after activation
    345      */
    346     public function one_update_appearance() {
    347         if ( ! empty( $this->get_plugin_option( 'key' ) ) ) {
    348             $this->update_appearance();
    349             $this->add_plugin_option( 'updated_appearance', 1 );
    350         }
    351         wp_die();
    352     }
    353 
    354     /**
    355344     * The first init function Adtechmedia_AB
    356345     */
     
    462451            // @codingStandardsIgnoreStart
    463452            if ( isset( $_POST['revenueMethod'], $_POST['country'] ) ) {
    464                 $plugin_dir = plugin_dir_path( __FILE__ );
    465                 $file       = $plugin_dir . '/js/atm.min.js';
    466                 @unlink( $file );
    467 
    468453                $revenue_method = sanitize_text_field( wp_unslash( $_POST['revenueMethod'] ) );
    469454                $this->update_plugin_option( 'revenue_method', $revenue_method );
     
    475460                $this->update_plugin_option( 'country', $country );
    476461
    477                 Adtechmedia_Request::property_update_config_by_array(
    478                     $this->get_plugin_option( 'id' ),
    479                     $this->get_plugin_option( 'key' ),
    480                     [
    481                         'revenueMethod' => $revenue_method,
    482                     ]
    483                 );
     462                // Adtechmedia_Request::property_update_config_by_array(
     463                // $this->get_plugin_option( 'id' ),
     464                // $this->get_plugin_option( 'key' ),
     465                // [
     466                //      'revenueMethod' => $revenue_method,
     467                // ]
     468                // );
    484469                Adtechmedia_Request::property_update(
    485470                    $this->get_plugin_option( 'id' ),
     
    488473                    $this->get_plugin_option( 'key' )
    489474                );
    490                 Adtechmedia_ContentManager::clear_all_content();
     475                $this->update_prop();
     476                // Adtechmedia_ContentManager::clear_all_content();
    491477            } else if ( isset( $_POST['contentConfig'] ) ) {
    492478                $content_config = json_decode( wp_unslash( $_POST['contentConfig'] ), true );
     
    504490            echo 'ok';
    505491        }
    506         die();
     492        wp_die();
     493    }
     494
     495    /**
     496     * Call function update_appearance after activation
     497     */
     498    public function one_update_appearance() {
     499        if ( ! empty( $this->get_plugin_option( 'key' ) ) ) {
     500            $this->update_appearance();
     501            $this->add_plugin_option( 'updated_appearance', 1 );
     502        }
     503        wp_die();
    507504    }
    508505
  • adtechmedia/trunk/adtechmedia-request.php

    r1703025 r1703090  
    292292        $types = [
    293293            'words' => 'words',
    294             'paragraphs' => 'elements',
     294            'paragraphs' => 'elements', // legacy...
     295            'elements'  => 'elements',
    295296        ];
    296297        return $types[ $offset_type ];
Note: See TracChangeset for help on using the changeset viewer.