• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP MS_Plugin类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: to_html

    /**
     * Returns the HTML code of the view.
     *
     * @since  1.0.0
     * @api
     *
     * @return string
     */
    public function to_html()
    {
        $model = MS_Factory::create('MS_Model_Import_Membership');
        $model->prepare();
        $view = MS_Factory::create('MS_View_Settings_Import');
        $view->data = array('model' => $model, 'compact' => true);
        $msg = __('Tip: You can also import your data later by visiting the Admin page <b>Membership2 > Settings > Import Tool</b>.', 'membership2');
        ob_start();
        // Render tabbed interface.
        ?>
		<div class="ms-wrap wrap">
			<h2>
				<?php 
        _e('Import Your Membership Data To Membership2', 'membership2');
        ?>
			</h2>
			<?php 
        if (MS_Plugin::is_network_wide()) {
            $msg .= '<br><br>' . __('You have enabled Network Wide Protection. We will import Membership data from your main blog.', 'membership2');
        }
        lib3()->ui->admin_message($msg, 'info');
        ?>
			<div class="ms-settings-import">
				<?php 
        echo $view->to_html();
        ?>
			</div>
		</div>
		<?php 
        return ob_get_clean();
    }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:39,代码来源:class-ms-view-migrationm1.php


示例2: get_columns

 public function get_columns()
 {
     $currency = MS_Plugin::instance()->settings->currency;
     $columns = apply_filters('ms_helper_listtable_billing_columns', array('cb' => '<input type="checkbox" />', 'invoice' => __('Invoice #', 'membership2'), 'user' => __('User', 'membership2'), 'membership' => __('Membership', 'membership2'), 'status' => __('Status', 'membership2'), 'total' => __('Total', 'membership2'), 'due_date' => __('Due date', 'membership2'), 'gateway_id' => __('Gateway', 'membership2')));
     $columns = apply_filters('ms_helper_listtable_billing_get_columns', $columns, $currency);
     return $columns;
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:7,代码来源:class-ms-helper-listtable-billing.php


示例3: prepare_fields

 /**
  * Prepare html fields.
  *
  * @since  1.0.0
  *
  * @return array
  */
 function prepare_fields()
 {
     $invoice = $this->data['invoice'];
     $currency = MS_Plugin::instance()->settings->currency;
     $user_name = '';
     $transaction_link = '';
     $user_id = 0;
     $user_list = array();
     if ($invoice->id) {
         $member = $invoice->get_member();
         $user_id = $member->id;
         $user_name = $member->name;
         $transaction_link = sprintf('<a href="%s" target="_blank">%s</a>', MS_Controller_Plugin::get_admin_url('billing', array('show' => 'logs', 'invoice' => $invoice->id)), __('Show Transactions', 'membership2'));
     } else {
         $user_list = MS_Model_Member::get_usernames(null, MS_Model_Member::SEARCH_ALL_USERS);
     }
     $fields = array('link_transactions' => array('id' => 'link_transactions', 'title' => $transaction_link, 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'wrapper_class' => 'ms-transactions-link'), 'txt_user' => array('id' => 'txt_user', 'title' => __('Invoice for member', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'value' => sprintf('<a href="%s">%s</a>', MS_Controller_Plugin::get_admin_url('add-member', array('user_id' => $user_id)), $user_name)), 'txt_membership' => array('id' => 'txt_membership', 'title' => __('Payment for membership', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT), 'txt_created' => array('id' => 'txt_created', 'title' => __('Invoice created on', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT), 'txt_separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'status' => array('id' => 'status', 'title' => __('Invoice status', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'field_options' => MS_Model_Invoice::get_status_types(true), 'value' => $invoice->status), 'user_id' => array('id' => 'user_id', 'title' => __('Invoice for member', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->user_id, 'field_options' => $user_list), 'membership_id' => array('id' => 'membership_id', 'title' => __('Payment for membership', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->membership_id, 'field_options' => $this->data['memberships']), 'amount' => array('id' => 'amount', 'title' => sprintf(__('Amount (%s)', 'membership2'), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_NUMBER, 'value' => MS_Helper_Billing::format_price($invoice->amount), 'config' => array('step' => 'any', 'min' => 0)), 'discount' => array('id' => 'discount', 'title' => sprintf(__('Discount (%s)', 'membership2'), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_NUMBER, 'value' => MS_Helper_Billing::format_price($invoice->discount), 'config' => array('step' => 'any', 'min' => 0)), 'due_date' => array('id' => 'due_date', 'title' => __('Due date', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_DATEPICKER, 'value' => $invoice->due_date), 'description' => array('id' => 'description', 'title' => __('Description', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'class' => 'widefat', 'value' => $invoice->description), 'notes' => array('id' => 'notes', 'title' => __('Notes', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT_AREA, 'class' => 'widefat', 'value' => $invoice->get_notes_desc()), 'invoice_id' => array('id' => 'invoice_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->id), '_wpnonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($this->data['action'])), 'action' => array('id' => 'action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $this->data['action']), 'separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'execute' => array('id' => 'execute', 'title' => __('Execute status change actions on Save (add/remove membership)', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_CHECKBOX, 'value' => true), 'cancel' => array('id' => 'cancel', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'title' => __('Cancel', 'membership2'), 'value' => __('Cancel', 'membership2'), 'url' => esc_url_raw(remove_query_arg(array('action', 'invoice_id'))), 'class' => 'wpmui-field-button button'), 'submit' => array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save Changes', 'membership2')));
     if ($invoice->id > 0) {
         $fields['user_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
         $fields['membership_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
         $fields['txt_membership']['value'] = $this->data['memberships'][$invoice->membership_id];
         $fields['txt_created']['value'] = MS_Helper_Period::format_date($invoice->invoice_date);
     } else {
         unset($fields['txt_user']);
         unset($fields['txt_membership']);
         unset($fields['txt_created']);
         unset($fields['txt_separator']);
     }
     return apply_filters('ms_view_billing_edit_prepare_fields', $fields, $this);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:37,代码来源:class-ms-view-billing-edit.php


示例4: get_columns

 /**
  * Defines the columns of the list table
  *
  * @since  1.0.0
  * @return array
  */
 public function get_columns()
 {
     $currency = MS_Plugin::instance()->settings->currency;
     $columns = apply_filters('ms_helper_listtable_transactionlog_columns', array('id' => __('ID', 'membership2'), 'date' => __('Time', 'membership2'), 'status' => '', 'method' => '', 'gateway' => __('Gateway', 'membership2'), 'amount' => __('Amount', 'membership2'), 'invoice' => __('Invoice', 'membership2'), 'note' => __('Details', 'membership2')));
     $columns = apply_filters('ms_helper_listtable_transactionlog_get_columns', $columns, $currency);
     return $columns;
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:13,代码来源:class-ms-helper-listtable-transactionlog.php


示例5: to_html

    public function to_html()
    {
        $settings = $this->data['settings'];
        $fields = array('plugin_enabled' => array('id' => 'plugin_enabled', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => __('Content Protection', 'membership2'), 'desc' => __('This setting toggles the content protection on this site.', 'membership2'), 'value' => MS_Plugin::is_enabled(), 'data_ms' => array('action' => MS_Controller_Settings::AJAX_ACTION_TOGGLE_SETTINGS, 'setting' => 'plugin_enabled')), 'hide_admin_bar' => array('id' => 'hide_admin_bar', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => __('Hide admin toolbar', 'membership2'), 'desc' => __('Hide the admin toolbar for non administrator users.', 'membership2'), 'value' => $settings->hide_admin_bar, 'data_ms' => array('action' => MS_Controller_Settings::AJAX_ACTION_TOGGLE_SETTINGS, 'setting' => 'hide_admin_bar')));
        $fields = apply_filters('ms_view_settings_prepare_general_fields', $fields);
        $setup = MS_Factory::create('MS_View_Settings_Page_Setup');
        $action_url = esc_url_raw(remove_query_arg(array('msg')));
        ob_start();
        MS_Helper_Html::settings_tab_header();
        ?>

		<form action="<?php 
        echo esc_url($action_url);
        ?>
" method="post" class="cf">
			<div class="cf">
				<div class="ms-half">
					<?php 
        MS_Helper_Html::html_element($fields['plugin_enabled']);
        ?>
				</div>
				<div class="ms-half">
					<?php 
        MS_Helper_Html::html_element($fields['hide_admin_bar']);
        ?>
				</div>
			</div>
			<?php 
        MS_Helper_Html::html_separator();
        MS_Helper_Html::html_element($setup->html_full_form());
        ?>
		</form>
		<?php 
        return ob_get_clean();
    }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:35,代码来源:class-ms-view-settings-page-general.php


示例6: option_key

 /**
  * validates and prepares the option key before it is used to read/write
  * a value in the database.
  *
  * @since  1.0.0
  * @api Used by MS_Factory
  *
  * @return string
  */
 public function option_key()
 {
     // Option key should be all lowercase.
     $key = strtolower(get_class($this));
     // Network-wide mode uses different options then single-site mode.
     if (MS_Plugin::is_network_wide()) {
         $key .= '-network';
     }
     return substr($key, 0, 64);
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:19,代码来源:class-ms-model-option.php


示例7: set_gateway

 /**
  * Sets the parent gateway of the API object.
  *
  * The parent gateway object is used to fetch the API keys.
  *
  * @since 1.0.1.0
  * @param MS_Gateway $gateway The parent gateway.
  */
 public function set_gateway($gateway)
 {
     static $Stripe_Loaded = false;
     if (!$Stripe_Loaded) {
         require_once MS_Plugin::instance()->dir . '/lib/stripe-php/lib/Stripe.php';
         do_action('ms_gateway_stripe_load_stripe_lib_after', $this);
         $Stripe_Loaded = true;
     }
     $this->_gateway = $gateway;
     $secret_key = $this->_gateway->get_secret_key();
     M2_Stripe::setApiKey($secret_key);
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:20,代码来源:class-ms-gateway-stripe-api.php


示例8: column_discount

 public function column_discount($item)
 {
     $html = '';
     if (MS_Addon_Coupon_Model::TYPE_VALUE == $item->discount_type) {
         $html = sprintf('%s %s', MS_Plugin::instance()->settings->currency, MS_Helper_Billing::format_price($item->discount));
     } elseif (MS_Addon_Coupon_Model::TYPE_PERCENT == $item->discount_type) {
         $html = $item->discount . ' %';
     } else {
         $html = apply_filters('ms_addon_coupon_helper_listtable_column_discount', $item->discount);
     }
     return $html;
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:12,代码来源:class-ms-addon-coupon-helper-listtable.php


示例9: process_item

 /**
  * Processes a single import command.
  *
  * @since  1.0.0
  * @param  array $item The import command.
  */
 protected function process_item($item, $source)
 {
     $res = false;
     lib2()->array->equip($item, 'task', 'data');
     $task = $item['task'];
     $data = $item['data'];
     $model = MS_Factory::create('MS_Model_Import');
     $model->source_key = $source;
     // Set MS_STOP_EMAILS modifier to suppress any outgoing emails.
     MS_Plugin::set_modifier('MS_STOP_EMAILS', true);
     // Possible tasks are defined in ms-view-settings-import.js
     switch ($task) {
         case 'start':
             lib2()->array->equip($item, 'clear');
             $clear = lib2()->is_true($item['clear']);
             $model->start($clear);
             $res = true;
             break;
         case 'import-membership':
             // Function expects an object, not an array!
             $data = (object) $data;
             $model->import_membership($data);
             $res = true;
             break;
         case 'import-member':
             // Function expects an object, not an array!
             $data = (object) $data;
             $model->import_member($data);
             $res = true;
             break;
         case 'import-settings':
             lib2()->array->equip($item, 'setting', 'value');
             $setting = $item['setting'];
             $value = $item['value'];
             $model->import_setting($setting, $value);
             $res = true;
             break;
         case 'done':
             $model->done();
             $res = true;
             break;
     }
     /**
      * After the import action was complated notify other objects and
      * add-ons.
      *
      * @since  1.0.0
      */
     do_action('ms_import_action_' . $task, $item);
     return $res;
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:57,代码来源:class-ms-controller-import.php


示例10: __construct

 /**
  * Prepare the metabox.
  *
  * @since  1.0.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->metabox_title = __('Membership Access', 'membership2');
     $post_types = array_merge(array('page', 'post', 'attachment'), array());
     $this->post_types = apply_filters('ms_controller_membership_metabox_add_meta_boxes_post_types', $post_types);
     if (!MS_Plugin::is_enabled()) {
         return $this;
     }
     $this->add_action('add_meta_boxes', 'add_meta_boxes', 10);
     $this->add_action('admin_enqueue_scripts', 'admin_enqueue_scripts');
     $this->add_ajax_action(self::AJAX_ACTION_TOGGLE_ACCESS, 'ajax_action_toggle_metabox_access');
     // Populates the WP editor with default contents of a page
     $this->add_action('the_editor_content', 'show_default_content');
 }
开发者ID:oshabaeva,项目名称:project-s-v2,代码行数:20,代码来源:class-ms-controller-metabox.php


示例11: prepare_fields

 /**
  * Prepare html fields.
  *
  * @since  1.0.0
  *
  * @return array
  */
 function prepare_fields()
 {
     $invoice = $this->data['invoice'];
     $currency = MS_Plugin::instance()->settings->currency;
     $fields = array('txt_user' => array('id' => 'txt_user', 'title' => __('Username', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'value' => $this->data['users'][$invoice->user_id]), 'txt_membership' => array('id' => 'txt_membership', 'title' => __('Membership', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::TYPE_HTML_TEXT), 'txt_separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'status' => array('id' => 'status', 'title' => __('Status', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'field_options' => MS_Model_Invoice::get_status_types(), 'value' => $invoice->status), 'user_id' => array('id' => 'user_id', 'title' => __('Username', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->user_id, 'field_options' => $this->data['users']), 'membership_id' => array('id' => 'membership_id', 'title' => __('Membership', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->membership_id, 'field_options' => $this->data['memberships']), 'description' => array('id' => 'description', 'title' => __('Description', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'value' => $invoice->description), 'amount' => array('id' => 'amount', 'title' => sprintf(__('Amount (%s)', MS_TEXT_DOMAIN), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'value' => $invoice->amount), 'discount' => array('id' => 'discount', 'title' => sprintf(__('Discount (%s)', MS_TEXT_DOMAIN), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'value' => $invoice->discount), 'due_date' => array('id' => 'due_date', 'title' => __('Due date', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_DATEPICKER, 'value' => $invoice->due_date), 'notes' => array('id' => 'notes', 'title' => __('Notes', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT_AREA, 'value' => $invoice->get_notes_desc()), 'invoice_id' => array('id' => 'invoice_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->id), '_wpnonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($this->data['action'])), 'action' => array('id' => 'action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $this->data['action']), 'separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'execute' => array('id' => 'execute', 'title' => __('Execute status change actions on Save (add/remove membership)', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_CHECKBOX, 'value' => true), 'cancel' => array('id' => 'cancel', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'title' => __('Cancel', MS_TEXT_DOMAIN), 'value' => __('Cancel', MS_TEXT_DOMAIN), 'url' => esc_url_raw(remove_query_arg(array('action', 'invoice_id'))), 'class' => 'wpmui-field-button button'), 'submit' => array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save Changes', MS_TEXT_DOMAIN)));
     if ($invoice->id > 0) {
         $fields['user_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
         $fields['membership_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
         $fields['txt_membership']['value'] = $this->data['memberships'][$invoice->membership_id];
     } else {
         unset($fields['txt_user']);
         unset($fields['txt_membership']);
         unset($fields['txt_separator']);
     }
     return apply_filters('ms_view_billing_edit_prepare_fields', $fields, $this);
 }
开发者ID:klgrimley,项目名称:mzf,代码行数:23,代码来源:class-ms-view-billing-edit.php


示例12: get_tabs

 /**
  * Get available tabs.
  *
  * @since  1.0.0
  *
  * @return array The tabs configuration.
  */
 public function get_tabs()
 {
     $tabs = array('general' => array('title' => __('General', MS_TEXT_DOMAIN)), 'shortcodes' => array('title' => __('Shortcodes', MS_TEXT_DOMAIN)), 'network' => array('title' => __('Network-Wide Protection', MS_TEXT_DOMAIN)), 'advanced' => array('title' => __('Advanced Settings', MS_TEXT_DOMAIN)), 'api' => array('title' => __('API Docs', MS_TEXT_DOMAIN), 'url' => MS_Plugin::instance()->url . 'docs/namespaces/default.html', 'target' => '_blank'));
     if (!is_multisite()) {
         unset($tabs['network']);
     }
     lib2()->array->equip_get('page');
     $def_key = MS_Controller_Plugin::MENU_SLUG . '-help';
     $page = sanitize_html_class($_GET['page'], $def_key);
     foreach ($tabs as $key => $tab) {
         if (empty($tabs[$key]['url'])) {
             $tabs[$key]['url'] = sprintf('admin.php?page=%1$s&tab=%2$s', esc_attr($page), esc_attr($key));
         }
     }
     return apply_filters('ms_controller_help_get_tabs', $tabs, $this);
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:23,代码来源:class-ms-controller-help.php


示例13: to_html

    /**
     * Overrides parent's to_html() method.
     *
     * Creates an output buffer, outputs the HTML and grabs the buffer content before releasing it.
     * Creates a wrapper 'ms-wrap' HTML element to contain content and navigation. The content inside
     * the navigation gets loaded with dynamic method calls.
     * e.g. if key is 'settings' then render_settings() gets called, if 'bob' then render_bob().
     *
     * @since  1.0.0
     * @api
     *
     * @return string
     */
    public function to_html()
    {
        $form_fields = $this->prepare_fields();
        $setup_url = MS_Controller_Plugin::get_admin_url('setup');
        ob_start();
        // Render tabbed interface.
        ?>
		<div class="ms-wrap wrap">
			<form class="ms-welcome-box" action="<?php 
        echo esc_url($setup_url);
        ?>
" method="POST">
				<h2 class="ms-welcome-title">
					<?php 
        _e('Welcome!', MS_TEXT_DOMAIN);
        ?>
				</h2>

				<div class="ms-welcome-text">
					<?php 
        _e('Hello and welcome to <strong>Membership2</strong> by WPMU DEV. Please follow this simple set-up<br />wizard to help us determine the settings that are most relevant to your needs. Don\'t worry, you<br />can always change these settings in the future.', MS_TEXT_DOMAIN);
        ?>
				</div>

				<div class="ms-welcome-image-box">
					<img src="<?php 
        echo esc_attr(MS_Plugin::instance()->url);
        ?>
app/assets/images/welcome.png" class="ms-welcome-image" />
				</div>

				<?php 
        foreach ($form_fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        ?>
			</form>
		</div>
		<?php 
        return ob_get_clean();
    }
开发者ID:klgrimley,项目名称:mzf,代码行数:54,代码来源:class-ms-view-welcome.php


示例14: init

 /**
  * Adds the hooks to integrate with Membership2.
  *
  * This function is called when Membership2 is active and initializtion
  * is done.
  *
  * @since  1.0.0
  * @param  MS_Controller_Api $api The API instance.
  */
 public function init($api)
 {
     $this->api = $api;
     if (MS_Plugin::is_network_wide()) {
         $affiliate_plugin = 'affiliate/affiliate.php';
         if (!function_exists('is_plugin_active_for_network')) {
             require_once ABSPATH . '/wp-admin/includes/plugin.php';
         }
         if (!is_plugin_active_for_network($affiliate_plugin) && current_user_can('manage_options')) {
             lib2()->ui->admin_message(__('Membership2 uses network-wide protection.<br>Please network activate the Affiliate plugin to avoid problems with the Membership2 integration for Affiliates.', 'affiliate'), 'err');
         }
     }
     // -- Frontend integration
     // Reward for the referrer of the member.
     add_action('ms_invoice_paid', array($this, 'payment_processed'), 10, 2);
     // -- Admin integration
     // Display Affiliate settings on the Membership payment options page.
     add_action('ms_view_membership_payment_form', array($this, 'form'), 10, 2);
     // Save Affiliate settings via Ajax request.
     add_action('wp_ajax_' . self::AJAX_ACTION, array($this, 'save'));
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:30,代码来源:membership2.php


示例15: is_current_site

 /**
  * Checks if the specified rule-key defines a rule that is relevant for the
  * current site in the network.
  *
  * If network-wide protection is disabled this function always returns true.
  *
  * @since  1.0.0
  * @param  string $key
  * @return bool
  */
 public static function is_current_site($key)
 {
     $res = true;
     $site_id = 0;
     if (MS_Plugin::is_network_wide()) {
         $parts = explode(':', $key);
         // Some rules have no site_id prefix (like URL rules)
         if (2 == count($parts)) {
             list($site_id, $type) = $parts;
             $site_id = intval($site_id);
             $res = MS_Factory::current_blog_id() == $site_id;
         }
     }
     return $res;
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:25,代码来源:class-ms-rule.php


示例16: get_capabilities

 /**
  * Get a simple array of capabilties (e.g. for display in select lists)
  *
  * @since  1.0.0
  * @global array $menu
  *
  * @return array {
  *      @type string $id The id.
  *      @type string $name The name.
  * }
  */
 public function get_capabilities($args = null)
 {
     if (null === $this->_content_array) {
         $this->_content_array = array();
         $member = MS_Model_Member::get_current_member();
         $capslist = $member->wp_user->allcaps;
         $ignored_caps = array('level_10' => 1, 'level_9' => 1, 'level_8' => 1, 'level_7' => 1, 'level_6' => 1, 'level_5' => 1, 'level_4' => 1, 'level_3' => 1, 'level_2' => 1, 'level_1' => 1, 'level_0' => 1, 'administrator' => 1);
         $capslist = array_diff_assoc($capslist, $ignored_caps);
         $capslist = array_keys($capslist);
         /**
          * Exclude certain capabilities for security reasons.
          *
          * @since  1.0.0
          * @var array
          */
         $exclude = apply_filters('ms_rule_membercaps_model_exclude', array(MS_Plugin::instance()->controller->capability, 'edit_plugins', 'delete_plugins', 'edit_files', 'edit_users', 'delete_users', 'remove_users', 'promote_users', 'list_users'));
         $capslist = array_diff($capslist, $exclude);
         $this->_content_array = array_combine($capslist, $capslist);
         // Make sure the rule_value only contains valid items.
         $rule_value = array_intersect_key($this->rule_value, $this->_content_array);
         $this->rule_value = lib2()->array->get($rule_value);
         // If not visitor membership, just show Membership2
         if (!$this->get_membership()->is_base()) {
             $this->_content_array = array_intersect_key($this->_content_array, $this->rule_value);
         }
         $this->_content_array = apply_filters('ms_rule_membercaps_model_get_content_array', $this->_content_array, $this);
     }
     $contents = $this->_content_array;
     // Search the shortcode-tag...
     if (!empty($args['s'])) {
         foreach ($contents as $key => $name) {
             if (false === stripos($name, $args['s'])) {
                 unset($contents[$key]);
             }
         }
     }
     $filter = self::get_exclude_include($args);
     if (is_array($filter->include)) {
         $contents = array_intersect($contents, $filter->include);
     } elseif (is_array($filter->exclude)) {
         $contents = array_diff($contents, $filter->exclude);
     }
     // Pagination
     if (!empty($args['posts_per_page'])) {
         $total = $args['posts_per_page'];
         $offset = !empty($args['offset']) ? $args['offset'] : 0;
         $contents = array_slice($contents, $offset, $total);
     }
     return $contents;
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:61,代码来源:class-ms-rule-membercaps-model.php


示例17: taxamo

 /**
  * Returns the Taxamo REST API object.
  *
  * Important: All calls to `taxamo()->` functions must be wrapped in
  * try..catch because an invalid API token will result in a fatal error.
  *
  * @since  1.0.0
  * @return Taxamo
  */
 protected static function taxamo()
 {
     static $Taxamo = null;
     if (null === $Taxamo) {
         if (!class_exists('Taxamo')) {
             require_once MS_Plugin::instance()->dir . '/lib/taxamo/Taxamo.php';
         }
         // Initialize the Taxamo API connection
         $connection = new APIClient(MS_Addon_Taxamo::model()->get('private_key'), 'https://api.taxamo.com');
         // Initialize the Taxamo REST API wrapper.
         $Taxamo = new Taxamo($connection);
         // Initialize the API object.
         self::init();
     }
     return $Taxamo;
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:25,代码来源:class-ms-addon-taxamo-api.php


示例18: get_contents

    /**
     * Returns the contens of the dialog
     *
     * @since  1.0.0
     *
     * @return object
     */
    public function get_contents($data)
    {
        $member = $data['model'];
        $currency = MS_Plugin::instance()->settings->currency;
        $show_trial = MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_TRIAL);
        $all_subscriptions = MS_Model_Relationship::get_subscriptions(array('user_id' => $member->id, 'status' => 'all', 'meta_key' => 'expire_date', 'orderby' => 'meta_value', 'order' => 'DESC'));
        // Prepare the form fields.
        $inp_dialog = array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'name' => 'dialog', 'value' => 'View_Member_Dialog');
        $inp_id = array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'name' => 'member_id', 'value' => $member->id);
        $inp_nonce = array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'name' => '_wpnonce', 'value' => wp_create_nonce(self::ACTION_SAVE));
        $inp_action = array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'name' => 'dialog_action', 'value' => self::ACTION_SAVE);
        $inp_save = array('type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save', 'membership2'), 'class' => 'ms-submit-form', 'data' => array('form' => 'ms-edit-member'));
        $inp_cancel = array('type' => MS_Helper_Html::INPUT_TYPE_BUTTON, 'value' => __('Close', 'membership2'), 'class' => 'close');
        ob_start();
        ?>
		<div>
			<form class="ms-form wpmui-ajax-update ms-edit-member" data-wpmui-ajax="<?php 
        echo esc_attr('save');
        ?>
">
				<div class="ms-form wpmui-form wpmui-grid-8">
					<table class="widefat">
					<thead>
						<tr>
							<th class="column-membership">
								<?php 
        _e('Membership', 'membership2');
        ?>
							</th>
							<th class="column-status">
								<?php 
        _e('Status', 'membership2');
        ?>
							</th>
							<th class="column-start">
								<?php 
        _e('Subscribed on', 'membership2');
        ?>
							</th>
							<th class="column-expire">
								<?php 
        _e('Expires on', 'membership2');
        ?>
							</th>
							<?php 
        if ($show_trial) {
            ?>
							<th class="column-trialexpire">
								<?php 
            _e('Trial until', 'membership2');
            ?>
							</th>
							<?php 
        }
        ?>
							<th class="column-payments">
								<?php 
        _e('Payments', 'membership2');
        ?>
							</th>
						</tr>
					</thead>
					<tbody>
					<?php 
        foreach ($all_subscriptions as $subscription) {
            $membership = $subscription->get_membership();
            $payments = $subscription->get_payments();
            $num_payments = count($payments);
            $amount_payments = 0;
            foreach ($payments as $payment) {
                $amount_payments += $payment['amount'];
            }
            $subscription_info = array('subscription_id' => $subscription->id);
            $update_info = array('subscription_id' => $subscription->id, 'statuscheck' => 'yes');
            ?>
						<tr>
							<td class="column-membership">
								<?php 
            $membership->name_tag();
            ?>
							</td>
							<td class="column-status">
								<?php 
            printf('<a href="#" data-ms-dialog="View_Member_Subscription" data-ms-data="%2$s">%1$s</a>
									<a href="#" data-ms-dialog="View_Member_Subscription" data-ms-data="%3$s" title="%5$s">%4$s</a>', $subscription->status, esc_attr(json_encode($subscription_info)), esc_attr(json_encode($update_info)), '<i class="dashicons dashicons-update"></i>', __('Check and update subscription status', 'membership2'));
            ?>
							</td>
							<td class="column-start">
								<?php 
            echo $subscription->start_date;
            ?>
							</td>
							<td class="column-expire">
//.........这里部分代码省略.........
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:101,代码来源:class-ms-view-member-dialog.php


示例19: to_html

    public function to_html()
    {
        ob_start();
        ?>
		<div class="ms-account-wrapper">
			<?php 
        if (MS_Model_Member::is_logged_in()) {
            ?>
				<h2>
					<?php 
            _e('Invoice', MS_TEXT_DOMAIN);
            ?>
				</h2>
				<table>
					<thead>
						<tr>
							<th class="ms-col-invoice-no"><?php 
            _e('Invoice #', MS_TEXT_DOMAIN);
            ?>
</th>
							<th class="ms-col-invoice-status"><?php 
            _e('Status', MS_TEXT_DOMAIN);
            ?>
</th>
							<th class="ms-col-invoice-total"><?php 
            printf('%s (%s)', __('Total', MS_TEXT_DOMAIN), MS_Plugin::instance()->settings->currency);
            ?>
</th>
							<th class="ms-col-invoice-title"><?php 
            _e('Membership', MS_TEXT_DOMAIN);
            ?>
</th>
							<th class="ms-col-invoice-due"><?php 
            _e('Due date', MS_TEXT_DOMAIN);
            ?>
</th>
						</tr>
					</thead>
					<tbody>
					<?php 
            foreach ($this->data['invoices'] as $invoice) {
                $inv_membership = MS_Factory::load('MS_Model_Membership', $invoice->membership_id);
                $inv_classes = array('ms-invoice-' . $invoice->id, 'ms-subscription-' . $invoice->ms_relationship_id, 'ms-invoice-' . $invoice->status, 'ms-gateway-' . $invoice->gateway_id, 'ms-membership-' . $invoice->membership_id, 'ms-type-' . $inv_membership->type, 'ms-payment-' . $inv_membership->payment_type);
                ?>
						<tr class="<?php 
                echo esc_attr(implode(' ', $inv_classes));
                ?>
">
							<td class="ms-col-invoice-no"><?php 
                printf('<a href="%s">%s</a>', get_permalink($invoice->id), $invoice->get_invoice_number());
                ?>
</td>
							<td class="ms-col-invoice-status"><?php 
                echo esc_html($invoice->status_text());
                ?>
</td>
							<td class="ms-col-invoice-total"><?php 
                echo esc_html(MS_Helper_Billing::format_price($invoice->total));
                ?>
</td>
							<td class="ms-col-invoice-title"><?php 
                echo esc_html($inv_membership->name);
                ?>
</td>
							<td class="ms-col-invoice-due"><?php 
                echo esc_html(MS_Helper_Period::format_date($invoice->due_date, __('F j', MS_TEXT_DOMAIN)));
                ?>
</td>
						</tr>
					<?php 
            }
            ?>
					</tbody>
				</table>
			<?php 
        } else {
            ?>
				<?php 
            $redirect = esc_url_raw(add_query_arg(array()));
            $title = __('Your account', MS_TEXT_DOMAIN);
            echo do_shortcode("[ms-membership-login redirect='{$redirect}' title='{$title}']");
            ?>
			<?php 
        }
        ?>
		</div>
		<?php 
        $html = ob_get_clean();
        $html = apply_filters('ms_compact_code', $html);
        return $html;
    }
开发者ID:klgrimley,项目名称:mzf,代码行数:91,代码来源:class-ms-view-frontend-invoices.php


示例20: body_class

 /**
  * Appends classes to the HTML body that identify all memberships that the
  * current user is registered to. This allows webdesigners to adjust layout
  * or hide elements based on the membership a user has.
  *
  * @since  1.0.0
  *
  * @param  array $class Class-names to attach to the body.
  * @return array Modified class-names to attach to the body.
  */
 public function body_class($classes)
 {
     $member = MS_Model_Member::get_current_member();
     if (!$member->is_logged_in()) {
         $classes[] = 'ms-guest';
     } else {
         $classes[] = 'ms-member';
         $classes[] = 'ms-member-' . $member->id;
     }
     $info = MS_Plugin::instance()->controller->get_access_info();
     foreach ($info['memberships'] as $membership_id) {
         $classes[] = 'ms-' . absint($membership_id);
     }
     return $classes;
 }
开发者ID:klgrimley,项目名称:mzf,代码行数:25,代码来源:class-ms-controller-frontend.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP MShop_Context_Item_Interface类代码示例发布时间:2022-05-23
下一篇:
PHP MS_Model_Membership类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap