function mysql2localedatetime_spans($mysqlstring, $datefmt = NULL, $timefmt = NULL) { if (is_null($datefmt)) { $datefmt = locale_datefmt(); } if (is_null($timefmt)) { $timefmt = locale_timefmt(); } return '<span class="date">' . mysql2date($datefmt, $mysqlstring) . '</span> <span class="time">' . mysql2date($timefmt, $mysqlstring) . '</span>'; }
/** * wp.getOptions * * @see http://codex.wordpress.org/XML-RPC_wp#wp.getOptions * * Note: If passing in a struct, search for options listed within it. * * @param xmlrpcmsg XML-RPC Message * 0 blogid (int): Unique identifier of the blog. * 1 username (string): User login. * 2 password (string): Password for said username. * 3 options (struct) */ function wp_getoptions($m) { global $Settings; // CHECK LOGIN: /** * @var User */ if (!($current_User =& xmlrpcs_login($m, 1, 2))) { // Login failed, return (last) error: return xmlrpcs_resperror(); } // GET BLOG: /** * @var Blog */ if (!($Blog =& xmlrpcs_get_Blog($m, 0))) { // Login failed, return (last) error: return xmlrpcs_resperror(); } if (isset($m->params[3])) { $options = $m->getParam(3); $options = xmlrpc_decode_recurse($options); } $defaults = array('software_name' => array('desc' => 'Software Name', 'value' => 'WordPress'), 'software_version' => array('desc' => 'Software Version', 'value' => '3.3.2'), 'blog_url' => array('desc' => 'Site URL', 'value' => $Blog->gen_blogurl()), 'blog_title' => array('desc' => 'Site TitleL', 'value' => $Blog->get('name')), 'blog_tagline' => array('desc' => 'Site Tagline', 'value' => $Blog->get('tagline')), 'date_format' => array('desc' => 'Date Format', 'value' => locale_datefmt()), 'time_format' => array('desc' => 'Time Format', 'value' => locale_timefmt()), 'users_can_register' => array('desc' => 'Allow new users to sign up', 'value' => $Settings->get('newusers_canregister')), 'thumbnail_crop' => array('desc' => 'Crop thumbnail to exact dimensions', 'value' => false), 'thumbnail_size_w' => array('desc' => 'Thumbnail Width', 'value' => '160'), 'thumbnail_size_h' => array('desc' => 'Thumbnail Height', 'value' => '160'), 'medium_size_w' => array('desc' => 'Medium size image width', 'value' => '320'), 'medium_size_h' => array('desc' => 'Medium size image height', 'value' => '320'), 'large_size_w' => array('desc' => 'Large size image width', 'value' => '720'), 'large_size_h' => array('desc' => 'Large size image height', 'value' => '500')); $data = array(); if (empty($options)) { // No specific options where asked for, return all of them foreach ($defaults as $k => $opt) { $data[$k] = new xmlrpcval(array('desc' => new xmlrpcval($opt['desc']), 'readonly' => new xmlrpcval(true, 'boolean'), 'value' => new xmlrpcval($opt['value'])), 'struct'); } logIO('Retrieving all options'); } else { foreach ($options as $k) { if (!isset($defaults[$k])) { continue; } $data[$k] = new xmlrpcval(array('desc' => new xmlrpcval($defaults[$k]['desc']), 'readonly' => new xmlrpcval(true, 'boolean'), 'value' => new xmlrpcval($defaults[$k]['value'])), 'struct'); logIO('Retrieving option: ' . $k); } } logIO('OK.'); return new xmlrpcresp(new xmlrpcval($data, 'struct')); }
/** * Template function: display time (datetime) of comment * * @param string date/time format: leave empty to use locale default time format * '#short_time' - to use locale default short time format * @param boolean true if you want GMT */ function time($format = '', $useGM = false) { if (empty($format)) { // Get the current locale's default time format $format = locale_timefmt(); } if ($format == '#short_time') { // Use short time format of current locale $format = locale_shorttimefmt(); } echo mysql2date($format, $this->date, $useGM); }
$Table->display_line_start(); // Checkbox to import $Table->display_col_start(); echo '<input type="radio" name="wp_file" value="' . $import_file['path'] . '"' . (get_param('wp_file') == $import_file['path'] ? ' checked="checked"' : '') . ' />'; $Table->display_col_end(); // File $Table->display_col_start(); echo basename($import_file['path']); $Table->display_col_end(); // Type $Table->display_col_start(); echo $import_file['type']; $Table->display_col_end(); // File date $Table->display_col_start(); echo date(locale_datefmt() . ' ' . locale_timefmt(), filemtime($import_file['path'])); $Table->display_col_end(); $Table->display_line_end(); evo_flush(); } } // BODY END / TABLE END: $Table->display_body_end(); $Table->display_list_end(); if (!empty($import_files)) { $Form->begin_fieldset(T_('Select a blog for import')); $BlogCache =& get_BlogCache(); $BlogCache->load_all('shortname,name', 'ASC'); $BlogCache->none_option_text = ' '; $Form->select_input_object('wp_blog_ID', param('wp_blog_ID', 'integer', 0), $BlogCache, T_('Blog for import'), array('note' => T_('This blog will be used for import.') . ' <a href="' . $admin_url . '?ctrl=collections&action=new">' . T_('Create new blog') . ' »</a>', 'allow_none' => true, 'required' => true, 'loop_object_method' => 'get_extended_name')); $import_type = param('import_type', 'string', 'replace');
// we have minutes if ($td_value % 60 != 0) { // we have seconds (hh:mm:ss) $td_value = floor($td_value / 3600) . ':' . sprintf('%02d', $td_value % 3600 / 60) . ':' . sprintf('%02d', $td_value % 60); } else { // hh:mm $td_value = floor($td_value / 3600) . ':' . sprintf('%02d', $td_value % 3600 / 60); } } else { // just full hours: $td_value = $td_value / 3600; } if ($neg) { $td_value = '-' . $td_value; } $Form->text_input('newtime_difference', $td_value, 8, T_('Time difference'), sprintf('[' . T_('in hours, e.g. "1", "1:30" or "1.5"') . '] ' . T_('If you\'re not on the timezone of your server. Current server time is: %s.'), '<span id="cur_servertime">' . date_i18n(locale_timefmt(), $servertimenow) . '</span>') . ' <a href="#" onclick="calc_TimeDifference(); return false;">' . T_('Calculate time difference') . '</a>', array('maxlength' => 8, 'required' => true)); $Form->select('newdefault_locale', $Settings->get('default_locale'), 'locale_options_return', T_('Default locale'), T_('Overridden by browser config, user locale or blog locale (in this order).')); $Form->end_fieldset(); $Form->begin_fieldset(T_('Available locales')); echo '<p class="center">'; if ($loc_transinfo) { echo '<a href="' . $pagenow . '?ctrl=locales">' . T_('Hide translation info'), '</a>'; } else { echo '<a href="' . $pagenow . '?ctrl=locales&loc_transinfo=1">' . T_('Show translation info'), '</a>'; } echo '</p>'; echo '<table class="grouped" cellspacing="0">'; ?> <tr> <th class="firstcol"><?php echo T_('Locale');
?> </th> </tr> </thead> <tbody> <?php $count = 0; foreach ($res_affected_comments as $row_stats) { // TODO: new Comment( $row_stats ) ?> <tr class="<?php echo $count % 2 == 1 ? 'odd' : 'even'; ?> "> <td class="firstcol"><?php echo mysql2date(locale_datefmt() . ' ' . locale_timefmt(), $row_stats['comment_date']); ?> </td> <td><?php echo $row_stats['comment_author']; ?> </a></td> <td><?php disp_url($row_stats['comment_author_url'], 50); ?> </td> <td><?php echo $row_stats['comment_author_IP']; ?> </td> <td><?php
/** * Template function: display deadline time (datetime) of Item * * @param string date/time format: leave empty to use locale default time format * @param boolean true if you want GMT */ function deadline_time($format = '', $useGM = false) { if (empty($format)) { echo mysql2date(locale_timefmt(), $this->datedeadline, $useGM); } else { echo mysql2date($format, $this->datedeadline, $useGM); } }
/** * Create author cell for message list table * * @param integer user ID * @param string login * @param string first name * @param string last name * @param integer avatar ID * @param string datetime */ function author($user_ID, $datetime) { $author = get_user_avatar_styled($user_ID, array('size' => 'crop-top-80x80')); return $author . '<div class="note black">' . mysql2date(locale_datefmt() . '<\\b\\r />' . str_replace(':s', '', locale_timefmt()), $datetime) . '</div>'; }
$Form->add_crumb('time'); $Form->hidden('ctrl', 'time'); $Form->hidden('action', 'update'); $Form->begin_fieldset(T_('Time settings') . get_manual_link('regional-time-tab')); // Time difference: $td_value = $Settings->get('time_difference'); $neg = $td_value < 0; $td_value = abs($td_value); if ($td_value % 3600 != 0) { // we have minutes if ($td_value % 60 != 0) { // we have seconds (hh:mm:ss) $td_value = floor($td_value / 3600) . ':' . sprintf('%02d', $td_value % 3600 / 60) . ':' . sprintf('%02d', $td_value % 60); } else { // hh:mm $td_value = floor($td_value / 3600) . ':' . sprintf('%02d', $td_value % 3600 / 60); } } else { // just full hours: $td_value = $td_value / 3600; } if ($neg) { $td_value = '-' . $td_value; } $Form->text_input('newtime_difference', $td_value, 8, T_('Time difference'), '[' . T_('in hours, e.g. "1", "1:30" or "-1.5"') . '] ' . T_('If you\'re not on the timezone of your server.'), array('maxlength' => 8, 'required' => true)); $Form->info(T_('Current server time'), date_i18n(locale_timefmt(), $servertimenow)); $Form->info('', '<a href="#" onclick="calc_TimeDifference(); return false;">' . T_('Calculate time difference') . '</a>'); $Form->end_fieldset(); if ($current_User->check_perm('options', 'edit')) { $Form->end_form(array(array('submit', '', T_('Save Changes!'), 'SaveButton'))); }
/** * Get date/time of last modification, formatted. * $ @param string date format or 'date' or 'time' for default locales. * @return string locale formatted date/time */ function get_lastmod_formatted($format = '#') { global $localtimenow; switch ($format) { case 'date': return date_i18n(locale_datefmt(), $this->_lastmod_ts); case 'time': return date_i18n(locale_timefmt(), $this->_lastmod_ts); case 'compact': $age = $localtimenow - $this->_lastmod_ts; if ($age < 3600) { // Less than 1 hour: return full time return date_i18n('H:i:s', $this->_lastmod_ts); } if ($age < 86400) { // Less than 24 hours: return compact time return date_i18n('H:i', $this->_lastmod_ts); } if ($age < 31536000) { // Less than 365 days: Month and day return date_i18n('M, d', $this->_lastmod_ts); } // Older: return yeat return date_i18n('Y', $this->_lastmod_ts); break; case '#': default: $format = locale_datefmt() . ' ' . locale_timefmt(); return date_i18n($format, $this->_lastmod_ts); } }
} // Initialize GeoIP plugin $geoip_Plugin =& $Plugins->get_by_code('evo_GeoIP'); foreach ($login_attempts as $attempt) { $attempt = explode('|', $attempt); $attempt_ip = $attempt[1]; $plugin_country_by_IP = ''; if (!empty($geoip_Plugin) && ($Country =& $geoip_Plugin->get_country_by_IP($attempt_ip))) { // Get country by IP if plugin is enabled $plugin_country_by_IP = ' (' . $Country->get_name() . ')'; } if ($attempt_ip != $current_ip) { // Get DNS by IP if current IP is different from attempt IP $attempt_ip .= ' ' . gethostbyaddr($attempt_ip); } $Messages->add(sprintf(T_('Someone tried to log in to your account with a wrong password on %s from %s%s'), date(locale_datefmt() . ' ' . locale_timefmt(), $attempt[0]), $attempt_ip, $plugin_country_by_IP), 'error'); } // Clear the attempts list $UserSettings->delete('login_attempts', $current_User->ID); $UserSettings->dbupdate(); } } elseif (empty($login_error)) { // if the login_error wasn't set yet, add the default one: // This will cause the login screen to "popup" (again) $login_error = T_('Wrong login/password.'); if (isset($login_attempts)) { // Save new login attempt into DB if (count($login_attempts) == 9) { // Unset first attempt to clear a space for new attempt unset($login_attempts[0]); }
function mysql2localedatetime_spans($mysqlstring) { return '<span class="date">' . mysql2date(locale_datefmt(), $mysqlstring) . '</span> <span class="time">' . mysql2date(locale_timefmt(), $mysqlstring) . '</span>'; }
// Date format $Form->text_input('newloc_datefmt', isset($ltemplate['datefmt']) ? $ltemplate['datefmt'] : get_param('newloc_datefmt'), 20, T_('Date format'), T_('See below.'), array('required' => true)); // Time format $Form->text_input('newloc_timefmt', isset($ltemplate['timefmt']) ? $ltemplate['timefmt'] : get_param('newloc_timefmt'), 20, T_('Time format'), T_('See below.'), array('required' => true)); // Short time format $Form->text_input('newloc_shorttimefmt', isset($ltemplate['shorttimefmt']) ? $ltemplate['shorttimefmt'] : get_param('newloc_shorttimefmt'), 20, T_('Short time format'), T_('See below.'), array('required' => true)); // Start of week $Form->dayOfWeek('newloc_startofweek', isset($ltemplate['startofweek']) ? $ltemplate['startofweek'] : get_param('newloc_startofweek'), T_('Start of week'), T_('Day at the start of the week.')); // Lang file $Form->text('newloc_messages', isset($ltemplate['messages']) ? $ltemplate['messages'] : get_param('newloc_messages'), 20, T_('Lang file'), T_('the lang file to use, from the <code>locales</code> subdirectory')); // Priority $Form->text_input('newloc_priority', isset($ltemplate['priority']) ? $ltemplate['priority'] : get_param('newloc_priority'), 3, T_('Priority'), T_('1 is highest. Priority is important when selecting a locale from a language code and several locales match the same language; this can happen when detecting browser language. Priority also affects the order in which locales are displayed in dropdown boxes, etc.'), array('required' => true)); // TODO: Update this field onchange of datefmt/timefmt through AJAX: // fp> It would actually make more sense to have the preview at the exact place that says "see below" locale_temp_switch($newlocale); $Form->info_field(T_('Date preview'), date_i18n(locale_datefmt() . ' ' . locale_timefmt(), $localtimenow)); locale_restore_previous(); // generate Javascript array of locales to warn in case of overwriting $l_warnfor = "'" . implode("', '", array_keys($locales)) . "'"; if ($edit_locale != '_new_') { // remove the locale we want to edit from the generated array $l_warnfor = str_replace("'{$newlocale}'", "'thiswillneverevermatch'", $l_warnfor); } $Form->end_form(array(array('submit', 'submit', $edit_locale == '_new_' ? T_('Create') : T_('Save Changes!'), 'SaveButton'))); ?> <div class="panelinfo"> <h3><?php echo T_('Flags'); ?> </h3> <p><?php
if (empty($Comment->ID)) { // PREVIEW comment $c_title = $Skin->T_('PREVIEW Comment from:'); } else { // Normal comment $c_title = '<a class="comment-id" href="' . $Comment->get_permanent_url() . '">' . $Skin->T_('Comment') . '</a> ' . $Skin->T_('from:'); } break; } echo '<div class="comment-head comment depth-1 withAvatars ' . $liclass . '">'; $Comment->rating(); $comment_author = $Comment->get_author_name(); if ($cmt_url = $Comment->get_author_url()) { $comment_author = '<a class="comment-author" href="' . $cmt_url . '" rel="nofollow">' . $Comment->get_author_name() . '</a>'; } $author_avatar = $Skin->get_avatar($Comment, 'crop-48x48'); if ($msg_url = $Skin->get_author_msgform_link($Comment)) { $author_avatar = '<a href="' . $msg_url . '" title="' . $Skin->T_('Send email to comment author') . '">' . $author_avatar . '</a>'; } echo '<div class="avatar-box">' . $author_avatar . '</div> <div class="author"><span class="by">' . $c_title . ' ' . $comment_author . '</span><br />' . mysql2date(locale_datefmt(), $Comment->date) . ' @ ' . mysql2date(locale_timefmt(), $Comment->date) . '</div>'; echo '<div class="controls bubble">'; $Comment->edit_link('', ' '); $Comment->delete_link('', ''); echo '</div>'; echo '</div><div class="comment-body clearfix"> <div class="comment-text"><p>' . $Comment->get_content() . '</p></div> </div>'; ?> </li>
function stats_time($format = '') { global $row_stats; if ($format == '') { $format = locale_datefmt() . ' ' . locale_timefmt(); } echo date_i18n($format, $row_stats['hit_datetime']); }
$Item->categories(array('before' => '<div class="post-tags post-cats" title="' . $Skin->T_('Categories') . '">', 'after' => '</div>', 'include_main' => true, 'include_other' => true, 'include_external' => true, 'link_categories' => true)); if ($Skin->get_setting('post_meta')) { ?> <table class="post-meta"> <tr> <td><?php $Skin->shareThis(); ?> </td> <td><a class="control print"><?php echo $Skin->T_('Print article'); ?> </a> </td> <td class="details"> <?php printf($Skin->T_('This %1$s was posted by %2$s on %3$s at %4$s. Follow any responses to this post through %5$s.'), '<a href="' . $Item->get_permanent_url() . '">' . $Skin->T_('entry') . '</a>', '<a href="' . $Item->creator_User->get_userpage_url() . '" title="' . $Skin->T_('Posts by') . ' ' . $Item->creator_User->get_preferred_name() . '">' . $Item->creator_User->get_preferred_name() . '</a>', $Item->get_issue_date(), $Item->get_issue_date(array('date_format' => locale_timefmt())), '<a href="' . url_add_param($Item->get_permanent_url(), 'tempskin=_rss2&disp=comments&p=' . $Item->ID) . '" title="RSS 2.0">RSS 2.0</a>'); ?> </td> </tr> </table> <?php } } // "Post bottom" CONTAINER EMBEDDED HERE skin_container(NT_('Post bottom'), array('block_start' => '<div class="PostBottom">', 'block_end' => '</div>')); // FEEDBACK (COMMENTS/TRACKBACKS) INCLUDED HERE skin_include('_item_feedback.inc.php', array('before_section_title' => '<span class="comment_section_title">', 'after_section_title' => '</span>', 'form_title_start' => '<div class="comment_form_title">', 'form_title_end' => '</div>', 'comment_list_start' => '<ul id="comments" class="comments">', 'comment_list_end' => '</ul>', 'before_comment_error' => '<span class="comment_section_title">', 'after_comment_error' => '</span>')); locale_restore_previous(); ?> </div>
/** * Template function: display last mod time (datetime) of Item * * @param string date/time format: leave empty to use locale default time format * @param boolean true if you want GMT */ function mod_time($format = '', $useGM = false) { if (empty($format)) { echo mysql2date(locale_timefmt(), $this->datemodified, $useGM); } else { echo mysql2date($format, $this->datemodified, $useGM); } }
/** * Get the settings that the plugin can use. * * Those settings are transfered into a Settings member object of the plugin * and can be edited in the backoffice (Settings / Plugins). * * @see Plugin::GetDefaultSettings() * @see PluginSettings * @see Plugin::PluginSettingsValidateSet() * @return array */ function GetDefaultSettings(&$params) { global $admin_url; if (file_exists($this->geoip_file_path)) { $datfile_info = sprintf(T_('Last updated on %s'), date(locale_datefmt() . ' ' . locale_timefmt(), filemtime($this->geoip_file_path))); } else { $datfile_info = '<span class="error">' . T_('Not found') . '</span>'; } $datfile_info .= ' - <a href="' . $admin_url . '?ctrl=tools&action=geoip_download&' . url_crumb('tools') . '#geoip">' . T_('Download update now!') . '</a>'; return array('datfile' => array('label' => 'GeoIP.dat', 'type' => 'info', 'note' => '', 'info' => $datfile_info), 'detect_registration' => array('label' => T_('Detect country on registration'), 'type' => 'radio', 'options' => array(array('no', T_('No')), array('auto', T_('Auto select current country in list')), array('hide', T_('Hide country selector if a country has been detected'))), 'field_lines' => true, 'note' => '', 'defaultvalue' => 'no'), 'force_account_creation' => array('label' => T_('At account creation'), 'type' => 'checkbox', 'note' => T_('force country to the country detected by GeoIP'), 'defaultvalue' => '1')); }