本文整理汇总了PHP中themes_path函数的典型用法代码示例。如果您正苦于以下问题:PHP themes_path函数的具体用法?PHP themes_path怎么用?PHP themes_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了themes_path函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fire
/**
* Execute the console command.
* @return void
*/
public function fire()
{
$themeName = $this->argument('name');
$argDirName = $this->argument('dirName');
if ($argDirName && $themeName == $argDirName) {
$argDirName = null;
}
if ($argDirName) {
if (!preg_match('/^[a-z0-9\\_\\-]+$/i', $argDirName)) {
return $this->error('Invalid destination directory name.');
}
if (Theme::exists($argDirName)) {
return $this->error(sprintf('A theme named %s already exists.', $argDirName));
}
}
try {
$themeManager = ThemeManager::instance();
$updateManager = UpdateManager::instance();
$themeDetails = $updateManager->requestThemeDetails($themeName);
if ($themeManager->isInstalled($themeDetails['code'])) {
return $this->error(sprintf('The theme %s is already installed.', $themeDetails['code']));
}
if (Theme::exists($themeDetails['code'])) {
return $this->error(sprintf('A theme named %s already exists.', $themeDetails['code']));
}
$fields = ['Name', 'Description', 'Author', 'URL', ''];
$this->info(sprintf(implode(': %s' . PHP_EOL, $fields), $themeDetails['code'], $themeDetails['description'], $themeDetails['author'], $themeDetails['product_url']));
if (!$this->confirm('Do you wish to continue? [Y|n]', true)) {
return;
}
$this->info('Downloading theme...');
$updateManager->downloadTheme($themeDetails['code'], $themeDetails['hash']);
$this->info('Extracting theme...');
$updateManager->extractTheme($themeDetails['code'], $themeDetails['hash']);
$dirName = $this->themeCodeToDir($themeDetails['code']);
if ($argDirName) {
/*
* Move downloaded theme to a new directory.
* Basically we're renaming it.
*/
File::move(themes_path() . '/' . $dirName, themes_path() . '/' . $argDirName);
/*
* Let's make sure to unflag the 'old' theme as
* installed so it can be re-installed later.
*/
$themeManager->setUninstalled($themeDetails['code']);
$dirName = $argDirName;
}
$this->info(sprintf('The theme %s has been installed. (now %s)', $themeDetails['code'], $dirName));
} catch (Exception $ex) {
$this->error($ex->getMessage());
}
}
开发者ID:minhkiller,项目名称:october,代码行数:57,代码来源:ThemeInstall.php
示例2: themes
/**
* Create virtual array for theme change
* @return array
*/
public function themes()
{
$path = themes_path();
$dir_arr = \File::directories($path);
$themes = array();
foreach ($dir_arr as $path) {
$name_arr = explode('/', $path);
$name = array_pop($name_arr);
$theme_name = array_get(theme_settings($path), 'theme_name');
$themes[$name] = $theme_name;
}
return $themes;
}
开发者ID:pongocms,项目名称:cms,代码行数:17,代码来源:Theme.php
示例3: fire
/**
* Execute the console command.
*/
public function fire()
{
if (!$this->confirmToProceed('Are you sure?')) {
return;
}
$demoThemePath = themes_path() . '/demo';
if (File::exists($demoThemePath)) {
Artisan::call('plugin:remove', ['name' => 'October.Demo', '--force' => true]);
File::deleteDirectory($demoThemePath);
$this->info('Demo has been removed! Enjoy a fresh start.');
} else {
$this->error('Demo theme is already removed.');
}
}
开发者ID:mechiko,项目名称:staff-october,代码行数:17,代码来源:OctoberFresh.php
示例4: getSystemWarnings
protected function getSystemWarnings()
{
$warnings = [];
$writablePaths = [temp_path(), themes_path(), storage_path(), storage_path('app'), storage_path('logs'), storage_path('framework'), storage_path('cms'), storage_path('cms/cache'), storage_path('cms/twig'), storage_path('cms/combiner')];
$requiredExtensions = ['GD' => extension_loaded('gd'), 'fileinfo' => extension_loaded('fileinfo'), 'Zip' => class_exists('ZipArchive'), 'cURL' => function_exists('curl_init') && defined('CURLOPT_FOLLOWLOCATION'), 'OpenSSL' => function_exists('openssl_random_pseudo_bytes')];
foreach ($writablePaths as $path) {
if (!is_writable($path)) {
$warnings[] = Lang::get('backend::lang.warnings.permissions', ['name' => '<strong>' . $path . '</strong>']);
}
}
foreach ($requiredExtensions as $extension => $installed) {
if (!$installed) {
$warnings[] = Lang::get('backend::lang.warnings.extension', ['name' => '<strong>' . $extension . '</strong>']);
}
}
return $warnings;
}
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:17,代码来源:Status.php
示例5: flipCss
/**
* @param $path
* @return string
*/
public static function flipCss($path, $useTheme = false)
{
if ($path == '/modules/backend/formwidgets/richeditor/assets/css/richeditor.css') {
return $path;
}
$theme_name = Theme::getActiveTheme()->getDirName();
$customPath = $useTheme ? themes_path($theme_name . '/' . dirname($path) . '/' . File::name($path) . '.rtl.' . File::extension($path)) : static::getCustomPath($path);
$orginalFile = $useTheme ? themes_path($theme_name . '/' . $path) : base_path($path);
$replacePath = $useTheme ? themes_path($theme_name) : base_path();
if (File::exists($orginalFile)) {
if (File::exists($customPath) && File::lastModified($orginalFile) < File::lastModified($customPath)) {
return str_replace($replacePath, '', $customPath);
}
File::makeDirectory(dirname($customPath), 0777, true, true);
$flipped_css = CSSJanus::transform(File::get($orginalFile), true, true);
//change url
if ($useTheme === false) {
$flipped_css = preg_replace_callback('/url\\s*\\(\\s*[\'|\\"]?([A-Za-z0-9\\.\\/\\-\\?=#_&]+)[\'|\\"]?\\)/i', function ($url) use($path) {
$u = str_replace('\'', '', $url[1]);
$u = str_replace('"', '', $u);
$p = dirname($path) . '/' . $u;
if (substr($p, 0, 1) != '/') {
$p = '/' . $p;
}
return 'url(\'' . $p . '\')';
}, $flipped_css);
}
preg_replace_callback('/@import\\s*"([A-Za-z0-9\\.\\/\\-\\?=#_&]+)"\\s*;/i', function ($import) use($path, $useTheme) {
$importPath = $import[1];
if (substr($importPath, 0, 1) != '/') {
$importPath = dirname($path) . '/' . $importPath;
}
return static::flipCss($importPath, $useTheme);
}, $flipped_css);
File::put($customPath, $flipped_css);
return str_replace($replacePath, '', $customPath);
}
return $path;
}
开发者ID:sajjad-ser,项目名称:oc-rtler,代码行数:43,代码来源:CssFlipper.php
示例6: themeUrl
/**
* Converts supplied URL to a theme URL relative to the website root. If the URL provided is an
* array then the files will be combined.
* @param mixed $url Specifies the theme-relative URL. If null, the theme path is returned.
* @return string
*/
public function themeUrl($url = null)
{
$themeDir = $this->getTheme()->getDirName();
if (is_array($url)) {
$_url = URL::to(CombineAssets::combine($url, themes_path() . '/' . $themeDir));
} else {
$_url = Config::get('cms.themesPath', '/themes') . '/' . $themeDir;
if ($url !== null) {
$_url .= '/' . $url;
}
$_url = URL::asset($_url);
}
return $_url;
}
开发者ID:Tripplefix,项目名称:pfadiorion,代码行数:20,代码来源:Controller.php
示例7: all
/**
* Returns a list of all themes.
* @return array Returns an array of the Theme objects.
*/
public static function all()
{
$it = new DirectoryIterator(themes_path());
$it->rewind();
$result = [];
foreach ($it as $fileinfo) {
if (!$fileinfo->isDir() || $fileinfo->isDot()) {
continue;
}
$theme = static::load($fileinfo->getFilename());
$result[] = $theme;
}
return $result;
}
开发者ID:GoldBest,项目名称:october,代码行数:18,代码来源:Theme.php
示例8: getPath
/**
* Returns the base for the file path to search the files in.
* @return string
* @throws \SystemException
*/
protected function getPath()
{
return themes_path() . "/" . Theme::getActiveTheme()->getDirName() . "/";
}
开发者ID:kosmonowt,项目名称:filesearch-october-plugin,代码行数:9,代码来源:Finder.php
示例9: removeOldThemes
/**
* Remove old theme directories.
*
* @return bool
* @throws \Krisawzm\DemoManager\Classes\DemoManagerException
*/
protected function removeOldThemes()
{
$baseTheme = Config::get('krisawzm.demomanager::base_theme', null);
if (!$baseTheme) {
// Prevents the base theme from accidentally being deleted.
throw new DemoManagerException('A base theme is not specified.');
}
$themesPath = themes_path();
$baseThemePath = themes_path($baseTheme);
foreach (File::directories($themesPath) as $themePath) {
// Do not remove the base theme.
if ($themePath == $baseThemePath) {
continue;
}
if (!File::deleteDirectory($themePath)) {
return false;
}
}
return true;
}
开发者ID:janusnic,项目名称:demomanager-plugin,代码行数:26,代码来源:DemoManager.php
示例10: applyThemeConfig
/**
* Override configs with theme-specific settings.
*
* @return void
*/
protected function applyThemeConfig()
{
$path = themes_path($this->theme . '/config');
if (app('files')->exists($path)) {
foreach (app('files')->allFiles($path) as $file) {
$key = str_replace('.' . $file->getExtension(), '', $file->getFilename());
app('config')->set($key, require $file->getPathname());
}
}
}
开发者ID:petercoles,项目名称:themes,代码行数:15,代码来源:Themes.php
示例11: index_onDuplicateTheme
public function index_onDuplicateTheme()
{
$theme = $this->findThemeObject();
$newDirName = trim(post('new_dir_name'));
$sourcePath = $theme->getPath();
$destinationPath = themes_path() . '/' . $newDirName;
if (!preg_match('/^[a-z0-9\\_\\-]+$/i', $newDirName)) {
throw new ValidationException(['new_dir_name' => trans('cms::lang.theme.dir_name_invalid')]);
}
if (File::isDirectory($destinationPath)) {
throw new ValidationException(['new_dir_name' => trans('cms::lang.theme.dir_name_taken')]);
}
File::copyDirectory($sourcePath, $destinationPath);
$newTheme = CmsTheme::load($newDirName);
$newName = $newTheme->getConfigValue('name') . ' - Copy';
$newTheme->writeConfig(['name' => $newName]);
Flash::success(trans('cms::lang.theme.duplicate_theme_success'));
return Redirect::refresh();
}
开发者ID:pietercolpaert,项目名称:swagsite,代码行数:19,代码来源:Themes.php
示例12: utilGitPull
/**
* This command requires the git binary to be installed.
*/
protected function utilGitPull()
{
foreach (File::directories(plugins_path()) as $authorDir) {
foreach (File::directories($authorDir) as $pluginDir) {
if (!File::isDirectory($pluginDir . '/.git')) {
continue;
}
$exec = 'cd ' . $pluginDir . ' && ';
$exec .= 'git pull 2>&1';
echo 'Updating plugin: ' . basename(dirname($pluginDir)) . '.' . basename($pluginDir) . PHP_EOL;
echo shell_exec($exec);
}
}
foreach (File::directories(themes_path()) as $themeDir) {
if (!File::isDirectory($themeDir . '/.git')) {
continue;
}
$exec = 'cd ' . $themeDir . ' && ';
$exec .= 'git pull 2>&1';
echo 'Updating theme: ' . basename($themeDir) . PHP_EOL;
echo shell_exec($exec);
}
}
开发者ID:jiiis,项目名称:ptn,代码行数:26,代码来源:OctoberUtil.php
示例13: getPath
/**
* Returns the absolute theme path.
* @param string $dirName Optional theme directory. Defaults to $this->getDirName()
* @return string
*/
public function getPath($dirName = null)
{
if (!$dirName) {
$dirName = $this->getDirName();
}
return themes_path() . '/' . $dirName;
}
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:12,代码来源:Theme.php
示例14: init
/**
* Initialize.
*
* @return void
*/
public function init()
{
if (!Cache::has($this->cacheKey)) {
Cache::forever($this->cacheKey, count(File::directories(themes_path())) - 1);
}
}
开发者ID:janusnic,项目名称:demomanager-plugin,代码行数:11,代码来源:UserCounter.php
注:本文中的themes_path函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论