Ejemplo n.º 1
0
 public function render()
 {
     if (sfConfig::get('sf_debug')) {
         $this->text('[EXCEPTION] ' . $this->exception->getMessage())->param('dm_debug', 1)->title('Click me to see the exception details');
     }
     return parent::render();
 }
Ejemplo n.º 2
0
 protected function initialize(array $options = array())
 {
     parent::initialize($options);
     $this->addAttributeToRemove(array('external_blank'));
     $this->uri = $this->resource->getSubject();
     if ($this->options['external_blank'] && 0 !== strncmp($this->uri, $this->requestContext['absolute_url_root'], strlen($this->requestContext['absolute_url_root'])) && 0 !== strncmp($this->uri, $this->requestContext['prefix'], strlen($this->requestContext['prefix']))) {
         $this->target('_blank');
     }
 }
Ejemplo n.º 3
0
 protected function prepareAttributesForHtml(array $attributes)
 {
     $attributes = parent::prepareAttributesForHtml($attributes);
     if (!sfConfig::get('dm_search_populating')) {
         // inactive page
         if ($this->user && !$this->page->_getI18n('is_active') && !$this->user->can('site_view')) {
             $attributes['class'][] = 'dm_inactive';
             $attributes['tag'] = 'span';
         }
         // current page
         if ($this->isCurrent() && empty($attributes['anchor'])) {
             $attributes['class'][] = $attributes['current_class'];
             if ($attributes['current_span']) {
                 $attributes['tag'] = 'span';
             }
         } elseif ($this->isParent()) {
             $attributes['class'][] = $attributes['parent_class'];
         }
     }
     return $attributes;
 }
Ejemplo n.º 4
0
 protected function prepareAttributesForHtml(array $attributes)
 {
     $attributes = parent::prepareAttributesForHtml($attributes);
     list($attributes['href'], $attributes['params']) = $this->getBaseHref(true);
     if (array_key_exists('params', $attributes)) {
         if (!empty($attributes['params'])) {
             $attributes['href'] = $this->buildUrl(dmString::getBaseFromUrl($attributes['href']), array_merge(dmString::getDataFromUrl($attributes['href']), $attributes['params']));
             /*
              * if last href char is a =, remove it
              * fixes http://github.com/diem-project/diem/issues/#issue/6
              */
             if ('=' === substr($attributes['href'], -1)) {
                 $attributes['href'] = substr($attributes['href'], 0, strlen($attributes['href']) - 1);
             }
         }
         unset($attributes['params']);
     }
     if (isset($attributes['anchor'])) {
         $attributes['href'] .= '#' . $attributes['anchor'];
     }
     // makes unit testing easier
     ksort($attributes);
     return $attributes;
 }
Ejemplo n.º 5
0
 protected function initialize(array $options = array())
 {
     parent::initialize($options);
     $this->media = $this->resource->getSubject();
 }