Exemple #1
0
 /**
  * Method to generate HTML form'elements to manage setting in the configuratio panel
  * of this plugin.
  *
  * @param array $setting
  */
 public function displaySettings($setting = array())
 {
     if (\is_admin()) {
         $id = null;
         if (isset($setting['id'])) {
             $id = $setting['id'];
         }
         $class = null;
         if (isset($setting['class'])) {
             $class = ' ' . $setting['class'];
         }
         $type = null;
         if (isset($setting['type'])) {
             $type = $setting['type'];
         }
         $std = null;
         if (isset($setting['std'])) {
             $std = $setting['std'];
         }
         $desc = null;
         if (isset($setting['desc'])) {
             $desc = $setting['desc'];
         }
         $choices = array();
         if (isset($setting['choices'])) {
             $choices = $setting['choices'];
         }
         $options = $this->options->toArray();
         if (!isset($options[$id]) && 'checkbox' != $type) {
             $options[$id] = $std;
         } elseif (!isset($options[$id])) {
             $options[$id] = 0;
         }
         if (is_readable(SELLSY_WP_PATH_INC . '/admin-setting.php')) {
             include SELLSY_WP_PATH_INC . '/admin-setting.php';
         }
     }
 }