• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP dmOs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testFolderCorrelations

 public function testFolderCorrelations(lime_test $t)
 {
     $t->diag('Verify that each db folder exist in fs');
     $errors = 0;
     foreach ($this->folderTable->findAll() as $f) {
         if (!is_dir($f->fullPath)) {
             $t->diag(sprintf('folder %s does not exist in fs', $f));
             $errors++;
         }
     }
     $t->is($errors, 0, 'Each db folder exist in fs');
     if ($errors > 0) {
         die;
     }
     $t->diag('Verify that each fs folder exist in db');
     $errors = 0;
     foreach (sfFinder::type('dir')->discard(".*")->ignore_version_control()->maxdepth(20)->in($this->folderTable->getTree()->fetchRoot()->fullPath) as $f) {
         if (strpos($f, '/.')) {
             continue;
         }
         $f = dmOs::normalize($f);
         $f = str_replace(dmOs::normalize(sfConfig::get('sf_upload_dir')) . '/', '', $f);
         if (!$this->folderTable->createQuery('f')->where('f.rel_path = ?', $f)->exists()) {
             $t->diag(sprintf('folder %s does not exist in db', $f));
             $errors++;
         }
     }
     $t->is($errors, 0, 'Each fs folder exist in db');
 }
开发者ID:theolymp,项目名称:diem,代码行数:29,代码来源:dmMediaUnitTestHelper.php


示例2: 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;
 }
开发者ID:theolymp,项目名称:diem,代码行数:7,代码来源:dmLorem.php


示例3: 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']);
}
开发者ID:jaimesuez,项目名称:diem,代码行数:27,代码来源:DmMediaHelper.php


示例4: 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;
 }
开发者ID:theolymp,项目名称:diem,代码行数:29,代码来源:dmFrontRoutingConfigHandler.php


示例5: perf

 protected function perf($kill = false)
 {
     if ($kill) {
         dmDebug::killForce(dmOs::getPerformanceInfos());
     }
     dmDebug::showForce(dmOs::getPerformanceInfos());
 }
开发者ID:theolymp,项目名称:diem,代码行数:7,代码来源:dmThread.php


示例6: renderGoogleAnalytics

 public function renderGoogleAnalytics()
 {
     if (($gaKey = dmConfig::get('ga_key')) && !$this->getService('user')->can('admin') && !dmOs::isLocalhost()) {
         return $this->getGoogleAnalyticsCode($gaKey);
     }
     return '';
 }
开发者ID:jdart,项目名称:diem,代码行数:7,代码来源:dmFrontLayoutHelper.php


示例7: 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);
     }
 }
开发者ID:theolymp,项目名称:diem,代码行数:30,代码来源:dmPublishAssetsTask.class.php


示例8: __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')));
 }
开发者ID:theolymp,项目名称:diem,代码行数:15,代码来源:dmModuleSecurityAbstract.class.php


示例9: 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'));
 }
开发者ID:rafix,项目名称:diem,代码行数:25,代码来源:dmGeneratePermissionsFixturesTask.class.php


示例10: 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);
 }
开发者ID:Regmaya,项目名称:diem-project,代码行数:28,代码来源:gitDocumentationSynchronizer.php


示例11: 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');
         }
     }
 }
开发者ID:theolymp,项目名称:diem,代码行数:26,代码来源:dmFrontGenerateTask.class.php


示例12: 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');
 }
开发者ID:theolymp,项目名称:diem,代码行数:7,代码来源:dmTextDiff.php


示例13: 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);
 }
开发者ID:theolymp,项目名称:diem,代码行数:8,代码来源:dmCorePluginConfiguration.class.php


示例14: doClean

 /**
  * @see sfValidatorUrl
  */
 protected function doClean($value)
 {
     $value = parent::doClean($value);
     if ($value !== dmOs::sanitizeDirName($value)) {
         throw new sfValidatorError($this, 'invalid', array('value' => $value));
     }
     return $value;
 }
开发者ID:theolymp,项目名称:diem,代码行数:11,代码来源:dmValidatorDirectoryName.php


示例15: media_file_infos

function media_file_infos(DmMedia $object)
{
    $infos = array(__('Size') => dmOs::humanizeSize($object->get('size')), __('Type') => $object->get('mime'), __('Created at') => format_date($object->get('created_at'), 'f'), __('Updated at') => format_date($object->get('updated_at'), 'f'), __('Url') => $object->getFullWebPath());
    if ($object->isImage()) {
        $infos = array_merge(array(__('Dimensions') => $object->getDimensions()), $infos);
    }
    return $infos;
}
开发者ID:jdart,项目名称:diem,代码行数:8,代码来源:DmMediaHelper.php


示例16: createMediaFromUploadedFile

 protected function createMediaFromUploadedFile(array &$values)
 {
     $file = $values['file'];
     $folder = dmDb::table('DmMediaFolder')->findOneByRelPathOrCreate('widget');
     $media = dmDb::table('DmMedia')->findOneByFileAndDmMediaFolderId(dmOs::sanitizeFileName($file->getOriginalName()), $folder->id);
     if (!$media) {
         $media = dmDb::create('DmMedia', array('dm_media_folder_id' => $folder->id))->create($file)->saveGet();
     }
     $values['mediaId'] = $media->id;
 }
开发者ID:theolymp,项目名称:diem,代码行数:10,代码来源:dmWidgetContentBaseMediaForm.php


示例17: 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);
 }
开发者ID:KnpLabs,项目名称:knpDmRackspacePlugin,代码行数:11,代码来源:knpDmRackspaceSynchronizer.php


示例18: 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));
 }
开发者ID:jdart,项目名称:diem,代码行数:11,代码来源:dmAdminPluginConfiguration.class.php


示例19: 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;
     }
 }
开发者ID:theolymp,项目名称:diem,代码行数:11,代码来源:dmMediaResource.php


示例20: clearName

 public function clearName($validator, $values)
 {
     if (!empty($values['file'])) {
         $filename = dmOs::sanitizeFileName($values['file']->getOriginalName());
         if (empty($filename)) {
             $error = new sfValidatorError($validator, 'This is a bad name');
             // throw an error bound to the password field
             throw new sfValidatorErrorSchema($validator, array('file' => $error));
         }
     }
     return $values;
 }
开发者ID:jdart,项目名称:diem,代码行数:12,代码来源:PluginDmMediaForm.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP dmString类代码示例发布时间:2022-05-23
下一篇:
PHP dmDb类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap