當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Vars類代碼示例

本文整理匯總了PHP中Vars的典型用法代碼示例。如果您正苦於以下問題:PHP Vars類的具體用法?PHP Vars怎麽用?PHP Vars使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Vars類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setLang

 /**
  * Sets initial language configuration for global use.
  */
 public function setLang()
 {
     $session = new Session();
     $vars = new Vars();
     if (!$session->exists('lang') || $vars->get('lang')) {
         $session->set('lang', $vars->get('lang') ? $vars->get('lang') : self::DEFAULT_LANG);
     }
 }
開發者ID:kasalgado,項目名稱:framework,代碼行數:11,代碼來源:Init.php

示例2: run

 public function run()
 {
     $model = new Vars();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Vars'])) {
         $model->attributes = $_POST['Vars'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:robebeye,項目名稱:MusicDream,代碼行數:13,代碼來源:CreateAction.php

示例3: beginRequest

function beginRequest($event)
{
    $app = Yii::app();
    $app->name = Vars::model()->find("varname='SITE_NAME'")->varvalue;
    $app->params['adminEmail'] = Vars::model()->find("varname='adminEmail'")->varvalue;
    $app->params['footerinfo'] = Vars::model()->find("varname='FOOTERINFO'")->varvalue;
}
開發者ID:robebeye,項目名稱:MusicDream,代碼行數:7,代碼來源:main.php

示例4: draw

 static function draw()
 {
     $page = self::urlArray(0);
     if ($page != "setupcomplete" && $page != "action" && file_exists(getSitePath() . "install/")) {
         forward("setupcomplete");
     }
     $body = $header = $nav = $footer = NULL;
     if ($page) {
         $page_handler_class = "SocialApparatus\\" . ucfirst($page) . "PageHandler";
     } else {
         $page_handler_class = "SocialApparatus\\HomePageHandler";
     }
     Vars::clear();
     if (class_exists($page_handler_class)) {
         $body = (new $page_handler_class())->view();
     } else {
         new SystemMessage("Page not found.");
         forward("home");
     }
     Vars::clear();
     $header = display("page_elements/header");
     Vars::clear();
     $nav = display("page_elements/navigation");
     Vars::clear();
     $footer = display("page_elements/footer");
     Vars::clear();
     echo $header;
     echo $nav;
     echo $body;
     echo $footer;
     Debug::clear();
     Dbase::con()->close();
     die;
 }
開發者ID:socialapparatus,項目名稱:socialapparatus,代碼行數:34,代碼來源:Page.php

示例5: getAllAssets

 static function getAllAssets($which_end)
 {
     // if cached already, return it
     if (isset(self::$assets)) {
         return self::$assets;
     }
     // otherwise, get it from settings
     $settings = Vars::getSettings();
     $assets = array();
     $i = 0;
     $indexes = array();
     foreach ($settings['assets'][$which_end] as $type => $asset_group) {
         foreach ($asset_group as $asset_key => $asset_attributes) {
             $asset = new Asset();
             $asset->type = $type;
             $asset->path = $asset_attributes['path'];
             $asset->source = $asset_attributes['source'];
             $asset->position = $asset_attributes['position'];
             $asset->weight = $asset_attributes['weight'];
             $asset->key = $asset_key;
             $assets[$i] = $asset;
             $indexes[$i] = $asset->weight;
             $i++;
         }
     }
     asort($indexes);
     $rtn = array();
     foreach ($indexes as $key => $val) {
         $rtn[] = $assets[$key];
     }
     return $rtn;
 }
開發者ID:jeffreycai,項目名稱:chaoliu,代碼行數:32,代碼來源:Asset.class.php

示例6: getThumbnailUrl

 public function getThumbnailUrl()
 {
     if ($this->getThumbnail()) {
         return get_sub_root() . "/files/avatars/" . $this->getThumbnail();
     }
     $settings = Vars::getSettings();
     return get_sub_root() . "/files/avatars/" . $settings['profile']['avatar_default'];
 }
開發者ID:jeffreycai,項目名稱:reader,代碼行數:8,代碼來源:SiteProfile.class.php

示例7: loadEngineTasks

 public static function loadEngineTasks()
 {
     CodonRewrite::ProcessRewrite();
     Vars::setParameters();
     self::$activeModule = strtoupper(CodonRewrite::$current_module);
     Config::loadSettings();
     self::loadModules();
 }
開發者ID:deanstalker,項目名稱:phpVMS,代碼行數:8,代碼來源:MainController.class.php

示例8: delete

 public function delete()
 {
     $settings = Vars::getSettings();
     // we delete avatar image first
     if ($this->getThumbnail() != $settings['profile']['avatar_default']) {
         @unlink(AVATAR_DIR . '/' . $this->getThumbnail());
     }
     parent::delete();
 }
開發者ID:jeffreycai,項目名稱:chaoliu,代碼行數:9,代碼來源:SiteProfile.class.php

示例9: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = Vars::model()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
開發者ID:robebeye,項目名稱:MusicDream,代碼行數:16,代碼來源:VarsController.php

示例10: testExecute

 function testExecute()
 {
     $f1 = new Filter1();
     $f2 = new Filter2();
     $fc = new \Hiano\Filter\FilterChain(function () {
         Vars::$callback_executed = TRUE;
     });
     $fc->addFilter($f1);
     $fc->addFilter($f2);
     $fc->execute();
     $this->assertEquals(TRUE, Vars::$f1_executed);
     $this->assertEquals(TRUE, Vars::$f2_executed);
     $this->assertEquals(TRUE, Vars::$callback_executed);
 }
開發者ID:kasonyang,項目名稱:hiano,代碼行數:14,代碼來源:FilterTest.php

示例11: getArticles

 public function getArticles($page = 1, $category = null, $unread = null)
 {
     global $mysqli;
     $user_account_table = 'user_' . $this->getId() . '_account';
     $user_category_table = 'user_' . $this->getId() . '_category';
     $user_read_table = 'user_' . $this->getId() . '_read';
     // where
     $where = array();
     if ($category) {
         $where[] = " ua.category_id={$category} ";
     }
     if (sizeof($where)) {
         $where = " WHERE " . implode(' AND ', $where) . " ";
         if ($unread == 1) {
             $where .= " AND ur.article_id IS NULL ";
         }
     } else {
         $where = '';
         if ($unread == 1) {
             $where = " WHERE ur.article_id IS NULL";
         }
     }
     // join
     $join = "";
     if ($unread == 1) {
         $join = " LEFT JOIN {$user_read_table} as ur ON ur.article_id=wa.id ";
     }
     // limit
     $limit = "";
     if ($page) {
         $settings = Vars::getSettings();
         $limit = " LIMIT " . ($page - 1) * $settings['articles_per_page'] . ", " . $settings['articles_per_page'];
     }
     // order by
     $order_by = ' ORDER BY wa.published_at DESC ';
     ///// final query
     $query = "SELECT wa.*, ua.id AS user_wechat_account_id FROM wechat_article as wa JOIN {$user_account_table} as ua ON ua.account_id=wa.account_id {$join} {$where} {$order_by} {$limit}";
     //_debug($query);
     $result = $mysqli->query($query);
     $rtn = array();
     while ($result && ($b = $result->fetch_object())) {
         $obj = new WechatArticle();
         DBObject::importQueryResultToDbObject($b, $obj);
         $obj->user_wechat_account_id = $b->user_wechat_account_id;
         $rtn[] = $obj;
     }
     return $rtn;
 }
開發者ID:jeffreycai,項目名稱:reader,代碼行數:48,代碼來源:MySiteUser.class.php

示例12: sendTicketToClient

function sendTicketToClient($subject, $msg, array $attachements, $to)
{
    $settings = Vars::getSettings();
    $username = $settings['mail']['ticket']['username'];
    $password = $settings['mail']['ticket']['password'];
    if (strpos($username, '@') == false) {
        $username = decrypt($username);
        $password = decrypt($password);
    }
    load_library_phpmailer();
    $mail = new PHPMailer(true);
    try {
        //    $mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
        $mail->Mailer = $settings['mail']['ticket']['mailer'];
        $mail->SMTPAuth = true;
        // enable SMTP authentication
        $mail->CharSet = 'UTF-8';
        $mail->SMTPSecure = $settings['mail']['ticket']['SMTPSecure'];
        // sets the prefix to the servier
        $mail->Host = $settings['mail']['ticket']['host'];
        // sets GMAIL as the SMTP server
        $mail->Port = $settings['mail']['ticket']['port'];
        // set the SMTP port for the GMAIL server
        $mail->Username = $username;
        // GMAIL username
        $mail->Password = $password;
        // GMAIL password
        $mail->AddReplyTo($settings['mail']['ticket']['from']);
        $mail->AddAddress($to);
        $mail->SetFrom($settings['mail']['ticket']['from'], $settings['sitename']);
        $mail->Subject = $subject;
        $mail->MsgHTML($msg);
        foreach ($attachements as $ticket) {
            $mail->addAttachment($ticket);
        }
        $mail->Send();
    } catch (phpmailerException $e) {
        $log = new Log('mail', Log::ERROR, 'Failed to send email: ' . $e->errorMessage());
        $log->save();
        return false;
    } catch (Exception $e) {
        $log = new Log('mail', Log::ERROR, 'Failed to send email: ' . $e->getMessage());
        $log->save();
        return false;
    }
    return true;
}
開發者ID:jeffreycai,項目名稱:ct21,代碼行數:47,代碼來源:functions.inc.php

示例13: ValidateConfirm

 public static function ValidateConfirm()
 {
     $confid = Vars::GET('confirmid');
     $sql = "UPDATE " . TABLE_PREFIX . "pilots SET confirmed=1, retired=0 WHERE salt='{$confid}'";
     $res = DB::query($sql);
     if (DB::errno() != 0) {
         return false;
     }
     return true;
 }
開發者ID:rallin,項目名稱:phpVMS,代碼行數:10,代碼來源:RegistrationData.class.php

示例14: denyDirect

 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$label = Vars::get("label");
$class = Vars::get("class");
$cancel = Vars("cancel");
if (!$label) {
    $label = "Save";
}
if (!$class) {
    $class = "btn btn-success";
}
if ($cancel) {
    echo <<<HTML
<span class='btn-group'>
HTML;
}
echo <<<HTML
    <input type="submit" class="{$class}" value="{$label}">
HTML;
開發者ID:socialapparatus,項目名稱:socialapparatus,代碼行數:31,代碼來源:submit.php

示例15: exit

<?php

if (!defined('BASEPATH')) {
    exit('Nu poti accesa acest fisier direct.');
}
$expire = $CFG->get('rank_regenerate');
$expire = 0;
if (Cache::is_cached('top_10_players', $expire)) {
    Vars::set('players_rank', Cache::get('top_10_players'));
} else {
    $players = array();
    $sql = "SELECT player.id, player.name, player.level, player_index.empire \n                FROM " . PLAYER_DATABASE . ".player \n                LEFT JOIN " . PLAYER_DATABASE . ".player_index ON player_index.id=player.account_id \n                LEFT JOIN " . PLAYER_DATABASE . ".guild_member ON guild_member.pid=player.id \n                INNER JOIN " . ACCOUNT_DATABASE . ".account \n                ON account.id=player.account_id\n                WHERE player.name NOT LIKE '[%]%' AND account.status!='BLOCK'\n            ORDER BY player.level DESC, player.exp DESC LIMIT 10";
    $query = $DB->query($sql);
    while ($row = $DB->fetch($query)) {
        $players[] = $row;
    }
    Cache::set('top_10_players', $players);
    Vars::set('players_rank', $players);
}
if (Cache::is_cached('top_10_guilds', $expire)) {
    Vars::set('guilds_rank', Cache::get('top_10_guilds'));
} else {
    $guilds = array();
    $sql = "SELECT \n        guild.name, guild.level, guild.win, guild.ladder_point, player_index.empire\n        FROM " . PLAYER_DATABASE . ".guild  \n        LEFT JOIN " . PLAYER_DATABASE . ".player ON guild.master = player.id \n        LEFT JOIN " . PLAYER_DATABASE . ".player_index ON player_index.id = player.account_id \n        WHERE player.name NOT LIKE '[%]%' \n        ORDER BY guild.ladder_point DESC LIMIT 10";
    $query = $DB->query($sql);
    while ($row = $DB->fetch($query)) {
        $guilds[] = $row;
    }
    Cache::set('top_10_guilds', $guilds);
    Vars::set('guilds_rank', $guilds);
}
開發者ID:ionutmilica,項目名稱:my-archive,代碼行數:31,代碼來源:getRank.php


注:本文中的Vars類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。