當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Options_Framework::_wwm_2015_optionsframework_options方法代碼示例

本文整理匯總了PHP中Options_Framework::_wwm_2015_optionsframework_options方法的典型用法代碼示例。如果您正苦於以下問題:PHP Options_Framework::_wwm_2015_optionsframework_options方法的具體用法?PHP Options_Framework::_wwm_2015_optionsframework_options怎麽用?PHP Options_Framework::_wwm_2015_optionsframework_options使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Options_Framework的用法示例。


在下文中一共展示了Options_Framework::_wwm_2015_optionsframework_options方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: optionsframework_fields

 /**
  * Generates the options fields that are used in the form.
  */
 static function optionsframework_fields()
 {
     global $allowedtags;
     $optionsframework_settings = get_option('optionsframework');
     // Gets the unique option id
     if (isset($optionsframework_settings['id'])) {
         $option_name = $optionsframework_settings['id'];
     } else {
         $option_name = 'optionsframework';
     }
     $settings = get_option($option_name);
     $options =& Options_Framework::_wwm_2015_optionsframework_options();
     $counter = 0;
     $menu = '';
     foreach ($options as $value) {
         $val = '';
         $select_value = '';
         $output = '';
         // Wrap all options
         if ($value['type'] != "heading" && $value['type'] != "info") {
             // Keep all ids lowercase with no spaces
             $value['id'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['id']));
             $id = 'section-' . $value['id'];
             $class = 'section';
             if (isset($value['type'])) {
                 $class .= ' section-' . $value['type'];
             }
             if (isset($value['class'])) {
                 $class .= ' ' . $value['class'];
             }
             $output .= '<div id="' . esc_attr($id) . '" class="' . esc_attr($class) . '"><div class="section_inner">' . "\n";
             if (isset($value['name'])) {
                 $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
             }
             if ($value['type'] != 'editor') {
                 $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
             } else {
                 $output .= '<div class="option">' . "\n" . '<div>' . "\n";
             }
         }
         // Set default value to $val
         if (isset($value['std'])) {
             $val = $value['std'];
         }
         // If the option is already saved, override $val
         if ($value['type'] != 'heading' && $value['type'] != 'info') {
             if (isset($settings[$value['id']])) {
                 $val = $settings[$value['id']];
                 // Striping slashes of non-array options
                 if (!is_array($val)) {
                     $val = stripslashes($val);
                 }
             }
         }
         // If there is a description save it for labels
         $explain_value = '';
         if (isset($value['desc'])) {
             $explain_value = $value['desc'];
         }
         if (has_filter('optionsframework_' . $value['type'])) {
             $output .= apply_filters('optionsframework_' . $value['type'], $option_name, $value, $val);
         }
         switch ($value['type']) {
             // Basic text input
             case 'text':
                 $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '" />';
                 break;
                 // Password input
             // Password input
             case 'password':
                 $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="password" value="' . esc_attr($val) . '" />';
                 break;
                 // Textarea
             // Textarea
             case 'textarea':
                 $rows = '8';
                 if (isset($value['settings']['rows'])) {
                     $custom_rows = $value['settings']['rows'];
                     if (is_numeric($custom_rows)) {
                         $rows = $custom_rows;
                     }
                 }
                 $val = stripslashes($val);
                 $output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" rows="' . $rows . '">' . esc_textarea($val) . '</textarea>';
                 break;
                 // Select Box
             // Select Box
             case 'select':
                 $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
                 foreach ($value['options'] as $key => $option) {
                     $output .= '<option' . selected($val, $key, false) . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
                 }
                 $output .= '</select>';
                 break;
                 // Radio Box
             // Radio Box
             case "radio":
//.........這裏部分代碼省略.........
開發者ID:mclesceri,項目名稱:webworkerme-Framework,代碼行數:101,代碼來源:class-options-interface.php

示例2: get_default_values

 /**
  * Get the default values for all the theme options
  *
  * Get an array of all default values as set in
  * options.php. The 'id','std' and 'type' keys need
  * to be defined in the configuration array. In the
  * event that these keys are not present the option
  * will not be included in this function's output.
  *
  * @return array Re-keyed options configuration array.
  *
  */
 function get_default_values()
 {
     $output = array();
     $config =& Options_Framework::_wwm_2015_optionsframework_options();
     foreach ((array) $config as $option) {
         if (!isset($option['id'])) {
             continue;
         }
         if (!isset($option['std'])) {
             continue;
         }
         if (!isset($option['type'])) {
             continue;
         }
         if (has_filter('of_sanitize_' . $option['type'])) {
             $output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
         }
     }
     return $output;
 }
開發者ID:mclesceri,項目名稱:webworkerme-Framework,代碼行數:32,代碼來源:class-options-framework-admin.php


注:本文中的Options_Framework::_wwm_2015_optionsframework_options方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。