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


PHP mycred_get_types函数代码示例

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


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


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