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

PHP Variable类代码示例

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

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



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

示例1: RestoreByNameForClass

 public static function RestoreByNameForClass($strName, $intClassId, $strVersion, $objFile)
 {
     $objConstant = QcodoConstant::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::QcodoConstant()->QcodoClassId, $intClassId), QQ::Equal(QQN::QcodoConstant()->Variable->Name, $strName)));
     if (!$objConstant) {
         $objVariable = new Variable();
         $objVariable->Name = $strName;
         $objVariable->VariableTypeId = VariableType::String;
         $objVariable->FirstVersion = $strVersion;
         $objVariable->Save();
         $objConstant = new QcodoConstant();
         $objConstant->Variable = $objVariable;
         $objConstant->File = $objFile;
         $objConstant->QcodoClassId = $intClassId;
         $objConstant->Save();
     } else {
         if ($objConstant->Variable->LastVersion) {
             $objConstant->Variable->LastVersion = null;
             $objConstant->Variable->Save();
         }
         if ($objFile->Id != $objConstant->intFileId) {
             $objConstant->File = $objFile;
             $objConstant->Save();
         }
     }
     return $objConstant;
 }
开发者ID:qcodo,项目名称:qcodo-api,代码行数:26,代码来源:QcodoConstant.class.php


示例2: render

 public function render($context)
 {
     try {
         $expire_time = $this->expire_time_var->resolve($context);
     } catch (VariableDoesNotExist $e) {
         throw new TemplateSyntaxError('"cache" tag got an unknown variable: ' . $this->expire_time_var->var);
     }
     if (!is_numeric($expire_time)) {
         throw new TemplateSyntaxError('"cache" tag got a non-integer timeout value: ' . print_r($expire_time, true));
     }
     $expire_time = (int) $expire_time;
     // Build a unicode key for this fragment and all vary-on's.
     $vs_ = array();
     foreach ($this->vary_on as $var) {
         $v_ = new Variable($var);
         $vs_[] = urlencode($v_->resolve($context));
     }
     $args = join(':', $vs_);
     unset($vs_);
     $cache_key = 'template.cache.' . $this->fragment_name . '.' . md5($args);
     $manager = Dja::getCacheManager();
     $value = $manager->get($cache_key);
     if ($value === null) {
         $value = $this->nodelist->render($context);
         $manager->set($cache_key, $value, $expire_time);
     }
     return $value;
 }
开发者ID:idlesign,项目名称:dja,代码行数:28,代码来源:cache.php


示例3: testCreateInstanceFromLocal

 public function testCreateInstanceFromLocal()
 {
     $local = new Variable('$var');
     $instance = $local->convertToInstance();
     $this->assertTrue($instance->isInstance());
     $this->assertFalse($local->isInstance());
 }
开发者ID:roozbehmatloobi,项目名称:php-refactoring-browser,代码行数:7,代码来源:VariableTest.php


示例4: testVariableParsing

 public function testVariableParsing()
 {
     $c = array('article' => array('section' => 'News'));
     $v = new Variable('article.section');
     $this->assertEquals('News', $v->resolve($c));
     $v = new Variable('"News"');
     $this->assertEquals('News', $v->resolve($c));
     $v = new Variable("'News'");
     $this->assertEquals('News', $v->resolve($c));
     // Translated strings are handled correctly.
     $v = new Variable('_(article.section)');
     $this->assertEquals('News', $v->resolve($c));
     $v = new Variable('_("Good News")');
     $this->assertEquals('Good News', $v->resolve($c));
     $v = new Variable("_('Better News')");
     $this->assertEquals('Better News', $v->resolve($c));
     // Escaped quotes work correctly as well.
     $v = new Variable('"Some \\"Good\\" News"');
     $this->assertEquals('Some "Good" News', $v->resolve($c));
     $v = new Variable("'Some 'Better' News'");
     $this->assertEquals("Some 'Better' News", $v->resolve($c));
     // Variables should reject access of attributes beginning with underscores.
     $this->setExpectedException('TemplateSyntaxError');
     new Variable('article._hidden');
 }
开发者ID:idlesign,项目名称:dja,代码行数:25,代码来源:parser.php


示例5: CreateNewForName

 public static function CreateNewForName($strName, $strVersion)
 {
     $objVariable = new Variable();
     $objVariable->Name = $strName;
     $objVariable->VariableTypeId = VariableType::Unknown;
     switch (substr($strName, 0, 3)) {
         case 'str':
             $objVariable->VariableTypeId = VariableType::String;
             break;
         case 'obj':
             $objVariable->VariableTypeId = VariableType::Object;
             break;
         case 'int':
             $objVariable->VariableTypeId = VariableType::Integer;
             break;
         case 'bln':
             $objVariable->VariableTypeId = VariableType::Boolean;
             break;
         case 'mix':
             $objVariable->VariableTypeId = VariableType::Mixed;
             break;
         case 'dtt':
             $objVariable->VariableTypeId = VariableType::QDateTime;
             break;
         case 'flt':
             $objVariable->VariableTypeId = VariableType::Float;
             break;
     }
     $objVariable->FirstVersion = $strVersion;
     if (strpos(strtolower($strName), 'array') !== false) {
         $objVariable->ArrayFlag = true;
     }
     $objVariable->Save();
     return $objVariable;
 }
开发者ID:qcodo,项目名称:qcodo-api,代码行数:35,代码来源:Variable.class.php


示例6: parse

 /**
  * Parse a variable line
  * 
  * @param string $varLine
  * @return Variable
  */
 public static function parse($varLine)
 {
     $parts = explode('=', $varLine, 2);
     if (!$parts || count($parts) !== 2) {
         throw new \InvalidArgumentException("Line does not appear to contain a variable");
     }
     $variable = new Variable();
     $variable->setName(trim(array_shift($parts)))->setValue(trim(array_shift($parts)));
     return $variable;
 }
开发者ID:yzalis,项目名称:crontab,代码行数:16,代码来源:Variable.php


示例7: pre_config

 /**
  * Appeler dans les fichiers: ./tinymce4_admin_title.php ; ./filemanager/config.php 
  * @return array
  * @see extract()
  */
 public static function pre_config()
 {
     if (!isset($_SESSION['util'], $_SESSION[self::MODULE])) {
         die('ERROR 403');
     }
     $urlsite = new Variable();
     $urlsite->charger('urlsite');
     $baseurl = rtrim('/' . preg_replace('/https?:\\/\\/[^\\/]+\\/?/', '', $urlsite->valeur), '/') . '/';
     $style_chem = new Variable();
     $style_chem->charger('style_chem');
     return array('thelia_path' => '../client/plugins/' . self::MODULE . '/', 'thelia_urlsite' => $urlsite->valeur, 'thelia_baseurl' => $baseurl, 'thelia_utilisateur' => 'client/gfx/utilisateur/', 'thelia_styles' => $urlsite->valeur && $style_chem->valeur ? $urlsite->valeur . $style_chem->valeur : '');
 }
开发者ID:anti-conformiste,项目名称:thelia1,代码行数:17,代码来源:Tinymce4.class.php


示例8: ecrire

 public static function ecrire($nom, $valeur, $creer_si_inexistante = false, $protege = 1, $cache = 1)
 {
     $var = new Variable($nom);
     if ($creer_si_inexistante && !$var->charger($nom)) {
         $var->nom = $nom;
         $var->valeur = $valeur;
         $var->protege = $protege;
         $var->cache = $cache;
         $var->add();
     } else {
         $var->valeur = $valeur;
         $var->maj();
     }
 }
开发者ID:anti-conformiste,项目名称:thelia1,代码行数:14,代码来源:Variable.class.php


示例9: showPage

 public function showPage($name)
 {
     $this->cache_control('private', 300);
     $this->page_title = Variable::getString("page-title-{$name}");
     $this->page_content = Variable::getString("page-content-{$name}");
     $this->render('home/show_page');
 }
开发者ID:daerduoCarey,项目名称:oj,代码行数:7,代码来源:HomeController.php


示例10: uninstall

 public function uninstall()
 {
     $ret = true;
     if ($ret) {
         $ret = Variable::delete('mail_from_addr');
     }
     if ($ret) {
         $ret = Variable::delete('mail_from_name');
     }
     if ($ret) {
         $ret = Variable::delete('mail_use_replyto');
     }
     if ($ret) {
         $ret = Variable::delete('mail_method');
     }
     if ($ret) {
         $ret = Variable::delete('mail_user');
     }
     if ($ret) {
         $ret = Variable::delete('mail_password');
     }
     if ($ret) {
         $ret = Variable::delete('mail_host');
     }
     if ($ret) {
         $ret = Variable::delete('mail_security');
     }
     if ($ret) {
         $ret = Variable::delete('mail_auth');
     }
     Base_ThemeCommon::uninstall_default_theme($this->get_type());
     return $ret;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:33,代码来源:MailInstall.php


示例11: parseBaseUrl

 public static function parseBaseUrl()
 {
     switch (Config::get("URL_MODEL")) {
         case 'NORMAL':
             $groupName = ucfirst(Variable::get(Config::get("GROUP_PARAM")));
             $controllerName = ucfirst(Variable::get(Config::get("CONTROLLER_PARAM")));
             $actionName = ucfirst(Variable::get(Config::get("ACTION_PARAM")));
             break;
         case 'PATH_INFO':
             $pathInfo = Variable::server("PATH_INFO");
             if (isset($pathInfo)) {
                 $pathInfo = ltrim($pathInfo, "/");
                 $urlInfo = explode("/", $pathInfo);
                 if (count($urlInfo) >= 3) {
                     foreach ($urlInfo as &$value) {
                         $value = ucfirst($value);
                     }
                     unset($value);
                     list($groupName, $controllerName, $actionName) = $urlInfo;
                 } else {
                     $groupName = isset($urlInfo[0]) ? ucfirst($urlInfo[0]) : "";
                     $controllerName = isset($urlInfo[1]) ? ucfirst($urlInfo[1]) : "";
                     $actionName = isset($urlInfo[2]) ? ucfirst($urlInfo[2]) : "";
                 }
                 break;
             } else {
                 break;
             }
         default:
     }
     define("GROUP_NAME", !empty($groupName) ? $groupName : Config::get("DEFAULT_GROUP"));
     define("CONTROLLER_NAME", !empty($controllerName) ? $controllerName : Config::get("DEFAULT_CONTROLLER"));
     define("ACTION_NAME", !empty($actionName) ? $actionName : Config::get("DEFAULT_ACTION"));
 }
开发者ID:lixinhan,项目名称:JiongPHP,代码行数:34,代码来源:Router.class.php


示例12: __construct

 /**
  * This hook is called once any activated plugins have been loaded.
  */
 protected function __construct()
 {
     $this->settings = Variable::settings();
     add_action('admin_init', array(&$this, 'admin_init'));
     add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
     add_action('admin_enqueue_scripts', array(&$this, 'add_pointer_script'));
 }
开发者ID:visualive,项目名称:va-social-buzz,代码行数:10,代码来源:class-module-admin.php


示例13: auth

 private function auth($user, $pass)
 {
     $error = '';
     $t = Variable::get('host_ban_time');
     if ($t > 0) {
         $fails = DB::GetOne('SELECT count(*) FROM user_login_ban WHERE failed_on>%d AND from_addr=%s', array(time() - $t, $_SERVER['REMOTE_ADDR']));
         if ($fails >= 3) {
             $error = 'Host banned.';
         }
     }
     if ($error === '') {
         $ret = Base_User_LoginCommon::check_login($user, $pass);
         if (!$ret) {
             $error = 'Login failed.';
             if ($t > 0) {
                 DB::Execute('DELETE FROM user_login_ban WHERE failed_on<=%d', array(time() - $t));
                 DB::Execute('INSERT INTO user_login_ban(failed_on,from_addr) VALUES(%d,%s)', array(time(), $_SERVER['REMOTE_ADDR']));
                 $fails = DB::GetOne('SELECT count(*) FROM user_login_ban WHERE failed_on>%d AND from_addr=%s', array(time() - $t, $_SERVER['REMOTE_ADDR']));
                 if ($fails >= 3) {
                     $error .= ' Host banned.';
                 }
             }
         } else {
             $uid = Base_UserCommon::get_user_id($user);
             Acl::set_user($uid, true);
         }
     }
     return $error;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:29,代码来源:soap.php


示例14: fetch

 private static function fetch($name, $default)
 {
     global $cache;
     $cache_key = static::buildCacheKey($name);
     $cache_value = $cache->get($cache_key);
     if ($cache_value === NULL) {
         try {
             $var = new Variable($name);
             $cache_value = $var->getValue();
         } catch (fNotFoundException $e) {
             $cache_value = $default;
         }
         $cache->set($cache_key, $cache_value);
     }
     return $cache_value;
 }
开发者ID:daerduoCarey,项目名称:oj,代码行数:16,代码来源:Variable.php


示例15: RestoreByNameForClass

 public static function RestoreByNameForClass($strName, $intClassId, $strVersion)
 {
     $objClassProperty = ClassProperty::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::ClassProperty()->QcodoClassId, $intClassId), QQ::Equal(QQN::ClassProperty()->Variable->Name, $strName)));
     if (!$objClassProperty) {
         $objConnectedClassVariable = ClassVariable::LoadByPartialNameForClass($strName, $intClassId);
         $objVariable = Variable::CreateNewForName($strName, $strVersion);
         $objClassProperty = new ClassProperty();
         $objClassProperty->QcodoClassId = $intClassId;
         $objClassProperty->VariableGroupId = 1;
         $objClassProperty->Variable = $objVariable;
         if ($objConnectedClassVariable) {
             $objClassProperty->ClassVariable = $objConnectedClassVariable;
             $objClassProperty->VariableGroupId = $objConnectedClassVariable->VariableGroupId;
         }
         $objClassProperty->Save();
     } else {
         if ($objClassProperty->Variable->LastVersion) {
             $objClassProperty->Variable->LastVersion = null;
             $objClassProperty->Variable->Save();
         }
         if ($objClassProperty->ClassVariable) {
             $objClassProperty->VariableGroupId = $objClassProperty->ClassVariable->VariableGroupId;
             $objClassProperty->Save();
         }
     }
     return $objClassProperty;
 }
开发者ID:qcodo,项目名称:qcodo-api,代码行数:27,代码来源:ClassProperty.class.php


示例16: show

 public function show($id)
 {
     $this->cache_control('private', Variable::getInteger('status-refresh', 30));
     try {
         $this->report = new Report($id);
         if (!$this->report->isReadable()) {
             throw new fAuthorizationException('You are not allowed to view this report.');
         }
         global $cache;
         $this->board = $cache->get($this->report->getBoardCacheKey());
         if ($this->board === NULL) {
             $p = $this->report->getProblems();
             $un = $this->report->getUsernames();
             $up = $this->report->getUserPairs();
             $un[] = '';
             $up[] = array('id' => '', 'name' => '平均');
             $st = $this->report->getStartDatetime();
             $et = $this->report->getEndDatetime();
             $this->board = new BoardTable(ReportGenerator::headers($p), $up, ReportGenerator::scores($p, $un, $st, $et));
             $cache->set($this->report->getBoardCacheKey(), $this->board, 10);
         }
         if ($this->report->isHomework()) {
             $this->nav_class = 'homework';
         } else {
             $this->nav_class = 'reports';
         }
         $this->render('report/show');
     } catch (fExpectedException $e) {
         fMessaging::create('warning', $e->getMessage());
         fURL::redirect(Util::getReferer());
     } catch (fUnexpectedException $e) {
         fMessaging::create('error', $e->getMessage());
         fURL::redirect(Util::getReferer());
     }
 }
开发者ID:daerduoCarey,项目名称:oj,代码行数:35,代码来源:ReportController.php


示例17: get_img_quality

function get_img_quality($nomvar, $min, $max, $defaut)
{
    $quality = intval(Variable::lire($nomvar, $defaut));
    if ($quality < $min || $quality > $max) {
        $quality = $defaut;
    }
    return $quality;
}
开发者ID:anti-conformiste,项目名称:thelia1,代码行数:8,代码来源:image.php


示例18: uninstall

 public function uninstall()
 {
     Base_ThemeCommon::uninstall_default_theme(Base_User_LoginInstall::module_name());
     Variable::delete('host_ban_time');
     Variable::delete('host_ban_nr_of_tries');
     Variable::delete('host_ban_by_login');
     return DB::DropTable('user_password') && DB::DropTable('user_login_ban') && DB::DropTable('user_autologin') && DB::DropTable('user_reset_pass');
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:8,代码来源:LoginInstall.php


示例19: submit_admin

 public function submit_admin($data)
 {
     Variable::set('default_theme', $data['theme']);
     Base_ThemeCommon::create_cache();
     Base_StatusBarCommon::message('Theme changed - reloading page');
     eval_js('setTimeout(\'document.location=\\\'index.php\\\'\',\'3000\')');
     return true;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:8,代码来源:Administrator_0.php


示例20: uninstall

 public function uninstall()
 {
     recursive_rmdir(DATA_DIR . '/Base_Theme/templates/default/images');
     Variable::delete('default_theme');
     Variable::delete('preload_image_cache_default');
     Variable::delete('preload_image_cache_selected');
     return true;
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:8,代码来源:ThemeInstall.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Varien_Autoload类代码示例发布时间:2022-05-23
下一篇:
PHP VardefManager类代码示例发布时间: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