示例#1
0
 public function view()
 {
     $this->set('unique_identifier', Core::make('helper/validation/identifier')->getString(18));
     if ($this->description) {
         $this->set('description', LinkAbstractor::translateFrom($this->description));
     }
 }
 /**
  * This is taking data OUT of the database and sending it into the page.
  *  @dataProvider contentsFrom
  */
 public function testFrom($from, $to)
 {
     self::createPage('Awesome');
     self::createPage('All Right', '/awesome');
     $translated = \Concrete\Core\Editor\LinkAbstractor::translateFrom($from);
     $this->assertEquals($to, $translated);
 }
示例#3
0
 public static function content(ContentBlockController $controller)
 {
     $content = $controller->getSearchableContent();
     $dom = new HtmlDomParser();
     $r = $dom->str_get_html($content, true, true, DEFAULT_TARGET_CHARSET, false);
     if (is_object($r)) {
         foreach ($r->find('concrete-picture') as $picture) {
             $fID = $picture->fid;
             $fo = File::getByID($fID);
             if (is_object($fo)) {
                 $tag = new AmpImg($fo);
                 $tag->alt($picture->alt);
                 $picture->outertext = (string) $tag;
             }
         }
         foreach ($r->find('img') as $img) {
             $tag = new Element('amp-img');
             $tag->alt($img->alt);
             $tag->src($img->src);
             $tag->height($img->height);
             $tag->width($img->width);
             $img->outertext = (string) $tag;
         }
         foreach ($r->find('*[style]') as $element) {
             $element->removeAttribute('style');
         }
         $content = (string) $r->restore_noise($r);
     }
     $content = LinkAbstractor::translateFrom($content);
     return $content;
 }
示例#4
0
 public function getEntries()
 {
     $db = Database::get();
     $r = $db->GetAll('SELECT * from btImageSliderEntries WHERE bID = ? ORDER BY sortOrder', array($this->bID));
     // in view mode, linkURL takes us to where we need to go whether it's on our site or elsewhere
     $rows = array();
     foreach ($r as $q) {
         if (!$q['linkURL'] && $q['internalLinkCID']) {
             $c = Page::getByID($q['internalLinkCID'], 'ACTIVE');
             $q['linkURL'] = $c->getCollectionLink();
             $q['linkPage'] = $c;
         }
         $q['description'] = LinkAbstractor::translateFrom($q['description']);
         $rows[] = $q;
     }
     return $rows;
 }
示例#5
0
 public function edit()
 {
     $this->set('description1', LinkAbstractor::translateFrom($this->description1));
     $this->requireAsset('core/file-manager');
     $this->requireAsset('core/sitemap');
     $this->requireAsset('css', 'font-awesome');
     $this->requireAsset('redactor');
     $classes = $this->getIconClasses();
     // let's clean them up
     $icons = array('' => t('Choose Icon'));
     $txt = Core::make('helper/text');
     foreach ($classes as $class) {
         $icons[$class] = $txt->unhandle($class);
     }
     $this->set('icons', $icons);
     $this->setRecordsForDisplay();
 }
 public function testFrom()
 {
     $from = '<p>This is really nice.</p><concrete-picture fID="1" alt="Happy Cat" />';
     // create the default storage location first.
     mkdir($this->getStorageDirectory());
     $this->getStorageLocation();
     $fi = new \Concrete\Core\File\Importer();
     $file = dirname(__FILE__) . '/fixtures/background-slider-blue-sky.png';
     $r = $fi->import($file, 'background-slider-blue-sky.png');
     $path = $r->getRelativePath();
     $translated = \Concrete\Core\Editor\LinkAbstractor::translateFrom($from);
     $to = '<p>This is really nice.</p><img src="' . $path . '" alt="Happy Cat" width="48" height="20">';
     $this->assertEquals('background-slider-blue-sky.png', $r->getFilename());
     $this->assertEquals($to, $translated);
     $c = new \Concrete\Block\Content\Controller();
     $c->content = $from;
     $sx = new SimpleXMLElement('<test />');
     $c->export($sx);
     $content = (string) $sx->data->record->content;
     $this->assertEquals('<p>This is really nice.</p><concrete-picture alt="Happy Cat" file="background-slider-blue-sky.png" />', $content);
 }
示例#7
0
 /**
  * This is taking data OUT of the database and sending it into the page.
  *  @dataProvider contentsFrom
  */
 public function testFrom($from, $to)
 {
     $translated = LinkAbstractor::translateFrom($from);
     $this->assertEquals($to, $translated);
 }
示例#8
0
 public function view()
 {
     $this->set('paragraph', LinkAbstractor::translateFrom($this->paragraph));
     $this->set('linkURL', $this->getLinkURL());
 }
 public function getContent()
 {
     return LinkAbstractor::translateFrom($this->content);
 }
 public function view()
 {
     $c = $this->request->getCurrentPage();
     if (!is_object($c) || $c->isError()) {
         $c = null;
     }
     if ($c !== null && $c->isEditMode()) {
         $this->set('output', '<div class="ccm-edit-mode-disabled-item"><div style="padding: 10px 5px">' . t('Redirect block') . '</div></div>');
     } else {
         $showMessage = false;
         switch ($this->showMessage) {
             case self::SHOWMESSAGE_ALWAYS:
                 $showMessage = true;
                 break;
             case self::SHOWMESSAGE_EDITORS:
                 if ($c !== null && $this->userCanEdit($c)) {
                     $showMessage = true;
                 }
                 break;
         }
         if ($showMessage) {
             if ($this->useCustomMessage) {
                 $msg = (string) $this->customMessage;
                 if ($msg !== '') {
                     $msg = LinkAbstractor::translateFrom($msg);
                 }
             } else {
                 $msg = '<span class="redirect-block-message">' . t('This block will redirect selected users.') . '</span>';
             }
             $this->set('output', $msg);
         }
     }
 }