• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP format_interval函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: openfit_base_preprocess_comment

function openfit_base_preprocess_comment(&$variables)
{
    $openfit_node_types = array('activity' => TRUE);
    if (!isset($variables['node']) || !isset($openfit_node_types[$variables['node']->type])) {
        return;
    }
    $comment = $variables['comment'];
    // Remove the standard comment links: reply, edit, delete
    unset($variables['content']['links']['comment']['#links']);
    // Add a delete menu if the user posted the comment or is admin
    global $user;
    if (user_access('administer comments') || $user->uid == $comment->uid) {
        $url = drupal_get_path_alias('node/' . $variables['node']->nid) . '/comments';
        $variables['content']['links']['comment']['#links'] = array('comment-delete' => array('title' => ' ', 'href' => 'comment/' . $comment->cid . '/delete', 'query' => array('destination' => $url), 'html' => TRUE));
    }
    // Display "XX ago" for posts less than 1 day, otherwise use locale to format datetime
    $ago = time() - $comment->created;
    if ($ago < 86400) {
        $variables['created'] = t('!interval ago', array('!interval' => format_interval(time() - $comment->created)));
    } else {
        $locale = OpenFitUserSetting::getCurrentUserLocale();
        $fmt = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::SHORT);
        $created = new DateTime('now');
        $created->setTimestamp($comment->created);
        $variables['created'] = $fmt->format($created);
    }
    $variables['submitted'] = $variables['author'] . '&nbsp;' . '<time datetime="' . $variables['datetime'] . '" pubdate="pubdate">' . $variables['created'] . '</time>';
}
开发者ID:NeilBryant,项目名称:sufferhub,代码行数:28,代码来源:template.php


示例2: getResultInfo

 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo()
 {
     if ($this->registry['cron_last']) {
         return dt('Cron last ran at @date (@ago ago)', array('@date' => date('r', $this->registry['cron_last']), '@ago' => format_interval(time() - $this->registry['cron_last'])));
     }
     return dt('Cron has never run.');
 }
开发者ID:OPIN-CA,项目名称:checkpoint,代码行数:10,代码来源:Last.php


示例3: hook_cleaner_settings

/**
 * Create Cleaner settings form.
 *
 * @return array
 *   Form of the cleaner settings page.
 */
function hook_cleaner_settings()
{
    // Add CSS to the admin settings page.
    drupal_add_css(drupal_get_path('module', 'cleaner') . '/cleaner.css');
    $form = array();
    $yes_no = array(t('No'), t('Yes'));
    $inline = array('class' => array('container-inline'));
    $interval = array(0 => t('Every time')) + Cleaner::$intervals;
    $form['cleaner_cron'] = array('#type' => 'radios', '#title' => t('Run interval'), '#options' => $interval, '#default_value' => variable_get('cleaner_cron', 3600), '#description' => t('This is how often the options below will occur. The actions will occur on the next Cron run after this interval expires. "Every time" means on every Cron run.'), '#attributes' => $inline);
    $form['cleaner_clear_cache'] = array('#type' => 'radios', '#options' => $yes_no, '#title' => t('Clean up cache'), '#default_value' => variable_get('cleaner_clear_cache', 0), '#description' => Cleaner::cleanerGetCacheTablesTable(), '#attributes' => $inline);
    $form['cleaner_empty_watchdog'] = array('#type' => 'radios', '#options' => $yes_no, '#title' => t('Clean up Watchdog'), '#default_value' => variable_get('cleaner_empty_watchdog', 0), '#description' => t('There is a standard setting for controlling Watchdog contents. This is more useful for test sites.'), '#attributes' => $inline);
    $cookie = session_get_cookie_params();
    $select = db_select('sessions', 's')->fields('s', array('timestamp'))->condition('timestamp', REQUEST_TIME - $cookie['lifetime'], '<');
    $count = $select->execute()->rowCount();
    $form['cleaner_clean_sessions'] = array('#type' => 'radios', '#options' => $yes_no, '#title' => t('Clean up Sessions table'), '#default_value' => variable_get('cleaner_clean_sessions', 0), '#description' => t('The sessions table can quickly become full with old, abandoned sessions. This will delete all sessions older than @interval (as set by your site administrator). There are currently @count such sessions.', array('@interval' => format_interval($cookie['lifetime']), '@count' => $count)), '#attributes' => $inline);
    $form['cleaner_clean_cssdir'] = array('#type' => 'radios', '#options' => $yes_no, '#title' => t('Clean up CSS files'), '#default_value' => variable_get('cleaner_clean_cssdir', 0), '#description' => t('The CSS directory can become full with stale and outdated cache files.  This will delete all CSS cache files but the latest.'), '#attributes' => $inline);
    $form['cleaner_clean_jsdir'] = array('#type' => 'radios', '#options' => $yes_no, '#title' => t('Clean up JS files'), '#default_value' => variable_get('cleaner_clean_jsdir', 0), '#description' => t('The JS directory can become full with stale and outdated cache files.  This will delete all JS cache files but the latest.'), '#attributes' => $inline);
    // We can only offer OPTIMIZE to MySQL users.
    if (db_driver() == 'mysql') {
        $form['cleaner_optimize_db'] = array('#type' => 'radios', '#options' => $yes_no + array('2' => 'Local only'), '#title' => t('Optimize tables with "overhead" space'), '#default_value' => variable_get('cleaner_optimize_db', 0), '#description' => t('The module will compress (optimize) all database tables with unused space. <strong>NOTE</strong>: During an optimization, the table will locked against any other activity; on a high vloume site, this may be undesirable. "Local only" means do not replicate the optimization (if it is being done).'), '#attributes' => $inline);
    } else {
        // If not MySQL, delete(reset) the variable.
        variable_del('cleaner_optimize_db');
    }
    return array('cleaner' => $form);
}
开发者ID:Net-Escola,项目名称:htdocs,代码行数:32,代码来源:cleaner.api.php


示例4: testUserListing

 /**
  * Tests the listing.
  */
 public function testUserListing()
 {
     $this->drupalGet('admin/people');
     $this->assertResponse(403, 'Anonymous user does not have access to the user admin listing.');
     // Create a bunch of users.
     $accounts = array();
     for ($i = 0; $i < 3; $i++) {
         $account = $this->drupalCreateUser();
         $accounts[$account->label()] = $account;
     }
     // Create a blocked user.
     $account = $this->drupalCreateUser();
     $account->block();
     $account->save();
     $accounts[$account->label()] = $account;
     // Create a user at a certain timestamp.
     $account = $this->drupalCreateUser();
     $account->created = 1363219200;
     $account->save();
     $accounts[$account->label()] = $account;
     $timestamp_user = $account->label();
     $rid_1 = $this->drupalCreateRole(array(), 'custom_role_1', 'custom_role_1');
     $rid_2 = $this->drupalCreateRole(array(), 'custom_role_2', 'custom_role_2');
     $account = $this->drupalCreateUser();
     $account->addRole($rid_1);
     $account->addRole($rid_2);
     $account->save();
     $accounts[$account->label()] = $account;
     $role_account_name = $account->label();
     // Create an admin user and look at the listing.
     $admin_user = $this->drupalCreateUser(array('administer users'));
     $accounts[$admin_user->label()] = $admin_user;
     $accounts['admin'] = entity_load('user', 1);
     $this->drupalLogin($admin_user);
     $this->drupalGet('admin/people');
     $this->assertResponse(200, 'The admin user has access to the user admin listing.');
     $result = $this->xpath('//table[contains(@class, "responsive-enabled")]/tbody/tr');
     $result_accounts = array();
     foreach ($result as $account) {
         $name = (string) $account->td[0]->span;
         $roles = array();
         if (isset($account->td[2]->div->ul)) {
             foreach ($account->td[2]->div->ul->li as $element) {
                 $roles[] = (string) $element;
             }
         }
         $result_accounts[$name] = array('name' => $name, 'status' => (string) $account->td[1], 'roles' => $roles, 'member_for' => (string) $account->td[3]);
     }
     $this->assertFalse(array_diff(array_keys($result_accounts), array_keys($accounts)), 'Ensure all accounts are listed.');
     foreach ($result_accounts as $name => $values) {
         $this->assertEqual($values['status'] == t('active'), $accounts[$name]->status->value, 'Ensure the status is displayed properly.');
     }
     $expected_roles = array('custom_role_1', 'custom_role_2');
     $this->assertEqual($result_accounts[$role_account_name]['roles'], $expected_roles, 'Ensure roles are listed properly.');
     $this->assertEqual($result_accounts[$timestamp_user]['member_for'], format_interval(REQUEST_TIME - $accounts[$timestamp_user]->created->value), 'Ensure the right member time is displayed.');
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:59,代码来源:UserAdminListingTest.php


示例5: adminlte_preprocess_page

/**
 * Implement hook_preprocess_page()
 */
function adminlte_preprocess_page(&$vars, $hook)
{
    global $user;
    global $base_url;
    $vars['front_page'] = $base_url;
    $theme_path = drupal_get_path('theme', 'adminlte');
    // Fontawesome 4.5.0
    drupal_add_css('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css', array('type' => 'external', 'scope' => 'header'));
    // Ionicons 2.0.1
    drupal_add_css('https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css', array('type' => 'external', 'scope' => 'header'));
    // jQuery 2.2.3
    drupal_add_js($theme_path . '/plugins/jQuery/jQuery-2.2.3.min.js', array('type' => 'file', 'scope' => 'footer'));
    // Bootstrap 3.3.5
    drupal_add_js($theme_path . '/bootstrap/js/bootstrap.min.js', array('type' => 'file', 'scope' => 'footer'));
    // jQuery UI
    drupal_add_js('https://code.jquery.com/ui/1.11.4/jquery-ui.min.js', array('type' => 'external', 'scope' => 'footer'));
    // FastClick
    drupal_add_js($theme_path . '/plugins/fastclick/fastclick.min.js', array('type' => 'file', 'scope' => 'footer'));
    // AdminLTE App
    drupal_add_js($theme_path . '/dist/js/app.min.js', array('type' => 'file', 'scope' => 'footer'));
    // Moment
    drupal_add_js('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js', array('type' => 'external', 'scope' => 'footer'));
    // Fullcalendar
    drupal_add_js($theme_path . '/plugins/fullcalendar/fullcalendar.min.js', array('type' => 'file', 'scope' => 'footer'));
    // Additional js for theme.
    drupal_add_js($theme_path . '/assets/js/script.js', array('type' => 'file', 'scope' => 'footer'));
    $vars['logout'] = '/user/logout';
    $vars['profile'] = 'user/' . $user->uid;
    $roles = end($user->roles);
    $vars['role'] = ucfirst($roles);
    reset($user->roles);
    // Check if user is login
    if (user_is_logged_in()) {
        $account = user_load($user->uid);
        $avatar_uri = drupal_get_path('theme', 'adminlte') . '/img/avatar.png';
        $alt = t("@user's picture", array('@user' => format_username($user)));
        // Display profile picture.
        if (!empty($account->picture)) {
            $user_picture = theme('image_style', array('style_name' => 'thumbnail', 'path' => $account->picture->uri, 'alt' => $alt, 'title' => $alt, 'attributes' => array('class' => 'img-circle')));
            $user_picture_m = theme('image_style', array('style_name' => 'thumbnail', 'path' => $account->picture->uri, 'alt' => $alt, 'title' => $alt, 'attributes' => array('class' => 'user-image')));
        } else {
            $user_picture_config = array('style_name' => 'thumbnail', 'path' => $avatar_uri, 'alt' => $alt, 'title' => $alt, 'attributes' => array('class' => 'img-circle'));
            $user_picture_m_config = array('style_name' => 'thumbnail', 'path' => $avatar_uri, 'alt' => $alt, 'title' => $alt, 'attributes' => array('class' => 'user-image'));
            $user_picture = adminlte_image_style($user_picture_config);
            $user_picture_m = adminlte_image_style($user_picture_m_config);
        }
        // Assign profile picture in variables.
        $vars['avatar'] = $user_picture;
        $vars['avatarsm'] = $user_picture_m;
        // Display history of member.
        $vars['history'] = 'Member for ' . format_interval(time() - $user->created);
        // Display username or you can change this to set the fullname of user login.
        $vars['fullname'] = $account->name;
    }
}
开发者ID:umandalroald,项目名称:adminlte,代码行数:58,代码来源:template.php


示例6: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, array &$form_state)
 {
     $config = $this->config('system.cron');
     $form['description'] = array('#markup' => '<p>' . t('Cron takes care of running periodic tasks like checking for updates and indexing content for search.') . '</p>');
     $form['run'] = array('#type' => 'submit', '#value' => t('Run cron'), '#submit' => array(array($this, 'submitCron')));
     $status = '<p>' . t('Last run: %cron-last ago.', array('%cron-last' => format_interval(REQUEST_TIME - $this->state->get('system.cron_last')))) . '</p>';
     $form['status'] = array('#markup' => $status);
     $form['cron_url'] = array('#markup' => '<p>' . t('To run cron from outside the site, go to <a href="!cron">!cron</a>', array('!cron' => url('cron/' . $this->state->get('system.cron_key'), array('absolute' => TRUE)))) . '</p>');
     $form['cron'] = array('#title' => t('Cron settings'), '#type' => 'details', '#open' => TRUE);
     $options = array(3600, 10800, 21600, 43200, 86400, 604800);
     $form['cron']['cron_safe_threshold'] = array('#type' => 'select', '#title' => t('Run cron every'), '#description' => t('More information about setting up scheduled tasks can be found by <a href="@url">reading the cron tutorial on drupal.org</a>.', array('@url' => url('http://drupal.org/cron'))), '#default_value' => $config->get('threshold.autorun'), '#options' => array(0 => t('Never')) + array_map('format_interval', array_combine($options, $options)));
     return parent::buildForm($form, $form_state);
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:16,代码来源:CronForm.php


示例7: testFieldDate

 public function testFieldDate()
 {
     $view = Views::getView('test_view');
     $view->setDisplay();
     $view->displayHandlers->get('default')->overrideOption('fields', array('created' => array('id' => 'created', 'table' => 'views_test_data', 'field' => 'created', 'relationship' => 'none', 'custom_date_format' => 'c')));
     $time = gmmktime(0, 0, 0, 1, 1, 2000);
     $this->executeView($view);
     $timezones = array(NULL, 'UTC', 'America/New_York');
     foreach ($timezones as $timezone) {
         $dates = array('short' => format_date($time, 'short', '', $timezone), 'medium' => format_date($time, 'medium', '', $timezone), 'long' => format_date($time, 'long', '', $timezone), 'custom' => format_date($time, 'custom', 'c', $timezone));
         $this->assertRenderedDatesEqual($view, $dates, $timezone);
     }
     $intervals = array('raw time ago' => format_interval(REQUEST_TIME - $time, 2), 'time ago' => t('%time ago', array('%time' => format_interval(REQUEST_TIME - $time, 2))));
     $this->assertRenderedDatesEqual($view, $intervals);
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:15,代码来源:FieldDateTest.php


示例8: neb_comment_block

function neb_comment_block()
{
    $items = array();
    $number = variable_get('comment_block_count', 10);
    foreach (comment_get_recent($number) as $comment) {
        //kpr($comment->changed);
        //print date('Y-m-d H:i', $comment->changed);
        $items[] = '<h3>' . l($comment->subject, 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid)) . '</h3>' . ' <time datetime="' . date('Y-m-d H:i', $comment->changed) . '">' . t('@time ago', array('@time' => format_interval(REQUEST_TIME - $comment->changed))) . '</time>';
    }
    if ($items) {
        return theme('item_list', array('items' => $items, 'daddy' => 'comments'));
    } else {
        return t('No comments available.');
    }
}
开发者ID:rolfvandekrol,项目名称:neb,代码行数:15,代码来源:misc.php


示例9: skype_history

function skype_history($threshold = 60, $since = "Last Monday")
{
    $calls = SkypeHistory_Call::getCalls();
    $since = strtotime($since);
    $table = new Console_Table();
    $table->setHeaders(array('Date', 'Time', 'Duration', '<>', 'Participants'));
    $types = array('INCOMING_PSTN' => '<-', 'INCOMING_P2P' => '<-', 'OUTGOING_PSTN' => '->', 'OUTGOING_P2P' => '->');
    $previous_date = NULL;
    $total_duration = 0;
    printf("Gathering skype call history, this may take a few seconds.\n");
    foreach ($calls as $i => $id) {
        $call = new SkypeHistory_Call($id);
        // Bail out once the cutoff is reached.
        if ($call->timestamp < $since) {
            break;
        }
        if ($call->duration < $threshold) {
            continue;
        }
        $participants = array();
        $participants[] = $call->PARTNER_DISPNAME;
        if ($call->conf_participants_count > 1) {
            for ($j = 1; $j < (int) $call->conf_participants_count; $j++) {
                $p = $call->getProperty("CONF_PARTICIPANT {$j}");
                // drewstephens0815 OUTGOING_P2P FINISHED Andrew Stephens
                list($nick, $type, $status, $display_name) = explode(" ", $p, 4);
                $participants[] = $display_name;
            }
        }
        $date = date('D M d,Y', (int) $call->timestamp);
        if ($date == $previous_date) {
            $date = '';
        } else {
            if (!empty($previous_date)) {
                $table->addSeparator();
            }
            $previous_date = $date;
        }
        $total_duration += (int) $call->duration;
        $table->addRow(array($date, date('g:ia', (int) $call->timestamp), format_interval($call->duration), $types[$call->type], format_participants($participants)));
        printf("\r%s", str_repeat('.', $i));
    }
    printf("\r");
    print $table->getTable();
    printf("Number of calls: %s\n", count($calls));
    printf("Total duration: %s\n", format_interval($total_duration));
}
开发者ID:soggycat,项目名称:skype-history-php,代码行数:47,代码来源:Main.php


示例10: worksafe_theme_status_time_link

function worksafe_theme_status_time_link($status, $is_link = true)
{
    $time = strtotime($status->created_at);
    if ($time > 0) {
        if (twitter_date('dmy') == twitter_date('dmy', $time)) {
            $out = format_interval(time() - $time, 1) . ' ago';
        } else {
            $out = twitter_date('H:i', $time);
        }
    } else {
        $out = $status->created_at;
    }
    if ($is_link) {
        $out = "<a href='status/{$status->id}'>{$out}</a>";
    }
    return $out;
}
开发者ID:berkes,项目名称:dabr,代码行数:17,代码来源:worksafe.php


示例11: formatInterval

 public function formatInterval($date, $now = null)
 {
     $timestamp = $this->dateToTimestamp($date);
     if (null === $timestamp) {
         return '';
         // I'm really sorry I'm not Mme Irma
     }
     if (null === $now) {
         $referenceTimestamp = time();
     } else {
         $referenceTimestamp = $this->dateToTimestamp($now);
         if (null === $referenceTimestamp) {
             return '';
             // Still not Mme Irma
         }
     }
     return format_interval($referenceTimestamp - $timestamp);
 }
开发者ID:makinacorpus,项目名称:drupal-sf-dic,代码行数:18,代码来源:DrupalDateExtension.php


示例12: rhok_twitter_block_tweets

/**
 * Returns themed html for individual tweets
 */
function rhok_twitter_block_tweets($tweet_object, $variables = array())
{
    $tweet = get_object_vars($tweet_object['tweet']);
    $tweet['text'] = twitter_block_linkify($tweet['text']);
    $tweet['time_ago'] = format_interval(time() - strtotime($tweet['created_at']));
    $html = <<<EOHTML
<div class="twitter_block tweet">
  <div class="tweet_text"><p class="tweet">{$tweet['text']}</p></div> 
  <div class="twitter_block_user">
    <a class="twitter_block profile_image" href="http://twitter.com/{$tweet['from_user']}">
      <span class="twitter_block_user_name">@{$tweet['from_user']}</span>
    </a>
    <span class="twitter_block_time_ago">{$tweet['time_ago']}</span>
  </div>
</div>
EOHTML;
    return $html;
}
开发者ID:RandomHacks,项目名称:rhok_website,代码行数:21,代码来源:template.php


示例13: apigee_base_preprocess_node

/**
 * Preprocess variables for node.tpl.php
 *
 * @see node.tpl.php
 */
function apigee_base_preprocess_node(&$variables)
{
    if ($variables['teaser']) {
        $variables['classes_array'][] = 'row-fluid';
    }
    $author = $variables['name'];
    $time_ago_short = format_interval(time() - $variables['created'], 1) . t(' ago');
    $time_ago_long = format_interval(time() - $variables['created'], 2) . t(' ago');
    // Add some date variables
    if ($variables['type'] = 'blog') {
        if ($variables['uid'] != 0) {
            $variables['posted'] = 'Posted by ' . $author . '&nbsp;|&nbsp;about&nbsp;' . $time_ago_short;
        } else {
            $variables['posted'] = 'Posted ' . $time_ago_short;
        }
        $variables['submitted_day'] = format_date($variables['node']->created, 'custom', 'j');
        $variables['submitted_month'] = format_date($variables['node']->created, 'custom', 'M');
    }
    if ($variables['type'] == 'forum') {
        $variables['submitted'] = 'Topic created by: ' . $author . '&nbsp;&nbsp;' . $time_ago_long;
    }
}
开发者ID:nevetS,项目名称:flame,代码行数:27,代码来源:template.php


示例14: nesi_bootstrap_menu_tree__user_menu

function nesi_bootstrap_menu_tree__user_menu($variables)
{
    global $base_url;
    global $user;
    $user_data = user_load($user->uid);
    $profile_data = profile2_load_by_user($user_data->uid);
    $admin_links = '';
    if (user_access('nesi website config')) {
        $admin_links .= '<li><a href="' . $base_url . '/nesi-config">Administration Dashboard</a></li>';
    }
    $output = '';
    $output .= '<ul id="nesi-user-profile-dropdown" class="dropdown-menu pull-right">';
    $output .= '<li id="nesi-user-picture"><div class="nesi-user-picture"><div class="pull-left">' . theme('user_picture', array('account' => $user)) . '</div>
              <h2>' . format_username($user_data) . '</h2>
              <h3>Institution</h3>
              <p>' . $profile_data['researcher_profile']->field_user_institution[LANGUAGE_NONE][0]['value'] . '</p>
              <p><em>Member for ' . format_interval(REQUEST_TIME - $user_data->created) . '</em></p>
              </div></li>';
    $output .= $admin_links;
    $output .= $variables['tree'];
    $output .= '<li id="nesi-base-actions"><ul class="nav nav-pills nesi-base-actions"><li class="pull-left"><a href="' . $base_url . '/user">Profile</a></li><li class="pull-right"><a href="/user/logout">Log out</a></li></ul></li>';
    $output .= '</ul>';
    return $output;
}
开发者ID:nesi,项目名称:nesi-webportal,代码行数:24,代码来源:template.php


示例15: formatLabel

 /**
  * Label for schedule.
  */
 public function formatLabel($job)
 {
     $settings = $job->getSettings($this->type);
     return t('Every @interval', array('@interval' => format_interval($this->presets[$settings['rules'][0]])));
 }
开发者ID:creazy412,项目名称:vmware-win10-c65-drupal7,代码行数:8,代码来源:simple.class.php


示例16: getStatsSummary

 /**
  * Get summary information about the Solr Core.
  */
 public function getStatsSummary()
 {
     $stats = $this->getStats();
     $summary = array('@pending_docs' => '', '@autocommit_time_seconds' => '', '@autocommit_time' => '', '@deletes_by_id' => '', '@deletes_by_query' => '', '@deletes_total' => '');
     if (!empty($stats)) {
         $docs_pending_xpath = $stats->xpath('//stat[@name="docsPending"]');
         $summary['@pending_docs'] = (int) trim($docs_pending_xpath[0]);
         $max_time_xpath = $stats->xpath('//stat[@name="autocommit maxTime"]');
         $max_time = (int) trim(current($max_time_xpath));
         // Convert to seconds.
         $summary['@autocommit_time_seconds'] = $max_time / 1000;
         $summary['@autocommit_time'] = format_interval($max_time / 1000);
         $deletes_id_xpath = $stats->xpath('//stat[@name="deletesById"]');
         $summary['@deletes_by_id'] = (int) trim($deletes_id_xpath[0]);
         $deletes_query_xpath = $stats->xpath('//stat[@name="deletesByQuery"]');
         $summary['@deletes_by_query'] = (int) trim($deletes_query_xpath[0]);
         $summary['@deletes_total'] = $summary['@deletes_by_id'] + $summary['@deletes_by_query'];
     }
     return $summary;
 }
开发者ID:rtanglao,项目名称:ad6-svn,代码行数:23,代码来源:Drupal_Apache_Solr_Service.php


示例17: t

</div>
  </div>
  
  <div class="author-data">
    <?php 
print $picture;
?>
	  <?php 
if (!$account->created == 0) {
    ?>
      <div class="user-member"><?php 
    print t('<strong>Member since:</strong><br /> !date', array('!date' => format_date($account->created, 'custom', 'j F Y')));
    ?>
</div>  
      <div class="user-access"><?php 
    print t('<strong>Last activity:</strong><br /> !ago', array('!ago' => format_interval(time() - $account->access)));
    ?>
</div>  
    <?php 
}
?>
  </div>

  <div class="comment-main">
    <?php 
if ($comment->new) {
    ?>
      <span class="new"><?php 
    print $new;
    ?>
</span>
开发者ID:redbtn,项目名称:wcc,代码行数:31,代码来源:comment.tpl.php


示例18: commons_beehive_process_node

/**
 * Implements hook_process_node().
 */
function commons_beehive_process_node(&$variables, $hook)
{
    $node = $variables['node'];
    $wrapper = entity_metadata_wrapper('node', $node);
    // Use timeago module for formatting node submission date
    // if it is enabled and also configured to be used on nodes.
    if (module_exists('timeago') && variable_get('timeago_node', 1)) {
        $variables['date'] = timeago_format_date($node->created, $variables['date']);
        $use_timeago_date_format = TRUE;
    } else {
        $use_timeago_date_format = FALSE;
    }
    // Replace the submitted text on nodes with something a bit more pertinent to
    // the content type.
    if (variable_get('node_submitted_' . $node->type, TRUE)) {
        $node_type_info = node_type_get_type($variables['node']);
        $type_attributes = array('class' => array('node-content-type', drupal_html_class('node-content-type-' . $node->type)));
        $placeholders = array('!type' => '<span' . drupal_attributes($type_attributes) . '>' . check_plain($node_type_info->name) . '</span>', '!user' => $variables['name'], '!date' => $variables['date'], '@interval' => format_interval(REQUEST_TIME - $node->created));
        // Show what group the content belongs to if applicable.
        if (!empty($node->{OG_AUDIENCE_FIELD}) && $wrapper->{OG_AUDIENCE_FIELD}->count() == 1) {
            $placeholders['!group'] = l($wrapper->{OG_AUDIENCE_FIELD}->get(0)->label(), 'node/' . $wrapper->{OG_AUDIENCE_FIELD}->get(0)->getIdentifier());
            if ($use_timeago_date_format == TRUE) {
                $variables['submitted'] = t('!type created !date in the !group group by !user', $placeholders);
            } else {
                $variables['submitted'] = t('!type created @interval ago in the !group group by !user', $placeholders);
            }
        } else {
            if ($use_timeago_date_format == TRUE) {
                $variables['submitted'] = t('!type created !date by !user', $placeholders);
            } else {
                $variables['submitted'] = t('!type created @interval ago by !user', $placeholders);
            }
        }
    }
    // Append a feature label to featured node teasers.
    if ($variables['teaser'] && $variables['promote']) {
        $variables['submitted'] .= ' <span class="featured-node-tooltip">' . t('Featured') . ' ' . $variables['type'] . '</span>';
    }
}
开发者ID:jayelless,项目名称:beehive,代码行数:42,代码来源:template.php


示例19: ajax_save_form

 /**
  * AJAX entry point to create the controller form for an IPE.
  */
 function ajax_save_form($break = NULL)
 {
     ctools_include('form');
     if (!empty($this->cache->locked)) {
         if ($break != 'break') {
             $account = user_load($this->cache->locked->uid);
             $name = theme('username', $account);
             $lock_age = format_interval(time() - $this->cache->locked->updated);
             $message = t("This panel is being edited by user !user, and is therefore locked from editing by others. This lock is !age old.\n\nClick OK to break this lock and discard any changes made by !user.", array('!user' => $name, '!age' => $lock_age));
             $this->commands[] = array('command' => 'unlockIPE', 'message' => $message, 'break_path' => url($this->get_url('save-form', 'break')));
             return;
         }
         // Break the lock.
         panels_edit_cache_break_lock($this->cache);
     }
     $form_state = array('display' => &$this->display, 'content_types' => $this->cache->content_types, 'rerender' => FALSE, 'no_redirect' => TRUE, 'layout' => $this->plugins['layout']);
     $output = ctools_build_form('panels_ipe_edit_control_form', $form_state);
     if ($output) {
         // At this point, we want to save the cache to ensure that we have a lock.
         panels_edit_cache_set($this->cache);
         $this->commands[] = array('command' => 'initIPE', 'key' => $this->clean_key, 'data' => $output);
         return;
     }
     // no output == submit
     if (!empty($form_state['clicked_button']['#save-display'])) {
         // Saved. Save the cache.
         panels_edit_cache_save($this->cache);
     } else {
         // Cancelled. Clear the cache.
         panels_edit_cache_clear($this->cache);
     }
     $this->commands[] = array('command' => 'endIPE', 'key' => $this->clean_key, 'data' => $output);
 }
开发者ID:CalvinZhu,项目名称:boinc,代码行数:36,代码来源:panels_renderer_ipe.class.php


示例20: foreach

foreach ($items as $item) {
    ?>
  <li class="item">
    <span class="facebook-note-picture"><img alt="<?php 
    echo $feedid;
    ?>
" src="//graph.facebook.com/<?php 
    echo $feedid;
    ?>
/picture" /></span>
    <span class="facebook-note-title"><a rel="external" href="<?php 
    echo $item->link['href'];
    ?>
"><?php 
    echo $item->title;
    ?>
</a></span>
    <span class="facebook-note-message"><?php 
    echo $item->summary;
    ?>
</span>
    <span class="facebook-note-time"><?php 
    echo t('!time ago.', array('!time' => format_interval(time() - strtotime($item->published))));
    ?>
</span>
  </li>
<?php 
}
?>
</ul>
开发者ID:lcrojanouninorte,项目名称:gie_portal,代码行数:30,代码来源:facebook_pull-notes.tpl.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP format_js函数代码示例发布时间:2022-05-15
下一篇:
PHP format_html函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap