コード例 #1
0
 /**
  * @param array $new_data
  * @param array $old_data
  * @return array
  */
 function validate($new_data, $old_data)
 {
     $options = wp_parse_args($new_data, $old_data);
     foreach (array('style', 'num_pages', 'num_larger_page_numbers', 'larger_page_numbers_multiple') as $key) {
         $options[$key] = absint(@$options[$key]);
     }
     foreach (array('use_pagenavi_css', 'always_show') as $key) {
         $options[$key] = intval(@$options[$key]);
     }
     HW_SKIN::save_enqueue_skin(array('type' => 'resume_skin', 'skin' => $options['hw_skin'], 'object' => 'pagenavi', 'status' => 1));
     return $options;
 }
コード例 #2
0
 /**
  * The pre-defined validation callback method.
  *
  * The following hooks are available:
  *	- validation_{instantiated class name}_{field id} – [3.0.0+] receives the form submission value of the field that does not have a section. The first parameter: ( string|array ) submitted input value. The second parameter: ( string|array ) the old value stored in the database.
  *	- validation_{instantiated class name}_{section_id}_{field id} – [3.0.0+] receives the form submission value of the field that has a section. The first parameter: ( string|array ) submitted input value. The second parameter: ( string|array ) the old value stored in the database.
  *	- validation_{instantiated class name}_{section id} – [3.0.0+] receives the form submission values that belongs to the section.. The first parameter: ( array ) the array of submitted input values that belong to the section. The second parameter: ( array ) the array of the old values stored in the database.
  *	- validation_{page slug}_{tab slug} – receives the form submission values as array. The first parameter: submitted input array. The second parameter: the original array stored in the database.
  *	- validation_{page slug} – receives the form submission values as array. The first parameter: submitted input array. The second parameter: the original array stored in the database.
  *	- validation_{instantiated class name} – receives the form submission values as array. The first parameter: submitted input array. The second parameter: the original array stored in the database.
  */
 public function validation_HW_Livechat_settings($aInput, $aOldInput)
 {
     if (isset($aInput['chat_skin']['skin_options'])) {
         //make sure exists current skin
         $options = $aInput['chat_skin']['skin_options'];
         //user skin options
         //resume hw_skin
         if (isset($aInput['chat_skin']['hash_skin']) && isset($aInput['chat_skin']['hwskin_config'])) {
             $skin = APF_hw_skin_Selector_hwskin::resume_hwskin_instance($aInput['chat_skin']);
             //
             if ($skin && isset($aInput['chat_skin']['hash_skin'])) {
                 $hash_skin = $aInput['chat_skin']['hash_skin'];
                 //current active skin
                 $skin_setting_file = $skin->instance->get_file_skin_setting($hash_skin);
                 //current skin setting
                 $skin_options = $skin->instance->get_file_skin_options();
                 //current skin options
                 if (file_exists($skin_setting_file)) {
                     include $skin_setting_file;
                 }
                 if (file_exists($skin_options)) {
                     include $skin_options;
                 }
                 if (isset($theme) && isset($theme['options'])) {
                     $default_options = $theme['options'];
                 } else {
                     $default_options = array();
                 }
                 if (isset($theme_options)) {
                     $options = HW_SKIN::merge_skin_options_values($options, $default_options, $theme_options);
                     //__save_session('y2',$options);
                     /*$_SESSION['y3']=$skin_setting;
                       $_SESSION['y4']=$default_options;*/
                 }
             }
         }
         //get demo live chat embed code
         if (isset($options['enable_demo_chat']) && strtolower($options['enable_demo_chat']) == 'on' && isset($options['demo_embedcode'])) {
             $aInput['chat_embed_code'] = $options['demo_embedcode'];
             //clear enable_demo_chat option to able to update 'enable_demo_chat' skin option in next time
             unset($aInput['chat_skin']['skin_options']['enable_demo_chat']);
         }
     }
     //save current skin for enqueue
     if (!empty($aInput['chat_skin'])) {
         HW_SKIN::save_enqueue_skin(array('type' => 'resume_skin', 'skin' => $aInput['chat_skin'], 'object' => 'livechat', 'status' => $aInput['enable_livechat']));
     }
     return $aInput;
 }