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

PHP timestamp函数代码示例

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

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



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


示例16: is_midnight

 function is_midnight($date)
 {
     $ts = timestamp($date);
     return date('H:i:s', $ts) == '00:00:00';
 }
开发者ID:huayuxian,项目名称:FUEL-CMS,代码行数:5,代码来源:MY_date_helper.php


示例17: image_graver

/**
 * Clôture une série de filtres d'images
 *
 * Ce filtre est automatiquement appelé à la fin d'une série de filtres
 * d'images dans un squelette.
 *
 * @filtre
 * @uses reconstruire_image_intermediaire()
 *     Si l'image finale a déjà été supprimée car considérée comme temporaire
 *     par une autre série de filtres images débutant pareil
 * @uses ramasse_miettes()
 *     Pour déclarer l'image définitive et nettoyer les images intermédiaires.
 *
 * @pipeline_appel post_image_filtrer
 *
 * @param string $img
 *     Code HTML de l'image
 * @return string
 *     Code HTML de l'image
 **/
function image_graver($img)
{
    // appeler le filtre post_image_filtrer qui permet de faire
    // des traitements auto a la fin d'une serie de filtres
    $img = pipeline('post_image_filtrer', $img);
    $fichier_ori = $fichier = extraire_attribut($img, 'src');
    if (($p = strpos($fichier, '?')) !== false) {
        $fichier = substr($fichier, 0, $p);
    }
    if (strlen($fichier) < 1) {
        $fichier = $img;
    }
    # si jamais le fichier final n'a pas ete calcule car suppose temporaire
    if (!@file_exists($fichier)) {
        reconstruire_image_intermediaire($fichier);
    }
    ramasse_miettes($fichier);
    // ajouter le timestamp si besoin
    if (strpos($fichier_ori, "?") === false) {
        // on utilise str_replace pour attraper le onmouseover des logo si besoin
        $img = str_replace($fichier_ori, timestamp($fichier_ori), $img);
    }
    return $img;
}
开发者ID:xablen,项目名称:Semaine14_SPIP_test,代码行数:44,代码来源:filtres_images_lib_mini.php


示例18: class_totals

$start_dateSQL = 'SUBDATE(NOW(), INTERVAL 1 DAY)';
$server = 'https://' . $cfg_web_host . '/';
$class_totals = new class_totals();
// Process the papers in range checking the totals.
$class_totals->process_papers($mysqli, $cfg_cron_user, $cfg_cron_passwd, $rootpath, $userid, $start_dateSQL, $end_dateSQL, $server);
// Get any failures.
$status = 'failure';
$testresult = $mysqli->prepare("SELECT user_id, paper_id, errors FROM class_totals_test_local WHERE status = ? and user_id = {$userid}");
$testresult->bind_param('s', $status);
$testresult->execute();
$testresult->bind_result($user_id, $paper_id, $errors);
// Log and email errors to support.
$message = '';
while ($testresult->fetch()) {
    $errors = strip_tags($errors);
    $message .= 'Failure: user - ' . $user_id . ', paper - ' . $paper_id . ', error - ' . $errors . "\n";
}
$testresult->close();
$headers = "From: {$support_email}\n";
$headers .= "MIME-Version: 1.0\nContent-type: text/plain; charset=UTF-8\n";
$subject = 'Rogo Summative Exam check';
if ($message != '') {
    echo $message;
    $sent = mail($support_email, $subject, $message, $headers);
    if ($sent) {
        echo "Email sent to {$support_email}";
    }
}
$mysqli->close();
echo "\n" . timestamp() . ": Finishing class totals check.\n";
开发者ID:vinod-co,项目名称:centa,代码行数:30,代码来源:class_totals_with_script_cli.php


示例19: getAllStatus


//.........这里部分代码省略.........
    }
    //Security - must enable this
    if (defined('SECURITY_ENABLE')) {
        foreach ($result["result"] as $i2 => $v2) {
            $security_idx = $v2["idx"];
            if ($security_idx == SECURITY_ID) {
                $securityStatus = $v2["Status"];
                $ajax["security"]["Normal"]["Name"] = "Normal";
                $ajax["security"]["Normal"]["Status"] = "disabled";
                $ajax["security"]["ArmAway"]["Name"] = "Arm Away";
                $ajax["security"]["ArmAway"]["Status"] = "disabled";
                $ajax["security"]["ArmHome"]["Name"] = "Arm Home";
                $ajax["security"]["ArmHome"]["Status"] = "disabled";
                if ($securityStatus == "Normal") {
                    $ajax["security"]["Normal"]["Status"] = "enabled";
                } elseif ($securityStatus == "Arm Away") {
                    $ajax["security"]["ArmAway"]["Status"] = "enabled";
                } elseif ($securityStatus == "Arm Home") {
                    $ajax["security"]["ArmHome"]["Status"] = "enabled";
                }
            }
        }
    }
    //Lights
    foreach ($result["result"] as $i2 => $v2) {
        $statusType = $v2["Type"];
        $statusHardware = $v2["HardwareName"];
        $statusName = $v2["Name"];
        if (($statusType == "Lighting 1" or $statusType == "Lighting 2" or $statusType == "Light/Switch") and strpos($statusName, "Aux") == false and strpos($statusName, "Bath") == false and strpos($statusName, "Fan") == false and $statusHardware == "Z-Wave") {
            if (strpos($v2["Status"], "Set") !== false) {
                $ajax["lights"][$v2["idx"]]["Status"] = "Transition";
            } else {
                $ajax["lights"][$v2["idx"]]["Status"] = $v2["Status"];
            }
            if ($v2["Status"] == "Off") {
                $ajax["lights"][$v2["idx"]]["Level"] = "0";
            } else {
                $ajax["lights"][$v2["idx"]]["Level"] = $v2["Level"];
            }
            $ajax["lights"][$v2["idx"]]["Type"] = $v2["Type"];
            $ajax["lights"][$v2["idx"]]["Name"] = $v2["Name"];
        }
    }
    $md5Lights = md5(print_r($ajax["lights"], true));
    //Fans
    foreach ($result["result"] as $i2 => $v2) {
        $statusType = $v2["Type"];
        $statusHardware = $v2["HardwareName"];
        $statusName = $v2["Name"];
        if (strpos($statusName, "Fan") == true and strpos($statusName, "Bath") == false and $statusHardware == "Z-Wave") {
            if (strpos($v2["Status"], "Set") !== false) {
                $ajax["fans"][$v2["idx"]]["Status"] = "Transition";
            } else {
                $ajax["fans"][$v2["idx"]]["Status"] = $v2["Status"];
            }
            $ajax["fans"][$v2["idx"]]["Level"] = $v2["Level"];
            $ajax["fans"][$v2["idx"]]["Type"] = $v2["Type"];
            $ajax["fans"][$v2["idx"]]["Name"] = $v2["Name"];
        }
    }
    $curlScene = curl_init(DOMOTICZ_JSON_URL . "?type=scenes");
    curl_setopt($curlScene, CURLOPT_RETURNTRANSFER, 1);
    $sceneResult = json_decode(curl_exec($curlScene), true);
    curl_close($curlScene);
    foreach ($sceneResult["result"] as $i3 => $v3) {
        $ajax["scenes"][$v3["idx"]]["Name"] = $v3["Name"];
        $pos = strpos($v3["Description"], $md5Lights);
        if ($pos === false) {
            $ajax["scenes"][$v3["idx"]]["Status"] = "Deactivated";
        } else {
            $ajax["scenes"][$v3["idx"]]["Status"] = "Activated";
        }
    }
    $md5 = md5(print_r($ajax, true));
    if ($md5_only == "true") {
        return $md5;
    } else {
        $ajax["meta"]["md5"] = $md5;
        $meta["meta"]["md5"] = $md5;
        $ajax["meta"]["lightd5"] = $md5Lights;
        $meta["meta"]["lightd5"] = $md5Lights;
        $timestamp = timestamp();
        $ajax["meta"]["timestamp"] = $timestamp;
        $meta["meta"]["timestamp"] = $timestamp;
        $ret_md5 = $_GET["md5"];
        if ($ret_md5 == $md5) {
            if ($format == "array") {
                return $meta;
            } else {
                return json_encode($meta);
            }
        } else {
            if ($format == "array") {
                return $ajax;
            } else {
                return json_encode($ajax);
            }
        }
    }
}
开发者ID:dcnoren,项目名称:Domoticz-Home-UI,代码行数:101,代码来源:functions.php


示例20: header

if (!$metrics) {
    header("Content-Type: image/" . IMGFMT);
    echo $canvas;
}
// Generate thumbnail image of the title for UI purposes.
$thumb = $canvas->clone();
if ($player) {
    $thumb->cropImage(427, 240, 350, 795);
    $thumb->resizeImage(72, 40, Imagick::FILTER_TRIANGLE, 1);
    $thumb->writeImage(realpath('thumbs') . '/' . $filename . '.' . IMGFMT);
    // headshotless title generation for animation
    $noHeadshot = getStatscard($player, ["emptyHeadshot" => true]);
    $noHeadshotCanvas = new Imagick();
    $noHeadshotCanvas->newImage(1920, 1080, "none", IMGFMT);
    $noHeadshotCanvas->setImageDepth(8);
    $noHeadshotCanvas->setimagecolorspace(imagick::COLORSPACE_SRGB);
    foreach ($noHeadshot['geos'] as $geo) {
        addGeoToCanvas($noHeadshotCanvas, $geo, $bustCache);
    }
    $noHeadshotCanvas->writeImage(realpath('out') . '/' . $filename . '_noHeadshot.' . IMGFMT);
} else {
    //$thumb->cropImage(1440, 1080, 0, 0);
    $thumb->resizeImage(72, 40, Imagick::FILTER_TRIANGLE, 1);
    $thumb->writeImage(realpath('thumbs') . '/' . $filename . '.' . IMGFMT);
}
timestamp('post thumbs');
// Generate the output file of the title.
$canvas->writeImage(realpath('out') . '/' . $filename . '.' . IMGFMT);
dbquery("REPLACE INTO cache SET `key`='{$key}', `hash`='" . getHashForTitle($title) . "';");
timestamp('post out');
开发者ID:rpitv,项目名称:rpits,代码行数:30,代码来源:im_render_title.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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