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


PHP Config::read方法代码示例

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


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

示例1: testWrite

 /**
  * @covers Config::write
  * @todo   Implement testWrite().
  */
 public function testWrite()
 {
     $config = array('app_key' => 'appkeyvalue', 'user_key' => 'userkeyvalue');
     $this->object->setConfig($config);
     echo getcwd();
     $this->object->setFileName('data/testOutputFile.ini');
     $this->object->write();
     $this->assertEquals($config, $this->object->read());
     unlink($this->object->getFileName());
 }
开发者ID:danielzen,项目名称:eventbrite-ics,代码行数:14,代码来源:ConfigTest.php

示例2: getContent

    protected function getContent()
    {
        // Inicializa assistente de formulário
        $form = new Form("myDetail");
        $dataArr['ajax'] = ["type" => Config::read('form.hidden'), "data" => (object) ["value" => true]];
        $dataArr['name'] = ["type" => Config::read('form.input'), "data" => (object) ["text" => Text::read('form.name'), "length" => 50]];
        $dataArr['surname'] = ["type" => Config::read('form.input'), "data" => (object) ["text" => Text::read('form.surname'), "length" => 50]];
        $dataArr['sex'] = ["type" => Config::read('form.radio'), "data" => (object) ["text" => Text::read('form.sex'), "value" => [(object) ["id" => 1, "text" => Text::read('form.man')], (object) ["id" => 2, "text" => Text::read('form.woman')]], "checked" => 1]];
        $dataArr['email'] = ["type" => Config::read('form.input'), "data" => (object) ["text" => Text::read('form.email'), "length" => 50]];
        $dataArr['password'] = ["type" => Config::read('form.password'), "data" => (object) ["text" => Text::read('form.password'), "length" => 20]];
        $dataArr['news'] = ["type" => Config::read('form.checkbox'), "data" => (object) ["text" => Text::read('form.newsletter'), "checked" => true]];
        $dataArr['btnSave'] = ["type" => Config::read('form.submit'), "data" => (object) ["text" => Text::read('form.save'), "class" => "success btn-lg"]];
        $accountForm = $form->createForm($dataArr);
        unset($dataArr);
        ob_start();
        ?>
          <div class="container">
            <div class="row cadastro">
              <div class="col-md-4 col-md-offset-4">
                <?php 
        echo $accountForm;
        ?>
              </div>
            </div>
          </div>
		<?php 
        return ob_get_clean();
    }
开发者ID:sohflp,项目名称:Hooked,代码行数:28,代码来源:class.LoginNewAccountView.php

示例3: create

 /**
  * Create a new template object
  * @return object
  */
 public static function create()
 {
     // Try/catch statement
     try {
         // Required Smarty libraries
         require_once dirname(__DIR__) . '/smarty/libs/Smarty.class.php';
         // Optional - load custom security features
         //require_once(__DIR__.'/smartysecuritycustom.inc.php');
         // Smarty v3.1 or newer
         $smarty = new Smarty();
         $smarty->setTemplateDir(Config::read('smarty|templateDirectory'));
         $smarty->setCompileDir(Config::read('smarty|compileDirectory'));
         $smarty->setCacheDir(Config::read('smarty|cacheDirectory'));
         // Optional - override configs
         //$smarty->setConfigDir(Config::read('smarty|configDirectory'));
         // Optional - override plugins
         //$smarty->setPluginsDir(Config::read('smarty|pluginsDirectory'));
         $smarty->setCacheLifetime(Config::read('smarty|cacheLifetime'));
         // Disable caching
         $smarty->force_compile = true;
         $smarty->compile_check = true;
         $smarty->setCaching(Smarty::CACHING_OFF);
         // Optional - enable security restrictions
         //$smarty->enableSecurity('SmartySecurityCustom');
         // Return Smarty object
         return $smarty;
     } catch (Exception $e) {
         Log::error("Error while loading template engine");
         // Exception error
         return false;
     }
 }
开发者ID:noumenia,项目名称:aetolos,代码行数:36,代码来源:templatefactory.inc.php

示例4: find

 /**
  * Find cafés nearby
  *
  * @param array $get The original $_GET array
  * @return array
  * @throws \Exception
  * @author Jesper Skytte Hansen <jesper@edulab.dk>
  */
 public static function find($get)
 {
     if (!isset($get['lat']) || !isset($get['lng'])) {
         return self::format('', 'MissingParams');
     }
     // Convert to floats
     $lat = floatval($get['lat']);
     $lng = floatval($get['lng']);
     // Set query parameters
     $query = array('location' => $lat . ',' . $lng, 'language' => 'da', 'rankby' => 'distance', 'sensor' => 'true', 'types' => 'cafe', 'key' => Config::read('Keys.GoogleApi'));
     // Create call url
     $url = 'https://maps.googleapis.com/maps/api/place/search/json?' . http_build_query($query);
     $url = str_replace('%2C', ',', $url);
     // Send request to google
     $d = self::curl($url);
     // Json decode string
     $d = json_decode($d, true);
     switch ($d['status']) {
         case 'OK':
             return self::format(array('latitude' => $lat, 'longitude' => $lng, 'results' => $d['results']));
             break;
         case 'ZERO_RESULTS':
             return self::format(array('latitude' => $lat, 'longitude' => $lng, 'results' => []));
             break;
     }
     return self::format('', 'UnknownApiResponse');
 }
开发者ID:greew,项目名称:erdetkaffetid.dk,代码行数:35,代码来源:Places.php

示例5: read

 /**
  * Método que se utiliza para leer un .ini
  * @param type $file Nombre del archivo (sin el .ini);
  * @param type $source 
  */
 public static function read($file, $source = '', $force = FALSE)
 {
     $tmp = $file;
     $file = Config::read($file, $force);
     foreach ($file as $seccion => $filas) {
         foreach ($filas as $variable => $valor) {
             if ($valor == '1') {
                 $file[$seccion][$variable] = 'On';
             } else {
                 if (empty($valor)) {
                     $file[$seccion][$variable] = $tmp == 'databases' ? NULL : 'Off';
                 }
             }
         }
     }
     if ($source) {
         if (is_array($source)) {
             $key = @array_shift(array_keys($source));
             $var = $source[$key];
             return isset($file[$key][$var]) ? $file[$key][$var] : NULL;
         } else {
             return isset($file[$source]) ? $file[$source] : NULL;
         }
     }
     return $file;
 }
开发者ID:RFDO93,项目名称:mantenimiento,代码行数:31,代码来源:dw_config.php

示例6: __construct

 public function __construct($params = "")
 {
     /**
      * Carrega os routes do sistema
      */
     $this->routes = Config::read("routes");
     //pr( $this->routes );
     /**
      * URL
      *
      * Verifica URL e decifra que controller
      * e action deve ser aberto.
      */
     $this->translateUrl();
     /**
      * AJUSTA CONEXÃO SE EXISTIR
      */
     $this->conn = empty($params["conn"]) ? NULL : $params["conn"];
     /**
      * Verifica tabelas
      */
     if ($this->conn) {
         $this->checkTables(array('conn' => $this->conn));
     }
 }
开发者ID:kurko,项目名称:acidphp,代码行数:25,代码来源:Engine.php

示例7: selectForDetail

 public function selectForDetail($id)
 {
     $this->mapping->fields['id'] = 'productID';
     $this->mapping->fields['name'] = 'productName';
     $this->mapping->fields['text'] = 'productDescription';
     $this->mapping->fields['price'] = 'REPLACE( CAST( TRUNCATE(productPrice,2)    AS CHAR), ".", "," )';
     $this->mapping->fields['discount'] = 'REPLACE( CAST( TRUNCATE(productDiscount,2) AS CHAR), ".", "," )';
     $this->mapping->fields['status'] = 'productStatus';
     $this->mapping->fields['album'] = 'albumID';
     $this->mapping->fields['type'] = '(SELECT typeTitle' . ' FROM products_types AS textTable' . ' WHERE textTable.typeID = ' . $this->mapping->table . '.typeID)';
     $this->mapping->fields['subtype'] = '(SELECT typeTitle' . ' FROM products_types AS textTable' . ' WHERE textTable.typeID = ' . $this->mapping->table . '.subTypeID)';
     $this->mapping->fields['brand'] = '(SELECT brandTitle' . ' FROM products_brands AS textTable' . ' WHERE textTable.brandID = ' . $this->mapping->table . '.brandID)';
     $this->mapping->fields['account'] = 'accountID';
     $this->mapping->fields['accName'] = '(SELECT accountFirstName' . ' FROM accounts AS textTable' . ' WHERE textTable.accountID = ' . $this->mapping->table . '.accountID)';
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'productID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $id;
     $data = $this->detail($id);
     if ($data) {
         // Recupera fotos a partir do album
         if ($this->photoModel) {
             $data->photos = $this->photoModel->selectAlbum($data->album);
         }
         // Converte o código do status para texto
         $data->statusText = Text::read('product.status')[array_search($data->status, Config::read('product.status'))];
     } else {
         //exit($this->getMessage());
     }
     return $data;
 }
开发者ID:sohflp,项目名称:Hooked,代码行数:31,代码来源:class.ProductModel.php

示例8: getContent

 protected function getContent()
 {
     // Inicializa assistente de formul‡rio
     $form = new Form("myDetail");
     $dataArr['ajax'] = ["type" => Config::read('form.hidden'), "data" => (object) ["value" => true]];
     $dataArr['name'] = ["type" => Config::read('form.input'), "data" => (object) ["text" => Text::read('form.name'), "length" => 100]];
     $dataArr['email'] = ["type" => Config::read('form.input'), "data" => (object) ["text" => Text::read('form.email'), "length" => 50]];
     $dataArr['message'] = ["type" => Config::read('form.textarea'), "data" => (object) ["text" => Text::read('form.message')]];
     $dataArr['btnSend'] = ["type" => Config::read('form.submit'), "data" => (object) ["text" => Text::read('form.send'), "class" => "success btn-lg"]];
     $messageForm = $form->createForm($dataArr);
     unset($dataArr);
     ob_start();
     ?>
         <div class="container">
             <div class="row cadastro">
                 <div class="col-md-4 col-md-offset-4">
                     <?php 
     echo $messageForm;
     ?>
                 </div>
             </div>
         </div>
     <?php 
     return ob_get_clean();
 }
开发者ID:sohflp,项目名称:Hooked,代码行数:25,代码来源:class.ContactView.php

示例9: create

 /**
  * Create a new template object
  * @return object
  */
 public static function create()
 {
     // Try/catch statement
     try {
         // Smarty installation
         $configDir = Config::read('smarty');
         // Required Smarty libraries
         require_once $configDir . '/libs/Smarty.class.php';
         // Smarty v3.1 or newer
         $smarty = new Smarty();
         $smarty->setTemplateDir(Config::read('pwd') . '/templates/' . Config::read('template'));
         $smarty->setCompileDir($configDir . '/templates_c');
         $smarty->setCacheDir($configDir . '/cache');
         // Disable caching
         $smarty->force_compile = true;
         $smarty->compile_check = true;
         $smarty->setCaching(Smarty::CACHING_OFF);
         // Return Smarty object
         return $smarty;
     } catch (Exception $e) {
         Log::error("Error while loading template engine");
         // Exception error
         return false;
     }
 }
开发者ID:noumenia,项目名称:nyx,代码行数:29,代码来源:templatefactory.inc.php

示例10: runApp

 public function runApp()
 {
     $run_info = URLParser\URLParser::getPeices();
     # Include it and call it, really basic
     include APP_PATH . DS . 'controllers' . DS . $run_info['controller'] . '_controller.php';
     $controller_name = ucwords($run_info['controller']) . 'Controller';
     $this->controller = new $controller_name();
     # Load up the database includes if there is one specified
     if (Config::read('DATABASE_CONNECTOR') !== '') {
         include LITEFRAME_PATH . DS . 'lib' . DS . 'php-activerecord' . DS . 'ActiveRecord.php';
         $connections = Config::read('DATABASE_CONNECTIONS');
         $default_connection = Config::read('DATABASE_CONNECTOR');
         $model_path = APP_PATH . DS . 'models';
         # must issue a "use" statement in your closure if passing variables
         \ActiveRecord\Config::initialize(function ($cfg) use($connections, $default_connection, $model_path) {
             $cfg->set_model_directory($model_path);
             $cfg->set_connections($connections);
             # default connection is now production
             $cfg->set_default_connection($default_connection);
         });
     }
     call_user_func_array(array($this->controller, 'init'), array());
     ob_start();
     call_user_func_array(array($this->controller, $run_info['function']), $run_info['args']);
     $content_for_layout = ob_get_clean();
     ob_end_clean();
     $title_for_layout = $this->controller->title;
     # Finally output with a global layout
     if ($this->controller->layout !== '') {
         include APP_PATH . DS . 'layouts' . DS . $this->controller->layout . '.tpl';
     } else {
         include LITEFRAME_PATH . DS . 'layouts' . DS . 'default.tpl';
     }
 }
开发者ID:nabeelio,项目名称:liteframe,代码行数:34,代码来源:liteframe.php

示例11: htm

/**
 * Generador de Reportes
 *
 * @category Kumbia
 * @package Report
 * @copyright Copyright (c) 2005-2007 Andres Felipe Gutierrez (andresfelipe at vagoogle.net)
 * @license http://www.kumbia.org/license.txt GNU/GPL
 *
 */
function htm($result, $sumArray, $title, $weighArray, $headerArray)
{
    $config = Config::read('config');
    $active_app = Router::get_application();
    $file = md5(uniqid());
    $content = "\n<html>\n <head>\n   <title>REPORTE DE " . strtoupper($title) . "</title>\n </head>\n <body bgcolor='white'>\n <div style='font-size:20px;font-family:Verdana;color:#000000'>" . strtoupper($config->{$active_app}->name) . "</div>\n\n <div style='font-size:18px;font-family:Verdana;color:#000000'>REPORTE DE " . strtoupper($title) . "</div>\n\n <div style='font-size:18px;font-family:Verdana;color:#000000'>" . date("Y-m-d") . "</div>\n\n <br/>\n <table cellspacing='0' border=1 style='border:1px solid #969696'>\n ";
    $content .= "<tr bgcolor='#F2F2F2'>\n";
    for ($i = 0; $i <= count($headerArray) - 1; $i++) {
        $content .= "<th style='font-family:Verdana;font-size:12px'>" . $headerArray[$i] . "</th>\n";
    }
    $content .= "</tr>\n";
    $l = 5;
    foreach ($result as $row) {
        $content .= "<tr bgcolor='white'>\n";
        for ($i = 0; $i <= count($row) - 1; $i++) {
            if (is_numeric($row[$i])) {
                $content .= "<td style='font-family:Verdana;font-size:12px' align='center'>{$row[$i]}</td>";
            } else {
                $content .= "<td style='font-family:Verdana;font-size:12px'>{$row[$i]}&nbsp;</td>";
            }
        }
        $content .= "</tr>\n";
        $l++;
    }
    file_put_contents("public/temp/{$file}.html", $content);
    if (isset($raw_output)) {
        print "<script type='text/javascript'> window.open('" . KUMBIA_PATH . "temp/" . $file . ".html', null);  </script>";
    } else {
        Generator::forms_print("<script type='text/javascript'> window.open('" . KUMBIA_PATH . "temp/" . $file . ".html', null);  </script>");
    }
}
开发者ID:raalveco,项目名称:Escuela,代码行数:40,代码来源:htm.php

示例12: setPHP

 /**
  * @param string|null $version
  */
 public function setPHP($version = null)
 {
     $phpVersions = $this->config->read('php_commands');
     if (is_array($phpVersions) && in_array($version, array_keys($phpVersions))) {
         $this->php = $phpVersions[$version];
     }
 }
开发者ID:plugowski,项目名称:php_sandbox,代码行数:10,代码来源:Evaluator.php

示例13: site_include

function site_include($Filename)
{
    if (Config::read('site.includenone')) {
    } else {
        include $Filename;
    }
}
开发者ID:amoschou,项目名称:acet,代码行数:7,代码来源:functions.php

示例14: getContent

    protected function getContent()
    {
        ob_start();
        ?>
			<div class="jumbotron text-center">
			  <h1>
				<span class="glyphicon glyphicon-time"></span>
				<?php 
        echo Text::read('message.login.session.inactive');
        ?>
			  </h1>
			  <h2>
				<a class="btn btn-lg btn-info" href="<?php 
        echo Config::read('page.url.login');
        ?>
">
				  <span class="glyphicon glyphicon-home"></span>&nbsp;
				  <?php 
        echo Text::read('message.login.session.return');
        ?>
				</a>
			  </h2>
			</div>
		<?php 
        return ob_get_clean();
    }
开发者ID:sohflp,项目名称:Hooked,代码行数:26,代码来源:class.LoginTimeOutView.php

示例15: __construct

 private function __construct()
 {
     $this->dbType = Config::read('db.type');
     switch ($this->dbType) {
         case 'mysql':
             $dsn = "mysql:host=" . Config::read('db.host') . ";port=" . Config::read('db.port') . ";dbname=" . Config::read('db.basename');
             $username = Config::read('db.user');
             $password = Config::read('db.password');
             $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES " . Config::read('db.charset'));
             break;
         case 'sqlite':
             $dsn = "sqlite:" . Config::read('db.basename');
             $options = array(PDO::ATTR_PERSISTENT => true);
             break;
         case 'sqlite2':
             $dsn = "sqlite2:" . Config::read('db.basename');
             $options = array(PDO::ATTR_PERSISTENT => true);
             break;
         case 'pgsql':
             $dsn = "pgsql:host=" . Config::read('db.host') . ";port=" . Config::read('db.port') . ";dbname=" . Config::read('db.basename') . ";user=" . Config::read('db.user') . ";password=" . Config::read('db.password');
             break;
     }
     try {
         if ($this->dbType == 'pgsql') {
             $this->dbh = new PDO($dsn);
         } elseif ($this->dbType == 'sqlite') {
             $this->dbh = new PDO($dsn, NULL, NULL, $options);
         } elseif ($this->dbType == 'mysql') {
             $this->dbh = new PDO($dsn, $username, $password, $options);
         }
     } catch (PDOException $e) {
         print 'Error!: ' . $e->getMessage() . '<br/>';
         die;
     }
 }
开发者ID:MorS25,项目名称:TorrentMonitor,代码行数:35,代码来源:Database.class.php


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