XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
xoops_metas.php
Go to the documentation of this file.
1 <?php
2 // $Id: xoops_metas.php 825 2011-12-09 00:06:11Z i.bitcero $
3 // --------------------------------------------------------------
4 // Red México Common Utilities
5 // A framework for Red México Modules
6 // Author: Eduardo Cortés <i.bitcero@gmail.com>
7 // Email: i.bitcero@gmail.com
8 // License: GPL 2.0
9 // --------------------------------------------------------------
10 
15 ?>
16 <!-- Xoops Metas -->
17 <?php
18 if (isset($GLOBALS['xoTheme'])){
19 
20  $xoTheme = $GLOBALS['xoTheme'];
21  $name = '';
22  $str = '';
23 
24  foreach (array_keys($xoTheme->metas) as $type) {
25  switch ($type) {
26  case 'script':
27  foreach ($xoTheme->metas[$type] as $id => $attrs) {
28 
29  // Prevent xoops.js
30  if ($id==XOOPS_URL.'/include/xoops.js') continue;
31 
32  $str .= "<script" . $xoTheme->renderAttributes($attrs) . ">";
33  if (@$attrs['_']) {
34  $str .= "\n//<![CDATA[\n" . $attrs['_'] . "\n//]]>";
35  }
36  $str .= "</script>\n";
37  }
38  break;
39  case 'link':
40  foreach ($xoTheme->metas[$type] as $rel => $attrs) {
41  $str .= '<link rel="' . $rel . '"' . $xoTheme->renderAttributes($attrs) . " />\n";
42  }
43  break;
44  case 'stylesheet':
45  foreach ($xoTheme->metas[$type] as $attrs) {
46  if (@$attrs['_']) {
47  $str .= '<style' . $xoTheme->renderAttributes($attrs) . ">\n/* <![CDATA[ */\n" . $attrs['_'] . "\n/* //]]> */\n</style>";
48  } else {
49  $str .= '<link rel="stylesheet"' . $xoTheme->renderAttributes($attrs) . " />\n";
50  }
51  }
52  break;
53  case 'http':
54  foreach ($xoTheme->metas[$type] as $name => $value) {
55  $str .= '<meta http-equiv="' . htmlspecialchars($name, ENT_QUOTES) . '" content="' . htmlspecialchars($value, ENT_QUOTES) . "\" />\n";
56  }
57  break;
58  default:
59  foreach ($xoTheme->metas[$type] as $name => $value) {
60  if ($name=='description'||$name=='keywords'||$name=='copyright') continue;
61  $str .= '<meta name="' . htmlspecialchars($name, ENT_QUOTES) . '" content="' . htmlspecialchars($value, ENT_QUOTES) . '" />'."\n";
62  }
63  break;
64  }
65  }
66  echo $str;
67 }
68 ?>
69 <!-- /End Xoops Metas -->