예제 #1
0
 public static function onCCK_Storage_LocationAfterRender(&$buffer, &$data, $uri = array())
 {
     $app = JFactory::getApplication();
     if ($uri['layout']) {
         return;
     }
     if ($uri['view'] == 'featured') {
         $data['return_view'] = 'featured';
         $tag = '&return=featured';
     } else {
         $data['return_view'] = '';
         $tag = '';
     }
     $class = JCck::on('3.4') ? ' class="hasTooltip"' : '';
     $data['doIntegration'] = false;
     $data['multilanguage'] = $data['options']->get('multilanguage', 0);
     if ($data['multilanguage']) {
         $data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&amp;task=article.edit' . $tag . '&amp;id=([0-9]*)" (.*)>#U';
     } else {
         $data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&amp;task=article.edit' . $tag . '&amp;id=([0-9]*)"#';
     }
     $data['search_alt'] = '#<a href = "javascript://" onclick="listItemTask\\(\'cb([0-9]*)\', \'articles.archive\'\\)">(.*)</a>#sU';
     if (JCckDevHelper::hasLanguageAssociations() && $data['multilanguage']) {
         $query = 'SELECT a.pk, a.cck, b.key, c.language FROM #__cck_core AS a' . ' LEFT JOIN #__associations AS b ON ( b.id = a.pk AND context = "com_content.item" )' . ' LEFT JOIN #__content AS c ON c.id = a.pk' . ' WHERE storage_location="joomla_article"';
         $list_assoc = JCckDatabase::loadObjectListArray('SELECT a.id, a.key, b.language FROM #__associations AS a LEFT JOIN #__content AS b ON ( b.id = a.id AND a.context = "com_content.item" )', 'key', 'language');
     } else {
         $query = 'SELECT pk, cck FROM #__cck_core WHERE storage_location="joomla_article"';
         $list_assoc = array();
     }
     $list = JCckDatabase::loadObjectList($query, 'pk');
     $buffer = JCckDevIntegration::rewriteBuffer($buffer, $data, $list, $list_assoc);
 }
예제 #2
0
 public function onAfterRender()
 {
     $app = JFactory::getApplication();
     $option = $app->input->get('option', '');
     $view = $app->input->get('view', '');
     $layout = $app->input->get('layout', '');
     // site
     if ($app->isSite()) {
         if ($this->multisite === true && $this->site_cfg->get('offline') && isset($this->offline_buffer)) {
             $uri = JFactory::getURI();
             $app->setUserState('users.login.form.data', array('return' => (string) $uri));
             JResponse::setHeader('Status', '503 Service Temporarily Unavailable', 'true');
             JResponse::setBody($this->offline_buffer);
         }
         return;
     }
     // admin
     if ($app->isAdmin() && JFactory::getDocument()->getType() == 'html') {
         $buffer = JResponse::getBody();
         $buffer = str_replace('icon-cck-', 'myicon-cck-', $buffer);
         switch ($option) {
             case 'com_cck':
             case 'com_cck_developer':
             case 'com_cck_ecommerce':
             case 'com_cck_exporter':
             case 'com_cck_importer':
             case 'com_cck_manager':
             case 'com_cck_multilingual':
             case 'com_cck_packager':
             case 'com_cck_toolbox':
             case 'com_cck_updater':
             case 'com_cck_webservices':
                 $buffer = $this->_setBasics($buffer, $option, $view);
                 break;
             case 'com_postinstall':
                 $eid = $app->input->get('eid', 0);
                 $eid2 = JCckDatabase::loadResult('SELECT extension_id FROM #__extensions WHERE type = "component" AND element = "com_cck"');
                 if ($eid && $eid == $eid2) {
                     $buffer = str_replace('com_cck', 'SEBLOD', $buffer);
                     $buffer = str_replace('option=SEBLOD', 'option=com_cck', $buffer);
                 }
                 break;
             case 'com_templates':
                 if ($view == 'templates' || $layout == 'edit') {
                     break;
                 }
                 $search = '#administrator/index.php\\?option=com_templates&amp;task=style.edit&amp;id=(.*)">(.*)</a>#sU';
                 $list = JCckDatabase::loadObjectList('SELECT a.id, b.name FROM #__template_styles AS a LEFT JOIN #__cck_core_templates AS b ON b.name = a.template WHERE b.name != ""', 'id');
                 preg_match_all($search, $buffer, $matches);
                 if (count($matches[1])) {
                     $i = 0;
                     $style = 'height:14px; color:#ffffff; background-color:#0088CC; margin:0px 12px 0px 12px; padding:2px 8px 2px 8px; font-size:10px; font-weight:bold;';
                     foreach ($matches[1] as $match) {
                         if (isset($list[$match])) {
                             $replace = $matches[0][$i] . '<span style="' . $style . '">SEBLOD</span>Do NOT set as Default Template !';
                             $buffer = str_replace($matches[0][$i], $replace, $buffer);
                         }
                         $i++;
                     }
                 }
                 break;
             default:
                 $and = $view ? ' AND ( a.view = "' . $view . '" OR a.view = "" )' : '';
                 $locations = JCckDatabase::loadObjectList('SELECT a.name, a.options FROM #__cck_core_objects AS a WHERE a.component = "' . $option . '"' . $and);
                 $uri = array('option' => $option, 'view' => $view, 'layout' => $layout);
                 if (count($locations)) {
                     foreach ($locations as $location) {
                         $path = JPATH_SITE . '/plugins/cck_storage_location/' . $location->name . '/classes/integration.php';
                         if (is_file($path)) {
                             $data = array('doIntegration' => false, 'multilanguage' => 0, 'options' => new JRegistry($location->options), 'replace_end' => '"', 'return_option' => substr($option, 4), 'return_view' => $view, 'return' => '', 'search' => '', 'search_alt' => '');
                             require_once $path;
                             JCck::callFunc_Array('plgCCK_Storage_Location' . $location->name . '_Integration', 'onCCK_Storage_LocationAfterRender', array(&$buffer, &$data, $uri));
                             if ($data['doIntegration']) {
                                 $list = JCckDatabase::loadObjectList('SELECT pk, cck FROM #__cck_core WHERE storage_location="' . $location->name . '"', 'pk');
                                 $buffer = JCckDevIntegration::rewriteBuffer($buffer, $data, $list);
                             }
                         }
                     }
                 }
                 break;
         }
         JResponse::setBody($buffer);
         return;
     }
 }