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


PHP config::getInArray方法代码示例

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


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

示例1: get

	/**
	 * Show the file to the client
	 *
	 * @param string $prm File requested
	 */
	public static function get($prm) {
		self::init();
		$prm = self::$cfg->dir.
			str_replace(
				array(self::$cfg->webDir.'/', '/'),
				array('', DS)
				, $prm);
		if (self::$cfg->getInArray('forceDownload', file::getExt($prm)))
			response::getInstance()->sendFile($prm);
		else
			response::getInstance()->showFile($prm);
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:17,代码来源:upload.class.php

示例2: get

 /**
  * Get a db object
  *
  * @param string $type Element type (table, rowset or row)
  * @param db_table|string $table
  * @param array $prm Array parameter for the factory
  * @return db_table|db_rowset|db_row
  */
 public static function get($type, $table, array $prm = array())
 {
     if ($type == 'table' && array_key_exists($table, self::$tables)) {
         return self::$tables[$table];
     }
     self::init();
     if ($table instanceof db_table) {
         $tableName = $table->getName();
         if (!array_key_exists('table', $prm)) {
             $prm['table'] = $table;
         }
     } else {
         $tableName = $table;
         if ($type == 'table' && !array_key_exists('name', $prm)) {
             $prm['name'] = $table;
         } else {
             if ($type == 'row' && !array_key_exists('table', $prm)) {
                 $db = array_key_exists('db', $prm) ? $prm['db'] : self::getInstance();
                 $prm['table'] = self::get('table', $tableName, array('db' => $db));
             }
         }
     }
     if (!($className = self::$cfg->getInArray($type, $tableName)) && !factory::isCreable($className = 'db_' . $type . '_' . $tableName)) {
         $className = self::$cfg->get($type . 'Class');
     }
     if ($type == 'table') {
         self::$tables[$table] = factory::get($className, $prm);
         return self::$tables[$table];
     }
     return factory::get($className, $prm);
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:39,代码来源:db.class.php

示例3: errorHandler

 public static function errorHandler($code, $message, $file, $line)
 {
     self::initCfg();
     $msg = self::$cfg->getInArray('errors', $code) . ': ' . $message . ' at ' . $file . ':' . $line;
     $stopCfg = self::$cfg->stop;
     $stop = is_array($stopCfg) ? in_array($code, $stopCfg) : $stopCfg;
     if ($stop) {
         $e = new nException($msg, $code);
         $e->line = $line;
         $e->file = $file;
         throw $e;
         return true;
     } else {
         // Maybe log something somewhere?
     }
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:16,代码来源:debug.class.php

示例4: __

	/**
	 * Get the translation for a keyword
	 *
	 * @param string $key The keyword
	 * @param bool $show Indicate if the word found should be directly shown
	 * @param bool $out Indicate if the word should be outted
	 * @return null|string
	 */
	public static function __($key, $show=false, $out=true) {
		self::initCfg();
		$ret = null;
		if (strpos($key, '_') !== false) {
			$keys = explode('_', $key);
			$ret = self::$cfg->getInArray($keys[0], $keys[1]);
		} else
			$ret = self::$cfg->get($key);
		
		if ($out)
			$ret = utils::htmlOut($ret);
		
		if (is_array($ret))
			$ret = array_map('nl2br', $ret);
		else
			$ret = nl2br($ret);
		
		if ($show)
			echo $ret;
		else
			return $ret;
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:30,代码来源:tr.class.php

示例5: get

 /**
  * Get a new object, with loading its definition and configuration
  *
  * @param string $className The classname to create
  * @param array $cfg The config
  * @return object The new object
  */
 public static function get($className, array $cfg = array())
 {
     if (self::$cfg && ($tmp = self::$cfg->getInArray('classAlias', $className))) {
         $className = $tmp;
     }
     self::load($className);
     $ref = new nReflection();
     if ($ref->rebuild($className)) {
         $prm = self::loadCfg($className);
         self::mergeCfg($prm, $cfg);
         $inst = $ref->newInstanceCfg(new config($prm));
         return $inst;
     } else {
         throw new nException('Factory - load: Unable to bluid ' . $className . '.');
     }
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:23,代码来源:factory.class.php

示例6: getType

 /**
  * Get the Mime Type of a file
  *
  * @param string $file File path name
  * @return string
  */
 public static function getType($file)
 {
     self::initCfg();
     $ret = self::$cfg->getInArray('mimes', strtolower(self::getExt($file)));
     if (!$ret) {
         $ret = self::$cfg->getInArray('mimes', 'unknown');
     }
     return $ret;
     $ret = false;
     if (self::exists($file)) {
         $finfo = new finfo(FILEINFO_MIME);
         if ($finfo) {
             $ret = $finfo->file($filename);
             $finfo->close();
         } else {
             $ret = mime_content_type($file);
         }
     }
     return $ret;
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:26,代码来源:file.class.php

示例7: getAttr

	/**
	 * Get an attribute
	 *
	 * @param string $name Attribute name
	 * @return mixed|null The attribute or null if not set
	 */
	public function getAttr($name) {
		return $this->cfg->getInArray('attributes', $name);
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:9,代码来源:object.class.php


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