get_option() public method

Gets an option from the settings API, using defaults if necessary to prevent undefined notices.
public get_option ( string $key, mixed $empty_value = null ) : string
$key string
$empty_value mixed
return string The value specified for the option or a default value for the option.
Example #1
0
 /**
  * Proxy to parent's get_option and attempt to localize the result using gettext.
  *
  * @param string $key
  * @param mixed  $empty_value
  * @return string
  */
 public function get_option($key, $empty_value = null)
 {
     $value = parent::get_option($key, $empty_value);
     return apply_filters('woocommerce_email_get_option', __($value), $this, $value, $key, $empty_value);
 }
 /**
  * get_option function.
  *
  * Gets and option from the settings API, using defaults if necessary to prevent undefined notices.
  *
  * @param  string $key
  * @param  mixed  $empty_value
  * @return mixed  The value specified for the option or a default value for the option.
  */
 public function get_option($key, $empty_value = null)
 {
     // Instance options take priority over global options
     if ($this->instance_id && array_key_exists($key, $this->get_instance_form_fields())) {
         return $this->get_instance_option($key, $empty_value);
     }
     // Return global option
     return parent::get_option($key, $empty_value);
 }
Example #3
0
 /**
  * Proxy to parent's get_option and attempt to localize the result using gettext.
  *
  * @access public
  * @return string
  */
 function get_option($key, $empty_value = null)
 {
     return __(parent::get_option($key, $empty_value));
 }