function decode($text) { $config = parent::loadConfig(dirname(__FILE__)); if (empty($text) || empty($config['link'])) { return $text; } $charset = !empty($config['charset']) ? $config['charset'] : "UTF-8"; xoops_load('xoopslocal'); $ret = "<a href='" . sprintf($config['link'], urlencode(XoopsLocal::convert_encoding($text, $charset))) . "' rel='external' title=''>{$text}</a>"; return $ret; }
function cleanup($text, $trim = 0) { if (strtolower($this->xml_encoding) == "utf-8" && strncasecmp(_CHARSET, $this->xml_encoding, 5)) { $text = XoopsLocal::convert_encoding($text, "utf-8"); } if (!empty($trim)) { $text = xoops_substr($text, 0, intval($trim)); } $text = htmlspecialchars($text, ENT_QUOTES); return $text; }
$tpl->assign('channel_desc', XoopsLocal::convert_encoding(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES))); $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss')); $tpl->assign('channel_webmaster', checkEmail($xoopsConfig['adminmail'], true)); $tpl->assign('channel_editor', checkEmail($xoopsConfig['adminmail'], true)); $tpl->assign('channel_category', 'News'); $tpl->assign('channel_generator', 'XOOPS'); $tpl->assign('channel_language', _LANGCODE); $tpl->assign('image_url', XOOPS_URL . '/images/logo.png'); $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.png'); if (empty($dimention[0])) { $width = 88; } else { $width = $dimention[0] > 144 ? 144 : $dimention[0]; } if (empty($dimention[1])) { $height = 31; } else { $height = $dimention[1] > 400 ? 400 : $dimention[1]; } $tpl->assign('image_width', $width); $tpl->assign('image_height', $height); if (@(include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php')) { $sarray = NewsStory::getAllPublished(10, 0, true); } if (!empty($sarray) && is_array($sarray)) { foreach ($sarray as $story) { $tpl->append('items', array('title' => XoopsLocal::convert_encoding(htmlspecialchars($story->title(), ENT_QUOTES)), 'link' => XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), 'guid' => XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), 'pubdate' => formatTimestamp($story->published(), 'rss'), 'description' => XoopsLocal::convert_encoding(htmlspecialchars($story->hometext(), ENT_QUOTES)))); } } } $tpl->display('db:system_rss.html');
default: $rss_channel['title'] = sprintf(__('Posts in %s', 'mywords'), $xoopsConfig['sitename']); $rss_channel['link'] = XOOPS_URL . ($config->permalinks ? $config->basepath : '/modules/mywords'); $rss_channel['description'] = __('All recent published posts', 'mywords'); $rss_channel['lastbuild'] = formatTimestamp(time(), 'rss'); $rss_channel['webmaster'] = checkEmail($xoopsConfig['adminmail'], true); $rss_channel['editor'] = checkEmail($xoopsConfig['adminmail'], true); $rss_channel['category'] = 'Blog'; $rss_channel['generator'] = 'Common Utilities'; $rss_channel['language'] = RMCLANG; // Get posts $posts = MWFunctions::get_posts(0, 10); $rss_items = array(); foreach ($posts as $post) { $item = array(); $item['title'] = $post->getVar('title'); $item['link'] = $post->permalink(); $img = new RMImage(); $img->load_from_params($post->getVar('image', 'e')); if (!$img->isNew()) { $image = '<img src="' . $img->url() . '" alt="' . $post->getVar('title') . '" /><br />'; } else { $image = ''; } $item['description'] = XoopsLocal::convert_encoding(htmlspecialchars($image . $post->content(true), ENT_QUOTES)); $item['pubdate'] = formatTimestamp($post->getVar('pubdate'), 'rss'); $item['guid'] = $post->permalink(); $rss_items[] = $item; } break; }
if (!($items = XoopsCache::read($rssfile))) { require_once $GLOBALS['xoops']->path('class/snoopy.php'); include_once $GLOBALS['xoops']->path('class/xml/rss/xmlrss2parser.php'); xoops_load('XoopsLocal'); $snoopy = new Snoopy(); $cnt = 0; foreach ($rssurl as $url) { if ($snoopy->fetch($url)) { $rssdata = $snoopy->results; $rss2parser = new XoopsXmlRss2Parser($rssdata); if (false != $rss2parser->parse()) { $_items = $rss2parser->getItems(); $count = count($_items); for ($i = 0; $i < $count; $i++) { $_items[$i]['title'] = XoopsLocal::convert_encoding($_items[$i]['title'], _CHARSET, 'UTF-8'); $_items[$i]['description'] = XoopsLocal::convert_encoding($_items[$i]['description'], _CHARSET, 'UTF-8'); $items[strval(strtotime($_items[$i]['pubdate'])) . "-" . strval(++$cnt)] = $_items[$i]; } } else { echo $rss2parser->getErrors(); } } } krsort($items); XoopsCache::write($rssfile, $items, 86400); } if ($items != '') { $ret = '<table class="outer width100">'; foreach (array_keys($items) as $i) { $ret .= '<tr class="head"><td><a href="' . htmlspecialchars($items[$i]['link']) . '" rel="external">'; $ret .= htmlspecialchars($items[$i]['title']) . '</a> (' . htmlspecialchars($items[$i]['pubdate']) . ')</td></tr>';
//Obtenemos una imagen del album $sql = "SELECT b.* FROM " . $db->prefix('gs_setsimages') . " a, " . $db->prefix('gs_images') . " b WHERE"; $sql .= " a.id_set='" . $set->id() . "' AND b.id_image=a.id_image AND b.public=2 AND b.owner='" . $set->owner() . "' ORDER BY RAND() LIMIT 0,4"; $resimg = $db->query($sql); if (!isset($users[$set->owner()])) { $users[$set->owner()] = new GSUser($set->owner(), 1); } $imgs = '<a href="' . $users[$set->owner()]->userURL() . ($mc['urlmode'] ? 'set/' . $set->id() . '/' : '&set=' . $set->id()) . '">'; while ($rowimg = $db->fetchArray($resimg)) { $img = new GSImage(); $img->assignVars($rowimg); $urlimg = $users[$set->owner()]->filesURL() . '/' . ($config['set_format_mode'] ? 'formats/set_' : 'ths/') . $img->image(); // Conversion de los formatos if (!$img->setFormat() && $config['set_format_mode']) { GSFunctions::resizeImage($crop, $users[$set->owner()]->filesPath() . '/' . $img->image(), $users[$set->owner()]->filesPath() . '/formats/set_' . $img->image(), $width, $height); $img->setSetFormat(1, 1); } $imgs .= '<img src="' . $urlimg . '" alt="' . $set->title() . '" /> '; } $imgs .= '</a>'; $desc = $imgs . '<br />'; $desc .= sprintf(__('By: <strong>%s</strong>', 'galleries'), $set->uname()); $item = array(); $item['title'] = $set->title(); $item['link'] = $users[$set->owner()]->userURL() . ($mc['urlmode'] ? 'set/' . $set->id() . '/' : '&set=' . $set->id()); $item['description'] = XoopsLocal::convert_encoding(htmlspecialchars($desc, ENT_QUOTES)); $item['pubdate'] = formatTimestamp($set->date(), 'rss'); $item['guid'] = $users[$set->owner()]->userURL() . ($mc['urlmode'] ? 'set/' . $set->id() . '/' : '&set=' . $set->id()); $rss_items[] = $item; } }
art_trackback_response(1, "Trackback is closed"); } if (!strlen($title . $url . $blog_name)) { art_trackback_response(1, art_constant("MD_INVALID")); } if (!empty($article_id) && !empty($url)) { $trackback_handler =& xoops_getmodulehandler("trackback", $GLOBALS["artdirname"]); $criteria = new CriteriaCompo(new Criteria("art_id", $article_id)); $criteria->add(new Criteria("tb_url", $url)); if ($trackback_handler->getCount($criteria) > 0) { art_trackback_response(1, "We already have a ping from that URI for this article."); } $charset = empty($charset) ? "utf-8" : $charset; $title = XoopsLocal::convert_encoding($title, _CHARSET, $charset); $excerpt = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset); $blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset); $tb_status = intval($xoopsModuleConfig["trackback_option"]); $trackback_obj = $trackback_handler->create(); $trackback_obj->setVar("art_id", $article_id); $trackback_obj->setVar("tb_time", time()); $trackback_obj->setVar("tb_title", $title); $trackback_obj->setVar("tb_url", $url); $trackback_obj->setVar("tb_excerpt", $excerpt); $trackback_obj->setVar("tb_blog_name", $blog_name); $trackback_obj->setVar("tb_ip", art_getIP()); $trackback_obj->setVar("tb_status", $tb_status); $result = $trackback_handler->insert($trackback_obj); $criteria = new CriteriaCompo(new Criteria("art_id", $article_id)); $criteria->add(new Criteria("tb_status", 0, ">")); $count = $trackback_handler->getCount($criteria); $article_handler =& xoops_getmodulehandler("article", $GLOBALS["artdirname"]);
function &utf8_encode(&$text) { $text = XoopsLocal::convert_encoding($text, 'utf-8'); return $text; }
fclose($fp); } } if ($rssdata != '') { include_once XOOPS_ROOT_PATH . '/class/xml/rss/xmlrss2parser.php'; $rss2parser = new XoopsXmlRss2Parser($rssdata); if (false != $rss2parser->parse()) { echo '<table class="outer" width="100%">'; $items =& $rss2parser->getItems(); $count = count($items); $myts =& MyTextSanitizer::getInstance(); for ($i = 0; $i < $count; $i++) { echo '<tr class="head"><td><a href="' . htmlspecialchars($items[$i]['link']) . '" target="_blank">'; echo htmlspecialchars(XoopsLocal::convert_encoding($items[$i]['title'], _CHARSET, "UTF-8")) . '</a> (' . formatTimestamp(htmlspecialchars($items[$i]['pubdate'])) . ')</td></tr>'; if ($items[$i]['description'] != "") { echo '<tr><td class="odd">' . XoopsLocal::convert_encoding($items[$i]['description'], _CHARSET, "UTF-8"); if ($items[$i]['guid'] != "") { echo ' <a href="' . htmlspecialchars($items[$i]['guid']) . '" target="_blank">' . _MORE . '</a>'; } echo '</td></tr>'; } elseif ($items[$i]['guid'] != "") { echo '<tr><td class="even" valign="top"></td><td colspan="2" class="odd"><a href="' . htmlspecialchars($items[$i]['guid']) . '" target="_blank">' . _MORE . '</a></td></tr>'; } } echo '</table>'; } else { echo $rss2parser->getErrors(); } } } else { //load admin frontpage blocks
function _encoding(&$text, $in_charset, $out_charset) { // some conversion goes here // refer to schinese.php for example $text =& XoopsLocal::convert_encoding($text, $out_charset, $in_charset); }
/** * @param $text * * @return string */ public static function decode($text, $width, $height) { $config = parent::loadConfig(__DIR__); if (empty($text) || empty($config['link'])) { return $text; } $charset = !empty($config['charset']) ? $config['charset'] : 'UTF-8'; xoops_load('XoopsLocal'); $ret = "<a href='" . sprintf($config['link'], urlencode(XoopsLocal::convert_encoding($text, $charset))) . "' rel='external' title=''>{$text}</a>"; return $ret; }
function _encoding(&$text, $in_charset, $out_charset) { $text =& XoopsLocal::convert_encoding($text, $out_charset, $in_charset); }
function &xoops_convert_encoding(&$text, $to = 'utf-8', $from = '') { if (is_callable(array("XoopsLocal", "convert_encoding"))) { return XoopsLocal::convert_encoding($text, $to, $from); } if (strtolower($to) != "utf-8") { return $text; } return xoops_utf8_encode($text); }
function convert_encoding($val) { if (is_array($val)) { foreach (array_keys($val) as $key) { $val[$key] = $this->convert_encoding($val[$key]); } } else { $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET); } return $val; }