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


PHP General::realiseDirectory方法代码示例

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


在下文中一共展示了General::realiseDirectory方法的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: update

 public function update($previousVersion = false)
 {
     if (version_compare($previousVersion, '1.21', '<')) {
         // Simplify JIT htaccess rule [#75]
         try {
             $htaccess = file_get_contents(DOCROOT . '/.htaccess');
             $htaccess = str_replace('RewriteRule ^image\\/(.+\\.(jpg|gif|jpeg|png|bmp))$', 'RewriteRule ^image\\/(.+)$', $htaccess);
         } catch (Exception $ex) {
             if (!file_put_contents(DOCROOT . '/.htaccess', $htaccess)) {
                 Administration::instance()->Page->pageAlert(__('An error occurred while updating %s. %s', array(__('JIT Image Manipulation'), $ex->getMessage())), Alert::ERROR);
                 return false;
             }
         }
     }
     if (version_compare($previousVersion, '1.17', '<')) {
         // Add [B] flag to the .htaccess rule [#37]
         try {
             $htaccess = file_get_contents(DOCROOT . '/.htaccess');
             $htaccess = str_replace('extensions/jit_image_manipulation/lib/image.php?param={$token} [L,NC]', 'extensions/jit_image_manipulation/lib/image.php?param={$token} [B,L,NC]', $htaccess);
         } catch (Exception $ex) {
             if (!file_put_contents(DOCROOT . '/.htaccess', $htaccess)) {
                 Administration::instance()->Page->pageAlert(__('An error occurred while updating %s. %s', array(__('JIT Image Manipulation'), $ex->getMessage())), Alert::ERROR);
                 return false;
             }
         }
     }
     if (version_compare($previousVersion, '1.15', '<')) {
         // Move /manifest/jit-trusted-sites into /workspace/jit-image-manipulation
         if (General::realiseDirectory(WORKSPACE . '/jit-image-manipulation', Symphony::Configuration()->get('write_mode', 'directory')) && file_exists(MANIFEST . '/jit-trusted-sites')) {
             rename(MANIFEST . '/jit-trusted-sites', WORKSPACE . '/jit-image-manipulation/trusted-sites');
         }
     }
 }
开发者ID:davjand,项目名称:codecept-symphonycms-db,代码行数:33,代码来源:extension.driver.php

示例3: install

 public function install()
 {
     Symphony::Configuration()->set('lang', 'en', 'redactor');
     Symphony::Configuration()->set('direction_ltr', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_toolbar', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_source', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_focus', 'no', 'redactor');
     Symphony::Configuration()->set('enable_shortcuts', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_autoresizing', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_cleanup', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_fixed', 'no', 'redactor');
     Symphony::Configuration()->set('enable_fixedbox', 'no', 'redactor');
     Symphony::Configuration()->set('enable_paragraphy', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_convertlinks', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_convertdivs', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_fileupload', 'no', 'redactor');
     Symphony::Configuration()->set('enable_imageupload', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_overlay', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_observeimages', 'yes', 'redactor');
     Symphony::Configuration()->set('enable_airmode', 'no', 'redactor');
     Symphony::Configuration()->set('enable_wym', 'no', 'redactor');
     Symphony::Configuration()->set('enable_mobile', 'yes', 'redactor');
     Symphony::Configuration()->set('buttons', implode($this->buttons, ','), 'redactor');
     Symphony::Configuration()->set('airbuttons', implode($this->airbuttons, ','), 'redactor');
     Symphony::Configuration()->set('allowedtags', implode($this->allowedtags, ','), 'redactor');
     Symphony::Configuration()->set('filepath', WORKSPACE . '/redactor/files', 'redactor');
     Symphony::Configuration()->set('imagepath', WORKSPACE . '/redactor/images', 'redactor');
     Symphony::Configuration()->write();
     return General::realiseDirectory(Symphony::Configuration()->get('filepath', 'redactor')) && General::realiseDirectory(Symphony::Configuration()->get('imagepath', 'redactor'));
 }
开发者ID:remie,项目名称:richtext_redactor,代码行数:30,代码来源:extension.driver.php

示例4: install

 public function install()
 {
     $result = true;
     if (!file_exists(TEXTFORMATTERS)) {
         $result = General::realiseDirectory(TEXTFORMATTERS, $this->_Parent->Configuration->get('write_mode', 'directory'));
     }
     return $result;
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:8,代码来源:extension.driver.php

示例5: install

 public function install()
 {
     $result = true;
     if (!file_exists(TEXTFORMATTERS)) {
         $result = General::realiseDirectory(TEXTFORMATTERS, Symphony::Configuration()->get('write_mode', 'directory'));
     }
     return $result;
 }
开发者ID:ahwayakchih,项目名称:templatedtextformatters,代码行数:8,代码来源:extension.driver.php

示例6: install

 public function install()
 {
     @General::realiseDirectory(WORKSPACE . '/sections');
     @General::realiseDirectory(WORKSPACE . '/pages');
     Symphony::Database()->query("ALTER TABLE `tbl_sections` ADD `guid` varchar(13) NOT NULL AFTER `navigation_group`");
     Symphony::Database()->query("ALTER TABLE `tbl_fields` ADD `guid` varchar(13) NOT NULL AFTER `show_column`");
     Symphony::Database()->query("ALTER TABLE `tbl_pages` ADD `guid` varchar(13) NOT NULL AFTER `sortorder`");
     return true;
 }
开发者ID:rainerborene,项目名称:schema_migration,代码行数:9,代码来源:extension.driver.php

示例7: update

 public function update($previousVersion = false)
 {
     if (version_compare($previousVersion, '1.15', '<')) {
         // Move /manifest/jit-trusted-sites into /workspace/jit-image-manipulation
         if (General::realiseDirectory(WORKSPACE . '/jit-image-manipulation', Symphony::Configuration()->get('write_mode', 'directory')) && file_exists(MANIFEST . '/jit-trusted-sites')) {
             rename(MANIFEST . '/jit-trusted-sites', WORKSPACE . '/jit-image-manipulation/trusted-sites');
         }
     }
 }
开发者ID:nils-werner,项目名称:jit_image_manipulation,代码行数:9,代码来源:extension.driver.php

示例8: 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

示例9: update

 public function update($previousVersion = false)
 {
     require_once 'lib/class.htaccess.php';
     $htaccess = new HTAccess();
     if ($htaccess->exists() && !$htaccess->is_writable()) {
         throw new Exception(__('.htaccess exists but is not writable.'));
     }
     if (version_compare($previousVersion, '1.15', '<')) {
         // Move /manifest/jit-trusted-sites into /workspace/jit-image-manipulation
         if (General::realiseDirectory(WORKSPACE . '/jit-image-manipulation', Symphony::Configuration()->get('write_mode', 'directory')) && file_exists(MANIFEST . '/jit-trusted-sites')) {
             if (!@rename(MANIFEST . '/jit-trusted-sites', WORKSPACE . '/jit-image-manipulation/trusted-sites')) {
                 $message = __('An error occured while updating %s. Could not move the trusted file to %s', array(__('JIT Image Manipulation'), WORKSPACE . '/jit-image-manipulation/trusted-sites'));
                 throw new Exception($message);
             }
         }
     }
     if (version_compare($previousVersion, '1.17', '<')) {
         // Add [B] flag to the .htaccess rule [#37]
         try {
             if ($htaccess->exists()) {
                 $htaccess->addBFlagToRule();
             }
         } catch (Exception $ex) {
             $message = __('An error occured while updating %s. %s', array(__('JIT Image Manipulation'), $ex->getMessage()));
             throw new Exception($message);
         }
     }
     if (version_compare($previousVersion, '1.21', '<')) {
         try {
             // Simplify JIT htaccess rule [#75]
             if ($htaccess->exists()) {
                 $htaccess->simplifyJITAccessRule();
             }
         } catch (Exception $ex) {
             $message = __('An error occured while updating %s. %s', array(__('JIT Image Manipulation'), $ex->getMessage()));
             throw new Exception($message);
         }
     }
     if (version_compare($previousVersion, '2.0.0', '<')) {
         try {
             if ($htaccess->exists()) {
                 $htaccess->transformRuleToSymphonyLauncher();
             }
         } catch (Exception $ex) {
             $message = __('An error occured while updating %s. %s', array(__('JIT Image Manipulation'), $ex->getMessage()));
             throw new Exception($message);
         }
     }
 }
开发者ID:symphonycms,项目名称:jit_image_manipulation,代码行数:49,代码来源:extension.driver.php

示例10: install

 public function install()
 {
     General::realiseDirectory(CACHE . '/sass_compiler/', Symphony::Configuration()->get('write_mode', 'directory'));
     $htaccess = @file_get_contents(DOCROOT . '/.htaccess');
     if ($htaccess === false) {
         return false;
     }
     ## Cannot use $1 in a preg_replace replacement string, so using a token instead
     $token = md5(time());
     $rule = "\n\t### SASS RULES\n\tRewriteRule ^sass\\/(.+\\.sass)\$ extensions/sass_compiler/lib/sass.php?mode=sass&param={$token} [L,NC]\n\tRewriteRule ^scss\\/(.+\\.scss)\$ extensions/sass_compiler/lib/sass.php?mode=scss&param={$token} [L,NC]\n\n";
     ## Remove existing rules
     $htaccess = self::__removeSassRules($htaccess);
     if (preg_match('/### SASS RULES/', $htaccess)) {
         $htaccess = preg_replace('/### SASS RULES/', $rule, $htaccess);
     } else {
         $htaccess = preg_replace('/RewriteRule .\\* - \\[S=14\\]\\s*/i', "RewriteRule .* - [S=14]\n{$rule}\t", $htaccess);
     }
     ## Replace the token with the real value
     $htaccess = str_replace($token, '$1', $htaccess);
     return @file_put_contents(DOCROOT . '/.htaccess', $htaccess);
 }
开发者ID:korelogic,项目名称:sass_compiler,代码行数:21,代码来源:extension.driver.php

示例11: __buildCacheFilename

 /**
  * Serialises the data source object properties into a checksum hash to see
  * whether the data source is currently cached, and whether it has expired.
  * Returns boolean of whether the data source is stale or not.
  *
  * @param Datasource $datasource
  *  The current data source object
  * @param string $filename
  *  Cache filename, passed by reference
  * @param int $file_age
  *  Cache file age (in seconds), passed by reference
  */
 private function __buildCacheFilename($datasource, &$filename, &$file_age)
 {
     $filename = null;
     // Checks if cacheabledatasource directory exists. If not, try to restore.
     if (!file_exists(CACHE . '/cacheabledatasource')) {
         if (!General::realiseDirectory(CACHE . '/cacheabledatasource', Symphony::Configuration()->get('write_mode', 'directory'))) {
             throw new Exception(__('Cacheable Datasource: Cache directory could not be restored at %s.', array('<code>/manifest/cache/cacheabledatasource</code>')));
         }
     }
     // get resolved values of each public property of this DS
     // (sort, filters, included elements etc.)
     foreach (get_class_vars(get_class($datasource)) as $key => $value) {
         if (substr($key, 0, 2) == 'ds') {
             $value = $datasource->{$key};
             $filename .= $key . (is_array($value) ? http_build_query($value) : $value);
         }
     }
     $filename = sprintf("%s/cache/cacheabledatasource/%s_%s.xml", MANIFEST, preg_replace("/^datasource/", '', get_class($datasource)), md5($filename));
     if (!file_exists($filename)) {
         return false;
     }
     $file_age = (int) floor(time() - filemtime($filename));
     return $file_age < $datasource->dsParamCACHE;
 }
开发者ID:symphonists,项目名称:cacheabledatasource,代码行数:36,代码来源:extension.driver.php

示例12: __install

 private static function __install()
 {
     $fields = $_POST['fields'];
     $start = time();
     Symphony::Log()->writeToLog(PHP_EOL . '============================================', true);
     Symphony::Log()->writeToLog('INSTALLATION PROCESS STARTED (' . DateTimeObj::get('c') . ')', true);
     Symphony::Log()->writeToLog('============================================', true);
     // MySQL: Establishing connection
     Symphony::Log()->pushToLog('MYSQL: Establishing Connection', E_NOTICE, true, true);
     try {
         Symphony::Database()->connect($fields['database']['host'], $fields['database']['user'], $fields['database']['password'], $fields['database']['port'], $fields['database']['db']);
     } catch (DatabaseException $e) {
         self::__abort('There was a problem while trying to establish a connection to the MySQL server. Please check your settings.', $start);
     }
     // MySQL: Setting prefix & character encoding
     Symphony::Database()->setPrefix($fields['database']['tbl_prefix']);
     Symphony::Database()->setCharacterEncoding();
     Symphony::Database()->setCharacterSet();
     // MySQL: Importing schema
     Symphony::Log()->pushToLog('MYSQL: Importing Table Schema', E_NOTICE, true, true);
     try {
         Symphony::Database()->import(file_get_contents(INSTALL . '/includes/install.sql'), true);
     } catch (DatabaseException $e) {
         self::__abort('There was an error while trying to import data to the database. MySQL returned: ' . $e->getDatabaseErrorCode() . ': ' . $e->getDatabaseErrorMessage(), $start);
     }
     // MySQL: Creating default author
     Symphony::Log()->pushToLog('MYSQL: Creating Default Author', E_NOTICE, true, true);
     try {
         Symphony::Database()->insert(array('id' => 1, 'username' => Symphony::Database()->cleanValue($fields['user']['username']), 'password' => Cryptography::hash(Symphony::Database()->cleanValue($fields['user']['password'])), 'first_name' => Symphony::Database()->cleanValue($fields['user']['firstname']), 'last_name' => Symphony::Database()->cleanValue($fields['user']['lastname']), 'email' => Symphony::Database()->cleanValue($fields['user']['email']), 'last_seen' => NULL, 'user_type' => 'developer', 'primary' => 'yes', 'default_area' => NULL, 'auth_token_active' => 'no'), 'tbl_authors');
     } catch (DatabaseException $e) {
         self::__abort('There was an error while trying create the default author. MySQL returned: ' . $e->getDatabaseErrorCode() . ': ' . $e->getDatabaseErrorMessage(), $start);
     }
     // Configuration: Populating array
     $conf = Symphony::Configuration()->get();
     foreach ($conf as $group => $settings) {
         foreach ($settings as $key => $value) {
             if (isset($fields[$group]) && isset($fields[$group][$key])) {
                 $conf[$group][$key] = $fields[$group][$key];
             }
         }
     }
     // Create manifest folder structure
     Symphony::Log()->pushToLog('WRITING: Creating ‘manifest’ folder (/manifest)', E_NOTICE, true, true);
     if (!General::realiseDirectory(DOCROOT . '/manifest', $conf['directory']['write_mode'])) {
         self::__abort('Could not create ‘manifest’ directory. Check permission on the root folder.', $start);
     }
     Symphony::Log()->pushToLog('WRITING: Creating ‘logs’ folder (/manifest/logs)', E_NOTICE, true, true);
     if (!General::realiseDirectory(DOCROOT . '/manifest/logs', $conf['directory']['write_mode'])) {
         self::__abort('Could not create ‘logs’ directory. Check permission on /manifest.', $start);
     }
     Symphony::Log()->pushToLog('WRITING: Creating ‘cache’ folder (/manifest/cache)', E_NOTICE, true, true);
     if (!General::realiseDirectory(DOCROOT . '/manifest/cache', $conf['directory']['write_mode'])) {
         self::__abort('Could not create ‘cache’ directory. Check permission on /manifest.', $start);
     }
     Symphony::Log()->pushToLog('WRITING: Creating ‘tmp’ folder (/manifest/tmp)', E_NOTICE, true, true);
     if (!General::realiseDirectory(DOCROOT . '/manifest/tmp', $conf['directory']['write_mode'])) {
         self::__abort('Could not create ‘tmp’ directory. Check permission on /manifest.', $start);
     }
     // Writing configuration file
     Symphony::Log()->pushToLog('WRITING: Configuration File', E_NOTICE, true, true);
     Symphony::Configuration()->setArray($conf);
     if (!Symphony::Configuration()->write(CONFIG, $conf['file']['write_mode'])) {
         self::__abort('Could not create config file ‘' . CONFIG . '’. Check permission on /manifest.', $start);
     }
     // Writing htaccess file
     Symphony::Log()->pushToLog('CONFIGURING: Frontend', E_NOTICE, true, true);
     $rewrite_base = ltrim(preg_replace('/\\/install$/i', NULL, dirname($_SERVER['PHP_SELF'])), '/');
     $htaccess = str_replace('<!-- REWRITE_BASE -->', $rewrite_base, file_get_contents(INSTALL . '/includes/htaccess.txt'));
     if (!General::writeFile(DOCROOT . "/.htaccess", $htaccess, $conf['file']['write_mode'], 'a')) {
         self::__abort('Could not write ‘.htaccess’ file. Check permission on ' . DOCROOT, $start);
     }
     // Writing /workspace folder
     if (!is_dir(DOCROOT . '/workspace')) {
         // Create workspace folder structure
         Symphony::Log()->pushToLog('WRITING: Creating ‘workspace’ folder (/workspace)', E_NOTICE, true, true);
         if (!General::realiseDirectory(DOCROOT . '/workspace', $conf['directory']['write_mode'])) {
             self::__abort('Could not create ‘workspace’ directory. Check permission on the root folder.', $start);
         }
         Symphony::Log()->pushToLog('WRITING: Creating ‘data-sources’ folder (/workspace/data-sources)', E_NOTICE, true, true);
         if (!General::realiseDirectory(DOCROOT . '/workspace/data-sources', $conf['directory']['write_mode'])) {
             self::__abort('Could not create ‘workspace/data-sources’ directory. Check permission on the root folder.', $start);
         }
         Symphony::Log()->pushToLog('WRITING: Creating ‘events’ folder (/workspace/events)', E_NOTICE, true, true);
         if (!General::realiseDirectory(DOCROOT . '/workspace/events', $conf['directory']['write_mode'])) {
             self::__abort('Could not create ‘workspace/events’ directory. Check permission on the root folder.', $start);
         }
         Symphony::Log()->pushToLog('WRITING: Creating ‘pages’ folder (/workspace/pages)', E_NOTICE, true, true);
         if (!General::realiseDirectory(DOCROOT . '/workspace/pages', $conf['directory']['write_mode'])) {
             self::__abort('Could not create ‘workspace/pages’ directory. Check permission on the root folder.', $start);
         }
         Symphony::Log()->pushToLog('WRITING: Creating ‘utilities’ folder (/workspace/utilities)', E_NOTICE, true, true);
         if (!General::realiseDirectory(DOCROOT . '/workspace/utilities', $conf['directory']['write_mode'])) {
             self::__abort('Could not create ‘workspace/utilities’ directory. Check permission on the root folder.', $start);
         }
     } else {
         Symphony::Log()->pushToLog('An existing ‘workspace’ directory was found at this location. Symphony will use this workspace.', E_NOTICE, true, true);
         // MySQL: Importing workspace data
         Symphony::Log()->pushToLog('MYSQL: Importing Workspace Data...', E_NOTICE, true, true);
         if (is_file(DOCROOT . '/workspace/install.sql')) {
             try {
//.........这里部分代码省略.........
开发者ID:hananils,项目名称:pompodium,代码行数:101,代码来源:class.installer.php

示例13: __viewIndex

 public function __viewIndex()
 {
     $this->setPageType('form');
     $this->Form->setAttribute('enctype', 'multipart/form-data');
     $this->setTitle('Symphony &ndash; Add Multiple Files From a Folder');
     $this->appendSubheading('Upload!');
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild(new XMLElement('legend', 'Essentials'));
     $p = new XMLElement('p');
     $p->setAttribute('id', 'guideme');
     $p->setValue('Upload some files. They will be put under a directory named: <b>/workspace' . $this->_driver->getMUI() . '/' . date('Y-m-d') . '.</b>');
     $fileinput = new XMLElement('div');
     $fileinput->setAttribute('id', 'fileInput');
     $input = Widget::Input('fileInput', null, 'file');
     $input->setAttribute('style', 'display:none');
     $input->setAttribute('height', '30');
     $input->setAttribute('width', '110');
     $input->setAttribute('id', 'fileInput');
     $script = new XMLElement('script');
     $script->setAttribute("type", 'text/javascript');
     $folder_name = date("Y-m-d");
     $path = preg_replace('/^http\\:\\/\\/.*\\//i', '', URL);
     if (preg_match('/http\\:\\/\\//i', $path)) {
         $path = '';
     }
     if (!General::realiseDirectory(WORKSPACE . $this->_driver->getMUI() . '/' . $folder_name, intval('0755', 8))) {
     }
     // could already exist echo "failed!";
     // echo $path;
     // echo WORKSPACE.$this->upload.'/'.$folder_name;
     // echo $_SERVER['DOCUMENT_ROOT']."/".$path."/workspace".$this->_driver->getMUI()."/".$folder_name;
     // echo $folder_name;
     $js = "\n\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\$('#fileInput').fileUpload ({\n\t\t\t\t\t\t'uploader'  : '" . URL . "/extensions/massuploadutility/assets/uploader.swf',\n\t\t\t\t\t\t'script'    : '" . ($path != '' ? '/' . $path : '') . "/extensions/massuploadutility/assets/upload.php',\n\t\t\t\t\t\t'cancelImg' : '" . URL . "/extensions/massuploadutility/assets/cancel.png',\n\t\t\t\t\t\t'auto'      : true,\n\t\t\t\t\t  'displayData': 'speed',\n\t\t\t\t\t  'simUploadLimit': 2,\n\t\t\t\t\t\t'folder'    : '" . ($path != '' ? '/' . $path : '') . "/workspace" . $this->_driver->getMUI() . "/" . $folder_name . "',\n\t\t\t\t\t  'multi'\t\t\t: true,\n\t\t\t      'onAllComplete': function(event, queueID, fileObj, response, data) { \$('#guideme').html('Upload complete! <b>Add more or click the button that says Process Files!</b>'); \$('#uploadcomplete').show(); },\n\t\t\t\t\t\t'onError': function (a, b, c, d) {\n\t\t\t\t\t\t\tif (d.status == 404)\n\t\t\t\t\t\t\t\talert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>');\n\t\t\t\t\t\t\telse if (d.type === \"HTTP\")\n\t\t\t\t\t\t\t\talert('error '+d.type+\": \"+d.status);\n\t\t\t\t\t\t\telse if (d.type ===\"File Size\")\n\t\t\t\t\t\t\t\talert(c.name+' '+d.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB');\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\talert('error '+d.type+\": \"+d.text);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\t";
     $script->setValue($js);
     $div = new XMLElement('div');
     $div->setAttribute('id', 'fileInputQueue');
     $div->setAttribute('class', 'fileUploadQueue');
     $queue = new XMLElement('a');
     $queue->setAttribute('href', "javascript:\$('#fileInput').fileUploadClearQueue();");
     $queue->setValue('Clear Queue');
     $fieldset->appendChild($p);
     $fieldset->appendChild($fileinput);
     $fieldset->appendChild($script);
     $fieldset->appendChild($div);
     $fieldset->appendChild($queue);
     /* now the section fields */
     $submit = Widget::Input('action[save]', 'Process files', 'button', array('accesskey' => 's'));
     $submit->setAttribute('onClick', "window.location='" . $this->_uri . "/do'");
     $actions = new XMLElement('div');
     $actions->setAttribute('class', 'actions');
     $div = new XMLElement('div');
     $div->setAttribute('class', 'uploadcomplete');
     $div->setAttribute('id', 'uploadcomplete');
     $div->setAttribute('style', 'display:none');
     $actions->appendChild($submit);
     $div->appendChild($actions);
     // <p><strong>Multiple File Upload</strong></p>
     // <input style="display: none;" id="fileInput2" name="fileInput2" height="30" type="file" width="110">
     // <embed src="/_scripts/uploader.swf?fileUploadID=fileInput2&amp;pagepath=/demo/&amp;script=/_scripts/upload.php&amp;folder=/_uploads&amp;btnWidth=110&amp;btnHeight=30&amp;wmode=opaque&amp;multi=true&amp;fileDataName=Filedata"
     //     quality="high" id="fileInput2Uploader" class="fileUploaderBtn" name="fileInput2Uploader" allowscriptaccess="sameDomain" wmode="opaque" type="application/x-shockwave-flash" height="30" width="110"
     //     />
     // <div id="fileInput2Queue" class="fileUploadQueue"></div>
     //   <br>
     //   <a href="javascript:$('#fileInput2').fileUploadStart();">Upload Files</a> | <a href="javascript:$('#fileInput2').fileUploadClearQueue();">Clear Queue</a>
     $this->Form->appendChild($fieldset);
     $this->Form->appendChild($div);
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:68,代码来源:content.inject.php

示例14: define

if (!defined('BITTER_LANGUAGE_PATH')) {
    define('BITTER_LANGUAGE_PATH', EXTENSIONS . '/devkit_debug/lib/bitter/languages');
}
if (!defined('BITTER_FORMAT_PATH')) {
    define('BITTER_FORMAT_PATH', EXTENSIONS . '/devkit_debug/lib/bitter/formats');
}
if (!defined('BITTER_CACHE_PATH')) {
    define('BITTER_CACHE_PATH', EXTENSIONS . '/devkit_debug/lib/bitter/caches');
}
require_once LIB . '/class.cache.php';
require_once LIB . '/class.devkit.php';
require_once EXTENSIONS . '/devkit_debug/lib/bitter/bitter.php';
// Create cache folter:
if (!is_dir(BITTER_CACHE_PATH)) {
    General::realiseDirectory(BITTER_CACHE_PATH);
}
class DevKit_Debug extends DevKit
{
    protected $show;
    protected $view;
    protected $input;
    protected $output;
    protected $params;
    protected $template;
    protected $utilities;
    protected $state;
    protected $states;
    protected $url;
    public function __construct(View $view)
    {
开发者ID:symphonycms,项目名称:symphony-3,代码行数:30,代码来源:debug.php

示例15: setXMLImporter

 public function setXMLImporter(&$name, &$error, $new)
 {
     $template = file_get_contents(EXTENSIONS . '/xmlimporter/templates/xml-importer.php');
     $old = !empty($name) ? $this->getXMLImporter($name) : array();
     // Update author:
     if (!isset($new['about']['author'])) {
         $new['about']['author'] = array('name' => Symphony::Engine()->Author()->getFullName(), 'email' => Symphony::Engine()->Author()->get('email'));
     }
     // Update dates:
     $new['about']['created'] = DateTimeObj::getGMT('c', @strtotime($new['about']['created']));
     $new['about']['updated'] = DateTimeObj::getGMT('c');
     // New name:
     $name = str_replace('-', '', Lang::createHandle($new['about']['name']));
     // Create new file:
     if (strpos(@$new['about']['file'], dirname(__FILE__)) === 0) {
         $rootdir = dirname(__FILE__);
     } else {
         $rootdir = WORKSPACE;
     }
     $filemode = Symphony::Configuration()->get('write_mode', 'file');
     $filename = sprintf('%s/xml-importers/xml-importer.%s.php', $rootdir, $name);
     $dirmode = Symphony::Configuration()->get('write_mode', 'directory');
     $dirname = dirname($filename);
     // Make sure the directory exists:
     if (!is_dir($dirname)) {
         General::realiseDirectory($dirname, $dirmode);
     }
     // Make sure new file can be written:
     if (!is_writable($dirname) or file_exists($filename) and !is_writable($filename)) {
         $error = __('Cannot save formatter, path is not writable.');
         return false;
     }
     $filedata = sprintf($template, str_replace(' ', '', ucwords(str_replace('-', ' ', Lang::createHandle($new['about']['name'])))), var_export($new['about']['name'], true), var_export($new['about']['author']['name'], true), var_export($new['about']['author']['email'], true), var_export($new['about']['description'], true), var_export($new['about']['created'], true), var_export($new['about']['updated'], true), var_export($new['can-update'], true), var_export($new['fields'], true), var_export($new['included-elements'], true), var_export($new['namespaces'], true), var_export($new['source'], true), var_export($new['timeout'], true), var_export($new['section'], true), var_export($new['unique-field'], true));
     // Write file to disk:
     General::writeFile($filename, $filedata, $filemode);
     // Cleanup old file:
     if ($filename != @$old['about']['html-formatter-file'] and file_exists($filename) and @file_exists($old['about']['html-formatter-file'])) {
         General::deleteFile($old['about']['html-formatter-file']);
     }
     return true;
 }
开发者ID:symphonists,项目名称:xmlimporter,代码行数:41,代码来源:extension.driver.php


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