Пример #1
0
 /**
  * Helper main function
  * @param $actionsHtml String HTML code showing the action buttons
  * @param $content String The content of this element
  * @param $dbId Int DB id of the object
  * @param $order Int order of this item in the DB
  * @param $params Array parameters (if any)
  * @return String HTML to be inserted in the view
  */
 public function contentViewembeder($actionsHtml = '', $content = '', $dbId = 0, $order = 0, $params = array(), $moduleName = 'adminpages', $pageStructureId = 0, $sharedInIds = '')
 {
     $toReturn = '';
     if (!empty($content)) {
         switch (Sydney_Tools::getConf('helpers')->content->viewembedder->method) {
             case 'ajax':
                 $toReturn = Sydney_View_Embedder_Content::ajaxContents($content);
                 break;
             case 'filegetcontents':
                 $toReturn = file_get_contents(Sydney_Tools::getRootUrl() . '/' . $content . '/sydneylayout/no/');
                 break;
             case 'curlgetcontents':
                 $toReturn = Sydney_View_Embedder_Content::curlGetContents(Sydney_Tools::getRootUrl() . $content . '/sydneylayout/no/');
                 break;
             case 'action':
             default:
                 $i = 0;
                 $module = null;
                 $controller = null;
                 $action = null;
                 $oldv = null;
                 $params2 = array();
                 foreach (preg_split("/\\//", $content) as $v) {
                     if ($i == 1) {
                         $module = $v;
                     } elseif ($i == 2) {
                         $controller = $v;
                     } elseif ($i == 3) {
                         $action = $v;
                     } elseif ($i > 3) {
                         if ($i % 2 == 0) {
                             $params2[$v] = null;
                             $oldv = $v;
                         }
                         if ($i % 2 == 1) {
                             $params2[$oldv] = $v;
                             $oldv = null;
                         }
                     }
                     $i++;
                 }
                 $toReturn = $this->view->action($action, $controller, $module, $params2);
                 break;
         }
     }
     // END - if content
     return '
         <li
             class="' . $params['addClass'] . ' sydney_editor_li"
             type=""
             dbparams="' . $content . '"
             editclass="viewembeder"
             dbid="' . $dbId . '"
             dborder="' . $order . '"
             data-content-type="view-embedder-block"
             pagstructureid="' . $pageStructureId . '"
             sharedinids="' . $sharedInIds . '">' . $actionsHtml . '<div class="content">' . $toReturn . '</div></li>';
 }
Пример #2
0
 /**
  * Helper main function
  * @param $actionsHtml String HTML code showing the action buttons
  * @param $content String The content of this element
  * @param $dbId Int DB id of the object
  * @param $order Int order of this item in the DB
  * @param $params Array parameters (if any)
  * @return String HTML to be inserted in the view
  */
 public function contentViewembeder($actionsHtml = '', $content = '', $dbId = 0, $order = 0, $params = array(), $pagstructureId = 0)
 {
     if (!empty($content)) {
         switch (Sydney_Tools_Sydneyglobals::getConf('helpers')->content->viewembedder->method) {
             case 'ajax':
                 return Sydney_View_Embedder_Content::ajaxContents($content);
                 break;
             case 'filegetcontents':
                 return file_get_contents(Sydney_Tools::getRootUrl() . '/' . $content . '/sydneylayout/no/');
                 break;
             case 'curlgetcontents':
                 return Sydney_View_Embedder_Content::curlGetContents(Sydney_Tools::getRootUrl() . $content . '/sydneylayout/no/');
                 break;
             case 'action':
             default:
                 $i = 0;
                 $module = null;
                 $controller = null;
                 $action = null;
                 $oldv = null;
                 $params2 = array();
                 foreach (preg_split("/\\//", $content) as $v) {
                     if ($i == 1) {
                         $module = $v;
                     } elseif ($i == 2) {
                         $controller = $v;
                     } elseif ($i == 3) {
                         $action = $v;
                     } elseif ($i > 3) {
                         if ($i % 2 == 0) {
                             $params2[$v] = null;
                             $oldv = $v;
                         }
                         if ($i % 2 == 1) {
                             $params2[$oldv] = $v;
                             $oldv = null;
                         }
                     }
                     $i++;
                 }
                 return $this->view->action($action, $controller, $module, array_merge($params2, $params));
                 break;
         }
     }
     // END - if content
     return '';
 }
Пример #3
0
 public static function ajaxContents($url)
 {
     self::setUrl($url);
     $divId = uniqid();
     return "<div id='" . $divId . "'></div><script>\n\t\t\t\$.get('" . Sydney_Tools::getRootUrl() . "/" . self::$url . "/sydneylayout/no', function(data) {\n\t\t\t  \$('#" . $divId . "').html(data);\n\t\t\t});\n\t\t</script>";
 }
Пример #4
0
 /**
  *
  * Enter description here ...
  */
 public function getContentHtmlToText($controller = null)
 {
     if ($this->row === null) {
         return '';
     } else {
         if ($controller) {
             $view = $controller->view;
         }
         set_time_limit(120);
         if (!$controller) {
             $html = file_get_contents(Sydney_Tools::getRootUrl() . '/publicms/index/view/page/' . $this->get()->id . '/layout/no');
             if (Sydney_Search_Indexation_Pages_Build::$debug) {
                 echo chr(10), 'Indexed: ', '/publicms/index/view/page/' . $this->get()->id . '/layout/no';
             }
         } else {
             $html = $view->action('view', 'index', 'publicms', array('format' => 'xml', 'page' => $this->get()->id, 'layout' => 'no'));
         }
         // JTO - 06/09/2013 - on enlève les scripts JS et leur contenu de la recherche
         $html = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $html);
         $text = strip_tags($html, '<br><p>');
         // Re-init controller principal
         if ($controller) {
             $controller->init();
         }
         return $text;
     }
 }