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


PHP General::writeFile方法代码示例

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


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

示例1: saveVersion

 public static function saveVersion($entry, $fields, $is_update)
 {
     // list existing versions of this entry
     $existing_versions = General::listStructure(MANIFEST . '/versions/' . $entry->get('id') . '/', '/.xml$/');
     // create folder
     if (!file_exists(MANIFEST . '/versions/' . $entry->get('id'))) {
         General::realiseDirectory(MANIFEST . '/versions/' . $entry->get('id'));
     }
     // max version number
     $new_version_number = count($existing_versions['filelist']);
     $new_version_number++;
     if ($is_update) {
         $new_version_number--;
     }
     if ($new_version_number == 0) {
         $new_version_number++;
     }
     unset($fields['entry-versions']);
     // run custom DS to get the built XML of this entry
     $ds = new EntryVersionsXMLDataSource(self::Context(), null, false);
     $ds->dsParamINCLUDEDELEMENTS = array_keys($fields);
     $ds->dsParamFILTERS['id'] = $entry->get('id');
     $ds->dsSource = (string) $entry->get('section_id');
     $param_pool = array();
     $entry_xml = $ds->grab($param_pool);
     // get text value of the entry
     $proc = new XsltProcess();
     $data = $proc->process($entry_xml->generate(), file_get_contents(EXTENSIONS . '/entry_versions/lib/entry-version.xsl'), array('version' => $new_version_number, 'created-by' => self::Context()->Author ? self::Context()->Author->getFullName() : '', 'created-date' => date('Y-m-d', time()), 'created-time' => date('H:i', time())));
     $write = General::writeFile(MANIFEST . '/versions/' . $entry->get('id') . '/' . $new_version_number . '.xml', $data);
     General::writeFile(MANIFEST . '/versions/' . $entry->get('id') . '/' . $new_version_number . '.dat', self::serializeEntry($entry));
     return $new_version_number;
 }
开发者ID:klaftertief,项目名称:entry_versions,代码行数:32,代码来源:class.entryversionsmanager.php

示例2: build

 public function build()
 {
     $this->_root = DOCROOT . '/';
     $this->_path = @realpath(strlen(trim($_GET['browse'])) == 0 ? $this->_root : $_GET['browse']);
     $this->_xsl = @file_get_contents($this->_pagedata['filelocation']);
     // Keep everything within DOCROOT:
     if (strpos($this->_path, $this->_root) !== 0) {
         $this->_path = $this->_root;
     }
     $this->_item = new PathListItem($this->_path);
     if ($this->_path != $this->_root) {
         $this->_link = '=' . $this->_item->path($this->_root);
     }
     // Toggle bookmarks:
     if (isset($_GET['bookmark'])) {
         $configuration = Frontend::instance()->Configuration;
         $bookmarks = $configuration->get('browsedevkit-bookmarks');
         $path = realpath($_GET['bookmark']);
         if (strpos($path, $this->_root) !== 0) {
             $path = $this->_root;
         }
         if (!is_array($bookmarks)) {
             $bookmarks = array();
         }
         if (in_array($path, $bookmarks)) {
             $bookmarks = array_diff($bookmarks, array($path));
         } else {
             $bookmarks[] = $path;
         }
         $configuration->set('browsedevkit-bookmarks', $bookmarks);
         General::writeFile(CONFIG, "<?php\n\t\$settings = {$configuration};\n", $configuration->get('write_mode', 'file'));
         redirect("?browse{$this->_link}{$this->_query_string}");
     }
     return parent::build();
 }
开发者ID:symphonists,项目名称:browsedevkit,代码行数:35,代码来源:content.browse.php

示例3: install

 public function install()
 {
     // create tables
     Symphony::Database()->query("CREATE TABLE `tbl_elasticsearch_logs` (\n\t\t\t\t  `id` varchar(255) NOT NULL DEFAULT '',\n\t\t\t\t  `date` datetime NOT NULL,\n\t\t\t\t  `keywords` varchar(255) DEFAULT NULL,\n\t\t\t\t  `keywords_raw` varchar(255) DEFAULT NULL,\n\t\t\t\t  `sections` varchar(255) DEFAULT NULL,\n\t\t\t\t  `page` int(11) NOT NULL,\n\t\t\t\t  `results` int(11) DEFAULT NULL,\n\t\t\t\t  `session_id` varchar(255) DEFAULT NULL,\n\t\t\t\t  `user_agent` varchar(255) DEFAULT NULL,\n\t\t\t\t  `ip` varchar(255) DEFAULT NULL,\n\t\t\t\t  PRIMARY KEY (`id`),\n\t\t\t\t  UNIQUE KEY `id` (`id`),\n\t\t\t\t  KEY `keywords` (`keywords`),\n\t\t\t\t  KEY `date` (`date`),\n\t\t\t\t  KEY `session_id` (`session_id`)\n\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
     // create config defaults
     Symphony::Configuration()->setArray(array('elasticsearch' => array('host' => '', 'index-name' => '', 'reindex-batch-size' => 20, 'reindex-batch-delay' => 0, 'per-page' => 20, 'sort' => '_score', 'direction' => 'desc', 'highlight-fragment-size' => 200, 'highlight-per-field' => 1, 'build-entry-xml' => 'no', 'default-sections' => '', 'default-language' => '', 'log-searches' => 'yes')));
     Administration::instance()->saveConfig();
     // create workspace structure
     $config = (object) Symphony::Configuration()->get('directory');
     General::realiseDirectory(WORKSPACE . '/elasticsearch', $config->{'write_mode'});
     General::writeFile(WORKSPACE . '/elasticsearch/.htaccess', file_get_contents(EXTENSIONS . '/elasticsearch/templates/.htaccess'), $config->{'write_mode'});
     General::writeFile(WORKSPACE . '/elasticsearch/index.json', file_get_contents(EXTENSIONS . '/elasticsearch/templates/index.json'), $config->{'write_mode'});
     General::realiseDirectory(WORKSPACE . '/elasticsearch/mappings', $config->{'write_mode'});
 }
开发者ID:nickdunn,项目名称:elasticsearch,代码行数:14,代码来源:extension.driver.php

示例4: persist

 private function persist($url, $result)
 {
     $cache = array();
     $cache[] = array();
     if (file_exists(BITLY_CACHE)) {
         $cache = file_get_contents(BITLY_CACHE);
         $cache = json_decode($cache, true);
     }
     $token = md5($url);
     if (!array_key_exists($token, $cache)) {
         $cache[0][$token] = array("url" => $url, "tinyurl" => $result);
     }
     $cache = json_encode($cache);
     General::writeFile(BITLY_CACHE, $cache);
 }
开发者ID:remie,项目名称:bitly,代码行数:15,代码来源:extension.driver.php

示例5: writeConfig

function writeConfig($dest, $conf, $mode)
{
    $string = "<?php\n";
    $string .= "\n\t\$settings = array(";
    foreach ($conf as $group => $data) {
        $string .= "\r\n\r\n\r\n\t\t###### " . strtoupper($group) . " ######";
        $string .= "\r\n\t\t'{$group}' => array(";
        foreach ($data as $key => $value) {
            $string .= "\r\n\t\t\t'{$key}' => " . (strlen($value) > 0 ? "'" . addslashes($value) . "'" : 'NULL') . ",";
        }
        $string .= "\r\n\t\t),";
        $string .= "\r\n\t\t########";
    }
    $string .= "\r\n\t);\n\n";
    return General::writeFile($dest . '/config.php', $string, $mode);
}
开发者ID:psychoticmeow,项目名称:symphony-2,代码行数:16,代码来源:update.php

示例6: editAllNavDssTo

 /**
  * Changes the source of navigation datasources.
  *
  * @static
  *
  * @param string $mode - flag for datasource status.
  */
 public static function editAllNavDssTo($mode)
 {
     $datasources = array_keys(DatasourceManager::listAll());
     if (is_array($datasources) && !empty($datasources)) {
         foreach ($datasources as $value) {
             $filename = WORKSPACE . '/data-sources/data.' . $value . '.php';
             if (is_file($filename) && is_writable($filename)) {
                 $old_content = file_get_contents($filename);
                 if (self::_isDsTypeNavigation($old_content)) {
                     if (method_exists(get_class(), "setNavDsTo{$mode}")) {
                         $new_content = call_user_func(array(self, "setNavDsTo{$mode}"), $old_content);
                         General::writeFile($filename, $new_content);
                     }
                 }
             }
         }
     }
 }
开发者ID:siimsoni,项目名称:page_lhandles,代码行数:25,代码来源:class.PLHDatasourceManager.php

示例7: install

 public function install()
 {
     if (file_exists(MANIFEST . '/jit-precaching.php')) {
         return;
     }
     $string = "<?php\n";
     $string .= "\n\t\$cached_recipes = array(";
     $string .= "\r\n\r\n\t\t/*";
     $string .= "\r\n\t\tarray(";
     $string .= "\r\n\t\t\t'section' => 'section-handle',";
     $string .= "\r\n\t\t\t'field' => 'field-handle',";
     $string .= "\r\n\t\t\t//'recipes' => array('*'),";
     $string .= "\r\n\t\t\t'recipes' => array('gallery', 'profile-small', 'profile-large'),";
     $string .= "\r\n\t\t),";
     $string .= "\r\n\t\t*/";
     $string .= "\r\n\t);\n\n";
     return General::writeFile(MANIFEST . '/jit-precaching.php', $string, Symphony::Configuration()->get('write_mode', 'file'));
 }
开发者ID:nickdunn,项目名称:jit_precaching,代码行数:18,代码来源:extension.driver.php

示例8: __actionIndex

 public function __actionIndex()
 {
     $sections_post = @$_POST['sections'];
     if (empty($this->_driver)) {
         $this->_driver = $this->_Parent->ExtensionManager->create('section_schemas');
     }
     if (@isset($_POST['action']['save'])) {
         $blueprint = new contentBlueprintsDatasources();
         $sm = new SectionManager($this->_Parent);
         $sections = $sm->fetch();
         foreach ($sections as $section) {
             $file = DATASOURCES . '/data.section_schema_' . str_replace('-', '_', $section->_data['handle']) . '.php';
             General::deleteFile($file);
             if (in_array($section->_data['handle'], $sections_post)) {
                 $dsShell = file_get_contents(TEMPLATE . '/datasource.tpl');
                 $dsShell = str_replace("require_once(TOOLKIT . '/class.datasource.php');", "require_once(TOOLKIT . '/class.datasource.php');\n\trequire_once(TOOLKIT . '/class.sectionmanager.php');\n\trequire_once(TOOLKIT . '/class.fieldmanager.php');\n\trequire_once(TOOLKIT . '/class.entrymanager.php');", $dsShell);
                 $dsShell = str_replace('<!-- CLASS NAME -->', 'section_schema_' . str_replace('-', '_', $section->_data['handle']), $dsShell);
                 $dsShell = str_replace('<!-- FILTERS -->', '', $dsShell);
                 $dsShell = str_replace('<!-- INCLUDED ELEMENTS -->', '', $dsShell);
                 $dsShell = str_replace('<!-- DS DEPENDANCY LIST -->', '""', $dsShell);
                 $params['rootelement'] = 'section-schema';
                 $blueprint->__injectVarList($dsShell, $params);
                 $about = array('name' => 'Section Schema: ' . $section->_data['name'], 'version' => '1.0', 'release date' => DateTimeObj::getGMT('c'), 'author name' => $this->_Parent->Author->getFullName(), 'author website' => URL, 'author email' => $this->_Parent->Author->get('email'));
                 $blueprint->__injectAboutInformation($dsShell, $about);
                 $dsShell = str_replace('<!-- SOURCE -->', $section->_data['id'], $dsShell);
                 $dsShell = str_replace('return true;', 'return false;', $dsShell);
                 $dsShell = str_replace('<!-- GRAB -->', "\$extension = \$this->_Parent->ExtensionManager->create('section_schemas');" . self::CRLF . "\t\t\t\t\$extension->getSectionSchema(\$result, \$this->getSource());", $dsShell);
                 $dsShell = str_replace('<!-- EXTRAS -->', '', $dsShell);
                 if (!is_writable(dirname($file)) || !($write = General::writeFile($file, $dsShell, $this->_Parent->Configuration->get('write_mode', 'file')))) {
                     $this->pageAlert(__('Failed to write data sources to <code>%s</code>. Please check permissions.', array(DATASOURCES)), Alert::ERROR);
                 } else {
                     $this->pageAlert('Section Schema data sources saved.', Alert::SUCCESS);
                 }
             }
         }
     }
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:37,代码来源:content.list.php

示例9: writeToLog

 /**
  * This function will write the given message to the log file. Messages will be appended
  * the existing log file.
  *
  * @param string $message
  *  The message to add to the Log
  * @param boolean $addbreak
  *  To be used in conjunction with `$writeToLog`, this will add a line break
  *  before writing this message in the log file. Defaults to true.
  * @return boolean
  *  Returns true if the message was written successfully, false otherwise
  */
 public function writeToLog($message, $addbreak = true)
 {
     if (file_exists($this->_log_path) && !is_writable($this->_log_path)) {
         $this->pushToLog('Could Not Write To Log. It is not readable.');
         return false;
     }
     $permissions = class_exists('Symphony') ? Symphony::Configuration()->get('write_mode', 'file') : '0664';
     return General::writeFile($this->_log_path, $message . ($addbreak ? PHP_EOL : ''), $permissions, 'a+');
 }
开发者ID:davjand,项目名称:codecept-symphonycms-db,代码行数:21,代码来源:class.log.php

示例10: migrateSection

 public static function migrateSection($section_id)
 {
     self::$sectionManager->flush();
     $section = self::$sectionManager->fetch($section_id);
     // Ensures that section has a guid value
     if (!$section->get('guid')) {
         $section->set('guid', uniqid());
         $section->commit();
     }
     $meta = $section->get();
     $fields = array();
     $field_objects = $section->fetchFields();
     if (is_array($field_objects) && !empty($field_objects)) {
         foreach ($field_objects as $f) {
             // Ensures that fields has guid values
             if (!$f->get('guid')) {
                 $f->set('guid', uniqid());
                 self::$fieldManager->edit($f->get('id'), array('guid' => $f->get('guid')));
             }
             $fields[] = $f->get();
         }
     }
     // Creates DOMDocument object
     $xml = new DOMDocument('1.0', 'UTF-8');
     $xml->preserveWhiteSpace = false;
     $xml->formatOutput = true;
     // Section element
     $section = $xml->createElement('section');
     $section->setAttribute('guid', $meta['guid']);
     // Section meta data
     $section_meta = $xml->createElement('meta');
     foreach ($meta as $key => $value) {
         if ($key == 'id') {
             continue;
         }
         $element = $xml->createElement($key, $value);
         $section_meta->appendChild($element);
     }
     // Section fields
     $section_fields = $xml->createElement('fields');
     foreach ($fields as $f) {
         $field = $xml->createElement('entry');
         foreach ($f as $key => $value) {
             if ($key == 'id' || $key == 'field_id') {
                 continue;
             }
             $data = $xml->createElement($key, $value);
             $field->appendChild($data);
         }
         $section_fields->appendChild($field);
     }
     $section->appendChild($section_meta);
     $section->appendChild($section_fields);
     $xml->appendChild($section);
     // Saves output in an external file
     $location = WORKSPACE . "/sections/{$meta['handle']}.xml";
     $output = $xml->saveXML();
     General::writeFile($location, $output, Symphony::Configuration()->get('write_mode', 'file'));
 }
开发者ID:rainerborene,项目名称:schema_migration,代码行数:59,代码来源:class.migrationmanager.php

示例11: save

 public function save(MessageStack $errors)
 {
     $editing = isset($this->parameters()->{'root-element'}) ? $this->parameters()->{'root-element'} : false;
     // About info:
     if (!isset($this->about()->name) || empty($this->about()->name)) {
         $errors->append('about::name', __('This is a required field'));
     }
     try {
         $existing = self::loadFromHandle($this->handle);
     } catch (DataSourceException $e) {
         //	Datasource not found, continue!
     }
     if ($existing instanceof Datasource && $editing != $this->handle) {
         throw new DataSourceException(__('A Datasource with the name <code>%s</code> already exists', array($this->about()->name)));
     }
     // Save type:
     if ($errors->length() <= 0) {
         $user = Administration::instance()->User;
         if (!file_exists($this->getTemplate())) {
             $errors->append('write', __("Unable to find Data Source Type template '%s'.", array($this->getTemplate())));
             throw new DataSourceException(__("Unable to find Data Source Type template '%s'.", array($this->getTemplate())));
         }
         $this->parameters()->{'root-element'} = $this->handle;
         $classname = Lang::createHandle(ucwords($this->about()->name), '_', false, true, array('/[^a-zA-Z0-9_\\x7f-\\xff]/' => NULL), true);
         $pathname = DATASOURCES . "/" . $this->handle . ".php";
         $data = array($classname, var_export($this->about()->name, true), var_export($user->getFullName(), true), var_export(URL, true), var_export($user->email, true), var_export('1.0', true), var_export(DateTimeObj::getGMT('c'), true));
         foreach ($this->parameters() as $value) {
             $data[] = trim(General::var_export($value, true, is_array($value) ? 5 : 0));
         }
         if (General::writeFile($pathname, vsprintf(file_get_contents($this->getTemplate()), $data), Symphony::Configuration()->core()->symphony->{'file-write-mode'})) {
             if ($editing !== false && $editing != $this->handle) {
                 General::deleteFile(DATASOURCES . '/' . $editing . '.php');
             }
             return $pathname;
         }
         $errors->append('write', __('Failed to write datasource "%s" to disk.', array($filename)));
     }
     throw new DataSourceException('Errors were encountered whilst attempting to save.');
 }
开发者ID:symphonycms,项目名称:symphony-3,代码行数:39,代码来源:class.datasource.php

示例12: __actionEdit

 function __actionEdit()
 {
     if (!($page_id = $this->_context[1])) {
         redirect(URL . '/symphony/blueprints/pages/');
     }
     if (@array_key_exists('delete', $_POST['action'])) {
         ## TODO: Fix Me
         ###
         # Delegate: Delete
         # Description: Prior to deletion. Provided with Page's database ID
         //$ExtensionManager->notifyMembers('Delete', getCurrentPage(), array('page' => $page_id));
         $page = $this->_Parent->Database->fetchRow(0, "SELECT * FROM tbl_pages WHERE `id` = '{$page_id}'");
         $filename = $page['path'] . '_' . $page['handle'];
         $filename = trim(str_replace('/', '_', $filename), '_');
         $this->_Parent->Database->delete('tbl_pages', " `id` = '{$page_id}'");
         $this->_Parent->Database->delete('tbl_pages_types', " `page_id` = '{$page_id}'");
         $this->_Parent->Database->query("UPDATE tbl_pages SET `sortorder` = (`sortorder` + 1) WHERE `sortorder` < '{$page_id}'");
         General::deleteFile(PAGES . "/{$filename}.xsl");
         redirect(URL . '/symphony/blueprints/pages/');
     } elseif (@array_key_exists('save', $_POST['action'])) {
         $fields = $_POST['fields'];
         $this->_errors = array();
         if (!isset($fields['body']) || trim($fields['body']) == '') {
             $this->_errors['body'] = __('Body is a required field');
         } elseif (!General::validateXML($fields['body'], $errors, false, new XSLTProcess())) {
             $this->_errors['body'] = __('This document is not well formed. The following error was returned: <code>%s</code>', array($errors[0]['message']));
         }
         if (!isset($fields['title']) || trim($fields['title']) == '') {
             $this->_errors['title'] = __('Title is a required field');
         }
         if (trim($fields['type']) != '' && preg_match('/(index|404|403)/i', $fields['type'])) {
             $haystack = strtolower($fields['type']);
             if (preg_match('/\\bindex\\b/i', $haystack, $matches) && ($row = $this->_Parent->Database->fetchRow(0, "SELECT * FROM `tbl_pages_types` WHERE `page_id` != '{$page_id}' AND `type` = 'index' LIMIT 1"))) {
                 $this->_errors['type'] = __('An index type page already exists.');
             } elseif (preg_match('/\\b404\\b/i', $haystack, $matches) && ($row = $this->_Parent->Database->fetchRow(0, "SELECT * FROM `tbl_pages_types` WHERE `page_id` != '{$page_id}' AND `type` = '404' LIMIT 1"))) {
                 $this->_errors['type'] = __('A 404 type page already exists.');
             } elseif (preg_match('/\\b403\\b/i', $haystack, $matches) && ($row = $this->_Parent->Database->fetchRow(0, "SELECT * FROM `tbl_pages_types` WHERE `page_id` != '{$page_id}' AND `type` = '403' LIMIT 1"))) {
                 $this->_errors['type'] = __('A 403 type page already exists.');
             }
         }
         if (empty($this->_errors)) {
             ## Manipulate some fields
             //$fields['sortorder'] = $this->_Parent->Database->fetchVar('next', 0, "SELECT MAX(sortorder) + 1 as `next` FROM `tbl_pages` LIMIT 1");
             //
             //if(empty($fields['sortorder']) || !is_numeric($fields['sortorder'])) $fields['sortorder'] = 1;
             $autogenerated_handle = false;
             if (trim($fields['handle']) == '') {
                 $fields['handle'] = $fields['title'];
                 $autogenerated_handle = true;
             }
             $fields['handle'] = Lang::createHandle($fields['handle']);
             if ($fields['params']) {
                 $fields['params'] = trim(preg_replace('@\\/{2,}@', '/', $fields['params']), '/');
             }
             ## Clean up type list
             $types = preg_split('/,\\s*/', $fields['type'], -1, PREG_SPLIT_NO_EMPTY);
             $types = @array_map('trim', $types);
             unset($fields['type']);
             //if(trim($fields['type'])) $fields['type'] = preg_replace('/\s*,\s*/i', ', ', $fields['type']);
             //else $fields['type'] = NULL;
             ## Manipulate some fields
             $fields['parent'] = $fields['parent'] != 'None' ? $fields['parent'] : NULL;
             $fields['data_sources'] = @implode(',', $fields['data_sources']);
             $fields['events'] = @implode(',', $fields['events']);
             $fields['path'] = NULL;
             if ($fields['parent']) {
                 $fields['path'] = $this->_Parent->resolvePagePath(intval($fields['parent']));
             }
             $new_filename = trim(str_replace('/', '_', $fields['path'] . '_' . $fields['handle']), '_');
             $current = $this->_Parent->Database->fetchRow(0, "SELECT * FROM `tbl_pages` WHERE `id` = '{$page_id}' LIMIT 1");
             $current_filename = $current['path'] . '_' . $current['handle'];
             $current_filename = trim(str_replace('/', '_', $current_filename), '_');
             ## Duplicate
             if ($this->_Parent->Database->fetchRow(0, "SELECT * FROM `tbl_pages` \r\n\t\t\t\t\t\t\t\t\t\t WHERE `handle` = '" . $fields['handle'] . "' \r\n\t\t\t\t\t\t\t\t\t\t AND `id` != '{$page_id}' \r\n\t\t\t\t\t\t\t\t\t\t AND `path` " . ($fields['path'] ? " = '" . $fields['path'] . "'" : ' IS NULL') . " \r\n\t\t\t\t\t\t\t\t\t\t LIMIT 1")) {
                 if ($autogenerated_handle) {
                     $this->_errors['title'] = __('A page with that title %s already exists', array($fields['parent'] ? __('and parent') : ''));
                 } else {
                     $this->_errors['handle'] = __('A page with that handle %s already exists', array($fields['parent'] ? __('and parent') : ''));
                 }
             } else {
                 ## Write the file
                 if (!($write = General::writeFile(PAGES . "/{$new_filename}.xsl", $fields['body'], $this->_Parent->Configuration->get('write_mode', 'file')))) {
                     $this->pageAlert(__('Page could not be written to disk. Please check permissions on <code>/workspace/pages</code>.'), Alert::ERROR);
                 } else {
                     if ($new_filename != $current_filename) {
                         @unlink(PAGES . "/{$current_filename}.xsl");
                     }
                     ## No longer need the body text
                     unset($fields['body']);
                     ## Insert the new data
                     if (!$this->_Parent->Database->update($fields, 'tbl_pages', "`id` = '{$page_id}'")) {
                         $this->pageAlert(__('Unknown errors occurred while attempting to save. Please check your <a href="%s">activity log</a>.', array(URL . '/symphony/system/log/')), Alert::ERROR);
                     } else {
                         $this->_Parent->Database->delete('tbl_pages_types', " `page_id` = '{$page_id}'");
                         if (is_array($types) && !empty($types)) {
                             foreach ($types as $type) {
                                 $this->_Parent->Database->insert(array('page_id' => $page_id, 'type' => $type), 'tbl_pages_types');
                             }
                         }
                         ## TODO: Fix Me
//.........这里部分代码省略.........
开发者ID:bauhouse,项目名称:sym-fluid960gs,代码行数:101,代码来源:content.blueprintspages.php

示例13: saveConfig

 function saveConfig()
 {
     if (!defined('DOMAIN')) {
         $clean_path = $_SERVER["HTTP_HOST"] . dirname($_SERVER["PHP_SELF"]);
         $clean_path = rtrim($clean_path, '/\\');
         $clean_path = preg_replace('/\\/{2,}/i', '/', $clean_path);
         ## Strip the /symphony part from the URL
         $clean_path = substr($clean_path, 0, strlen($clean_path) - 9);
         define('DOMAIN', $clean_path);
     }
     $string = '<?php' . CRLF . "define('DOCROOT','" . DOCROOT . "');" . CRLF . "define('DOMAIN','" . DOMAIN . "');" . CRLF . CRLF . '$settings = array();' . CRLF;
     $string .= $this->_config->create("php");
     $string .= CRLF . "require_once(DOCROOT . '/symphony/lib/boot/bundle.php');" . CRLF . '?>';
     return General::writeFile(CONFIG, $string, $this->getConfigVar("write_mode", "file"));
 }
开发者ID:symphonycms,项目名称:symphony-1.7,代码行数:15,代码来源:class.admin.php

示例14: writePageFiles

 /**
  * A wrapper for `General::writeFile`, this function takes a `$path`
  * and a `$data` and writes the new template to disk.
  *
  * @param string $path
  *  The path to write the template to
  * @param string $data
  *  The contents of the template
  * @return boolean
  *  True when written successfully, false otherwise
  */
 public static function writePageFiles($path, $data)
 {
     return General::writeFile($path, $data, Symphony::Configuration()->get('write_mode', 'file'));
 }
开发者ID:nickdunn,项目名称:elasticsearch-surfin-shakespeare,代码行数:15,代码来源:class.pagemanager.php

示例15: __formAction


//.........这里部分代码省略.........
                 * @param string $context
                 * '/blueprints/events/(edit|new|info)/'
                 * @param array $selected
                 *  An array of all the selected filters for this Event
                 * @param array $documentation
                 *  An array of all the documentation XMLElements, passed by reference
                 */
                Symphony::ExtensionManager()->notifyMembers('AppendEventFilterDocumentation', '/blueprints/events/' . $this->_context[0] . '/', array('selected' => $filters, 'documentation' => &$documentation_parts));
                $documentation = join(PHP_EOL, array_map(create_function('$x', 'return rtrim($x->generate(true, 4));'), $documentation_parts));
                $documentation = str_replace('\'', '\\\'', $documentation);
                $eventShell = str_replace('<!-- CLASS EXTENDS -->', $extends, $eventShell);
                $eventShell = str_replace('<!-- DOCUMENTATION -->', General::tabsToSpaces($documentation, 2), $eventShell);
            }
            $eventShell = str_replace('<!-- ROOT ELEMENT -->', $rootelement, $eventShell);
            $eventShell = str_replace('<!-- CLASS NAME -->', $classname, $eventShell);
            $eventShell = str_replace('<!-- SOURCE -->', $source, $eventShell);
            // Remove left over placeholders
            $eventShell = preg_replace(array('/<!--[\\w ]++-->/'), '', $eventShell);
            if ($this->_context[0] == 'new') {
                /**
                 * Prior to creating an Event, the file path where it will be written to
                 * is provided and well as the contents of that file.
                 *
                 * @delegate EventsPreCreate
                 * @since Symphony 2.2
                 * @param string $context
                 * '/blueprints/events/'
                 * @param string $file
                 *  The path to the Event file
                 * @param string $contents
                 *  The contents for this Event as a string passed by reference
                 * @param array $filters
                 *  An array of the filters attached to this event
                 */
                Symphony::ExtensionManager()->notifyMembers('EventPreCreate', '/blueprints/events/', array('file' => $file, 'contents' => &$eventShell, 'filters' => $filters));
            } else {
                /**
                 * Prior to editing an Event, the file path where it will be written to
                 * is provided and well as the contents of that file.
                 *
                 * @delegate EventPreEdit
                 * @since Symphony 2.2
                 * @param string $context
                 * '/blueprints/events/'
                 * @param string $file
                 *  The path to the Event file
                 * @param string $contents
                 *  The contents for this Event as a string passed by reference
                 * @param array $filters
                 *  An array of the filters attached to this event
                 */
                Symphony::ExtensionManager()->notifyMembers('EventPreEdit', '/blueprints/events/', array('file' => $file, 'contents' => &$eventShell, 'filters' => $filters));
            }
            // Write the file
            if (!is_writable(dirname($file)) || !($write = General::writeFile($file, $eventShell, Symphony::Configuration()->get('write_mode', 'file')))) {
                $this->pageAlert(__('Failed to write Event to disk.') . ' ' . __('Please check permissions on %s.', array('<code>/workspace/events</code>')), Alert::ERROR);
            } else {
                if ($queueForDeletion) {
                    General::deleteFile($queueForDeletion);
                    $pages = PageManager::fetch(false, array('events', 'id'), array("\n\t\t\t\t\t\t\t`events` REGEXP '[[:<:]]" . $existing_handle . "[[:>:]]'\n\t\t\t\t\t\t"));
                    if (is_array($pages) && !empty($pages)) {
                        foreach ($pages as $page) {
                            $page['events'] = preg_replace('/\\b' . $existing_handle . '\\b/i', $classname, $page['events']);
                            PageManager::edit($page['id'], $page);
                        }
                    }
                }
                if ($this->_context[0] == 'new') {
                    /**
                     * After creating the Event, the path to the Event file is provided
                     *
                     * @delegate EventPostCreate
                     * @since Symphony 2.2
                     * @param string $context
                     * '/blueprints/events/'
                     * @param string $file
                     *  The path to the Event file
                     */
                    Symphony::ExtensionManager()->notifyMembers('EventPostCreate', '/blueprints/events/', array('file' => $file));
                } else {
                    /**
                     * After editing the Event, the path to the Event file is provided
                     *
                     * @delegate EventPostEdit
                     * @since Symphony 2.2
                     * @param string $context
                     * '/blueprints/events/'
                     * @param string $file
                     *  The path to the Event file
                     * @param string $previous_file
                     *  The path of the previous Event file in the case where an Event may
                     *  have been renamed. To get the handle from this value, see
                     *  `EventManager::__getHandleFromFilename`
                     */
                    Symphony::ExtensionManager()->notifyMembers('EventPostEdit', '/blueprints/events/', array('file' => $file, 'previous_file' => $queueForDeletion ? $queueForDeletion : null));
                }
                redirect(SYMPHONY_URL . '/blueprints/events/edit/' . $classname . '/' . ($this->_context[0] == 'new' ? 'created' : 'saved') . '/');
            }
        }
    }
开发者ID:hananils,项目名称:pompodium,代码行数:101,代码来源:content.blueprintsevents.php


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