Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getOption($args = null, $prefix = null) {
- $result = null;
- $options = get_option($this->key);
- if (!Helper::isEmpty($prefix)) {
- $prefix .= '_';
- if (is_array($args)) {
- foreach ($args as $val) {
- $key = $prefix.$val;
- $result[$val] = Helper::isGood($options, $key) ? $options[$key] : null;
- }
- } else if (is_string($args)) {
- if ($args == 'all') {
- foreach ($options as $key=>$val) {
- if (strpos($key, $prefix) !== false) {
- $result[str_replace($prefix, '', $key)] = Helper::isGood($options, $key) ? $options[$key] : null;
- }
- }
- } else {
- $key = $prefix.$args;
- $result = Helper::isGood($options, $key) ? $options[$key] : null;
- }
- }
- } else {
- return $options;
- }
- return $result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement