當前位置: 首頁>>代碼示例>>PHP>>正文


PHP dmString::toArray方法代碼示例

本文整理匯總了PHP中dmString::toArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP dmString::toArray方法的具體用法?PHP dmString::toArray怎麽用?PHP dmString::toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dmString的用法示例。


在下文中一共展示了dmString::toArray方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: 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

示例3: media_file_image_tag

function media_file_image_tag($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)->size($options['width'], $options['height']);
    } else {
        $image = _media('dmCore/images/media/unknown.png')->size($options['width'], $options['height']);
    }
    return $image;
}
開發者ID:jdart,項目名稱:diem,代碼行數:10,代碼來源:DmMediaHelper.php

示例4: 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

示例5: render

 public function render($attributes = array())
 {
     $attributes = dmString::toArray($attributes, true);
     return $this->open($attributes) . '<ul class="dm_form_elements">' . $this->getFormFieldSchema()->render($attributes) . '</ul>' . sprintf('<div class="actions">
     <div class="actions_part clearfix">
       %s%s
     </div>
     <div class="actions_part clearfix">
       %s%s
     </div>
   </div>', sprintf('<a class="cancel dm close_dialog dm button fleft">%s</a>', $this->__('Cancel')), sprintf('<input type="submit" class="submit try blue fright" name="try" value="%s" />', $this->__('Try')), sprintf('<a class="delete dm button red fleft" title="%s">%s</a>', $this->__('Delete this zone'), $this->__('Delete')), sprintf('<input type="submit" class="submit and_save green fright" name="and_save" value="%s" />', $this->__('Save and close'))) . $this->close();
 }
開發者ID:theolymp,項目名稱:diem,代碼行數:12,代碼來源:DmZoneFrontForm.php

示例6: render

 public function render($options = array())
 {
     $this->options = array_merge(dmString::toArray($options, true), $this->options);
     $this->html = $this->helper->open('ul', $this->options);
     $this->lastLevel = false;
     foreach ($this->tree as $node) {
         $this->level = $node[4];
         $this->html .= $this->renderNode($node);
         $this->lastLevel = $this->level;
     }
     $this->html .= str_repeat('</li></ul>', $this->lastLevel + 1);
     return $this->html;
 }
開發者ID:theolymp,項目名稱:diem,代碼行數:13,代碼來源:dmPageTreeView.php

示例7: render

 public function render($options = array(), $treeOptions = array())
 {
     $this->options = array_merge(dmString::toArray($options, true), $this->options);
     $rootColumnName = $this->getTree()->getAttribute('rootColumnName');
     $this->html = '';
     if ($rootColumnName) {
         foreach ($this->getTree()->fetchRoots() as $root) {
             $treeOptions = array_merge($treeOptions, array('root_id' => $root->{$rootColumnName}));
             $this->renderTree($options, $treeOptions);
         }
     } else {
         $this->renderTree($options, $treeOptions);
     }
     return $this->html;
 }
開發者ID:theolymp,項目名稱:diem,代碼行數:15,代碼來源:dmModelTreeView.php

示例8: renderNavigation

 public function renderNavigation($options = array())
 {
     if (!$this->pager->haveToPaginate()) {
         return '';
     }
     if (!empty($options)) {
         $this->setOptions(array_merge($this->getOptions(), dmString::toArray($options, true)));
     }
     $this->initBaseHref();
     $cacheKey = $this->calculateCacheKey();
     if (isset($this->navigationCache[$cacheKey])) {
         return $this->navigationCache[$cacheKey];
     }
     $html = $this->openPager() . $this->renderFirstAndPreviousLinks() . $this->renderPageLinks() . $this->renderNextAndLastLinks() . $this->closePager();
     if ($this->getOption('ajax')) {
         $this->context->getResponse()->addJavascript('front.ajaxPager');
     }
     $this->navigationCache[$cacheKey] = $html;
     return $html;
 }
開發者ID:theolymp,項目名稱:diem,代碼行數:20,代碼來源:dmFrontPagerView.php

示例9: renderArea

 public function renderArea($name, $options = array())
 {
     $options = dmString::toArray($options);
     //Set id of page we need
     $this->global_area_id = dmArray::get($options, 'global_area', null);
     unset($options['global_area']);
     $tagName = $this->getAreaTypeTagName($name);
     $area = $this->getArea($name);
     list($prefix, $type) = explode('.', $name);
     $options['class'] = array_merge(dmArray::get($options, 'class', array()), array('dm_area', 'dm_' . $prefix . '_' . $type, 'dm_area_' . $area['id'], $prefix == 'layout' ? 'dm_layout_shared' : '', $this->behaviorsManager->isAreaAttachable() ? 'dm_behaviors_attachable' : ''));
     $options['id'] = dmArray::get($options, 'id', 'dm_area_' . $area['id']);
     $html = '';
     /*
      * Add a content id for accessibility purpose ( access link )
      */
     if ('content' === $type) {
         $html .= '<div id="dm_content">';
     }
     $html .= $this->helper->open($tagName, $options);
     if ($this->behaviorsManager->isAreaAttachable()) {
         $html .= '<a class="dm dm_area_edit' . ($this->user->can('behavior_add') ? ' dm_behaviors_droppable' : '') . '">' . ('content' === $type ? $this->i18n->__('Content') : $this->i18n->__('Layout')) . '</a>';
         if ($this->user->can('behavior_edit') || $this->user->can('behavior_delete')) {
             $html .= '<a class="dm dm_edit_behaviors_icon dm_edit_behaviors_area_icon s16_gear s16" title="' . $this->i18n->__('Edit behaviors') . '"></a>';
         }
     }
     $html .= '<div class="dm_zones clearfix">';
     $html .= $this->renderAreaInner($area);
     $html .= '</div>';
     $html .= sprintf('</%s>', $tagName);
     /*
      * Add a content id for accessibility purpose ( access links )
      */
     if ('content' === $type) {
         $html .= '</div>';
     }
     return $html;
 }
開發者ID:runopencode,項目名稱:diem-extended,代碼行數:37,代碼來源:dmFrontPageEditHelper.php

示例10: compileVars

 protected function compileVars(array $vars = array())
 {
     $this->compiledVars = array_merge(array(), (array) json_decode((string) $this->behavior['dm_behavior_value'], true), array('dm_behavior_id' => $this->behavior['id'], 'dm_behavior_key' => $this->behavior['dm_behavior_key'], 'dm_behavior_attached_to' => $this->behavior['dm_behavior_attached_to'], 'dm_behavior_attached_to_id' => (int) $this->behavior['dm_page_id'] + $this->behavior['dm_area_id'] + $this->behavior['dm_zone_id'] + $this->behavior['dm_widget_id'], 'dm_behavior_attached_to_content' => $this->behavior['dm_behavior_attached_to_selector'] != '' ? true : false, 'dm_behavior_attached_to_selector' => $this->behavior['dm_behavior_attached_to_selector'] != '' ? $this->behavior['dm_behavior_attached_to_selector'] : null, 'dm_behavior_sequence' => $this->behavior['position'], 'dm_behavior_enabled' => $this->isEnabled(), 'dm_behavior_valid' => true), dmString::toArray($vars));
 }
開發者ID:runopencode,項目名稱:diem-extended,代碼行數:4,代碼來源:dmBehaviorBaseView.class.php

示例11: array

$t->is_deeply($string, '', '::retrieveOptFromString() sets the string parameter to an empty string');
// string overwrites opt
$t->diag('  ::retrieveOptFromString() overwriting');
$string = 'x=string';
$opt = array('x' => 'opt');
dmString::retrieveOptFromString($string, $opt);
$t->is_deeply($opt, array('x' => 'string'), '::retrieveOptFromString() string has the precedence over opt');
// ::retrieveCssFromString()
$t->diag('::retrieveCssFromString');
$cssFromStringsTests = array(array('', array(), '', array(), 'empty string'), array('#an_id', array(), '', array('id' => 'an_id'), 'one id only'), array('#an_id', array('id' => 'old'), '', array('id' => 'an_id'), 'id in opts is overridden'), array('.a_class', array(), '', array('class' => array('a_class')), 'one class only'), array('.a_class.another_class', array(), '', array('class' => array('a_class', 'another_class')), 'multiple classes'), array('#an_id.a_class', array(), '', array('id' => 'an_id', 'class' => array('a_class')), 'an id and a class'), array('#an_id.a_class href="/page"', array(), ' href="/page"', array('id' => 'an_id', 'class' => array('a_class')), 'garbage string after'), array('href="/page" a#an_id.a_class', array(), 'href="/page" a#an_id.a_class', array(), 'garbage string before'), array('#an_id alt="I am. Are you?"', array(), ' alt="I am. Are you?"', array('id' => 'an_id'), 'dots are not taken into account if not classes'), array('#an_id.imaclass alt="I am. Are you?"', array(), ' alt="I am. Are you?"', array('id' => 'an_id', 'class' => array('imaclass')), 'dots are not taken into account if not classes'), array('#an_id.imaclass alt="I am. Are you? and.imaclass"', array(), ' alt="I am. Are you? and.imaclass"', array('id' => 'an_id', 'class' => array('imaclass')), 'dots are not taken into account if not classes, and a class with same name exists'), array('.cls href="#anchor"', array(), ' href="#anchor"', array('class' => array('cls')), '# are not taken into account if not ids'), array('.cls href="page#anchor"', array(), ' href="page#anchor"', array('class' => array('cls')), '# are not taken into account if not ids, even if they have text before'));
foreach ($cssFromStringsTests as $cssFromStringsTest) {
    list($str, $opts, $expectedStr, $expectedOpts, $msg) = $cssFromStringsTest;
    dmString::retrieveCssFromString($str, $opts);
    $t->comment('  ::retrieveCssFromString() ' . $msg);
    $t->is_deeply($str, $expectedStr, '::retrieveCssFromString() ' . $msg . ': testing resulting string');
    $t->is_deeply($opts, $expectedOpts, '::retrieveCssFromString() ' . $msg . ': testing resulting opts');
}
// ::toArray()
$t->diag('::toArray()');
$t->is_deeply(dmString::toArray($arr = array('some' => 'array')), $arr, '::toArray() with an array returns the array');
$t->is_deeply(dmString::toArray(''), array(), '::toArray() with an empty string returns an empty array');
$t->is_deeply(dmString::toArray('#an_id.a_class.another_class'), array('id' => 'an_id', 'class' => array('a_class', 'another_class')), '::toArray() jquery style');
$t->is_deeply(dmString::toArray('an_option=a_value other_option=other_value'), array('an_option' => 'a_value', 'other_option' => 'other_value'), '::toArray() symfony style');
$t->is_deeply(dmString::toArray('#an_id.a_class.another_class an_option=a_value other_option=other_value'), array('id' => 'an_id', 'class' => array('a_class', 'another_class'), 'an_option' => 'a_value', 'other_option' => 'other_value'), '::toArray() with jquery AND symfony styles');
$t->is_deeply(dmString::toArray('#jquery id=symfony'), array('id' => 'symfony'), '::toArray() symfony style has precedence over jquery style');
$t->is_deeply(dmString::toArray('#an_id.a_class.another_class href=page#anchor'), array('id' => 'an_id', 'class' => array('a_class', 'another_class'), 'href' => 'page#anchor'), '::toArray() if a symfony style option contains a #');
$t->is_deeply(dmString::toArray('#an_id.a_class.another_class an_option=a_value other_option=other_value', true), array('id' => 'an_id', 'class' => 'a_class another_class', 'an_option' => 'a_value', 'other_option' => 'other_value'), '::toArray() with implodeClasses = true');
$t->is_deeply(dmString::toArray('action="http://site.com/url"'), array('action' => 'http://site.com/url'), 'correctly extract action');
$t->is_deeply(dmString::toArray('.class action="http://site.com/url"'), array('class' => array('class'), 'action' => 'http://site.com/url'), 'correctly extract action and class');
$t->is_deeply(dmString::toArray('#id.class action="http://site.com/url"'), array('id' => 'id', 'action' => 'http://site.com/url', 'class' => array('class')), 'correctly extract action, id and class');
開發者ID:theolymp,項目名稱:diem,代碼行數:30,代碼來源:dmStringTest.php

示例12: markdown

function markdown($markdown, $opt = array())
{
    return _tag('div.markdown', dmString::toArray($opt), sfContext::getInstance()->get('markdown')->toHtml($markdown));
}
開發者ID:runopencode,項目名稱:diem-extended,代碼行數:4,代碼來源:DmHelper.php

示例13: render

 public function render($attributes = array())
 {
     $attributes = dmString::toArray($attributes, true);
     return $this->open($attributes) . $this->renderContent($attributes) . $this->renderActions() . $this->close();
 }
開發者ID:runopencode,項目名稱:diem-extended,代碼行數:5,代碼來源:dmBehaviorBaseForm.class.php

示例14: renderBodyTag

 public function renderBodyTag($options = array())
 {
     return $this->getHelper()->open('body', dmString::toArray($options));
 }
開發者ID:runopencode,項目名稱:diem-extended,代碼行數:4,代碼來源:dmCoreLayoutHelper.php

示例15: renderBodyTag

 public function renderBodyTag($options = array())
 {
     $options = dmString::toArray($options);
     $options['class'] = array_merge(dmArray::get($options, 'class', array()), array($this->serviceContainer->getParameter('controller.module') . '_' . $this->serviceContainer->getParameter('controller.action')));
     return parent::renderBodyTag($options);
 }
開發者ID:jwegner,項目名稱:diem,代碼行數:6,代碼來源:dmAdminLayoutHelper.php


注:本文中的dmString::toArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。