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


PHP Helpers::init方法代码示例

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


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

示例1: __construct

 /**
  * We want to establish a "fluid" API for the objects.
  * which is why most of these methods return $this.
  *
  * ( new Object() )->setup()->doCalculation()->update()->done();
  */
 public function __construct($mapper = null)
 {
     parent::init();
     static::setupMetaAttributes();
     static::setupModelAttributes();
     $this->actual_model_attributes_table = static::$_model_attributes_table;
     $this->actual_meta_attributes_table = static::$_meta_attributes_table;
     $this->actual_model_settings = static::$_model_settings;
     $this->mapper = $mapper;
     Helpers::debug(get_called_class() . "::__construct");
 }
开发者ID:borisdiakur,项目名称:woocommerce-json-api,代码行数:17,代码来源:Base.php

示例2: array

<?php

$config = array("database" => array("host" => "localhost", "name" => "toiletfinder", "username" => "root", "password" => "toiletpaper"));
ini_set("display_errors", true);
error_reporting(E_ALL);
require "helpers.php";
Helpers::init($config);
开发者ID:tomkoker,项目名称:crappermapper,代码行数:7,代码来源:config.php

示例3: strtolower

 $newProjectLower = strtolower($newProjectName);
 /* update MC current.project.php file */
 $content = file_get_contents($cpFile);
 $content = str_replace($currentProject, $newProjectLower, $content);
 $fp = fopen($cpFile, 'w');
 if ($fp) {
     fwrite($fp, $content);
     fclose($fp);
 }
 $currentProject = $newProjectLower;
 /* create new project config file */
 $props = array();
 $props['mycomponentCore'] = $modx->getOption('mc.core_path', null, $modx->getOption('core_path') . 'components/mycomponent/');
 require_once $props['mycomponentCore'] . 'model/mycomponent/helpers.class.php';
 $helpers = new Helpers($modx, $props);
 $helpers->init();
 $newTpl = $helpers->getTpl('example.config.php');
 if (empty($newTpl)) {
     $message = 'Could not find example.config.php';
     break;
 }
 $newTpl = str_replace('Example', $newProjectName, $newTpl);
 $newTpl = str_replace('example', $newProjectLower, $newTpl);
 $configDir = $modx->getOption('mc.root', null, $modx->getOption('core_path') . 'components/mycomponent/') . '_build/config/';
 if (!is_dir($configDir)) {
     $message = 'Config directory does not exist';
     break;
 }
 $configFile = $configDir . $newProjectLower . '.config.php';
 $fp = fopen($configFile, 'w');
 if ($fp) {
开发者ID:mooror,项目名称:MyComponent,代码行数:31,代码来源:mycomponent.php

示例4: createConfigFile

 public function createConfigFile()
 {
     $newProjectName = $this->get('packageName');
     $newProjectLower = strtolower($newProjectName);
     $paths = $this->initPaths();
     $props = array();
     require_once $paths['mycomponentCore'] . 'model/mycomponent/helpers.class.php';
     $props['mycomponentCore'] = $paths['myCore'];
     $helpers = new Helpers($this->xpdo, $props);
     $helpers->init();
     //$helpers->tplPath = $paths['myTplPath'];echo $paths['myTplPath'];
     $newTpl = $helpers->getTpl('migxexample.config.php');
     if (empty($newTpl)) {
         $this->set('errormessage', 'Could not find migxexample.config.php');
         return false;
     }
     $newTpl = str_replace('Example', $newProjectName, $newTpl);
     $newTpl = str_replace('example', $newProjectLower, $newTpl);
     $configDir = $this->xpdo->getOption('mc.root', null, $this->xpdo->getOption('core_path') . 'components/mycomponent/') . '_build/config/';
     if (!is_dir($configDir)) {
         $this->set('errormessage', 'Config directory does not exist');
         return false;
     }
     $configFile = $configDir . $newProjectLower . '.config.php';
     if (!file_exists($configFile)) {
         $fp = fopen($configFile, 'w');
         if ($fp) {
             fwrite($fp, $newTpl);
             fclose($fp);
         } else {
             $this->set('errormessage', 'Could not open new config file');
             return false;
         }
         $message = "Important! Edit the new config file before running any utilities:\n" . $configFile;
         $projects[$newProjectLower] = $configFile;
         /* update projects file */
         $content = '<' . '?' . "php\n\n  \$projects = " . var_export($projects, true) . ';' . "\n return \$projects;";
         $fp = fopen($projectFile, 'w');
         if ($fp) {
             fwrite($fp, $content);
             fclose($fp);
         }
     }
     return true;
 }
开发者ID:Piterden,项目名称:modx_testfloor,代码行数:45,代码来源:mcuiconfig.class.php


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