Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 46 Ответов
  • 43788 Просмотров
*

scorp66

  • Осваиваюсь на форуме
  • 30
  • 1 / 0
Re: Кодировка RSS
« Ответ #30 : 30.01.2009, 19:08:16 »
Просьба к тем, у кого всё получилось с кодировкой - а не могли бы вы прикрепить к своим сообщениям правленные файлы? А то ведь так и будет каждый, у кого проблема, один и тот же код править. Помогите другим съэкономить время.
*

alexecon

  • Захожу иногда
  • 129
  • 2 / 0
Re: Кодировка RSS
« Ответ #31 : 02.02.2009, 02:58:11 »
Просьба к тем, у кого всё получилось с кодировкой - а не могли бы вы прикрепить к своим сообщениям правленные файлы? А то ведь так и будет каждый, у кого проблема, один и тот же код править. Помогите другим съэкономить время.
А Вы уже подправили или ждете у моря погоды? ;)
*

scorp66

  • Осваиваюсь на форуме
  • 30
  • 1 / 0
Re: Кодировка RSS
« Ответ #32 : 04.02.2009, 00:55:06 »
А Вы уже подправили или ждете у моря погоды? ;)
Я пытаюсь сам править, но положительных результатов пока нет. Может руки кривые, а может не для всех версий подходит.
У меня:
Joomla 1.0.15 RE
Версия Apache 2.0.63
Версия PHP 5.2.8
Версия MySQL 5.0.67-community-log
*

XAND

  • Новичок
  • 4
  • 0 / 0
Re: Кодировка RSS
« Ответ #33 : 11.02.2009, 16:35:59 »
А Вы уже подправили или ждете у моря погоды? ;)
Так то что написано выше то и правилось, что еще то приводить?
У меня все исправилось только теперь пытаясь получить ленты свои - получаю кракозябры, ранее прикручивал чужие были кракозябры а свои получал отлично. Кстати никто не пишет про свои ленты :)
*

XAND

  • Новичок
  • 4
  • 0 / 0
Re: Кодировка RSS
« Ответ #34 : 11.02.2009, 16:51:48 »
Просьба к тем, у кого всё получилось с кодировкой - а не могли бы вы прикрепить к своим сообщениям правленные файлы? А то ведь так и будет каждый, у кого проблема, один и тот же код править. Помогите другим съэкономить время.
Попробую отправить
Код
<?php
/**
* @package domit-rss
* @version 0.51
* @copyright (C) 2004 John Heinstein. All rights reserved
* @license http://www.gnu.org/copyleft/lesser.html LGPL License
* @author John Heinstein <johnkarl@nbnet.nb.ca>
* @link http://www.engageinteractive.com/domitrss/ DOMIT! RSS Home Page
* DOMIT! RSS is Free Software
**/

/** channel constant */
define('DOMIT_RSS_ELEMENT_CHANNEL', 'channel');
/** item constant */
define('DOMIT_RSS_ELEMENT_ITEM', 'item');
/** title constant */
define('DOMIT_RSS_ELEMENT_TITLE', 'title');
/** link constant */
define('DOMIT_RSS_ELEMENT_LINK', 'link');
/** description constant */
define('DOMIT_RSS_ELEMENT_DESCRIPTION', 'description');

/** version constant */
define('DOMIT_RSS_ATTR_VERSION', 'version');

/** name of array containing list of existing RSS items */
define('DOMIT_RSS_ARRAY_ITEMS', 'item'); //formerly named 'domit_rss_items'
/** name of array containing list of existing RSS channels */
define('DOMIT_RSS_ARRAY_CHANNELS', 'channel'); //formerly named 'domit_rss_channels'
/** name of array containing list of existing RSS categories */
define('DOMIT_RSS_ARRAY_CATEGORIES', 'category'); //formerly named 'domit_rss_categories'

/** DOMIT RSS error, attempt to call an abstract method */
define('DOMIT_RSS_ABSTRACT_METHOD_INVOCATION_ERR', 101);
/** DOMIT RSS error, specified element not present */
define('DOMIT_RSS_ELEMENT_NOT_FOUND_ERR', 102);
/** DOMIT RSS error, specified attribute not present */
define('DOMIT_RSS_ATTR_NOT_FOUND_ERR', 103);
/** DOMIT RSS error, parsing failed */
define('DOMIT_RSS_PARSING_ERR', 104);

//DOMIT! RSS Error Modes
/** continue on error  */
define('DOMIT_RSS_ONERROR_CONTINUE', 1);
/** die on error  */
define('DOMIT_RSS_ONERROR_DIE', 2);
/** die on error  */
define('DOMIT_RSS_ONERROR_RETURN', 3);

/**
* The base class of all DOMIT! RSS objects
*
* @package domit-rss
* @author John Heinstein <johnkarl@nbnet.nb.ca>
*/
class xml_domit_rss_base {
    /** @var Object The underlying DOMIT! node of the element */
var $node = null;
/** @var array A list of valid RSS defined child elements */
var $rssDefinedElements = array();

/**
* Retrieves the underlying DOMIT node
* @return Object The underlying DOMIT node
*/
function getNode() {
    return $this->node;
} //getNode

/**
* Retrieves the text of the named attribute, checking first if the attribute exists
* @param string The attribute name
* @return string The attribute value, or an empty string
*/
function getAttribute($attr) {
if ($this->node->hasAttribute($attr)) {
return $this->node->getAttribute($attr);
}

return "";
} //getAttribute

/**
* Checks whether the named attribute exists
* @param string The attribute name
* @return boolean True if the attribute exists
*/
function hasAttribute($attr) {
    return (($this->node->nodeType == DOMIT_ELEMENT_NODE) && $this->node->hasAttribute($attr));
} //hasAttribute

/**
* Tests whether the named element is predefined by the RSS spec
* @param string The element name
* @return boolean True if the element is predefined by the RSS spec
*/
function isRSSDefined($elementName) {
    $isDefined = false;

    foreach ($this->rssDefinedElements as $key => $value) {
        if ($elementName == $value) {
            $isDefined = true;
            break;
        }
    }

    return $isDefined;
} //isRSSDefined

/**
* Tests whether the named element has a single child text node
* @param string The element name
* @return boolean True if the named element has a single child text node
*/
function isSimpleRSSElement($elementName) {
    $elementName = strtolower($elementName);

if (isset($this->DOMIT_RSS_indexer[$elementName])) {
    return (get_class($this->getElement($elementName)) == 'xml_domit_rss_simpleelement');
}
else {
    return false;
}
} //isSimpleRSSElement

/**
* Generates a string representation of the node and its children
* @param boolean True if HTML readable output is desired
* @param boolean True if illegal xml characters in text nodes and attributes should be converted to entities
* @return string The string representation
*/
    function get($htmlSafe = false, $subEntities = false) {
    return $this->node->toString($htmlSafe, $subEntities);
} //toString

    /**
* Generates a normalized (formatted for readability) representation of the node and its children
* @param boolean True if HTML readable output is desired
* @param boolean True if illegal xml characters in text nodes and attributes should be converted to entities
* @return string The formatted string representation
*/
function toNormalizedString($htmlSafe = false, $subEntities = false) {
    return $this->node->toNormalizedString($htmlSafe, $subEntities);
} //toNormalizedString
} //xml_domit_rss_base


/**
* Represents a collection of custom RSS elements, e.g. a set of dc:creator entries
*
* @package domit-rss
* @subpackage domit-rss-main
* @author John Heinstein <johnkarl@nbnet.nb.ca>
*/
class xml_domit_rss_collection extends xml_domit_rss_elementindexer {
    /** @var array An array holding the collection of custom elements */
var $elements = array();
/** @var int The number of custom elements in the collection */
var $elementCount = 0;

/**
* Adds a custom RSS element (DOM node) to the collection
* @param Object A DOM node representing a custom RSS element
*/
function addElement(&$node) {
$this->elements[] =& $node;
$this->elementCount++;
} //addElement

/**
* Retrieves the element at the specified index
* @param int The index of the requested custom RSS element
* @return Object The DOMIT node representing the requested element
*/
function &getElementAt($index) {
return $this->elements[$index];
} //getElementAt

/**
* Retrieves the element at the specified index (alias for getElementAt)
* @param int The index of the requested custom RSS element
* @return Object The DOMIT node representing the requested element
*/
function &getElement($index) {
return $this->getElementAt($index);
} //getElement

/**
* Returns the number of elements in the collection
* @return int The number of members in the collection
*/
function getElementCount() {
    return $this->elementCount;
} //getElementCount

/**
* Gets a text representation of the collection (applies the toString method to each member and concatenates)
* @return string The element text
*/
function getElementText() {
$total = $this->getElementCount();
  $result = '';

        for ($i = 0; $i < $total; $i++) {
            $result .= $currElement->toString();
        }

        return $result;
} //getElementText
} //xml_domit_rss_collection


/**
* Provides indexing functionality to RSS classes
*
* @package domit-rss
* @author John Heinstein <johnkarl@nbnet.nb.ca>
*/
class xml_domit_rss_elementindexer extends xml_domit_rss_base {
/** @var Array Name based index to RSS elements */
var $DOMIT_RSS_indexer = array();
/** @var Array Numerical index to RSS elements; for optimization purposes, only set if requested by getElementAt */
var $DOMIT_RSS_numericalIndexer;

/**
* Performs generic initialization of elements
*/
function _init(){
$total = $this->node->childCount;

for($i = 0; $i < $total; $i++) {
$currNode =& $this->node->childNodes[$i];
//$this->DOMIT_RSS_indexer[$currNode->nodeName] =& $currNode;
$this->addIndexedElement($currNode);
}
} //_init

/**
* Adds a custom element (one not defined by the RSS specs, e..g., dc:creator) to the indexer
* @param Object A DOMIT! node representing the custom element
*/
function addIndexedElement(&$node) {
    $tagName = strtolower($node->nodeName);

    if (isset($this->DOMIT_RSS_indexer[$tagName])) {
        if (strtolower(get_class($this->DOMIT_RSS_indexer[$tagName])) == 'domit_element') {
        $collection = new xml_domit_rss_collection();
        $collection->addElement($this->DOMIT_RSS_indexer[$tagName]);
        $collection->addElement($node);
        $this->DOMIT_RSS_indexer[$tagName] =& $collection;
        }
        else {
//Don't think I need this case???
            //$this->DOMIT_RSS_indexer[$tagName]->addElement($node);
        }
    }
    else {
        $this->DOMIT_RSS_indexer[$tagName] =& $node;
    }
} //addIndexedElement

/**
* Indicates whether the requested element is actually a collection of elements of the same type
* @param string The name of the requested element
* @return boolean True if a collection of elements exists
*/
function isCollection($elementName) {
    $elementName = strtolower($elementName);

if (isset($this->DOMIT_RSS_indexer[$elementName])) {
return (get_class($this->DOMIT_RSS_indexer[$elementName]) == 'xml_domit_rss_collection');
}
else {
return false;
}
} //isCollection

/**
* Indicates whether the requested element is a DOMIT! node
* @param string The name of the requested element
* @return boolean True if the requested element is a DOMIT! node
*/
function isNode($elementName) {
    $elementName = strtolower($elementName);

if (isset($this->DOMIT_RSS_indexer[$elementName])) {
return (strtolower(get_class($this->DOMIT_RSS_indexer[$elementName])) == 'domit_element');
}
else {
return false;
}
} //isNode

/**
* Indicates whether the requested element is a DOMIT! node (alias for isNode)
* @param string The name of the requested element
* @return boolean True if the requested element is a DOMIT! node
*/
function isCustomRSSElement($elementName) {
    return isNode($elementName);
} //isCustomRSSElement

/**
* Gets a named list of existing elements as a child of the current element
* @return array A named list of existing elements
*/
function getElementList() {
return array_keys($this->DOMIT_RSS_indexer);
} //getElementList

/**
* Indicates whether a particular element exists
* @param string The name of the requested element
* @return boolean True if an element with the specified name exists
*/
function hasElement($elementName) {
return isset($this->DOMIT_RSS_indexer[strtolower($elementName)]);
} //hasElement

/**
* Gets a reference to an element with the specified name
* @param string The name of the requested element
* @return mixed A reference to an element with the specified name, or the text of the element if it is a text node
*/
function &getElement($elementName) {
$elementName = strtolower($elementName);

if (isset($this->DOMIT_RSS_indexer[$elementName])) {
return $this->DOMIT_RSS_indexer[$elementName];
}
else {
xml_domit_rss_exception::raiseException(DOMIT_RSS_ELEMENT_NOT_FOUND_ERR,
'Element ' . $elementName . ' not present.');
}
} //getElement

/**
* Gets a reference to an element at the specified index
* @param int The index of the requested element
* @return mixed A reference to an element at the specified index, or the text of the element if it is a text node
*/
function &getElementAt($index) {
$this->indexNumerically();

    if (isset($this->DOMIT_RSS_numericalIndexer[$index])) {
return $this->DOMIT_RSS_numericalIndexer[$index];
}
else {
xml_domit_rss_exception::raiseException(DOMIT_RSS_ELEMENT_NOT_FOUND_ERR,
'Element ' . $index . ' not present.');
}
} //getElementAt

/**
* Populates an integer-based index for elements if one isn't already present.
*/
function indexNumerically() {
if (!isset($this->DOMIT_RSS_numericalIndexer)) {
$counter = 0;

            foreach ($this->DOMIT_RSS_indexer as $key => $value) {
$this->DOMIT_RSS_numericalIndexer[$counter] =& $this->DOMIT_RSS_indexer[$key];
$counter++;
    }
}
} //indexNumerically

/**
* Gets the text of the specified element
* @param string The name of the requested element
* @return string The element text, or an empty string
*/
function getElementText($elementName) {
$elementName = strtolower($elementName);
    return $this->_getElementText($elementName, $this->DOMIT_RSS_indexer);
} //getElementText

/**
* Gets the text at the specified index
* @param int The index of the requested element
* @return string The element text, or an empty string
*/
function getElementTextAt($index) {
    $this->indexNumerically();

    return $this->_getElementText($index, $this->DOMIT_RSS_numericalIndexer);
} //getElementTextAt

/**
* Gets the text at the specified index
* @param mixed The index or name of the requested element
* @param array The indexing array from which to extract data
* @return string The element text, or an empty string
*/
function _getElementText($index, &$myArray) {
    if (isset($myArray[$index])) {
$element =& $myArray[$index];
$result = '';

if (is_array($element)) {
//do nothing; data for domit_rss_channels, domit_rss_items,
//and domit_rss_categories should be extracted with their own methods
}
else {
switch (strtolower(get_class($element))) {
    case 'xml_domit_rss_simpleelement':
        $result = $element->getElementText();
        break;

    case 'xml_domit_rss_collection':
        $result = $element->getElementText();
        break;

case 'domit_element':
    $total = $element->childCount;

for ($i = 0; $i < $total; $i++) {
$currNode =& $element->childNodes[$i];

if ($currNode->nodeType == DOMIT_CDATA_SECTION_NODE) {
$result .= $currNode->nodeValue;
}
else {
$result .= $currNode->toString();
}
}
break;
}
}

return $result;
}

return '';
} //_getElementText
} //xml_domit_rss_elementindexer


/**
* A base class for DOMIT! RSS and DOMIT! RSS Lite documents
*
* @package domit-rss
* @author John Heinstein <johnkarl@nbnet.nb.ca>
*/
class xml_domit_rss_base_document extends xml_domit_rss_elementindexer {
/** @var array An array of item elements (only present in some RSS formats) */
var $domit_rss_items = array();
/** @var array An array of existing channel elements */
var $domit_rss_channels = array();
/** @var array An array of existing category elements */
var $domit_rss_categories = array();
/** @var boolean True if caching is enabled */
var $cacheEnabled = true;
/** @var Object A reference to the file caching object */
var $cache;
/** @var boolean True if PEAR:Cache_Lite is to be used instead of php_text_cache */
var $useCacheLite = false;
/** @var boolean True if php_http_client_generic is to be used instead of PHP get_file_contents */
var $doUseHTTPClient = false;
/** @var string The name of the current parser - either 'DOMIT_RSS' or 'DOMIT_RSS_LITE' */
var $parser;
/** @var object A reference to a http connection or proxy, if one is required */
var $httpConnection = null;
/** @var int The timeout value for an http connection */
var $rssTimeout = 0;

/**
* Constructor
* @param string Path to the rss file
* @param string Directory in which cache files are to be stored
* @param int Expiration time (in seconds) for the cache file
* @return mixed Null if an url was not provided, true if an url was provided and parsing was successful, false otherwise
*/
function xml_domit_rss_base_document ($url = '', $cacheDir = './', $cacheTime = 3600) {
    $success = null;
    $this->createDocument();

    if ($url != '') { //if rss data is from filesystem
if (substr($url, 0, 4) != "http") {
$rssText = $this->getTextFromFile($url);
$this->parseRSS($rssText);
}
else {
$this->createDefaultCache($cacheDir, $cacheTime);
$success = $this->loadRSS($url, $cacheDir, $cacheTime);
}
    }

    return $success;
} //xml_domit_rss_base_document

/**
* Specifies the default timeout value for connecting to a host
* @param int The number of seconds to timeout when attempting to connect to a server
*/
function setRSSTimeout($rssTimeout) {
$this->rssTimeout = $rssTimeout;

if (!$this->useCacheLite && !($this->cache == null)) {
$this->cache->setTimeout($rssTimeout);
}
} //setRSSTimeout

/**
* Specifies the parameters of the http conection used to obtain the xml data
* @param string The ip address or domain name of the connection
* @param string The path of the connection
* @param int The port that the connection is listening on
* @param int The timeout value for the connection
* @param string The user name, if authentication is required
* @param string The password, if authentication is required
*/
function setConnection($host, $path = '/', $port = 80, $timeout = 0, $user = null, $password = null) {
    require_once(DOMIT_RSS_INCLUDE_PATH . 'php_http_client_generic.php');

$this->httpConnection = new php_http_client_generic($host, $path, $port, $timeout, $user, $password);
} //setConnection

/**
* Specifies basic authentication for an http connection
* @param string The user name
* @param string The password
*/
function setAuthorization($user, $password) {
$this->httpConnection->setAuthorization($user, $password);
} //setAuthorization

/**
* Specifies that a proxy is to be used to obtain the xml data
* @param string The ip address or domain name of the proxy
* @param string The path to the proxy
* @param int The port that the proxy is listening on
* @param int The timeout value for the connection
* @param string The user name, if authentication is required
* @param string The password, if authentication is required
*/
function setProxyConnection($host, $path = '/', $port = 80, $timeout = 0, $user = null, $password = null) {
require_once(DOMIT_RSS_INCLUDE_PATH . 'php_http_proxy.php');

$this->httpConnection = new php_http_proxy($host, $path, $port, $timeout, $user, $password);
} //setProxyConnection

/**
* Specifies a user name and password for the proxy
* @param string The user name
* @param string The password
*/
function setProxyAuthorization($user, $password) {
$this->httpConnection->setProxyAuthorization($user, $password);
} //setProxyAuthorization

/**
* Specifies whether an HTTP client should be used to establish a connection
* @param boolean True if an HTTP client is to be used to establish the connection
*/
function useHTTPClient($truthVal) {
$this->doUseHTTPClient = $truthVal;
} //useHTTPClient

/**
* Returns the name of the parser
*@return string Either 'DOMIT_RSS' or 'DOMIT_RSS_LITE'
*/
function parsedBy() {
    return $this->parser;
} //parsedBy

/**
* Creates an empty DOMIT! document to contain the RSS nodes
*/
function createDocument() {
    require_once(DOMIT_RSS_INCLUDE_PATH . 'xml_domit_include.php');
$this->node = new DOMIT_Document();
$this->node->resolveErrors(true);
} //createDocument

/**
* Substitutes PEAR::Cache_Lite for the default php_text_cache
* @param boolean True if Cache Lite is to be used
* @param string Absolute or relative path to the Cache Lite library
* @param string Directory for cache files
* @param int Expiration time for a cache file
*/
function useCacheLite($doUseCacheLite, $pathToLibrary = './Lite.php', $cacheDir = './', $cacheTime = 3600) {
$this->useCacheLite = $doUseCacheLite;

if ($doUseCacheLite) {
    if (!file_exists($pathToLibrary)) {
$this->useCacheLite(false);
    }
    else {
require_once($pathToLibrary);

$cacheOptions = array('cacheDir' => $cacheDir, 'lifeTime' => $cacheTime);
$this->cache = new Cache_Lite($cacheOptions);
    }
}
else {
    $this->createDefaultCache($cacheDir, $cacheTime);
}
} //useCacheLite

/**
* Instantiates a default cache (php_text_cache)
* @param string Directory for cache files
* @param int Expiration time for a cache file
*/
function createDefaultCache($cacheDir = './', $cacheTime = 3600) {
    require_once(DOMIT_RSS_INCLUDE_PATH . 'php_text_cache.php');
$this->cache = new php_text_cache($cacheDir, $cacheTime, $this->rssTimeout);
} //initDefaultCache

/**
* Disables caching mechanism
*/
function disableCache() {
$this->cacheEnabled = false;
} //initDefaultCache

/**
* Loads and parses the RSS at the specified url
* @param string The url of the RSS feed
* @return boolean True if parsing is successful
*/
function loadRSS($url) {
if (substr($url, 0, 4) != "http") {
$rssText = $this->getTextFromFile($url);
return $this->parseRSS($rssText);
}
else {
    if ($this->cacheEnabled && !isset($this->cache)) {
$this->createDefaultCache();
$this->cache->httpConnection =& $this->httpConnection;
    }

$success = $this->loadRSSData($url);

if ($success) {
$this->_init();
}

return $success;
}
} //loadRSS

/**
* Parses the RSS text provided
* @param string The RSS text
* @return boolean True if parsing is successful
*/
function parseRSS($rssText) {
    if ($this->cacheEnabled && !isset($this->cache)) $this->createDefaultCache();
    $success = $this->parseRSSData($rssText);

if ($success) {
$this->_init();
}

return $success;
} //parseRSS

/**
* Retrieves the RSS data from the url/cache file and parses
* @param string The url for the RSS data
* @return boolean True if parsing is successful
*/
function loadRSSData($url) {
$rssText = $this->getDataFromCache($url);
return $this->parseRSSData($rssText);
} //loadRSSData

/**
* Retrieves the RSS data from the url/cache file
* @param string The url for the RSS data
* @return string The RSS data
*/
function getDataFromCache($url) {
if ($this->cacheEnabled) {
    if ($this->useCacheLite) {
        if ($rssText = $this->cache->get($url)) {
            return $rssText;
        }
        else {
            $rssText = $this->getTextFromFile($url);
if ($rssText != '') $this->cache->save($rssText, $url);
            return $rssText;
        }
    }
    else {
$this->cache->useHTTPClient($this->doUseHTTPClient);
        return $this->cache->getData($url);
    }
}
else {
return $this->getTextFromFile($url);
}
} //getDataFromCache

/**
* Parses the RSS data provided
* @param string The the RSS data
* @return boolean True if parsing is successful
*/
function parseRSSData($rssText) {
    if ($rssText != '') {
return $this->fromString($rssText);
}
else {
return false;
}
} //parseRSSData

/**
* Reads in RSS text from a file and parses it
* @param string The file path
* @return boolean True if parsing is successful
*/
function &fromFile($filename) {
$success = $this->node->loadXML($filename, false);
return $success;
} //fromFile

/**
* Reads in RSS text from a string and parses it
* @param string The RSS text
* @return boolean True if parsing is successful
*/
function &fromString($rssText) {
$success = $this->node->parseXML($rssText, true);
return $success;
} //fromString

/**
* Establishes a connection, given an url
* @param string The url of the data
*/
function establishConnection($url) {
require_once(DOMIT_RSS_INCLUDE_PATH . 'php_http_client_generic.php');

$host = php_http_connection::formatHost($url);
$host = substr($host, 0, strpos($host, '/'));

$this->setConnection($host, '/', 80, $this->rssTimeout);
} //establishConnection

/**
* Get text from an url or file
* @param string The url or file path
* @return string The text contained in the url or file, or an empty string
*/
function getTextFromFile($filename) {
$fileContents = '';

if ($this->doUseHTTPClient) {
$this->establishConnection($filename);
$response =& $this->httpConnection->get($filename);

if ($response != null) {
$fileContents = $response->getResponse();
}
}
else {
if (function_exists('file_get_contents')) {
$fileContents = @file_get_contents($filename);
}
else {
require_once(DOMIT_RSS_INCLUDE_PATH . 'php_file_utilities.php');
$fileContents =& php_file_utilities::getDataFromFile($filename, 'r');
}

if ($fileContents == '') {
$this->establishConnection($filename);
$response =& $this->httpConnection->get($filename);

if ($response != null) {
$fileContents = $response->getResponse();
}
}
}

return $fileContents;
} //getTextFromFile

/**
* Gets a reference to the underlying DOM document
* @return Object A reference to the underlying DOM document
*/
function &getDocument() {
return $this->node;
} //getDocument

/**
* Gets a reference to the root DOM element
* @return Object A reference to the root DOM element
*/
function &getNode() {
return $this->node->documentElement;
} //getNode

/**
* Forces channel elements that are external to a channel to be referenced as subelements of that channel
*/
function handleChannelElementsEmbedded() {
if (count($this->domit_rss_items) > 0) {
foreach ($this->domit_rss_channels as $key => $value) {
$this->domit_rss_channels[$key]->domit_rss_items =& $this->domit_rss_items;

if (count($this->DOMIT_RSS_indexer) > 0) {
foreach ($this->DOMIT_RSS_indexer as $ikey => $ivalue) {
if ($ikey != DOMIT_RSS_ARRAY_CHANNELS) {
$this->domit_rss_channels[$key]->DOMIT_RSS_indexer[$ikey] =& $this->DOMIT_RSS_indexer[$ikey];
unset($this->DOMIT_RSS_indexer[$ikey]);
}
}
}
}
}
} //handleChannelElementsEmbedded

/**
* Returns the version of RSS used to format the data
* @return string The version of RSS used to format the data
*/
function getRSSVersion() {
$version = $this->node->documentElement->getAttribute(DOMIT_RSS_ATTR_VERSION);

if ($version == '') {
$xmlns = $this->node->documentElement->getAttribute('xmlns');
$total = strlen($xmlns);

if (substr($xmlns, $total) == '/') {
    $total--;
}

for ($i = ($total - 1); $i > -1; $i--) {
    $currentChar = substr($xmlns, $i);

    if ($currentChar == '/') {
        break;
    }
    else {
        $version = $currentChar . $version;
    }
}

}

return $version;
} //getRSSVersion

/**
* Returns the number of channels in the document
* @return int The number of channels in the document
*/
function getChannelCount() {
return count($this->domit_rss_channels);
} //getChannelCount()

/**
* Returns a reference to the channel located at the specified index
* @return Object A reference to the channel located at the specified index
*/
function &getChannel($index) {
return $this->domit_rss_channels[$index];
} //getChannel
} //xml_domit_rss_base_document

/**
* Represents a simple RSS element, without attributes and only a single child text node
*
* @package domit-rss
* @subpackage domit-rss-main
* @author John Heinstein <johnkarl@nbnet.nb.ca>
*/
class xml_domit_rss_simpleelement extends xml_domit_rss_elementindexer {
/**
* Constructor
* @param Object A DOM node containing element data
*/
function xml_domit_rss_simpleelement(&$element) {
$this->node =& $element;
} //xml_domit_rss_simpleelement

/**
* Gets the text of the element
* @return string The element text
*/
function getElementText() {
    $element =& $this->node;
    $result = '';
    $total = $element->childCount;

for ($i = 0; $i < $total; $i++) {
$currNode =& $element->childNodes[$i];

if ($currNode->nodeType == DOMIT_CDATA_SECTION_NODE) {
$result .= $currNode->nodeValue;
}
else {
$result .= $currNode->toString();
}
    }

        return $result;
} //getElementText
} //xml_domit_rss_simpleelement

/**
* @global object Reference to custom error handler for DOMIT RSS Exception class
*/
$GLOBALS['DOMIT_RSS_Exception_errorHandler'] = null;
/**
* @global int Error mode; specifies whether to die on error or simply return
*/
//$GLOBALS['DOMIT_RSS_Exception_mode'] = DOMIT_RSS_ONERROR_RETURN;
// fixes bug identified here: sarahk.pcpropertymanager.com/blog/using-domit-rss/225/
$GLOBALS['DOMIT_RSS_Exception_mode'] = 1;

/**
* @global string Log file for errors
*/
$GLOBALS['DOMIT_RSS_Exception_log'] = null;


/**
* A DOMIT! RSS exception handling class
*
* @package domit-rss
* @author John Heinstein <johnkarl@nbnet.nb.ca>
*/
class xml_domit_rss_exception {
/**
* Raises the specified exception
* @param int The error number
* @param string A string explanation of the error
*/
function raiseException($errorNum, $errorString) {
if ($GLOBALS['DOMIT_RSS_Exception_errorHandler'] != null) {
call_user_func($GLOBALS['DOMIT_RSS_Exception_errorHandler'], $errorNum, $errorString);
}
else {
$errorMessageText = $errorNum  . ' ' . $errorString;
$errorMessage = 'Error: ' . $errorMessageText;

if ((!isset($GLOBALS['DOMIT_RSS_ERROR_FORMATTING_HTML'])) ||
($GLOBALS['DOMIT_RSS_ERROR_FORMATTING_HTML'] == true)) {
$errorMessage = "<p><pre>" . $errorMessage . "</pre></p>";
}

//log error to file
if ((isset($GLOBALS['DOMIT_RSS_Exception_log'])) &&
($GLOBALS['DOMIT_RSS_Exception_log'] != null)) {
require_once(DOMIT_RSS_INCLUDE_PATH . 'php_file_utilities.php');

$logItem = "\n" . date('Y-m-d H:i:s') . 'DOMIT! RSS Error ' . $errorMessageText;
php_file_utilities::putDataToFile($GLOBALS['DOMIT_RSS_Exception_log'], $logItem, 'a');
}

switch ($GLOBALS['DOMIT_RSS_Exception_mode']) {
case DOMIT_RSS_ONERROR_CONTINUE:
return;
break;

case DOMIT_RSS_ONERROR_DIE:
die($errorMessage);
break;
}
}
} //raiseException

/**
* custom handler for DOM RSS errors
* @param object A reference to the custom error handler
*/
function setErrorHandler($method) {
$GLOBALS['DOMIT_RSS_Exception_errorHandler'] =& $method;

require_once(DOMIT_RSS_INCLUDE_PATH . 'php_http_exceptions.php');
$GLOBALS['HTTP_Exception_errorHandler'] =& $method;

require_once(DOMIT_RSS_INCLUDE_PATH . 'xml_domit_shared.php');
$GLOBALS['HTTP_Exception_errorHandler'] =& $method;
} //setErrorHandler

/**
* Set error mode
* @param int The DOMIT RSS error mode
*/
function setErrorMode($mode) {
$GLOBALS['DOMIT_RSS_Exception_mode'] = $mode;

require_once(DOMIT_RSS_INCLUDE_PATH . 'php_http_exceptions.php');
require_once(DOMIT_RSS_INCLUDE_PATH . 'xml_domit_shared.php');

if ($mode == DOMIT_RSS_ONERROR_CONTINUE) {
$GLOBALS['HTTP_Exception_mode'] = HTTP_ONERROR_CONTINUE;
$GLOBALS['DOMIT_DOMException_mode'] = DOMIT_ONERROR_CONTINUE;
}
else {
$GLOBALS['HTTP_Exception_mode'] = HTTP_ONERROR_DIE;
$GLOBALS['DOMIT_DOMException_mode'] = DOMIT_ONERROR_DIE;
}
} //setErrorMode

/**
* Set error mode
* @param boolean True if errors should be logged
* @param string Absolute or relative path to log file
*/
function setErrorLog($doLogErrors, $logfile) {
require_once(DOMIT_RSS_INCLUDE_PATH . 'php_http_exceptions.php');

if ($doLogErrors) {
$GLOBALS['DOMIT_RSS_Exception_log'] = $logfile;
$GLOBALS['HTTP_Exception_log'] = $logfile;
$GLOBALS['DOMIT_Exception_log'] = $logfile;
}
else {
$GLOBALS['DOMIT_RSS_Exception_log'] = null;
$GLOBALS['HTTP_Exception_log'] = null;
$GLOBALS['DOMIT_Exception_log'] = null;
}
} //setErrorLog
} //xml_domit_rss_exception

?>


Второй который правил
<?php
/**
* version $Id: newsfeeds.html.php 4697 2006-08-24 00:01:32Z stingrey $
* @package Joomla RE
* @subpackage Newsfeeds
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// чряЁхЄ яЁ ьюую фюёЄєяр
defined( '_VALID_MOS' ) or die( '─юёЄєя юуЁрэшўхэ' );

/**
* @package Joomla RE
* @subpackage Newsfeeds
*/
class HTML_newsfeed {

function displaylist( &$categories, &$rows, $catid, $currentcat=NULL, &$params, $tabclass ) {
global $Itemid, $mosConfig_live_site, $hide_js;
if ( $params->get( 'page_title' ) ) {
?>
<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
<?php echo $currentcat->header; ?>
</div>
<?php
}
?>
<form action="index.php" method="post" name="adminForm">

<table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane<?php echo $params->get( 'pageclass_sfx' ); ?>">
<tr>
<td width="60%" valign="top" class="contentdescription<?php echo $params->get( 'pageclass_sfx' ); ?>" colspan="2">
<?php
// show image
if ( $currentcat->img ) {
?>
<img src="<?php echo $currentcat->img; ?>" align="<?php echo $currentcat->align; ?>" hspace="6" alt="<?php echo _WEBLINKS_TITLE; ?>" />
<?php
}
echo $currentcat->descrip;
?>
</td>
</tr>
<tr>
<td>
<?php
if ( count( $rows ) ) {
HTML_newsfeed::showTable( $params, $rows, $catid, $tabclass );
}
?>
</td>
</tr>
<tr>
<td>&nbsp;

</td>
</tr>
<tr>
<td>
<?php
// Displays listing of Categories
if ( ( $params->get( 'type' ) == 'category' ) && $params->get( 'other_cat' ) ) {
HTML_newsfeed::showCategories( $params, $categories, $catid );
} else if ( ( $params->get( 'type' ) == 'section' ) && $params->get( 'other_cat_section' ) ) {
HTML_newsfeed::showCategories( $params, $categories, $catid );
}
?>
</td>
</tr>
</table>
</form>
<?php
// displays back button
mosHTML::BackButton ( $params, $hide_js );
}

/**
* Display Table of items
*/
function showTable( &$params, &$rows, $catid, $tabclass ) {
global $mosConfig_live_site, $Itemid;
// icon in table display
$img = mosAdminMenus::ImageCheck( 'con_info.png', '/images/M_images/', $params->get( 'icon' ) );
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<?php
if ( $params->get( 'headings' ) ) {
?>
<tr>
<?php
if ( $params->get( 'name' ) ) {
?>
<td height="20" class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>">
<?php echo _FEED_NAME; ?>
</td>
<?php
}
?>
<?php
if ( $params->get( 'articles' ) ) {
?>
<td height="20" class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" align="center">
<?php echo _FEED_ARTICLES; ?>
</td>
<?php
}
?>
<?php
if ( $params->get( 'link' ) ) {
?>
<td height="20" class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>">
<?php echo _FEED_LINK; ?>
</td>
<?php
}
?>
</tr>
<?php
}

$k = 0;
foreach ($rows as $row) {
$link = 'index.php?option=com_newsfeeds&amp;task=view&amp;feedid='. $row->id .'&amp;Itemid='. $Itemid;
?>
<tr>
<?php
if ( $params->get( 'name' ) ) {
?>
<td height="20" class="<?php echo $tabclass[$k]; ?>">
<a href="<?php echo sefRelToAbs( $link ); ?>" class="category<?php echo $params->get( 'pageclass_sfx' ); ?>">
<?php echo $row->name; ?>
</a>
</td>
<?php
}
?>
<?php
if ( $params->get( 'articles' ) ) {
?>
<td width="20%" class="<?php echo $tabclass[$k]; ?>" align="center">
<?php echo $row->numarticles; ?>
</td>
<?php
}
?>
<?php
if ( $params->get( 'link' ) ) {
?>
<td width="50%" class="<?php echo $tabclass[$k]; ?>">
<?php echo ampReplace( $row->link ); ?>
</td>
<?php
}
?>
</tr>
<?php
$k = 1 - $k;
}
?>
</table>
<?php
}

/**
* Display links to categories
*/
function showCategories( &$params, &$categories, $catid ) {
global $mosConfig_live_site, $Itemid;
?>
<ul>
<?php
foreach ( $categories as $cat ) {
if ( $catid == $cat->catid ) {
?>
<li>
<b>
<?php echo $cat->title;?>
</b>
&nbsp;
<span class="small">
(<?php echo $cat->numlinks;?>)
</span>
</li>
<?php
} else {
$link = 'index.php?option=com_newsfeeds&amp;catid='. $cat->catid .'&amp;Itemid='. $Itemid;
?>
<li>
<a href="<?php echo sefRelToAbs( $link ); ?>" class="category<?php echo $params->get( 'pageclass_sfx' ); ?>">
<?php echo $cat->title;?>
</a>
<?php
if ( $params->get( 'cat_items' ) ) {
?>
&nbsp;
<span class="small">
(<?php echo $cat->numlinks;?>)
</span>
<?php
}
?>
<?php
// Writes Category Description
if ( $params->get( 'cat_description' ) ) {
echo '<br />';
echo $cat->description;
}
?>
</li>
<?php
}
}
?>
</ul>
<?php
}


function showNewsfeeds( &$newsfeed, $LitePath, $cacheDir, &$params ) {
?>
<table width="100%" class="contentpane<?php echo $params->get( 'pageclass_sfx' ); ?>">
<?php
if ( $params->get( 'header' ) ) {
?>
<tr>
<td class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" colspan="2">
<?php echo $params->get( 'header' ); ?>
</td>
</tr>
<?php
}

// full RSS parser used to access image information
$rssDoc = new xml_domit_rss_document();
$rssDoc->setRSSTimeout(5);
$rssDoc->useCacheLite( true, $LitePath, $cacheDir, $newsfeed->cache_time );
$success = $rssDoc->loadRSS( $newsfeed->link );

if ( $success ) {
$totalChannels = $rssDoc->getChannelCount();

for ( $i = 0; $i < $totalChannels; $i++ ) {
$currChannel =& $rssDoc->getChannel($i);
$elements = $currChannel->getElementList();
$descrip = 0;
$iUrl = 0;

foreach ( $elements as $element ) {
//image handling
if ( $element == 'image' ) {
$image =& $currChannel->getElement( DOMIT_RSS_ELEMENT_IMAGE );
$iUrl = $image->getUrl();
$iTitle = $image->getTitle();
}
if ( $element == 'description' ) {
$descrip = 1;
// hide com_rss descrip in 4.5.0 feeds
if ( $currChannel->getDescription() == 'com_rss' ) {
$descrip = 0;
}
}
}
$feed_title = $currChannel->getTitle();
$feed_title = mosCommonHTML::newsfeedEncoding( $rssDoc, $feed_title );
?>
<tr>
<td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
<a href="<?php echo ampReplace( $currChannel->getLink() ); ?>" target="_blank">
<?php echo $feed_title; ?></a>
</td>
</tr>
<?php
// feed description
if ( $descrip && $params->get( 'feed_descr' ) ) {
$feed_descrip = $currChannel->getDescription();
$feed_descrip = mosCommonHTML::newsfeedEncoding( $rssDoc, $feed_descrip );
?>
<tr>
<td>
<?php echo $feed_descrip; ?>
<br />
<br />
</td>
</tr>
<?php
}
// feed image
if ( $iUrl && $params->get( 'feed_image' ) ) {
?>
<tr>
<td>
<img src="<?php echo $iUrl; ?>" alt="<?php echo $iTitle; ?>" />
</td>
</tr>
<?php
}
$actualItems = $currChannel->getItemCount();
$setItems = $newsfeed->numarticles;
if ( $setItems > $actualItems ) {
$totalItems = $actualItems;
} else {
$totalItems = $setItems;
}
?>
<tr>
<td>
<ul>
<?php
for ( $j = 0; $j < $totalItems; $j++ ) {
$currItem =& $currChannel->getItem($j);

$item_title = $currItem->getTitle();
$item_title = mosCommonHTML::newsfeedEncoding( $rssDoc, $item_title );
?>
<li>
<?php
// START fix for RSS enclosure tag url not showing
if ($currItem->getLink()) {
?>
<a href="<?php echo ampReplace( $currItem->getLink() ); ?>" target="_blank">
<?php echo $item_title; ?></a>
<?php
} else if ($currItem->getEnclosure()) {
$enclosure = $currItem->getEnclosure();
$eUrl = $enclosure->getUrl();
?>
<a href="<?php echo ampReplace( $eUrl ); ?>" target="_blank">
<?php echo $item_title; ?></a>
<?php
}  else if (($currItem->getEnclosure()) && ($currItem->getLink())) {
$enclosure = $currItem->getEnclosure();
$eUrl = $enclosure->getUrl();
?>
<a href="<?php echo ampReplace( $currItem->getLink() ); ?>" target="_blank">
<?php echo $item_title; ?></a>
<br />
╤ё√ыър:
                                       <a href="<?php echo $eUrl; ?>" target="_blank">
<?php echo ampReplace( $eUrl ); ?></a>
<?php
}
// END fix for RSS enclosure tag url not showing

// item description
if ( $params->get( 'item_descr' ) ) {
$text = $currItem->getDescription();
$text = mosCommonHTML::newsfeedEncoding( $rssDoc, $text );

$num = $params->get( 'word_count' );

// word limit check
if ( $num ) {
$texts = explode( ' ', $text );
$count = count( $texts );
if ( $count > $num ) {
$text = '';
for( $i=0; $i < $num; $i++ ) {
$text .= ' '. $texts[$i];
}
$text .= '...';
}
}
?>
<br />
<?php echo $text; ?>
<br />
<br />
<?php
}
?>
</li>
<?php
}
?>
</ul>
</td>
</tr>
<tr>
<td>
<br />
</td>
</tr>
<?php
}
}
?>
</table>
<?php
// displays back button
mosHTML::BackButton ( $params );
}
}
?>

Изменено. Причина: Не правильное оформление сообщения.
ЗЫ XAND, не забывайте использовать ВВтеги  ::)
« Последнее редактирование: 19.02.2009, 05:55:29 от MuraDweb »
*

alexecon

  • Захожу иногда
  • 129
  • 2 / 0
Re: Кодировка RSS
« Ответ #35 : 19.02.2009, 05:35:28 »
Так то что написано выше то и правилось, что еще то приводить?
У меня все исправилось только теперь пытаясь получить ленты свои - получаю кракозябры, ранее прикручивал чужие были кракозябры а свои получал отлично. Кстати никто не пишет про свои ленты :)
Посмотрите внимательно ещё раз, что тут написано и сделайте все в точности так, как написано http://joomlaforum.ru/index.php/topic,3722.msg55678.html#msg55678
С кодировками лент новостей - и своих, и чужих - все нормально. Если Вы имеете в виду, как они выглядят на сайте. А уж в каком виде мои ленты к кому-то поступают, мне неведомо. Но если что и не так, то я ничего с этим поделать не могу. Равно как и вы пытаетесь лечить свой сайт, который не "читает" нормально чужие ленты, а не предлагаете их авторам подкрутить что-нибудь в коде на своей стороне.
*

Gold Dragon

  • Захожу иногда
  • 289
  • 33 / 2
Re: Кодировка RSS
« Ответ #36 : 09.04.2009, 17:07:31 »
Други! спасибо.. помогли ваши советы! Всем по плюсу... правда гостю не могу поставить ;)

кстати.. хак сделал для Joostina 1.1.3, т.ч. это работает и на джустине
« Последнее редактирование: 09.04.2009, 17:13:14 от Gold Dragon »
*

rocksilver

  • Захожу иногда
  • 69
  • 2 / 0
Re: Кодировка RSS
« Ответ #37 : 18.04.2009, 23:51:05 »
Есть еще один встроенный перекодировщик для RSS новостей... И внем ошибка, в результате чего он неправильно работает, т.е. декодирует тогда когда не надо

Чтобы это исправить открываем файл хост/includes/joomla.php и ищем там функцию newsfeedEncoding( $rssDoc, $text )

После чего находим в этой функции следующий текст:

      if ( phpversion() >= 5 ) {
      // handling for PHP 5
         if ( _JOS_FEED_ENCODING ) {
         // handling for utf-8 feed
            if ( _JOS_SITE_ENCODING ) {
            // utf-8 page
               $encoding = 'html_entity_decode';
            } else {
            // non utf-8 page
               $encoding = 'utf8_decode';
            }
         } else {
         // handling for non utf-8 feed
            if ( _JOS_SITE_ENCODING ) {
               // utf-8 page
               $encoding = '';
            } else {
               // non utf-8 page
               $encoding = 'utf8_decode';
            }
         }
      } else {
   
 и меняем выделенные строки местами...
В итоге должно получиться следующее


      if ( phpversion() >= 5 ) {
      // handling for PHP 5
         if ( _JOS_FEED_ENCODING ) {
         // handling for utf-8 feed
            if ( _JOS_SITE_ENCODING ) {
            // utf-8 page
               $encoding = 'html_entity_decode';
            } else {
            // non utf-8 page
               $encoding = 'utf8_decode';
            }
         } else {
         // handling for non utf-8 feed
            if ( _JOS_SITE_ENCODING ) {
               // utf-8 page
               $encoding = 'utf8_decode';
            } else {
               // non utf-8 page
               $encoding = '';
            }
         }
      } else {

Это для 5-го PHP для 4 возможно то же что-то придется поменять... Там ниже для этого свой кусочек...

Помогло это + вот это:

Цитировать
Сначала нужно провести вышеуказанные манипуляции с Joola.php

Потом делаем вот что :

1. идем в /includes/domit/xml_domit_rss_shared.php и строчку:
      $success = $this->node->parseXML($rssText, false);
Заменяем на
      $success = $this->node->parseXML($rssText, true);

2. в файле /includes/feedcreator.class.php если в строчке
   var $encoding = "Windows-1251 или что то другое";
заменяем на
   var $encoding = "UTF-8";

У меня все заработало! Joomla Lavra 1.0.15

Огромное спасибо, а то весь инет перерыл, еле откопал!
Причем, РСС выводил с украинского сайта, после первого шага (1 цитата) ушли вопросики,
после 2 шага - "неправильный" русский превратился в украинский.
*

Алхимик

  • Осваиваюсь на форуме
  • 28
  • 0 / 0
Re: Кодировка RSS
« Ответ #38 : 06.05.2009, 23:44:02 »
Joomla 1.5.10. Юзал разные компоненты и везде RSS экспортируется в utf-8, а у меня уже два сайта новости мои просят, но у них windows-1251 в итоге там не русский язык, а сами знаете что. Может кто посоветует какой компонент, где можно кодировки экспорта выбирать (или тот что экспортирует в windows-1251), или как существующие поправить. Вот на данный момент у меня BCA RSS Syndicator и танцы с бубном вокруг него не помогают.
*

tonik

  • Осваиваюсь на форуме
  • 18
  • 1 / 0
Re: Кодировка RSS
« Ответ #39 : 13.05.2009, 22:25:33 »
Цитировать
Re: Кодировка RSS
« Ответ #16 : 23.07.2007, 03:57:45 »
Получилось!

А как теперь исправить, что вместо «кавычек» стали отображаться [кавычкиk ?


Такая же проблема..
Кто-нибудь решил?
*

Valery

  • Новичок
  • 5
  • 0 / 0
Re: Кодировка RSS
« Ответ #40 : 23.05.2009, 08:40:10 »
Народ помогите у меня такая же проблема на Joomla 1.5.9
Такая же проблема при получении RSS новостей в кодировке 1251
Тоже вместо букв на русском идут кубики или знаки вопросов
Что делать подскажите?
*

alexecon

  • Захожу иногда
  • 129
  • 2 / 0
Re: Кодировка RSS
« Ответ #41 : 25.05.2009, 19:50:36 »
Народ помогите у меня такая же проблема на Joomla 1.5.9
Такая же проблема при получении RSS новостей в кодировке 1251
Тоже вместо букв на русском идут кубики или знаки вопросов
Что делать подскажите?


to Алхимик also:

Народ, тут пишут про решение данной проблемы на Joomla 1.0.x
А Вы народу "полуторку" подсовываете...
*

Adam.K

  • Захожу иногда
  • 135
  • 3 / 0
  • Чтож со зрением то делать? Совсем испортилось.
Re: Кодировка RSS
« Ответ #42 : 09.08.2009, 09:11:22 »
rocksilver Точно получилось! Молодца!
*

alex75300

  • Захожу иногда
  • 99
  • 5 / 0
  • Кому щас легко...
Re: Кодировка RSS
« Ответ #43 : 28.03.2010, 14:26:12 »
Сначала нужно провести вышеуказанные манипуляции с Joola.php

Потом делаем вот что :

1. идем в /includes/domit/xml_domit_rss_shared.php и строчку:
      $success = $this->node->parseXML($rssText, false);
Заменяем на
      $success = $this->node->parseXML($rssText, true);

2. в файле /includes/feedcreator.class.php если в строчке
   var $encoding = "Windows-1251 или что то другое";
заменяем на
   var $encoding = "UTF-8";

У меня все заработало! Joomla Lavra 1.0.15

Реально заработало Joomla Lavra 1.0.15 и Joomla 1.0.15 RE
Спасибо за пост и естественно + автору поста

Re: Кодировка RSS
« Ответ #44 : 22.08.2010, 00:54:02 »
Для Joostina 1.2:
Редактируем /includes/joomla.php
Находим функцию    function newsfeedEncoding($rssDoc,$text,$utf8enc=null) {
в ней находим фрагмент
      if($encoding && !$utf8enc) {
         $text = $encoding($text);
заменяем на:
      if($encoding && !$utf8enc) {
         $text = iconv("UTF-8", "cp1251", $text);

и будет вам счастье. проверено 100%
*

old_style

  • Осваиваюсь на форуме
  • 15
  • 1 / 0
Re: Кодировка RSS
« Ответ #45 : 20.01.2011, 23:36:03 »
Да, все работает (1.0 Лавра). Изменила файлы /includes/frontend.html.php, /includes/joomla.php и /includes/feedcreator.class.php. То, что в папке /includes/domit, не трогала (точнее попыталась, но лента новостей исчезла). Спасибо sarportal !
*

otshelnik

  • Захожу иногда
  • 116
  • 7 / 0
  • мы вместе!
Re: Кодировка RSS
« Ответ #46 : 08.02.2011, 04:54:24 »
Да, все работает (1.0 Лавра). Изменила файлы /includes/frontend.html.php, /includes/joomla.php и /includes/feedcreator.class.php. То, что в папке /includes/domit, не трогала (точнее попыталась, но лента новостей исчезла). Спасибо sarportal !
Да этот вариант сработал.
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Кривая кодировка в RSS при импорте из Joomla 1.5.14

Автор VP

Ответов: 0
Просмотров: 4978
Последний ответ 29.09.2009, 20:48:49
от VP
Кодировка стандартного модуля

Автор malike

Ответов: 2
Просмотров: 4117
Последний ответ 01.04.2008, 15:21:52
от FIJN
кодировка в RSS

Автор c0yc

Ответов: 7
Просмотров: 4354
Последний ответ 15.02.2008, 13:39:08
от c0yc