当前位置: 首页>>代码示例>>PHP>>正文


PHP WC_Payment_Gateway::process_admin_options方法代码示例

本文整理汇总了PHP中WC_Payment_Gateway::process_admin_options方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Payment_Gateway::process_admin_options方法的具体用法?PHP WC_Payment_Gateway::process_admin_options怎么用?PHP WC_Payment_Gateway::process_admin_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WC_Payment_Gateway的用法示例。


在下文中一共展示了WC_Payment_Gateway::process_admin_options方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process_admin_options

 public function process_admin_options()
 {
     $post_data = $this->get_post_data();
     $mode = 'live';
     if ($post_data['woocommerce_' . $this->id . '_sandbox'] == '1') {
         $mode = 'test';
     }
     $this->merchant_id = $post_data['woocommerce_' . $this->id . '_' . $mode . '_merchant_id'];
     $this->private_key = $post_data['woocommerce_' . $this->id . '_' . $mode . '_private_key'];
     $this->publishable_key = $post_data['woocommerce_' . $this->id . '_' . $mode . '_publishable_key'];
     $env = $mode == 'live' ? 'Producton' : 'Sandbox';
     if ($this->merchant_id == '' || $this->private_key == '' || $this->publishable_key == '') {
         $settings = new WC_Admin_Settings();
         $settings->add_error('You need to enter "' . $env . '" credentials if you want to use this plugin in this mode.');
     } else {
         $this->createWebhook();
     }
     return parent::process_admin_options();
 }
开发者ID:open-pay,项目名称:openpay-woocommerce,代码行数:19,代码来源:openpay_stores_gateway.php

示例2: process_admin_options

 public function process_admin_options()
 {
     $target_dir = IMAGE_FOLDER_URL;
     $target_file = $target_dir . basename($_FILES["woocommerce_Pwacheckout_pwa_btn_img"]["name"]);
     if ($_FILES["woocommerce_Pwacheckout_pwa_btn_img"]["name"]) {
         try {
             move_uploaded_file($_FILES["woocommerce_Pwacheckout_pwa_btn_img"]["tmp_name"], $target_file);
             chmod($target_file, 0777);
         } catch (Exception $e) {
             echo 'error in uploading file';
         }
     }
     $value = isset($_POST['woocommerce_Pwacheckout_pwa_delete_img']) ? $_POST['woocommerce_Pwacheckout_pwa_delete_img'] : 0;
     if (!$value && $_FILES['woocommerce_Pwacheckout_pwa_btn_img']['name']) {
         $_POST['woocommerce_Pwacheckout_pwa_btn_img_hidden'] = IMAGE_FOLDER_HTTPURL . $_FILES['woocommerce_Pwacheckout_pwa_btn_img']['name'];
     } elseif ($value) {
         $_POST['woocommerce_Pwacheckout_pwa_btn_img_hidden'] = '';
     }
     $_POST['woocommerce_Pwacheckout_pwa_delete_img'] = 0;
     parent::process_admin_options();
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:21,代码来源:class-pwa-gateway.php

示例3: process_admin_options

 /**
  * Save the admin options, ask the loader to clone to siblings
  */
 public function process_admin_options()
 {
     if (parent::process_admin_options()) {
         WC_PayPal_Braintree_Loader::getInstance()->clone_fields_from_id($this->id);
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:9,代码来源:class-wc-gateway-paypal-braintree.php

示例4: catch

 function process_admin_options()
 {
     if (!parent::process_admin_options()) {
         return false;
     }
     require_once plugin_dir_path(__FILE__) . 'coinbase-php' . DIRECTORY_SEPARATOR . 'Coinbase.php';
     $api_key = $this->get_option('apiKey');
     $api_secret = $this->get_option('apiSecret');
     // Validate merchant API key
     try {
         $coinbase = Coinbase::withApiKey($api_key, $api_secret);
         $user = $coinbase->getUser();
         update_option("coinbase_account_email", $user->email);
         update_option("coinbase_error_message", false);
     } catch (Exception $e) {
         $error_message = $e->getMessage();
         update_option("coinbase_account_email", false);
         update_option("coinbase_error_message", $error_message);
         return;
     }
 }
开发者ID:perfect-coin,项目名称:coinbase-woocommerce,代码行数:21,代码来源:coinbase-woocommerce.php

示例5: process_admin_options

 public function process_admin_options()
 {
     // Call parent
     parent::process_admin_options();
     if (isset($_POST) && is_array($_POST)) {
         $bwwc_settings = BWWC__get_settings();
         if (!isset($bwwc_settings['gateway_settings']) || !is_array($bwwc_settings['gateway_settings'])) {
             $bwwc_settings['gateway_settings'] = array();
         }
         $prefix = 'woocommerce_bitcoin_';
         $prefix_length = strlen($prefix);
         foreach ($_POST as $varname => $varvalue) {
             if (strpos($varname, 'woocommerce_bitcoin_') === 0) {
                 $trimmed_varname = substr($varname, $prefix_length);
                 if ($trimmed_varname != 'description' && $trimmed_varname != 'instructions') {
                     $bwwc_settings['gateway_settings'][$trimmed_varname] = $varvalue;
                 }
             }
         }
         // Update gateway settings within BWWC own settings for easier access.
         BWWC__update_settings($bwwc_settings);
     }
 }
开发者ID:jgabrielfreitas,项目名称:MultipagosTestesAPP,代码行数:23,代码来源:bwwc-bitcoin-gateway.php

示例6: process_admin_options

 /**
  * Do some additonal validation before saving options via the API.
  */
 public function process_admin_options()
 {
     // Validate logo
     $logo_image_url = wc_clean($_POST['woocommerce_ppec_paypal_logo_image_url']);
     if (!empty($logo_image_url) && !preg_match('/https?:\\/\\/[a-zA-Z0-9][a-zA-Z0-9.-]+[a-zA-Z0-9](\\/[a-zA-Z0-9.\\/?&%#]*)?/', $logo_image_url)) {
         WC_Admin_Settings::add_error(__('Error: The logo image URL you provided is not valid and cannot be used.', 'woocommerce-gateway-paypal-express-checkout'));
         unset($_POST['woocommerce_ppec_paypal_logo_image_url']);
     }
     // If a certificate has been uploaded, read the contents and save that string instead.
     if (array_key_exists('woocommerce_ppec_paypal_api_certificate', $_FILES) && array_key_exists('tmp_name', $_FILES['woocommerce_ppec_paypal_api_certificate']) && array_key_exists('size', $_FILES['woocommerce_ppec_paypal_api_certificate']) && $_FILES['woocommerce_ppec_paypal_api_certificate']['size']) {
         $_POST['woocommerce_ppec_paypal_api_certificate'] = base64_encode(file_get_contents($_FILES['woocommerce_ppec_paypal_api_certificate']['tmp_name']));
         unlink($_FILES['woocommerce_ppec_paypal_api_certificate']['tmp_name']);
         unset($_FILES['woocommerce_ppec_paypal_api_certificate']);
     } else {
         $_POST['woocommerce_ppec_paypal_api_certificate'] = $this->get_option('api_certificate');
     }
     if (array_key_exists('woocommerce_ppec_paypal_sandbox_api_certificate', $_FILES) && array_key_exists('tmp_name', $_FILES['woocommerce_ppec_paypal_sandbox_api_certificate']) && array_key_exists('size', $_FILES['woocommerce_ppec_paypal_sandbox_api_certificate']) && $_FILES['woocommerce_ppec_paypal_sandbox_api_certificate']['size']) {
         $_POST['woocommerce_ppec_paypal_sandbox_api_certificate'] = base64_encode(file_get_contents($_FILES['woocommerce_ppec_paypal_sandbox_api_certificate']['tmp_name']));
         unlink($_FILES['woocommerce_ppec_paypal_sandbox_api_certificate']['tmp_name']);
         unset($_FILES['woocommerce_ppec_paypal_sandbox_api_certificate']);
     } else {
         $_POST['woocommerce_ppec_paypal_sandbox_api_certificate'] = $this->get_option('sandbox_api_certificate');
     }
     parent::process_admin_options();
     // Validate credentials
     $this->validate_active_credentials();
 }
开发者ID:ksan5835,项目名称:maadithottam,代码行数:30,代码来源:abstract-wc-gateway-ppec.php

示例7: process_admin_options

 /**
  * Procesamos los datos enviados en el panel de configuración.
  * Conversión de los certificados en texto a fichero.
  * 
  */
 public function process_admin_options()
 {
     if (!is_dir(__DIR__ . '/certificados')) {
         $res = mkdir(__DIR__ . '/certificados', 0755, true);
         if (!$res) {
             throw new Exception(__('The directory is not writeable, check permisions', 'woocriptopay'));
         }
     }
     $finfo = new finfo(FILEINFO_MIME_TYPE);
     foreach ($_FILES as $key => $file) {
         if (!empty($file['name']) && substr($file['name'], 0, 10) == "CriptoPay_") {
             if ($finfo->file($file['tmp_name']) == "text/plain" && (substr($file['name'], -3) == "crt" || substr($file['name'], -3) == "key")) {
                 $move = move_uploaded_file($file['tmp_name'], __DIR__ . '/certificados/' . $file['name']);
             } else {
                 throw new Exception(__("File " . $file['name'] . " incorrect format " . $finfo->file($file['tmp_name'], 'woocriptopay')));
             }
         }
     }
     parent::process_admin_options();
 }
开发者ID:CriptoPay,项目名称:Wordpress_Woocomerce,代码行数:25,代码来源:class-wc-criptopay.php


注:本文中的WC_Payment_Gateway::process_admin_options方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。