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

PHP dmArray类代码示例

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

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



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

示例1: configure

 public function configure(array $options = array())
 {
     $options['default'] = null;
     foreach ($options['list'] as $themeName => $themeConfig) {
         // enabled options defaults to true
         if (null === dmArray::get($themeConfig, 'enabled')) {
             $options['list'][$themeName]['enabled'] = true;
         }
         // first enabled theme is the default theme
         if (null === $options['default'] && $options['list'][$themeName]['enabled']) {
             $options['default'] = $themeName;
         }
         // path is renamed to dir BC 5.0_BETA6
         if (isset($options['list'][$themeName]['path'])) {
             $options['list'][$themeName]['dir'] = $options['list'][$themeName]['path'];
             unset($options['list'][$themeName]['path']);
         }
         // theme key is the theme name
         $options['list'][$themeName]['name'] = $themeName;
     }
     if (null === $options['default']) {
         throw new dmException('No theme is enabled!');
     }
     return parent::configure($options);
 }
开发者ID:theolymp,项目名称:diem,代码行数:25,代码来源:dmThemeManager.php


示例2: getUrls

 protected function getUrls()
 {
     $urls = array('/');
     $routing = $this->context->getRouting();
     foreach ($this->context->getModuleManager()->getModules() as $module) {
         if (!$routing->hasRouteName($module->getUnderscore())) {
             continue;
         }
         $moduleUrl = $routing->generate($module->getUnderscore());
         $urls[] = $moduleUrl;
         if ($module->hasModel() && $module->getTable()->hasField('id')) {
             $records = $module->getTable()->createQuery('t')->select('t.id, RANDOM() AS rand')->orderBy('rand')->limit(2)->fetchArray();
             foreach ($records as $record) {
                 $urls[] = $moduleUrl . '/edit/pk/' . $record['id'];
             }
         }
     }
     foreach ($this->context->getModuleManager()->getTypes() as $type) {
         $urls[] = $this->context->getController()->genUrl($routing->getModuleTypeUrl($type));
         foreach ($type->getSpaces() as $space) {
             $urls[] = $this->context->getController()->genUrl($routing->getModuleSpaceUrl($space));
         }
     }
     $uriPrefixLength = strlen(dmArray::get(dmArray::get($routing->getOptions(), 'context'), 'prefix'));
     foreach ($urls as $index => $url) {
         $urls[$index] = substr($url, $uriPrefixLength);
     }
     return $urls;
 }
开发者ID:theolymp,项目名称:diem,代码行数:29,代码来源:dmAdminFunctionalCoverageTest.php


示例3: executeSaveFile

 public function executeSaveFile(dmWebRequest $request)
 {
     // modify existing media
     if ($mediaId = dmArray::get($request->getParameter('dm_admin_media_form'), 'id')) {
         $this->forward404Unless($media = dmDb::table('DmMedia')->find($mediaId));
         $form = new DmAdminMediaForm($media);
     } else {
         $media = null;
         $this->forward404Unless($folder = dmDb::table('DmMediaFolder')->find($request->getParameter('folder_id')));
         if (!$folder->isWritable()) {
             $this->getUser()->logAlert($this->getI18n()->__('Folder %1% is not writable', array('%1%' => $folder->fullPath)));
         }
         $form = new DmAdminMediaForm();
         $form->setDefault('dm_media_folder_id', $folder->id);
     }
     if ($request->isMethod('post') && $form->bindAndValid($request)) {
         $redirect = $form->getValue('file') || $media->dm_media_folder_id != $form->getValue('dm_media_folder_id');
         $media = $form->save();
         if ($redirect) {
             $this->getUser()->setFlash('dm_media_open', $media->id, false);
             return $this->renderText($this->getRouting()->getMediaUrl(dmDb::table('DmMediaFolder')->find($media->dm_media_folder_id)));
         }
     }
     $action = $media ? 'dmMediaLibrary/saveFile' : 'dmMediaLibrary/saveFile?folder_id=' . $folder->id;
     return $this->renderText($form->render('.dm_form.list.little action="' . $action . '"'));
 }
开发者ID:runopencode,项目名称:diem-extended,代码行数:26,代码来源:BasedmMediaLibraryActions.class.php


示例4: getWidgetValues

  public function getWidgetValues()
  {
    $values = parent::getWidgetValues();

    $values['items'] = array();

    foreach(dmArray::get($values, 'link', array()) as $index => $link)
    {
      $values['items'][] = array(
        'link'     => $values['link'][$index],
        'text'     => $values['text'][$index],
        'secure'   => (int) !empty($values['secure'][$index]),
        'nofollow' => (int) !empty($values['nofollow'][$index]),
        'depth'    => $values['depth'][$index]
      );
    }

    unset(
      $values['link'],
      $values['text'],
      $values['secure'],
      $values['nofollow'],
      $values['depth']
    );

    return $values;
  }
开发者ID:Regmaya,项目名称:diem,代码行数:27,代码来源:dmWidgetNavigationMenuForm.php


示例5: configure

 public function configure(array $data)
 {
     $isXhr = $data['context']->getRequest()->isXmlHttpRequest();
     $uri = $this->cleanUri(dmArray::get($data['server'], 'PATH_INFO', $data['server']['REQUEST_URI']));
     $milliseconds = (microtime(true) - dm::getStartTime()) * 1000;
     $this->data = array('time' => (string) $data['server']['REQUEST_TIME'], 'uri' => dmString::truncate($uri, 500), 'code' => (string) $data['context']->getResponse()->getStatusCode(), 'app' => (string) sfConfig::get('sf_app'), 'env' => (string) sfConfig::get('sf_environment'), 'ip' => (string) $data['server']['REMOTE_ADDR'], 'user_id' => (string) $data['context']->getUser()->getUserId(), 'user_agent' => dmString::truncate($isXhr ? '' : isset($data['server']['HTTP_USER_AGENT']) ? $data['server']['HTTP_USER_AGENT'] : '', 500), 'xhr' => (int) $isXhr, 'mem' => (string) memory_get_peak_usage(true), 'timer' => (string) sprintf('%.0f', $milliseconds), 'cache' => sfConfig::get('dm_internal_page_cached'));
 }
开发者ID:jdart,项目名称:diem,代码行数:7,代码来源:dmRequestLogEntry.php


示例6: executeCommand

 public function executeCommand(sfWebRequest $request)
 {
     $command = trim($request->getParameter("dm_command"));
     if (substr($command, 0, 2) == "sf") {
         $command = substr($command, 3);
         $exec = sprintf('%s "%s" %s --color', sfToolkit::getPhpCli(), dmProject::getRootDir() . '/symfony', $command);
     } else {
         $options = substr(trim($command), 0, 2) == 'll' || substr(trim($command), 0, 2) == 'ls' ? '--color' : '';
         $parts = explode(" ", $command);
         $parts[0] = dmArray::get($this->getAliases(), $parts[0], $parts[0]);
         $command = implode(" ", $parts);
         $parts = explode(" ", $command);
         $command = dmArray::get($this->getAliases(), $command, $command);
         if (!in_array($parts[0], $this->getCommands())) {
             return $this->renderText(sprintf("%s<li>This command is not available. You can do: <strong>%s</strong></li>", $this->renderCommand($command), implode(' ', $this->getCommands())));
         }
         $exec = sprintf("%s {$options}", $command);
     }
     ob_start();
     passthru($exec . ' 2>&1', $return);
     $raw = dmAnsiColorFormatHtmlRenderer::render(ob_get_clean());
     $arr = explode("\n", $raw);
     $res = $this->renderCommand($command);
     foreach ($arr as $a) {
         $res .= "<li class='dm_result_command'><pre>" . $a . "</pre></li>";
     }
     return $this->renderText($res);
 }
开发者ID:theolymp,项目名称:diem,代码行数:28,代码来源:actions.class.php


示例7: filterViewVars

  protected function filterViewVars(array $vars = array())
  {
    $vars = parent::filterViewVars($vars);

    $menuClass = dmArray::get($vars, 'menuClass');

    $vars['menu'] = $this->getService('menu', $menuClass ? $menuClass : null)
    ->ulClass($vars['ulClass']);

    foreach($vars['items'] as $index => $item)
    {
      $menuItem = $vars['menu']
      ->addChild($index.'-'.dmString::slugify($item['text']), $item['link'])
      ->label($item['text'])
      ->secure(!empty($item['secure']))
      ->liClass($vars['liClass'])
      ->addRecursiveChildren(dmArray::get($item, 'depth', 0));

      if(!empty($item['nofollow']) && $menuItem->getLink())
      {
        $menuItem->getLink()->set('rel', 'nofollow');
      }
    }

    unset($vars['items'], $vars['ulClass'], $vars['liClass']);

    return $vars;
  }
开发者ID:Regmaya,项目名称:diem,代码行数:28,代码来源:dmWidgetNavigationMenuView.php


示例8: createPageTranslations

 protected function createPageTranslations($pageId)
 {
     $cultures = $this->getOption('cultures');
     $translationTable = dmDb::table('DmPageTranslation');
     $existingCultures = $translationTable->createQuery('t')->where('t.id = ? ', $pageId)->andWhereIn('t.lang', $cultures)->select('t.lang')->fetchFlat();
     // can not generate translations from nothing
     if (empty($existingCultures)) {
         return;
     }
     // calculate missing cultures for this page
     $missingCultures = array_diff($cultures, $existingCultures);
     // all translations exist
     if (empty($missingCultures)) {
         return;
     }
     if (in_array(sfConfig::get('sf_default_culture'), $existingCultures)) {
         $mainCulture = sfConfig::get('sf_default_culture');
     } elseif (in_array(myDoctrineRecord::getDefaultCulture(), $existingCultures)) {
         $mainCulture = myDoctrineRecord::getDefaultCulture();
     } else {
         $mainCulture = dmArray::first($existingCultures);
     }
     $mainTranslationArray = $translationTable->createQuery('t')->select('t.slug, t.name, t.title, t.h1, t.description, t.keywords, t.is_active')->where('t.id = ?', $pageId)->andWhere('t.lang = ?', $mainCulture)->limit(1)->fetchOne(array(), Doctrine_Core::HYDRATE_ARRAY);
     $missingTranslations = new myDoctrineCollection(dmDb::table('DmPageTranslation'));
     if ($this->getOption('activate_new_translations')) {
         $isActive = $mainTranslationArray['is_active'];
     } else {
         $isActive = false;
     }
     foreach ($missingCultures as $culture) {
         $missingTranslations->add($translationTable->create(array_merge($mainTranslationArray, array('lang' => $culture, 'is_active' => $isActive))));
     }
     $missingTranslations->save();
 }
开发者ID:theolymp,项目名称:diem,代码行数:34,代码来源:dmPageI18nBuilder.php


示例9: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $this->logSection('Diem Extended', 'Setup ' . dmProject::getKey());
     $this->dispatcher->notify(new sfEvent($this, 'dm.setup.before', array('clear-db' => $options['clear-db'])));
     // don't use cache:clear task because it changes current app & environment
     @sfToolkit::clearDirectory(sfConfig::get('sf_cache_dir'));
     if (!file_exists(dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineRecord.php'))) {
         $this->getContext()->get('filesystem')->copy(dmOs::join(sfConfig::get('dm_core_dir'), 'data', 'skeleton', 'lib', 'model', 'doctrine', 'myDoctrineRecord.php'), dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineRecord.php'));
     }
     if (!file_exists(dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineQuery.php'))) {
         $this->getContext()->get('filesystem')->copy(dmOs::join(sfConfig::get('dm_core_dir'), 'data', 'skeleton', 'lib', 'model', 'doctrine', 'myDoctrineQuery.php'), dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineQuery.php'));
     }
     if (!file_exists(dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineTable.php'))) {
         $this->getContext()->get('filesystem')->copy(dmOs::join(sfConfig::get('dm_core_dir'), 'data', 'skeleton', 'lib', 'model', 'doctrine', 'myDoctrineTable.php'), dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineTable.php'));
     }
     $this->runTask('doctrine:build', array(), array('model' => true));
     if ($options['clear-db'] || $options['clear-tables'] || $this->isProjectLocked()) {
         $this->reloadAutoload();
         if ($options['clear-db']) {
             $this->runTask('doctrine:drop-db', array(), array('env' => $options['env'], 'no-confirmation' => dmArray::get($options, 'no-confirmation', false)));
         } else {
             $this->runTask('dm:drop-tables', array(), array('env' => $options['env']));
         }
         if ($options['clear-db'] && ($ret = $this->runTask('doctrine:build-db', array(), array('env' => $options['env'])))) {
             return $ret;
         }
         $this->runTask('doctrine:build-sql', array(), array('env' => $options['env']));
         $this->runTask('doctrine:insert-sql', array(), array('env' => $options['env']));
     } else {
         $this->runTask('dm:upgrade', array(), array('env' => $options['env']));
     }
     $this->reloadAutoload();
     $this->withDatabase();
     $this->runTask('dm:clear-cache', array(), array('env' => $options['env']));
     $this->getContext()->reloadModuleManager();
     $this->runTask('doctrine:build-forms', array(), array('generator-class' => 'dmDoctrineFormGenerator'));
     $this->runTask('doctrine:build-filters', array(), array('generator-class' => 'dmDoctrineFormFilterGenerator'));
     $this->runTask('dm:publish-assets');
     $this->runTask('dm:clear-cache', array(), array('env' => $options['env']));
     $this->reloadAutoload();
     $this->getContext()->reloadModuleManager();
     $this->runTask('dmAdmin:generate', array(), array('env' => $options['env']));
     if (!$options['dont-load-data']) {
         $this->runTask('dm:data', array(), array('load-doctrine-data' => $options['load-doctrine-data'], 'env' => $options['env']));
     }
     $this->logSection('Diem Extended', 'generate front modules');
     if (!($return = $this->context->get('filesystem')->sf('dmFront:generate --env=' . dmArray::get($options, 'env', 'dev')))) {
         $this->logBlock(array('Can\'t run dmFront:generate: ' . $this->context->get('filesystem')->getLastExec('output'), 'Please run "php symfony dmFront:generate" manually to generate front templates'), 'ERROR');
     }
     $this->runTask('dm:permissions');
     // fix db file permissions
     if ('Sqlite' === Doctrine_Manager::connection()->getDriverName()) {
         $this->filesystem->chmod(sfConfig::get('sf_data_dir'), 0777, 00);
     }
     $this->runTask('dm:clear-cache', array(), array('env' => $options['env']));
     $this->dispatcher->notify(new sfEvent($this, 'dm.setup.after', array('clear-db' => $options['clear-db'])));
     $this->logBlock('Setup successful', 'INFO_LARGE');
     $this->unlockProject();
 }
开发者ID:runopencode,项目名称:diem-extended,代码行数:62,代码来源:dmSetupTask.class.php


示例10: getOptionsForSelect

 protected function getOptionsForSelect($value, $choices)
 {
     $choices = dmArray::valueToKey($value ? $value : $choices);
     $html = parent::getOptionsForSelect($choices, $choices);
     // fcbkcomplete wants a class selected
     $html = str_replace('selected="selected"', 'class="selected"', $html);
     return $html;
 }
开发者ID:rafix,项目名称:ctaller,代码行数:8,代码来源:sfWidgetFormDmTagsAsString.php


示例11: label

 public function label($label = null, $attributes = array())
 {
     $attributes = dmString::toArray($attributes);
     $attributes['class'] = dmArray::toHtmlCssClasses(empty($attributes['class']) ? array('label') : array_merge((array) $attributes['class'], array('label')));
     $label = null === $label ? $this->parent->getWidget()->getLabel($this->name) : $label;
     $this->htmlBuffer .= parent::renderLabel($label, $attributes);
     return $this;
 }
开发者ID:runopencode,项目名称:diem-extended,代码行数:8,代码来源:dmFormField.php


示例12: configure

 public function configure(array $data)
 {
     $userId = dmArray::get($data, 'user_id', $this->serviceContainer->getService('user')->getUserId());
     if (!$userId && dmConfig::isCli()) {
         $userId = 'task';
     }
     $this->data = array('time' => (string) $data['server']['REQUEST_TIME'], 'ip' => (string) $this->getCurrentRequestIp(), 'session_id' => (string) session_id(), 'user_id' => (string) $userId, 'action' => (string) $data['action'], 'type' => (string) $data['type'], 'subject' => dmString::truncate($data['subject'], 500), 'record' => isset($data['record']) ? get_class($data['record']) . ':' . $data['record']->get('id') : '');
 }
开发者ID:theolymp,项目名称:diem,代码行数:8,代码来源:dmEventLogEntry.php


示例13: getBrowser

 /**
  * Guess user's browser
  * @return dmBrowser browser object
  */
 public function getBrowser()
 {
     if (!$this->isBrowserConfigured) {
         $this->browser->configureFromUserAgent(dmArray::get($_SERVER, 'HTTP_USER_AGENT'));
         $this->isBrowserConfigured = true;
     }
     return $this->browser;
 }
开发者ID:jdart,项目名称:diem,代码行数:12,代码来源:dmCoreUser.php


示例14: getWidgetValues

 public function getWidgetValues()
 {
     $values = parent::getWidgetValues();
     if (dmArray::get($values, 'removeMedia')) {
         $values['mediaId'] = null;
     }
     unset($values['removeMedia']);
     return $values;
 }
开发者ID:runopencode,项目名称:diem-extended,代码行数:9,代码来源:dmWidgetContentTextForm.php


示例15: renderPartial

 protected function renderPartial(array $vars)
 {
     if ($this->isCachable() && $this->context->getViewCacheManager()) {
         list($partialModule, $partialAction) = $this->getPartialModuleAction();
         $this->context->getViewCacheManager()->addCache($partialModule, '_' . $partialAction, array('withLayout' => false, 'lifeTime' => 86400, 'clientLifeTime' => 86400, 'contextual' => !$this->isStatic(), 'vary' => array(dmArray::get($this->widget, 'id'), $this->getService('user')->getUserId(), $this->getService('user')->getCulture())));
     }
     // add dm_widget to the component/partial vars
     $vars['dm_widget'] = $this->widget;
     return $this->doRenderPartial($vars);
 }
开发者ID:theolymp,项目名称:diem,代码行数:10,代码来源:dmWidgetBaseView.php


示例16: getResultsPager

 protected function getResultsPager(array $vars)
 {
     $results = $this->getService('search_engine')->search($vars['query']);
     if (empty($results)) {
         return null;
     }
     $pager = new dmSearchPager($results, dmArray::get($vars, 'maxPerPage', 99999));
     $pager->setPage($this->getService('request')->getParameter('page', 1));
     $pager->init();
     return $this->getService('front_pager_view')->setPager($pager)->setOption('navigation_top', dmArray::get($vars, 'navTop'))->setOption('navigation_bottom', dmArray::get($vars, 'navBottom'))->setBaseHref($this->getService('request')->getUri());
 }
开发者ID:theolymp,项目名称:diem,代码行数:11,代码来源:dmWidgetSearchResultsView.php


示例17: executeChangeMaxPerPage

 public function executeChangeMaxPerPage(sfWebRequest $request)
 {
     $this->forward404Unless($module = $this->context->getModuleManager()->getModuleBySfName($sfModule = $request->getParameter('dm_module')));
     if ($maxPerPage = $request->getParameter('max_per_page')) {
         $maxPerPages = sfConfig::get('dm_admin_max_per_page', array(10));
         $maxPerPage = in_array($maxPerPage, $maxPerPages) ? $maxPerPage : dmArray::first($maxPerPages);
         $this->getUser()->setAttribute($sfModule . '.max_per_page', $maxPerPage, 'admin_module');
         $this->getUser()->setAttribute($sfModule . '.page', 1, 'admin_module');
     }
     return $this->redirectBack();
 }
开发者ID:theolymp,项目名称:diem,代码行数:11,代码来源:actions.class.php


示例18: renderBodyTag

  public function renderBodyTag($options = array())
  {
    $options = dmString::toArray($options);

    $options['class'] = dmArray::toHtmlCssClasses(array_merge(dmArray::get($options, 'class', array()), array(
      'page_'.$this->page->get('module').'_'.$this->page->get('action'),
      $this->page->getPageView()->getLayout()->get('css_class')
    )));
    
    return parent::renderBodyTag($options);
  }
开发者ID:jaimesuez,项目名称:diem,代码行数:11,代码来源:dmFrontLayoutHelper.php


示例19: getBigLorem

 public static function getBigLorem($nbParagraphs = null)
 {
     $lorem = self::getLoremText();
     if (null === $nbParagraphs) {
         $nbParagraphs = 1;
     }
     $paragraphs = array();
     for ($it = 0; $it < $nbParagraphs; $it++) {
         $paragraphs[] = dmArray::get($lorem, array_rand($lorem));
     }
     return implode("\n", $paragraphs);
 }
开发者ID:theolymp,项目名称:diem,代码行数:12,代码来源:dmLorem.php


示例20: getResultsPager

 protected function getResultsPager(array $vars)
 {
     $this->index = $this->context->get('search_engine');
     if (count($results = $this->index->search($vars['query']))) {
         $pager = new dmSearchPager($results, dmArray::get($vars, 'maxPerPage', 99999));
         $pager->setPage($this->context->getRequest()->getParameter('page', 1));
         $pager->init();
     } else {
         $pager = null;
     }
     return $pager;
 }
开发者ID:jdart,项目名称:diem,代码行数:12,代码来源:dmWidgetSearchResultsView.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP dmDb类代码示例发布时间:2022-05-23
下一篇:
PHP dm类代码示例发布时间: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