Changeset 803 for branches/Ver2.4/xpressme_integration_kit
- Timestamp:
- Apr 3, 2012, 9:33:21 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Ver2.4/xpressme_integration_kit/include/xpress_render.php
r672 r803 180 180 } 181 181 182 function xpress_meta_assign($meta_key,$meta_word){ 183 global $xoopsTpl,$xoTheme; //for XOOPS 184 185 if (!empty($meta_key) && !empty($meta_word)){ 186 if (defined('LEGACY_MODULE_VERSION') && version_compare(LEGACY_MODULE_VERSION, '2.2', '>=')) { 187 // For XCL 2.2 188 $xclRoot =& XCube_Root::getSingleton(); 189 $headerScript = $xclRoot->mContext->getAttribute('headerScript'); 190 $headerScript->addMeta($meta_key, $meta_word); 191 } elseif (isset($xoTheme) && is_object($xoTheme)) { 192 // For XOOPS 2.3 or higher & Impress CMS. 193 $xoTheme->addMeta('meta', $meta_key, $meta_word); 194 } 195 $xoopsTpl->assign('xoops_meta_'. $meta_key, $meta_word); 196 } 197 } 198 function xpress_get_xoops_meta($meta_key){ 199 global $xoopsTpl,$xoTheme; //for XOOPS 200 201 if (defined('LEGACY_MODULE_VERSION') && version_compare(LEGACY_MODULE_VERSION, '2.2', '>=')) { 202 // For XCL 2.2 203 $moduleHandler =& xoops_gethandler('module'); 204 $legacyRender =& $moduleHandler->getByDirname('legacyRender'); 205 $configHandler =& xoops_gethandler('config'); 206 $configs =& $configHandler->getConfigsByCat(0, $legacyRender->get('mid')); 207 $ret = htmlspecialchars($configs['meta_'.$meta_key]); 208 } elseif (isset($xoTheme) && is_object($xoTheme)) { 209 $ret = $xoTheme->metas['meta'][$meta_key]; 210 } else { 211 $ret = $xoopsTpl->get_template_vars('xoops_meta_'.$meta_key); 212 } 213 return $ret; 214 } 215 216 182 217 //rendering for the module header and the body 183 218 function xpress_render($contents){ … … 196 231 $xoopsTpl->assign('xoops_pagetitle', $page_title); 197 232 198 $xoops_keywords = $xoopsTpl->get_template_vars('xoops_meta_keywords'); 233 $xoops_keywords = xpress_get_xoops_meta('keywords'); 234 199 235 $wp_keyword = get_xpress_meta_name('keywords',$contents); 200 236 switch ($xpress_config->meta_keyword_type){ … … 202 238 break; 203 239 case 'wordpress': 204 if (!empty($wp_keyword)) 205 $xoopsTpl->assign('xoops_meta_keywords', $wp_keyword); 240 if (!empty($wp_keyword)){ 241 xpress_meta_assign('keywords', $wp_keyword); 242 } 206 243 break; 207 244 case 'wordpress_xoops': … … 212 249 $keywords = $wp_keyword; 213 250 } 214 $xoopsTpl->assign('xoops_meta_keywords', $keywords);251 xpress_meta_assign('keywords', $keywords); 215 252 } 216 253 break; … … 218 255 } 219 256 220 $xoops_description = $xoopsTpl->get_template_vars('xoops_meta_description');257 $xoops_description = xpress_get_xoops_meta('description'); 221 258 $wp_description = get_xpress_meta_name('description',$contents); 259 222 260 switch ($xpress_config->meta_description_type){ 223 261 case 'xoops': 224 262 break; 225 263 case 'wordpress': 226 if (!empty($wp_description)) 227 $xoopsTpl->assign('xoops_meta_description', $wp_description); 264 if (!empty($wp_description)){ 265 xpress_meta_assign('description', $wp_description); 266 } 228 267 break; 229 268 case 'wordpress_xoops': … … 234 273 $description = $wp_description; 235 274 } 236 $xoopsTpl->assign('xoops_meta_description', $description);275 xpress_meta_assign('description', $description); 237 276 } 238 277 break; … … 246 285 case 'wordpress': 247 286 if (!empty($wp_robots)) 248 $xoopsTpl->assign('xoops_meta_robots', $wp_robots);287 xpress_meta_assign('robots', $wp_robots); 249 288 break; 250 289 default :
Note: See TracChangeset
for help on using the changeset viewer.