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


PHP current_time函数代码示例

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


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

示例1: memberlite_getUpdateInfo

/**
 * Get theme update information from the PMPro server.
 *
 * @since  2.0
 */
function memberlite_getUpdateInfo()
{
    //check if forcing a pull from the server
    $update_info = get_option("memberlite_update_info", false);
    $update_info_timestamp = get_option("memberlite_update_info_timestamp", 0);
    //if no update_infos locally, we need to hit the server
    if (empty($update_info) || !empty($_REQUEST['force-check']) || current_time('timestamp') > $update_info_timestamp + 86400) {
        /**
         * Filter to change the timeout for this wp_remote_get() request.
         *
         * @since 2.0.1
         *
         * @param int $timeout The number of seconds before the request times out
         */
        $timeout = apply_filters("memberlite_get_update_info_timeout", 5);
        //get em
        $remote_info = wp_remote_get(PMPRO_LICENSE_SERVER . "/themes/memberlite", $timeout);
        //test response
        if (is_wp_error($remote_info) || empty($remote_info['response']) || $remote_info['response']['code'] != '200') {
            //error
            pmpro_setMessage("Could not connect to the PMPro License Server to get update information. Try again later.", "error");
        } else {
            //update update_infos in cache
            $update_info = json_decode(wp_remote_retrieve_body($remote_info), true);
            delete_option('memberlite_update_info');
            add_option("memberlite_update_info", $update_info, NULL, 'no');
        }
        //save timestamp of last update
        delete_option('memberlite_update_info_timestamp');
        add_option("memberlite_update_info_timestamp", current_time('timestamp'), NULL, 'no');
    }
    return $update_info;
}
开发者ID:greathmaster,项目名称:memberlite,代码行数:38,代码来源:updates.php

示例2: get_timespan_most_viewed

function get_timespan_most_viewed($mode = '', $limit = 10, $days = 7, $display = true)
{
    global $wpdb, $post;
    $limit_date = current_time('timestamp') - $days * 26400;
    $limit_date = date("Y-m-d H:i:s", $limit_date);
    $where = '';
    $temp = '';
    if (!empty($mode) && $mode != 'both') {
        $where = "post_type = '{$mode}'";
    } else {
        $where = '1=1';
    }
    $most_viewed = $wpdb->get_results("SELECT {$wpdb->posts}.*, (meta_value+0) AS views FROM {$wpdb->posts} LEFT JOIN {$wpdb->postmeta} ON {$wpdb->postmeta}.post_id = {$wpdb->posts}.ID WHERE post_date < '" . current_time('mysql') . "' AND post_date > '" . $limit_date . "' AND {$where} AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER  BY views DESC LIMIT {$limit}");
    if ($most_viewed) {
        foreach ($most_viewed as $post) {
            $post_title = get_the_title();
            $post_views = intval($post->views);
            $post_views = number_format($post_views);
            $temp .= "<li><a href=\"" . get_permalink() . "\">{$post_title}</a>" . __('', 'wp-postviews') . "</li>";
        }
    } else {
        $temp = '<li>' . __('N/A', 'wp-postviews') . '</li>' . "\n";
    }
    if ($display) {
        echo $temp;
    } else {
        return $temp;
    }
}
开发者ID:areszn,项目名称:wordpress,代码行数:29,代码来源:hot-post.php

示例3: sf_custom_comments

    function sf_custom_comments($comment, $args, $depth)
    {
        $GLOBALS['comment'] = $comment;
        $GLOBALS['comment_depth'] = $depth;
        ?>
		    <li id="comment-<?php 
        comment_ID();
        ?>
" <?php 
        comment_class('clearfix');
        ?>
>
		        <div class="comment-wrap clearfix">
		            <div class="comment-avatar">
		            	<?php 
        if (function_exists('get_avatar')) {
            echo get_avatar($comment, '100');
        }
        ?>
		            	<?php 
        if ($comment->comment_author_email == get_the_author_meta('email')) {
            ?>
		            	<span class="tooltip"><?php 
            _e("Author", "swiftframework");
            ?>
<span class="arrow"></span></span>
		            	<?php 
        }
        ?>
		            </div>
		    		<div class="comment-content">
		            	<div class="comment-meta">
	            			<?php 
        printf('<span class="comment-author">%1$s</span> <span class="comment-date">%2$s</span>', get_comment_author_link(), human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ' . __("ago", "swiftframework"));
        ?>
			            	<div class="comment-meta-actions">
		            			<?php 
        edit_comment_link(__('Edit', 'swiftframework'), '<span class="edit-link">', '</span><span class="meta-sep"> |</span>');
        ?>
		                        <?php 
        if ($args['type'] == 'all' || get_comment_type() == 'comment') {
            comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'swiftframework'), 'login_text' => __('Log in to reply.', 'swiftframework'), 'depth' => $depth, 'before' => '<span class="comment-reply">', 'after' => '</span>')));
        }
        ?>
			                </div>
						</div>
		      			<?php 
        if ($comment->comment_approved == '0') {
            _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'swiftframework');
        }
        ?>
		            	<div class="comment-body">
		                	<?php 
        comment_text();
        ?>
		            	</div>
		    		</div>
		        </div>
	<?php 
    }
开发者ID:roycocup,项目名称:enclothed,代码行数:60,代码来源:sf-comments.php

示例4: save

 /**
  * Save meta box data
  */
 public static function save($post_id, $post)
 {
     if ('shop_subscription' == $post->post_type && !empty($_POST['woocommerce_meta_nonce']) && wp_verify_nonce($_POST['woocommerce_meta_nonce'], 'woocommerce_save_data')) {
         if (isset($_POST['_billing_interval'])) {
             update_post_meta($post_id, '_billing_interval', $_POST['_billing_interval']);
         }
         if (!empty($_POST['_billing_period'])) {
             update_post_meta($post_id, '_billing_period', $_POST['_billing_period']);
         }
         $subscription = wcs_get_subscription($post_id);
         $dates = array();
         foreach (wcs_get_subscription_date_types() as $date_key => $date_label) {
             if ('last_payment' == $date_key) {
                 continue;
             }
             $utc_timestamp_key = $date_key . '_timestamp_utc';
             // A subscription needs a start date, even if it wasn't set
             if (isset($_POST[$utc_timestamp_key])) {
                 $datetime = $_POST[$utc_timestamp_key];
             } elseif ('start' === $date_key) {
                 $datetime = current_time('timestamp', true);
             } else {
                 // No date to set
                 continue;
             }
             $dates[$date_key] = date('Y-m-d H:i:s', $datetime);
         }
         try {
             $subscription->update_dates($dates, 'gmt');
             wp_cache_delete($post_id, 'posts');
         } catch (Exception $e) {
             wcs_add_admin_notice($e->getMessage(), 'error');
         }
     }
 }
开发者ID:slavic18,项目名称:cats,代码行数:38,代码来源:class-wcs-meta-box-subscription-schedule.php

示例5: rcl_confirm_user_registration

function rcl_confirm_user_registration()
{
    global $wpdb, $rcl_options;
    $reglogin = $_GET['rglogin'];
    $regpass = $_GET['rgpass'];
    $regcode = md5($reglogin);
    if ($regcode == $_GET['rgcode']) {
        if ($user = get_user_by('login', $reglogin)) {
            wp_update_user(array('ID' => $user->ID, 'role' => get_option('default_role')));
            $time_action = current_time('mysql');
            $action = $wpdb->get_var($wpdb->prepare("SELECT time_action FROM " . RCL_PREF . "user_action WHERE user = '%d'", $user->ID));
            if (!$action) {
                $wpdb->insert(RCL_PREF . 'user_action', array('user' => $user->ID, 'time_action' => $time_action));
            }
            $creds = array();
            $creds['user_login'] = $reglogin;
            $creds['user_password'] = $regpass;
            $creds['remember'] = true;
            $sign = wp_signon($creds, false);
            if (!is_wp_error($sign)) {
                rcl_update_timeaction_user();
                do_action('rcl_confirm_registration', $user->ID);
                wp_redirect(rcl_get_authorize_url($user->ID));
                exit;
            }
        }
    }
    if ($rcl_options['login_form_recall'] == 2) {
        wp_safe_redirect('wp-login.php?checkemail=confirm');
    } else {
        wp_redirect(get_bloginfo('wpurl') . '?action-rcl=login&error=confirm');
    }
    exit;
}
开发者ID:stanislav-chechun,项目名称:campus-rize,代码行数:34,代码来源:register.php

示例6: log

 public function log($connector, $message, $args, $object_id, $contexts, $user_id = null)
 {
     global $wpdb;
     if (is_null($user_id)) {
         $user_id = get_current_user_id();
     }
     require_once MAINWP_WP_STREAM_INC_DIR . 'class-wp-stream-author.php';
     $user = new WP_User($user_id);
     $roles = get_option($wpdb->get_blog_prefix() . 'user_roles');
     if (!isset($args['author_meta'])) {
         $args['author_meta'] = array('user_email' => $user->user_email, 'display_name' => defined('WP_CLI') && empty($user->display_name) ? 'WP-CLI' : $user->display_name, 'user_login' => $user->user_login, 'user_role_label' => !empty($user->roles) ? $roles[$user->roles[0]]['name'] : null, 'agent' => MainWP_WP_Stream_Author::get_current_agent());
         if (defined('WP_CLI') && function_exists('posix_getuid')) {
             $uid = posix_getuid();
             $user_info = posix_getpwuid($uid);
             $args['author_meta']['system_user_id'] = $uid;
             $args['author_meta']['system_user_name'] = $user_info['name'];
         }
     }
     // Remove meta with null values from being logged
     $meta = array_filter($args, function ($var) {
         return !is_null($var);
     });
     $recordarr = array('object_id' => $object_id, 'site_id' => is_multisite() ? get_current_site()->id : 1, 'blog_id' => apply_filters('blog_id_logged', is_network_admin() ? 0 : get_current_blog_id()), 'author' => $user_id, 'author_role' => !empty($user->roles) ? $user->roles[0] : null, 'created' => current_time('mysql', 1), 'summary' => vsprintf($message, $args), 'parent' => self::$instance->prev_record, 'connector' => $connector, 'contexts' => $contexts, 'meta' => $meta, 'ip' => mainwp_wp_stream_filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP));
     $record_id = MainWP_WP_Stream_DB::get_instance()->insert($recordarr);
     return $record_id;
 }
开发者ID:HasClass0,项目名称:mainwp-child-reports,代码行数:26,代码来源:log.php

示例7: export_roles

 public function export_roles()
 {
     global $pagenow;
     if ($pagenow !== 'users.php') {
         return;
     }
     if (!isset($_GET['page']) || $_GET['page'] !== 'users-' . URE_PLUGIN_FILE) {
         return;
     }
     if (!isset($_POST['action']) || $_POST['action'] !== 'export-roles') {
         return;
     }
     if (empty($_POST['ure_nonce']) || !wp_verify_nonce($_POST['ure_nonce'], 'user-role-editor')) {
         echo '<h3>Wrong nonce. Action prohibitied.</h3>';
         exit;
     }
     if (!current_user_can('ure_export_roles')) {
         echo esc_html__('You do not have sufficient permissions to use this add-on.', 'ure');
         exit;
     }
     $this->lib->get_user_roles();
     $serialized_roles = serialize($this->lib->roles);
     $timestamp = date('_Y-m-d_h_i_s', current_time('timestamp'));
     header('Pragma: public');
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     header('Cache-Control: private', false);
     // required for certain browsers
     header('Content-Type: application/pdf');
     header('Content-Disposition: attachment; filename="ure-roles-backup' . $timestamp . '.dat";');
     header('Content-Transfer-Encoding: binary');
     header('Content-Length: ' . strlen($serialized_roles));
     echo $serialized_roles;
     exit;
 }
开发者ID:jbeyta,项目名称:joelandsam,代码行数:35,代码来源:class-export-import.php

示例8: __construct

 public function __construct()
 {
     global $start_date, $end_date;
     global $woocommerce;
     $current_month = date("j/n/Y", mktime(0, 0, 0, 1, date("m"), date("Y")));
     $start_date = isset($_GET['start_date']) ? $_GET['start_date'] : '';
     $end_date = isset($_GET['end_date']) ? $_GET['end_date'] : '';
     if (!$start_date) {
         $start_date = $current_month;
     }
     if (!$end_date) {
         $end_date = date('Ymd', current_time('timestamp'));
     }
     $start_date = strtotime($start_date);
     $end_date = strtotime($end_date);
     add_action('admin_menu', array($this, 'hide_add_new_carts'));
     add_action('views_edit-carts', array($this, 'av8_remove_cart_views'));
     //Remove the All / Published / Trash view.
     add_action('manage_carts_posts_custom_column', array($this, 'av8_manage_cart_columns'), 1, 1);
     add_action('restrict_manage_posts', array($this, 'author_filter'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_index'));
     add_filter('restrict_manage_posts', array($this, 'restrict_manage_posts'), 1000);
     add_action('pre_get_posts', array($this, 'exclude_category'));
     add_filter('posts_where', array($this, 'filter_where'));
     add_filter('manage_edit-carts_columns', array($this, 'av8_carts_columns'));
     add_filter('manage_edit-carts_sortable_columns', array($this, 'av8_carts_sort'));
     add_filter('request', array($this, 'cart_column_orderby'));
     add_filter('bulk_actions-' . 'edit-carts', '__return_empty_array');
     //Remove bulk edit
     add_filter('parse_query', array($this, 'woocommerce_carts_search_custom_fields'));
     add_filter('get_search_query', array($this, 'woocommerce_carts_search_label'));
 }
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:32,代码来源:cart_index_interface.php

示例9: mycred_get_stat_dates

 function mycred_get_stat_dates($instance = '', $value = 0)
 {
     $now = current_time('timestamp');
     $results = array();
     switch ($instance) {
         case 'x_dates':
             $from = $value - 1;
             $start = date('U', strtotime('-' . $from . ' days midnight', $now));
             for ($i = 0; $i < $value; $i++) {
                 if ($i == 0) {
                     $new_start = $start;
                 } else {
                     $new_start = $start + 86400 * $i;
                 }
                 $results[] = array('label' => date('Y-m-d', $new_start), 'from' => $new_start, 'until' => $new_start + 86399);
             }
             break;
         case 'today_this':
             $start = date('U', strtotime('today midnight', $now));
             $results[] = array('key' => 'today', 'from' => $start, 'until' => $now);
             $this_week = mktime(0, 0, 0, date("n", $now), date("j", $now) - date("N", $now) + 1);
             $results[] = array('key' => 'thisweek', 'from' => $this_week, 'until' => $now);
             $this_month = mktime(0, 0, 0, date("n", $now), 1, date('Y', $now));
             $results[] = array('key' => 'thismonth', 'from' => $this_month, 'until' => $now);
             $this_year = mktime(0, 0, 0, 1, 1, date('Y', $now));
             $results[] = array('key' => 'thisyear', 'from' => $this_year, 'until' => $now);
             break;
     }
     return $results;
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:30,代码来源:mycred-stats-functions.php

示例10: update_punch_card_ajax

 function update_punch_card_ajax()
 {
     global $wpdb;
     $punch_cards_table = $wpdb->prefix . "punch_cards";
     $punch_cards_meta_table = $wpdb->prefix . "punch_cards_meta";
     $card_action = $_POST['card_action'];
     $card_id = $_POST['card_id'];
     $punches_array = array();
     $punch_card = Punch_Card::get_punch_card($card_id);
     $punches = (int) $punch_card->card_punches;
     switch ($card_action) {
         case 'add':
             $punches++;
             break;
         case 'remove':
             $punches--;
             break;
         case 'complete':
             $punches = 0;
             $punches_array['card_completed'] = (int) $punch_card->card_completed + 1;
             break;
         default:
             $punches = 0;
             break;
     }
     $punches_array['card_punches'] = $punches;
     $wpdb->update($punch_cards_table, $punches_array, array('card_id' => $card_id));
     $wpdb->insert($punch_cards_meta_table, array('card_id' => $card_id, 'punch_number' => $punches, 'punch_date' => current_time('mysql')));
     echo json_encode(array('action' => $card_action, 'card_id' => $card_id, 'punches' => $punches, 'punches_html' => Punch_Card::get_punches_html($card_id, $punches)));
     wp_die();
 }
开发者ID:CamanoIslandCoffeeRoasters,项目名称:cim-punch-cards,代码行数:31,代码来源:Punch_Card.class.php

示例11: insert

 /**
  * Add an event to the database
  *
  * @since 1.0.0
  *
  * @param  array  $data The data to use for each field
  *
  * @return integer       The number of rows that were affected
  */
 public function insert($data = array())
 {
     $defaults = array('last_sync' => date('Y-m-d H:i:s', current_time('timestamp')));
     $group = wp_parse_args($data, $defaults);
     global $wpdb;
     return $wpdb->insert($this->table_name, $group);
 }
开发者ID:firetreedesign,项目名称:ccbpress-core,代码行数:16,代码来源:event_profiles-db.php

示例12: send_activity_report

 public static function send_activity_report()
 {
     $current_time = current_time('timestamp');
     $mostly_recent_users = get_users(array('meta_key' => 'displet_last_login', 'meta_value' => $current_time - 60 * 60 * 24 * 7, 'meta_compare' => '>'));
     $recent_users = array();
     if (!empty($mostly_recent_users) && is_array($mostly_recent_users)) {
         $edit_url = admin_url('admin.php?page=displet-lead-manager&user_id=');
         foreach ($mostly_recent_users as $user) {
             if (!empty($user->displet_last_login) && is_numeric($user->displet_last_login)) {
                 $logins_for_day = 0;
                 if (!empty($user->displet_logins) && is_array($user->displet_logins)) {
                     foreach ($user->displet_logins as $login) {
                         if ($login > $current_time - 60 * 60 * 24) {
                             $logins_for_day++;
                         }
                     }
                 }
                 $property_stats = DispletRetsIdxViewedPropertiesController::get_property_view_stats($user->displet_user_properties);
                 $recent_users[] = array('url' => $edit_url . $user->ID, 'name' => $user->nickname, 'phone' => $user->displet_phone, 'logins_for_day' => $logins_for_day, 'logins_total' => count($user->displet_logins), 'price_average' => $property_stats['price_average'], 'zip_mode' => $property_stats['zip_mode']);
             }
         }
     }
     if (!empty($recent_users)) {
         $user_activity_report = '<table cellpadding="3" width="100%"><tr><th>Name</th><th>Phone</th><th>Logins In Last Day</th><th>Total Logins</th><th>Average Price</th><th>Most Frequented Zip Code</th></tr>';
         foreach ($recent_users as $user) {
             $price_average = !empty($user['price_average']) ? number_format($user['price_average']) : '';
             $user_activity_report .= '<tr><td align="left"><a href="' . $user['url'] . '">' . $user['name'] . '</a></td><td align="center">' . $user['phone'] . '</td><td align="center">' . $user['logins_for_day'] . '</td><td align="center">' . $user['logins_total'] . '</td><td align="center">$' . $price_average . '</td><td align="center">' . $user['zip_mode'] . '</td></tr>';
         }
         $user_activity_report .= '</table>';
         new DispletRetsIdxEmail('activity_report', array('activity_report' => $user_activity_report));
     }
 }
开发者ID:amankatoch,项目名称:wp-plugin,代码行数:32,代码来源:class-displet-rets-idx-email-controller.php

示例13: save_subscription

 function save_subscription($name, $email, $taxonomy, $frequency)
 {
     global $wpdb;
     $last_send = current_time('mysql');
     $taxonomy = serialize($taxonomy);
     $wpdb->insert($wpdb->prefix . 'miklaj_notification', compact('name', 'email', 'taxonomy', 'frequency', 'last_send'), array('%s', '%s', '%s', '%s', '%s'));
 }
开发者ID:mik-laj,项目名称:miklaj-posts-notification,代码行数:7,代码来源:shortcode.php

示例14: add_post_child

 /**
  * Add a post to post connection
  * @param $parent_id
  * @param $child_id
  * @param int $author
  *
  * @return int|WP_Error
  */
 public function add_post_child($parent_id, $child_id, $author = 0)
 {
     if ($author == 0) {
         $author = get_current_user_id();
     }
     return $this->insert($this->table_name, array('parent_id' => $parent_id, 'child_id' => $child_id, 'author' => $author, 'modified' => current_time('mysql')));
 }
开发者ID:shaulfiron,项目名称:forest-manager,代码行数:15,代码来源:PostToPostsQuery.php

示例15: _setup_data

 protected function _setup_data()
 {
     //basically ALL we're going to get from this is the transaction object and use it to build the majority of our info.
     $session = $this->_data->get_session_data();
     $this->txn = $session['transaction'];
     if (empty($this->txn) || !$this->txn instanceof EE_Transaction) {
         throw new EE_Error(__('Incoming data for the EE_Session data handler must have a valid EE_Transaction object in order to setup the data'));
     }
     $this->reg_info = array();
     $this->incoming_data = $session;
     $this->taxes = $this->txn->tax_total();
     $this->grand_total_price_object = '';
     //other data from the session (if possible)
     $this->user_id = isset($session['user_id']) ? $session['user_id'] : '';
     $this->ip_address = isset($session['ip_address']) ? $session['ip_address'] : '';
     $this->user_agent = isset($session['user_agent']) ? $session['user_agent'] : '';
     $this->init_access = $this->last_access = '';
     $this->payment = $this->txn->get_first_related('Payment');
     $this->payment = empty($this->payment) ? EE_Payment::new_instance(array('STS_ID' => EEM_Payment::status_id_pending, 'PAY_timestamp' => (int) current_time('timestamp'), 'PAY_gateway' => $this->txn->selected_gateway(), 'PAY_gateway_response' => $this->txn->gateway_response_on_transaction())) : $this->payment;
     //if there is no payments associated with the transaction then we just create a default payment object for potential parsing.
     $this->billing = $this->payment->details();
     EE_Registry::instance()->load_helper('Template');
     $this->billing['total_due'] = isset($this->billing['total']) ? EEH_Template::format_currency($this->billing['total']) : '';
     //let's get all the registrations associated with this txn
     $this->reg_objs = $this->txn->registrations();
     $this->_assemble_data();
 }
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:27,代码来源:EE_Messages_EE_Session_incoming_data.class.php


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