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


PHP timestamp函数代码示例

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


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

示例1: formatUser

 public function formatUser(&$user)
 {
     switch ($user->rank) {
         case 'U':
         default:
             $class = 'info';
             $rank = 'User';
             break;
         case 'M':
             $class = 'success';
             $rank = 'Moderator';
             break;
         case 'A':
             $class = 'danger';
             $rank = 'Admin';
             break;
     }
     $user->userlabel = "<a class='label label-{$class}' href='?action=";
     $user->userlabel .= "viewUser&user={$user->uid}'>{$user->username}</a>";
     $user->rankname = $rank;
     $user->createdlabel = timestamp($user->created);
     if ($user->status) {
         $user->statuslink = "<span class='label label-success'>Active</span> <a class='btn btn-xs btn-danger' href='?action=deactivateUser&user={$user->uid}'><i class='fa fa-times'></i></a>";
     } else {
         $user->statuslink = "<span class='label label-danger'>Inactive</span> <a class='btn btn-xs btn-success' href='?action=activateUser&user={$user->uid}'><i class='fa fa-check'></i></a>";
     }
     return $user;
 }
开发者ID:nfreader,项目名称:baseline,代码行数:28,代码来源:user.php

示例2: responsive_logo

/**
 * html Pour pouvoir masquer les logos sans les downloader en petit ecran
 * il faut le mettre dans un conteneur parent que l'on masque
 * http://timkadlec.com/2012/04/media-query-asset-downloading-results/
 *
 * On utilise un double conteneur :
 * le premier fixe la largeur, le second la hauteur par le ratio hauteur/largeur
 * grace a la technique des intrinsic-ratio ou padding-bottom-hack
 * http://mobile.smashingmagazine.com/2013/09/16/responsive-images-performance-problem-case-study/
 * http://alistapart.com/article/creating-intrinsic-ratios-for-video
 *
 * Le span interieur porte l'image en background CSS
 * Le span conteneur ne porte pas de style display car trop prioritaire.
 * Sans CSS il occupe la largeur complete disponible, car en inline par defaut
 * Il suffit de lui mettre un float:xxx ou un display:block pour qu'il respecte la largeur initiale du logo
 *
 * Pour masquer les logos :
 * .spip_logos {display:none}
 * Pour forcer une taille maxi :
 * .spip_logos {max-width:25%;float:right}
 *
 * @param $logo
 *
 * @return string
 */
function responsive_logo($logo)
{
    if (!function_exists('extraire_balise')) {
        include_spip('inc/filtres');
    }
    if (!$logo or !($img = extraire_balise($logo, "img"))) {
        return $logo;
    }
    list($h, $w) = taille_image($img);
    $src = extraire_attribut($img, "src");
    $class = extraire_attribut($img, "class");
    // timestamper l'url si pas deja fait
    if (strpos($src, "?") == false) {
        $src = timestamp($src);
    }
    if (defined('_STATIC_IMAGES_DOMAIN')) {
        $src = url_absolue($src, _STATIC_IMAGES_DOMAIN);
    }
    $hover = "";
    if ($hover_on = extraire_attribut($img, "onmouseover")) {
        $hover_off = extraire_attribut($img, "onmouseout");
        $hover_on = str_replace("this.src=", "jQuery(this).css('background-image','url('+", $hover_on) . "+')')";
        $hover_off = str_replace("this.src=", "jQuery(this).css('background-image','url('+", $hover_off) . "+')')";
        $hover = " onmouseover=\"{$hover_on}\" onmouseout=\"{$hover_off}\"";
    }
    $ratio = round($h * 100 / $w, 2);
    return "<span class='{$class}' style=\"width:{$w}px;\"><span class=\"img\" style=\"display:block;position:relative;height:0;width:100%;padding-bottom:{$ratio}%;overflow:hidden;background:url({$src}) no-repeat center;background-size:100%;\"{$hover}> </span></span>";
}
开发者ID:RadioCanut,项目名称:site-radiocanut,代码行数:53,代码来源:zcore_options.php

示例3: compresseur_ecrire_balise_css_dist

/**
 * Ecrire la balise CSS pour insérer le fichier compressé
 *
 * C'est cette fonction qui décide ou il est le plus pertinent
 * d'insérer le fichier, et dans quelle forme d'écriture
 *
 * @param string $flux
 *   Contenu du head nettoyé des fichiers qui ont ete compressé
 * @param int $pos
 *   Position initiale du premier fichier inclu dans le fichier compressé
 * @param string $src
 *   Nom du fichier compressé
 * @param string $comments
 *   Commentaires à insérer devant
 * @param string $media
 *   Type de media si précisé (print|screen...)
 * @return string
 *   Code HTML de la balise <link>
 */
function compresseur_ecrire_balise_css_dist(&$flux, $pos, $src, $comments = "", $media = "")
{
    $src = timestamp($src);
    $comments .= "<link rel='stylesheet'" . ($media ? " media='{$media}'" : "") . " href='{$src}' type='text/css' />";
    // Envoyer aussi un entete http pour demarer le chargement de la CSS plus tot
    // Link: <http://href.here/to/resource.html>;rel="stylesheet prefetch"
    $comments .= "<" . "?php header('Link: <' . url_de_base() . (_DIR_RACINE ? _DIR_RESTREINT_ABS : '') . '{$src}>;rel=\"stylesheet prefetch\"'); ?>";
    $flux = substr_replace($flux, $comments, $pos, 0);
    return $flux;
}
开发者ID:RadioCanut,项目名称:site-radiocanut,代码行数:29,代码来源:compresseur.php

示例4: insertUser

 function insertUser()
 {
     $data = array('username' => $this->input->post('username'), 'picURL' => $this->getUserPicURL($this->input->post('username')), 'active' => 1, 'admin' => 0, 'dateadded' => timestamp());
     $this->db->insert('actorRules', $data);
     if ($this->db->affected_rows() >= 1) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:electromute,项目名称:gnip-tweetgroups,代码行数:10,代码来源:actorrules_model.php

示例5: install

    public static function install(&$package, $params = array())
    {
        // Set the files directory
        $directory = dirname(__FILE__) . '/files';
        // Add the files to the package
        $package->addDir($directory, '', array('ruckusing'));
        // /ruckusing/db/migrate/users
        $package->addFile($directory . '/ruckusing/db/migrate/create_users.php', 'ruckusing/db/migrate/' . timestamp() . '_CreateUsers.php');
        // /ruckusing/db/migrate/add_admin_to_users
        $package->addFile($directory . '/ruckusing/db/migrate/add_admin_to_users.php', 'ruckusing/db/migrate/' . timestamp() . '_AddAdminToUsers.php');
        // /ruckusing/db/migrate/auth_codes
        $package->addFile($directory . '/ruckusing/db/migrate/create_auth_codes.php', 'ruckusing/db/migrate/' . timestamp() . '_CreateAuthCodes.php');
        // /ruckusing/db/migrate/roles
        $package->addFile($directory . '/ruckusing/db/migrate/create_roles.php', 'ruckusing/db/migrate/' . timestamp() . '_CreateRoles.php');
        // Add links to AdminHelper::admin_nav()
        $links[] = <<<EOF
      
  'Manage Users' => array(
    'path' => 'users',
    'auth' => 'admin'
    )
EOF;
        $links[] = <<<EOF
      
  'Manage Auth Codes' => array(
    'path' => 'auth_codes',
    'auth' => 'su'
    )
EOF;
        $links[] = <<<EOF
      
  'Manage Roles' => array(
    'path' => 'roles',
    'auth' => 'admin'
    )
EOF;
        foreach ($links as $link_string) {
            $package->replace('inc/admin/config.php', '/(\\$admin_links = array\\()((?:.+)?)(\\);)/se', "'\\1'.self::global_array_builder('\\2', \"{$link_string}\").'\\3'");
        }
        // Add UserSession initializer
        $user_session_include = <<<EOF

// ===============
// = UserSession =
// ===============
\$session = new UserSession;  
EOF;
        $package->appendPHP('inc/config.php', $user_session_include);
        // Add to inc/helpers.php
        if (!$package->locateName('inc/helpers.php')) {
            $package->addFromString('inc/helpers.php', "<?php\n\n?>");
        }
        $package->appendPHP('inc/helpers.php', "include ROOT.'/inc/helpers/user_management.php';\n");
    }
开发者ID:TheOddLinguist,项目名称:toolbox,代码行数:54,代码来源:install.php

示例6: addTweets

 function addTweets($xml)
 {
     $xml_element = new SimpleXMLElement($xml);
     //prep data for db
     //note that for normal applications, full data for twitter is not available
     //therefore, the URL must be polled to get the full data.
     foreach ($xml_element as $key) {
         $data = array('username' => strval($key->actor), 'tweet' => strval($key->payload->body), 'URL' => strval($key->destinationURL), 'time' => strval($key->at), 'client' => strval($key->source), 'replyto' => strval($key->regardingURL), 'timeadded' => timestamp());
         $status = $this->Gnipdata_model->addTweet($data);
         log_message('debug', 'Added tweet by ' . strval($key->actor) . ' at ' . strval($key->at));
     }
 }
开发者ID:electromute,项目名称:gnip-tweetgroups,代码行数:12,代码来源:home.php

示例7: f_jQuery

/**
 * Inserer jQuery et ses plugins
 *
 * La fonction ajoute les balises scripts dans le texte qui appelent
 * les scripts jQuery ainsi que certains de ses plugins. La liste
 * des js chargée peut être complété par le pipeline 'jquery_plugins'
 *
 * Cette fonction est appelée par le pipeline insert_head
 *
 * @internal
 *     Ne pas vérifier ici qu'on ne doublonne pas `#INSERT_HEAD`
 *     car cela empêche un double appel (multi calcul en cache cool,
 *     ou erreur de l'espace privé)
 *
 * @see f_jQuery_prive()
 * @pipeline insert_head
 * @pipeline_appel jquery_plugins
 *
 * @param string $texte Contenu qui sera inséré dans le head HTML
 * @return string          Contenu qui sera inséré dans le head HTML
 **/
function f_jQuery($texte)
{
    $x = '';
    $jquery_plugins = pipeline('jquery_plugins', array('javascript/jquery.js', 'javascript/jquery.form.js', 'javascript/jquery.autosave.js', 'javascript/jquery.placeholder-label.js', 'javascript/ajaxCallback.js', 'javascript/jquery.cookie.js'));
    foreach (array_unique($jquery_plugins) as $script) {
        if ($script = find_in_path($script)) {
            $script = timestamp($script);
            $x .= "\n<script src=\"{$script}\" type=\"text/javascript\"></script>\n";
        }
    }
    $texte = $x . $texte;
    return $texte;
}
开发者ID:RadioCanut,项目名称:site-radiocanut,代码行数:34,代码来源:pipelines.php

示例8: install

    public static function install(&$package, $params = array())
    {
        // Set the files directory
        $directory = dirname(__FILE__) . '/files';
        // Add the files to the package
        $package->addDir($directory, '', array('ruckusing'));
        // /ruckusing/db/migrate/cms_blocks
        $package->addFile($directory . '/ruckusing/db/migrate/create_cms_blocks.php', 'ruckusing/db/migrate/' . timestamp() . '_CreateCMSBlocks.php');
        // /ruckusing/db/migrate/cms_categories
        $package->addFile($directory . '/ruckusing/db/migrate/create_cms_categories.php', 'ruckusing/db/migrate/' . timestamp() . '_CreateCMSCategories.php');
        // /ruckusing/db/migrate/cms_files
        $package->addFile($directory . '/ruckusing/db/migrate/create_cms_files.php', 'ruckusing/db/migrate/' . timestamp() . '_CreateCMSFiles.php');
        // /ruckusing/db/migrate/add_su_to_users
        $package->addFile($directory . '/ruckusing/db/migrate/add_su_to_users.php', 'ruckusing/db/migrate/' . timestamp() . '_AddSuToUsers.php');
        // Add links to AdminHelper::admin_nav()
        $links[] = <<<EOF
      
  'Edit Blocks' => array(
    'path' => 'cms',
    'auth' => 'admin'
    )
EOF;
        $links[] = <<<EOF
      
  'Manage Files' => array(
    'path' => 'cms_files',
    'auth' => 'admin'
    )
EOF;
        $links[] = <<<EOF
      
  'Manage Blocks' => array(
    'path' => 'blocks',
    'auth' => 'su'
    )
EOF;
        foreach ($links as $link_string) {
            $package->replace('inc/admin/config.php', '/(\\$admin_links = array\\()((?:.+)?)(\\);)/se', "'\\1'.self::global_array_builder('\\2', \"{$link_string}\").'\\3'");
        }
        // Add to inc/helpers.php
        if (!$package->locateName('inc/helpers.php')) {
            $package->addFromString('inc/helpers.php', "<?php\n\n?>");
        }
        $package->appendPHP('inc/helpers.php', "include ROOT.'/inc/helpers/basic_cms.php';\n");
    }
开发者ID:TheOddLinguist,项目名称:toolbox,代码行数:45,代码来源:install.php

示例9: f_jQuery_prive

/**
 * Inserer jQuery et ses plugins pour l'espace privé
 *
 * La fonction ajoute les balises scripts dans le texte qui appelent
 * les scripts jQuery ainsi que certains de ses plugins. La liste
 * des js chargée peut être complété par le pipeline 'jquery_plugins'
 *
 * Cette fonction est appelée par le pipeline header_prive
 *
 * @see f_jQuery()
 * @link http://code.spip.net/@f_jQuery
 * 
 * @param string $texte    Contenu qui sera inséré dans le head HTML
 * @return string          Contenu complété des scripts javascripts, dont jQuery
**/
function f_jQuery_prive($texte)
{
    $x = '';
    $jquery_plugins = pipeline('jquery_plugins', array('prive/javascript/jquery.js', 'prive/javascript/jquery.form.js', 'prive/javascript/jquery.autosave.js', 'prive/javascript/jquery.placeholder-label.js', 'prive/javascript/ajaxCallback.js', 'prive/javascript/jquery.cookie.js', 'prive/javascript/spip_barre.js'));
    foreach (array_unique($jquery_plugins) as $script) {
        if ($script = find_in_path($script)) {
            $script = timestamp($script);
            $x .= "\n<script src=\"{$script}\" type=\"text/javascript\"></script>\n";
        }
    }
    // inserer avant le premier script externe ou a la fin
    if (preg_match(",<script[^><]*src=,", $texte, $match) and $p = strpos($texte, $match[0])) {
        $texte = substr_replace($texte, $x, $p, 0);
    } else {
        $texte .= $x;
    }
    return $texte;
}
开发者ID:JLuc,项目名称:SPIP,代码行数:33,代码来源:pipelines_ecrire.php

示例10: parseTicket

 public function parseTicket(&$ticket)
 {
     $ticket->scanned = $ticket->scanned + 0;
     if ('0000-00-00 00:00:00' === $ticket->scanned_at) {
         $ticket->scanned_at = FALSE;
     } else {
         $ticket->scanned_at = timestamp($ticket->scanned_at);
     }
     $ticket->fullStatus = "Not scanned";
     if ($ticket->scanned) {
         $ticket->fullStatus = "Scanned";
     }
     $ticket->scanlink = "<a href='scan.php?user=manualOverride&barcode={$ticket->barcode}&format=html' class='btn btn-success btn-xs'>";
     $ticket->scanlink .= "Manual Check In</a>";
     $ticket->ticketLink = "<span class='glyphicon glyphicon-barcode'></span> ";
     $ticket->ticketLink .= "<a href='viewTicket.php?barcode={$ticket->barcode}'>";
     $ticket->ticketLink .= "<code>{$ticket->barcode}</code></a>";
     return $ticket;
 }
开发者ID:Flashpoint-Artists-Initiative,项目名称:scanner,代码行数:19,代码来源:ticket.php

示例11: update_acordes

function update_acordes($data = array())
{
    global $db, $usuario;
    $timestamp = timestamp();
    $id = $data[id] ? $data[id] : false;
    unset($data[id]);
    foreach ($data as $campo => $valor) {
        $campos[] = $campo . "='" . $valor . "'";
    }
    $campos[] = "id_usuario = '{$usuario['id_usuario']}'";
    $campos[] = "timestamp \t= '{$timestamp}'";
    $updateFields = implode(',', $campos);
    if ($id && $updateFields) {
        $sql = "UPDATE {$db['tbl_acordes']}\n\t\t\t\tSET  {$updateFields}\n\t\t\t\tWHERE id_acorde='{$id}'\n\t\t\t\tLIMIT 1;";
        $resultado = SQLDo($sql) ? true : false;
        return $resultado;
    } else {
        return false;
    }
}
开发者ID:Oscarmal,项目名称:o3m.director,代码行数:20,代码来源:dao.catalogos.php

示例12: updateAdminStatus

 function updateAdminStatus($username, $statusvalue)
 {
     $data = array('admin' => $statusvalue, 'lastupdated' => timestamp());
     $this->db->where('username', $username);
     $this->db->update('actorRules', $data);
     if ($statusvalue == 1) {
         $verificationcode = md5(md5($username) . md5(timestamp()));
         $this->db->select('username');
         $query = $this->db->get_where('admin', array('username' => $username));
         if (!$query->result()) {
             $data = array('username' => $username, 'activationcode' => $verificationcode);
             $this->db->insert('admin', $data);
         }
         return $verificationcode;
     } else {
         // delete user from admin as well
         $this->db->where('username', $username);
         $this->db->delete('admin');
     }
 }
开发者ID:electromute,项目名称:gnip-tweetgroups,代码行数:20,代码来源:users_model.php

示例13: read

 protected function read($params = array())
 {
     // the core of the data is the user object
     $auth = !empty($_SESSION['user']);
     // filter session (fixed fields for now...)
     if ($auth) {
         $this->data['user'] = $this->filter($_SESSION['user']);
         // loop through the token data
         if (!empty($_SESSION['oauth'])) {
             $this->data['oauth'] = array();
             foreach ($_SESSION['oauth'] as $service => $creds) {
                 // save in an array if more than one...
                 $this->data["oauth"][$service] = $this->filter($creds);
             }
         }
     }
     // set the auth flag
     $this->data['auth'] = $auth;
     // set updated attribute (for the client)
     $this->data['updated'] = timestamp();
 }
开发者ID:makesites,项目名称:kisscms,代码行数:21,代码来源:session.php

示例14: sql

function sql($query, $mysql_data = null)
{
    global $mysql_default;
    if (!$mysql_data) {
        $mysql_data = $mysql_default;
    }
    if ($mysql_data['debug'] & 1) {
        print "<!-- SQL-Query: {$query} -->\n";
    }
    if ($mysql_data['debug'] & 2) {
        global $path_config;
        global $current_user;
        file_put_contents("{$path_config}/.debug.log", timestamp() . "\t" . $current_user->id . ":\n" . $query . "\n", FILE_APPEND | LOCK_EX);
    }
    if (!($res = $mysql_data['linkid']->query($query))) {
        global $path_config;
        global $current_user;
        file_put_contents("{$path_config}/.debug.log", timestamp() . "\t" . $current_user->id . ":\n" . "ERROR executing query \"{$query}\"\n" . print_r($mysql_data['linkid']->errorInfo(), 1) . "\n", FILE_APPEND | LOCK_EX);
        print "<pre>" . print_r($mysql_data['linkid']->errorInfo(), 1) . "</pre>";
        exit;
    }
    return $res;
}
开发者ID:plepe,项目名称:modulekit-lib,代码行数:23,代码来源:code.php

示例15: getDifferenceOfTimes

function getDifferenceOfTimes($timeA, $timeB)
{
    if (preg_match('/\\d{4}-\\d{1,2}-\\d{1,2}\\s\\d{1,2}:\\d{1,2}:\\d{1,2}/u', $timeA)) {
        $timeA = strtotime($timeA);
    }
    if (preg_match('/\\d{4}-\\d{1,2}-\\d{1,2}\\s\\d{1,2}:\\d{1,2}:\\d{1,2}/u', $timeB)) {
        $timeB = strtotime($timeB);
    }
    $d = $timeA - $timeB;
    return timestamp($d, true);
}
开发者ID:piiskop,项目名称:pstk,代码行数:11,代码来源:timestamp.php


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