本文整理汇总了PHP中dmOs::join方法的典型用法代码示例。如果您正苦于以下问题:PHP dmOs::join方法的具体用法?PHP dmOs::join怎么用?PHP dmOs::join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dmOs
的用法示例。
在下文中一共展示了dmOs::join方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateDatabase
/**
* Update changed documentation pages in database
*/
protected function updateDatabase($branch)
{
$types = dmDb::query('Doc d')->select('d.type')->distinct()->fetchFlat();
$cultures = sfConfig::get('dm_i18n_cultures');
$originalCulture = sfDoctrineRecord::getDefaultCulture();
foreach ($types as $type) {
foreach ($cultures as $culture) {
sfDoctrineRecord::setDefaultCulture($culture);
$dir = dmOs::join($this->repo->getDir(), $type, $culture);
$files = sfFinder::type('file')->name('/^\\d{2}\\s-\\s.+\\.markdown$/')->in($dir);
foreach ($files as $file) {
$docName = preg_replace('/^\\d{2}\\s-\\s(.+)\\.markdown$/', '$1', basename($file));
$docRecord = dmDb::query('DocPage dp')->withI18n()->innerJoin('dp.Doc doc')->innerJoin('doc.Branch branch')->where('branch.number = ?', $branch)->andWhere('doc.type = ?', $type)->andWhere('dpTranslation.name = ?', $docName)->fetchOne();
if ($docRecord) {
$docText = file_get_contents($file);
if ($docRecord->text != $docText) {
$docRecord->text = $docText;
$docRecord->save();
}
}
}
}
}
sfDoctrineRecord::setDefaultCulture($originalCulture);
}
示例2: generateLayoutTemplates
protected function generateLayoutTemplates()
{
$this->logSection('diem', 'generate layout templates');
$filesystem = $this->get('filesystem');
foreach (dmDb::query('DmLayout l')->fetchRecords() as $layout) {
$template = $layout->get('template');
$templateFile = dmProject::rootify('apps/front/modules/dmFront/templates/' . $template . 'Success.php');
if (!file_exists($templateFile)) {
if ($filesystem->mkdir(dirname($templateFile))) {
$filesystem->copy(dmOs::join(sfConfig::get('dm_front_dir'), 'modules/dmFront/templates/pageSuccess.php'), $templateFile);
$filesystem->chmod($templateFile, 0777);
} else {
$this->logBlock('Can NOT create layout template ' . $template, 'ERROR');
}
}
}
$layoutFile = dmProject::rootify('apps/front/modules/dmFront/templates/layout.php');
if (!file_exists($layoutFile)) {
if ($filesystem->mkdir(dirname($layoutFile))) {
$filesystem->copy(dmOs::join(sfConfig::get('dm_front_dir'), 'modules/dmFront/templates/layout.php'), $layoutFile);
$filesystem->chmod($layoutFile, 0777);
} else {
$this->logBlock('Can NOT create layout ' . $layoutFile, 'ERROR');
}
}
}
示例3: getMarkdownLoremText
protected static function getMarkdownLoremText()
{
if (null === self::$markdownLoremText) {
self::$markdownLoremText = implode('', file(dmOs::join(sfConfig::get("dm_core_dir"), "data/lorem/markdown")));
}
return self::$markdownLoremText;
}
示例4: writeFixture
protected function writeFixture(dmModule $module, $securityDesc)
{
$this->clear();
if ($pluginName = $module->getPluginName()) {
$root = dmContext::getInstance()->getConfiguration()->getPluginConfiguration($pluginName)->getRootDir();
} else {
$root = sfConfig::get('sf_root_dir');
}
$fixturesRootPath = dmOs::join($root, 'data', 'fixtures');
foreach (array('admin', 'front') as $app) {
foreach (array('actions', 'components') as $actionKind) {
if (isset($securityDesc[$app]) && isset($securityDesc[$app][$actionKind]) && is_array($securityDesc[$app][$actionKind])) {
foreach ($securityDesc[$app][$actionKind] as $actionName => $actionDesc) {
if (isset($actionDesc['credentials'])) {
$credentials = (array) $module->getSecurityManager()->parseCredentials($actionDesc['credentials']);
foreach ($credentials as $credential) {
$this->addPermissionFor($credential, $module->getKey(), $actionName);
}
}
}
}
}
}
$this->doWriteFixture(dmOs::join($fixturesRootPath, 'DmPermissions', $module->getKey() . '.yml'));
}
示例5: loadVendorLib
protected function loadVendorLib()
{
$dir = dmOs::join(sfConfig::get('dm_core_dir'), 'lib/vendor/Text_Diff');
set_include_path(get_include_path() . PATH_SEPARATOR . $dir);
require_once dmOs::join($dir, 'Text/Diff.php');
require_once dmOs::join($dir, 'Text/Diff/Renderer/inline.php');
}
示例6: execute
/**
* @see sfTask
*/
protected function execute($arguments = array(), $options = array())
{
parent::execute($arguments, $options);
$projectWebPath = sfConfig::get('sf_web_dir');
$filesystem = new dmFilesystem($this->dispatcher, $this->formatter);
foreach (array('dmAdminPlugin', 'dmFrontPlugin') as $plugin) {
$this->logSection('plugin', 'Configuring plugin - ' . $plugin);
$this->installPluginAssets($plugin, dm::getDir() . '/' . $plugin);
}
// remove useless doctrine assets
if (is_readable($doctrineAssetPath = dmOs::join($projectWebPath, 'sfDoctrinePlugin'))) {
if (!is_link($doctrineAssetPath)) {
$filesystem->deleteDirContent($doctrineAssetPath);
}
$filesystem->remove($doctrineAssetPath);
}
// remove web cache dir
$webCacheDir = sfConfig::get('sf_web_dir') . '/cache';
if (is_link($webCacheDir)) {
$filesystem->remove($webCacheDir);
}
// create web cache dir
$filesystem->mkdir($webCacheDir);
if (!file_exists(dmOs::join($projectWebPath, 'sf'))) {
$filesystem->relativeSymlink(realpath(sfConfig::get('sf_symfony_lib_dir') . '/../data/web/sf'), dmOs::join($projectWebPath, 'sf'), true);
}
}
示例7: media_file_image_tag
function media_file_image_tag(DmMedia $file, $options = array()) {
$options = array_merge(array(
'width' => $file->isImage() ? 128 : 64,
'height' => $file->isImage() ? 98 : 64
), dmString::toArray($options, true));
if ($file->isImage()) {
$image = _media($file);
} else {
if (file_exists(
dmOs::join(
sfConfig::get('sf_web_dir')
.
'/dmCorePlugin/images/media/'
.
dmOs::getFileExtension($file->getFile(), false)
. '.png'
)
)) {
$image = _media('/dmCorePlugin/images/media/' . dmOs::getFileExtension($file->getFile(), false) . '.png');
} else {
$image = _media('/dmCorePlugin/images/media/unknown.png');
}
}
return $image->size($options['width'], $options['height']);
}
示例8: parse
protected function parse($configFiles)
{
// parse the yaml
$rawConfig = self::getConfiguration($configFiles);
$dmFrontConfig = self::parseYamls(array(dmOs::join(sfConfig::get('dm_front_dir'), 'config/routing.yml')));
$firstConfig = array();
$lastConfig = array();
foreach ($rawConfig as $key => $value) {
if (array_key_exists($key, $dmFrontConfig)) {
$lastConfig[$key] = $value;
} else {
$firstConfig[$key] = $value;
}
}
$config = array_merge($firstConfig, $lastConfig);
// collect routes
$routes = array();
foreach ($config as $name => $params) {
if (isset($params['type']) && 'collection' == $params['type'] || isset($params['class']) && false !== strpos($params['class'], 'Collection')) {
$options = isset($params['options']) ? $params['options'] : array();
$options['name'] = $name;
$options['requirements'] = isset($params['requirements']) ? $params['requirements'] : array();
$routes[$name] = array(isset($params['class']) ? $params['class'] : 'sfRouteCollection', array($options));
} else {
$routes[$name] = array(isset($params['class']) ? $params['class'] : 'sfRoute', array($params['url'] ? $params['url'] : '/', isset($params['params']) ? $params['params'] : (isset($params['param']) ? $params['param'] : array()), isset($params['requirements']) ? $params['requirements'] : array(), isset($params['options']) ? $params['options'] : array()));
}
}
return $routes;
}
示例9: __construct
/**
* Constructor.
* This method is used to construct a child class instance,
* and helps sfServiceContainer injects dependancies
*
* @param dmContext $context
* @param sfServiceContainer $container
*/
public function __construct(dmContext $context, sfServiceContainer $container, $user)
{
$this->context = $context;
$this->container = $container;
$this->user = $user;
$this->initialize(array('cache_dir' => dmOs::join(sfConfig::get('sf_cache_dir'), $this->getApplication(), 'security')));
}
示例10: loadConfiguration
protected function loadConfiguration()
{
sfConfig::add(array('sf_i18n' => true, 'sf_charset' => 'utf-8', 'sf_upload_dir_name' => str_replace(dmOs::normalize(sfConfig::get('sf_web_dir') . '/'), '', dmOs::normalize(sfConfig::get('sf_upload_dir'))), 'dm_data_dir' => dmOs::join(sfConfig::get('sf_data_dir'), 'dm'), 'dm_cache_dir' => dmOs::join(sfConfig::get('sf_cache_dir'), 'dm')));
if (extension_loaded('mbstring')) {
mb_internal_encoding('UTF-8');
}
dmConfig::initialize($this->dispatcher);
}
示例11: rootify
/**
* add sfConfig::get('sf_root_dir') to path
*/
public static function rootify($path)
{
if (!self::isInProject($path)) {
$path = dmOs::join(self::getRootDir(), $path);
} else {
$path = dmOs::join($path);
}
return $path;
}
示例12: renderHead
protected function renderHead()
{
return sprintf('<html>
<head>
<title>Diem %s System Check</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<style type="text/css">%s</style>
</head>', DIEM_VERSION, file_get_contents(dmOs::join(dm::getDir(), 'dmCorePlugin/web/lib/blueprint/screen.css')) . file_get_contents(dmOs::join(dm::getDir(), 'dmCorePlugin/web/css/serverCheck.css')));
}
示例13: getFullPath
public function getFullPath()
{
switch ($this->getType()) {
case self::MEDIA:
return $this->source->getFullPath();
case self::FILE:
return dmOs::join(sfConfig::get('sf_web_dir'), $this->getPathFromWebDir());
case self::REMOTE:
return $this->remotePath;
}
}
示例14: getAvailableModules
protected function getAvailableModules()
{
$modules = array();
foreach (glob(dmOs::join(sfConfig::get('dm_admin_dir'), 'modules/*'), GLOB_ONLYDIR) as $dir) {
$modules[] = basename($dir);
}
foreach (glob(dmOs::join(sfConfig::get('sf_plugins_dir'), '*/modules/*'), GLOB_ONLYDIR) as $dir) {
$modules[] = basename($dir);
}
return array_unique(array_merge($modules, self::$externalModules));
}
示例15: sync
public function sync($relDir)
{
if ('/' === $relDir[0]) {
throw new InvalidArgumentException($relDir . ' is not a relative web dir');
}
$dir = dmOs::join($this->webDir, $relDir);
if (!is_dir($dir)) {
throw new InvalidArgumentException($relDir . ' does not exist in ' . $this->webDir);
}
$this->syncDir($dir);
}