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


PHP WC_Subscriptions_Manager::touch_time方法代码示例

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


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

示例1: column_default


//.........这里部分代码省略.........
             }
             if ($item['status'] == 'pending') {
                 unset($actions['active']);
                 unset($actions['trash']);
             } elseif (!in_array($item['status'], array('cancelled', 'expired', 'suspended'))) {
                 unset($actions['trash']);
             }
             $actions = apply_filters('woocommerce_subscriptions_list_table_actions', $actions, $item);
             $column_content = sprintf('<mark class="%s">%s</mark> %s', sanitize_title($item[$column_name]), WC_Subscriptions_Manager::get_status_to_display($item[$column_name], $item['subscription_key'], $item['user_id']), $this->row_actions($actions));
             $column_content = apply_filters('woocommerce_subscriptions_list_table_column_status_content', $column_content, $item, $actions, $this);
             break;
         case 'title':
             //Return the title contents
             $column_content = sprintf('<a href="%s">%s</a>', get_edit_post_link($item['product_id']), WC_Subscriptions_Order::get_item_name($item['order_id'], $item['product_id']));
             $column_content .= sprintf('<input type="hidden" class="%1$s" name="%2$s[%3$s][%4$s][][%1$s]" value="%5$s" />', 'product_id', $this->_args['plural'], $item['user_id'], $item['subscription_key'], $item['product_id']);
             $order = new WC_Order($item['order_id']);
             $order_item = WC_Subscriptions_Order::get_item_by_product_id($order, $item['product_id']);
             $product = $order->get_product_from_item($order_item);
             if (isset($product->variation_data)) {
                 $column_content .= '<br />' . woocommerce_get_formatted_variation($product->variation_data, true);
             }
             break;
         case 'order_id':
             $order = new WC_Order($item[$column_name]);
             $column_content = sprintf('<a href="%1$s">%2$s</a>', get_edit_post_link($item[$column_name]), sprintf(__('Order %s', WC_Subscriptions::$text_domain), $order->get_order_number()));
             $column_content .= sprintf('<input type="hidden" class="%1$s" name="%2$s[%3$s][%4$s][][%1$s]" value="%5$s" />', $column_name, $this->_args['plural'], $item['user_id'], $item['subscription_key'], $item[$column_name]);
             break;
         case 'user':
             $user = get_user_by('id', $item['user_id']);
             $column_content = sprintf('<a href="%s">%s</a>', admin_url('user-edit.php?user_id=' . $user->ID), ucfirst($user->display_name));
             $column_content .= sprintf('<input type="hidden" class="%1$s" name="%2$s[%3$s][%4$s][][%1$s]" value="%5$s" />', 'user_id', $this->_args['plural'], $item['user_id'], $item['subscription_key'], $item['user_id']);
             break;
         case 'start_date':
         case 'expiry_date':
         case 'end_date':
             if ($column_name == 'expiry_date' && $item[$column_name] == 0) {
                 $column_content = __('Never', WC_Subscriptions::$text_domain);
             } else {
                 if ($column_name == 'end_date' && $item[$column_name] == 0) {
                     $column_content = __('Not yet ended', WC_Subscriptions::$text_domain);
                 } else {
                     $gmt_timestamp = strtotime($item[$column_name]);
                     $user_timestamp = $gmt_timestamp + get_option('gmt_offset') * 3600;
                     $column_content = sprintf('<time title="%s">%s</time>', esc_attr($gmt_timestamp), date_i18n(get_option('date_format'), $user_timestamp));
                 }
             }
             break;
         case 'trial_expiry_date':
             $trial_expiration = WC_Subscriptions_Manager::get_trial_expiration_date($item['subscription_key'], $item['user_id'], 'timestamp');
             if (empty($trial_expiration)) {
                 $column_content = '-';
             } else {
                 $column_content = sprintf('<time title="%s">%s</time>', esc_attr($trial_expiration), date_i18n(get_option('date_format'), $trial_expiration + get_option('gmt_offset') * 3600));
             }
             break;
         case 'last_payment_date':
             if (empty($item['completed_payments'])) {
                 $column_content = '-';
             } else {
                 $last_payment_timestamp = strtotime(array_pop($item['completed_payments']));
                 $time_diff = $current_gmt_time - $last_payment_timestamp;
                 if ($time_diff > 0 && $time_diff < 7 * 24 * 60 * 60) {
                     $last_payment = sprintf(__('%s ago', WC_Subscriptions::$text_domain), human_time_diff($last_payment_timestamp, $current_gmt_time));
                 } else {
                     $last_payment = date_i18n(get_option('date_format'), $last_payment_timestamp + get_option('gmt_offset') * 3600);
                 }
                 $column_content = sprintf('<time title="%s">%s</time>', esc_attr($last_payment_timestamp), $last_payment);
             }
             break;
         case 'next_payment_date':
             $next_payment_timestamp = WC_Subscriptions_Manager::get_next_payment_date($item['subscription_key'], $item['user_id'], 'timestamp');
             if ($next_payment_timestamp == 0) {
                 $column_content = '-';
             } else {
                 // Convert to site time
                 $time_diff = $next_payment_timestamp - $current_gmt_time;
                 if ($time_diff > 0 && $time_diff < 7 * 24 * 60 * 60) {
                     $next_payment = sprintf(__('In %s', WC_Subscriptions::$text_domain), human_time_diff($current_gmt_time, $next_payment_timestamp));
                 } else {
                     $next_payment = date_i18n(get_option('date_format'), $next_payment_timestamp + get_option('gmt_offset') * 3600);
                 }
                 $column_content = sprintf('<time class="next-payment-date" title="%s">%s</time>', esc_attr($next_payment_timestamp), $next_payment);
                 if (WC_Subscriptions_Manager::can_subscription_be_changed_to('new-payment-date', $item['subscription_key'], $item['user_id'])) {
                     $column_content .= '<div class="edit-date-div row-actions hide-if-no-js">';
                     $column_content .= '<img class="date-picker-icon" src="' . admin_url('images/date-button.gif') . '" title="Date Picker Icon"/>';
                     $column_content .= '<a href="#edit_timestamp" class="edit-timestamp" tabindex="4">' . __('Change', WC_Subscriptions::$text_domain) . '</a>';
                     $column_content .= '<div class="date-picker-div hide-if-js">';
                     $column_content .= WC_Subscriptions_Manager::touch_time(array('date' => date('Y-m-d', $next_payment_timestamp), 'echo' => false, 'multiple' => true, 'include_time' => false));
                     $column_content .= '</div>';
                     $column_content .= '</form>';
                 }
             }
             break;
         case 'renewal_order_count':
             $count = WC_Subscriptions_Renewal_Order::get_renewal_order_count($item['order_id']);
             $column_content = sprintf('<a href="%1$s">%2$d</a>', admin_url('edit.php?post_status=all&post_type=shop_order&_renewal_order_parent_id=' . absint($item['order_id'])), $count);
             break;
     }
     return $column_content;
 }
开发者ID:bulats,项目名称:chef,代码行数:101,代码来源:class-wc-subscriptions-list-table.php


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