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


PHP mc4wp_get_options函数代码示例

本文整理汇总了PHP中mc4wp_get_options函数的典型用法代码示例。如果您正苦于以下问题:PHP mc4wp_get_options函数的具体用法?PHP mc4wp_get_options怎么用?PHP mc4wp_get_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: mc4wp_get_form_settings

/**
 * @param int $form_id
 * @param bool $inherit
 *
 * @return array
 */
function mc4wp_get_form_settings($form_id, $inherit = false)
{
    $inherited_settings = mc4wp_get_options('form');
    $form_settings = array();
    // set defaults
    $form_settings['lists'] = array();
    $form_settings['email_copy_receiver'] = get_bloginfo('admin_email');
    // fill optional meta keys with empty strings
    $optional_meta_keys = array('double_optin', 'update_existing', 'replace_interests', 'send_welcome', 'ajax', 'hide_after_success', 'redirect', 'text_success', 'text_error', 'text_invalid_email', 'text_already_subscribed', 'send_email_copy', 'text_invalid_captcha', 'text_required_field_missing');
    foreach ($optional_meta_keys as $meta_key) {
        if ($inherit) {
            $form_settings[$meta_key] = $inherited_settings[$meta_key];
        } else {
            $form_settings[$meta_key] = '';
        }
    }
    $meta = get_post_meta($form_id, '_mc4wp_settings', true);
    if (is_array($meta)) {
        foreach ($meta as $key => $value) {
            // only add meta value if not empty
            if ($value != '') {
                $form_settings[$key] = $value;
            }
        }
    }
    return $form_settings;
}
开发者ID:Infernosaint,项目名称:WPSetupTest2,代码行数:33,代码来源:general.php

示例2: mc4wp_get_api

/**
 * Gets the MailChimp for WP API class and injects it with the API key
 *
 * @deprecated 4.0
 * @use mc4wp_get_api_v3
 *
 * @since 1.0
 * @access public
 *
 * @return MC4WP_API
 */
function mc4wp_get_api()
{
    _deprecated_function(__FUNCTION__, '4.0', 'mc4wp_get_api_v3');
    $opts = mc4wp_get_options();
    $instance = new MC4WP_API($opts['api_key']);
    return $instance;
}
开发者ID:dannyvankooten,项目名称:mailchimp-for-wordpress,代码行数:18,代码来源:functions.php

示例3: get_options

 /**
  * Get the checkbox options
  *
  * @return array
  */
 public function get_options()
 {
     if ($this->options === null) {
         $this->options = mc4wp_get_options('checkbox');
     }
     return $this->options;
 }
开发者ID:jimmitjoo,项目名称:mnh,代码行数:12,代码来源:class-integration.php

示例4: __construct

 /**
  * Constructor
  *
  * Hooks into the `init` action to start the process of subscribing the person who filled out the form
  */
 public function __construct()
 {
     // store number of submitted form
     $this->form_instance_number = absint($_POST['_mc4wp_form_instance']);
     // store form options
     $this->form_options = mc4wp_get_options('form');
     add_action('init', array($this, 'act'));
 }
开发者ID:shubham79,项目名称:Jhintaak,代码行数:13,代码来源:class-form-request.php

示例5: get_api

 /**
  * @return MC4WP_Lite_API
  */
 public function get_api()
 {
     if ($this->api === null) {
         $opts = mc4wp_get_options();
         $this->api = new MC4WP_Lite_API($opts['general']['api_key']);
     }
     return $this->api;
 }
开发者ID:shubham79,项目名称:Jhintaak,代码行数:11,代码来源:class-plugin.php

示例6: load_stylesheet

 /**
  * Loads the checkbox stylesheet
  */
 public function load_stylesheet()
 {
     $opts = mc4wp_get_options('checkbox');
     if ($opts['css'] == false) {
         return false;
     }
     wp_enqueue_style('mailchimp-for-wp-checkbox', MC4WP_LITE_PLUGIN_URL . 'assets/css/checkbox.css', array(), MC4WP_LITE_VERSION, 'all');
     return true;
 }
开发者ID:sydneyDAD,项目名称:cardguys.com,代码行数:12,代码来源:class-checkbox-manager.php

示例7: load_stylesheet

 /**
  * Loads the checkbox stylesheet
  */
 public function load_stylesheet()
 {
     $opts = mc4wp_get_options('checkbox');
     if ($opts['css'] == false) {
         return false;
     }
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     wp_enqueue_style('mailchimp-for-wp-checkbox', MC4WP_LITE_PLUGIN_URL . 'assets/css/checkbox' . $suffix . '.css', array(), MC4WP_LITE_VERSION, 'all');
     return true;
 }
开发者ID:shubham79,项目名称:Jhintaak,代码行数:13,代码来源:class-checkbox-manager.php

示例8: CF7_pre_send

function CF7_pre_send($cf7)
{
    if (isset($_POST['is_subcribe']) && count($_POST['is_subcribe']) > 0) {
        $option = mc4wp_get_options('form');
        $api = mc4wp_get_api();
        foreach ($option['lists'] as $v) {
            $api->subscribe($v, $cf7->mail['recipient']);
        }
    }
}
开发者ID:IdDevGroup,项目名称:Identifid-Website,代码行数:10,代码来源:functions.php

示例9: get_tracked_options

 /**
  * @return array
  */
 public function get_tracked_options()
 {
     $checkbox_options = mc4wp_get_options('checkbox');
     $form_options = mc4wp_get_options('form');
     // make sure these keys are always stripped
     $ignored_options = array('api_key', 'license_key', 'lists');
     // filter options
     $checkbox_options = array_diff_key($checkbox_options, array_flip($ignored_options));
     $form_options = array_diff_key($form_options, array_flip($ignored_options));
     // merge options
     $options = array('checkbox' => $checkbox_options, 'form' => $form_options);
     return $options;
 }
开发者ID:JaneJieYing,项目名称:HiFridays,代码行数:16,代码来源:class-usage-tracking.php

示例10: initialize

 /**
  * Initializes the Form functionality
  *
  * - Registers scripts so developers can override them, should they want to.
  */
 public function initialize()
 {
     $this->options = mc4wp_get_options('form');
     $this->register_shortcodes();
     // has a MC4WP form been submitted?
     if (isset($_POST['_mc4wp_form_submit'])) {
         $this->form_request = new MC4WP_Lite_Form_Request($_POST);
     }
     // frontend only
     if (!is_admin()) {
         // load checkbox css if necessary
         add_action('wp_head', array($this, 'print_css'), 90);
         add_action('wp_enqueue_scripts', array($this, 'load_stylesheet'));
         $this->register_scripts();
     }
 }
开发者ID:jimmitjoo,项目名称:mnh,代码行数:21,代码来源:class-form-manager.php

示例11: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     $this->options = mc4wp_get_options('checkbox');
     // load checkbox css if necessary
     add_action('wp_enqueue_scripts', array($this, 'load_stylesheet'));
     add_action('login_enqueue_scripts', array($this, 'load_stylesheet'));
     // Load WP Comment Form Integration
     if ($this->options['show_at_comment_form']) {
         $this->integrations['comment_form'] = new MC4WP_Comment_Form_Integration();
     }
     // Load WordPress Registration Form Integration
     if ($this->options['show_at_registration_form']) {
         $this->integrations['registration_form'] = new MC4WP_Registration_Form_Integration();
     }
     // Load BuddyPress Integration
     if ($this->options['show_at_buddypress_form']) {
         $this->integrations['buddypress_form'] = new MC4WP_BuddyPress_Integration();
     }
     // Load MultiSite Integration
     if ($this->options['show_at_multisite_form']) {
         $this->integrations['multisite_form'] = new MC4WP_MultiSite_Integration();
     }
     // Load bbPress Integration
     if ($this->options['show_at_bbpress_forms']) {
         $this->integrations['bbpress_forms'] = new MC4WP_bbPress_Integration();
     }
     // Load CF7 Integration
     if (function_exists('wpcf7_add_shortcode')) {
         $this->integrations['contact_form_7'] = new MC4WP_CF7_Integration();
     }
     // Load Events Manager integration
     if (defined('EM_VERSION')) {
         $this->integrations['events_manager'] = new MC4WP_Events_Manager_Integration();
     }
     // Load WooCommerce Integration
     if ($this->options['show_at_woocommerce_checkout']) {
         $this->integrations['woocommerce'] = new MC4WP_WooCommerce_Integration();
     }
     // Load EDD Integration
     if ($this->options['show_at_edd_checkout']) {
         $this->integrations['easy_digital_downloads'] = new MC4WP_EDD_Integration();
     }
     // load General Integration on POST requests
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         $this->integrations['general'] = new MC4WP_General_Integration();
     }
 }
开发者ID:tlandn,项目名称:akvo-sites-zz-template,代码行数:50,代码来源:class-checkbox-manager.php

示例12: __construct

 /**
  * Constructor
  *
  * @param array $form_data
  */
 public function __construct($form_data)
 {
     $this->data = $this->normalize_form_data($form_data);
     // store number of submitted form
     $this->form_instance_number = absint($this->data['_MC4WP_FORM_INSTANCE']);
     $this->form_options = mc4wp_get_options('form');
     $this->is_valid = $this->validate();
     if ($this->is_valid) {
         // add some data to the posted data, like FNAME and LNAME
         $this->data = $this->guess_missing_fields($this->data);
         // map fields to corresponding MailChimp lists
         if ($this->map_data($this->data)) {
             // subscribe using the processed data
             $this->success = $this->subscribe($this->lists_fields_map);
         }
     }
     // send HTTP response
     $this->send_http_response();
     return $this->success;
 }
开发者ID:jimmitjoo,项目名称:mnh,代码行数:25,代码来源:class-form-request.php

示例13: initialize

 /**
  * Initialize form stuff
  *
  * - Registers post type
  * - Registers scripts
  */
 public function initialize()
 {
     $this->options = mc4wp_get_options('form');
     // register post type
     register_post_type('mc4wp-form', array('labels' => array('name' => 'MailChimp Sign-up Forms', 'singular_name' => 'Sign-up Form', 'add_new_item' => 'Add New Form', 'edit_item' => 'Edit Form', 'new_item' => 'New Form', 'all_items' => 'All Forms', 'view_item' => null), 'public' => false, 'show_ui' => true, 'show_in_menu' => false));
     $this->register_shortcodes();
     // has a form been submitted, either by ajax or manually?
     if (isset($_POST['_mc4wp_form_submit'])) {
         $this->form_request = new MC4WP_Form_Request($_POST);
     }
     // frontend only
     if (!is_admin()) {
         add_action('wp_head', array($this, 'print_css'), 90);
         add_action('wp_enqueue_scripts', array($this, 'load_stylesheet'));
         $this->register_scripts();
         if (isset($_GET['_mc4wp_css_preview'])) {
             $this->show_form_preview();
             die;
         }
     }
 }
开发者ID:Infernosaint,项目名称:WPSetupTest2,代码行数:27,代码来源:class-form-manager.php

示例14: act

	/**
	 * Acts on the submitted data
	 * - Validates internal fields
	 * - Formats email and merge_vars
	 * - Sends off the subscribe request to MailChimp
	 * - Returns state
	 *
	 * @return bool True on success, false on failure.
	 */
	public function act() {

		// store number of submitted form
		$this->form_instance_number = absint( $_POST['_mc4wp_form_instance'] );

		// store form options
		$this->form_options = mc4wp_get_options( 'form' );

		// validate form nonce
		if ( ! isset( $_POST['_mc4wp_form_nonce'] ) || ! wp_verify_nonce( $_POST['_mc4wp_form_nonce'], '_mc4wp_form_nonce' ) ) {
			$this->error_code = 'invalid_nonce';
			return false;
		}

		// ensure honeypot was not filed
		if ( isset( $_POST['_mc4wp_required_but_not_really'] ) && ! empty( $_POST['_mc4wp_required_but_not_really'] ) ) {
			$this->error_code = 'spam';
			return false;
		}

		// check if captcha was present and valid
		if( isset( $_POST['_mc4wp_has_captcha'] ) && $_POST['_mc4wp_has_captcha'] == 1 && function_exists( 'cptch_check_custom_form' ) && cptch_check_custom_form() !== true ) {
			$this->error_code = 'invalid_captcha';
			return false;
		}

		/**
		 * @filter mc4wp_valid_form_request
		 *
		 * Use this to perform custom form validation.
		 * Return true if the form is valid or an error string if it isn't.
		 * Use the `mc4wp_form_messages` filter to register custom error messages.
		 */
		$valid_form_request = apply_filters( 'mc4wp_valid_form_request', true );
		if( $valid_form_request !== true ) {
			$this->error_code = $valid_form_request;
			return false;
		}

		// get entered form data (sanitized)
		$this->sanitize_form_data();
		$data = $this->get_posted_data();

		// validate email
		if( ! isset( $data['EMAIL'] ) || ! is_email( $data['EMAIL'] ) ) {
			$this->error_code = 'invalid_email';
			return false;
		}

		// setup merge_vars array
		$merge_vars = $data;

		// take email out of $data array, use the rest as merge_vars
		$email = $merge_vars['EMAIL'];
		unset( $merge_vars['EMAIL'] );

		// validate groupings
		if( isset( $data['GROUPINGS'] ) && is_array( $data['GROUPINGS'] ) ) {
			$merge_vars['GROUPINGS'] = $this->format_groupings_data( $data['GROUPINGS'] );
		}

		// subscribe the given email / data combination
		$this->success = $this->subscribe( $email, $merge_vars );

		// do stuff on success
		if( true === $this->success ) {

			// check if we want to redirect the visitor
			if ( ! empty( $this->form_options['redirect'] ) ) {
				wp_redirect( $this->form_options['redirect'] );
				exit;
			}

			// return true on success
			return true;
		}

		// return false on failure
		return false;
	}
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:89,代码来源:class-form-request.php

示例15: on_activation

 /**
  * Runs on plugin activation
  * Transfers settings from MC4WP Lite
  */
 public function on_activation()
 {
     // delete transients
     delete_transient('mc4wp_mailchimp_lists');
     delete_transient('mc4wp_mailchimp_lists_fallback');
     // check if PRO option exists and contains data entered by user
     if (($o = get_option('mc4wp')) != false && (!empty($o['api_key']) || !empty($o['license_key']))) {
         return;
     }
     // user entered no PRO options in the past, let's see if we can transfer from LITE
     $lite_settings = array('general' => (array) get_option('mc4wp_lite'), 'checkbox' => (array) get_option('mc4wp_lite_checkbox'), 'form' => (array) get_option('mc4wp_lite_form'));
     $default_options = mc4wp_get_options();
     foreach ($default_options as $group_key => $options) {
         foreach ($options as $option_key => $option_value) {
             if (isset($lite_settings[$group_key][$option_key]) && !empty($lite_settings[$group_key][$option_key])) {
                 $default_options[$group_key][$option_key] = $lite_settings[$group_key][$option_key];
             }
         }
     }
     $forms = get_posts(array('post_type' => 'mc4wp-form'));
     if (!$forms) {
         // no forms found, try to transfer from lite.
         $form_markup = isset($lite_settings['form']['markup']) ? $lite_settings['form']['markup'] : $this->get_default_form_markup();
         $form_ID = wp_insert_post(array('post_type' => 'mc4wp-form', 'post_title' => 'Sign-Up Form #1', 'post_content' => $form_markup, 'post_status' => 'publish'));
         $lists = isset($lite_settings['form']['lists']) ? $lite_settings['form']['lists'] : array();
         update_post_meta($form_ID, '_mc4wp_settings', array('lists' => $lists));
         update_option('mc4wp_default_form_id', $form_ID);
     }
     // store options
     update_option('mc4wp', $default_options['general']);
     update_option('mc4wp_checkbox', $default_options['checkbox']);
     update_option('mc4wp_form', $default_options['form']);
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:37,代码来源:class-admin.php


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