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


PHP Shineisp_Commons_Utilities::readfile方法代码示例

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


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

示例1: init

 public function init()
 {
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $this->addElement('select', 'locale', array('decorators' => array('Bootstrap'), 'label' => 'Language', 'class' => 'form-control', 'multioptions' => Languages::getLanguageFiles(PUBLIC_PATH . "/languages")));
     $this->addElement('textarea', 'agreement', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'label' => 'Agreements', 'rows' => '10', 'value' => Shineisp_Commons_Utilities::readfile(PUBLIC_PATH . "/../LICENSE")));
     $this->addElement('select', 'chkagreement', array('decorators' => array('Bootstrap'), 'label' => 'I agree with the legal terms', 'class' => 'form-control', 'multioptions' => array(1 => 'YES, I agree with the legal terms', 0 => 'NO, I disagree with these legal terms')));
     $this->addElement('submit', 'submit', array('label' => 'Continue', 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary btn-lg'));
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:8,代码来源:LocalizationForm.php

示例2: loadConfig

 /**
  * Load of the configuration file
  * @return SimpleXMLElement
  */
 public static function loadConfig()
 {
     $confFile = APPLICATION_PATH . "/configs/config.xml";
     try {
         if (file_exists($confFile) && is_readable($confFile)) {
             $config = Shineisp_Commons_Utilities::readfile($confFile);
             if (!empty($config)) {
                 $config = new Zend_Config_Xml($confFile);
                 if (simplexml_load_file($confFile)) {
                     Shineisp_Registry::set('config', $config);
                     return simplexml_load_file($confFile);
                 } else {
                     throw new Exception("XML Config file is not readable or not well-formed");
                 }
             }
         }
     } catch (Exception $e) {
         echo $e->getMessage();
         echo "<xmp>";
         echo $e->getTraceAsString();
         echo "</xmp>";
         exit;
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:28,代码来源:Main.php

示例3: preDispatch

 /**
  * (non-PHPdoc)
  * @see Zend_Controller_Plugin_Abstract::preDispatch()
  */
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $dayssincefirstsetup = 0;
     $migration = new Doctrine_Migration(APPLICATION_PATH . '/configs/migrations');
     $LatestVersion = $migration->getLatestVersion();
     $CurrentVersion = $migration->getCurrentVersion();
     try {
         // Check if the config file has been created
         $isReady = Shineisp_Main::isReady();
         if ($isReady) {
             // Execute the migration
             if ($CurrentVersion < $LatestVersion) {
                 // write a log message
                 Shineisp_Commons_Utilities::log("Upgrade: Current Version is {$CurrentVersion} and the latest available version is {$LatestVersion}");
                 $dbconfig = Shineisp_Main::databaseConfig();
                 // Update the version in the config.xml file previously created
                 Settings::saveConfig($dbconfig, $LatestVersion);
                 if ($CurrentVersion > 0) {
                     Shineisp_Commons_Utilities::log("Upgrade: Migrate ShineISP version from {$CurrentVersion} to {$LatestVersion}");
                     $migration->migrate();
                 }
             }
             $db = Doctrine_Manager::getInstance()->getCurrentConnection();
             // Read and execute all the sql files saved in the /application/configs/data/sql directory
             $path = PROJECT_PATH . "/application/configs/data/sql";
             if (is_dir($path)) {
                 $directory_iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
                 try {
                     // get the first setup date
                     $setupdate = Settings::getConfigSetupDate();
                     if (empty($setupdate)) {
                         throw new Exception('Setup date is not set in the config.xml file');
                     }
                     // for each sql file do ...
                     foreach ($directory_iterator as $filename => $path_object) {
                         // get the sql file information
                         $info = pathinfo($filename);
                         if (!empty($info['extension']) && $info['extension'] == "sql") {
                             $name = $info['filename'];
                             // get the first part of the name with the filename that contains the date: YYYYMMddHis-NAME.sql
                             $arrName = explode("-", $name);
                             // if the string is a valid date get the days betweeen the sql file name and the day of the setup of shineisp
                             if (!empty($arrName[0]) && Zend_Date::isdate($arrName[0], 'YYYYMMddHis')) {
                                 $sqldate = new Zend_Date($arrName[0], 'YYYYMMddHis');
                                 $mysetupdate = new Zend_Date($setupdate, 'YYYYMMddHis');
                                 // get the difference of the two dates
                                 $diff = $sqldate->sub($mysetupdate)->toValue();
                                 $dayssincefirstsetup = floor($diff / 60 / 60 / 24);
                                 unset($sqldate);
                                 unset($mysetupdate);
                             }
                             // SQL files post installation will be executed
                             if ($dayssincefirstsetup >= 0) {
                                 // read the sql
                                 $sql = Shineisp_Commons_Utilities::readfile($info['dirname'] . "/" . $info['basename']);
                                 if (!empty($sql)) {
                                     // execute the sql strings
                                     $result = $db->execute($sql);
                                     // close the db connection
                                     $db->close();
                                     if ($result) {
                                         // write a log message
                                         Shineisp_Commons_Utilities::log($info['filename'] . ".sql has been executed.");
                                         // rename the sql
                                         rename($info['dirname'] . "/" . $info['basename'], $info['dirname'] . "/" . $info['filename'] . ".sql.old");
                                     }
                                 }
                             } else {
                                 // rename the sql
                                 rename($info['dirname'] . "/" . $info['basename'], $info['dirname'] . "/" . $info['filename'] . ".sql.old");
                                 // write a log message
                                 Shineisp_Commons_Utilities::log($info['filename'] . ".sql has been skipped because already set in the doctrine data setup.");
                             }
                         }
                     }
                 } catch (Exception $e) {
                     die($e->getMessage());
                 }
             }
         }
         // Execute the migration
         if ($CurrentVersion < $LatestVersion) {
             $dbconfig = Shineisp_Main::databaseConfig();
             // Update the version in the config.xml file previously created
             Settings::saveConfig($dbconfig, $LatestVersion);
             if ($CurrentVersion > 0) {
                 $migration->migrate();
             }
         }
     } catch (Exception $e) {
         Zend_Debug::dump($e->getMessage());
         die;
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:98,代码来源:Migrate.php


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