Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1.     public function getOption($args = null, $prefix = null) {
  2.  
  3.         $result = null;
  4.         $options = get_option($this->key);
  5.  
  6.         if (!Helper::isEmpty($prefix)) {
  7.             $prefix .= '_';
  8.             if (is_array($args)) {
  9.                 foreach ($args as $val) {
  10.                     $key = $prefix.$val;
  11.                     $result[$val] = Helper::isGood($options, $key) ? $options[$key] : null;
  12.                 }
  13.             } else if (is_string($args)) {
  14.                 if ($args == 'all') {
  15.                     foreach ($options as $key=>$val) {
  16.                         if (strpos($key, $prefix) !== false) {
  17.                             $result[str_replace($prefix, '', $key)] = Helper::isGood($options, $key) ? $options[$key] : null;
  18.                         }
  19.                     }
  20.                 } else {
  21.                     $key = $prefix.$args;
  22.                     $result = Helper::isGood($options, $key) ? $options[$key] : null;
  23.                 }
  24.             }
  25.         } else {
  26.             return $options;
  27.         }
  28.  
  29.         return $result;
  30.  
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement