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

PHP mycred_get_types函数代码示例

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

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



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

示例1: my_history_screen

        /**
         * My History Content
         * @since 0.1
         * @version 1.2
         */
        public function my_history_screen()
        {
            global $bp;
            $mycred_types = mycred_get_types();
            $type = 'mycred_default';
            if (isset($_REQUEST['show-ctype']) && array_key_exists($_REQUEST['show-ctype'], $mycred_types)) {
                $type = $_REQUEST['show-ctype'];
            }
            $args = array('user_id' => bp_displayed_user_id(), 'number' => apply_filters('mycred_bp_history_num_to_show', $this->buddypress['history_num']), 'ctype' => $type);
            if (isset($_GET['paged']) && $_GET['paged'] != '') {
                $args['paged'] = $_GET['paged'];
            }
            if (isset($bp->canonical_stack['action']) && $bp->canonical_stack['action'] != $this->buddypress['history_url']) {
                $args['time'] = $bp->canonical_stack['action'];
            }
            $log = new myCRED_Query_Log($args);
            unset($log->headers['column-username']);
            ob_start();
            if (count($mycred_types) > 1) {
                ?>
<form action="" id="mycred-sort-cred-history-form" method="get" style="display: block; height: 48px; float: right;"><label>Show:</label> <?php 
                mycred_types_select_from_dropdown('show-ctype', 'mycred-select-type', $type);
                ?>
 <input type="submit" class="btn btn-large btn-primary button button-large button-primary" value="<?php 
                _e('Go', 'mycred');
                ?>
" /></form>
<?php 
            }
            ?>
<style type="text/css">
.pagination-links { float: right; }
.tablenav { vertical-align: middle; }
</style>
<div class="wrap" id="myCRED-wrap">

	<?php 
            $log->mobile_support();
            ?>

	<form method="get" action="">
		<div class="tablenav top clear clearfix">

			<?php 
            if ($log->have_entries() && $log->max_num_pages > 1) {
                $log->navigation('top');
            }
            ?>

		</div>

		<?php 
            $log->display();
            ?>

		<div class="tablenav bottom clear clearfix">

			<?php 
            if ($log->have_entries() && $log->max_num_pages > 1) {
                $log->navigation('bottom');
            }
            ?>

		</div>

	</form>
</div>
<?php 
            $log->reset_query();
            $output = ob_get_contents();
            ob_end_clean();
            echo apply_filters('mycred_bp_history_page', $output, $this);
        }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:78,代码来源:mycred-module-buddypress.php


示例2: mycred_display_badge_requirements

 function mycred_display_badge_requirements($post_id = NULL, $sep = '<br />')
 {
     $requirements = mycred_get_badge_requirements($post_id);
     if (empty($requirements)) {
         $reply = '-';
     } else {
         $types = mycred_get_types();
         $references = mycred_get_all_references();
         $output = array();
         foreach ($requirements as $row => $needs) {
             if (!isset($types[$needs['type']])) {
                 $point_type = '-';
             } else {
                 $point_type = $types[$needs['type']];
             }
             if (!isset($references[$needs['reference']])) {
                 $ref = '-';
             } else {
                 $ref = $references[$needs['reference']];
             }
             if ($needs['by'] == 'count') {
                 $output[] = $point_type . ' ' . __('for', 'mycred') . ' ' . $ref . ' ' . $needs['amount'] . ' ' . __('time(s)', 'mycred');
             } else {
                 $output[] = $needs['amount'] . ' ' . $point_type . ' ' . __('for', 'mycred') . ' ' . $ref . ' ' . __('in total', 'mycred');
             }
         }
         $reply = implode($sep, $output) . '.';
     }
     return apply_filters('mycred_badge_display_requirements', $reply, $post_id, $sep);
 }
开发者ID:rafasashi,项目名称:mycred,代码行数:30,代码来源:mycred-badge-functions.php


示例3: mycred_render_my_ranks

 function mycred_render_my_ranks($atts, $content = NULL)
 {
     extract(shortcode_atts(array('user_id' => NULL, 'show_title' => 1, 'show_logo' => 0, 'logo_size' => 'post-thumbnail', 'first' => 'logo'), $atts));
     if ($user_id === NULL && !is_user_logged_in()) {
         return;
     }
     if ($user_id === NULL) {
         $user_id = get_current_user_id();
     }
     $mycred_types = mycred_get_types();
     $show = array();
     foreach ($mycred_types as $type_id => $label) {
         $row = array();
         $rank_id = mycred_get_users_rank_id($user_id, $type_id);
         if ($show_logo) {
             $row[] = mycred_get_rank_logo($rank_id, $logo_size);
         }
         if ($show_title) {
             $row[] = get_the_title($rank_id);
         }
         if ($first != 'logo') {
             $row = array_reverse($row);
         }
         $show = array_merge($row, $show);
     }
     if (empty($show)) {
         return;
     }
     return '<div class="mycred-all-ranks">' . implode(' ', $show) . '</div>';
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:30,代码来源:mycred-rank-shortcodes.php


示例4: __construct

 /**
  * Construct
  */
 function __construct($args = array(), $hook_prefs = NULL, $type = 'mycred_default')
 {
     if (!empty($args)) {
         foreach ($args as $key => $value) {
             $this->{$key} = $value;
         }
     }
     // Grab myCRED Settings
     $this->core = mycred($type);
     $this->point_types = mycred_get_types();
     if ($type != '') {
         $this->core->cred_id = sanitize_text_field($type);
         $this->mycred_type = $this->core->cred_id;
     }
     if ($this->mycred_type != 'mycred_default') {
         $this->is_main_type = false;
     }
     // Grab settings
     if ($hook_prefs !== NULL) {
         // Assign prefs if set
         if (isset($hook_prefs[$this->id])) {
             $this->prefs = $hook_prefs[$this->id];
         }
         // Defaults must be set
         if (!isset($this->defaults)) {
             $this->defaults = array();
         }
     }
     // Apply default settings if needed
     if (!empty($this->defaults)) {
         $this->prefs = mycred_apply_defaults($this->defaults, $this->prefs);
     }
 }
开发者ID:sebastianringel,项目名称:stammtisch,代码行数:36,代码来源:mycred-abstract-hook.php


示例5: init_form_fields

 /**
  * Initialise Gateway Settings Form Fields
  * @since 0.1
  * @version 1.4
  */
 function init_form_fields()
 {
     // Fields
     $fields['enabled'] = array('title' => __('Enable/Disable', 'mycred'), 'type' => 'checkbox', 'label' => __('Enable myCRED Payment', 'mycred'), 'default' => 'no', 'description' => __('Users who are not logged in or excluded from using myCRED will not have access to this gateway!', 'mycred'));
     $fields['title'] = array('title' => __('Title', 'mycred'), 'type' => 'text', 'description' => __('Title to show for this payment option.', 'mycred'), 'default' => __('Pay with myCRED', 'mycred'), 'desc_tip' => true);
     $fields['description'] = array('title' => __('Customer Message', 'mycred'), 'type' => 'textarea', 'default' => $this->mycred->template_tags_general('Deduct the amount from your %_plural% balance.'));
     $fields['log_template'] = array('title' => __('Log Template', 'mycred'), 'type' => 'text', 'description' => $this->mycred->available_template_tags(array('general'), '%order_id%, %order_link%'), 'default' => 'Payment for Order: #%order_id%');
     $fields['log_template_refund'] = array('title' => __('Refund Log Template', 'mycred'), 'type' => 'text', 'description' => $this->mycred->available_template_tags(array('general'), '%order_id%, %reason%'), 'default' => 'Payment refund for order #%order_id% Reason: %reason%');
     // Multiple Point Types Setup
     $mycred_types = mycred_get_types();
     if (count($mycred_types) > 1) {
         $fields['point_type'] = array('title' => __('Point Type', 'mycred'), 'type' => 'select', 'label' => __('Select the point type users can use to pay.', 'mycred'), 'options' => $mycred_types, 'default' => 'mycred_default');
     } else {
         $fields['point_type'] = array('type' => 'hidden', 'value' => 'mycred_default');
     }
     // Only add exchange rate if the currecy is not set to mycred
     if ($this->use_exchange()) {
         $exchange_desc = __('How much is 1 %_singular% worth in %currency%?', 'mycred');
         $exchange_desc = $this->mycred->template_tags_general($exchange_desc);
         $exchange_desc = str_replace('%currency%', get_woocommerce_currency(), $exchange_desc);
         $fields['exchange_rate'] = array('title' => __('Exchange Rate', 'mycred'), 'type' => 'text', 'description' => $exchange_desc, 'default' => 1, 'desc_tip' => true);
         $fields['show_total'] = array('title' => __('Show Total', 'mycred'), 'type' => 'select', 'label' => $this->mycred->template_tags_general(__('Show the final price in %_plural% .', 'mycred')), 'options' => array('' => __('Do not show', 'mycred'), 'cart' => __('Show in Cart', 'mycred'), 'checkout' => __('Show on Checkout Page', 'mycred'), 'all' => __('Show in Cart and on Checkout Page', 'mycred')), 'default' => '');
         $fields['total_label'] = array('title' => __('Label', 'mycred'), 'type' => 'text', 'default' => $this->mycred->template_tags_general(__('Order Total in %_plural%', 'mycred')), 'desc_tip' => true);
     }
     // Profit Sharing added in 1.3
     $fields['profit_sharing_percent'] = array('title' => __('Profit Sharing', 'mycred'), 'type' => 'text', 'description' => __('Option to share sales with the product owner. Use zero to disable.', 'mycred'), 'default' => 0, 'desc_tip' => true);
     $fields['profit_sharing_log'] = array('title' => __('Log Template', 'mycred'), 'type' => 'text', 'description' => __('Log entry template for profit sharing.', 'mycred') . ' ' . $this->mycred->available_template_tags(array('general', 'post')), 'default' => 'Sale of %post_title%');
     $fields['profit_sharing_refund_log'] = array('title' => __('Refund Log Template', 'mycred'), 'type' => 'text', 'description' => __('Log entry template for refunds of profit shares.', 'mycred') . ' ' . $this->mycred->available_template_tags(array('general', 'post')), 'default' => 'Refund for order #%order_id%');
     $this->form_fields = apply_filters('mycred_woo_fields', $fields, $this);
 }
开发者ID:suifengtec,项目名称:mycred,代码行数:35,代码来源:mycred-woocommerce.php


示例6: __construct

 /**
  * Construct
  */
 function __construct($gateway_prefs)
 {
     $types = mycred_get_types();
     $default_exchange = array();
     foreach ($types as $type => $label) {
         $default_exchange[$type] = 1;
     }
     parent::__construct(array('id' => 'bitpay', 'label' => 'Bitpay', 'gateway_logo_url' => plugins_url('assets/images/bitpay.png', myCRED_PURCHASE), 'defaults' => array('api_key' => '', 'currency' => 'USD', 'exchange' => $default_exchange, 'item_name' => __('Purchase of myCRED %plural%', 'mycred'), 'speed' => 'high', 'notifications' => 1)), $gateway_prefs);
 }
开发者ID:nfer,项目名称:mycred,代码行数:12,代码来源:bitpay.php


示例7: __construct

 /**
  * Construct
  */
 function __construct($gateway_prefs)
 {
     $types = mycred_get_types();
     $default_exchange = array();
     foreach ($types as $type => $label) {
         $default_exchange[$type] = 1;
     }
     parent::__construct(array('id' => 'paypal-standard', 'label' => 'PayPal', 'gateway_logo_url' => plugins_url('assets/images/paypal.png', myCRED_PURCHASE), 'defaults' => array('sandbox' => 0, 'currency' => '', 'account' => '', 'item_name' => 'Purchase of myCRED %plural%', 'exchange' => $default_exchange)), $gateway_prefs);
 }
开发者ID:sebastianringel,项目名称:stammtisch,代码行数:12,代码来源:paypal-standard.php


示例8: __construct

 /**
  * Construct
  */
 function __construct($gateway_prefs)
 {
     $types = mycred_get_types();
     $default_exchange = array();
     foreach ($types as $type => $label) {
         $default_exchange[$type] = 1;
     }
     parent::__construct(array('id' => 'skrill', 'label' => 'Skrill Payment', 'gateway_logo_url' => plugins_url('assets/images/skrill.png', myCRED_PURCHASE), 'defaults' => array('sandbox' => 0, 'currency' => '', 'account' => '', 'word' => '', 'account_title' => '', 'account_logo' => '', 'confirmation_note' => '', 'email_receipt' => 0, 'item_name' => 'Purchase of myCRED %plural%', 'exchange' => $default_exchange)), $gateway_prefs);
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:12,代码来源:skrill.php


示例9: __construct

 /**
  * Construct
  */
 function __construct($gateway_prefs)
 {
     global $netbilling_errors;
     $types = mycred_get_types();
     $default_exchange = array();
     foreach ($types as $type => $label) {
         $default_exchange[$type] = 1;
     }
     parent::__construct(array('id' => 'netbilling', 'label' => 'NETbilling', 'gateway_logo_url' => plugins_url('assets/images/netbilling.png', myCRED_PURCHASE), 'defaults' => array('sandbox' => 0, 'account' => '', 'site_tag' => '', 'item_name' => 'Purchase of myCRED %plural%', 'exchange' => $default_exchange, 'cryptokey' => '', 'currency' => 'USD')), $gateway_prefs);
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:13,代码来源:netbilling.php


示例10: mycred_update_to_onesix

 function mycred_update_to_onesix($version = NULL)
 {
     if ($version === NULL) {
         return;
     }
     // 1.6 Update
     if (version_compare($version, '1.6', '<')) {
         global $wpdb;
         $types = mycred_get_types();
         // Remove Login hook markers
         if (count($types) == 1) {
             $wpdb->delete($wpdb->usermeta, array('meta_key' => 'mycred_last_login'), array('%s'));
         } else {
             foreach ($types as $type_id => $label) {
                 $wpdb->delete($wpdb->usermeta, array('meta_key' => 'mycred_last_login_' . $type_id), array('%s'));
             }
         }
         // Update email notices to support multiple point types
         if (class_exists('myCRED_Email_Notice_Module')) {
             $notices = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'mycred_email_notice' AND post_status != 'trash';");
             if (!empty($notices)) {
                 foreach ($notices as $notice_id) {
                     update_post_meta((int) $notice_id, 'mycred_email_ctype', 'all');
                 }
             }
         }
         // Update ranks to support multiple point types
         if (class_exists('myCRED_Ranks_Module')) {
             $ranks = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'mycred_rank' AND post_status != 'trash';");
             if (!empty($ranks)) {
                 foreach ($ranks as $rank_id) {
                     update_post_meta((int) $rank_id, 'ctype', 'mycred_default');
                 }
             }
         }
     } elseif (version_compare($version, '1.6.7', '<')) {
         $addons = mycred_get_option('mycred_pref_addons');
         $addons = maybe_unserialize($addons);
         // Remove built-in add-ons Paths.
         if (!empty($addons['installed'])) {
             foreach ($addons['installed'] as $id => $info) {
                 $addons['installed'][$id]['path'] = str_replace(myCRED_ADDONS_DIR, '', $info['path']);
             }
             mycred_update_option('mycred_pref_addons', $addons);
         }
     }
     // Update complted
     update_option('mycred_version', myCRED_VERSION);
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:49,代码来源:mycred-update.php


示例11: mycred_get_type_color

 function mycred_get_type_color($type = NULL)
 {
     //$set = array( 'rgba(221,73,167,1)', 'rgba(106,187,218,1)', 'rgba(111,70,161,1)' );
     //$set = array( 'rgba(213,78,33,1)', 'rgba(46,162,204,1)', 'rgba(34,34,34,1)' );
     $set = array('rgba(204,175,11,1)', 'rgba(221,130,59,1)', 'rgba(207,73,68,1)', 'rgba(180,60,56,1)', 'rgba(34,34,34,1)');
     $types = mycred_get_types();
     $colors = array();
     $row = 0;
     foreach ($types as $type_id => $label) {
         $colors[$type_id] = $set[$row];
         $row++;
     }
     $result = $colors;
     if ($type !== NULL && array_key_exists($type, $colors)) {
         $result = $colors[$type];
     }
     return apply_filters('mycred_point_type_colors', $result, $set, $type, $types);
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:18,代码来源:mycred-stats-functions.php


示例12: __construct

 /**
  * Construct
  */
 function __construct($widget_id = NULL, $args = array(), $default = NULL)
 {
     if ($widget_id === NULL) {
         return false;
     }
     $this->id = str_replace(array('_', '-', ' '), '', $widget_id);
     $this->ctypes = mycred_get_types();
     if (!is_array($default)) {
         $default = array('ctypes' => 'all', 'span' => 0, 'number' => 5);
     }
     $this->args = wp_parse_args($args, $default);
     if ($this->args['ctypes'] == 'all') {
         $this->core = mycred();
     } else {
         $this->core = mycred($this->args['ctypes']);
     }
     $this->colors = mycred_get_type_color();
     $this->now = current_time('timestamp');
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:22,代码来源:mycred-abstract-stat-widget.php


示例13: __construct

 /**
  * Construct
  */
 function __construct($module_id = '', $args = array(), $type = 'mycred_default')
 {
     // Module ID is required
     if (empty($module_id)) {
         wp_die('myCRED_Module() Error. A Module ID is required!');
     }
     $this->module_id = $module_id;
     $this->core = mycred($type);
     if (!empty($type)) {
         $this->core->cred_id = sanitize_text_field($type);
         $this->mycred_type = $this->core->cred_id;
     }
     if ($this->mycred_type != 'mycred_default') {
         $this->is_main_type = false;
     }
     $this->point_types = mycred_get_types();
     // Default arguments
     $defaults = array('module_name' => '', 'option_id' => '', 'defaults' => array(), 'labels' => array('menu' => '', 'page_title' => ''), 'register' => true, 'screen_id' => '', 'add_to_core' => false, 'accordion' => false, 'cap' => 'plugin', 'menu_pos' => 10);
     $args = wp_parse_args($args, $defaults);
     $this->module_name = $args['module_name'];
     $this->option_id = $args['option_id'];
     if (!$this->is_main_type) {
         $this->option_id .= '_' . $this->mycred_type;
     }
     $this->settings_name = 'myCRED-' . $this->module_name;
     if (!$this->is_main_type) {
         $this->settings_name .= '-' . $this->mycred_type;
     }
     $this->labels = $args['labels'];
     $this->register = $args['register'];
     $this->screen_id = $args['screen_id'];
     if (!$this->is_main_type && !empty($this->screen_id)) {
         $this->screen_id = 'myCRED_' . $this->mycred_type . substr($this->screen_id, 6);
     }
     $this->add_to_core = $args['add_to_core'];
     $this->accordion = $args['accordion'];
     $this->cap = $args['cap'];
     $this->menu_pos = $args['menu_pos'];
     $this->default_prefs = $args['defaults'];
     $this->current_user_id = get_current_user_id();
     $this->now = current_time('timestamp');
     $this->set_settings();
 }
开发者ID:sebastianringel,项目名称:stammtisch,代码行数:46,代码来源:mycred-abstract-module.php


示例14: mycred_update_to_onesix

 function mycred_update_to_onesix($version = NULL)
 {
     if ($version === NULL) {
         return;
     }
     // 1.6 Update
     if (version_compare($version, '1.6', '<')) {
         global $wpdb;
         $types = mycred_get_types();
         // Remove Login hook markers
         if (count($types) == 1) {
             $wpdb->delete($wpdb->usermeta, array('meta_key' => 'mycred_last_login'), array('%s'));
         } else {
             foreach ($types as $type_id => $label) {
                 $wpdb->delete($wpdb->usermeta, array('meta_key' => 'mycred_last_login_' . $type_id), array('%s'));
             }
         }
         // Update email notices to support multiple point types
         if (class_exists('myCRED_Email_Notice_Module')) {
             $notices = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'mycred_email_notice' AND post_status != 'trash';");
             if (!empty($notices)) {
                 foreach ($notices as $notice_id) {
                     update_post_meta((int) $notice_id, 'mycred_email_ctype', 'all');
                 }
             }
         }
         // Update ranks to support multiple point types
         if (class_exists('myCRED_Ranks_Module')) {
             $ranks = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'mycred_rank' AND post_status != 'trash';");
             if (!empty($ranks)) {
                 foreach ($ranks as $rank_id) {
                     update_post_meta((int) $rank_id, 'ctype', 'mycred_default');
                 }
             }
         }
     }
     // Update complted
     update_option('mycred_version', myCRED_VERSION);
 }
开发者ID:sebastianringel,项目名称:stammtisch,代码行数:39,代码来源:mycred-update.php


示例15: mycred_display_badge_requirements

 function mycred_display_badge_requirements($post_id = NULL, $sep = '<br />')
 {
     $requirements = mycred_get_badge_requirements($post_id);
     if (empty($requirements)) {
         $reply = '-';
     } else {
         $types = mycred_get_types();
         $references = mycred_get_all_references();
         $req_count = count($requirements);
         $output = array();
         foreach ($requirements as $level => $needs) {
             if ($needs['type'] == '') {
                 $needs['type'] = 'mycred_default';
             }
             if (!isset($types[$needs['type']])) {
                 continue;
             }
             $mycred = mycred($needs['type']);
             $point_type = $mycred->plural();
             if (!isset($references[$needs['reference']])) {
                 $ref = '-';
             } else {
                 $ref = $references[$needs['reference']];
             }
             $level_label = '';
             if ($req_count > 1) {
                 $level_label = '<strong>' . sprintf(__('Level %s', 'mycred'), $level + 1) . '</strong>';
             }
             if ($needs['by'] == 'count') {
                 $output[] = sprintf(_x('%s for %s %s - %s', '"Points" for "reference" "x time(s)" - Level', 'mycred'), $point_type, $ref, sprintf(_n('1 time', '%d times', $needs['amount'], 'mycred'), $needs['amount']), $level_label);
             } else {
                 $output[] = sprintf(_x('%s for %s in total', '"x points" for "reference" in total', 'mycred'), $mycred->format_creds($needs['amount']), $ref);
             }
         }
         $reply = implode($sep, $output);
     }
     return apply_filters('mycred_badge_display_requirements', $reply, $post_id, $sep);
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:38,代码来源:mycred-badge-functions.php


示例16: get_users_balance

 /**
  * Get users balance
  * Returns the users balance unformated.
  *
  * @param $user_id (int), required user id
  * @param $type (string), optional cred type to check for
  * @returns zero if user id is not set or if no creds were found, else returns amount
  * @since 0.1
  * @version 1.4
  */
 public function get_users_balance($user_id = NULL, $type = NULL)
 {
     if ($user_id === NULL) {
         return $this->zero();
     }
     $types = mycred_get_types();
     if ($type === NULL || !array_key_exists($type, $types)) {
         $type = $this->get_cred_id();
     }
     $balance = mycred_get_user_meta($user_id, $type, '', true);
     if ($balance == '') {
         $balance = $this->zero();
     }
     // Let others play
     $balance = apply_filters('mycred_get_users_cred', $balance, $this, $user_id, $type);
     return $this->number($balance);
 }
开发者ID:suifengtec,项目名称:mycred,代码行数:27,代码来源:mycred-functions.php


示例17: mycred_woo_payout_rewards

 function mycred_woo_payout_rewards($order_id)
 {
     // Get Order
     $order = new WC_Order($order_id);
     // If we paid with myCRED we do not award points by default
     if ($order->payment_method == 'mycred' && apply_filters('mycred_woo_reward_mycred_payment', false) === false) {
         return;
     }
     // Get items
     $items = $order->get_items();
     // Get point types
     $types = mycred_get_types();
     // Loop
     foreach ($types as $type => $label) {
         // Load type
         $mycred = mycred($type);
         // Check for exclusions
         if ($mycred->exclude_user($order->user_id)) {
             continue;
         }
         // Calculate reward
         $reward = $mycred->zero();
         foreach ($items as $item) {
             $prefs = (array) get_post_meta($item['product_id'], 'mycred_reward', true);
             if (isset($prefs[$type]) && $prefs[$type] != '') {
                 $reward = $reward + $prefs[$type] * $item['qty'];
             }
         }
         // Award
         if ($reward != $mycred->zero()) {
             // Let others play with the reference and log entry
             $reference = apply_filters('mycred_woo_reward_reference', 'reward', $order_id, $type);
             $log = apply_filters('mycred_woo_reward_log', '%plural% reward for store purchase', $order_id, $type);
             // Execute
             $mycred->add_creds($reference, $order->user_id, $reward, $log, $order_id, array('ref_type' => 'post'), $type);
         }
     }
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:38,代码来源:mycred-hook-woocommerce.php


示例18: __construct

 /**
  * Construct
  * @since 1.6
  * @version 1.0
  */
 public function __construct()
 {
     // Get all types
     $this->point_types = mycred_get_types();
     // Get the used type (if used)
     $type = 'mycred_default';
     $currency = affiliate_wp()->settings->get('currency', 'mycred_default');
     if (array_key_exists($currency, $this->point_types)) {
         $type = $currency;
     }
     // Load myCRED
     $this->mycred = mycred($type);
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:18,代码来源:mycred-hook-affiliatewp.php


示例19: uninstall

 /**
  * Uninstall
  * TODO: Add a call to all add-ons to allow them to uninstall their own
  * settings and data once the core is gone.
  * @filter 'mycred_uninstall_this'
  * @since 0.1
  * @version 1.3
  */
 public function uninstall()
 {
     // Everyone should use this filter to delete everything else they have created before returning the option ids.
     $installed = apply_filters('mycred_uninstall_this', array('mycred_pref_core', 'mycred_pref_hooks', 'mycred_pref_addons', 'mycred_pref_bank'));
     // Delete each option
     foreach ($installed as $option_id) {
         delete_option($GLOBALS['blog_id'], $option_id);
     }
     // Delete flags
     delete_option('mycred_setup_completed');
     delete_option('mycred_version');
     delete_option('mycred_version_db');
     delete_option('mycred_key');
     // Delete widget options
     delete_option('widget_mycred_widget_balance');
     delete_option('widget_mycred_widget_list');
     delete_option('widget_mycred_widget_transfer');
     delete_option('mycred_ref_hook_counter');
     // Remove Add-on settings
     delete_option('mycred_espresso_gateway_prefs');
     delete_option('mycred_eventsmanager_gateway_prefs');
     // Clear Cron
     wp_clear_scheduled_hook('mycred_reset_key');
     wp_clear_scheduled_hook('mycred_banking_recurring_payout');
     wp_clear_scheduled_hook('mycred_banking_do_batch');
     wp_clear_scheduled_hook('mycred_banking_interest_compound');
     wp_clear_scheduled_hook('mycred_banking_do_compound_batch');
     wp_clear_scheduled_hook('mycred_banking_interest_payout');
     wp_clear_scheduled_hook('mycred_banking_interest_do_batch');
     global $wpdb;
     // Get log table
     if (defined('MYCRED_LOG_TABLE')) {
         $table_name = MYCRED_LOG_TABLE;
     } else {
         if (mycred_centralize_log()) {
             $table_name = $wpdb->base_prefix . 'myCRED_log';
         } else {
             $table_name = $wpdb->prefix . 'myCRED_log';
         }
     }
     // Delete log table
     $wpdb->query("DROP TABLE IF EXISTS {$table_name};");
     // Multisite
     if (is_multisite()) {
         delete_site_option('mycred_network');
     }
     // Delete custom post types
     $post_types = apply_filters('mycred_custom_post_types', array('mycred_rank', 'mycred_email_notice'));
     if (is_array($post_types) || !empty($post_types)) {
         $wpdb->query("DELETE FROM {$wpdb->posts} WHERE post_type IN ('" . implode("','", $post_types) . "');");
     }
     // Delete all point types
     $mycred_types = mycred_get_types();
     foreach ($mycred_types as $type => $label) {
         $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->usermeta} WHERE meta_key = %s;", $type));
     }
     // Good bye.
 }
开发者ID:nfer,项目名称:mycred,代码行数:66,代码来源:mycred-install.php


示例20: mycred_markpress_payout_rewards

 function mycred_markpress_payout_rewards($order)
 {
     // Payment info
     $payment_info = get_post_meta($order->ID, 'mp_payment_info', true);
     if (!isset($payment_info['gateway_private_name']) || $payment_info['gateway_private_name'] == 'myCRED' && apply_filters('mycred_marketpress_reward_mycred_payment', false) === false) {
         return;
     }
     // Get buyer ID
     global $wpdb;
     $meta_id = 'mp_order_history';
     if (is_multisite()) {
         global $blog_id;
         $meta_id = 'mp_order_history_' . $blog_id;
     }
     // Get buyer
     $user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = %s AND meta_value LIKE %s", $meta_id, '%s:2:"id";i:' . $order->ID . ';%'));
     if ($user_id === NULL && !is_user_logged_in()) {
         return;
     } elseif ($user_id === NULL) {
         $user_id = get_current_user_id();
     }
     // Get point types
     $types = mycred_get_types();
     // Loop
     foreach ($types as $type => $label) {
         // Load type
         $mycred = mycred($type);
         // Check for exclusions
         if ($mycred->exclude_user($user_id)) {
             continue;
         }
         // Calculate reward
         $reward = $mycred->zero();
         foreach ($order->mp_cart_info as $product_id => $variations) {
             foreach ($variations as $variation => $data) {
                 $prefs = (array) get_post_meta((int) $product_id, 'mycred_reward', true);
                 if (isset($prefs[$type]) && $prefs[$type] != '') {
                     $reward = $reward + $prefs[$type] * $data['quantity'];
                 }
             }
         }
         // Award
         if ($reward != $mycred->zero()) {
             // Let others play with the reference and log entry
             $reference = apply_filters('mycred_marketpress_reward_reference', 'marketpress_reward', $order_id, $type);
             $log = apply_filters('mycred_marketpress_reward_log', '%plural% reward for store purchase', $order_id, $type);
             // Execute
             $mycred->add_creds($reference, $order->user_id, $reward, $log, $order->ID, array('ref_type' => 'post'), $type);
         }
     }
 }
开发者ID:kfwebdev,项目名称:wp-atd,代码行数:51,代码来源:mycred-hook-marketpress.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP mycred_get_user_meta函数代码示例发布时间:2022-05-15
下一篇:
PHP mycred_apply_defaults函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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