本文整理汇总了PHP中get_date_from_gmt函数的典型用法代码示例。如果您正苦于以下问题:PHP get_date_from_gmt函数的具体用法?PHP get_date_from_gmt怎么用?PHP get_date_from_gmt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_date_from_gmt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Create export file with data
*/
public function create()
{
$sheet_id = !empty($_GET['sheet_id']) ? $_GET['sheet_id'] : null;
$data = $this->data->get_all_data($sheet_id);
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=sign-up-sheets-" . date('Ymd-His') . ".csv");
header("Pragma: no-cache");
header("Expires: 0");
$all_custom_fields = get_option('dls_sus_custom_fields');
if (!empty($all_custom_fields)) {
$custom_field_names = array();
foreach ($all_custom_fields as $field) {
$custom_field_names[] = $field['name'];
}
reset($all_custom_fields);
}
$custom_fields_heading = !empty($custom_field_names) ? '"' . implode('","', $custom_field_names) . '",' : null;
$csv = '"Sheet ID","Sheet Title","Sheet Date","Task ID","Task Title","Task Date","Sign-up ID","Sign-up First Name","Sign-up Last Name","Sign-up Phone","Sign-up Email",' . $custom_fields_heading . '"Reminded"' . "\n";
foreach ($data as $d) {
$csv .= '"' . $this->clean_csv($d->sheet_id) . '","' . $this->clean_csv($d->sheet_title) . '","' . $this->clean_csv(!empty($d->sheet_date) && $d->sheet_date !== '0000-00-00' ? date('Y-m-d', strtotime($d->sheet_date)) : null) . '","' . $this->clean_csv($d->task_id) . '","' . $this->clean_csv($d->task_title) . '","' . $this->clean_csv(!empty($d->task_date) && $d->task_date !== '0000-00-00' ? date('Y-m-d', strtotime($d->task_date)) : null) . '","' . $this->clean_csv($d->signup_id) . '","' . $this->clean_csv($d->firstname) . '","' . $this->clean_csv($d->lastname) . '","' . $this->clean_csv($d->phone) . '","' . $this->clean_csv($d->email) . '","';
if (!empty($all_custom_fields)) {
foreach ($all_custom_fields as $field) {
$slug = str_replace('-', '_', $field['slug']);
if (!isset($d->signup_fields[$slug])) {
$d->signup_fields[$slug] = '';
}
$csv .= $this->clean_csv(is_array($d->signup_fields[$slug]) ? implode(', ', $d->signup_fields[$slug]) : $d->signup_fields[$slug]) . '","';
}
}
$csv .= $this->clean_csv(!empty($d->reminded) ? get_date_from_gmt($d->reminded, 'Y-m-d H:i:s') : null) . '"' . "\n";
}
echo $csv;
}
开发者ID:sabdev1,项目名称:ljcdevsab,代码行数:36,代码来源:export.php
示例2: rssmi_show_last_feed_update
/**
* Displays the last time the feed was updated and controls to update now
*
* @return string
*/
function rssmi_show_last_feed_update()
{
$wprssmi_admin_options = get_option('rss_admin_options');
// admin settings
$last_db_update = $wprssmi_admin_options['last_db_update'];
return "\n\t<h3>Last Update of the Feed Database: <em>" . get_date_from_gmt(date('Y-m-d H:i:s', $last_db_update), 'M j, Y @ g:i a') . "; " . human_time_diff($last_db_update, time()) . " ago</em></h3>\n\t<p><button type='button' name='getFeedsNow' id='getFeeds-Now' class='button button-primary' value=''>Update the feed Database</button></p>\n\n\t<div id='gfnote'>\n\t\t<em>(note: this could take several minutes)</em>\n\t</div>\n\t<div id='rssmi-ajax-loader-center'></div>\n\t<p>Think there is a scheduling problem? <a href='http://www.wprssimporter.com/faqs/the-cron-scheduler-isnt-working-whats-happening/' target='_blank'>Read this</a>.</p>";
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:12,代码来源:admin_functions.php
示例3: format_date_time_gmt
public function format_date_time_gmt($timestamp_gmt)
{
$f = get_option('date_format') . ' ' . get_option('time_format');
$s = gmdate('Y-m-d H:i:s', $timestamp_gmt);
$s = get_date_from_gmt($s, $f);
return $s;
}
开发者ID:chrisuehlein,项目名称:couponsite,代码行数:7,代码来源:class-fw-backup-format.php
示例4: prepare_items
public function prepare_items()
{
if (!is_null($this->total_items)) {
return;
}
$this->total_items = count($this->_archives);
$this->set_pagination_args(array('total_items' => $this->total_items, 'per_page' => $this->items_pre_page));
/**
* @var FW_Extension_Backups $backups
*/
$backups = fw_ext('backups');
/**
* Prepare items for output
*/
foreach ($this->_archives as $filename => $archive) {
$time = get_date_from_gmt(gmdate('Y-m-d H:i:s', $archive['time']), get_option('date_format') . ' ' . get_option('time_format'));
$filename_hash = md5($filename);
$details = array();
$details[] = $archive['full'] ? __('Full Backup', 'fw') : __('Content Backup', 'fw');
if (function_exists('fw_human_bytes')) {
$details[] = fw_human_bytes(filesize($archive['path']));
}
$details[] = fw_html_tag('a', array('href' => $backups->get_download_link($filename), 'target' => '_blank', 'id' => 'download-' . $filename_hash, 'data-download-file' => $filename), esc_html__('Download', 'fw'));
$details[] = fw_html_tag('a', array('href' => '#', 'onclick' => 'return false;', 'id' => 'delete-' . $filename_hash, 'data-delete-file' => $filename, 'data-confirm' => __("Warning! \n" . "You are about to delete a backup, it will be lost forever. \n" . "Are you sure?", 'fw')), esc_html__('Delete', 'fw'));
$this->items[] = array('cb' => fw_html_tag('input', array('type' => 'radio', 'name' => 'archive', 'value' => $filename, 'id' => 'archive-' . $filename_hash)), 'details' => '<div>' . $time . '</div>' . '<div>' . implode(' | ', $details) . '</div>');
}
}
开发者ID:azharijelek,项目名称:Unyson-Backups-Extension,代码行数:27,代码来源:class--fw-ext-backups-list-table.php
示例5: get_formatted_time
function get_formatted_time($date, $date_format = false, $time_format = false)
{
if (empty($date)) {
return $date;
}
if (!$date_format) {
$date_format = get_option('date_format');
}
if (preg_match('/^\\d{1-2}\\/\\d{1-2}\\/\\d{4}$/', $date)) {
global $frmpro_settings;
$date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
}
$do_time = date('H:i:s', strtotime($date)) == '00:00:00' ? false : true;
$date = get_date_from_gmt($date);
$formatted = date_i18n($date_format, strtotime($date));
if ($do_time) {
if (!$time_format) {
$time_format = get_option('time_format');
}
$trimmed_format = trim($time_format);
if ($time_format and !empty($trimmed_format)) {
$formatted .= ' ' . __('at', 'formidable') . ' ' . date_i18n($time_format, strtotime($date));
}
}
return $formatted;
}
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:26,代码来源:FrmProAppHelper.php
示例6: __invoke
/**
* Reset the post_date field on your posts.
* A sadly necessary step after you change your timezone in WordPress
*
* @synopsis --post_type=<post-type>
*/
public function __invoke($args, $assoc_args)
{
global $wpdb;
$query_args = array('post_type' => $assoc_args['post_type'], 'posts_per_page' => -1, 'post_status' => 'publish');
$query = new WP_Query($query_args);
if (empty($query->posts)) {
WP_CLI::error("No posts found");
}
WP_CLI::line(sprintf("Updating post_date on %d posts.", count($query->posts)));
foreach ($query->posts as $key => $post) {
if (empty($post->post_date_gmt) || "0000-00-00 00:00:00" == $post->post_date_gmt) {
WP_CLI::line(sprintf("Error: Post %d is missing a publish date.", $post->ID));
continue;
}
$original = $post->post_date;
$new = get_date_from_gmt($post->post_date_gmt);
if ($new == $original) {
WP_CLI::line(sprintf("No Change: Post %d has the correct post_date of %s", $post->ID, $original));
continue;
}
$wpdb->update($wpdb->posts, array('post_date' => $new), array('ID' => $post->ID));
clean_post_cache($post->ID);
WP_CLI::line(sprintf("Updated: Post %d changed from %s to %s", $post->ID, $original, $new));
if ($key && $key % 10 == 0) {
sleep(1);
}
}
WP_CLI::success("Posts were updated with the correct post_date.");
}
开发者ID:danielbachhuber,项目名称:wp-cli-reset-post-date-command,代码行数:35,代码来源:wp-cli-reset-post-date-command.php
示例7: test_get_date_from_gmt_during_dst
/**
* Unpatched, this test passes only when Europe/London is observing DST.
*
* @ticket 20328
*/
function test_get_date_from_gmt_during_dst()
{
update_option('timezone_string', 'Europe/London');
$gmt = '2012-06-01 12:34:56';
$local = '2012-06-01 13:34:56';
$this->assertEquals($local, get_date_from_gmt($gmt));
}
开发者ID:boonebgorges,项目名称:wp,代码行数:12,代码来源:date.php
示例8: extract_posts
function extract_posts($arg_url)
{
$httpclient = new HTTPClient();
$json_data = $httpclient->send($arg_url, 'get');
if (empty($json_data)) {
$this->message = 'Empty content returned';
return false;
}
// convert json to php array
$array_data = json_decode($json_data, true);
// get data
$facebook_posts = $array_data['data'];
if (count($facebook_posts) > 0) {
foreach ($facebook_posts as $facebook_post) {
$post_content = $facebook_post['message'];
$post_title = $facebook_post['name'];
$post_author = $this->author_id;
$post_status = $this->status_id;
$post_date_gmt = gmdate('Y-m-d H:i:s', strtotime($facebook_post['created_time']));
$post_date = get_date_from_gmt($post_date_gmt);
$facebook_id = $facebook_post['id'];
// build the post array
$this->posts[] = compact('post_content', 'post_title', 'post_author', 'post_status', 'post_date', 'post_date_gmt', 'facebook_id');
}
// end of foreach
}
// end of if
return true;
}
开发者ID:EricYue2012,项目名称:FacebookPostsImporter,代码行数:29,代码来源:Importer.php
示例9: tc_format_date
function tc_format_date($timestamp, $date_only = false)
{
$format = get_option('date_format');
if (!$date_only) {
$format .= ' - ' . get_option('time_format');
}
$date = get_date_from_gmt(date('Y-m-d H:i:s', $timestamp), $format);
return $date;
}
开发者ID:walkthenight,项目名称:walkthenight-wordpress,代码行数:9,代码来源:general-functions.php
示例10: test_insert_post_publish_respect_post_date_gmt
/**
* Test that a published post post_date_gmt is not altered
*/
function test_insert_post_publish_respect_post_date_gmt()
{
$post = array('post_author' => self::$admin_user_id, 'post_status' => 'publish', 'post_content' => rand_str(), 'post_title' => rand_str(), 'post_date_gmt' => '2016-04-29 12:00:00');
$id = wp_insert_post($post);
$out = get_post($id);
$this->assertEquals($post['post_content'], $out->post_content);
$this->assertEquals($post['post_title'], $out->post_title);
$this->assertEquals(get_date_from_gmt($post['post_date_gmt']), $out->post_date);
$this->assertEquals($post['post_date_gmt'], $out->post_date_gmt);
}
开发者ID:philoserf,项目名称:Edit-Flow,代码行数:13,代码来源:test-edit-flow-custom-status.php
示例11: is_post_in_sync
/**
* Check if the post is in sync before updating in Apple News.
*
* @access private
* @return boolean
*/
private function is_post_in_sync()
{
$post = get_post($this->id);
if (!$post) {
throw new \Apple_Actions\Action_Exception(__('Could not find post with id ', 'apple-news') . $this->id);
}
$api_time = get_post_meta($this->id, 'apple_news_api_modified_at', true);
$api_time = strtotime(get_date_from_gmt(date('Y-m-d H:i:s', strtotime($api_time))));
$local_time = strtotime($post->post_modified);
$in_sync = $api_time >= $local_time;
return apply_filters('apple_news_is_post_in_sync', $in_sync, $this->id, $api_time, $local_time);
}
开发者ID:norcross,项目名称:apple-news,代码行数:18,代码来源:class-push.php
示例12: backup
public function backup($backup_array)
{
global $updraftplus, $updraftplus_backup;
$updraft_dir = trailingslashit($updraftplus->backups_dir_location());
$email = $updraftplus->just_one_email(UpdraftPlus_Options::get_updraft_option('updraft_email'), true);
if (!is_array($email)) {
$email = array($email);
}
foreach ($backup_array as $type => $file) {
$descrip_type = preg_match('/^(.*)\\d+$/', $type, $matches) ? $matches[1] : $type;
$fullpath = $updraft_dir . $file;
if (file_exists($fullpath) && filesize($fullpath) > UPDRAFTPLUS_WARN_EMAIL_SIZE) {
$size_in_mb_of_big_file = round(filesize($fullpath) / 1048576, 1);
$toobig_hash = md5($file);
$updraftplus->log($file . ': ' . sprintf(__('This backup archive is %s Mb in size - the attempt to send this via email is likely to fail (few email servers allow attachments of this size). If so, you should switch to using a different remote storage method.', 'updraftplus'), $size_in_mb_of_big_file), 'warning', 'toobigforemail_' . $toobig_hash);
}
$any_attempted = false;
$any_sent = false;
foreach ($email as $ind => $addr) {
if (!apply_filters('updraftplus_email_wholebackup', true, $addr, $ind, $type)) {
continue;
}
foreach (explode(',', $addr) as $sendmail_addr) {
$send_short = strlen($sendmail_addr) > 5 ? substr($sendmail_addr, 0, 5) . '...' : $sendmail_addr;
$updraftplus->log("{$file}: email to: {$send_short}");
$any_attempted = true;
$subject = __("WordPress Backup", 'updraftplus') . ': ' . get_bloginfo('name') . ' (UpdraftPlus ' . $updraftplus->version . ') ' . get_date_from_gmt(gmdate('Y-m-d H:i:s', $updraftplus->backup_time), 'Y-m-d H:i');
$sent = wp_mail(trim($sendmail_addr), $subject, sprintf(__("Backup is of: %s.", 'updraftplus'), site_url() . ' (' . $descrip_type . ')'), null, array($fullpath));
if ($sent) {
$any_sent = true;
}
}
}
if ($any_sent) {
if (isset($toobig_hash)) {
$updraftplus->log_removewarning('toobigforemail_' . $toobig_hash);
// Don't leave it still set for the next archive
unset($toobig_hash);
}
$updraftplus->uploaded_file($file);
} elseif ($any_attempted) {
$updraftplus->log('Mails were not sent successfully');
$updraftplus->log(__('The attempt to send the backup via email failed (probably the backup was too large for this method)', 'updraftplus'), 'error');
} else {
$updraftplus->log('No email addresses were configured to send to');
}
}
return null;
}
开发者ID:JunnLearning,项目名称:dk,代码行数:49,代码来源:email.php
示例13: init
public static function init()
{
// SCHEDULER
if (isset($_POST['dh-do-schedule']) && current_user_can('manage_options')) {
wp_clear_scheduled_hook('dh-do-backup');
if ($_POST['dh-do-schedule'] != 'disabled') {
wp_schedule_event(current_time('timestamp', true) + 86400, $_POST['dh-do-schedule'], 'dh-do-backup');
$timestamp = get_date_from_gmt(date('Y-m-d H:i:s', wp_next_scheduled('dh-do-schedule')), get_option('time_format'));
$nextbackup = sprintf(__('Next backup: %s', dreamobjects), $timestamp);
DHDO::logger('Scheduled ' . $_POST['dh-do-schedule'] . ' backup. ' . $nextbackup);
}
}
// RESET
if (current_user_can('manage_options') && isset($_POST['dhdo-reset']) && $_POST['dhdo-reset'] == 'Y') {
delete_option('dh-do-backupsection');
delete_option('dh-do-boto');
delete_option('dh-do-bucket');
delete_option('dh-do-key');
delete_option('dh-do-schedule');
delete_option('dh-do-secretkey');
delete_option('dh-do-section');
delete_option('dh-do-logging');
DHDO::logger('reset');
}
// LOGGER: Wipe logger if blank
if (current_user_can('manage_options') && isset($_POST['dhdo-logchange']) && $_POST['dhdo-logchange'] == 'Y') {
if (!isset($_POST['dh-do-logging'])) {
DHDO::logger('reset');
}
}
// UPDATE OPTIONS
if (isset($_GET['settings-updated']) && isset($_GET['page']) && ($_GET['page'] == 'dreamobjects-menu' || $_GET['page'] == 'dreamobjects-menu-backup')) {
add_action('admin_notices', array('DHDOMESS', 'updateMessage'));
}
// BACKUP ASAP
if (current_user_can('manage_options') && isset($_GET['backup-now']) && $_GET['page'] == 'dreamobjects-menu-backup') {
wp_schedule_single_event(current_time('timestamp', true) + 60, 'dh-do-backupnow');
add_action('admin_notices', array('DHDOMESS', 'backupMessage'));
DHDO::logger('Scheduled ASAP backup in 60 seconds.');
}
// BACKUP
if (wp_next_scheduled('dh-do-backupnow') && ($_GET['page'] == 'dreamobjects-menu' || $_GET['page'] == 'dreamobjects-menu-backup')) {
add_action('admin_notices', array('DHDOMESS', 'backupMessage'));
}
}
开发者ID:ajmorris,项目名称:objectstore-backups,代码行数:45,代码来源:dhdo.php
示例14: extract_posts_from_data
function extract_posts_from_data($raw)
{
global $wpdb;
$importdata = $raw;
if (null === $importdata) {
$this->finished = true;
return new Keyring_Error('keyring-instapaper-importer-failed-download', __('Failed to download or parse your links from Instapaper. Please wait a few minutes and try again.'));
}
// Make sure we have some bookmarks to parse
if (!is_array($importdata) || count($importdata) < 2) {
$this->finished = true;
return;
}
usort($importdata, array($this, 'sort_by_time'));
// Parse/convert everything to WP post structs
foreach ($importdata as $post) {
if ('bookmark' != $post->type) {
continue;
}
$post_title = $post->title;
// Parse/adjust dates
$post_date_gmt = gmdate('Y-m-d H:i:s', $post->progress_timestamp);
// last seen "progress"
$post_date = get_date_from_gmt($post_date_gmt);
// Apply selected category
$post_category = array($this->get_option('category'));
// Just default tags here
$tags = $this->get_option('tags');
// Construct a post body
$href = $post->url;
$post_content = '<a href="' . $href . '" class="instapaper-title">' . $post_title . '</a>';
if (!empty($post->description)) {
$post_content .= "\n\n<blockquote class='instapaper-note'>" . $post->description . '</blockquote>';
}
// Other bits
$post_author = $this->get_option('author');
$post_status = 'publish';
$instapaper_id = $post->bookmark_id;
$instapaper_raw = $post;
// Build the post array, and hang onto it along with the others
$this->posts[] = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'post_category', 'tags', 'href', 'instapaper_id', 'instapaper_raw');
}
}
开发者ID:ebinnion,项目名称:keyring-social-importers,代码行数:43,代码来源:keyring-importer-instapaper.php
示例15: yith_vendors_update_db_1_0_1
function yith_vendors_update_db_1_0_1()
{
$vendors_db_option = get_option('yith_product_vendors_db_version', '1.0.0');
if ($vendors_db_option && version_compare($vendors_db_option, '1.0.1', '<')) {
global $wpdb;
$sql = "SELECT woocommerce_term_id as vendor_id, meta_value as user_id\r\n FROM {$wpdb->woocommerce_termmeta} as wtm\r\n WHERE wtm.meta_key = %s\r\n AND woocommerce_term_id IN (\r\n SELECT DISTINCT term_id as vendor_id\r\n FROM {$wpdb->term_taxonomy} as tt\r\n WHERE tt.taxonomy = %s\r\n )";
$results = $wpdb->get_results($wpdb->prepare($sql, 'owner', YITH_Vendors()->get_taxonomy_name()));
foreach ($results as $result) {
$user = get_user_by('id', $result->user_id);
if ($user) {
update_woocommerce_term_meta($result->vendor_id, 'registration_date', get_date_from_gmt($user->user_registered));
update_woocommerce_term_meta($result->vendor_id, 'registration_date_gmt', $user->user_registered);
if (defined('YITH_WPV_PREMIUM')) {
$user->add_cap('view_woocommerce_reports');
}
}
}
update_option('yith_product_vendors_db_version', '1.0.1');
}
}
开发者ID:yarwalker,项目名称:ecobyt,代码行数:20,代码来源:functions.yith-update.php
示例16: compute
private function compute($whichtime)
{
// Returned value should be in UNIX time.
$unixtime_now = time();
// Convert to date
$now_timestring_gmt = gmdate('Y-m-d H:i:s', $unixtime_now);
// Convert to blog's timezone
$now_timestring_blogzone = get_date_from_gmt($now_timestring_gmt, 'Y-m-d H:i:s');
$int_key = 'db' == $whichtime ? '_database' : '';
$sched = isset($_POST['updraft_interval' . $int_key]) ? $_POST['updraft_interval' . $int_key] : 'manual';
// Was a particular week-day specified?
if (isset($_POST['updraft_startday_' . $whichtime]) && ('weekly' == $sched || 'monthly' == $sched || 'fortnightly' == $sched)) {
// Get specified day of week in range 0-6
$startday = min(absint($_POST['updraft_startday_' . $whichtime]), 6);
// Get today's day of week in range 0-6
$day_today_blogzone = get_date_from_gmt($now_timestring_gmt, 'w');
if ($day_today_blogzone != $startday) {
if ($startday < $day_today_blogzone) {
$startday += 7;
}
$new_startdate_unix = $unixtime_now + ($startday - $day_today_blogzone) * 86400;
$now_timestring_blogzone = get_date_from_gmt(gmdate('Y-m-d H:i:s', $new_startdate_unix), 'Y-m-d H:i:s');
}
}
// HH:MM, in blog time zone
// This function is only called from the options validator, so we don't read the current option
//$start_time = UpdraftPlus_Options::get_updraft_option('updraft_starttime_'.$whichtime);
$start_time = isset($_POST['updraft_starttime_' . $whichtime]) ? $_POST['updraft_starttime_' . $whichtime] : '00:00';
list($start_hour, $start_minute) = $this->parse($start_time);
// Now, convert the start time HH:MM from blog time to UNIX time
$start_time_unix = get_gmt_from_date(substr($now_timestring_blogzone, 0, 11) . sprintf('%02d', $start_hour) . ':' . sprintf('%02d', $start_minute) . ':00', 'U');
// That may have already passed for today
if ($start_time_unix < time()) {
if ('weekly' == $sched || 'monthly' == $sched || 'fortnightly' == $sched) {
$start_time_unix = $start_time_unix + 86400 * 7;
} else {
$start_time_unix = $start_time_unix + 86400;
}
}
return $start_time_unix;
}
开发者ID:jimrucinski,项目名称:Vine,代码行数:41,代码来源:fixtime.php
示例17: extract_posts_from_data
function extract_posts_from_data($raw)
{
global $wpdb;
$importdata = $raw;
if (null === $importdata) {
$this->finished = true;
return new Keyring_Error('keyring-delicious-importer-failed-download', __('Failed to download or parse your bookmarks from Delicious. Please wait a few minutes and try again.'));
}
// Make sure we have some bookmarks to parse
if (!is_object($importdata) || !count($importdata->post)) {
$this->finished = true;
return;
}
// Parse/convert everything to WP post structs
foreach ($importdata->post as $post) {
$post_title = (string) $post['description'];
// Parse/adjust dates
$post_date_gmt = strtotime((string) $post['time']);
$post_date_gmt = gmdate('Y-m-d H:i:s', $post_date_gmt);
$post_date = get_date_from_gmt($post_date_gmt);
// Apply selected category
$post_category = array($this->get_option('category'));
// Figure out tags
$tags = (string) $post['tag'];
$tags = array_merge($this->get_option('tags'), explode(' ', strtolower($tags)));
// Construct a post body
$href = (string) $post['href'];
$extended = (string) $post['extended'];
$post_content = '<a href="' . $href . '" class="delicious-title">' . $post_title . '</a>';
if (!empty($extended)) {
$post_content .= "\n\n<blockquote class='delicious-note'>" . $extended . '</blockquote>';
}
// Other bits
$post_author = $this->get_option('author');
$post_status = 'publish';
$delicious_id = (string) $post['hash'];
$delicious_raw = $post;
// Build the post array, and hang onto it along with the others
$this->posts[] = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'post_category', 'delicious_id', 'tags', 'href', 'delicious_raw');
}
}
开发者ID:ebinnion,项目名称:keyring-social-importers,代码行数:41,代码来源:keyring-importer-delicious.php
示例18: backup
public function backup($backup_array)
{
global $updraftplus, $updraftplus_backup;
$updraft_dir = trailingslashit($updraftplus->backups_dir_location());
$email = $updraftplus->just_one_email(UpdraftPlus_Options::get_updraft_option('updraft_email'), true);
if (!is_array($email)) {
$email = array($email);
}
foreach ($backup_array as $type => $file) {
$descrip_type = preg_match('/^(.*)\\d+$/', $type, $matches) ? $matches[1] : $type;
$fullpath = $updraft_dir . $file;
#if (file_exists($fullpath) && filesize($fullpath) > ...
$any_attempted = false;
$any_sent = false;
foreach ($email as $ind => $addr) {
if (!apply_filters('updraftplus_email_wholebackup', true, $addr, $ind, $type)) {
continue;
}
foreach (explode(',', $addr) as $sendmail_addr) {
$send_short = strlen($sendmail_addr) > 5 ? substr($sendmail_addr, 0, 5) . '...' : $sendmail_addr;
$updraftplus->log("{$file}: email to: {$send_short}");
$any_attempted = true;
$subject = __("WordPress Backup", 'updraftplus') . ': ' . get_bloginfo('name') . ' (UpdraftPlus ' . $updraftplus->version . ') ' . get_date_from_gmt(gmdate('Y-m-d H:i:s', $updraftplus->backup_time), 'Y-m-d H:i');
$sent = wp_mail(trim($sendmail_addr), $subject, sprintf(__("Backup is of: %s.", 'updraftplus'), site_url() . ' (' . $descrip_type . ')'), null, array($fullpath));
if ($sent) {
$any_sent = true;
}
}
}
if ($any_sent) {
$updraftplus->uploaded_file($file);
} elseif ($any_attempted) {
$updraftplus->log('Mails were not sent successfully');
$updraftplus->log(__('The attempt to send the backup via email failed (probably the backup was too large for this method)', 'updraftplus'), 'error');
} else {
$updraftplus->log('No email addresses were configured to send to');
}
}
return null;
}
开发者ID:lorier,项目名称:thedailydrawing,代码行数:40,代码来源:email.php
示例19: user_edit_form_tag
public function user_edit_form_tag()
{
global $gMemberNetwork, $profileuser;
$store_lastlogin = $gMemberNetwork->settings->get('store_lastlogin', TRUE);
echo '><h2>' . __('Account Information', GMEMBER_TEXTDOMAIN) . '</h2>';
echo '<table class="form-table">';
if (isset($profileuser->{$this->constants['meta_register_ip']}) && $profileuser->{$this->constants['meta_register_ip']}) {
$register_ip = $gMemberNetwork->getIPLookup($profileuser->{$this->constants['meta_register_ip']});
} else {
$register_ip = __('No Data Available', GMEMBER_TEXTDOMAIN);
}
echo '<tr class="register_ip"><th>' . __('Registration IP', GMEMBER_TEXTDOMAIN) . '</th><td><code>' . $register_ip . '</code></td></tr>';
$register_date = strtotime(get_date_from_gmt($profileuser->user_registered));
$register_on = $gMemberNetwork->getDate($register_date, 'datetime') . ' <small><small><span class="description">(' . sprintf(__('%s ago', GMEMBER_TEXTDOMAIN), apply_filters('string_format_i18n', human_time_diff($register_date))) . ')</span></small></small>';
echo '<tr class="register_date"><th>' . __('Registration on', GMEMBER_TEXTDOMAIN) . '</th><td>' . $register_on . '</td></tr>';
if ($store_lastlogin || current_user_can('edit_users')) {
if (isset($profileuser->{$this->constants['meta_lastlogin']}) && '' != $profileuser->{$this->constants['meta_lastlogin']}) {
$lastlogin_date = strtotime(get_date_from_gmt($profileuser->{$this->constants['meta_lastlogin']}));
$lastlogin = $gMemberNetwork->getDate($lastlogin_date, 'datetime') . ' <small><small><span class="description">(' . sprintf(__('%s ago', GMEMBER_TEXTDOMAIN), apply_filters('string_format_i18n', human_time_diff($lastlogin_date))) . ')</span></small></small>';
} else {
$lastlogin = '<code>' . __('No Data Available', GMEMBER_TEXTDOMAIN) . '</code>';
}
echo '<tr class="last_login' . ($store_lastlogin ? '' : ' error') . '"><th>' . __('Last Login', GMEMBER_TEXTDOMAIN) . '</th><td>' . $lastlogin . ($store_lastlogin ? '' : ' — <strong>' . __('Last Logins are Disabled', GMEMBER_TEXTDOMAIN) . '</strong>') . '</td></tr>';
}
if (!IS_PROFILE_PAGE && current_user_can('edit_users')) {
echo '</table><h2>' . __('Administrative Options', GMEMBER_TEXTDOMAIN) . '</h2>';
echo '<table class="form-table">';
$nicename = $profileuser->user_login == $profileuser->user_nicename ? $this->sanitize_slug($profileuser->display_name) : $profileuser->user_nicename;
echo '<tr><th><label for="gmember-slug">' . __('Slug', GMEMBER_TEXTDOMAIN) . '</label></th><td><input type="text" name="gmember_slug" id="gmember_slug" value="' . esc_attr($nicename) . '" class="regular-text" dir="ltr"' . (current_user_can('edit_users') ? '' : ' readonly="readonly" disabled="disabled"') . ' /><p class="description">' . __('This will be used in the URL of the user\'s page', GMEMBER_TEXTDOMAIN) . '</p></td></tr>';
echo '<tr><th>' . __('Account Login', GMEMBER_TEXTDOMAIN) . '</th><td><label for="gmember_disable_user">' . '<input type="checkbox" name="gmember_disable_user" id="gmember_disable_user" value="1"';
checked(1, get_the_author_meta($this->constants['meta_disable_user'], $profileuser->ID));
echo ' /> ' . __('Disable user login with this account', GMEMBER_TEXTDOMAIN) . '</label></td></tr>';
echo '<tr><th>' . __('Password Reset', GMEMBER_TEXTDOMAIN) . '</th><td><label for="gmember_password_reset">' . '<input type="checkbox" name="gmember_password_reset" id="gmember_password_reset" value="1"';
checked(1, get_the_author_meta($this->constants['meta_disable_password_reset'], $profileuser->ID));
echo ' /> ' . __('Disable this account password reset via wp-login.php', GMEMBER_TEXTDOMAIN) . '</label></td></tr>';
}
echo '</table';
// it's correct, checkout the hook!
}
开发者ID:geminorum,项目名称:gmember,代码行数:39,代码来源:login.class.php
示例20: wp_insert_post
//.........这里部分代码省略.........
}
// Don't allow contributors to set the post slug for pending review posts.
if ('pending' == $post_status && !current_user_can('publish_posts')) {
$post_name = '';
}
/*
* Create a valid post name. Drafts and pending posts are allowed to have
* an empty post name.
*/
if (empty($post_name)) {
if (!in_array($post_status, array('draft', 'pending', 'auto-draft'))) {
$post_name = sanitize_title($post_title);
} else {
$post_name = '';
}
} else {
// On updates, we need to check to see if it's using the old, fixed sanitization context.
$check_name = sanitize_title($post_name, '', 'old-save');
if ($update && strtolower(urlencode($post_name)) == $check_name && get_post_field('post_name', $post_ID) == $check_name) {
$post_name = $check_name;
} else {
// new post, or slug has changed.
$post_name = sanitize_title($post_name);
}
}
/*
* If the post date is empty (due to having been new or a draft) and status
* is not 'draft' or 'pending', set date to now.
*/
if (empty($postarr['post_date']) || '0000-00-00 00:00:00' == $postarr['post_date']) {
if (empty($postarr['post_date_gmt']) || '0000-00-00 00:00:00' == $postarr['post_date_gmt']) {
$post_date = current_time('mysql');
} else {
$post_date = get_date_from_gmt($postarr['post_date_gmt']);
}
} else {
$post_date = $postarr['post_date'];
}
// Validate the date.
$mm = substr($post_date, 5, 2);
$jj = substr($post_date, 8, 2);
$aa = substr($post_date, 0, 4);
$valid_date = wp_checkdate($mm, $jj, $aa, $post_date);
if (!$valid_date) {
if ($wp_error) {
return new WP_Error('invalid_date', __('Whoops, the provided date is invalid.'));
} else {
return 0;
}
}
if (empty($postarr['post_date_gmt']) || '0000-00-00 00:00:00' == $postarr['post_date_gmt']) {
if (!in_array($post_status, array('draft', 'pending', 'auto-draft'))) {
$post_date_gmt = get_gmt_from_date($post_date);
} else {
$post_date_gmt = '0000-00-00 00:00:00';
}
} else {
$post_date_gmt = $postarr['post_date_gmt'];
}
if ($update || '0000-00-00 00:00:00' == $post_date) {
$post_modified = current_time('mysql');
$post_modified_gmt = current_time('mysql', 1);
} else {
$post_modified = $post_date;
$post_modified_gmt = $post_date_gmt;
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:67,代码来源:post.php
注:本文中的get_date_from_gmt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论