コード例 #1
0
 /**
  * Gets and option from the settings API. Implemented for compatibility with
  * WooCommerce 1.6, whose class WC_Payment_Gateway doesn't implement this
  * method.
  *
  * @param string key The option key.
  * @param mixed empty_value The value to return if the option is not found.
  * @return mixed
  */
 public function get_option($key, $empty_value = null)
 {
     if (method_exists('WC_Payment_Gateway', 'get_option')) {
         return parent::get_option($key, $empty_value);
     }
     return get_value($key, $this->settings, $empty_value);
 }
コード例 #2
0
ファイル: Gateway.php プロジェクト: daanbakker1995/vanteun
 /**
  * Get Pronamic option
  *
  * The WooCommerce settings API only have an 'get_option' function in
  * WooCommerce version 2 or higher.
  *
  * @see https://github.com/woothemes/woocommerce/blob/v2.0.0/classes/abstracts/abstract-wc-settings-api.php#L130
  *
  * @param string $name
  */
 public function get_pronamic_option($key)
 {
     $value = false;
     if (method_exists($this, 'get_option')) {
         $value = parent::get_option($key);
     } elseif (isset($this->settings[$key])) {
         $value = $this->settings[$key];
     }
     return $value;
 }