mirror of
https://github.com/danpros/htmly.git
synced 2026-04-17 11:16:00 +05:30
Update composer + sitemap bugs fixes
This commit is contained in:
parent
2efa6f32f3
commit
7036f125c4
36 changed files with 3039 additions and 2243 deletions
|
|
@ -4,10 +4,10 @@
|
|||
"optimize-autoloader": true
|
||||
},
|
||||
"require": {
|
||||
"michelf/php-markdown": "~1.4",
|
||||
"suin/php-rss-writer": "~1",
|
||||
"kanti/hub-updater": "~0.3",
|
||||
"ircmaxell/password-compat": "^1.0"
|
||||
"ircmaxell/password-compat": "^1.0",
|
||||
"michelf/php-markdown": "^1.5"
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
|
|
|
|||
61
composer.lock
generated
61
composer.lock
generated
|
|
@ -4,7 +4,8 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "68eb4fad3ec95821f7b883c60043ed6e",
|
||||
"hash": "7596d174acdf281f566feb7cbc72469d",
|
||||
"content-hash": "6dabcc2db078cb3f7d2e8af75949f4ce",
|
||||
"packages": [
|
||||
{
|
||||
"name": "ircmaxell/password-compat",
|
||||
|
|
@ -50,25 +51,28 @@
|
|||
},
|
||||
{
|
||||
"name": "kanti/hub-updater",
|
||||
"version": "v0.3.1",
|
||||
"version": "v0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Kanti/hub-updater.git",
|
||||
"reference": "105bf291983b1323c5916092cc4e170bf987b00c"
|
||||
"reference": "81dae71f2b3ccd0e3425579ac932a8c6b7b58c5d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Kanti/hub-updater/zipball/105bf291983b1323c5916092cc4e170bf987b00c",
|
||||
"reference": "105bf291983b1323c5916092cc4e170bf987b00c",
|
||||
"url": "https://api.github.com/repos/Kanti/hub-updater/zipball/81dae71f2b3ccd0e3425579ac932a8c6b7b58c5d",
|
||||
"reference": "81dae71f2b3ccd0e3425579ac932a8c6b7b58c5d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.6@dev"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Kanti\\": ""
|
||||
"Kanti\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
|
|
@ -84,20 +88,20 @@
|
|||
}
|
||||
],
|
||||
"description": "Simple Github Updater for Web Projects",
|
||||
"time": "2014-12-27 13:59:09"
|
||||
"time": "2015-02-03 09:53:58"
|
||||
},
|
||||
{
|
||||
"name": "michelf/php-markdown",
|
||||
"version": "1.4.1",
|
||||
"version": "1.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/michelf/php-markdown.git",
|
||||
"reference": "de9a19c7bf352d41cc99ed86c3c0ef17e87394b6"
|
||||
"reference": "e1aabe18173231ebcefc90e615565742fc1c7fd9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/michelf/php-markdown/zipball/de9a19c7bf352d41cc99ed86c3c0ef17e87394b6",
|
||||
"reference": "de9a19c7bf352d41cc99ed86c3c0ef17e87394b6",
|
||||
"url": "https://api.github.com/repos/michelf/php-markdown/zipball/e1aabe18173231ebcefc90e615565742fc1c7fd9",
|
||||
"reference": "e1aabe18173231ebcefc90e615565742fc1c7fd9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -119,36 +123,36 @@
|
|||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michel Fortin",
|
||||
"email": "michel.fortin@michelf.ca",
|
||||
"homepage": "http://michelf.ca/",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "John Gruber",
|
||||
"homepage": "http://daringfireball.net/"
|
||||
},
|
||||
{
|
||||
"name": "Michel Fortin",
|
||||
"email": "michel.fortin@michelf.ca",
|
||||
"homepage": "https://michelf.ca/",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "PHP Markdown",
|
||||
"homepage": "http://michelf.ca/projects/php-markdown/",
|
||||
"homepage": "https://michelf.ca/projects/php-markdown/",
|
||||
"keywords": [
|
||||
"markdown"
|
||||
],
|
||||
"time": "2014-05-05 02:43:50"
|
||||
"time": "2015-03-01 12:03:08"
|
||||
},
|
||||
{
|
||||
"name": "suin/php-rss-writer",
|
||||
"version": "1.3",
|
||||
"version": "1.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/suin/php-rss-writer.git",
|
||||
"reference": "82812ff988bb470f746d24e153cdc138e8838ff3"
|
||||
"reference": "96ff59575442dbe23e15fe7ff56d0bf27486cff9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/suin/php-rss-writer/zipball/82812ff988bb470f746d24e153cdc138e8838ff3",
|
||||
"reference": "82812ff988bb470f746d24e153cdc138e8838ff3",
|
||||
"url": "https://api.github.com/repos/suin/php-rss-writer/zipball/96ff59575442dbe23e15fe7ff56d0bf27486cff9",
|
||||
"reference": "96ff59575442dbe23e15fe7ff56d0bf27486cff9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -157,7 +161,7 @@
|
|||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Suin\\RSSWriter": "Source"
|
||||
"Suin\\RSSWriter": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
|
|
@ -166,10 +170,8 @@
|
|||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "suin",
|
||||
"email": "suinyeze@gmail.com",
|
||||
"homepage": "https://www.facebook.com/suinyeze",
|
||||
"role": "Developer, Renaming Specialist"
|
||||
"name": "Hidehito Nozawa aka Suin",
|
||||
"email": "suinyeze@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Yet another simple RSS writer library for PHP 5.3 or later.",
|
||||
|
|
@ -177,10 +179,11 @@
|
|||
"keywords": [
|
||||
"feed",
|
||||
"generator",
|
||||
"php",
|
||||
"rss",
|
||||
"writer"
|
||||
],
|
||||
"time": "2014-03-12 06:05:28"
|
||||
"time": "2015-08-21 06:24:39"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
|
|
|
|||
|
|
@ -1835,7 +1835,7 @@ function sitemap_post_path()
|
|||
|
||||
// Author string
|
||||
$str = explode('/', $replaced);
|
||||
$author = $str[count($str) - 3];
|
||||
$author = $str[count($str) - 5];
|
||||
|
||||
$post->authorUrl = site_url() . 'author/' . $author;
|
||||
|
||||
|
|
@ -2480,7 +2480,7 @@ function remove_html_comments($content)
|
|||
// Google recaptcha
|
||||
function isCaptcha($reCaptchaResponse)
|
||||
{
|
||||
if (config('google.reCaptcha') == 'false') {
|
||||
if (config('google.reCaptcha') != 'true') {
|
||||
return true;
|
||||
}
|
||||
$url = "https://www.google.com/recaptcha/api/siteverify";
|
||||
|
|
|
|||
8
system/vendor/composer/ClassLoader.php
vendored
8
system/vendor/composer/ClassLoader.php
vendored
|
|
@ -351,7 +351,7 @@ class ClassLoader
|
|||
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
||||
if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
|
@ -361,7 +361,7 @@ class ClassLoader
|
|||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
|
@ -380,7 +380,7 @@ class ClassLoader
|
|||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
|
@ -390,7 +390,7 @@ class ClassLoader
|
|||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
21
system/vendor/composer/LICENSE
vendored
Normal file
21
system/vendor/composer/LICENSE
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
Copyright (c) 2015 Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
13
system/vendor/composer/autoload_classmap.php
vendored
13
system/vendor/composer/autoload_classmap.php
vendored
|
|
@ -6,4 +6,17 @@ $vendorDir = dirname(dirname(__FILE__));
|
|||
$baseDir = dirname(dirname($vendorDir));
|
||||
|
||||
return array(
|
||||
'Kanti\\CacheOneFile' => $vendorDir . '/kanti/hub-updater/src/CacheOneFile.php',
|
||||
'Kanti\\HelperClass' => $vendorDir . '/kanti/hub-updater/src/HelperClass.php',
|
||||
'Kanti\\HubUpdater' => $vendorDir . '/kanti/hub-updater/src/HubUpdater.php',
|
||||
'Michelf\\Markdown' => $vendorDir . '/michelf/php-markdown/Michelf/Markdown.php',
|
||||
'Michelf\\MarkdownExtra' => $vendorDir . '/michelf/php-markdown/Michelf/MarkdownExtra.php',
|
||||
'Michelf\\MarkdownInterface' => $vendorDir . '/michelf/php-markdown/Michelf/MarkdownInterface.php',
|
||||
'Suin\\RSSWriter\\Channel' => $vendorDir . '/suin/php-rss-writer/src/Suin/RSSWriter/Channel.php',
|
||||
'Suin\\RSSWriter\\ChannelInterface' => $vendorDir . '/suin/php-rss-writer/src/Suin/RSSWriter/ChannelInterface.php',
|
||||
'Suin\\RSSWriter\\Feed' => $vendorDir . '/suin/php-rss-writer/src/Suin/RSSWriter/Feed.php',
|
||||
'Suin\\RSSWriter\\FeedInterface' => $vendorDir . '/suin/php-rss-writer/src/Suin/RSSWriter/FeedInterface.php',
|
||||
'Suin\\RSSWriter\\Item' => $vendorDir . '/suin/php-rss-writer/src/Suin/RSSWriter/Item.php',
|
||||
'Suin\\RSSWriter\\ItemInterface' => $vendorDir . '/suin/php-rss-writer/src/Suin/RSSWriter/ItemInterface.php',
|
||||
'Suin\\RSSWriter\\SimpleXMLElement' => $vendorDir . '/suin/php-rss-writer/src/Suin/RSSWriter/SimpleXMLElement.php',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
|
|||
$baseDir = dirname(dirname($vendorDir));
|
||||
|
||||
return array(
|
||||
'Suin\\RSSWriter' => array($vendorDir . '/suin/php-rss-writer/Source'),
|
||||
'Suin\\RSSWriter' => array($vendorDir . '/suin/php-rss-writer/src'),
|
||||
'Michelf' => array($vendorDir . '/michelf/php-markdown'),
|
||||
);
|
||||
|
|
|
|||
2
system/vendor/composer/autoload_psr4.php
vendored
2
system/vendor/composer/autoload_psr4.php
vendored
|
|
@ -6,5 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
|
|||
$baseDir = dirname(dirname($vendorDir));
|
||||
|
||||
return array(
|
||||
'Kanti\\' => array($vendorDir . '/kanti/hub-updater'),
|
||||
'Kanti\\' => array($vendorDir . '/kanti/hub-updater/src'),
|
||||
);
|
||||
|
|
|
|||
282
system/vendor/composer/installed.json
vendored
282
system/vendor/composer/installed.json
vendored
|
|
@ -1,144 +1,4 @@
|
|||
[
|
||||
{
|
||||
"name": "suin/php-rss-writer",
|
||||
"version": "1.3",
|
||||
"version_normalized": "1.3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/suin/php-rss-writer.git",
|
||||
"reference": "82812ff988bb470f746d24e153cdc138e8838ff3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/suin/php-rss-writer/zipball/82812ff988bb470f746d24e153cdc138e8838ff3",
|
||||
"reference": "82812ff988bb470f746d24e153cdc138e8838ff3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"time": "2014-03-12 06:05:28",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Suin\\RSSWriter": "Source"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "suin",
|
||||
"email": "suinyeze@gmail.com",
|
||||
"homepage": "https://www.facebook.com/suinyeze",
|
||||
"role": "Developer, Renaming Specialist"
|
||||
}
|
||||
],
|
||||
"description": "Yet another simple RSS writer library for PHP 5.3 or later.",
|
||||
"homepage": "https://github.com/suin/php-rss-writer",
|
||||
"keywords": [
|
||||
"feed",
|
||||
"generator",
|
||||
"rss",
|
||||
"writer"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "kanti/hub-updater",
|
||||
"version": "v0.3.1",
|
||||
"version_normalized": "0.3.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Kanti/hub-updater.git",
|
||||
"reference": "105bf291983b1323c5916092cc4e170bf987b00c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Kanti/hub-updater/zipball/105bf291983b1323c5916092cc4e170bf987b00c",
|
||||
"reference": "105bf291983b1323c5916092cc4e170bf987b00c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"time": "2014-12-27 13:59:09",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Kanti\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kanti",
|
||||
"email": "git@kanti.de",
|
||||
"homepage": "https://kanti.de",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Simple Github Updater for Web Projects"
|
||||
},
|
||||
{
|
||||
"name": "michelf/php-markdown",
|
||||
"version": "1.4.1",
|
||||
"version_normalized": "1.4.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/michelf/php-markdown.git",
|
||||
"reference": "de9a19c7bf352d41cc99ed86c3c0ef17e87394b6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/michelf/php-markdown/zipball/de9a19c7bf352d41cc99ed86c3c0ef17e87394b6",
|
||||
"reference": "de9a19c7bf352d41cc99ed86c3c0ef17e87394b6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"time": "2014-05-05 02:43:50",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-lib": "1.4.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "source",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Michelf": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michel Fortin",
|
||||
"email": "michel.fortin@michelf.ca",
|
||||
"homepage": "http://michelf.ca/",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "John Gruber",
|
||||
"homepage": "http://daringfireball.net/"
|
||||
}
|
||||
],
|
||||
"description": "PHP Markdown",
|
||||
"homepage": "http://michelf.ca/projects/php-markdown/",
|
||||
"keywords": [
|
||||
"markdown"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ircmaxell/password-compat",
|
||||
"version": "v1.0.4",
|
||||
|
|
@ -182,5 +42,147 @@
|
|||
"hashing",
|
||||
"password"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "michelf/php-markdown",
|
||||
"version": "1.5.0",
|
||||
"version_normalized": "1.5.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/michelf/php-markdown.git",
|
||||
"reference": "e1aabe18173231ebcefc90e615565742fc1c7fd9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/michelf/php-markdown/zipball/e1aabe18173231ebcefc90e615565742fc1c7fd9",
|
||||
"reference": "e1aabe18173231ebcefc90e615565742fc1c7fd9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"time": "2015-03-01 12:03:08",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-lib": "1.4.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Michelf": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "John Gruber",
|
||||
"homepage": "http://daringfireball.net/"
|
||||
},
|
||||
{
|
||||
"name": "Michel Fortin",
|
||||
"email": "michel.fortin@michelf.ca",
|
||||
"homepage": "https://michelf.ca/",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "PHP Markdown",
|
||||
"homepage": "https://michelf.ca/projects/php-markdown/",
|
||||
"keywords": [
|
||||
"markdown"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "suin/php-rss-writer",
|
||||
"version": "1.3.1",
|
||||
"version_normalized": "1.3.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/suin/php-rss-writer.git",
|
||||
"reference": "96ff59575442dbe23e15fe7ff56d0bf27486cff9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/suin/php-rss-writer/zipball/96ff59575442dbe23e15fe7ff56d0bf27486cff9",
|
||||
"reference": "96ff59575442dbe23e15fe7ff56d0bf27486cff9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"time": "2015-08-21 06:24:39",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Suin\\RSSWriter": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Hidehito Nozawa aka Suin",
|
||||
"email": "suinyeze@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Yet another simple RSS writer library for PHP 5.3 or later.",
|
||||
"homepage": "https://github.com/suin/php-rss-writer",
|
||||
"keywords": [
|
||||
"feed",
|
||||
"generator",
|
||||
"php",
|
||||
"rss",
|
||||
"writer"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "kanti/hub-updater",
|
||||
"version": "v0.4",
|
||||
"version_normalized": "0.4.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Kanti/hub-updater.git",
|
||||
"reference": "81dae71f2b3ccd0e3425579ac932a8c6b7b58c5d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Kanti/hub-updater/zipball/81dae71f2b3ccd0e3425579ac932a8c6b7b58c5d",
|
||||
"reference": "81dae71f2b3ccd0e3425579ac932a8c6b7b58c5d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.6@dev"
|
||||
},
|
||||
"time": "2015-02-03 09:53:58",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Kanti\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kanti",
|
||||
"email": "git@kanti.de",
|
||||
"homepage": "https://kanti.de",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Simple Github Updater for Web Projects"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
22
system/vendor/kanti/hub-updater/composer.json
vendored
22
system/vendor/kanti/hub-updater/composer.json
vendored
|
|
@ -13,15 +13,23 @@
|
|||
"support": {
|
||||
"forum": "https://github.com/Kanti/hub-updater/issues",
|
||||
"issues": "https://github.com/Kanti/hub-updater/issues",
|
||||
"source": "https://github.com/Kanti/hub-updater"
|
||||
"source": "https://github.com/Kanti/hub-updater"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Kanti\\": ""
|
||||
}
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.6@dev"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Kanti\\": "src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Kanti\\Test\\": "tests"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
PHP Markdown Lib
|
||||
Copyright (c) 2004-2014 Michel Fortin
|
||||
<http://michelf.ca/>
|
||||
Copyright (c) 2004-2015 Michel Fortin
|
||||
<https://michelf.ca/>
|
||||
All rights reserved.
|
||||
|
||||
Based on Markdown
|
||||
|
|
|
|||
1756
system/vendor/michelf/php-markdown/Michelf/Markdown.php
vendored
1756
system/vendor/michelf/php-markdown/Michelf/Markdown.php
vendored
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -3,8 +3,8 @@
|
|||
# Markdown - A text-to-HTML conversion tool for web writers
|
||||
#
|
||||
# PHP Markdown
|
||||
# Copyright (c) 2004-2014 Michel Fortin
|
||||
# <http://michelf.com/projects/php-markdown/>
|
||||
# Copyright (c) 2004-2015 Michel Fortin
|
||||
# <https://michelf.ca/projects/php-markdown/>
|
||||
#
|
||||
# Original Markdown
|
||||
# Copyright (c) 2004-2006 John Gruber
|
||||
|
|
@ -32,6 +32,3 @@ interface MarkdownInterface {
|
|||
public function transform($text);
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
40
system/vendor/michelf/php-markdown/Readme.md
vendored
40
system/vendor/michelf/php-markdown/Readme.md
vendored
|
|
@ -1,10 +1,10 @@
|
|||
PHP Markdown
|
||||
============
|
||||
|
||||
PHP Markdown Lib 1.4.1 - 4 May 2013
|
||||
PHP Markdown Lib 1.5.0 - 1 Mar 2015
|
||||
|
||||
by Michel Fortin
|
||||
<http://michelf.ca/>
|
||||
<https://michelf.ca/>
|
||||
|
||||
based on Markdown by John Gruber
|
||||
<http://daringfireball.net/>
|
||||
|
|
@ -26,9 +26,9 @@ markup to HTML. PHP Markdown is a port to PHP of the original Markdown
|
|||
program by John Gruber.
|
||||
|
||||
* [Full documentation of the Markdown syntax](<http://daringfireball.net/projects/markdown/>)
|
||||
- Daring Fireball (John Gruber)
|
||||
* [Markdown Extra syntax additions](<http://michelf.ca/projects/php-markdown/extra/>)
|
||||
- Michel Fortin
|
||||
— Daring Fireball (John Gruber)
|
||||
* [Markdown Extra syntax additions](<https://michelf.ca/projects/php-markdown/extra/>)
|
||||
— Michel Fortin
|
||||
|
||||
|
||||
Requirement
|
||||
|
|
@ -83,7 +83,7 @@ configuration variables:
|
|||
|
||||
To learn more, see the full list of [configuration variables].
|
||||
|
||||
[configuration variables]: http://michelf.ca/projects/php-markdown/configuration/
|
||||
[configuration variables]: https://michelf.ca/projects/php-markdown/configuration/
|
||||
|
||||
|
||||
### Usage without an autoloader
|
||||
|
|
@ -174,6 +174,28 @@ PHP Markdown, please visit [michelf.ca/donate] or send Bitcoin to
|
|||
Version History
|
||||
---------------
|
||||
|
||||
PHP Markdown Lib 1.5.0 (1 Mar 2015)
|
||||
|
||||
* Added the ability start ordered lists with a number different from 1 and
|
||||
and have that reflected in the HTML output. This can be enabled with
|
||||
the `enhanced_ordered_lists` configuration variable for the Markdown
|
||||
parser; it is enabled by default for Markdown Extra.
|
||||
Credits to Matt Gorle for providing the implementation.
|
||||
|
||||
* Added the ability to insert custom HTML attributes with simple values
|
||||
everywhere an extra attribute block is allowed (links, images, headers).
|
||||
The value must be unquoted, cannot contains spaces and is limited to
|
||||
alphanumeric ASCII characters.
|
||||
Credits to Peter Droogmans for providing the implementation.
|
||||
|
||||
* Added a `header_id_func` configuration variable which takes a function
|
||||
that can generate an `id` attribute value from the header text.
|
||||
Credits to Evert Pot for providing the implementation.
|
||||
|
||||
* Added a `url_filter_func` configuration variable which takes a function
|
||||
that can rewrite any link or image URL to something different.
|
||||
|
||||
|
||||
PHP Markdown Lib 1.4.1 (4 May 2014)
|
||||
|
||||
* The HTML block parser will now treat `<figure>` as a block-level element
|
||||
|
|
@ -229,7 +251,7 @@ PHP Markdown Extra 1.2.6:
|
|||
|
||||
* Plugin interface for WordPress and other systems is no longer present in
|
||||
the Lib package. The classic package is still available if you need it:
|
||||
<http://michelf.ca/projects/php-markdown/classic/>
|
||||
<https://michelf.ca/projects/php-markdown/classic/>
|
||||
|
||||
* Added `public` and `protected` protection attributes, plus a section about
|
||||
what is "public API" and what isn't in the Readme file.
|
||||
|
|
@ -267,8 +289,8 @@ Copyright and License
|
|||
---------------------
|
||||
|
||||
PHP Markdown Lib
|
||||
Copyright (c) 2004-2014 Michel Fortin
|
||||
<http://michelf.ca/>
|
||||
Copyright (c) 2004-2015 Michel Fortin
|
||||
<https://michelf.ca/>
|
||||
All rights reserved.
|
||||
|
||||
Based on Markdown
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
"name": "michelf/php-markdown",
|
||||
"type": "library",
|
||||
"description": "PHP Markdown",
|
||||
"homepage": "http://michelf.ca/projects/php-markdown/",
|
||||
"homepage": "https://michelf.ca/projects/php-markdown/",
|
||||
"keywords": ["markdown"],
|
||||
"license": "BSD-3-Clause",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michel Fortin",
|
||||
"email": "michel.fortin@michelf.ca",
|
||||
"homepage": "http://michelf.ca/",
|
||||
"homepage": "https://michelf.ca/",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
|
|
|
|||
3
system/vendor/suin/php-rss-writer/.gitignore
vendored
Normal file
3
system/vendor/suin/php-rss-writer/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.idea/
|
||||
.phpmake
|
||||
.DS_Store
|
||||
16
system/vendor/suin/php-rss-writer/.travis.yml
vendored
16
system/vendor/suin/php-rss-writer/.travis.yml
vendored
|
|
@ -1,11 +1,19 @@
|
|||
sudo: false
|
||||
language: php
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- hhvm
|
||||
|
||||
before_script:
|
||||
- cd Tests
|
||||
- wget http://getcomposer.org/composer.phar
|
||||
- php composer.phar install
|
||||
- cd tests
|
||||
- composer install -n
|
||||
|
||||
script: ./phpunit --coverage-text --configuration phpunit.xml.dist
|
||||
script: phpunit --coverage-text --configuration phpunit.xml.dist
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- tests/vendor
|
||||
- $HOME/.composer/cache
|
||||
26
system/vendor/suin/php-rss-writer/README.md
vendored
26
system/vendor/suin/php-rss-writer/README.md
vendored
|
|
@ -61,9 +61,14 @@ Output:
|
|||
|
||||
## Installation
|
||||
|
||||
You can install via Composer.
|
||||
### Easy installation
|
||||
You can install directly via [Composer](https://getcomposer.org/):
|
||||
```bash
|
||||
$ composer require suin/php-rss-writer
|
||||
```
|
||||
|
||||
At first create `composer.json` file:
|
||||
### Manual installation
|
||||
Add the following code to your `composer.json` file:
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
@ -73,23 +78,22 @@ At first create `composer.json` file:
|
|||
}
|
||||
```
|
||||
|
||||
Run composer to install.
|
||||
|
||||
```
|
||||
...and run composer to install it:
|
||||
```bash
|
||||
$ composer install
|
||||
```
|
||||
|
||||
Finally, include `vendor/autoload.php` in your product.
|
||||
|
||||
```
|
||||
Finally, include `vendor/autoload.php` in your product:
|
||||
```php
|
||||
<?php
|
||||
require_once 'vendor/autoload.php';
|
||||
```
|
||||
|
||||
## How to Use
|
||||
## How to use
|
||||
|
||||
`example.php` is an example usage of RSSWriter.
|
||||
The [`examples`](examples) directory contains usage examples for RSSWriter.
|
||||
|
||||
If you want to know APIs, please see `FeedInterface`, `ChannelInterface` and `ItemInterface`.
|
||||
If you want to know APIs, please see [`FeedInterface`](src/Suin/RSSWriter/FeedInterface.php), [`ChannelInterface`](src/Suin/RSSWriter/ChannelInterface.php) and [`ItemInterface`](src/Suin/RSSWriter/ItemInterface.php).
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
|||
3
system/vendor/suin/php-rss-writer/Tests/.gitignore
vendored
Normal file
3
system/vendor/suin/php-rss-writer/Tests/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Coverage/
|
||||
vendor/*
|
||||
/composer.lock
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
<?php
|
||||
|
||||
// For composer
|
||||
require_once 'Vendor/autoload.php';
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
// Load test target classes
|
||||
spl_autoload_register(function($c) { @include_once strtr($c, '\\_', '//').'.php'; });
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__DIR__).'/Source');
|
||||
spl_autoload_register(function ($c) {
|
||||
@include_once strtr($c, '\\_', '//') . '.php';
|
||||
});
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__DIR__) . '/src');
|
||||
|
|
@ -24,5 +24,4 @@ $ ./phpunit
|
|||
|
||||
## View Reports
|
||||
|
||||
|
||||
If you want to see code coverages, open Coverage/index.html.
|
||||
|
|
@ -4,129 +4,128 @@ namespace Suin\RSSWriter;
|
|||
|
||||
class ChannelTest extends \XoopsUnit\TestCase
|
||||
{
|
||||
private $itemInterface = '\Suin\RSSWriter\ItemInterface';
|
||||
private $feedInterface = '\Suin\RSSWriter\FeedInterface';
|
||||
private $itemInterface = '\Suin\RSSWriter\ItemInterface';
|
||||
private $feedInterface = '\Suin\RSSWriter\FeedInterface';
|
||||
|
||||
public function testTitle()
|
||||
{
|
||||
$title = uniqid();
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->title($title));
|
||||
$this->assertAttributeSame($title, 'title', $channel);
|
||||
}
|
||||
public function testTitle()
|
||||
{
|
||||
$title = uniqid();
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->title($title));
|
||||
$this->assertAttributeSame($title, 'title', $channel);
|
||||
}
|
||||
|
||||
public function testUrl()
|
||||
{
|
||||
$url = uniqid();
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->url($url));
|
||||
$this->assertAttributeSame($url, 'url', $channel);
|
||||
}
|
||||
public function testUrl()
|
||||
{
|
||||
$url = uniqid();
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->url($url));
|
||||
$this->assertAttributeSame($url, 'url', $channel);
|
||||
}
|
||||
|
||||
public function testDescription()
|
||||
{
|
||||
$description = uniqid();
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->description($description));
|
||||
$this->assertAttributeSame($description, 'description', $channel);
|
||||
}
|
||||
public function testDescription()
|
||||
{
|
||||
$description = uniqid();
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->description($description));
|
||||
$this->assertAttributeSame($description, 'description', $channel);
|
||||
}
|
||||
|
||||
public function testLanguage()
|
||||
{
|
||||
$language = uniqid();
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->language($language));
|
||||
$this->assertAttributeSame($language, 'language', $channel);
|
||||
}
|
||||
public function testLanguage()
|
||||
{
|
||||
$language = uniqid();
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->language($language));
|
||||
$this->assertAttributeSame($language, 'language', $channel);
|
||||
}
|
||||
|
||||
public function testCopyright()
|
||||
{
|
||||
$copyright = uniqid();
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->copyright($copyright));
|
||||
$this->assertAttributeSame($copyright, 'copyright', $channel);
|
||||
}
|
||||
public function testCopyright()
|
||||
{
|
||||
$copyright = uniqid();
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->copyright($copyright));
|
||||
$this->assertAttributeSame($copyright, 'copyright', $channel);
|
||||
}
|
||||
|
||||
public function testPubDate()
|
||||
{
|
||||
$pubDate = mt_rand(0, 9999999);
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->pubDate($pubDate));
|
||||
$this->assertAttributeSame($pubDate, 'pubDate', $channel);
|
||||
}
|
||||
public function testPubDate()
|
||||
{
|
||||
$pubDate = mt_rand(0, 9999999);
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->pubDate($pubDate));
|
||||
$this->assertAttributeSame($pubDate, 'pubDate', $channel);
|
||||
}
|
||||
|
||||
public function testLastBuildDate()
|
||||
{
|
||||
$lastBuildDate = mt_rand(0, 9999999);
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->lastBuildDate($lastBuildDate));
|
||||
$this->assertAttributeSame($lastBuildDate, 'lastBuildDate', $channel);
|
||||
}
|
||||
public function testLastBuildDate()
|
||||
{
|
||||
$lastBuildDate = mt_rand(0, 9999999);
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->lastBuildDate($lastBuildDate));
|
||||
$this->assertAttributeSame($lastBuildDate, 'lastBuildDate', $channel);
|
||||
}
|
||||
|
||||
public function testTtl()
|
||||
{
|
||||
$ttl = mt_rand(0, 99999999);
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->ttl($ttl));
|
||||
$this->assertAttributeSame($ttl, 'ttl', $channel);
|
||||
}
|
||||
public function testTtl()
|
||||
{
|
||||
$ttl = mt_rand(0, 99999999);
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->ttl($ttl));
|
||||
$this->assertAttributeSame($ttl, 'ttl', $channel);
|
||||
}
|
||||
|
||||
public function testAddItem()
|
||||
{
|
||||
$item = $this->getMock($this->itemInterface);
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->addItem($item));
|
||||
$this->assertAttributeSame(array($item), 'items', $channel);
|
||||
}
|
||||
public function testAddItem()
|
||||
{
|
||||
$item = $this->getMock($this->itemInterface);
|
||||
$channel = new Channel();
|
||||
$this->assertSame($channel, $channel->addItem($item));
|
||||
$this->assertAttributeSame(array($item), 'items', $channel);
|
||||
}
|
||||
|
||||
public function testAppendTo()
|
||||
{
|
||||
$channel = new Channel();
|
||||
$feed = $this->getMock($this->feedInterface);
|
||||
$feed->expects($this->once())->method('addChannel')->with($channel);
|
||||
$this->assertSame($channel, $channel->appendTo($feed));
|
||||
}
|
||||
public function testAppendTo()
|
||||
{
|
||||
$channel = new Channel();
|
||||
$feed = $this->getMock($this->feedInterface);
|
||||
$feed->expects($this->once())->method('addChannel')->with($channel);
|
||||
$this->assertSame($channel, $channel->appendTo($feed));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $expect
|
||||
* @param array $data
|
||||
* @dataProvider dataForAsXML
|
||||
*/
|
||||
public function testAsXML($expect, array $data)
|
||||
{
|
||||
$data = (object) $data;
|
||||
$channel = new Channel();
|
||||
/**
|
||||
* @param $expect
|
||||
* @param array $data
|
||||
* @dataProvider dataForAsXML
|
||||
*/
|
||||
public function testAsXML($expect, array $data)
|
||||
{
|
||||
$data = (object)$data;
|
||||
$channel = new Channel();
|
||||
|
||||
foreach ( $data as $key => $value )
|
||||
{
|
||||
$this->reveal($channel)->attr($key, $value);
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
$this->reveal($channel)->attr($key, $value);
|
||||
}
|
||||
|
||||
$this->assertXmlStringEqualsXmlString($expect, $channel->asXML()->asXML());
|
||||
}
|
||||
$this->assertXmlStringEqualsXmlString($expect, $channel->asXML()->asXML());
|
||||
}
|
||||
|
||||
public static function dataForAsXML()
|
||||
{
|
||||
$now = time();
|
||||
$nowString = date(DATE_RSS, $now);
|
||||
public static function dataForAsXML()
|
||||
{
|
||||
$now = time();
|
||||
$nowString = date(DATE_RSS, $now);
|
||||
|
||||
return array(
|
||||
array(
|
||||
"
|
||||
return array(
|
||||
array(
|
||||
"
|
||||
<channel>
|
||||
<title>GoUpstate.com News Headlines</title>
|
||||
<link>http://www.goupstate.com/</link>
|
||||
<description>The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.</description>
|
||||
</channel>
|
||||
",
|
||||
array(
|
||||
'title' => "GoUpstate.com News Headlines",
|
||||
'url' => 'http://www.goupstate.com/',
|
||||
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
|
||||
)
|
||||
),
|
||||
array(
|
||||
"
|
||||
array(
|
||||
'title' => "GoUpstate.com News Headlines",
|
||||
'url' => 'http://www.goupstate.com/',
|
||||
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
|
||||
)
|
||||
),
|
||||
array(
|
||||
"
|
||||
<channel>
|
||||
<title>GoUpstate.com News Headlines</title>
|
||||
<link>http://www.goupstate.com/</link>
|
||||
|
|
@ -134,15 +133,15 @@ class ChannelTest extends \XoopsUnit\TestCase
|
|||
<language>en-us</language>
|
||||
</channel>
|
||||
",
|
||||
array(
|
||||
'title' => "GoUpstate.com News Headlines",
|
||||
'url' => 'http://www.goupstate.com/',
|
||||
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
|
||||
'language' => 'en-us',
|
||||
)
|
||||
),
|
||||
array(
|
||||
"
|
||||
array(
|
||||
'title' => "GoUpstate.com News Headlines",
|
||||
'url' => 'http://www.goupstate.com/',
|
||||
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
|
||||
'language' => 'en-us',
|
||||
)
|
||||
),
|
||||
array(
|
||||
"
|
||||
<channel>
|
||||
<title>GoUpstate.com News Headlines</title>
|
||||
<link>http://www.goupstate.com/</link>
|
||||
|
|
@ -150,15 +149,15 @@ class ChannelTest extends \XoopsUnit\TestCase
|
|||
<pubDate>{$nowString}</pubDate>
|
||||
</channel>
|
||||
",
|
||||
array(
|
||||
'title' => "GoUpstate.com News Headlines",
|
||||
'url' => 'http://www.goupstate.com/',
|
||||
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
|
||||
'pubDate' => $now,
|
||||
)
|
||||
),
|
||||
array(
|
||||
"
|
||||
array(
|
||||
'title' => "GoUpstate.com News Headlines",
|
||||
'url' => 'http://www.goupstate.com/',
|
||||
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
|
||||
'pubDate' => $now,
|
||||
)
|
||||
),
|
||||
array(
|
||||
"
|
||||
<channel>
|
||||
<title>GoUpstate.com News Headlines</title>
|
||||
<link>http://www.goupstate.com/</link>
|
||||
|
|
@ -166,15 +165,15 @@ class ChannelTest extends \XoopsUnit\TestCase
|
|||
<lastBuildDate>{$nowString}</lastBuildDate>
|
||||
</channel>
|
||||
",
|
||||
array(
|
||||
'title' => "GoUpstate.com News Headlines",
|
||||
'url' => 'http://www.goupstate.com/',
|
||||
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
|
||||
'lastBuildDate' => $now,
|
||||
)
|
||||
),
|
||||
array(
|
||||
"
|
||||
array(
|
||||
'title' => "GoUpstate.com News Headlines",
|
||||
'url' => 'http://www.goupstate.com/',
|
||||
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
|
||||
'lastBuildDate' => $now,
|
||||
)
|
||||
),
|
||||
array(
|
||||
"
|
||||
<channel>
|
||||
<title>GoUpstate.com News Headlines</title>
|
||||
<link>http://www.goupstate.com/</link>
|
||||
|
|
@ -182,15 +181,15 @@ class ChannelTest extends \XoopsUnit\TestCase
|
|||
<ttl>60</ttl>
|
||||
</channel>
|
||||
",
|
||||
array(
|
||||
'title' => "GoUpstate.com News Headlines",
|
||||
'url' => 'http://www.goupstate.com/',
|
||||
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
|
||||
'ttl' => 60,
|
||||
)
|
||||
),
|
||||
array(
|
||||
"
|
||||
array(
|
||||
'title' => "GoUpstate.com News Headlines",
|
||||
'url' => 'http://www.goupstate.com/',
|
||||
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
|
||||
'ttl' => 60,
|
||||
)
|
||||
),
|
||||
array(
|
||||
"
|
||||
<channel>
|
||||
<title>GoUpstate.com News Headlines</title>
|
||||
<link>http://www.goupstate.com/</link>
|
||||
|
|
@ -198,39 +197,38 @@ class ChannelTest extends \XoopsUnit\TestCase
|
|||
<copyright>Copyright 2002, Spartanburg Herald-Journal</copyright>
|
||||
</channel>
|
||||
",
|
||||
array(
|
||||
'title' => "GoUpstate.com News Headlines",
|
||||
'url' => 'http://www.goupstate.com/',
|
||||
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
|
||||
'copyright' => "Copyright 2002, Spartanburg Herald-Journal",
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
array(
|
||||
'title' => "GoUpstate.com News Headlines",
|
||||
'url' => 'http://www.goupstate.com/',
|
||||
'description' => "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.",
|
||||
'copyright' => "Copyright 2002, Spartanburg Herald-Journal",
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function testAppendTo_with_items()
|
||||
{
|
||||
$channel = new Channel();
|
||||
|
||||
public function testAppendTo_with_items()
|
||||
{
|
||||
$channel = new Channel();
|
||||
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item><title>item1</title></item>');
|
||||
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item><title>item2</title></item>');
|
||||
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item><title>item3</title></item>');
|
||||
|
||||
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item><title>item1</title></item>');
|
||||
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item><title>item2</title></item>');
|
||||
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item><title>item3</title></item>');
|
||||
$item1 = $this->getMock($this->itemInterface);
|
||||
$item1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
|
||||
$item2 = $this->getMock($this->itemInterface);
|
||||
$item2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
|
||||
$item3 = $this->getMock($this->itemInterface);
|
||||
$item3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
|
||||
|
||||
$item1 = $this->getMock($this->itemInterface);
|
||||
$item1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
|
||||
$item2= $this->getMock($this->itemInterface);
|
||||
$item2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
|
||||
$item3 = $this->getMock($this->itemInterface);
|
||||
$item3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
|
||||
$this->reveal($channel)
|
||||
->attr('title', "GoUpstate.com News Headlines")
|
||||
->attr('url', 'http://www.goupstate.com/')
|
||||
->attr('description', "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.")
|
||||
->attr('items', array($item1, $item2, $item3));
|
||||
|
||||
$this->reveal($channel)
|
||||
->attr('title', "GoUpstate.com News Headlines")
|
||||
->attr('url', 'http://www.goupstate.com/')
|
||||
->attr('description', "The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.")
|
||||
->attr('items', array($item1, $item2, $item3));
|
||||
|
||||
$expect = '<?xml version="1.0" encoding="UTF-8" ?>
|
||||
$expect = '<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<channel>
|
||||
<title>GoUpstate.com News Headlines</title>
|
||||
<link>http://www.goupstate.com/</link>
|
||||
|
|
@ -247,6 +245,6 @@ class ChannelTest extends \XoopsUnit\TestCase
|
|||
</channel>
|
||||
';
|
||||
|
||||
$this->assertXmlStringEqualsXmlString($expect, $channel->asXML()->asXML());
|
||||
}
|
||||
$this->assertXmlStringEqualsXmlString($expect, $channel->asXML()->asXML());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,57 +2,57 @@
|
|||
|
||||
namespace Suin\RSSWriter;
|
||||
|
||||
use \Mockery;
|
||||
use Mockery;
|
||||
|
||||
class FeedTest extends \XoopsUnit\TestCase
|
||||
{
|
||||
private $channelInterface = '\Suin\RSSWriter\ChannelInterface';
|
||||
private $channelInterface = '\Suin\RSSWriter\ChannelInterface';
|
||||
|
||||
public function testAddChannel()
|
||||
{
|
||||
$channel = Mockery::mock($this->channelInterface);
|
||||
$feed = new Feed();
|
||||
$this->assertSame($feed, $feed->addChannel($channel));
|
||||
$this->assertAttributeSame(array($channel), 'channels', $feed);
|
||||
}
|
||||
public function testAddChannel()
|
||||
{
|
||||
$channel = Mockery::mock($this->channelInterface);
|
||||
$feed = new Feed();
|
||||
$this->assertSame($feed, $feed->addChannel($channel));
|
||||
$this->assertAttributeSame(array($channel), 'channels', $feed);
|
||||
}
|
||||
|
||||
public function testRender()
|
||||
{
|
||||
$feed = new Feed();
|
||||
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel1</title></channel>');
|
||||
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel2</title></channel>');
|
||||
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel3</title></channel>');
|
||||
$channel1 = $this->getMock($this->channelInterface);
|
||||
$channel1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
|
||||
$channel2 = $this->getMock($this->channelInterface);
|
||||
$channel2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
|
||||
$channel3 = $this->getMock($this->channelInterface);
|
||||
$channel3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
|
||||
$this->reveal($feed)->attr('channels', array($channel1, $channel2, $channel3));
|
||||
$expect = '<?xml version="1.0" encoding="UTF-8" ?>
|
||||
public function testRender()
|
||||
{
|
||||
$feed = new Feed();
|
||||
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel1</title></channel>');
|
||||
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel2</title></channel>');
|
||||
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel3</title></channel>');
|
||||
$channel1 = $this->getMock($this->channelInterface);
|
||||
$channel1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
|
||||
$channel2 = $this->getMock($this->channelInterface);
|
||||
$channel2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
|
||||
$channel3 = $this->getMock($this->channelInterface);
|
||||
$channel3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
|
||||
$this->reveal($feed)->attr('channels', array($channel1, $channel2, $channel3));
|
||||
$expect = '<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<rss version="2.0">
|
||||
<channel><title>channel1</title></channel>
|
||||
<channel><title>channel2</title></channel>
|
||||
<channel><title>channel3</title></channel>
|
||||
</rss>
|
||||
';
|
||||
$this->assertXmlStringEqualsXmlString($expect, $feed->render());
|
||||
}
|
||||
$this->assertXmlStringEqualsXmlString($expect, $feed->render());
|
||||
}
|
||||
|
||||
public function testRender_with_japanese()
|
||||
{
|
||||
$feed = new Feed();
|
||||
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>日本語1</title></channel>');
|
||||
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>日本語2</title></channel>');
|
||||
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>日本語3</title></channel>');
|
||||
$channel1 = $this->getMock($this->channelInterface);
|
||||
$channel1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
|
||||
$channel2 = $this->getMock($this->channelInterface);
|
||||
$channel2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
|
||||
$channel3 = $this->getMock($this->channelInterface);
|
||||
$channel3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
|
||||
$this->reveal($feed)->attr('channels', array($channel1, $channel2, $channel3));
|
||||
$expect = <<< 'XML'
|
||||
public function testRender_with_japanese()
|
||||
{
|
||||
$feed = new Feed();
|
||||
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>日本語1</title></channel>');
|
||||
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>日本語2</title></channel>');
|
||||
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>日本語3</title></channel>');
|
||||
$channel1 = $this->getMock($this->channelInterface);
|
||||
$channel1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
|
||||
$channel2 = $this->getMock($this->channelInterface);
|
||||
$channel2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
|
||||
$channel3 = $this->getMock($this->channelInterface);
|
||||
$channel3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
|
||||
$this->reveal($feed)->attr('channels', array($channel1, $channel2, $channel3));
|
||||
$expect = <<< 'XML'
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
|
|
@ -67,30 +67,30 @@ class FeedTest extends \XoopsUnit\TestCase
|
|||
</rss>
|
||||
|
||||
XML;
|
||||
$this->assertSame($expect, $feed->render());
|
||||
$this->assertSame($expect, $feed->render());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function test__toString()
|
||||
{
|
||||
$feed = new Feed();
|
||||
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel1</title></channel>');
|
||||
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel2</title></channel>');
|
||||
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel3</title></channel>');
|
||||
$channel1 = $this->getMock($this->channelInterface);
|
||||
$channel1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
|
||||
$channel2 = $this->getMock($this->channelInterface);
|
||||
$channel2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
|
||||
$channel3 = $this->getMock($this->channelInterface);
|
||||
$channel3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
|
||||
$this->reveal($feed)->attr('channels', array($channel1, $channel2, $channel3));
|
||||
$expect = '<?xml version="1.0" encoding="UTF-8" ?>
|
||||
public function test__toString()
|
||||
{
|
||||
$feed = new Feed();
|
||||
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel1</title></channel>');
|
||||
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel2</title></channel>');
|
||||
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel3</title></channel>');
|
||||
$channel1 = $this->getMock($this->channelInterface);
|
||||
$channel1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
|
||||
$channel2 = $this->getMock($this->channelInterface);
|
||||
$channel2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
|
||||
$channel3 = $this->getMock($this->channelInterface);
|
||||
$channel3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
|
||||
$this->reveal($feed)->attr('channels', array($channel1, $channel2, $channel3));
|
||||
$expect = '<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<rss version="2.0">
|
||||
<channel><title>channel1</title></channel>
|
||||
<channel><title>channel2</title></channel>
|
||||
<channel><title>channel3</title></channel>
|
||||
</rss>
|
||||
';
|
||||
$this->assertXmlStringEqualsXmlString($expect, $feed);
|
||||
}
|
||||
$this->assertXmlStringEqualsXmlString($expect, $feed);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,131 +2,141 @@
|
|||
|
||||
namespace Suin\RSSWriter;
|
||||
|
||||
class ItemTest extends \XoopsUnit\TestCase
|
||||
use XoopsUnit\TestCase;
|
||||
|
||||
class ItemTest extends TestCase
|
||||
{
|
||||
private $channelInterface = '\Suin\RSSWriter\ChannelInterface';
|
||||
private $channelInterface = '\Suin\RSSWriter\ChannelInterface';
|
||||
|
||||
public function testTitle()
|
||||
{
|
||||
$title = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->title($title));
|
||||
$this->assertAttributeSame($title, 'title', $item);
|
||||
}
|
||||
public function testTitle()
|
||||
{
|
||||
$title = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->title($title));
|
||||
$this->assertAttributeSame($title, 'title', $item);
|
||||
}
|
||||
|
||||
public function testUrl()
|
||||
{
|
||||
$url = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->url($url));
|
||||
$this->assertAttributeSame($url, 'url', $item);
|
||||
}
|
||||
public function testUrl()
|
||||
{
|
||||
$url = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->url($url));
|
||||
$this->assertAttributeSame($url, 'url', $item);
|
||||
}
|
||||
|
||||
public function testDescription()
|
||||
{
|
||||
$description = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->description($description));
|
||||
$this->assertAttributeSame($description, 'description', $item);
|
||||
}
|
||||
public function testDescription()
|
||||
{
|
||||
$description = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->description($description));
|
||||
$this->assertAttributeSame($description, 'description', $item);
|
||||
}
|
||||
|
||||
public function testCategory()
|
||||
{
|
||||
$category = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->category($category));
|
||||
$this->assertAttributeSame(array(
|
||||
array($category, null),
|
||||
), 'categories', $item);
|
||||
}
|
||||
public function testCategory()
|
||||
{
|
||||
$category = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->category($category));
|
||||
$this->assertAttributeSame(array(
|
||||
array($category, null),
|
||||
), 'categories', $item);
|
||||
}
|
||||
|
||||
public function testCategory_with_domain()
|
||||
{
|
||||
$category = uniqid();
|
||||
$domain = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->category($category, $domain));
|
||||
$this->assertAttributeSame(array(
|
||||
array($category, $domain),
|
||||
), 'categories', $item);
|
||||
}
|
||||
public function testCategory_with_domain()
|
||||
{
|
||||
$category = uniqid();
|
||||
$domain = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->category($category, $domain));
|
||||
$this->assertAttributeSame(array(
|
||||
array($category, $domain),
|
||||
), 'categories', $item);
|
||||
}
|
||||
|
||||
public function testGuid()
|
||||
{
|
||||
$guid = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->guid($guid));
|
||||
$this->assertAttributeSame($guid, 'guid', $item);
|
||||
}
|
||||
public function testGuid()
|
||||
{
|
||||
$guid = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->guid($guid));
|
||||
$this->assertAttributeSame($guid, 'guid', $item);
|
||||
}
|
||||
|
||||
public function testGuid_with_permalink()
|
||||
{
|
||||
$item = new Item();
|
||||
$item->guid('guid', true);
|
||||
$this->assertAttributeSame(true, 'isPermalink', $item);
|
||||
public function testGuid_with_permalink()
|
||||
{
|
||||
$item = new Item();
|
||||
$item->guid('guid', true);
|
||||
$this->assertAttributeSame(true, 'isPermalink', $item);
|
||||
|
||||
$item->guid('guid', false);
|
||||
$this->assertAttributeSame(false, 'isPermalink', $item);
|
||||
$item->guid('guid', false);
|
||||
$this->assertAttributeSame(false, 'isPermalink', $item);
|
||||
|
||||
$item->guid('guid'); // default
|
||||
$this->assertAttributeSame(false, 'isPermalink', $item);
|
||||
}
|
||||
$item->guid('guid'); // default
|
||||
$this->assertAttributeSame(false, 'isPermalink', $item);
|
||||
}
|
||||
|
||||
public function testPubDate()
|
||||
{
|
||||
$pubDate = mt_rand(1000000, 9999999);
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->pubDate($pubDate));
|
||||
$this->assertAttributeSame($pubDate, 'pubDate', $item);
|
||||
}
|
||||
public function testPubDate()
|
||||
{
|
||||
$pubDate = mt_rand(1000000, 9999999);
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->pubDate($pubDate));
|
||||
$this->assertAttributeSame($pubDate, 'pubDate', $item);
|
||||
}
|
||||
|
||||
public function testAppendTo()
|
||||
{
|
||||
$item = new Item();
|
||||
$channel = $this->getMock($this->channelInterface);
|
||||
$channel->expects($this->once())->method('addItem')->with($item);
|
||||
$this->assertSame($item, $item->appendTo($channel));
|
||||
}
|
||||
public function testAppendTo()
|
||||
{
|
||||
$item = new Item();
|
||||
$channel = $this->getMock($this->channelInterface);
|
||||
$channel->expects($this->once())->method('addItem')->with($item);
|
||||
$this->assertSame($item, $item->appendTo($channel));
|
||||
}
|
||||
|
||||
public function testEnclosure()
|
||||
{
|
||||
$url = uniqid();
|
||||
public function testEnclosure()
|
||||
{
|
||||
$url = uniqid();
|
||||
$enclosure = array('url' => $url, 'length' => 0, 'type' => 'audio/mpeg');
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->enclosure($url));
|
||||
$this->assertAttributeSame($enclosure, 'enclosure', $item);
|
||||
}
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->enclosure($url));
|
||||
$this->assertAttributeSame($enclosure, 'enclosure', $item);
|
||||
}
|
||||
|
||||
public function testAsXML()
|
||||
{
|
||||
$now = time();
|
||||
$nowString = date(DATE_RSS, $now);
|
||||
public function testAuthor()
|
||||
{
|
||||
$author = uniqid();
|
||||
$item = new Item();
|
||||
$this->assertSame($item, $item->author($author));
|
||||
$this->assertAttributeSame($author, 'author', $item);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'title' => "Venice Film Festival Tries to Quit Sinking",
|
||||
'url' => 'http://nytimes.com/2004/12/07FEST.html',
|
||||
'description' => "Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged.",
|
||||
'categories' => array(
|
||||
array("Grateful Dead", null),
|
||||
array("MSFT", 'http://www.fool.com/cusips'),
|
||||
),
|
||||
'guid' => "http://inessential.com/2002/09/01.php#a2",
|
||||
'isPermalink' => true,
|
||||
'pubDate' => $now,
|
||||
public function testAsXML()
|
||||
{
|
||||
$now = time();
|
||||
$nowString = date(DATE_RSS, $now);
|
||||
|
||||
$data = array(
|
||||
'title' => "Venice Film Festival Tries to Quit Sinking",
|
||||
'url' => 'http://nytimes.com/2004/12/07FEST.html',
|
||||
'description' => "Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged.",
|
||||
'categories' => array(
|
||||
array("Grateful Dead", null),
|
||||
array("MSFT", 'http://www.fool.com/cusips'),
|
||||
),
|
||||
'guid' => "http://inessential.com/2002/09/01.php#a2",
|
||||
'isPermalink' => true,
|
||||
'pubDate' => $now,
|
||||
'enclosure' => array(
|
||||
'url' => 'http://link-to-audio-file.com/test.mp3',
|
||||
'url' => 'http://link-to-audio-file.com/test.mp3',
|
||||
'length' => 4992,
|
||||
'type' => 'audio/mpeg')
|
||||
);
|
||||
'type' => 'audio/mpeg'),
|
||||
'author' => 'Hidehito Nozawa aka Suin'
|
||||
);
|
||||
|
||||
$item = new Item();
|
||||
$item = new Item();
|
||||
|
||||
foreach ( $data as $key => $value )
|
||||
{
|
||||
$this->reveal($item)->attr($key, $value);
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
$this->reveal($item)->attr($key, $value);
|
||||
}
|
||||
|
||||
$expect ="
|
||||
$expect = "
|
||||
<item>
|
||||
<title>{$data['title']}</title>
|
||||
<link>{$data['url']}</link>
|
||||
|
|
@ -135,31 +145,28 @@ class ItemTest extends \XoopsUnit\TestCase
|
|||
<category domain=\"{$data['categories'][1][1]}\">{$data['categories'][1][0]}</category>
|
||||
<guid isPermaLink=\"true\">{$data['guid']}</guid>
|
||||
<pubDate>{$nowString}</pubDate>
|
||||
<enclosure url=\"{$data['enclosure']['url']}\" length=\"{$data['enclosure']['length']}\" type=\"{$data['enclosure']['type']}\"/>
|
||||
<enclosure url=\"{$data['enclosure']['url']}\" type=\"{$data['enclosure']['type']}\" length=\"{$data['enclosure']['length']}\"/>
|
||||
<author>{$data['author']}</author>
|
||||
</item>
|
||||
";
|
||||
$this->assertXmlStringEqualsXmlString($expect, $item->asXML()->asXML());
|
||||
}
|
||||
$this->assertXmlStringEqualsXmlString($expect, $item->asXML()->asXML());
|
||||
}
|
||||
|
||||
public function testAsXML_test_Japanese()
|
||||
{
|
||||
$now = time();
|
||||
$nowString = date(DATE_RSS, $now);
|
||||
public function testAsXML_test_Japanese()
|
||||
{
|
||||
$data = array(
|
||||
'title' => "Venice Film Festival",
|
||||
'url' => 'http://nytimes.com/2004/12/07FEST.html',
|
||||
'description' => "Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged.",
|
||||
);
|
||||
|
||||
$data = array(
|
||||
'title' => "Venice Film Festival",
|
||||
'url' => 'http://nytimes.com/2004/12/07FEST.html',
|
||||
'description' => "Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged.",
|
||||
);
|
||||
$item = new Item();
|
||||
|
||||
$item = new Item();
|
||||
foreach ($data as $key => $value) {
|
||||
$this->reveal($item)->attr($key, $value);
|
||||
}
|
||||
|
||||
foreach ( $data as $key => $value )
|
||||
{
|
||||
$this->reveal($item)->attr($key, $value);
|
||||
}
|
||||
|
||||
$expect = "
|
||||
$expect = "
|
||||
<item>
|
||||
<title>{$data['title']}</title>
|
||||
<link>{$data['url']}</link>
|
||||
|
|
@ -167,34 +174,34 @@ class ItemTest extends \XoopsUnit\TestCase
|
|||
</item>
|
||||
";
|
||||
|
||||
$this->assertXmlStringEqualsXmlString($expect, $item->asXML()->asXML());
|
||||
}
|
||||
$this->assertXmlStringEqualsXmlString($expect, $item->asXML()->asXML());
|
||||
}
|
||||
|
||||
public function test_with_amp()
|
||||
{
|
||||
$item = new Item();
|
||||
$item
|
||||
->title('test&test')
|
||||
->url('url&url')
|
||||
->description('desc&desc');
|
||||
$expect = '<?xml version="1.0" encoding="UTF-8"?>
|
||||
public function test_with_amp()
|
||||
{
|
||||
$item = new Item();
|
||||
$item
|
||||
->title('test&test')
|
||||
->url('url&url')
|
||||
->description('desc&desc');
|
||||
$expect = '<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item><title>test&test</title><link>url&url</link><description>desc&desc</description></item>
|
||||
';
|
||||
|
||||
$this->assertSame($expect, $item->asXML()->asXML());
|
||||
}
|
||||
$this->assertSame($expect, $item->asXML()->asXML());
|
||||
}
|
||||
|
||||
public function test_fail_safe_against_invalid_string()
|
||||
{
|
||||
$item = new Item();
|
||||
$item
|
||||
->title("test\0test")
|
||||
->url("url\0test")
|
||||
->description("desc\0desc");
|
||||
$expect = '<?xml version="1.0" encoding="UTF-8"?>
|
||||
public function test_fail_safe_against_invalid_string()
|
||||
{
|
||||
$item = new Item();
|
||||
$item
|
||||
->title("test\0test")
|
||||
->url("url\0test")
|
||||
->description("desc\0desc");
|
||||
$expect = '<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item><title>test</title><link>url</link><description>desc</description></item>
|
||||
';
|
||||
|
||||
$this->assertSame($expect, $item->asXML()->asXML());
|
||||
}
|
||||
$this->assertSame($expect, $item->asXML()->asXML());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
"config": {
|
||||
"bin-dir": ".",
|
||||
"vendor-dir": "Vendor"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"EHER/PHPUnit": ">=1.6",
|
||||
|
|
|
|||
|
|
@ -20,23 +20,21 @@
|
|||
highlight="false"
|
||||
lowUpperBound="35"
|
||||
highLowerBound="70" />
|
||||
<!-- <log type="coverage-text" target="php://stdout" lowUpperBound="35" highLowerBound="70" /> -->
|
||||
</logging>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">../Source</directory>
|
||||
<!-- <file>/path/to/file</file> -->
|
||||
<directory suffix=".php">../src</directory>
|
||||
<exclude>
|
||||
<file>../Public/index.php</file>
|
||||
<directory suffix="Interface.php">../Source</directory>
|
||||
<directory suffix="Interface.php">../src</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
<blacklist>
|
||||
<directory suffix=".php" group="PHPUNIT">../Vendor</directory>
|
||||
<directory suffix=".php" group="PHPUNIT">../vendor</directory>
|
||||
</blacklist>
|
||||
</filter>
|
||||
<listeners>
|
||||
<listener class="\Mockery\Adapter\Phpunit\TestListener" file="Vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php" />
|
||||
<listener class="\Mockery\Adapter\Phpunit\TestListener" file="vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php" />
|
||||
</listeners>
|
||||
</phpunit>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "suin/php-rss-writer",
|
||||
"type": "library",
|
||||
"description": "Yet another simple RSS writer library for PHP 5.3 or later.",
|
||||
"keywords": ["rss", "generator", "writer", "feed"],
|
||||
"keywords": ["rss", "generator", "writer", "feed", "php"],
|
||||
"homepage": "https://github.com/suin/php-rss-writer",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
|
|
@ -15,6 +15,6 @@
|
|||
"php": ">=5.3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Suin\\RSSWriter": "Source" }
|
||||
"psr-0": { "Suin\\RSSWriter": "src" }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
37
system/vendor/suin/php-rss-writer/examples/simple-feed.php
vendored
Normal file
37
system/vendor/suin/php-rss-writer/examples/simple-feed.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
// Load test target classes
|
||||
spl_autoload_register(function ($c) {
|
||||
@include_once strtr($c, '\\_', '//') . '.php';
|
||||
});
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__DIR__) . '/src');
|
||||
|
||||
use Suin\RSSWriter\Channel;
|
||||
use Suin\RSSWriter\Feed;
|
||||
use Suin\RSSWriter\Item;
|
||||
|
||||
$feed = new Feed();
|
||||
|
||||
$channel = new Channel();
|
||||
$channel
|
||||
->title("Channel Title")
|
||||
->description("Channel Description")
|
||||
->url('http://blog.example.com')
|
||||
->language('en-US')
|
||||
->copyright('Copyright 2012, Foo Bar')
|
||||
->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
|
||||
->lastBuildDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
|
||||
->ttl(60)
|
||||
->appendTo($feed);
|
||||
|
||||
$item = new Item();
|
||||
$item
|
||||
->title("Blog Entry Title")
|
||||
->description("<div>Blog body</div>")
|
||||
->url('http://blog.example.com/2012/08/21/blog-entry/')
|
||||
->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
|
||||
->guid('http://blog.example.com/2012/08/21/blog-entry/', true)
|
||||
->appendTo($channel);
|
||||
|
||||
|
||||
echo $feed; // or echo $feed->render();
|
||||
193
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/Channel.php
vendored
Normal file
193
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/Channel.php
vendored
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
<?php
|
||||
|
||||
namespace Suin\RSSWriter;
|
||||
|
||||
/**
|
||||
* Class Channel
|
||||
* @package Suin\RSSWriter
|
||||
*/
|
||||
class Channel implements ChannelInterface
|
||||
{
|
||||
/** @var string */
|
||||
protected $title;
|
||||
|
||||
/** @var string */
|
||||
protected $url;
|
||||
|
||||
/** @var string */
|
||||
protected $description;
|
||||
|
||||
/** @var string */
|
||||
protected $language;
|
||||
|
||||
/** @var string */
|
||||
protected $copyright;
|
||||
|
||||
/** @var int */
|
||||
protected $pubDate;
|
||||
|
||||
/** @var int */
|
||||
protected $lastBuildDate;
|
||||
|
||||
/** @var int */
|
||||
protected $ttl;
|
||||
|
||||
/** @var ItemInterface[] */
|
||||
protected $items = array();
|
||||
|
||||
/**
|
||||
* Set channel title
|
||||
* @param string $title
|
||||
* @return $this
|
||||
*/
|
||||
public function title($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set channel URL
|
||||
* @param string $url
|
||||
* @return $this
|
||||
*/
|
||||
public function url($url)
|
||||
{
|
||||
$this->url = $url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set channel description
|
||||
* @param string $description
|
||||
* @return $this
|
||||
*/
|
||||
public function description($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ISO639 language code
|
||||
*
|
||||
* The language the channel is written in. This allows aggregators to group all
|
||||
* Italian language sites, for example, on a single page. A list of allowable
|
||||
* values for this element, as provided by Netscape, is here. You may also use
|
||||
* values defined by the W3C.
|
||||
*
|
||||
* @param string $language
|
||||
* @return $this
|
||||
*/
|
||||
public function language($language)
|
||||
{
|
||||
$this->language = $language;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set channel copyright
|
||||
* @param string $copyright
|
||||
* @return $this
|
||||
*/
|
||||
public function copyright($copyright)
|
||||
{
|
||||
$this->copyright = $copyright;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set channel published date
|
||||
* @param int $pubDate Unix timestamp
|
||||
* @return $this
|
||||
*/
|
||||
public function pubDate($pubDate)
|
||||
{
|
||||
$this->pubDate = $pubDate;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set channel last build date
|
||||
* @param int $lastBuildDate Unix timestamp
|
||||
* @return $this
|
||||
*/
|
||||
public function lastBuildDate($lastBuildDate)
|
||||
{
|
||||
$this->lastBuildDate = $lastBuildDate;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set channel ttl (minutes)
|
||||
* @param int $ttl
|
||||
* @return $this
|
||||
*/
|
||||
public function ttl($ttl)
|
||||
{
|
||||
$this->ttl = $ttl;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add item object
|
||||
* @param ItemInterface $item
|
||||
* @return $this
|
||||
*/
|
||||
public function addItem(ItemInterface $item)
|
||||
{
|
||||
$this->items[] = $item;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append to feed
|
||||
* @param FeedInterface $feed
|
||||
* @return $this
|
||||
*/
|
||||
public function appendTo(FeedInterface $feed)
|
||||
{
|
||||
$feed->addChannel($this);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return XML object
|
||||
* @return SimpleXMLElement
|
||||
*/
|
||||
public function asXML()
|
||||
{
|
||||
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel></channel>', LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL);
|
||||
$xml->addChild('title', $this->title);
|
||||
$xml->addChild('link', $this->url);
|
||||
$xml->addChild('description', $this->description);
|
||||
|
||||
if ($this->language !== null) {
|
||||
$xml->addChild('language', $this->language);
|
||||
}
|
||||
|
||||
if ($this->copyright !== null) {
|
||||
$xml->addChild('copyright', $this->copyright);
|
||||
}
|
||||
|
||||
if ($this->pubDate !== null) {
|
||||
$xml->addChild('pubDate', date(DATE_RSS, $this->pubDate));
|
||||
}
|
||||
|
||||
if ($this->lastBuildDate !== null) {
|
||||
$xml->addChild('lastBuildDate', date(DATE_RSS, $this->lastBuildDate));
|
||||
}
|
||||
|
||||
if ($this->ttl !== null) {
|
||||
$xml->addChild('ttl', $this->ttl);
|
||||
}
|
||||
|
||||
foreach ($this->items as $item) {
|
||||
$toDom = dom_import_simplexml($xml);
|
||||
$fromDom = dom_import_simplexml($item->asXML());
|
||||
$toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true));
|
||||
}
|
||||
|
||||
return $xml;
|
||||
}
|
||||
}
|
||||
92
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/ChannelInterface.php
vendored
Normal file
92
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/ChannelInterface.php
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
namespace Suin\RSSWriter;
|
||||
|
||||
/**
|
||||
* Interface ChannelInterface
|
||||
* @package Suin\RSSWriter
|
||||
*/
|
||||
interface ChannelInterface
|
||||
{
|
||||
/**
|
||||
* Set channel title
|
||||
* @param string $title
|
||||
* @return $this
|
||||
*/
|
||||
public function title($title);
|
||||
|
||||
/**
|
||||
* Set channel URL
|
||||
* @param string $url
|
||||
* @return $this
|
||||
*/
|
||||
public function url($url);
|
||||
|
||||
/**
|
||||
* Set channel description
|
||||
* @param string $description
|
||||
* @return $this
|
||||
*/
|
||||
public function description($description);
|
||||
|
||||
/**
|
||||
* Set ISO639 language code
|
||||
*
|
||||
* The language the channel is written in. This allows aggregators to group all
|
||||
* Italian language sites, for example, on a single page. A list of allowable
|
||||
* values for this element, as provided by Netscape, is here. You may also use
|
||||
* values defined by the W3C.
|
||||
*
|
||||
* @param string $language
|
||||
* @return $this
|
||||
*/
|
||||
public function language($language);
|
||||
|
||||
/**
|
||||
* Set channel copyright
|
||||
* @param string $copyright
|
||||
* @return $this
|
||||
*/
|
||||
public function copyright($copyright);
|
||||
|
||||
/**
|
||||
* Set channel published date
|
||||
* @param int $pubDate Unix timestamp
|
||||
* @return $this
|
||||
*/
|
||||
public function pubDate($pubDate);
|
||||
|
||||
/**
|
||||
* Set channel last build date
|
||||
* @param int $lastBuildDate Unix timestamp
|
||||
* @return $this
|
||||
*/
|
||||
public function lastBuildDate($lastBuildDate);
|
||||
|
||||
/**
|
||||
* Set channel ttl (minutes)
|
||||
* @param int $ttl
|
||||
* @return $this
|
||||
*/
|
||||
public function ttl($ttl);
|
||||
|
||||
/**
|
||||
* Add item object
|
||||
* @param ItemInterface $item
|
||||
* @return $this
|
||||
*/
|
||||
public function addItem(ItemInterface $item);
|
||||
|
||||
/**
|
||||
* Append to feed
|
||||
* @param FeedInterface $feed
|
||||
* @return $this
|
||||
*/
|
||||
public function appendTo(FeedInterface $feed);
|
||||
|
||||
/**
|
||||
* Return XML object
|
||||
* @return SimpleXMLElement
|
||||
*/
|
||||
public function asXML();
|
||||
}
|
||||
55
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/Feed.php
vendored
Normal file
55
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/Feed.php
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace Suin\RSSWriter;
|
||||
|
||||
use DOMDocument;
|
||||
|
||||
/**
|
||||
* Class Feed
|
||||
* @package Suin\RSSWriter
|
||||
*/
|
||||
class Feed implements FeedInterface
|
||||
{
|
||||
/** @var ChannelInterface[] */
|
||||
protected $channels = array();
|
||||
|
||||
/**
|
||||
* Add channel
|
||||
* @param ChannelInterface $channel
|
||||
* @return $this
|
||||
*/
|
||||
public function addChannel(ChannelInterface $channel)
|
||||
{
|
||||
$this->channels[] = $channel;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render XML
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0" />', LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL);
|
||||
|
||||
foreach ($this->channels as $channel) {
|
||||
$toDom = dom_import_simplexml($xml);
|
||||
$fromDom = dom_import_simplexml($channel->asXML());
|
||||
$toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true));
|
||||
}
|
||||
|
||||
$dom = new DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($dom->importNode(dom_import_simplexml($xml), true));
|
||||
$dom->formatOutput = true;
|
||||
return $dom->saveXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render XML
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->render();
|
||||
}
|
||||
}
|
||||
29
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/FeedInterface.php
vendored
Normal file
29
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/FeedInterface.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Suin\RSSWriter;
|
||||
|
||||
/**
|
||||
* Interface FeedInterface
|
||||
* @package Suin\RSSWriter
|
||||
*/
|
||||
interface FeedInterface
|
||||
{
|
||||
/**
|
||||
* Add channel
|
||||
* @param ChannelInterface $channel
|
||||
* @return $thisJ
|
||||
*/
|
||||
public function addChannel(ChannelInterface $channel);
|
||||
|
||||
/**
|
||||
* Render XML
|
||||
* @return string
|
||||
*/
|
||||
public function render();
|
||||
|
||||
/**
|
||||
* Render XML
|
||||
* @return string
|
||||
*/
|
||||
public function __toString();
|
||||
}
|
||||
136
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/Item.php
vendored
Normal file
136
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/Item.php
vendored
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
|
||||
namespace Suin\RSSWriter;
|
||||
|
||||
/**
|
||||
* Class Item
|
||||
* @package Suin\RSSWriter
|
||||
*/
|
||||
class Item implements ItemInterface
|
||||
{
|
||||
/** @var string */
|
||||
protected $title;
|
||||
|
||||
/** @var string */
|
||||
protected $url;
|
||||
|
||||
/** @var string */
|
||||
protected $description;
|
||||
|
||||
/** @var array */
|
||||
protected $categories = array();
|
||||
|
||||
/** @var string */
|
||||
protected $guid;
|
||||
|
||||
/** @var bool */
|
||||
protected $isPermalink;
|
||||
|
||||
/** @var int */
|
||||
protected $pubDate;
|
||||
|
||||
/** @var array */
|
||||
protected $enclosure;
|
||||
|
||||
/** @var string */
|
||||
protected $author;
|
||||
|
||||
public function title($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function url($url)
|
||||
{
|
||||
$this->url = $url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function description($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function category($name, $domain = null)
|
||||
{
|
||||
$this->categories[] = array($name, $domain);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function guid($guid, $isPermalink = false)
|
||||
{
|
||||
$this->guid = $guid;
|
||||
$this->isPermalink = $isPermalink;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function pubDate($pubDate)
|
||||
{
|
||||
$this->pubDate = $pubDate;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function enclosure($url, $length = 0, $type = 'audio/mpeg')
|
||||
{
|
||||
$this->enclosure = array('url' => $url, 'length' => $length, 'type' => $type);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function author($author)
|
||||
{
|
||||
$this->author = $author;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function appendTo(ChannelInterface $channel)
|
||||
{
|
||||
$channel->addItem($this);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function asXML()
|
||||
{
|
||||
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item></item>', LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL);
|
||||
$xml->addChild('title', $this->title);
|
||||
$xml->addChild('link', $this->url);
|
||||
$xml->addChild('description', $this->description);
|
||||
|
||||
foreach ($this->categories as $category) {
|
||||
$element = $xml->addChild('category', $category[0]);
|
||||
|
||||
if (isset($category[1])) {
|
||||
$element->addAttribute('domain', $category[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->guid) {
|
||||
$guid = $xml->addChild('guid', $this->guid);
|
||||
|
||||
if ($this->isPermalink) {
|
||||
$guid->addAttribute('isPermaLink', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->pubDate !== null) {
|
||||
$xml->addChild('pubDate', date(DATE_RSS, $this->pubDate));
|
||||
}
|
||||
|
||||
if (is_array($this->enclosure) && (count($this->enclosure) == 3)) {
|
||||
$element = $xml->addChild('enclosure');
|
||||
$element->addAttribute('url', $this->enclosure['url']);
|
||||
$element->addAttribute('type', $this->enclosure['type']);
|
||||
|
||||
if ($this->enclosure['length']) {
|
||||
$element->addAttribute('length', $this->enclosure['length']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($this->author)) {
|
||||
$xml->addChild('author', $this->author);
|
||||
}
|
||||
|
||||
return $xml;
|
||||
}
|
||||
}
|
||||
83
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/ItemInterface.php
vendored
Normal file
83
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/ItemInterface.php
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
namespace Suin\RSSWriter;
|
||||
|
||||
/**
|
||||
* Interface ItemInterface
|
||||
* @package Suin\RSSWriter
|
||||
*/
|
||||
interface ItemInterface
|
||||
{
|
||||
/**
|
||||
* Set item title
|
||||
* @param string $title
|
||||
* @return $this
|
||||
*/
|
||||
public function title($title);
|
||||
|
||||
/**
|
||||
* Set item URL
|
||||
* @param string $url
|
||||
* @return $this
|
||||
*/
|
||||
public function url($url);
|
||||
|
||||
/**
|
||||
* Set item description
|
||||
* @param string $description
|
||||
* @return $this
|
||||
*/
|
||||
public function description($description);
|
||||
|
||||
/**
|
||||
* Set item category
|
||||
* @param string $name Category name
|
||||
* @param string $domain Category URL
|
||||
* @return $this
|
||||
*/
|
||||
public function category($name, $domain = null);
|
||||
|
||||
/**
|
||||
* Set GUID
|
||||
* @param string $guid
|
||||
* @param bool $isPermalink
|
||||
* @return $this
|
||||
*/
|
||||
public function guid($guid, $isPermalink = false);
|
||||
|
||||
/**
|
||||
* Set published date
|
||||
* @param int $pubDate Unix timestamp
|
||||
* @return $this
|
||||
*/
|
||||
public function pubDate($pubDate);
|
||||
|
||||
/**
|
||||
* Set enclosure
|
||||
* @param string $url Url to media file
|
||||
* @param int $length Length in bytes of the media file
|
||||
* @param string $type Media type, default is audio/mpeg
|
||||
* @return $this
|
||||
*/
|
||||
public function enclosure($url, $length = 0, $type = 'audio/mpeg');
|
||||
|
||||
/**
|
||||
* Set the author
|
||||
* @param string $author Email of item author
|
||||
* @return $this
|
||||
*/
|
||||
public function author($author);
|
||||
|
||||
/**
|
||||
* Append item to the channel
|
||||
* @param \Suin\RSSWriter\ChannelInterface $channel
|
||||
* @return $this
|
||||
*/
|
||||
public function appendTo(ChannelInterface $channel);
|
||||
|
||||
/**
|
||||
* Return XML object
|
||||
* @return \Suin\RSSWriter\SimpleXMLElement
|
||||
*/
|
||||
public function asXML();
|
||||
}
|
||||
19
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/SimpleXMLElement.php
vendored
Normal file
19
system/vendor/suin/php-rss-writer/src/Suin/RSSWriter/SimpleXMLElement.php
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Suin\RSSWriter;
|
||||
|
||||
/**
|
||||
* Class SimpleXMLElement
|
||||
* @package Suin\RSSWriter
|
||||
*/
|
||||
class SimpleXMLElement extends \SimpleXMLElement
|
||||
{
|
||||
public function addChild($name, $value = null, $namespace = null)
|
||||
{
|
||||
if ($value !== null and is_string($value) === true) {
|
||||
$value = str_replace('&', '&', $value);
|
||||
}
|
||||
|
||||
return parent::addChild($name, $value, $namespace);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue