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


PHP Director::setBaseURL方法代码示例

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


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

示例1: testRSSFeed

 function testRSSFeed()
 {
     $list = new DataObjectSet();
     $list->push(new RSSFeedTest_ItemA());
     $list->push(new RSSFeedTest_ItemB());
     $list->push(new RSSFeedTest_ItemC());
     $origServer = $_SERVER;
     $_SERVER['HTTP_HOST'] = 'www.example.org';
     Director::setBaseURL('/');
     $rssFeed = new RSSFeed($list, "http://www.example.com", "Test RSS Feed", "Test RSS Feed Description");
     $content = $rssFeed->feedContent();
     //Debug::message($content);
     $this->assertContains('<link>http://www.example.org/item-a/</link>', $content);
     $this->assertContains('<link>http://www.example.com/item-b.html</link>', $content);
     $this->assertContains('<link>http://www.example.com/item-c.html</link>', $content);
     $this->assertContains('<title>ItemA</title>', $content);
     $this->assertContains('<title>ItemB</title>', $content);
     $this->assertContains('<title>ItemC</title>', $content);
     $this->assertContains('<description>ItemA Content</description>', $content);
     $this->assertContains('<description>ItemB Content</description>', $content);
     $this->assertContains('<description>ItemC Content</description>', $content);
     // Feed #2 - put Content() into <title> and AltContent() into <description>
     $rssFeed = new RSSFeed($list, "http://www.example.com", "Test RSS Feed", "Test RSS Feed Description", "Content", "AltContent");
     $content = $rssFeed->feedContent();
     $this->assertContains('<title>ItemA Content</title>', $content);
     $this->assertContains('<title>ItemB Content</title>', $content);
     $this->assertContains('<title>ItemC Content</title>', $content);
     $this->assertContains('<description>ItemA AltContent</description>', $content);
     $this->assertContains('<description>ItemB AltContent</description>', $content);
     $this->assertContains('<description>ItemC AltContent</description>', $content);
     Director::setBaseURL(null);
     $_SERVER = $origServer;
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:33,代码来源:RSSFeedTest.php

示例2: testModuleRender

 /**
  * Test that the module render method is producing content.
  */
 public function testModuleRender()
 {
     Director::setBaseURL('http://www.example.com/');
     $page = $this->objFromFixture('ModularPage', 'test');
     foreach ($page->Modules() as $module) {
         $this->assertNotEmpty($module->Content());
     }
 }
开发者ID:touchcast,项目名称:modulator,代码行数:11,代码来源:ModularPageTest.php

示例3: export

 function export()
 {
     if ($_REQUEST['baseurl']) {
         $base = $_REQUEST['baseurl'];
         if (substr($base, -1) != '/') {
             $base .= '/';
         }
         Director::setBaseURL($base);
     }
     $folder = '/tmp/static-export/' . project();
     if (!project()) {
         $folder .= 'site';
     }
     if (!file_exists($folder)) {
         mkdir($folder, Filesystem::$folder_create_mask, true);
     }
     $f1 = Director::baseFolder() . '/assets';
     $f2 = Director::baseFolder() . '/' . project();
     `cd {$folder}; ln -s {$f1}; ln -s {$f2}`;
     $baseFolder = basename($folder);
     if ($folder && file_exists($folder)) {
         $pages = DataObject::get("SiteTree");
         foreach ($pages as $page) {
             $subfolder = "{$folder}/{$page->URLSegment}";
             $contentfile = "{$folder}/{$page->URLSegment}/index.html";
             // Make the folder
             if (!file_exists($subfolder)) {
                 mkdir($subfolder, Filesystem::$folder_create_mask);
             }
             // Run the page
             Requirements::clear();
             $controllerClass = "{$page->class}_Controller";
             if (class_exists($controllerClass)) {
                 $controller = new $controllerClass($page);
                 $pageContent = $controller->run(array());
                 // Write to file
                 if ($fh = fopen($contentfile, 'w')) {
                     fwrite($fh, $pageContent->getBody());
                     fclose($fh);
                 }
             }
         }
         copy("{$folder}/home/index.html", "{$folder}/index.html");
         `cd /tmp/static-export; tar -czhf {$baseFolder}.tar.gz {$baseFolder}`;
         $content = file_get_contents("/tmp/static-export/{$baseFolder}.tar.gz");
         Filesystem::removeFolder('/tmp/static-export');
         HTTP::sendFileToBrowser($content, "{$baseFolder}.tar.gz");
         return null;
     } else {
         echo _t('StaticExporter.ONETHATEXISTS', "Please specify a folder that exists");
     }
 }
开发者ID:ramziammar,项目名称:websites,代码行数:52,代码来源:StaticExporter.php

示例4: export

 function export()
 {
     // specify custom baseurl for publishing to other webroot
     if (isset($_REQUEST['baseurl'])) {
         $base = $_REQUEST['baseurl'];
         if (substr($base, -1) != '/') {
             $base .= '/';
         }
         Director::setBaseURL($base);
     }
     // setup temporary folders
     $tmpBaseFolder = TEMP_FOLDER . '/static-export';
     $tmpFolder = project() ? "{$tmpBaseFolder}/" . project() : "{$tmpBaseFolder}/site";
     if (!file_exists($tmpFolder)) {
         Filesystem::makeFolder($tmpFolder);
     }
     $baseFolderName = basename($tmpFolder);
     // symlink /assets
     $f1 = ASSETS_PATH;
     $f2 = Director::baseFolder() . '/' . project();
     `cd {$tmpFolder}; ln -s {$f1}; ln -s {$f2}`;
     // iterate through all instances of SiteTree
     $pages = DataObject::get("SiteTree");
     foreach ($pages as $page) {
         $subfolder = "{$tmpFolder}/" . trim($page->RelativeLink(null, true), '/');
         $contentfile = "{$tmpFolder}/" . trim($page->RelativeLink(null, true), '/') . '/index.html';
         // Make the folder
         if (!file_exists($subfolder)) {
             Filesystem::makeFolder($subfolder);
         }
         // Run the page
         Requirements::clear();
         $link = Director::makeRelative($page->Link());
         $response = Director::test($link);
         // Write to file
         if ($fh = fopen($contentfile, 'w')) {
             fwrite($fh, $response->getBody());
             fclose($fh);
         }
     }
     // copy homepage (URLSegment: "home") to webroot
     copy("{$tmpFolder}/home/index.html", "{$tmpFolder}/index.html");
     // archive all generated files
     `cd {$tmpBaseFolder}; tar -czhf {$baseFolderName}.tar.gz {$baseFolderName}`;
     $archiveContent = file_get_contents("{$tmpBaseFolder}/{$baseFolderName}.tar.gz");
     // remove temporary files and folder
     Filesystem::removeFolder($tmpBaseFolder);
     // return as download to the client
     $response = SS_HTTPRequest::send_file($archiveContent, "{$baseFolderName}.tar.gz", 'application/x-tar-gz');
     echo $response->output();
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:51,代码来源:StaticExporter.php

示例5: testAlternativeBaseURL

 public function testAlternativeBaseURL()
 {
     // relative base URLs - you should end them in a /
     Director::setBaseURL('/relativebase/');
     $this->assertEquals('/relativebase/', Director::baseURL());
     $this->assertEquals(Director::protocolAndHost() . '/relativebase/', Director::absoluteBaseURL());
     $this->assertEquals(Director::protocolAndHost() . '/relativebase/subfolder/test', Director::absoluteURL('subfolder/test'));
     // absolute base URLs - you should end them in a /
     Director::setBaseURL('http://www.example.org/');
     $this->assertEquals('http://www.example.org/', Director::baseURL());
     $this->assertEquals('http://www.example.org/', Director::absoluteBaseURL());
     $this->assertEquals('http://www.example.org/subfolder/test', Director::absoluteURL('subfolder/test'));
     // Setting it to false restores functionality
     Director::setBaseURL(false);
     $this->assertEquals(BASE_URL . '/', Director::baseURL());
     $this->assertEquals(Director::protocolAndHost() . BASE_URL . '/', Director::absoluteBaseURL(BASE_URL));
     $this->assertEquals(Director::protocolAndHost() . BASE_URL . '/subfolder/test', Director::absoluteURL('subfolder/test'));
 }
开发者ID:normann,项目名称:sapphire,代码行数:18,代码来源:DirectorTest.php

示例6: define

<?php

define('UNIT_TESTING', true);
define('ECOMMERCE_PAYMENT_BASE_PATH', dirname(__DIR__));
define('BASE_PATH', ECOMMERCE_PAYMENT_BASE_PATH);
if (!file_exists(BASE_PATH . '/vendor/autoload.php')) {
    echo 'You must first install the vendors using composer.' . PHP_EOL;
    exit(1);
}
$loader = (require BASE_PATH . '/vendor/autoload.php');
use Symfony\Component\ClassLoader\ClassMapGenerator;
$loader->addClassMap(ClassMapGenerator::createMap(BASE_PATH . '/framework'));
$loader->add('Heystack\\Payment\\Test', __DIR__);
\Director::setBaseURL('http://localhost/');
开发者ID:heyday,项目名称:heystack-ecommerce-payment,代码行数:14,代码来源:bootstrap.php

示例7:

<?php

global $project;
$project = 'beardpapa';
global $database;
$database = 'beardpapa';
require_once 'conf/ConfigureFromEnv.php';
Director::setBaseURL('/');
// Set the site locale
i18n::set_locale('en_US');
define('CSS_DIR', THEMES_DIR . "/" . SSViewer::current_custom_theme() . '/css');
define('JS_DIR', THEMES_DIR . "/" . SSViewer::current_custom_theme() . '/javascript');
define('BOWER_PATH', 'bower_components');
开发者ID:shawn3a,项目名称:beardpapa,代码行数:13,代码来源:_config.php

示例8: publishPages

 function publishPages($urls)
 {
     // Do we need to map these?
     // Detect a numerically indexed arrays
     if (is_numeric(join('', array_keys($urls)))) {
         $urls = $this->urlsToPaths($urls);
     }
     // This can be quite memory hungry and time-consuming
     // @todo - Make a more memory efficient publisher
     increase_time_limit_to();
     increase_memory_limit_to();
     // Set the appropriate theme for this publication batch.
     // This may have been set explicitly via StaticPublisher::static_publisher_theme,
     // or we can use the last non-null theme.
     if (!StaticPublisher::static_publisher_theme()) {
         SSViewer::set_theme(SSViewer::current_custom_theme());
     } else {
         SSViewer::set_theme(StaticPublisher::static_publisher_theme());
     }
     $currentBaseURL = Director::baseURL();
     if (self::$static_base_url) {
         Director::setBaseURL(self::$static_base_url);
     }
     if ($this->fileExtension == 'php') {
         SSViewer::setOption('rewriteHashlinks', 'php');
     }
     if (StaticPublisher::echo_progress()) {
         echo $this->class . ": Publishing to " . self::$static_base_url . "\n";
     }
     $files = array();
     $i = 0;
     $totalURLs = sizeof($urls);
     foreach ($urls as $url => $path) {
         if (self::$static_base_url) {
             Director::setBaseURL(self::$static_base_url);
         }
         $i++;
         if ($url && !is_string($url)) {
             user_error("Bad url:" . var_export($url, true), E_USER_WARNING);
             continue;
         }
         if (StaticPublisher::echo_progress()) {
             echo " * Publishing page {$i}/{$totalURLs}: {$url}\n";
             flush();
         }
         Requirements::clear();
         if ($url == "") {
             $url = "/";
         }
         if (Director::is_relative_url($url)) {
             $url = Director::absoluteURL($url);
         }
         $response = Director::test(str_replace('+', ' ', $url));
         Requirements::clear();
         singleton('DataObject')->flushCache();
         //skip any responses with a 404 status code. We don't want to turn those into statically cached pages
         if (!$response || $response->getStatusCode() == '404') {
             continue;
         }
         // Generate file content
         // PHP file caching will generate a simple script from a template
         if ($this->fileExtension == 'php') {
             if (is_object($response)) {
                 if ($response->getStatusCode() == '301' || $response->getStatusCode() == '302') {
                     $content = $this->generatePHPCacheRedirection($response->getHeader('Location'));
                 } else {
                     $content = $this->generatePHPCacheFile($response->getBody(), HTTP::get_cache_age(), date('Y-m-d H:i:s'));
                 }
             } else {
                 $content = $this->generatePHPCacheFile($response . '', HTTP::get_cache_age(), date('Y-m-d H:i:s'));
             }
             // HTML file caching generally just creates a simple file
         } else {
             if (is_object($response)) {
                 if ($response->getStatusCode() == '301' || $response->getStatusCode() == '302') {
                     $absoluteURL = Director::absoluteURL($response->getHeader('Location'));
                     $content = "<meta http-equiv=\"refresh\" content=\"2; URL={$absoluteURL}\">";
                 } else {
                     $content = $response->getBody();
                 }
             } else {
                 $content = $response . '';
             }
         }
         $files[] = array('Content' => $content, 'Folder' => dirname($path) . '/', 'Filename' => basename($path));
         // Add externals
         /*
         			$externals = $this->externalReferencesFor($content);
         			if($externals) foreach($externals as $external) {
         				// Skip absolute URLs
         				if(preg_match('/^[a-zA-Z]+:\/\//', $external)) continue;
         				// Drop querystring parameters
         				$external = strtok($external, '?');
         				
         				if(file_exists("../" . $external)) {
         					// Break into folder and filename
         					if(preg_match('/^(.*\/)([^\/]+)$/', $external, $matches)) {
         						$files[$external] = array(
         							"Copy" => "../$external",
         							"Folder" => $matches[1],
//.........这里部分代码省略.........
开发者ID:comperio,项目名称:silverstripe-cms,代码行数:101,代码来源:FilesystemPublisher.php

示例9: publishUrls


//.........这里部分代码省略.........
     $i = 0;
     $totalURLs = sizeof($urls);
     $cache = $this->getCache();
     if (!defined('PROXY_CACHE_GENERATING')) {
         define('PROXY_CACHE_GENERATING', true);
     }
     foreach ($urls as $url => $path) {
         // work around bug introduced in ss3 whereby top level /bathroom.html would be changed to ./bathroom.html
         $path = ltrim($path, './');
         $url = rtrim($url, '/');
         // TODO: Detect the scheme + host URL from the URL's absolute path
         // and set that as the base URL appropriately
         $baseUrlSrc = $this->staticBaseUrl ? $this->staticBaseUrl : $url;
         $urlBits = parse_url($baseUrlSrc);
         if (isset($urlBits['scheme']) && isset($urlBits['host'])) {
             // now see if there's a host mapping
             // we want to set the base URL correctly
             Config::inst()->update('Director', 'alternate_base_url', $urlBits['scheme'] . '://' . $urlBits['host'] . '/');
         }
         $i++;
         if ($url && !is_string($url)) {
             user_error("Bad url:" . var_export($url, true), E_USER_WARNING);
             continue;
         }
         Requirements::clear();
         if (strrpos($url, '/home') == strlen($url) - 5) {
             $url = substr($url, 0, strlen($url) - 5);
         }
         if ($url == "" || $url == 'home') {
             $url = "/";
         }
         if (Director::is_relative_url($url)) {
             $url = Director::absoluteURL($url);
         }
         $stage = Versioned::current_stage();
         Versioned::reading_stage('Live');
         $GLOBALS[self::CACHE_PUBLISH] = 1;
         Config::inst()->update('SSViewer', 'theme_enabled', true);
         if (class_exists('Multisites')) {
             Multisites::inst()->resetCurrentSite();
         }
         $response = Director::test(str_replace('+', ' ', $url));
         Config::inst()->update('SSViewer', 'theme_enabled', false);
         unset($GLOBALS[self::CACHE_PUBLISH]);
         Versioned::reading_stage($stage);
         Requirements::clear();
         singleton('DataObject')->flushCache();
         $contentType = null;
         // Generate file content
         if (is_object($response)) {
             if ($response->getStatusCode() == '301' || $response->getStatusCode() == '302') {
                 $absoluteURL = Director::absoluteURL($response->getHeader('Location'));
                 $content = null;
             } else {
                 $content = $response->getBody();
                 $type = $response->getHeader('Content-type');
                 $contentType = $type ? $type : $contentType;
             }
         } else {
             $content = $response . '';
         }
         if (!$content) {
             continue;
         }
         if (isset($urlBits['host'])) {
             $domain = $urlBits['host'];
         }
         if ($domain && !$keyPrefix) {
             $keyPrefix = $domain;
         }
         $path = trim($path, '/');
         if ($path == 'home') {
             $path = '';
         }
         $data = new stdClass();
         $data->Content = $content;
         $data->LastModified = date('Y-m-d H:i:s');
         $cacheAge = SiteConfig::current_site_config()->CacheAge;
         if ($cacheAge) {
             $data->Age = $cacheAge;
         } else {
             $data->Age = HTTP::get_cache_age();
         }
         if (!empty($contentType)) {
             $data->ContentType = $contentType;
         }
         $key = $keyPrefix . '/' . $path;
         $cache->store($key, $data);
         if ($domain && isset($PROXY_CACHE_HOSTMAP) && isset($PROXY_CACHE_HOSTMAP[$domain])) {
             $hosts = $PROXY_CACHE_HOSTMAP[$domain];
             foreach ($hosts as $otherDomain) {
                 $key = $otherDomain . '/' . $path;
                 $storeData = clone $data;
                 $storeData->Content = str_replace($domain, $otherDomain, $storeData->Content);
                 $cache->store($key, $storeData);
             }
         }
     }
     Director::setBaseURL($currentBaseURL);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-simplecache,代码行数:101,代码来源:SimpleCachePublisher.php

示例10: testPageModuleRender

 /**
  * Test that the module render function is producing content.
  */
 public function testPageModuleRender()
 {
     Director::setBaseURL('http://www.example.com/');
     $hero = $this->objFromFixture('PageModule', 'hero');
     $this->assertNotEmpty($hero->Content());
 }
开发者ID:touchcast,项目名称:modulator,代码行数:9,代码来源:PageModuleTest.php

示例11: publishPages

 function publishPages($urls)
 {
     set_time_limit(0);
     ini_set("memory_limit", -1);
     //$base = Director::absoluteURL($this->destFolder);
     //$base = preg_replace('/\/[^\/]+\/\.\./','',$base) . '/';
     if (self::$static_base_url) {
         Director::setBaseURL(self::$static_base_url);
     }
     if ($this->fileExtension == 'php') {
         SSViewer::setOption('rewriteHashlinks', 'php');
     }
     $files = array();
     $i = 0;
     $totalURLs = sizeof($urls);
     foreach ($urls as $url) {
         $i++;
         if (StaticPublisher::echo_progress()) {
             echo " * Publishing page {$i}/{$totalURLs}: {$url}\n";
             flush();
         }
         Requirements::clear();
         $response = Director::test($url);
         Requirements::clear();
         /*
         			if(!is_object($response)) {
         				echo "String response for url '$url'\n";
         				print_r($response);
         			}*/
         if (is_object($response)) {
             $content = $response->getBody();
         } else {
             $content = $response . '';
         }
         if ($this->fileExtension) {
             $filename = $url ? "{$url}.{$this->fileExtension}" : "index.{$this->fileExtension}";
         } else {
             $filename = $url ? "{$url}/index.html" : "index.html";
         }
         $files[$filename] = array('Content' => $content, 'Folder' => dirname($filename) == '/' ? '' : dirname($filename) . '/', 'Filename' => basename($filename));
         // Add externals
         /*
         			$externals = $this->externalReferencesFor($content);
         			if($externals) foreach($externals as $external) {
         				// Skip absolute URLs
         				if(preg_match('/^[a-zA-Z]+:\/\//', $external)) continue;
         				// Drop querystring parameters
         				$external = strtok($external, '?');
         				
         				if(file_exists("../" . $external)) {
         					// Break into folder and filename
         					if(preg_match('/^(.*\/)([^\/]+)$/', $external, $matches)) {
         						$files[$external] = array(
         							"Copy" => "../$external",
         							"Folder" => $matches[1],
         							"Filename" => $matches[2],
         						);
         					
         					} else {
         						user_error("Can't parse external: $external", E_USER_WARNING);
         					}
         				} else {
         					$missingFiles[$external] = true;
         				}
         			}*/
     }
     if (self::$static_base_url) {
         Director::setBaseURL(null);
     }
     if ($this->fileExtension == 'php') {
         SSViewer::setOption('rewriteHashlinks', true);
     }
     //Debug::show(array_keys($files));
     //Debug::show(array_keys($missingFiles));
     $base = "../{$this->destFolder}";
     foreach ($files as $file) {
         Filesystem::makeFolder("{$base}/{$file['Folder']}");
         if (isset($file['Content'])) {
             $fh = fopen("{$base}/{$file['Folder']}{$file['Filename']}", "w");
             fwrite($fh, $file['Content']);
             fclose($fh);
         } else {
             if (isset($file['Copy'])) {
                 copy($file['Copy'], "{$base}/{$file['Folder']}{$file['Filename']}");
             }
         }
     }
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:88,代码来源:FilesystemPublisher.php

示例12: exportTo

 public function exportTo($directory)
 {
     $directory = rtrim($directory, '/');
     $links = $this->urlsToPaths($this->getLinks());
     $files = array();
     increase_time_limit_to();
     increase_memory_limit_to();
     // Make the output directory if it doesn't exist.
     if (!is_dir($directory)) {
         mkdir($directory, Filesystem::$folder_create_mask, true);
     }
     if ($this->theme) {
         SSViewer::set_theme($this->theme);
     } else {
         SSViewer::set_theme(SSViewer::current_custom_theme());
     }
     if ($this->baseUrl && !$this->makeRelative) {
         $originalBaseUrl = Director::baseURL();
         Director::setBaseURL($this->baseUrl);
     }
     // Loop through each link that we're publishing, and create a static
     // html file for each.
     foreach ($links as $link => $path) {
         Requirements::clear();
         singleton('DataObject')->flushCache();
         $response = Director::test($link);
         $target = $directory . '/' . $path;
         if (is_object($response)) {
             if ($response->getStatusCode() == '301' || $response->getStatusCode() == '302') {
                 $absoluteURL = Director::absoluteURL($response->getHeader('Location'));
                 $content = "<meta http-equiv=\"refresh\" content=\"2; URL={$absoluteURL}\">";
             } else {
                 $content = $response->getBody();
             }
         } else {
             $content = (string) $response;
         }
         // Find any external content references inside the response, and add
         // them to the copy array.
         $externals = $this->externalReferencesFor($content);
         if ($externals) {
             foreach ($externals as $external) {
                 if (!Director::is_site_url($external)) {
                     continue;
                 }
                 $external = strtok($external, '?');
                 $external = Director::makeRelative($external);
                 if (file_exists(BASE_PATH . '/' . $external)) {
                     $files["{$directory}/{$external}"] = array('copy', BASE_PATH . '/' . $external);
                 }
             }
         }
         // Append any anchor links which point to a relative site link
         // with a .html extension.
         $base = preg_quote(Director::baseURL());
         $content = preg_replace('~<a(.+?)href="(' . $base . '[^"]*?)/?"~i', '<a$1href="$2.html"', $content);
         $content = str_replace('/.html', '/index.html', $content);
         // If we want to rewrite links to relative, then determine how many
         // levels deep we are and rewrite the relevant attributes globally.
         // Also, string the base tag.
         if ($this->makeRelative) {
             $content = preg_replace('~(src|href)="' . Director::protocolAndHost() . '~i', '$1="', $content);
             if (($trimmed = trim($link, '/')) && strpos($trimmed, '/')) {
                 $prepend = str_repeat('../', substr_count($trimmed, '/'));
             } else {
                 $prepend = './';
             }
             $base = preg_quote(Director::baseURL());
             $content = preg_replace('~(href|src)="' . $base . '~i', '$1="' . $prepend, $content);
             $content = preg_replace('~<base href="([^"]+)" />~', '', $content);
             $content = preg_replace('~<base href="([^"]+)"><!--[if lte IE 6]></base><![endif]-->~', '', $content);
         }
         $files[$target] = array('create', $content);
     }
     // If we currently have a theme active, then copy all the theme
     // assets across to the site.
     if ($theme = SSViewer::current_theme()) {
         $stack = array(THEMES_PATH . '/' . $theme);
         // Build up a list of every file present in the current theme
         // which is not a .ss template, and add it to the files array
         while ($path = array_pop($stack)) {
             foreach (scandir($path) as $file) {
                 if ($file[0] == '.' || $file[0] == '_') {
                     continue;
                 }
                 if (is_dir("{$path}/{$file}")) {
                     $stack[] = "{$path}/{$file}";
                 } else {
                     if (substr($file, -3) != '.ss') {
                         $loc = "{$path}/{$file}";
                         $to = $directory . '/' . substr($loc, strlen(BASE_PATH) + 1);
                         $files[$to] = array('copy', $loc);
                     }
                 }
             }
         }
     }
     // If theres a favicon.ico file in the site root, copy it across
     if (file_exists(BASE_PATH . '/favicon.ico')) {
         $files["{$directory}/favicon.ico"] = array('copy', BASE_PATH . '/favicon.ico');
//.........这里部分代码省略.........
开发者ID:rodneyway,项目名称:silverstripe-siteexporter,代码行数:101,代码来源:SiteExporter.php


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