14.1 Dữ liệu hàm get (ok)

C:\xampp\htdocs\test\wp-content\plugins\plugin-name\includes\class-wpf-form_ct.php

public function save_themplate(array $post) {
    $result = false;
    if (!empty($post['layout'])) {
      $option = WPF_Options_CT::get_option($this->plugin_name, $this->version);
      if (empty($post['name'])) {
        $post['name'] = uniqid($this->plugin_name . '_');
      }
      $themplate_id = !empty($post['themplate_id']) ? $post['themplate_id'] : $option->unique_name($post['name']);
      $data = $option->get();
      $layout = stripslashes_deep($post['layout']);
    }
    
    return $result;
  }

C:\xampp\htdocs\test\wp-content\plugins\themify-wc-product-filter\includes\class-wpf-options.php

public  function get($recreate=false){
    static $options = null;
    if(is_null($options) || $recreate){
        $options = get_option(self::$settings_key);
    }
    return $options?$options:array();
}

C:\xampp\htdocs\test\wp-content\themes\twentyfifteen-child\header.php

<?php
		global $wpdb;
		$result = $wpdb->get_results( "SELECT option_value FROM `wp_options` WHERE `option_id` = 1282" );
		$aaa = $result[0]->option_value;
		$pia = maybe_unserialize( $aaa );
		echo '<pre>';
			var_export($pia);
		echo '</pre>';
	?>

Kết quả:

array (
  'lionel' => 
  array (
    'layout' => 
    array (
      'wpf_cat' => 
      array (
        'field_title' => 
        array (
          'en' => '',
        ),
        'count' => '1',
        'include' => 'yes',
        'show_as' => 'link',
        'logic' => 'or',
        'order' => 'term_order',
        'orderby' => 'asc',
        'display' => 'horizontal',
        'column' => '2',
        'color_bg_15' => false,
        'color_text_15' => false,
        'text_15' => 
        array (
          'en' => '',
        ),
        'image_bg_15' => '',
        'color_bg_19' => false,
        'color_text_19' => false,
        'text_19' => 
        array (
          'en' => '',
        ),
        'image_bg_19' => '',
        'color_bg_250' => false,
        'color_text_250' => false,
        'text_250' => 
        array (
          'en' => '',
        ),
        'image_bg_250' => '',
        'color_bg_238' => false,
        'color_text_238' => false,
        'text_238' => 
        array (
          'en' => '',
        ),
        'image_bg_238' => '',
        'color_bg_228' => false,
        'color_text_228' => false,
        'text_228' => 
        array (
          'en' => '',
        ),
        'image_bg_228' => '',
        'color_bg_16' => false,
        'color_text_16' => false,
        'text_16' => 
        array (
          'en' => '',
        ),
        'image_bg_16' => '',
        'color_bg_21' => false,
        'color_text_21' => false,
        'text_21' => 
        array (
          'en' => '',
        ),
        'image_bg_21' => '',
        'color_bg_18' => false,
        'color_text_18' => false,
        'text_18' => 
        array (
          'en' => '',
        ),
        'image_bg_18' => '',
        'color_bg_229' => false,
        'color_text_229' => false,
        'text_229' => 
        array (
          'en' => '',
        ),
        'image_bg_229' => '',
        'color_bg_215' => false,
        'color_text_215' => false,
        'text_215' => 
        array (
          'en' => '',
        ),
        'image_bg_215' => '',
        'color_bg_20' => false,
        'color_text_20' => false,
        'text_20' => 
        array (
          'en' => '',
        ),
        'image_bg_20' => '',
        'color_bg_251' => false,
        'color_text_251' => false,
        'text_251' => 
        array (
          'en' => '',
        ),
        'image_bg_251' => '',
        'color_bg_221' => false,
        'color_text_221' => false,
        'text_221' => 
        array (
          'en' => '',
        ),
        'image_bg_221' => '',
        'color_bg_249' => false,
        'color_text_249' => false,
        'text_249' => 
        array (
          'en' => '',
        ),
        'image_bg_249' => '',
        'color_bg_225' => false,
        'color_text_225' => false,
        'text_225' => 
        array (
          'en' => '',
        ),
        'image_bg_225' => '',
        'color_bg_216' => false,
        'color_text_216' => false,
        'text_216' => 
        array (
          'en' => '',
        ),
        'image_bg_216' => '',
        'color_bg_227' => false,
        'color_text_227' => false,
        'text_227' => 
        array (
          'en' => '',
        ),
        'image_bg_227' => '',
        'color_bg_17' => false,
        'color_text_17' => false,
        'text_17' => 
        array (
          'en' => '',
        ),
        'image_bg_17' => '',
        'color_bg_226' => false,
        'color_text_226' => false,
        'text_226' => 
        array (
          'en' => '',
        ),
        'image_bg_226' => '',
        'include_cat' => '',
        'exclude_cat' => '',
      ),
      'price' => 
      array (
        'field_title' => 
        array (
          'en' => '',
        ),
        'price_type' => 'group',
        'from' => 
        array (
          0 => '0',
          1 => '10',
          2 => '30',
          3 => '50',
        ),
        'to' => 
        array (
          0 => '10',
          1 => '20',
          2 => '50',
          3 => '199',
        ),
        'step' => '1',
      ),
      'pa_color' => 
      array (
        'field_title' => 
        array (
          'en' => '',
        ),
        'count' => '1',
        'show_as' => 'link',
        'logic' => 'or',
        'order' => 'name',
        'orderby' => 'asc',
        'display' => 'horizontal',
        'column' => '2',
        'color_bg_258' => false,
        'color_text_258' => false,
        'text_258' => 
        array (
          'en' => '',
        ),
        'image_bg_258' => '',
        'color_bg_264' => false,
        'color_text_264' => false,
        'text_264' => 
        array (
          'en' => '',
        ),
        'image_bg_264' => '',
        'color_bg_259' => false,
        'color_text_259' => false,
        'text_259' => 
        array (
          'en' => '',
        ),
        'image_bg_259' => '',
        'color_bg_260' => false,
        'color_text_260' => false,
        'text_260' => 
        array (
          'en' => '',
        ),
        'image_bg_260' => '',
        'color_bg_265' => false,
        'color_text_265' => false,
        'text_265' => 
        array (
          'en' => '',
        ),
        'image_bg_265' => '',
      ),
    ),
    'data' => 
    array (
      'name' => 'lionel',
      'empty' => '1',
      'reset_button' => 'no',
      'type' => 'vertical',
      'page' => '1789',
      'result_type' => 'same_page',
      'tax_relation' => 'or',
      'pagination_type' => 'pagination',
      'no_found_message' => 
      array (
        'en' => '',
      ),
      'clear_label' => 
      array (
        'en' => '',
      ),
      'date' => 1611417549,
    ),
  ),
)

Last updated