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


PHP cfg函数代码示例

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


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

示例1: ThreadViewIndexBarReadPosting

 function ThreadViewIndexBarReadPosting(&$_posting, $_prev_posting_id, $_next_posting_id, $_prev_thread_id, $_next_thread_id)
 {
     $this->Menu();
     if (!$_posting) {
         $this->add_separator();
         return;
     }
     $url = new FreechURL();
     $url->set_var('action', 'read');
     $url->set_var('msg_id', 1);
     $url->set_var('forum_id', $_posting->get_forum_id());
     // "Previous/Next Posting" buttons.
     if ($_prev_posting_id) {
         $url->set_var('msg_id', $_prev_posting_id);
         $url->set_label('<<');
         $this->add_link($url);
     } else {
         $this->add_text('<<');
     }
     $this->add_text(_('Message'));
     if ($_next_posting_id) {
         $url = clone $url;
         $url->set_var('msg_id', $_next_posting_id);
         $url->set_label('>>');
         $this->add_link($url);
     } else {
         $this->add_text('>>');
     }
     // "Previous Thread" button.
     $this->add_separator();
     if (cfg('thread_arrow_reverse')) {
         $prev_id = $_next_thread_id;
     } else {
         $prev_id = $_prev_thread_id;
     }
     if ($prev_id) {
         $url = clone $url;
         $url->set_var('msg_id', $prev_id);
         $url->set_label('<<');
         $this->add_link($url);
     } else {
         $this->add_text('<<');
     }
     // "Next Thread" button.
     $this->add_text(_('Thread'));
     $url = clone $url;
     if (cfg('thread_arrow_reverse')) {
         $next_id = $_prev_thread_id;
     } else {
         $next_id = $_next_thread_id;
     }
     if ($next_id) {
         $url = clone $url;
         $url->set_var('msg_id', $next_id);
         $url->set_label('>>');
         $this->add_link($url);
     } else {
         $this->add_text('>>');
     }
 }
开发者ID:useada,项目名称:freech-1,代码行数:60,代码来源:indexbar_read_posting.class.php

示例2: __construct

 /**
  * 初始化,并设置是否启用自动登录
  * @param bool $auto_login
  */
 function __construct($auto_login = false)
 {
     $this->ck = new \CLib\Cookie(cfg()->get('cookie', 'encode'));
     if ($auto_login) {
         $this->auto_login();
     }
 }
开发者ID:Wanyor,项目名称:ProjectManager,代码行数:11,代码来源:user.php

示例3: __construct

 /**
  * @param        $host
  * @param        $user
  * @param        $pass
  * @param        $name
  * @param string $driver
  */
 public function __construct($host, $user, $pass, $name, $driver = 'pgsql')
 {
     try {
         parent::__construct($driver . ':dbname=' . $name . ';host=' . $host, $user, $pass);
     } catch (Exception $e) {
         if (!cfg()->dev_mode && Core_Request::getInstance()->getRoute('module') == 'default') {
             $view = Core_View::getInstance();
             $view->setLayoutFile('$maintenance/db_connect.phtml');
             $view->displayLayout();
             die;
         } else {
             print get_class($e) . ': ' . $e->getMessage() . PHP_EOL;
             die;
         }
     }
     if (cfg()->dev_mode) {
         $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     } else {
         $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
     }
     $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Core_Db_Statement', array($this)));
     if (cfg()->dev_mode) {
         //			Core_Debug::getInstance()->initPdoDebug($this);
     }
 }
开发者ID:bozhich,项目名称:PHP-on-Rails,代码行数:32,代码来源:Db.php

示例4: read

 public function read()
 {
     $list = cfg('resources', 'models', $this->name);
     $rels = array('collection', 'model');
     $data = array();
     $pack = array();
     foreach ($list as $model) {
         $cname = \System\Loader::get_class_from_model($model);
         $model = \System\Loader::get_model_from_class($model);
         $schema = $cname::get_visible_schema($this->request->user);
         foreach ($schema['attrs'] as $attr) {
             if (in_array($attr['type'], $rels)) {
                 $rel_cname = \System\Loader::get_class_from_model($attr['model']);
                 $rel_model = \System\Loader::get_model_from_class($attr['model']);
                 if (!array_key_exists($rel_model, $pack)) {
                     $pack[$rel_model] = $rel_cname::get_visible_schema($this->request->user);
                 }
             }
         }
         $pack[$model] = $schema;
     }
     foreach ($pack as $name => $def) {
         $data[] = array("name" => $name, "parents" => array('model'), "static" => $def);
     }
     $this->content = json_encode(array("data" => $data));
 }
开发者ID:just-paja,项目名称:fudjan-api,代码行数:26,代码来源:schema.php

示例5: run

 public function run()
 {
     try {
         $this->req('ident');
     } catch (\System\Error\Argument $e) {
         $this->req('id');
     }
     def($this->template, 'system/text/show');
     def($this->show_heading, true);
     $conds = array();
     if (isset($ident)) {
         $conds['ident'] = $ident;
     } else {
         $conds['id_system_text'] = $id;
     }
     if ($text = \System\Text::get_first($conds)->fetch()) {
         $this->partial($template, array("text" => $text, "show_heading" => $show_heading));
     } else {
         if (cfg('dev', 'debug', 'backend')) {
             throw new \System\Error\Config('Text was not found', isset($ident) ? $ident : $id);
         } else {
             throw new \System\Error\NotFound();
         }
     }
 }
开发者ID:just-paja,项目名称:fudjan,代码行数:25,代码来源:show.php

示例6: TimestampToDate

 /**
  * @param $timestamp
  * @return bool|int|string
  */
 public static function TimestampToDate($timestamp)
 {
     if ($timestamp > 0) {
         return date(cfg()->date_format, $timestamp);
     }
     return 0;
 }
开发者ID:bozhich,项目名称:PHP-on-Rails,代码行数:11,代码来源:Tools.php

示例7: content

 function content($ret)
 {
     $tpl = gs_tpl::get_instance();
     $tpl->addTemplateDir(cfg('document_root') . DIRECTORY_SEPARATOR . 'content');
     $this->params['name'] = $this->data['gspgid_v'];
     return $this->show($ret);
 }
开发者ID:alex-k,项目名称:velotur,代码行数:7,代码来源:module.php

示例8: showViewDialog

 private function showViewDialog()
 {
     // Only show when map name given
     if (!isset($this->url) || $this->url == '') {
         throw new NagVisException(l('No url given.'));
     }
     // Build index template
     $INDEX = new NagVisIndexView($this->CORE);
     // Need to parse the header menu?
     if (cfg('index', 'headermenu')) {
         // Parse the header menu
         $HEADER = new NagVisHeaderMenu(cfg('index', 'headertemplate'));
         // Put rotation information to header menu
         if ($this->rotation != '') {
             $HEADER->setRotationEnabled();
         }
         $INDEX->setHeaderMenu($HEADER->__toString());
     }
     // Initialize map view
     $this->VIEW = new NagVisUrlView($this->CORE, $this->url);
     // Maybe it is needed to handle the requested rotation
     if ($this->rotation != '') {
         $ROTATION = new FrontendRotation($this->rotation);
         $ROTATION->setStep('url', $this->url, $this->rotationStep);
         $this->VIEW->setRotation($ROTATION->getRotationProperties());
     }
     $INDEX->setContent($this->VIEW->parse());
     return $INDEX->parse();
 }
开发者ID:rlugojr,项目名称:nagvis,代码行数:29,代码来源:FrontendModUrl.php

示例9: indexAction

 /**
  *
  */
 public function indexAction()
 {
     die('todo');
     $overwrite = !is_null(Core_Request::getInstance()->getArgv(4)) ? Core_Request::getInstance()->getArgv(4) : false;
     foreach (dibi::getDatabaseInfo()->getTables() as $table_data) {
         if ($table_data->getName() == Migration_MigrationModel::getTableName()) {
             continue;
         }
         $ddl_data = dibi::query('SHOW CREATE TABLE ' . $table_data->getName())->fetch()->toArray();
         $ddl_query = $ddl_data['Create Table'];
         $migration_time = time();
         $migration_name = 'Create' . ucfirst($table_data->getName());
         $migration_name = str_replace(' ', '', $migration_name);
         $migration_name = str_replace('-', '', $migration_name);
         $migration_name = str_replace('_', '', $migration_name);
         $filename = cfg()->migration_path . $migration_name . '.php';
         if (Core_Files::fileSize($filename) && !$overwrite) {
             echo PHP_EOL . 'Migration "Create ' . ucfirst($table_data->getName()) . '" Exists' . PHP_EOL;
             continue;
         }
         $template_data = Core_Files::getContent(cfg()->migration_path . Migration_FilesHelper::TEMPLATE_FILE_NAME);
         $template_data = str_replace('Template', $migration_name, $template_data);
         $template_data = str_replace('__NAME__', $migration_name, $template_data);
         $template_data = str_replace('__CREATED_AT__', $migration_time, $template_data);
         $template_data = str_replace('__CREATED_CFG__', Core_Request::getInstance()->getArgv(1), $template_data);
         $template_data = preg_replace('#//__UP_ACTION__#', $ddl_query, $template_data);
         $down_query = 'DROP TABLE IF EXISTS `' . $table_data->getName() . '`';
         $template_data = preg_replace('#//__DOWN_ACTION__#', $down_query, $template_data);
         Core_Files::putContent($filename, $template_data);
         echo PHP_EOL . 'Migration ' . $filename . ' created' . PHP_EOL;
     }
 }
开发者ID:bozhich,项目名称:PHP-on-Rails,代码行数:35,代码来源:Dump.php

示例10: send

 /**
  * @param $data
  * @return bool|string
  * @throws Exception
  * @throws phpmailerException
  */
 public static function send($data)
 {
     $mail = new PHPMailer();
     if (cfg()->is_smtp) {
         $mail->IsSMTP();
         // set mailer to use SMTP
     }
     $mail->Host = cfg()->smtp_host;
     $mail->Port = cfg()->smtp_port;
     $mail->SMTPAuth = cfg()->smtp_auth;
     // turn on SMTP authentication
     $mail->Username = cfg()->mail_user;
     // SMTP username
     $mail->Password = cfg()->mail_password;
     // SMTP password
     $mail->From = $data['from_email'];
     $mail->FromName = $data['from_name'];
     $mail->AddAddress($data['to_mail']);
     $mail->SetFrom($data['from_email'], $data['from_name']);
     $mail->AddReplyTo($data['from_email'], $data['from_name']);
     //$mail->SMTPDebug = 10;
     //$mail->SMTPSecure = 'tls';
     $mail->WordWrap = cfg()->mail_world_warp;
     // set word wrap to 50 characters
     $mail->IsHTML(cfg()->is_html);
     // set email format to HTML
     $mail->Subject = $data['subject'];
     $mail->Body = $data['message_html'];
     if (!$mail->Send()) {
         return $mail->ErrorInfo;
     }
     return true;
 }
开发者ID:bozhich,项目名称:PHP-on-Rails,代码行数:39,代码来源:phpMail.php

示例11: showViewDialog

 private function showViewDialog()
 {
     // Build index template
     $INDEX = new NagVisIndexView($this->CORE);
     // Need to parse the header menu?
     if (cfg('index', 'headermenu')) {
         // Parse the header menu
         $HEADER = new NagVisHeaderMenu(cfg('index', 'headertemplate'));
         // Put rotation information to header menu
         if ($this->rotation != '') {
             $HEADER->setRotationEnabled();
         }
         $INDEX->setHeaderMenu($HEADER->__toString());
     }
     // Initialize overview view
     $this->VIEW = new NagVisOverviewView($this->CORE);
     // Maybe it is needed to handle the requested rotation
     if ($this->rotation != '') {
         $ROTATION = new FrontendRotation($this->rotation);
         $ROTATION->setStep('overview', '', $this->rotationStep);
         $this->VIEW->setRotation($ROTATION->getRotationProperties());
     }
     $INDEX->setContent($this->VIEW->parse());
     return $INDEX->parse();
 }
开发者ID:swedieman,项目名称:nagvis,代码行数:25,代码来源:FrontendModOverview.php

示例12: get_quoted_text

 function get_quoted_text($_depth = 1)
 {
     if ($this->depth + $_depth == 0) {
         return trim($this->text);
     }
     $text = '';
     $prefix .= str_repeat('> ', $this->depth + $_depth);
     $maxlen = max(45, cfg('max_linelength') - strlen($prefix));
     foreach (explode("\n", $this->text) as $paragraph) {
         $paragraph = wordwrap($paragraph, $maxlen, " \n");
         foreach (explode("\n", $paragraph) as $line) {
             if (!$line) {
                 continue;
             }
             if (strlen($line) > $maxlen + 2) {
                 $line = wordwrap($line, $maxlen, "\t\n", TRUE);
                 $lines = explode("\n", trim($line));
                 $line = implode("\n" . $prefix, $lines);
             }
             $text .= $prefix . $line . "\n";
         }
         $text = trim($text) . "\n";
     }
     return trim($text);
 }
开发者ID:useada,项目名称:freech-1,代码行数:25,代码来源:indented_block.class.php

示例13: indexAction

 /**
  *
  */
 public function indexAction()
 {
     $argv = $this->getRequest()->getServer('argv');
     $test_to_run = isset($argv[3]) ? $argv[3] : Const_Tests::RUN_ALL_TESTS;
     $test_to_run = str_replace('_', '/', $test_to_run);
     foreach (Core_Files::listFiles(cfg()->tests_path) as $test) {
         if (!strstr($test, $test_to_run . '.php') && $test_to_run != Const_Tests::RUN_ALL_TESTS) {
             continue;
         }
         $class_path = str_replace(cfg()->tests_path, '', $test);
         $class_path_frag = explode('/', $class_path);
         $class_path_frag = array_map("ucfirst", $class_path_frag);
         $class_path_frag[count($class_path_frag) - 1] = str_replace('.php', '', $class_path_frag[count($class_path_frag) - 1]);
         $class = implode('_', $class_path_frag);
         $class_name = 'Tests_' . $class . 'File';
         echo '--------------------------------------' . PHP_EOL;
         echo 'Running test: ' . $class_name . PHP_EOL;
         echo '--------------------------------------' . PHP_EOL;
         $phpunit = new PHPUnit_TextUI_TestRunner();
         $phpunit->run($phpunit->getTest($class_name, $test), array('colors' => 'auto'));
         if ($test_to_run != Const_Tests::RUN_ALL_TESTS) {
             die;
         }
         echo PHP_EOL . PHP_EOL;
     }
     die;
 }
开发者ID:bozhich,项目名称:PHP-on-Rails,代码行数:30,代码来源:Index.php

示例14: check

 /**
  * @param bool $return
  * @return array
  */
 public static function check($return = false)
 {
     $must_migrate = false;
     $return_data = array();
     foreach (Core_Files::listFiles(cfg()->migration_path) as $migration_file) {
         if (strstr($migration_file, self::TEMPLATE_NAME)) {
             continue;
         }
         $migration_data = explode(DS, $migration_file);
         list($migration_file_name) = array_reverse($migration_data);
         list($migration_name, $extension) = explode('.', $migration_file_name);
         $migration_class_name = self::MIGRATION_PREFIX . $migration_name . self::MIGRATION_SUFIX;
         /* @var $migration_object Core_Migration_Abstract */
         $migration_object = new $migration_class_name();
         if ($migration_object->check()) {
             $must_migrate = true;
             if ($return) {
                 $return_data[] = $migration_file_name;
             } else {
                 echo 'TO RUN: ' . $migration_file_name . PHP_EOL;
             }
         }
     }
     if (!$must_migrate) {
         if (!$return) {
             echo 'DB is UP TO DATE' . PHP_EOL;
         }
     }
     if ($return) {
         return $return_data;
     }
 }
开发者ID:bozhich,项目名称:PHP-on-Rails,代码行数:36,代码来源:Factory.php

示例15: sql_error

 public function sql_error()
 {
     if (db()->status()) {
         $this->not_found();
     } else {
         $this->__view("Home/sql_error.php", ['msg' => db()->ex_message(), 'email' => cfg()->get('mail', 'From')]);
     }
 }
开发者ID:ttym7993,项目名称:Linger,代码行数:8,代码来源:Home.php


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