Revert "init" This reverts commit 0dd0a570ec1494891eb4d77dd1df3cb457c1649e.
jump to
@@ -1,443 +0,0 @@
-<?php - -namespace Article2Email; -require (__DIR__ . '/vendor/autoload.php'); - -define ( 'Article2Email\revisit_time', 1800 ); -define ( 'Article2Email\bookmarks', __DIR__ . DIRECTORY_SEPARATOR . 'bookmarks.tsv' ); -define ( 'Article2Email\fromfile', __DIR__ . DIRECTORY_SEPARATOR . 'from.tsv' ); -define ( 'Article2Email\cachedir', __DIR__ . DIRECTORY_SEPARATOR . 'cache' ); -define ( 'Article2Email\defaultfrom', 'articlesemail@' . gethostname() ); -define ( 'Article2Email\debuglevel', 5 ); - - -/** - * - * @param string $message - * @param int $level - * - * @output log to syslog | die on high level - * @return false on not taking action, true on log sent - */ -function debug( $message, $level = LOG_NOTICE ) { - - if ( empty( $message ) ) - return false; - - if ( @is_array( $message ) || @is_object ( $message ) ) - $message = json_encode($message); - - $levels = array ( - LOG_EMERG => 0, // system is unusable - LOG_ALERT => 1, // Alert action must be taken immediately - LOG_CRIT => 2, // Critical critical conditions - LOG_ERR => 3, // Error error conditions - LOG_WARNING => 4, // Warning warning conditions - LOG_NOTICE => 5, // Notice normal but significant condition - LOG_INFO => 6, // Informational informational messages - LOG_DEBUG => 7, // Debug debug-level messages - ); - - // number for number based comparison - // should work with the defines only, this is just a make-it-sure step - $level_ = $levels [ $level ]; - - // ERR, CRIT, ALERT and EMERG - if ( 3 >= $level_ ) { - die( "Error: {$message}" ); - } - - if ( defined( 'Article2Email\debuglevel') ) { - if ( $level_ > debuglevel ) - return false; - } - - $trace = debug_backtrace(); - $caller = $trace[1]; - $parent = $caller['function']; - - if (isset($caller['class'])) - $parent = $caller['class'] . '::' . $parent; - - return error_log( "{$parent}: {$message}" ); -} - -/** - * - */ -function main() { - if ( !is_dir( cachedir ) ) - mkdir ( cachedir ); - - $bookmarks = get_bookmarks(); - foreach ( $bookmarks as $i => $bookmark ) { - debug( "Processing {$bookmark['url']} for {$bookmark['email']}", 5 ); - if ( $bookmark['type'] == 'rss' ) { - debug( "{$bookmark['url']} is rss", 7 ); - $t = process_rss( $bookmark ); - } - elseif ( $bookmark['type'] == 'mf2' ) { - debug( "{$bookmark['url']} is mf2", 7 ); - $t = process_mf2( $bookmark ); - } - $bookmarks[ $i ]['updated'] = $t; - } - - update_bookmarks( $bookmarks ); -} - -function fetch_mf2 ( $bookmark ) { - - $hash = md5( $bookmark['url'] ); - $cachefile = cachedir . DIRECTORY_SEPARATOR . $hash; - - if ( file_exists( $cachefile ) ) { - $mtime = filemtime( $cachefile ); - if ( $mtime > (time() - revisit_time) ) { - debug ("Using cachefile", 7 ); - $mf = unserialize( file_get_contents( $cachefile ) ); - return $mf; - } - } - - $data = get_url ( $bookmark['url'] ); - $test = json_decode ( $data, true ); - - // content is json - if ( false !== $test && null !== $test ) { - debug ( "content is JSON", 7); - $mf = $test; - } - else { - debug ( "content is HTML", 7); - $mf = \Mf2\parse( $data ); - } - - file_put_contents( $cachefile, serialize( $mf ) ); - touch( $cachefile, time() ); - return $mf; -} - -/*** - * Microformats2 parser version - * - * @param object $bookmark - * @param object $owner - * - */ -function process_mf2 ( $bookmark ) { - - $last_updated_ = $last_updated = $bookmark['updated']; - $mf = fetch_mf2( $bookmark ); - - $mfitems = $items = array (); - if ( empty( $mf ) || ! is_array( $mf) ) { - debug ( "parsing {$bookmark['url']} as MF2 failed", 4 ); - return $last_updated_; - } - - $config = get_from(); - - foreach ($mf['items'] as $i ) { - - if ( in_array( 'h-feed', $i['type']) && !empty($i['children'])) { - $mfitems = array_merge( $mfitems, $i['children'] ); - } - elseif ( in_array( 'h-entry', $i['type']) ) { - $mfitems[] = $i; - } - } - - foreach ($mfitems as $entry ) { - // double-check h-entries - if ( in_array( 'h-entry', $entry['type']) ) { - - $properties = $entry['properties']; - $title = $bookmark['url']; - - if (isset($properties['name'][0]) && !empty($properties['name'][0])) - $title = $properties['name'][0]; - - elseif(isset($properties['author'][0]['properties']['name'][0]) && !empty($properties['author'][0]['properties']['name'][0]) ) - $title = $properties['author'][0]['properties']['name'][0]; - - if (isset($properties['uid'][0]) && !empty($properties['uid'][0])) - $title .= ' (' . $properties['uid'][0] . ')'; - - $url = $properties['url'][0]; - - if ( isset($properties['updated']) && !empty($properties['updated']) ) - $date = $properties['updated'][0]; - else - $date = $properties['published'][0]; - - $time = strtotime( $date ); - - if ( isset($properties['content'][0]['html']) && !empty($properties['content'][0]['html']) ) - $content = $properties['content'][0]['html']; - elseif ( isset($properties['summary'][0]['html']) && !empty($properties['summary'][0]['html'])) - $content = $properties['summary'][0]['html'] . '<h2><a href="'.$url.'">Read the full article »»</a></h2>'; - else - $content = '<h1><a href="'.$url.'">'.$title.'</a></h1>'; - - if ( isset($properties['photo'][0]) && !empty($properties['photo'][0] ) && !stristr($content, $properties['photo'][0]) ) - $content .= '<p><img src="'.$properties['photo'][0].'" /></p>'; - - if ( isset($properties['video'][0]) && !empty($properties['video'][0] ) && !stristr($content, $properties['video'][0]) ) - $content .= '<p><video><source src="'.$properties['video'][0].'" /></video></p>'; - - $item = array ( - 'url' => $url, - 'content' => $content, - 'title' => $title, - ); - - $items[ $time ] = $item; - } - } - - if ( empty( $items ) ) - return false; - - if ( isset( $config[ $bookmark['email'] ] ) ) - $frommail = $config[ $bookmark['email'] ]; - else - $frommail = defaultfrom; - - $fromname = $bookmark['url']; - - foreach ( $items as $time => $item ) { - if ( $time > $last_updated ) { - if ( send ( - $bookmark['email'], - $item['url'], - $item['title'], - $fromname, - $frommail, - $item['url'], - $item['content'], - $time - )) { - if ( $time > $last_updated_ ) - $last_updated_ = $time; - } - } - } - - return $last_updated_; - -} - - -/** - * - */ -function process_rss( $bookmark ) { - - $url = $bookmark['url']; - $last_updated_ = $last_updated = $bookmark['updated']; - - $feed = new \SimplePie(); - $feed->set_feed_url( $url ); - $feed->set_cache_duration ( revisit_time - 10 ); - $feed->set_cache_location( cachedir ); - $feed->force_feed(true); - - // optimization - $feed->enable_order_by_date(true); - $feed->remove_div(true); - $feed->strip_comments(true); - $feed->strip_htmltags(false); - $feed->strip_attributes(true); - $feed->set_image_handler(false); - - $feed->set_output_encoding('UTF-8'); - - $feed->init(); - $feed->handle_content_type(); - - if ( $feed->error() ) { - //if ( preg_match( '/invalid XML/i', $feed->error() )) - // try mf2; - - return date( 'U', time() ); - } - - // set max items to 12 - // especially useful with first runs - $maxitems = $feed->get_item_quantity( 12 ); - $feed_items = $feed->get_items( 0, $maxitems ); - - //if ( 0 == $feed_items ) - // debug( "{$url} is empty, try mf2!" ); - - $f_author = $feed->get_author(); - - if ( $maxitems <= 0 ) - return date( 'U', time() ); - - $config = get_from(); - - foreach ( $feed_items as $item ) { - $i_date = $item->get_date( 'U' ); - $i_url = $item->get_link(); - $i_title = $item->get_title(); - - if ( $i_date <= $last_updated ) { - debug ( "skipping {$i_url}; already processed", 7 ); - continue; - } - - $i_content = $item->get_content(); - if ( empty( $i_content ) ) { - debug ( "skipping {$i_url}; empty content", 6 ); - continue; - } - - $i_author = $item->get_author(); - - if ($i_author) - $fromname = $feed->get_title() . ': ' . $i_author->get_name(); - elseif ( $f_author ) - $fromname = $feed->get_title() . ': ' . $f_author->get_name(); - - if ( isset( $config[ $bookmark['email'] ] ) ) - $frommail = $config[ $bookmark['email'] ]; - else - $frommail = defaultfrom; - - send( - $bookmark['email'], - $i_url, - $i_title, - $fromname, - $frommail, - $url, - $i_content, - $i_date - ); - - if ( $i_date > $last_updated_ ) - $last_updated_ = $i_date; - } - - return $last_updated_; - -} - -/** - * - */ -function get_bookmarks( $bookmarksfile = bookmarks ) { - $bookmarks = []; - if (($handle = fopen( $bookmarksfile, "r" )) !== FALSE) { - while (($data = fgetcsv($handle, 1000, " ")) !== FALSE) { - $e = [ - 'email' => $data[0], - 'type' => $data[1], - 'url' => htmlspecialchars_decode( $data[2] ), - 'updated' => strtotime( $data[3] ), - ]; - array_push( $bookmarks, $e ); - } - fclose($handle); - } - - return $bookmarks; -} - -/** - * - */ -function update_bookmarks( $bookmarks, $bookmarksfile = bookmarks ) { - - foreach ( $bookmarks as $i => $e ) { - $e['updated'] = date('c', $e['updated'] ); - $bookmarks[ $i ] = join( " ", $e ); - } - $bookmarks = join ( "\n", $bookmarks ); - file_put_contents ( $bookmarksfile, $bookmarks ); - debug("Bookmarks file updated", 6); -} - -/** - * - */ -function get_from( $fromfile = fromfile ) { - $config = []; - if (($handle = fopen( $fromfile, "r" )) !== FALSE) { - while (($data = fgetcsv($handle, 1000, " ")) !== FALSE) { - if ( isset( $data[1] ) && !empty( $data[1] ) ) - $config [ $data[0] ] = $data[1]; - } - fclose($handle); - } - - return $config; -} - -/** - * - */ -function send ( $to, $link, $title, $fromname, $frommail, $sourceurl, $content, $time ) { - - // build a more readable body - $body = '<html> - <head></head> - <h1> - <a href="'. $link .'">'. $title .'</a> - </h1> - <body>' - . $content - . '<p>URL: - <a href="'.$link.'">'.$link.'</a> - </p> - </body> - </html>'; - - $mail = new \PHPMailer; - $mail->CharSet = "UTF-8"; - $mail->setFrom( $frommail, $fromname ); - $mail->isHTML(true); - $mail->addAddress( $to ); - - $mail->addCustomHeader('X-RSS-ID', $link ); - $mail->addCustomHeader('X-RSS-URL', $link ); - $mail->addCustomHeader('X-RSS-Feed', $sourceurl ); - $mail->addCustomHeader('User-Agent', __NAMESPACE__ ); - $mail->addCustomHeader('Date', date( 'r', $time ) ); - - $mail->Subject = $title; - $mail->Body = $body; - - debug ( "Sending {$link} to {$to}", 5 ); - - if(!$mail->send()) { - debug( 'Message could not be sent: ' . $mail->ErrorInfo, 4 ); - return false; - } - - return true; - -} - -/** - * - */ -function get_url( $url ){ - /* - $ch = curl_init(); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_URL, $url ); - $data = curl_exec($ch); - if ( empty( $data ) ) - die( curl_error($ch) . curl_errno($ch)); - curl_close($ch); - * return $data; - */ - return file_get_contents( $url ); - -} - -// --- -main();
@@ -1,2 +0,0 @@
-to@mail.address rss http://example.com/feed 1970-01-01T00:00:00+00:00 -to@mail.address mf2 http://example.com/feed 1970-01-01T00:00:00+00:00
@@ -4,4 +4,4 @@ // autoload.php @generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit8651d460cf5b16821824c9298a9a110e::getLoader(); +return ComposerAutoloaderInit948650bb27ddef968d09c0cba5384a3c::getLoader();
@@ -6,12 +6,4 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir); return array( - 'EasyPeasyICS' => $vendorDir . '/phpmailer/phpmailer/extras/EasyPeasyICS.php', - 'PHPMailer' => $vendorDir . '/phpmailer/phpmailer/class.phpmailer.php', - 'PHPMailerOAuth' => $vendorDir . '/phpmailer/phpmailer/class.phpmaileroauth.php', - 'PHPMailerOAuthGoogle' => $vendorDir . '/phpmailer/phpmailer/class.phpmaileroauthgoogle.php', - 'POP3' => $vendorDir . '/phpmailer/phpmailer/class.pop3.php', - 'SMTP' => $vendorDir . '/phpmailer/phpmailer/class.smtp.php', - 'ntlm_sasl_client_class' => $vendorDir . '/phpmailer/phpmailer/extras/ntlm_sasl_client.php', - 'phpmailerException' => $vendorDir . '/phpmailer/phpmailer/class.phpmailer.php', );
@@ -6,5 +6,4 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir); return array( - 'SimplePie' => array($vendorDir . '/simplepie/simplepie/library'), );
@@ -2,7 +2,7 @@ <?php
// autoload_real.php @generated by Composer -class ComposerAutoloaderInit8651d460cf5b16821824c9298a9a110e +class ComposerAutoloaderInit948650bb27ddef968d09c0cba5384a3c { private static $loader;@@ -19,48 +19,37 @@ if (null !== self::$loader) {
return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit8651d460cf5b16821824c9298a9a110e', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit948650bb27ddef968d09c0cba5384a3c', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit8651d460cf5b16821824c9298a9a110e', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit948650bb27ddef968d09c0cba5384a3c', 'loadClassLoader')); - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION'); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } - call_user_func(\Composer\Autoload\ComposerStaticInit8651d460cf5b16821824c9298a9a110e::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); } $loader->register(true); - if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit8651d460cf5b16821824c9298a9a110e::$files; - } else { - $includeFiles = require __DIR__ . '/autoload_files.php'; - } + $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire8651d460cf5b16821824c9298a9a110e($fileIdentifier, $file); + composerRequire948650bb27ddef968d09c0cba5384a3c($fileIdentifier, $file); } return $loader; } } -function composerRequire8651d460cf5b16821824c9298a9a110e($fileIdentifier, $file) +function composerRequire948650bb27ddef968d09c0cba5384a3c($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file;
@@ -1,42 +0,0 @@
-<?php - -// autoload_static.php @generated by Composer - -namespace Composer\Autoload; - -class ComposerStaticInit8651d460cf5b16821824c9298a9a110e -{ - public static $files = array ( - '757772e28a0943a9afe83def8db95bdf' => __DIR__ . '/..' . '/mf2/mf2/Mf2/Parser.php', - ); - - public static $prefixesPsr0 = array ( - 'S' => - array ( - 'SimplePie' => - array ( - 0 => __DIR__ . '/..' . '/simplepie/simplepie/library', - ), - ), - ); - - public static $classMap = array ( - 'EasyPeasyICS' => __DIR__ . '/..' . '/phpmailer/phpmailer/extras/EasyPeasyICS.php', - 'PHPMailer' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmailer.php', - 'PHPMailerOAuth' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmaileroauth.php', - 'PHPMailerOAuthGoogle' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmaileroauthgoogle.php', - 'POP3' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.pop3.php', - 'SMTP' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.smtp.php', - 'ntlm_sasl_client_class' => __DIR__ . '/..' . '/phpmailer/phpmailer/extras/ntlm_sasl_client.php', - 'phpmailerException' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmailer.php', - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixesPsr0 = ComposerStaticInit8651d460cf5b16821824c9298a9a110e::$prefixesPsr0; - $loader->classMap = ComposerStaticInit8651d460cf5b16821824c9298a9a110e::$classMap; - - }, null, ClassLoader::class); - } -}
@@ -1,21 +1,21 @@
[ { "name": "mf2/mf2", - "version": "v0.3.0", - "version_normalized": "0.3.0.0", + "version": "v0.2.12", + "version_normalized": "0.2.12.0", "source": { "type": "git", "url": "https://github.com/indieweb/php-mf2.git", - "reference": "4fb2eb5365cbc0fd2e0c26ca748777d6c2539763" + "reference": "6701504876d6c9242eb310b35f41d40d9785ab4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/indieweb/php-mf2/zipball/4fb2eb5365cbc0fd2e0c26ca748777d6c2539763", - "reference": "4fb2eb5365cbc0fd2e0c26ca748777d6c2539763", + "url": "https://api.github.com/repos/indieweb/php-mf2/zipball/6701504876d6c9242eb310b35f41d40d9785ab4e", + "reference": "6701504876d6c9242eb310b35f41d40d9785ab4e", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=5.3.0" }, "require-dev": { "phpunit/phpunit": "3.7.*"@@ -23,7 +23,7 @@ },
"suggest": { "barnabywalters/mf-cleaner": "To more easily handle the canonical data php-mf2 gives you" }, - "time": "2016-03-14 12:13:34", + "time": "2015-07-12 14:10:01", "bin": [ "bin/fetch-mf2", "bin/parse-mf2"@@ -37,7 +37,7 @@ ]
}, "notification-url": "https://packagist.org/downloads/", "license": [ - "CC0" + "MIT" ], "authors": [ {@@ -52,124 +52,6 @@ "microformats",
"microformats 2", "parser", "semantic" - ] - }, - { - "name": "phpmailer/phpmailer", - "version": "v5.2.16", - "version_normalized": "5.2.16.0", - "source": { - "type": "git", - "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a", - "reference": "1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a", - "shasum": "" - }, - "require": { - "php": ">=5.0.0" - }, - "require-dev": { - "phpdocumentor/phpdocumentor": "*", - "phpunit/phpunit": "4.7.*" - }, - "suggest": { - "league/oauth2-google": "Needed for Google XOAUTH2 authentication" - }, - "time": "2016-06-06 09:09:37", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "class.phpmailer.php", - "class.phpmaileroauth.php", - "class.phpmaileroauthgoogle.php", - "class.smtp.php", - "class.pop3.php", - "extras/EasyPeasyICS.php", - "extras/ntlm_sasl_client.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1" - ], - "authors": [ - { - "name": "Jim Jagielski", - "email": "jimjag@gmail.com" - }, - { - "name": "Marcus Bointon", - "email": "phpmailer@synchromedia.co.uk" - }, - { - "name": "Andy Prevost", - "email": "codeworxtech@users.sourceforge.net" - }, - { - "name": "Brent R. Matzelle" - } - ], - "description": "PHPMailer is a full-featured email creation and transfer class for PHP" - }, - { - "name": "simplepie/simplepie", - "version": "1.4.2", - "version_normalized": "1.4.2.0", - "source": { - "type": "git", - "url": "https://github.com/simplepie/simplepie.git", - "reference": "9b775e88ba1128fa14c69ff94ab954d86067de2a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/simplepie/simplepie/zipball/9b775e88ba1128fa14c69ff94ab954d86067de2a", - "reference": "9b775e88ba1128fa14c69ff94ab954d86067de2a", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2016-06-14 05:48:16", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "SimplePie": "library" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Ryan Parman", - "homepage": "http://ryanparman.com/", - "role": "Creator, alumnus developer" - }, - { - "name": "Geoffrey Sneddon", - "homepage": "http://gsnedders.com/", - "role": "Alumnus developer" - }, - { - "name": "Ryan McCue", - "email": "me@ryanmccue.info", - "homepage": "http://ryanmccue.info/", - "role": "Developer" - } - ], - "description": "A simple Atom/RSS parsing library for PHP", - "homepage": "http://simplepie.org/", - "keywords": [ - "atom", - "feeds", - "rss" ] } ]
@@ -1,7 +0,0 @@
-language: php -php: - - 5.4 - - 5.5 - - 5.6 - - nightly -before_script: composer install
@@ -1,36 +0,0 @@
-# Creative Commons Legal Code - -## CC0 1.0 Universal - -http://creativecommons.org/publicdomain/zero/1.0 - -Official translations of this legal tool are available> CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER. - -### _Statement of Purpose_ - -The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. - -**1. Copyright and Related Rights.** A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: - -1. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; -2. moral rights retained by the original author(s) and/or performer(s); -3. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; -4. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; -5. rights protecting the extraction, dissemination, use and reuse of data in a Work; -6. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and -7. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. - -**2. Waiver.** To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. - -**3. Public License Fallback.** Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. - -**4. Limitations and Disclaimers.** - -1. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. -2. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. -3. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. -4. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
@@ -78,9 +78,6 @@ // The content was not delivered as HTML, do not attempt to parse it.
return null; } - # ensure the final URL is used to resolve relative URLs - $url = $info['url']; - return parse($html, $url, $convertClassic); }@@ -234,19 +231,6 @@ }
} } -function applySrcsetUrlTransformation($srcset, $transformation) { - return implode(', ', array_filter(array_map(function ($srcsetPart) use ($transformation) { - $parts = explode(" \t\n\r\0\x0B", trim($srcsetPart), 2); - $parts[0] = rtrim($parts[0]); - - if (empty($parts[0])) { return false; } - - $parts[0] = call_user_func($transformation, $parts[0]); - - return $parts[0] . (empty($parts[1]) ? '' : ' ' . $parts[1]); - }, explode(',', trim($srcset))))); -} - /** * Microformats2 Parser *@@ -352,20 +336,12 @@ if ($child->hasAttribute('href'))
$child->setAttribute('href', $this->resolveUrl($child->getAttribute('href'))); if ($child->hasAttribute('src')) $child->setAttribute('src', $this->resolveUrl($child->getAttribute('src'))); - if ($child->hasAttribute('srcset')) - $child->setAttribute('srcset', applySrcsetUrlTransformation($child->getAttribute('href'), [$this, 'resolveUrl'])); if ($child->hasAttribute('data')) $child->setAttribute('data', $this->resolveUrl($child->getAttribute('data'))); } } public function textContent(DOMElement $el) { - $excludeTags = array('noframe', 'noscript', 'script', 'style', 'frames', 'frameset'); - - if (isset($el->tagName) and in_array(strtolower($el->tagName), $excludeTags)) { - return ''; - } - $this->resolveChildUrls($el); $clonedEl = $el->cloneNode(true);@@ -374,93 +350,16 @@ foreach ($this->xpath->query('.//img', $clonedEl) as $imgEl) {
$newNode = $this->doc->createTextNode($imgEl->getAttribute($imgEl->hasAttribute('alt') ? 'alt' : 'src')); $imgEl->parentNode->replaceChild($newNode, $imgEl); } - - foreach ($excludeTags as $tagName) { - foreach ($this->xpath->query(".//{$tagName}", $clonedEl) as $elToRemove) { - $elToRemove->parentNode->removeChild($elToRemove); - } - } - return $this->innerText($clonedEl); - } - - /** - * This method attempts to return a better 'innerText' representation than DOMNode::textContent - * - * @param DOMElement|DOMText $el - * @param bool $implied when parsing for implied name for h-*, rules may be slightly different - * @see: https://github.com/glennjones/microformat-shiv/blob/dev/lib/text.js - */ - public function innerText($el, $implied=false) { - $out = ''; - - $blockLevelTags = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'hr', 'pre', 'table', - 'address', 'article', 'aside', 'blockquote', 'caption', 'col', 'colgroup', 'dd', 'div', - 'dt', 'dir', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'header', 'hgroup', 'hr', - 'li', 'map', 'menu', 'nav', 'optgroup', 'option', 'section', 'tbody', 'testarea', - 'tfoot', 'th', 'thead', 'tr', 'td', 'ul', 'ol', 'dl', 'details'); - - $excludeTags = array('noframe', 'noscript', 'script', 'style', 'frames', 'frameset'); - - // PHP DOMDocument doesn’t correctly handle whitespace around elements it doesn’t recognise. - $unsupportedTags = array('data'); - - if (isset($el->tagName)) { - if (in_array(strtolower($el->tagName), $excludeTags)) { - return $out; - } else if ($el->tagName == 'img') { - if ($el->getAttribute('alt') !== '') { - return $el->getAttribute('alt'); - } else if (!$implied && $el->getAttribute('src') !== '') { - return $this->resolveUrl($el->getAttribute('src')); - } - } else if ($el->tagName == 'area' and $el->getAttribute('alt') !== '') { - return $el->getAttribute('alt'); - } else if ($el->tagName == 'abbr' and $el->getAttribute('title') !== '') { - return $el->getAttribute('title'); - } - } - - // if node is a text node get its text - if (isset($el->nodeType) && $el->nodeType === 3) { - $out .= $el->textContent; - } - - // get the text of the child nodes - if ($el->childNodes && $el->childNodes->length > 0) { - for ($j = 0; $j < $el->childNodes->length; $j++) { - $text = $this->innerText($el->childNodes->item($j), $implied); - if (!is_null($text)) { - $out .= $text; - } - } - } - - if (isset($el->tagName)) { - // if its a block level tag add an additional space at the end - if (in_array(strtolower($el->tagName), $blockLevelTags)) { - $out .= ' '; - } elseif ($implied and in_array(strtolower($el->tagName), $unsupportedTags)) { - $out .= ' '; - } else if (strtolower($el->tagName) == 'br') { - // else if its a br, replace with newline - $out .= "\n"; - } - } - - return ($out === '') ? NULL : $out; + return $clonedEl->textContent; } // TODO: figure out if this has problems with sms: and geo: URLs public function resolveUrl($url) { // If the URL is seriously malformed it’s probably beyond the scope of this // parser to try to do anything with it. - if (parse_url($url) === false) { + if (parse_url($url) === false) return $url; - } - - // per issue #40 valid URLs could have a space on either side - $url = trim($url); $scheme = parse_url($url, PHP_URL_SCHEME);@@ -511,7 +410,7 @@ return null;
} /** - * Given an element with class="p-*", get its value + * Given an element with class="p-*", get it’s value * * @param DOMElement $p The element to parse * @return string The plaintext value of $p, dependant on type@@ -520,12 +419,9 @@ */
public function parseP(\DOMElement $p) { $classTitle = $this->parseValueClassTitle($p, ' '); - if ($classTitle !== null) { + if ($classTitle !== null) return $classTitle; - } - $this->resolveChildUrls($p); - if ($p->tagName == 'img' and $p->getAttribute('alt') !== '') { $pValue = $p->getAttribute('alt'); } elseif ($p->tagName == 'area' and $p->getAttribute('alt') !== '') {@@ -535,7 +431,7 @@ $pValue = $p->getAttribute('title');
} elseif (in_array($p->tagName, array('data', 'input')) and $p->getAttribute('value') !== '') { $pValue = $p->getAttribute('value'); } else { - $pValue = unicodeTrim($this->innerText($p)); + $pValue = unicodeTrim($this->textContent($p)); } return $pValue;@@ -678,7 +574,7 @@ $value = $dt->getAttribute('value');
if (!empty($value)) $dtValue = $value; else - $dtValue = $this->textContent($dt); + $dtValue = $dt->nodeValue; } elseif ($dt->tagName == 'abbr') { // Use @title, otherwise innertext // Is it an entire dt?@@ -686,7 +582,7 @@ $title = $dt->getAttribute('title');
if (!empty($title)) $dtValue = $title; else - $dtValue = $this->textContent($dt); + $dtValue = $dt->nodeValue; } elseif ($dt->tagName == 'del' or $dt->tagName == 'ins' or $dt->tagName == 'time') { // Use @datetime if available, otherwise innertext // Is it an entire dt?@@ -694,9 +590,9 @@ $dtAttr = $dt->getAttribute('datetime');
if (!empty($dtAttr)) $dtValue = $dtAttr; else - $dtValue = $this->textContent($dt); + $dtValue = $dt->nodeValue; } else { - $dtValue = $this->textContent($dt); + $dtValue = $dt->nodeValue; } if (preg_match('/(\d{4}-\d{2}-\d{2})/', $dtValue, $matches)) {@@ -741,14 +637,8 @@ }
return array( 'html' => $html, - 'value' => unicodeTrim($this->innerText($e)) + 'value' => unicodeTrim($this->textContent($e)) ); - } - - private function removeTags(\DOMElement &$e, $tagName) { - while(($r = $e->getElementsByTagName($tagName)) && $r->length) { - $r->item(0)->parentNode->removeChild($r->item(0)); - } } /**@@ -798,7 +688,7 @@ $eParsedResult = $this->parseE($subMF);
$prefixSpecificResult['html'] = $eParsedResult['html']; $prefixSpecificResult['value'] = $eParsedResult['value']; } elseif (in_array('u-', $prefixes)) { - $prefixSpecificResult['value'] = (empty($result['properties']['url'])) ? $this->parseU($subMF) : reset($result['properties']['url']); + $prefixSpecificResult['value'] = $this->parseU($subMF); } $return[$property][] = $prefixSpecificResult; }@@ -916,6 +806,7 @@ throw new Exception($em->getAttribute('alt'));
} } + // Look for double nested img @alt foreach ($this->xpath->query('./*[count(preceding-sibling::*)+count(following-sibling::*)=0]/img[count(preceding-sibling::*)+count(following-sibling::*)=0]', $e) as $em) { $emNames = mfNamesFromElement($em, 'h-');@@ -932,7 +823,7 @@ throw new Exception($em->getAttribute('alt'));
} } - throw new Exception($this->innerText($e, true)); + throw new Exception($e->nodeValue); } catch (Exception $exc) { $return['name'][] = unicodeTrim($exc->getMessage()); }@@ -1272,7 +1163,7 @@ 'dtstart' => 'dt-start',
'dtend' => 'dt-end', 'duration' => 'dt-duration', 'description' => 'p-description', - 'summary' => 'p-name', + 'summary' => 'p-summary', 'description' => 'p-description', 'url' => 'u-url', 'category' => 'p-category',@@ -1429,7 +1320,7 @@
# 5.2.3 Merge Paths function mergePaths($base, $reference) { # If the base URI has a defined authority component and an empty - # path, + # path, if($base['authority'] && $base['path'] == null) { # then return a string consisting of "/" concatenated with the # reference's path; otherwise,@@ -1437,13 +1328,13 @@ $merged = '/' . $reference['path'];
} else { if(($pos=strrpos($base['path'], '/')) !== false) { # return a string consisting of the reference's path component - # appended to all but the last segment of the base URI's path (i.e., - # excluding any characters after the right-most "/" in the base URI - # path, + # appended to all but the last segment of the base URI's path (i.e., + # excluding any characters after the right-most "/" in the base URI + # path, $merged = substr($base['path'], 0, $pos + 1) . $reference['path']; } else { - # or excluding the entire base URI path if it does not contain - # any "/" characters). + # or excluding the entire base URI path if it does not contain + # any "/" characters). $merged = $base['path']; } }
@@ -1,6 +1,5 @@
-# php-mf2 - -[](http://travis-ci.org/indieweb/php-mf2) +php-mf2 +======= php-mf2 is a pure, generic [microformats-2](http://microformats.org/wiki/microformats-2) parser. It makes HTML as easy to consume as JSON.@@ -10,7 +9,7 @@ ## Installation
There are two ways of installing php-mf2. I **highly recommend** installing php-mf2 using [Composer](http://getcomposer.org). The rest of the documentation assumes that you have done so. -To install using Composer, run `./composer.phar require mf2/mf2:~0.3` +To install using Composer, run `./composer.phar require mf2/mf2:~0.2` If you can’t or don’t want to use Composer, then php-mf2 can be installed the old way by downloading [`/Mf2/Parser.php`](https://raw.githubusercontent.com/indieweb/php-mf2/master/Mf2/Parser.php), adding it to your project and requiring it from files you want to call its functions from, like this:@@ -280,36 +279,11 @@ Currently php-mf2 passes the majority of it’s own test case, and a good percentage of the cross-platform tests. Contributors should ALWAYS test against the PHPUnit suite to ensure any changes don’t negatively impact php-mf2, and SHOULD run the cross-platform suite, especially if you’re changing parsing behaviour.
### Changelog -#### v0.3.0 - -2016-03-14 - -* Requires PHP 5.4 at minimum (PHP 5.3 is EOL) -* Licensed under CC0 rather than MIT -* Merges Pull requests #70, #73, #74, #75, #77, #80, #82, #83, #85 and #86. -* Variety of small bug fixes and features including improved whitespace support, removal of style and script contents from plaintext properties -* All PHPUnit tests passing finally - -Many thanks to @aaronpk, @diplix, @dissolve, @dymcx @gRegorLove, @jeena, @veganstraightedge and @voxpelli for all your hard work opening issues and sending and merging PRs! - -#### v0.2.12 - -2015-07-12 - -* Merges pull requests [#65](https://github.com/indieweb/php-mf2/pull/65), [#66](https://github.com/indieweb/php-mf2/pull/66) and [#67](https://github.com/indieweb/php-mf2/pull/67). -* Fixes issue [#64](https://github.com/indieweb/php-mf2/issues/64). - -Many thanks to @aaronpk, @gRegorLove and @kylewm for contributions, @aaronpk and @kevinmarks for PR management and @tantek for issue reporting! - -#### v0.2.11 - -2015-07-10 - #### v0.2.10 2015-04-29 -* Merged [#58](https://github.com/indieweb/php-mf2/pull/58), fixing some parsing bugs and adding support for area element parsing. Thanks so much for your hard work and patience, <a class="h-card" href="http://ben.thatmustbe.me/">Ben</a>! +* Merged #58, fixing some parsing bugs and adding support for area element parsing. Thanks so much for your hard work and patience, <a class="h-card" href="http://ben.thatmustbe.me/">Ben</a>! #### v0.2.9@@ -425,10 +399,3 @@ #### v0.1.15
* Added html-safe options * Added rel+rel-alternate parsing - - -## License - -php-mf2 is dedicated to the public domain using Creative Commons -- CC0 1.0 Universal. - -http://creativecommons.org/publicdomain/zero/1.0
@@ -4,23 +4,23 @@ "type": "library",
"description": "A pure, generic microformats2 parser — makes HTML as easy to consume as a JSON API", "keywords": ["microformats", "microformats 2", "parser", "semantic", "html"], "authors" : [ - { - "name": "Barnaby Walters", - "homepage": "http://waterpigs.co.uk" - } + { + "name": "Barnaby Walters", + "homepage": "http://waterpigs.co.uk" + } ], "bin": ["bin/fetch-mf2", "bin/parse-mf2"], "require": { - "php": ">=5.4.0" + "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "3.7.*" + "phpunit/phpunit": "3.7.*" }, "autoload": { - "files": ["Mf2/Parser.php"] + "files": ["Mf2/Parser.php"] }, - "license": "CC0", - "suggest": { - "barnabywalters/mf-cleaner": "To more easily handle the canonical data php-mf2 gives you" - } -} + "license": "MIT", + "suggest": { + "barnabywalters/mf-cleaner": "To more easily handle the canonical data php-mf2 gives you" + } +}
@@ -128,47 +128,4 @@
$result = Mf2\parse($input, 'http://www.staples.com/Swingline-747-Rio-Red-Stapler-20-Sheet-Capacity/product_562485'); $this->assertCount(4, $result['items']); } - - /** - * @see https://github.com/indieweb/php-mf2/issues/81 - */ - public function test_vevent() { - $input = <<< EOT -<div class="vevent"> -<h3 class="summary">XYZ Project Review</h3> -<p class="description">Project XYZ Review Meeting</p> -<p> <a class="url" href="http://example.com/xyz-meeting">http://example.com/xyz-meeting</a> </p> -<p>To be held on - <span class="dtstart"> - <abbr class="value" title="1998-03-12">the 12th of March</abbr> - from <span class="value">8:30am</span> <abbr class="value" title="-0500">EST</abbr> - </span> until - <span class="dtend"> - <span class="value">9:30am</span> <abbr class="value" title="-0500">EST</abbr> - </span> -</p> -<p>Location: <span class="location">1CP Conference Room 4350</span></p> -<small>Booked by: <span class="uid">guid-1.host1.com</span> on - <span class="dtstamp"> - <abbr class="value" title="1998-03-09">the 9th</abbr> at <span class="value">6:00pm</span> - </span> -</small> -</div> -EOT; - $parser = new Parser($input); - $output = $parser->parse(); - - $this->assertArrayHasKey('name', $output['items'][0]['properties']); - $this->assertArrayHasKey('description', $output['items'][0]['properties']); - $this->assertArrayHasKey('url', $output['items'][0]['properties']); - $this->assertArrayHasKey('start', $output['items'][0]['properties']); - $this->assertArrayHasKey('end', $output['items'][0]['properties']); - - $this->assertEquals('XYZ Project Review', $output['items'][0]['properties']['name'][0]); - $this->assertEquals('Project XYZ Review Meeting', $output['items'][0]['properties']['description'][0]); - $this->assertEquals('http://example.com/xyz-meeting', $output['items'][0]['properties']['url'][0]); - $this->assertEquals('1998-03-12T08:30', $output['items'][0]['properties']['start'][0]); - $this->assertEquals('1998-03-12T09:30', $output['items'][0]['properties']['end'][0]); - } - }
@@ -242,56 +242,6 @@ $mf = Mf2\parse($input);
$this->assertEquals($mf['items'][0]['properties']['url'][0]['value'], 'This should be the value'); } - - public function testMicroformatsNestedUnderUPropertyClassnamesDeriveValueFromURL() { - $input = '<div class="h-entry"> - <h1 class="p-name">Name</h1> - <p class="e-content">Hello World</p> - <ul> - <li class="u-comment h-cite"> - <a class="u-author h-card" href="http://jane.example.com/">Jane Bloggs</a> - <p class="p-content p-name">lol</p> - <a class="u-url" href="http://example.org/post1234"><time class="dt-published">2015-07-12 12:03</time></a> - </li> - </ul> - </div>'; - $expected = '{ - "items": [{ - "type": ["h-entry"], - "properties": { - "name": ["Name"], - "content": [{ - "html": "Hello World", - "value": "Hello World" - }], - "comment": [{ - "type": ["h-cite"], - "properties": { - "author": [{ - "type": ["h-card"], - "properties": { - "name": ["Jane Bloggs"], - "url": ["http:\/\/jane.example.com\/"] - }, - "value": "http:\/\/jane.example.com\/" - }], - "content": ["lol"], - "name": ["lol"], - "url": ["http:\/\/example.org\/post1234"], - "published": ["2015-07-12 12:03"] - }, - "value": "http:\/\/example.org\/post1234" - }] - } - }], - "rels":[] - }'; - $mf = Mf2\parse($input); - - $this->assertJsonStringEqualsJsonString(json_encode($mf), $expected); - $this->assertEquals($mf['items'][0]['properties']['comment'][0]['value'], 'http://example.org/post1234'); - $this->assertEquals($mf['items'][0]['properties']['comment'][0]['properties']['author'][0]['value'], 'http://jane.example.com/'); - } public function testMicroformatsNestedUnderPPropertyClassnamesDeriveValueFromFirstPName() { $input = '<div class="h-entry"><div class="p-author h-card">This post was written by <span class="p-name">Zoe</span>.</div></div>';
@@ -102,17 +102,4 @@ $this->assertEquals('The day I saw a five legged elephant', $result['items'][0]['properties']['name'][0]);
$this->assertEquals('Blah blah http://waterpigs.co.uk/photos/five-legged-elephant.jpg', $result['items'][0]['properties']['summary'][0]); } - /** - * @see https://github.com/indieweb/php-mf2/issues/69 - */ - public function testBrWhitespaceIssue69() { - $input = '<div class="h-card"><p class="p-adr"><span class="p-street-address">Street Name 9</span><br/><span class="p-locality">12345 NY, USA</span></p></div>'; - $result = Mf2\parse($input); - - $this->assertEquals('Street Name 9' . "\n" . '12345 NY, USA', $result['items'][0]['properties']['adr'][0]); - $this->assertEquals('Street Name 9', $result['items'][0]['properties']['street-address'][0]); - $this->assertEquals('12345 NY, USA', $result['items'][0]['properties']['locality'][0]); - $this->assertEquals('Street Name 9' . "\n" . '12345 NY, USA', $result['items'][0]['properties']['name'][0]); - } - }
@@ -175,17 +175,4 @@ $this->assertEquals('http://example.com/video.mp4', $output['items'][0]['properties']['video'][0]);
$this->assertEquals('http://example.com/video.ogg', $output['items'][0]['properties']['video'][1]); } - /** - * @group parseU - */ - public function testParseUWithSpaces() { - $input = '<div class="h-card"><a class="u-url" href=" http://example.com ">Awesome example website</a></div>'; - $parser = new Parser($input); - $output = $parser->parse(); - - $this->assertArrayHasKey('url', $output['items'][0]['properties']); - $this->assertEquals('http://example.com', $output['items'][0]['properties']['url'][0]); - } - - }
@@ -286,7 +286,7 @@
$parser = new Parser($input); $output = $parser->parse(); - $this->assertEquals('Person Bee', $output['items'][0]['properties']['name'][0]); + $this->assertEquals('', $output['items'][0]['properties']['name'][0]); $this->assertEquals('rect', $output['items'][0]['properties']['category'][0]['shape']); $this->assertEquals('100,100,120,120', $output['items'][0]['properties']['category'][0]['coords']); $this->assertEquals('Person Bee', $output['items'][0]['properties']['category'][0]['value']);@@ -313,103 +313,5 @@ $this->assertArrayHasKey('name', $output['items'][0]['properties']['category'][0]['properties']);
$this->assertEquals('Bob Smith', $output['items'][0]['properties']['category'][0]['properties']['name'][0]); $this->assertArrayHasKey('url', $output['items'][0]['properties']['category'][0]['properties']); $this->assertEquals('http://b.example.com/', $output['items'][0]['properties']['category'][0]['properties']['url'][0]); - } - - public function testApplyTransformationToSrcset() { - $transformation = function ($url) { - return 'https://example.com/' . ltrim($url, '/'); - }; - - // Example from https://developers.whatwg.org/edits.html#attr-img-srcset - $srcset = 'banner-HD.jpeg 2x, banner-phone.jpeg 100w, banner-phone-HD.jpeg 100w 2x'; - $result = Mf2\applySrcsetUrlTransformation($srcset, $transformation); - $this->assertEquals('https://example.com/banner-HD.jpeg 2x, https://example.com/banner-phone.jpeg 100w, https://example.com/banner-phone-HD.jpeg 100w 2x', $result); - } - - - /** - * @see https://github.com/indieweb/php-mf2/issues/84 - */ - public function testRelativeURLResolvedWithFinalURL() { - $mf = Mf2\fetch('http://aaron.pk/4Zn5'); - - $this->assertEquals('https://aaronparecki.com/2014/12/23/5/photo.jpeg', $mf['items'][0]['properties']['photo'][0]); - } - - public function testScriptTagContentsRemovedFromTextValue() { - $input = <<<EOT -<div class="h-entry"> - <div class="p-content"> - <b>Hello World</b> - <script>alert("hi");</script> - </div> -</div> -EOT; - - $parser = new Parser($input); - $output = $parser->parse(); - - $this->assertContains('h-entry', $output['items'][0]['type']); - $this->assertContains('Hello World', $output['items'][0]['properties']['content'][0]); - $this->assertNotContains('alert', $output['items'][0]['properties']['content'][0]); - } - - public function testScriptElementContentsRemovedFromAllPlaintextValues() { - $input = <<<EOT -<div class="h-entry"> - <span class="dt-published">contained<script>not contained</script><style>not contained</style></span> - <span class="u-url">contained<script>not contained</script><style>not contained</style></span> -</div> -EOT; - - $parser = new Parser($input); - $output = $parser->parse(); - - $this->assertNotContains('not contained', $output['items'][0]['properties']['published'][0]); - $this->assertNotContains('not contained', $output['items'][0]['properties']['url'][0]); - } - - public function testScriptTagContentsNotRemovedFromHTMLValue() { - $input = <<<EOT -<div class="h-entry"> - <div class="e-content"> - <b>Hello World</b> - <script>alert("hi");</script> - <style>body{ visibility: hidden; }</style> - <p> - <script>alert("hi");</script> - <style>body{ visibility: hidden; }</style> - </p> - </div> -</div> -EOT; - - $parser = new Parser($input); - $output = $parser->parse(); - - $this->assertContains('h-entry', $output['items'][0]['type']); - $this->assertContains('Hello World', $output['items'][0]['properties']['content'][0]['value']); - $this->assertContains('<b>Hello World</b>', $output['items'][0]['properties']['content'][0]['html']); - # The script and style tags should be removed from plaintext results but left in HTML results. - $this->assertContains('alert', $output['items'][0]['properties']['content'][0]['html']); - $this->assertNotContains('alert', $output['items'][0]['properties']['content'][0]['value']); - $this->assertContains('visibility', $output['items'][0]['properties']['content'][0]['html']); - $this->assertNotContains('visibility', $output['items'][0]['properties']['content'][0]['value']); - } - - public function testWhitespaceBetweenElements() { - $input = <<<EOT -<div class="h-entry"> - <data class="p-rsvp" value="yes">I'm attending</data> - <a class="u-in-reply-to" href="https://snarfed.org/2014-06-16_homebrew-website-club-at-quip">Homebrew Website Club at Quip</a> - <div class="p-content">Thanks for hosting!</div> -</div> -EOT; - - $parser = new Parser($input); - $output = $parser->parse(); - - $this->assertContains('h-entry', $output['items'][0]['type']); - $this->assertNotContains('attendingHomebrew', $output['items'][0]['properties']['name'][0]); } }
@@ -212,6 +212,9 @@
array('relative add host from base', 'http://www.example.com', 'server.php', 'http://www.example.com/server.php'), + array('relative add scheme host user from base', + 'http://user:@www.example.com', 'server.php', 'http://user:@www.example.com/server.php'), + array('relative add scheme host pass from base', 'http://:pass@www.example.com', 'server.php', 'http://:pass@www.example.com/server.php'),@@ -252,15 +255,6 @@ array('testAbsolutePathIncludesPortNumber',
'http://example.com:8080/index.html', '/photo.jpg', 'http://example.com:8080/photo.jpg') ); - - // PHP 5.4 and before returns a different result, but either are acceptable - if(PHP_MAJOR_VERSION <= 5 && PHP_MINOR_VERSION <= 4) { - $cases[] = array('relative add scheme host user from base', - 'http://user:@www.example.com', 'server.php', 'http://user@www.example.com/server.php'); - } else { - $cases[] = array('relative add scheme host user from base', - 'http://user:@www.example.com', 'server.php', 'http://user:@www.example.com/server.php'); - } // Test cases from RFC // http://tools.ietf.org/html/rfc3986#section-5.4
@@ -1,6 +0,0 @@
-docs/phpdoc/ -test/message.txt -test/testbootstrap.php -test/*.pem -build/ -vendor/
@@ -1,132 +0,0 @@
-build: - environment: - php: '5.6.0' - -before_commands: - - "composer install --prefer-source" - -tools: - external_code_coverage: - enabled: true - timeout: 300 - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - - php_code_coverage: - enabled: false - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - - php_code_sniffer: - enabled: true - config: - standard: PSR2 - sniffs: - generic: - files: - one_class_per_file_sniff: false - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - - # Copy/Paste Detector - php_cpd: - enabled: true - excluded_dirs: - - docs - - examples - - extras - - test - - vendor - - # PHP CS Fixer (http://http://cs.sensiolabs.org/). - php_cs_fixer: - enabled: true - config: - level: psr2 - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - - # Analyzes the size and structure of a PHP project. - php_loc: - enabled: true - excluded_dirs: - - docs - - examples - - extras - - test - - vendor - - # PHP Mess Detector (http://phpmd.org). - php_mess_detector: - enabled: true - config: - rulesets: - - codesize - - unusedcode - - naming - - design - naming_rules: - short_variable: { minimum: 2 } - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - - # Analyzes the size and structure of a PHP project. - php_pdepend: - enabled: true - excluded_dirs: - - docs - - examples - - extras - - test - - vendor - - # Runs Scrutinizer's PHP Analyzer Tool - # https://scrutinizer-ci.com/docs/tools/php/php-analyzer/config_reference - php_analyzer: - enabled: true - config: - checkstyle: - enabled: true - naming: - enabled: true - property_name: ^[_a-zA-Z][a-zA-Z0-9_]*$ #Allow underscores & caps - method_name: ^(?:[_a-zA-Z]|__)[a-zA-Z0-9_]*$ #Allow underscores & caps - parameter_name: ^[a-z][a-zA-Z0-9_]*$ # Allow underscores - local_variable: ^[a-zA-Z][a-zA-Z0-9_]*$ #Allow underscores & caps - exception_name: ^[a-zA-Z][a-zA-Z0-9]*Exception$ - isser_method_name: ^(?:[_a-zA-Z]|__)[a-zA-Z0-9]*$ #Allow underscores & caps - filter: - excluded_paths: - - 'docs/*' - - 'examples/*' - - 'extras/*' - - 'test/*' - - 'vendor/*' - - # Security Advisory Checker - sensiolabs_security_checker: true
@@ -1,32 +0,0 @@
-language: php -php: - - 7.0 - - 5.6 - - 5.5 - - 5.4 - - 5.3 - - hhvm - -matrix: - allow_failures: - - php: hhvm - -before_install: - - sudo apt-get update -qq - - sudo apt-get install -y -qq postfix -before_script: - - sudo service postfix stop - - smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 & - - mkdir -p build/logs - - cd test - - cp testbootstrap-dist.php testbootstrap.php - - chmod +x fakesendmail.sh - - sudo mkdir -p /var/qmail/bin - - sudo cp fakesendmail.sh /var/qmail/bin/sendmail - - sudo cp fakesendmail.sh /usr/sbin/sendmail - - echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > $(php --ini|grep -m 1 "ini files in:"|cut -d ":" -f 2)/sendmail.ini -script: - - phpunit --configuration ../travis.phpunit.xml.dist -after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover ../build/logs/clover.xml
@@ -1,504 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - -
@@ -1,49 +0,0 @@
-<?php -/** - * PHPMailer SPL autoloader. - * PHP Version 5 - * @package PHPMailer - * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project - * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> - * @author Jim Jagielski (jimjag) <jimjag@gmail.com> - * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailer SPL autoloader. - * @param string $classname The name of the class to load - */ -function PHPMailerAutoload($classname) -{ - //Can't use __DIR__ as it's only in PHP 5.3+ - $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php'; - if (is_readable($filename)) { - require $filename; - } -} - -if (version_compare(PHP_VERSION, '5.1.2', '>=')) { - //SPL autoloading was introduced in PHP 5.1.2 - if (version_compare(PHP_VERSION, '5.3.0', '>=')) { - spl_autoload_register('PHPMailerAutoload', true, true); - } else { - spl_autoload_register('PHPMailerAutoload'); - } -} else { - /** - * Fall back to traditional autoload for old PHP versions - * @param string $classname The name of the class to load - */ - function __autoload($classname) - { - PHPMailerAutoload($classname); - } -}
@@ -1,184 +0,0 @@
- - -# PHPMailer - A full-featured email creation and transfer class for PHP - -Build status: [](https://travis-ci.org/PHPMailer/PHPMailer) -[](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/) -[](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/) - -[](https://packagist.org/packages/phpmailer/phpmailer) [](https://packagist.org/packages/phpmailer/phpmailer) [](https://packagist.org/packages/phpmailer/phpmailer) [](https://packagist.org/packages/phpmailer/phpmailer) - -## Class Features - -- Probably the world's most popular code for sending email from PHP! -- Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more -- Integrated SMTP support - send without a local mail server -- Send emails with multiple TOs, CCs, BCCs and REPLY-TOs -- Multipart/alternative emails for mail clients that do not read HTML email -- Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings -- SMTP authentication with LOGIN, PLAIN, NTLM, CRAM-MD5 and Google's XOAUTH2 mechanisms over SSL and TLS transports -- Error messages in 47 languages! -- DKIM and S/MIME signing support -- Compatible with PHP 5.0 and later -- Much more! - -## Why you might need it - -Many PHP developers utilize email in their code. The only PHP function that supports this is the `mail()` function. However, it does not provide any assistance for making use of popular features such as HTML-based emails and attachments. - -Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules - the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong! -*Please* don't be tempted to do it yourself - if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own - try SwiftMailer, Zend_Mail, eZcomponents etc. - -The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD and OS X platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP implementation allows email sending on Windows platforms without a local mail server. - -## License - -This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html) license. Please read LICENSE for information on the -software availability and distribution. - -## Installation & loading - -PHPMailer is available via [Composer/Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), so just add this line to your `composer.json` file: - -```json -"phpmailer/phpmailer": "~5.2" -``` - -or - -```sh -composer require phpmailer/phpmailer -``` - -If you want to use the Gmail XOAUTH2 authentication class, you will also need to add a dependency on the `league/oauth2-client` package. - -Alternatively, copy the contents of the PHPMailer folder into one of the `include_path` directories specified in your PHP configuration. If you don't speak git or just want a tarball, click the 'zip' button at the top of the page in GitHub. - -If you're not using composer's autoloader, PHPMailer provides an SPL-compatible autoloader, and that is the preferred way of loading the library - just `require '/path/to/PHPMailerAutoload.php';` and everything should work. The autoloader does not throw errors if it can't find classes so it prepends itself to the SPL list, allowing your own (or your framework's) autoloader to catch errors. SPL autoloading was introduced in PHP 5.1.0, so if you are using a version older than that you will need to require/include each class manually. - -PHPMailer does *not* declare a namespace because namespaces were only introduced in PHP 5.3. - -If you want to use Google's XOAUTH2 authentication mechanism, you need to be running at least PHP 5.4, and load the dependencies listed in `composer.json`. - -### Minimal installation - -While installing the entire package manually or with composer is simple, convenient and reliable, you may want to include only vital files in your project. At the very least you will need [class.phpmailer.php](https://github.com/PHPMailer/PHPMailer/tree/master/class.phpmailer.php). If you're using SMTP, you'll need [class.smtp.php](https://github.com/PHPMailer/PHPMailer/tree/master/class.smtp.php), and if you're using POP-before SMTP, you'll need [class.pop3.php](https://github.com/PHPMailer/PHPMailer/tree/master/class.pop3.php). For all of these, we recommend you use [the autoloader](https://github.com/PHPMailer/PHPMailer/tree/master/PHPMailerAutoload.php) too as otherwise you will either have to `require` all classes manually or use some other autoloader. You can skip the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder if you're not showing errors to users and can make do with English-only errors. You may need the additional classes in the [extras](extras/) folder if you are using those features, including NTLM authentication and ics generation. If you're using Google XOAUTH2 you will need `class.phpmaileroauth.php` and `class.oauth.php` classes too, as well as the composer dependencies. - -## A Simple Example - -```php -<?php -require 'PHPMailerAutoload.php'; - -$mail = new PHPMailer; - -//$mail->SMTPDebug = 3; // Enable verbose debug output - -$mail->isSMTP(); // Set mailer to use SMTP -$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers -$mail->SMTPAuth = true; // Enable SMTP authentication -$mail->Username = 'user@example.com'; // SMTP username -$mail->Password = 'secret'; // SMTP password -$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted -$mail->Port = 587; // TCP port to connect to - -$mail->setFrom('from@example.com', 'Mailer'); -$mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient -$mail->addAddress('ellen@example.com'); // Name is optional -$mail->addReplyTo('info@example.com', 'Information'); -$mail->addCC('cc@example.com'); -$mail->addBCC('bcc@example.com'); - -$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments -$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name -$mail->isHTML(true); // Set email format to HTML - -$mail->Subject = 'Here is the subject'; -$mail->Body = 'This is the HTML message body <b>in bold!</b>'; -$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; - -if(!$mail->send()) { - echo 'Message could not be sent.'; - echo 'Mailer Error: ' . $mail->ErrorInfo; -} else { - echo 'Message has been sent'; -} -``` - -You'll find plenty more to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder. - -That's it. You should now be ready to use PHPMailer! - -## Localization -PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder you'll find numerous (46 at the time of writing!) translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this: - -```php -// To load the French version -$mail->setLanguage('fr', '/optional/path/to/language/directory/'); -``` - -We welcome corrections and new languages - if you're looking for corrections to do, run the [phpmailerLangTest.php](https://github.com/PHPMailer/PHPMailer/tree/master/test/phpmailerLangTest.php) script in the tests folder and it will show any missing translations. - -## Documentation - -Examples of how to use PHPMailer for common scenarios can be found in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder. If you're looking for a good starting point, we recommend you start with [the Gmail example](https://github.com/PHPMailer/PHPMailer/tree/master/examples/gmail.phps). - -There are tips and a troubleshooting guide in the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, this should be the first place you look as it's the most frequently updated. - -Complete generated API documentation is [available online](http://phpmailer.github.io/PHPMailer/). - -You'll find some basic user-level docs in the [docs](docs/) folder, and you can generate complete API-level documentation using the [generatedocs.sh](https://github.com/PHPMailer/PHPMailer/tree/master/docs/generatedocs.sh) shell script in the docs folder, though you'll need to install [PHPDocumentor](http://www.phpdoc.org) first. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/tree/master/test/phpmailerTest.php) a good source of how to do various operations such as encryption. - -If the documentation doesn't cover what you need, search the [many questions on Stack Overflow](http://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting). - -## Tests - -There is a PHPUnit test script in the [test](https://github.com/PHPMailer/PHPMailer/tree/master/test/) folder. - -Build status: [](https://travis-ci.org/PHPMailer/PHPMailer) - -If this isn't passing, is there something you can do to help? - -## Contributing - -Please submit bug reports, suggestions and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues). - -We're particularly interested in fixing edge-cases, expanding test coverage and updating translations. - -With the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone: - -```sh -git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git -``` - -Please *don't* use the SourceForge or Google Code projects any more. - -## Sponsorship - -Development time and resources for PHPMailer are provided by [Smartmessages.net](https://info.smartmessages.net/), a powerful email marketing system. - -<a href="https://info.smartmessages.net/"><img src="https://www.smartmessages.net/img/smartmessages-logo.svg" width="250" height="28" alt="Smartmessages email marketing"></a> - -Other contributions are gladly received, whether in beer ðŸº, T-shirts 👕, Amazon wishlist raids, or cold, hard cash 💰. - -## Changelog - -See [changelog](changelog.md). - -## History -- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](http://sourceforge.net/projects/phpmailer/). -- Marcus Bointon (coolbru on SF) and Andy Prevost (codeworxtech) took over the project in 2004. -- Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski. -- Marcus created his fork on [GitHub](https://github.com/Synchro/PHPMailer). -- Jim and Marcus decide to join forces and use GitHub as the canonical and official repo for PHPMailer. -- PHPMailer moves to the [PHPMailer organisation](https://github.com/PHPMailer) on GitHub. - -### What's changed since moving from SourceForge? -- Official successor to the SourceForge and Google Code projects. -- Test suite. -- Continuous integration with Travis-CI. -- Composer support. -- Public development. -- Additional languages and language strings. -- CRAM-MD5 authentication support. -- Preserves full repo history of authors, commits and branches from the original SourceForge project.
@@ -1,644 +0,0 @@
-# ChangeLog - -## Version 5.2.16 (June 6th 2016) -* Added DKIM example -* Fixed empty additional_parameters problem -* Fixed wrong version number in VERSION file! -* Improve line-length tests -* Use instance settings for SMTP::connect by default -* Use more secure auth mechanisms first - -## Version 5.2.15 (May 10th 2016) -* Added ability to inject custom address validators, and set the default validator -* Fix TLS 1.2 compatibility -* Remove some excess line breaks in MIME structure -* Updated Polish, Russian, Brazilian Portuguese, Georgian translations -* More DRY! -* Improve error messages -* Update dependencies -* Add example showing how to handle multiple form file uploads -* Improve SMTP example -* Improve Windows compatibility -* Use consistent names for temp files -* Fix gmail XOAUTH2 scope, thanks to @sherryl4george -* Fix extra line break in getSentMIMEMessage() -* Improve DKIM signing to use SHA-2 - -## Version 5.2.14 (Nov 1st 2015) -* Allow addresses with IDN (Internationalized Domain Name) in PHP 5.3+, thanks to @fbonzon -* Allow access to POP3 errors -* Make all POP3 private properties and methods protected -* **SECURITY** Fix vulnerability that allowed email addresses with line breaks (valid in RFC5322) to pass to SMTP, permitting message injection at the SMTP level. Mitigated in both the address validator and in the lower-level SMTP class. Thanks to Takeshi Terada. -* Updated Brazilian Portuguese translations (Thanks to @phelipealves) - -## Version 5.2.13 (Sep 14th 2015) -* Rename internal oauth class to avoid name clashes -* Improve Estonian translations - -## Version 5.2.12 (Sep 1st 2015) -* Fix incorrect composer package dependencies -* Skip existing embedded image `cid`s in `msgHTML` - -## Version 5.2.11 (Aug 31st 2015) -* Don't switch to quoted-printable for long lines if already using base64 -* Fixed Travis-CI config when run on PHP 7 -* Added Google XOAUTH2 authentication mechanism, thanks to @sherryl4george -* Add address parser for RFC822-format addresses -* Update MS Office MIME types -* Don't convert line breaks when using quoted-printable encoding -* Handle MS Exchange returning an invalid empty AUTH-type list in EHLO -* Don't set name or filename properties on MIME parts that don't have one - -## Version 5.2.10 (May 4th 2015) -* Add custom header getter -* Use `application/javascript` for .js attachments -* Improve RFC2821 compliance for timelimits, especially for end-of-data -* Add Azerbaijani translations (Thanks to @mirjalal) -* Minor code cleanup for robustness -* Add Indonesian translations (Thanks to @ceceprawiro) -* Avoid `error_log` Debugoutput naming clash -* Add ability to parse server capabilities in response to EHLO (useful for SendGrid etc) -* Amended default values for WordWrap to match RFC -* Remove html2text converter class (has incompatible license) -* Provide new mechanism for injecting html to text converters -* Improve pointers to docs and support in README -* Add example file upload script -* Refactor and major cleanup of EasyPeasyICS, now a lot more usable -* Make set() method simpler and more reliable -* Add Malay translation (Thanks to @nawawi) -* Add Bulgarian translation (Thanks to @mialy) -* Add Armenian translation (Thanks to Hrayr Grigoryan) -* Add Slovenian translation (Thanks to Klemen TuÅ¡ar) -* More efficient word wrapping -* Add support for S/MIME signing with additional CA certificate (thanks to @IgitBuh) -* Fix incorrect MIME structure when using S/MIME signing and isMail() (#372) -* Improved checks and error messages for missing extensions -* Store and report SMTP errors more consistently -* Add MIME multipart preamble for better Outlook compatibility -* Enable TLS encryption automatically if the server offers it -* Provide detailed errors when individual recipients fail -* Report more errors when connecting -* Add extras classes to composer classmap -* Expose stream_context_create options via new SMTPOptions property -* Automatic encoding switch to quoted-printable if message lines are too long -* Add Korean translation (Thanks to @ChalkPE) -* Provide a pointer to troubleshooting docs on SMTP connection failure - -## Version 5.2.9 (Sept 25th 2014) -* **Important: The autoloader is no longer autoloaded by the PHPMailer class** -* Update html2text from https://github.com/mtibben/html2text -* Improve Arabic translations (Thanks to @tarekdj) -* Consistent handling of connection variables in SMTP and POP3 -* PHPDoc cleanup -* Update composer to use PHPUnit 4.1 -* Pass consistent params to callbacks -* More consistent handling of error states and debug output -* Use property defaults, remove constructors -* Remove unreachable code -* Use older regex validation pattern for troublesome PCRE library versions -* Improve PCRE detection in older PHP versions -* Handle debug output consistently, and always in UTF-8 -* Allow user-defined debug output method via a callable -* msgHTML now converts data URIs to embedded images -* SMTP::getLastReply() will now always be populated -* Improved example code in README -* Ensure long filenames in Content-Disposition are encoded correctly -* Simplify SMTP debug output mechanism, clarify levels with constants -* Add SMTP connection check example -* Simplify examples, don't use mysql* functions - -## Version 5.2.8 (May 14th 2014) -* Increase timeout to match RFC2821 section 4.5.3.2 and thus not fail greetdelays, fixes #104 -* Add timestamps to default debug output -* Add connection events and new level 3 to debug output options -* Chinese language update (Thanks to @binaryoung) -* Allow custom Mailer types (Thanks to @michield) -* Cope with spaces around SMTP host specs -* Fix processing of multiple hosts in connect string -* Added Galician translation (Thanks to @donatorouco) -* Autoloader now prepends -* Docs updates -* Add Latvian translation (Thanks to @eddsstudio) -* Add Belarusian translation (Thanks to @amaksymiuk) -* Make autoloader work better on older PHP versions -* Avoid double-encoding if mbstring is overloading mail() -* Add Portuguese translation (Thanks to @Jonadabe) -* Make quoted-printable encoder respect line ending setting -* Improve Chinese translation (Thanks to @PeterDaveHello) -* Add Georgian translation (Thanks to @akalongman) -* Add Greek translation (Thanks to @lenasterg) -* Fix serverHostname on PHP < 5.3 -* Improve performance of SMTP class -* Implement automatic 7bit downgrade -* Add Vietnamese translation (Thanks to @vinades) -* Improve example images, switch to PNG -* Add Croatian translation (Thanks to @hrvoj3e) -* Remove setting the Return-Path and deprecate the Return-path property - it's just wrong! -* Fix language file loading if CWD has changed (@stephandesouza) -* Add HTML5 email validation pattern -* Improve Turkish translations (Thanks to @yasinaydin) -* Improve Romanian translations (Thanks to @aflorea) -* Check php.ini for path to sendmail/qmail before using default -* Improve Farsi translation (Thanks to @MHM5000) -* Don't use quoted-printable encoding for multipart types -* Add Serbian translation (Thanks to ajevremovic at gmail.com) -* Remove useless PHP5 check -* Use SVG for build status badges -* Store MessageDate on creation -* Better default behaviour for validateAddress - -## Version 5.2.7 (September 12th 2013) -* Add Ukrainian translation from @Krezalis -* Support for do_verp -* Fix bug in CRAM-MD5 AUTH -* Propagate Debugoutput option to SMTP class (@Reblutus) -* Determine MIME type of attachments automatically -* Add cross-platform, multibyte-safe pathinfo replacement (with tests) and use it -* Add a new 'html' Debugoutput type -* Clean up SMTP debug output, remove embedded HTML -* Some small changes in header formatting to improve IETF msglint test results -* Update test_script to use some recently changed features, rename to code_generator -* Generated code actually works! -* Update SyntaxHighlighter -* Major overhaul and cleanup of example code -* New PHPMailer graphic -* msgHTML now uses RFC2392-compliant content ids -* Add line break normalization function and use it in msgHTML -* Don't set unnecessary reply-to addresses -* Make fakesendmail.sh a bit cleaner and safer -* Set a content-transfer-encoding on multiparts (fixes msglint error) -* Fix cid generation in msgHTML (Thanks to @digitalthought) -* Fix handling of multiple SMTP servers (Thanks to @NanoCaiordo) -* SMTP->connect() now supports stream context options (Thanks to @stanislavdavid) -* Add support for iCal event alternatives (Thanks to @reblutus) -* Update to Polish language file (Thanks to Krzysztof Kowalewski) -* Update to Norwegian language file (Thanks to @datagutten) -* Update to Hungarian language file (Thanks to @dominicus-75) -* Add Persian/Farsi translation from @jaii -* Make SMTPDebug property type match type in SMTP class -* Add unit tests for DKIM -* Major refactor of SMTP class -* Reformat to PSR-2 coding standard -* Introduce autoloader -* Allow overriding of SMTP class -* Overhaul of PHPDocs -* Fix broken Q-encoding -* Czech language update (Thanks to @nemelu) -* Removal of excess blank lines in messages -* Added fake POP server and unit tests for POP-before-SMTP - -## Version 5.2.6 (April 11th 2013) -* Reflect move to PHPMailer GitHub organisation at https://github.com/PHPMailer/PHPMailer -* Fix unbumped version numbers -* Update packagist.org with new location -* Clean up Changelog - -## Version 5.2.5 (April 6th 2013) -* First official release after move from Google Code -* Fixes for qmail when sending via mail() -* Merge in changes from Google code 5.2.4 release -* Minor coding standards cleanup in SMTP class -* Improved unit tests, now tests S/MIME signing -* Travis-CI support on GitHub, runs tests with fake SMTP server - -## Version 5.2.4 (February 19, 2013) -* Fix tag and version bug. -* un-deprecate isSMTP(), isMail(), IsSendmail() and isQmail(). -* Numerous translation updates - -## Version 5.2.3 (February 8, 2013) -* Fix issue with older PCREs and ValidateAddress() (Bugz: 124) -* Add CRAM-MD5 authentication, thanks to Elijah madden, https://github.com/okonomiyaki3000 -* Replacement of obsolete Quoted-Printable encoder with a much better implementation -* Composer package definition -* New language added: Hebrew - -## Version 5.2.2 (December 3, 2012) -* Some fixes and syncs from https://github.com/Synchro/PHPMailer -* Add Slovak translation, thanks to Michal Tinka - -## Version 5.2.2-rc2 (November 6, 2012) -* Fix SMTP server rotation (Bugz: 118) -* Allow override of autogen'ed 'Date' header (for Drupal's - og_mailinglist module) -* No whitespace after '-f' option (Bugz: 116) -* Work around potential warning (Bugz: 114) - -## Version 5.2.2-rc1 (September 28, 2012) -* Header encoding works with long lines (Bugz: 93) -* Turkish language update (Bugz: 94) -* undefined $pattern in EncodeQ bug squashed (Bugz: 98) -* use of mail() in safe_mode now works (Bugz: 96) -* ValidateAddress() now 'public static' so people can override the - default and use their own validation scheme. -* ValidateAddress() no longer uses broken FILTER_VALIDATE_EMAIL -* Added in AUTH PLAIN SMTP authentication - -## Version 5.2.2-beta2 (August 17, 2012) -* Fixed Postfix VERP support (Bugz: 92) -* Allow action_function callbacks to pass/use - the From address (passed as final param) -* Prevent inf look for get_lines() (Bugz: 77) -* New public var ($UseSendmailOptions). Only pass sendmail() - options iff we really are using sendmail or something sendmail - compatible. (Bugz: 75) -* default setting for LE returned to "\n" due to popular demand. - -## Version 5.2.2-beta1 (July 13, 2012) -* Expose PreSend() and PostSend() as public methods to allow - for more control if serializing message sending. -* GetSentMIMEMessage() only constructs the message copy when - needed. Save memory. -* Only pass params to mail() if the underlying MTA is - "sendmail" (as defined as "having the string sendmail - in its pathname") [#69] -* Attachments now work with Amazon SES and others [Bugz#70] -* Debug output now sent to stdout (via echo) or error_log [Bugz#5] -* New var: Debugoutput (for above) [Bugz#5] -* SMTP reads now Timeout aware (new var: Timeout=15) [Bugz#71] -* SMTP reads now can have a Timelimit associated with them - (new var: Timelimit=30)[Bugz#71] -* Fix quoting issue associated with charsets -* default setting for LE is now RFC compliant: "\r\n" -* Return-Path can now be user defined (new var: ReturnPath) - (the default is "" which implies no change from previous - behavior, which was to use either From or Sender) [Bugz#46] -* X-Mailer header can now be disabled (by setting to a - whitespace string, eg " ") [Bugz#66] -* Bugz closed: #68, #60, #42, #43, #59, #55, #66, #48, #49, - #52, #31, #41, #5. #70, #69 - -## Version 5.2.1 (January 16, 2012) -* Closed several bugs #5 -* Performance improvements -* MsgHTML() now returns the message as required. -* New method: GetSentMIMEMessage() (returns full copy of sent message) - -## Version 5.2 (July 19, 2011) -* protected MIME body and header -* better DKIM DNS Resource Record support -* better aly handling -* htmlfilter class added to extras -* moved to Apache Extras - -## Version 5.1 (October 20, 2009) -* fixed filename issue with AddStringAttachment (thanks to Tony) -* fixed "SingleTo" property, now works with Senmail, Qmail, and SMTP in - addition to PHP mail() -* added DKIM digital signing functionality, new properties: - - DKIM_domain (sets the domain name) - - DKIM_private (holds DKIM private key) - - DKIM_passphrase (holds your DKIM passphrase) - - DKIM_selector (holds the DKIM "selector") - - DKIM_identity (holds the identifying email address) -* added callback function support - - callback function parameters include: - result, to, cc, bcc, subject and body - - see the test/test_callback.php file for usage. -* added "auto" identity functionality - - can automatically add: - - Return-path (if Sender not set) - - Reply-To (if ReplyTo not set) - - can be disabled: - - $mail->SetFrom('yourname@yourdomain.com','First Last',false); - - or by adding the $mail->Sender and/or $mail->ReplyTo properties - -Note: "auto" identity added to help with emails ending up in spam or junk boxes because of missing headers - -## Version 5.0.2 (May 24, 2009) -* Fix for missing attachments when inline graphics are present -* Fix for missing Cc in header when using SMTP (mail was sent, - but not displayed in header -- Cc receiver only saw email To: - line and no Cc line, but did get the email (To receiver - saw same) - -## Version 5.0.1 (April 05, 2009) -* Temporary fix for missing attachments - -## Version 5.0.0 (April 02, 2009) -With the release of this version, we are initiating a new version numbering -system to differentiate from the PHP4 version of PHPMailer. -Most notable in this release is fully object oriented code. - -### class.smtp.php: -* Refactored class.smtp.php to support new exception handling -* code size reduced from 29.2 Kb to 25.6 Kb -* Removed unnecessary functions from class.smtp.php: - - public function Expand($name) { - - public function Help($keyword="") { - - public function Noop() { - - public function Send($from) { - - public function SendOrMail($from) { - - public function Verify($name) { - -### class.phpmailer.php: -* Refactored class.phpmailer.php with new exception handling -* Changed processing functionality of Sendmail and Qmail so they cannot be - inadvertently used -* removed getFile() function, just became a simple wrapper for - file_get_contents() -* added check for PHP version (will gracefully exit if not at least PHP 5.0) -* enhanced code to check if an attachment source is the same as an embedded or - inline graphic source to eliminate duplicate attachments - -### New /test_script -We have written a test script you can use to test the script as part of your -installation. Once you press submit, the test script will send a multi-mime -email with either the message you type in or an HTML email with an inline -graphic. Two attachments are included in the email (one of the attachments -is also the inline graphic so you can see that only one copy of the graphic -is sent in the email). The test script will also display the functional -script that you can copy/paste to your editor to duplicate the functionality. - -### New examples -All new examples in both basic and advanced modes. Advanced examples show - Exception handling. - -### PHPDocumentator (phpdocs) documentation for PHPMailer version 5.0.0 -All new documentation - -## Version 2.3 (November 06, 2008) -* added Arabic language (many thanks to Bahjat Al Mostafa) -* removed English language from language files and made it a default within - class.phpmailer.php - if no language is found, it will default to use - the english language translation -* fixed public/private declarations -* corrected line 1728, $basedir to $directory -* added $sign_cert_file to avoid improper duplicate use of $sign_key_file -* corrected $this->Hello on line 612 to $this->Helo -* changed default of $LE to "\r\n" to comply with RFC 2822. Can be set by the user - if default is not acceptable -* removed trim() from return results in EncodeQP -* /test and three files it contained are removed from version 2.3 -* fixed phpunit.php for compliance with PHP5 -* changed $this->AltBody = $textMsg; to $this->AltBody = html_entity_decode($textMsg); -* We have removed the /phpdoc from the downloads. All documentation is now on - the http://phpmailer.codeworxtech.com website. - -## Version 2.2.1 () July 19 2008 -* fixed line 1092 in class.smtp.php (my apologies, error on my part) - -## Version 2.2 () July 15 2008 -* Fixed redirect issue (display of UTF-8 in thank you redirect) -* fixed error in getResponse function declaration (class.pop3.php) -* PHPMailer now PHP6 compliant -* fixed line 1092 in class.smtp.php (endless loop from missing = sign) - -## Version 2.1 (Wed, June 04 2008) -NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS. IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE APPRECIATED. - -* added S/MIME functionality (ability to digitally sign emails) - BIG THANKS TO "sergiocambra" for posting this patch back in November 2007. - The "Signed Emails" functionality adds the Sign method to pass the private key - filename and the password to read it, and then email will be sent with - content-type multipart/signed and with the digital signature attached. -* fully compatible with E_STRICT error level - - Please note: - In about half the test environments this development version was subjected - to, an error was thrown for the date() functions used (line 1565 and 1569). - This is NOT a PHPMailer error, it is the result of an incorrectly configured - PHP5 installation. The fix is to modify your 'php.ini' file and include the - date.timezone = Etc/UTC (or your own zone) - directive, to your own server timezone - - If you do get this error, and are unable to access your php.ini file: - In your PHP script, add - `date_default_timezone_set('Etc/UTC');` - - do not try to use - `$myVar = date_default_timezone_get();` - as a test, it will throw an error. -* added ability to define path (mainly for embedded images) - function `MsgHTML($message,$basedir='')` ... where: - `$basedir` is the fully qualified path -* fixed `MsgHTML()` function: - - Embedded Images where images are specified by `<protocol>://` will not be altered or embedded -* fixed the return value of SMTP exit code ( pclose ) -* addressed issue of multibyte characters in subject line and truncating -* added ability to have user specified Message ID - (default is still that PHPMailer create a unique Message ID) -* corrected unidentified message type to 'application/octet-stream' -* fixed chunk_split() multibyte issue (thanks to Colin Brown, et al). -* added check for added attachments -* enhanced conversion of HTML to text in MsgHTML (thanks to "brunny") - -## Version 2.1.0beta2 (Sun, Dec 02 2007) -* implemented updated EncodeQP (thanks to coolbru, aka Marcus Bointon) -* finished all testing, all known bugs corrected, enhancements tested - -Note: will NOT work with PHP4. - -Please note, this is BETA software **DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS; INTENDED STRICTLY FOR TESTING** - -## Version 2.1.0beta1 -Please note, this is BETA software -** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS - INTENDED STRICTLY FOR TESTING - -## Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release -* implements new property to control VERP in class.smtp.php - example (requires instantiating class.smtp.php): - $mail->do_verp = true; -* POP-before-SMTP functionality included, thanks to Richard Davey - (see class.pop3.php & pop3_before_smtp_test.php for examples) -* included example showing how to use PHPMailer with GMAIL -* fixed the missing Cc in SendMail() and Mail() - -## Version 2.0.0 rc1 (Thu, Nov 08 2007), interim release -* dramatically simplified using inline graphics ... it's fully automated and requires no user input -* added automatic document type detection for attachments and pictures -* added MsgHTML() function to replace Body tag for HTML emails -* fixed the SendMail security issues (input validation vulnerability) -* enhanced the AddAddresses functionality so that the "Name" portion is used in the email address -* removed the need to use the AltBody method (set from the HTML, or default text used) -* set the PHP Mail() function as the default (still support SendMail, SMTP Mail) -* removed the need to set the IsHTML property (set automatically) -* added Estonian language file by Indrek Päri -* added header injection patch -* added "set" method to permit users to create their own pseudo-properties like 'X-Headers', etc. -* fixed warning message in SMTP get_lines method -* added TLS/SSL SMTP support. -* PHPMailer has been tested with PHP4 (4.4.7) and PHP5 (5.2.7) -* Works with PHP installed as a module or as CGI-PHP -NOTE: will NOT work with PHP5 in E_STRICT error mode - -## Version 1.73 (Sun, Jun 10 2005) -* Fixed denial of service bug: http://www.cybsec.com/vuln/PHPMailer-DOS.pdf -* Now has a total of 20 translations -* Fixed alt attachments bug: http://tinyurl.com/98u9k - -## Version 1.72 (Wed, May 25 2004) -* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations. -* Received: Removed this method because spam filter programs like - SpamAssassin reject this header. -* Fixed error count bug. -* SetLanguage default is now "language/". -* Fixed magic_quotes_runtime bug. - -## Version 1.71 (Tue, Jul 28 2003) -* Made several speed enhancements -* Added German and Italian translation files -* Fixed HELO/AUTH bugs on keep-alive connects -* Now provides an error message if language file does not load -* Fixed attachment EOL bug -* Updated some unclear documentation -* Added additional tests and improved others - -## Version 1.70 (Mon, Jun 20 2003) -* Added SMTP keep-alive support -* Added IsError method for error detection -* Added error message translation support (SetLanguage) -* Refactored many methods to increase library performance -* Hello now sends the newer EHLO message before HELO as per RFC 2821 -* Removed the boundary class and replaced it with GetBoundary -* Removed queue support methods -* New $Hostname variable -* New Message-ID header -* Received header reformat -* Helo variable default changed to $Hostname -* Removed extra spaces in Content-Type definition (#667182) -* Return-Path should be set to Sender when set -* Adds Q or B encoding to headers when necessary -* quoted-encoding should now encode NULs \000 -* Fixed encoding of body/AltBody (#553370) -* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC) -* Multiple bug fixes - -## Version 1.65 (Fri, Aug 09 2002) -* Fixed non-visible attachment bug (#585097) for Outlook -* SMTP connections are now closed after each transaction -* Fixed SMTP::Expand return value -* Converted SMTP class documentation to phpDocumentor format - -## Version 1.62 (Wed, Jun 26 2002) -* Fixed multi-attach bug -* Set proper word wrapping -* Reduced memory use with attachments -* Added more debugging -* Changed documentation to phpDocumentor format - -## Version 1.60 (Sat, Mar 30 2002) -* Sendmail pipe and address patch (Christian Holtje) -* Added embedded image and read confirmation support (A. Ognio) -* Added unit tests -* Added SMTP timeout support (*nix only) -* Added possibly temporary PluginDir variable for SMTP class -* Added LE message line ending variable -* Refactored boundary and attachment code -* Eliminated SMTP class warnings -* Added SendToQueue method for future queuing support - -## Version 1.54 (Wed, Dec 19 2001) -* Add some queuing support code -* Fixed a pesky multi/alt bug -* Messages are no longer forced to have "To" addresses - -## Version 1.50 (Thu, Nov 08 2001) -* Fix extra lines when not using SMTP mailer -* Set WordWrap variable to int with a zero default - -## Version 1.47 (Tue, Oct 16 2001) -* Fixed Received header code format -* Fixed AltBody order error -* Fixed alternate port warning - -## Version 1.45 (Tue, Sep 25 2001) -* Added enhanced SMTP debug support -* Added support for multiple ports on SMTP -* Added Received header for tracing -* Fixed AddStringAttachment encoding -* Fixed possible header name quote bug -* Fixed wordwrap() trim bug -* Couple other small bug fixes - -## Version 1.41 (Wed, Aug 22 2001) -* Fixed AltBody bug w/o attachments -* Fixed rfc_date() for certain mail servers - -## Version 1.40 (Sun, Aug 12 2001) -* Added multipart/alternative support (AltBody) -* Documentation update -* Fixed bug in Mercury MTA - -## Version 1.29 (Fri, Aug 03 2001) -* Added AddStringAttachment() method -* Added SMTP authentication support - -## Version 1.28 (Mon, Jul 30 2001) -* Fixed a typo in SMTP class -* Fixed header issue with Imail (win32) SMTP server -* Made fopen() calls for attachments use "rb" to fix win32 error - -## Version 1.25 (Mon, Jul 02 2001) -* Added RFC 822 date fix (Patrice) -* Added improved error handling by adding a $ErrorInfo variable -* Removed MailerDebug variable (obsolete with new error handler) - -## Version 1.20 (Mon, Jun 25 2001) -* Added quoted-printable encoding (Patrice) -* Set Version as public and removed PrintVersion() -* Changed phpdoc to only display public variables and methods - -## Version 1.19 (Thu, Jun 21 2001) -* Fixed MS Mail header bug -* Added fix for Bcc problem with mail(). *Does not work on Win32* - (See PHP bug report: http://www.php.net/bugs.php?id=11616) -* mail() no longer passes a fifth parameter when not needed - -## Version 1.15 (Fri, Jun 15 2001) -Note: these changes contributed by Patrice Fournier -* Changed all remaining \n to \r\n -* Bcc: header no longer written to message except - when sent directly to sendmail -* Added a small message to non-MIME compliant mail reader -* Added Sender variable to change the Sender email - used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode -* Changed boundary setting to a place it will be set only once -* Removed transfer encoding for whole message when using multipart -* Message body now uses Encoding in multipart messages -* Can set encoding and type to attachments 7bit, 8bit - and binary attachment are sent as is, base64 are encoded -* Can set Encoding to base64 to send 8 bits body - through 7 bits servers - -## Version 1.10 (Tue, Jun 12 2001) -* Fixed win32 mail header bug (printed out headers in message body) - -## Version 1.09 (Fri, Jun 08 2001) -* Changed date header to work with Netscape mail programs -* Altered phpdoc documentation - -## Version 1.08 (Tue, Jun 05 2001) -* Added enhanced error-checking -* Added phpdoc documentation to source - -## Version 1.06 (Fri, Jun 01 2001) -* Added optional name for file attachments - -## Version 1.05 (Tue, May 29 2001) -* Code cleanup -* Eliminated sendmail header warning message -* Fixed possible SMTP error - -## Version 1.03 (Thu, May 24 2001) -* Fixed problem where qmail sends out duplicate messages - -## Version 1.02 (Wed, May 23 2001) -* Added multiple recipient and attachment Clear* methods -* Added Sendmail public variable -* Fixed problem with loading SMTP library multiple times - -## Version 0.98 (Tue, May 22 2001) -* Fixed problem with redundant mail hosts sending out multiple messages -* Added additional error handler code -* Added AddCustomHeader() function -* Added support for Microsoft mail client headers (affects priority) -* Fixed small bug with Mailer variable -* Added PrintVersion() function - -## Version 0.92 (Tue, May 15 2001) -* Changed file names to class.phpmailer.php and class.smtp.php to match - current PHP class trend. -* Fixed problem where body not being printed when a message is attached -* Several small bug fixes - -## Version 0.90 (Tue, April 17 2001) -* Initial public release
@@ -1,3924 +0,0 @@
-<?php -/** - * PHPMailer - PHP email creation and transport class. - * PHP Version 5 - * @package PHPMailer - * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project - * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> - * @author Jim Jagielski (jimjag) <jimjag@gmail.com> - * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailer - PHP email creation and transport class. - * @package PHPMailer - * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> - * @author Jim Jagielski (jimjag) <jimjag@gmail.com> - * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> - * @author Brent R. Matzelle (original founder) - */ -class PHPMailer -{ - /** - * The PHPMailer Version number. - * @var string - */ - public $Version = '5.2.16'; - - /** - * Email priority. - * Options: null (default), 1 = High, 3 = Normal, 5 = low. - * When null, the header is not set at all. - * @var integer - */ - public $Priority = null; - - /** - * The character set of the message. - * @var string - */ - public $CharSet = 'iso-8859-1'; - - /** - * The MIME Content-type of the message. - * @var string - */ - public $ContentType = 'text/plain'; - - /** - * The message encoding. - * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable". - * @var string - */ - public $Encoding = '8bit'; - - /** - * Holds the most recent mailer error message. - * @var string - */ - public $ErrorInfo = ''; - - /** - * The From email address for the message. - * @var string - */ - public $From = 'root@localhost'; - - /** - * The From name of the message. - * @var string - */ - public $FromName = 'Root User'; - - /** - * The Sender email (Return-Path) of the message. - * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. - * @var string - */ - public $Sender = ''; - - /** - * The Return-Path of the message. - * If empty, it will be set to either From or Sender. - * @var string - * @deprecated Email senders should never set a return-path header; - * it's the receiver's job (RFC5321 section 4.4), so this no longer does anything. - * @link https://tools.ietf.org/html/rfc5321#section-4.4 RFC5321 reference - */ - public $ReturnPath = ''; - - /** - * The Subject of the message. - * @var string - */ - public $Subject = ''; - - /** - * An HTML or plain text message body. - * If HTML then call isHTML(true). - * @var string - */ - public $Body = ''; - - /** - * The plain-text message body. - * This body can be read by mail clients that do not have HTML email - * capability such as mutt & Eudora. - * Clients that can read HTML will view the normal Body. - * @var string - */ - public $AltBody = ''; - - /** - * An iCal message part body. - * Only supported in simple alt or alt_inline message types - * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator - * @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/ - * @link http://kigkonsult.se/iCalcreator/ - * @var string - */ - public $Ical = ''; - - /** - * The complete compiled MIME message body. - * @access protected - * @var string - */ - protected $MIMEBody = ''; - - /** - * The complete compiled MIME message headers. - * @var string - * @access protected - */ - protected $MIMEHeader = ''; - - /** - * Extra headers that createHeader() doesn't fold in. - * @var string - * @access protected - */ - protected $mailHeader = ''; - - /** - * Word-wrap the message body to this number of chars. - * Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance. - * @var integer - */ - public $WordWrap = 0; - - /** - * Which method to use to send mail. - * Options: "mail", "sendmail", or "smtp". - * @var string - */ - public $Mailer = 'mail'; - - /** - * The path to the sendmail program. - * @var string - */ - public $Sendmail = '/usr/sbin/sendmail'; - - /** - * Whether mail() uses a fully sendmail-compatible MTA. - * One which supports sendmail's "-oi -f" options. - * @var boolean - */ - public $UseSendmailOptions = true; - - /** - * Path to PHPMailer plugins. - * Useful if the SMTP class is not in the PHP include path. - * @var string - * @deprecated Should not be needed now there is an autoloader. - */ - public $PluginDir = ''; - - /** - * The email address that a reading confirmation should be sent to, also known as read receipt. - * @var string - */ - public $ConfirmReadingTo = ''; - - /** - * The hostname to use in the Message-ID header and as default HELO string. - * If empty, PHPMailer attempts to find one with, in order, - * $_SERVER['SERVER_NAME'], gethostname(), php_uname('n'), or the value - * 'localhost.localdomain'. - * @var string - */ - public $Hostname = ''; - - /** - * An ID to be used in the Message-ID header. - * If empty, a unique id will be generated. - * @var string - */ - public $MessageID = ''; - - /** - * The message Date to be used in the Date header. - * If empty, the current date will be added. - * @var string - */ - public $MessageDate = ''; - - /** - * SMTP hosts. - * Either a single hostname or multiple semicolon-delimited hostnames. - * You can also specify a different port - * for each host by using this format: [hostname:port] - * (e.g. "smtp1.example.com:25;smtp2.example.com"). - * You can also specify encryption type, for example: - * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465"). - * Hosts will be tried in order. - * @var string - */ - public $Host = 'localhost'; - - /** - * The default SMTP server port. - * @var integer - * @TODO Why is this needed when the SMTP class takes care of it? - */ - public $Port = 25; - - /** - * The SMTP HELO of the message. - * Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find - * one with the same method described above for $Hostname. - * @var string - * @see PHPMailer::$Hostname - */ - public $Helo = ''; - - /** - * What kind of encryption to use on the SMTP connection. - * Options: '', 'ssl' or 'tls' - * @var string - */ - public $SMTPSecure = ''; - - /** - * Whether to enable TLS encryption automatically if a server supports it, - * even if `SMTPSecure` is not set to 'tls'. - * Be aware that in PHP >= 5.6 this requires that the server's certificates are valid. - * @var boolean - */ - public $SMTPAutoTLS = true; - - /** - * Whether to use SMTP authentication. - * Uses the Username and Password properties. - * @var boolean - * @see PHPMailer::$Username - * @see PHPMailer::$Password - */ - public $SMTPAuth = false; - - /** - * Options array passed to stream_context_create when connecting via SMTP. - * @var array - */ - public $SMTPOptions = array(); - - /** - * SMTP username. - * @var string - */ - public $Username = ''; - - /** - * SMTP password. - * @var string - */ - public $Password = ''; - - /** - * SMTP auth type. - * Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified - * @var string - */ - public $AuthType = ''; - - /** - * SMTP realm. - * Used for NTLM auth - * @var string - */ - public $Realm = ''; - - /** - * SMTP workstation. - * Used for NTLM auth - * @var string - */ - public $Workstation = ''; - - /** - * The SMTP server timeout in seconds. - * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 - * @var integer - */ - public $Timeout = 300; - - /** - * SMTP class debug output mode. - * Debug output level. - * Options: - * * `0` No output - * * `1` Commands - * * `2` Data and commands - * * `3` As 2 plus connection status - * * `4` Low-level data output - * @var integer - * @see SMTP::$do_debug - */ - public $SMTPDebug = 0; - - /** - * How to handle debug output. - * Options: - * * `echo` Output plain-text as-is, appropriate for CLI - * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output - * * `error_log` Output to error log as configured in php.ini - * - * Alternatively, you can provide a callable expecting two params: a message string and the debug level: - * <code> - * $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";}; - * </code> - * @var string|callable - * @see SMTP::$Debugoutput - */ - public $Debugoutput = 'echo'; - - /** - * Whether to keep SMTP connection open after each message. - * If this is set to true then to close the connection - * requires an explicit call to smtpClose(). - * @var boolean - */ - public $SMTPKeepAlive = false; - - /** - * Whether to split multiple to addresses into multiple messages - * or send them all in one message. - * Only supported in `mail` and `sendmail` transports, not in SMTP. - * @var boolean - */ - public $SingleTo = false; - - /** - * Storage for addresses when SingleTo is enabled. - * @var array - * @TODO This should really not be public - */ - public $SingleToArray = array(); - - /** - * Whether to generate VERP addresses on send. - * Only applicable when sending via SMTP. - * @link https://en.wikipedia.org/wiki/Variable_envelope_return_path - * @link http://www.postfix.org/VERP_README.html Postfix VERP info - * @var boolean - */ - public $do_verp = false; - - /** - * Whether to allow sending messages with an empty body. - * @var boolean - */ - public $AllowEmpty = false; - - /** - * The default line ending. - * @note The default remains "\n". We force CRLF where we know - * it must be used via self::CRLF. - * @var string - */ - public $LE = "\n"; - - /** - * DKIM selector. - * @var string - */ - public $DKIM_selector = ''; - - /** - * DKIM Identity. - * Usually the email address used as the source of the email. - * @var string - */ - public $DKIM_identity = ''; - - /** - * DKIM passphrase. - * Used if your key is encrypted. - * @var string - */ - public $DKIM_passphrase = ''; - - /** - * DKIM signing domain name. - * @example 'example.com' - * @var string - */ - public $DKIM_domain = ''; - - /** - * DKIM private key file path. - * @var string - */ - public $DKIM_private = ''; - - /** - * Callback Action function name. - * - * The function that handles the result of the send email action. - * It is called out by send() for each email sent. - * - * Value can be any php callable: http://www.php.net/is_callable - * - * Parameters: - * boolean $result result of the send action - * string $to email address of the recipient - * string $cc cc email addresses - * string $bcc bcc email addresses - * string $subject the subject - * string $body the email body - * string $from email address of sender - * @var string - */ - public $action_function = ''; - - /** - * What to put in the X-Mailer header. - * Options: An empty string for PHPMailer default, whitespace for none, or a string to use - * @var string - */ - public $XMailer = ''; - - /** - * Which validator to use by default when validating email addresses. - * May be a callable to inject your own validator, but there are several built-in validators. - * @see PHPMailer::validateAddress() - * @var string|callable - * @static - */ - public static $validator = 'auto'; - - /** - * An instance of the SMTP sender class. - * @var SMTP - * @access protected - */ - protected $smtp = null; - - /** - * The array of 'to' names and addresses. - * @var array - * @access protected - */ - protected $to = array(); - - /** - * The array of 'cc' names and addresses. - * @var array - * @access protected - */ - protected $cc = array(); - - /** - * The array of 'bcc' names and addresses. - * @var array - * @access protected - */ - protected $bcc = array(); - - /** - * The array of reply-to names and addresses. - * @var array - * @access protected - */ - protected $ReplyTo = array(); - - /** - * An array of all kinds of addresses. - * Includes all of $to, $cc, $bcc - * @var array - * @access protected - * @see PHPMailer::$to @see PHPMailer::$cc @see PHPMailer::$bcc - */ - protected $all_recipients = array(); - - /** - * An array of names and addresses queued for validation. - * In send(), valid and non duplicate entries are moved to $all_recipients - * and one of $to, $cc, or $bcc. - * This array is used only for addresses with IDN. - * @var array - * @access protected - * @see PHPMailer::$to @see PHPMailer::$cc @see PHPMailer::$bcc - * @see PHPMailer::$all_recipients - */ - protected $RecipientsQueue = array(); - - /** - * An array of reply-to names and addresses queued for validation. - * In send(), valid and non duplicate entries are moved to $ReplyTo. - * This array is used only for addresses with IDN. - * @var array - * @access protected - * @see PHPMailer::$ReplyTo - */ - protected $ReplyToQueue = array(); - - /** - * The array of attachments. - * @var array - * @access protected - */ - protected $attachment = array(); - - /** - * The array of custom headers. - * @var array - * @access protected - */ - protected $CustomHeader = array(); - - /** - * The most recent Message-ID (including angular brackets). - * @var string - * @access protected - */ - protected $lastMessageID = ''; - - /** - * The message's MIME type. - * @var string - * @access protected - */ - protected $message_type = ''; - - /** - * The array of MIME boundary strings. - * @var array - * @access protected - */ - protected $boundary = array(); - - /** - * The array of available languages. - * @var array - * @access protected - */ - protected $language = array(); - - /** - * The number of errors encountered. - * @var integer - * @access protected - */ - protected $error_count = 0; - - /** - * The S/MIME certificate file path. - * @var string - * @access protected - */ - protected $sign_cert_file = ''; - - /** - * The S/MIME key file path. - * @var string - * @access protected - */ - protected $sign_key_file = ''; - - /** - * The optional S/MIME extra certificates ("CA Chain") file path. - * @var string - * @access protected - */ - protected $sign_extracerts_file = ''; - - /** - * The S/MIME password for the key. - * Used only if the key is encrypted. - * @var string - * @access protected - */ - protected $sign_key_pass = ''; - - /** - * Whether to throw exceptions for errors. - * @var boolean - * @access protected - */ - protected $exceptions = false; - - /** - * Unique ID used for message ID and boundaries. - * @var string - * @access protected - */ - protected $uniqueid = ''; - - /** - * Error severity: message only, continue processing. - */ - const STOP_MESSAGE = 0; - - /** - * Error severity: message, likely ok to continue processing. - */ - const STOP_CONTINUE = 1; - - /** - * Error severity: message, plus full stop, critical error reached. - */ - const STOP_CRITICAL = 2; - - /** - * SMTP RFC standard line ending. - */ - const CRLF = "\r\n"; - - /** - * The maximum line length allowed by RFC 2822 section 2.1.1 - * @var integer - */ - const MAX_LINE_LENGTH = 998; - - /** - * Constructor. - * @param boolean $exceptions Should we throw external exceptions? - */ - public function __construct($exceptions = null) - { - if ($exceptions !== null) { - $this->exceptions = (boolean)$exceptions; - } - } - - /** - * Destructor. - */ - public function __destruct() - { - //Close any open SMTP connection nicely - $this->smtpClose(); - } - - /** - * Call mail() in a safe_mode-aware fashion. - * Also, unless sendmail_path points to sendmail (or something that - * claims to be sendmail), don't pass params (not a perfect fix, - * but it will do) - * @param string $to To - * @param string $subject Subject - * @param string $body Message Body - * @param string $header Additional Header(s) - * @param string $params Params - * @access private - * @return boolean - */ - private function mailPassthru($to, $subject, $body, $header, $params) - { - //Check overloading of mail function to avoid double-encoding - if (ini_get('mbstring.func_overload') & 1) { - $subject = $this->secureHeader($subject); - } else { - $subject = $this->encodeHeader($this->secureHeader($subject)); - } - //Can't use additional_parameters in safe_mode - //@link http://php.net/manual/en/function.mail.php - if (ini_get('safe_mode') or !$this->UseSendmailOptions) { - $result = @mail($to, $subject, $body, $header); - } else { - $result = @mail($to, $subject, $body, $header, $params); - } - return $result; - } - - /** - * Output debugging info via user-defined method. - * Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug). - * @see PHPMailer::$Debugoutput - * @see PHPMailer::$SMTPDebug - * @param string $str - */ - protected function edebug($str) - { - if ($this->SMTPDebug <= 0) { - return; - } - //Avoid clash with built-in function names - if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) { - call_user_func($this->Debugoutput, $str, $this->SMTPDebug); - return; - } - switch ($this->Debugoutput) { - case 'error_log': - //Don't output, just log - error_log($str); - break; - case 'html': - //Cleans up output a bit for a better looking, HTML-safe output - echo htmlentities( - preg_replace('/[\r\n]+/', '', $str), - ENT_QUOTES, - 'UTF-8' - ) - . "<br>\n"; - break; - case 'echo': - default: - //Normalize line breaks - $str = preg_replace('/\r\n?/ms', "\n", $str); - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( - "\n", - "\n \t ", - trim($str) - ) . "\n"; - } - } - - /** - * Sets message type to HTML or plain. - * @param boolean $isHtml True for HTML mode. - * @return void - */ - public function isHTML($isHtml = true) - { - if ($isHtml) { - $this->ContentType = 'text/html'; - } else { - $this->ContentType = 'text/plain'; - } - } - - /** - * Send messages using SMTP. - * @return void - */ - public function isSMTP() - { - $this->Mailer = 'smtp'; - } - - /** - * Send messages using PHP's mail() function. - * @return void - */ - public function isMail() - { - $this->Mailer = 'mail'; - } - - /** - * Send messages using $Sendmail. - * @return void - */ - public function isSendmail() - { - $ini_sendmail_path = ini_get('sendmail_path'); - - if (!stristr($ini_sendmail_path, 'sendmail')) { - $this->Sendmail = '/usr/sbin/sendmail'; - } else { - $this->Sendmail = $ini_sendmail_path; - } - $this->Mailer = 'sendmail'; - } - - /** - * Send messages using qmail. - * @return void - */ - public function isQmail() - { - $ini_sendmail_path = ini_get('sendmail_path'); - - if (!stristr($ini_sendmail_path, 'qmail')) { - $this->Sendmail = '/var/qmail/bin/qmail-inject'; - } else { - $this->Sendmail = $ini_sendmail_path; - } - $this->Mailer = 'qmail'; - } - - /** - * Add a "To" address. - * @param string $address The email address to send to - * @param string $name - * @return boolean true on success, false if address already used or invalid in some way - */ - public function addAddress($address, $name = '') - { - return $this->addOrEnqueueAnAddress('to', $address, $name); - } - - /** - * Add a "CC" address. - * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer. - * @param string $address The email address to send to - * @param string $name - * @return boolean true on success, false if address already used or invalid in some way - */ - public function addCC($address, $name = '') - { - return $this->addOrEnqueueAnAddress('cc', $address, $name); - } - - /** - * Add a "BCC" address. - * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer. - * @param string $address The email address to send to - * @param string $name - * @return boolean true on success, false if address already used or invalid in some way - */ - public function addBCC($address, $name = '') - { - return $this->addOrEnqueueAnAddress('bcc', $address, $name); - } - - /** - * Add a "Reply-To" address. - * @param string $address The email address to reply to - * @param string $name - * @return boolean true on success, false if address already used or invalid in some way - */ - public function addReplyTo($address, $name = '') - { - return $this->addOrEnqueueAnAddress('Reply-To', $address, $name); - } - - /** - * Add an address to one of the recipient arrays or to the ReplyTo array. Because PHPMailer - * can't validate addresses with an IDN without knowing the PHPMailer::$CharSet (that can still - * be modified after calling this function), addition of such addresses is delayed until send(). - * Addresses that have been added already return false, but do not throw exceptions. - * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo' - * @param string $address The email address to send, resp. to reply to - * @param string $name - * @throws phpmailerException - * @return boolean true on success, false if address already used or invalid in some way - * @access protected - */ - protected function addOrEnqueueAnAddress($kind, $address, $name) - { - $address = trim($address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - if (($pos = strrpos($address, '@')) === false) { - // At-sign is misssing. - $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address"; - $this->setError($error_message); - $this->edebug($error_message); - if ($this->exceptions) { - throw new phpmailerException($error_message); - } - return false; - } - $params = array($kind, $address, $name); - // Enqueue addresses with IDN until we know the PHPMailer::$CharSet. - if ($this->has8bitChars(substr($address, ++$pos)) and $this->idnSupported()) { - if ($kind != 'Reply-To') { - if (!array_key_exists($address, $this->RecipientsQueue)) { - $this->RecipientsQueue[$address] = $params; - return true; - } - } else { - if (!array_key_exists($address, $this->ReplyToQueue)) { - $this->ReplyToQueue[$address] = $params; - return true; - } - } - return false; - } - // Immediately add standard addresses without IDN. - return call_user_func_array(array($this, 'addAnAddress'), $params); - } - - /** - * Add an address to one of the recipient arrays or to the ReplyTo array. - * Addresses that have been added already return false, but do not throw exceptions. - * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo' - * @param string $address The email address to send, resp. to reply to - * @param string $name - * @throws phpmailerException - * @return boolean true on success, false if address already used or invalid in some way - * @access protected - */ - protected function addAnAddress($kind, $address, $name = '') - { - if (!in_array($kind, array('to', 'cc', 'bcc', 'Reply-To'))) { - $error_message = $this->lang('Invalid recipient kind: ') . $kind; - $this->setError($error_message); - $this->edebug($error_message); - if ($this->exceptions) { - throw new phpmailerException($error_message); - } - return false; - } - if (!$this->validateAddress($address)) { - $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address"; - $this->setError($error_message); - $this->edebug($error_message); - if ($this->exceptions) { - throw new phpmailerException($error_message); - } - return false; - } - if ($kind != 'Reply-To') { - if (!array_key_exists(strtolower($address), $this->all_recipients)) { - array_push($this->$kind, array($address, $name)); - $this->all_recipients[strtolower($address)] = true; - return true; - } - } else { - if (!array_key_exists(strtolower($address), $this->ReplyTo)) { - $this->ReplyTo[strtolower($address)] = array($address, $name); - return true; - } - } - return false; - } - - /** - * Parse and validate a string containing one or more RFC822-style comma-separated email addresses - * of the form "display name <address>" into an array of name/address pairs. - * Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available. - * Note that quotes in the name part are removed. - * @param string $addrstr The address list string - * @param bool $useimap Whether to use the IMAP extension to parse the list - * @return array - * @link http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation - */ - public function parseAddresses($addrstr, $useimap = true) - { - $addresses = array(); - if ($useimap and function_exists('imap_rfc822_parse_adrlist')) { - //Use this built-in parser if it's available - $list = imap_rfc822_parse_adrlist($addrstr, ''); - foreach ($list as $address) { - if ($address->host != '.SYNTAX-ERROR.') { - if ($this->validateAddress($address->mailbox . '@' . $address->host)) { - $addresses[] = array( - 'name' => (property_exists($address, 'personal') ? $address->personal : ''), - 'address' => $address->mailbox . '@' . $address->host - ); - } - } - } - } else { - //Use this simpler parser - $list = explode(',', $addrstr); - foreach ($list as $address) { - $address = trim($address); - //Is there a separate name part? - if (strpos($address, '<') === false) { - //No separate name, just use the whole thing - if ($this->validateAddress($address)) { - $addresses[] = array( - 'name' => '', - 'address' => $address - ); - } - } else { - list($name, $email) = explode('<', $address); - $email = trim(str_replace('>', '', $email)); - if ($this->validateAddress($email)) { - $addresses[] = array( - 'name' => trim(str_replace(array('"', "'"), '', $name)), - 'address' => $email - ); - } - } - } - } - return $addresses; - } - - /** - * Set the From and FromName properties. - * @param string $address - * @param string $name - * @param boolean $auto Whether to also set the Sender address, defaults to true - * @throws phpmailerException - * @return boolean - */ - public function setFrom($address, $name = '', $auto = true) - { - $address = trim($address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - // Don't validate now addresses with IDN. Will be done in send(). - if (($pos = strrpos($address, '@')) === false or - (!$this->has8bitChars(substr($address, ++$pos)) or !$this->idnSupported()) and - !$this->validateAddress($address)) { - $error_message = $this->lang('invalid_address') . " (setFrom) $address"; - $this->setError($error_message); - $this->edebug($error_message); - if ($this->exceptions) { - throw new phpmailerException($error_message); - } - return false; - } - $this->From = $address; - $this->FromName = $name; - if ($auto) { - if (empty($this->Sender)) { - $this->Sender = $address; - } - } - return true; - } - - /** - * Return the Message-ID header of the last email. - * Technically this is the value from the last time the headers were created, - * but it's also the message ID of the last sent message except in - * pathological cases. - * @return string - */ - public function getLastMessageID() - { - return $this->lastMessageID; - } - - /** - * Check that a string looks like an email address. - * @param string $address The email address to check - * @param string|callable $patternselect A selector for the validation pattern to use : - * * `auto` Pick best pattern automatically; - * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14; - * * `pcre` Use old PCRE implementation; - * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; - * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. - * * `noregex` Don't use a regex: super fast, really dumb. - * Alternatively you may pass in a callable to inject your own validator, for example: - * PHPMailer::validateAddress('user@example.com', function($address) { - * return (strpos($address, '@') !== false); - * }); - * You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator. - * @return boolean - * @static - * @access public - */ - public static function validateAddress($address, $patternselect = null) - { - if (is_null($patternselect)) { - $patternselect = self::$validator; - } - if (is_callable($patternselect)) { - return call_user_func($patternselect, $address); - } - //Reject line breaks in addresses; it's valid RFC5322, but not RFC5321 - if (strpos($address, "\n") !== false or strpos($address, "\r") !== false) { - return false; - } - if (!$patternselect or $patternselect == 'auto') { - //Check this constant first so it works when extension_loaded() is disabled by safe mode - //Constant was added in PHP 5.2.4 - if (defined('PCRE_VERSION')) { - //This pattern can get stuck in a recursive loop in PCRE <= 8.0.2 - if (version_compare(PCRE_VERSION, '8.0.3') >= 0) { - $patternselect = 'pcre8'; - } else { - $patternselect = 'pcre'; - } - } elseif (function_exists('extension_loaded') and extension_loaded('pcre')) { - //Fall back to older PCRE - $patternselect = 'pcre'; - } else { - //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension - if (version_compare(PHP_VERSION, '5.2.0') >= 0) { - $patternselect = 'php'; - } else { - $patternselect = 'noregex'; - } - } - } - switch ($patternselect) { - case 'pcre8': - /** - * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains. - * @link http://squiloople.com/2009/12/20/email-address-validation/ - * @copyright 2009-2010 Michael Rushton - * Feel free to use and redistribute this code. But please keep this copyright notice. - */ - return (boolean)preg_match( - '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' . - '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' . - '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' . - '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' . - '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' . - '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' . - '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' . - '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' . - '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', - $address - ); - case 'pcre': - //An older regex that doesn't need a recent PCRE - return (boolean)preg_match( - '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' . - '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' . - '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' . - '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' . - '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' . - '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' . - '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' . - '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' . - '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' . - '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD', - $address - ); - case 'html5': - /** - * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements. - * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email) - */ - return (boolean)preg_match( - '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' . - '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD', - $address - ); - case 'noregex': - //No PCRE! Do something _very_ approximate! - //Check the address is 3 chars or longer and contains an @ that's not the first or last char - return (strlen($address) >= 3 - and strpos($address, '@') >= 1 - and strpos($address, '@') != strlen($address) - 1); - case 'php': - default: - return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL); - } - } - - /** - * Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the - * "intl" and "mbstring" PHP extensions. - * @return bool "true" if required functions for IDN support are present - */ - public function idnSupported() - { - // @TODO: Write our own "idn_to_ascii" function for PHP <= 5.2. - return function_exists('idn_to_ascii') and function_exists('mb_convert_encoding'); - } - - /** - * Converts IDN in given email address to its ASCII form, also known as punycode, if possible. - * Important: Address must be passed in same encoding as currently set in PHPMailer::$CharSet. - * This function silently returns unmodified address if: - * - No conversion is necessary (i.e. domain name is not an IDN, or is already in ASCII form) - * - Conversion to punycode is impossible (e.g. required PHP functions are not available) - * or fails for any reason (e.g. domain has characters not allowed in an IDN) - * @see PHPMailer::$CharSet - * @param string $address The email address to convert - * @return string The encoded address in ASCII form - */ - public function punyencodeAddress($address) - { - // Verify we have required functions, CharSet, and at-sign. - if ($this->idnSupported() and - !empty($this->CharSet) and - ($pos = strrpos($address, '@')) !== false) { - $domain = substr($address, ++$pos); - // Verify CharSet string is a valid one, and domain properly encoded in this CharSet. - if ($this->has8bitChars($domain) and @mb_check_encoding($domain, $this->CharSet)) { - $domain = mb_convert_encoding($domain, 'UTF-8', $this->CharSet); - if (($punycode = defined('INTL_IDNA_VARIANT_UTS46') ? - idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46) : - idn_to_ascii($domain)) !== false) { - return substr($address, 0, $pos) . $punycode; - } - } - } - return $address; - } - - /** - * Create a message and send it. - * Uses the sending method specified by $Mailer. - * @throws phpmailerException - * @return boolean false on error - See the ErrorInfo property for details of the error. - */ - public function send() - { - try { - if (!$this->preSend()) { - return false; - } - return $this->postSend(); - } catch (phpmailerException $exc) { - $this->mailHeader = ''; - $this->setError($exc->getMessage()); - if ($this->exceptions) { - throw $exc; - } - return false; - } - } - - /** - * Prepare a message for sending. - * @throws phpmailerException - * @return boolean - */ - public function preSend() - { - try { - $this->error_count = 0; // Reset errors - $this->mailHeader = ''; - - // Dequeue recipient and Reply-To addresses with IDN - foreach (array_merge($this->RecipientsQueue, $this->ReplyToQueue) as $params) { - $params[1] = $this->punyencodeAddress($params[1]); - call_user_func_array(array($this, 'addAnAddress'), $params); - } - if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { - throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL); - } - - // Validate From, Sender, and ConfirmReadingTo addresses - foreach (array('From', 'Sender', 'ConfirmReadingTo') as $address_kind) { - $this->$address_kind = trim($this->$address_kind); - if (empty($this->$address_kind)) { - continue; - } - $this->$address_kind = $this->punyencodeAddress($this->$address_kind); - if (!$this->validateAddress($this->$address_kind)) { - $error_message = $this->lang('invalid_address') . ' (punyEncode) ' . $this->$address_kind; - $this->setError($error_message); - $this->edebug($error_message); - if ($this->exceptions) { - throw new phpmailerException($error_message); - } - return false; - } - } - - // Set whether the message is multipart/alternative - if ($this->alternativeExists()) { - $this->ContentType = 'multipart/alternative'; - } - - $this->setMessageType(); - // Refuse to send an empty message unless we are specifically allowing it - if (!$this->AllowEmpty and empty($this->Body)) { - throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL); - } - - // Create body before headers in case body makes changes to headers (e.g. altering transfer encoding) - $this->MIMEHeader = ''; - $this->MIMEBody = $this->createBody(); - // createBody may have added some headers, so retain them - $tempheaders = $this->MIMEHeader; - $this->MIMEHeader = $this->createHeader(); - $this->MIMEHeader .= $tempheaders; - - // To capture the complete message when using mail(), create - // an extra header list which createHeader() doesn't fold in - if ($this->Mailer == 'mail') { - if (count($this->to) > 0) { - $this->mailHeader .= $this->addrAppend('To', $this->to); - } else { - $this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;'); - } - $this->mailHeader .= $this->headerLine( - 'Subject', - $this->encodeHeader($this->secureHeader(trim($this->Subject))) - ); - } - - // Sign with DKIM if enabled - if (!empty($this->DKIM_domain) - && !empty($this->DKIM_private) - && !empty($this->DKIM_selector) - && file_exists($this->DKIM_private)) { - $header_dkim = $this->DKIM_Add( - $this->MIMEHeader . $this->mailHeader, - $this->encodeHeader($this->secureHeader($this->Subject)), - $this->MIMEBody - ); - $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF . - str_replace("\r\n", "\n", $header_dkim) . self::CRLF; - } - return true; - } catch (phpmailerException $exc) { - $this->setError($exc->getMessage()); - if ($this->exceptions) { - throw $exc; - } - return false; - } - } - - /** - * Actually send a message. - * Send the email via the selected mechanism - * @throws phpmailerException - * @return boolean - */ - public function postSend() - { - try { - // Choose the mailer and send through it - switch ($this->Mailer) { - case 'sendmail': - case 'qmail': - return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody); - case 'smtp': - return $this->smtpSend($this->MIMEHeader, $this->MIMEBody); - case 'mail': - return $this->mailSend($this->MIMEHeader, $this->MIMEBody); - default: - $sendMethod = $this->Mailer.'Send'; - if (method_exists($this, $sendMethod)) { - return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody); - } - - return $this->mailSend($this->MIMEHeader, $this->MIMEBody); - } - } catch (phpmailerException $exc) { - $this->setError($exc->getMessage()); - $this->edebug($exc->getMessage()); - if ($this->exceptions) { - throw $exc; - } - } - return false; - } - - /** - * Send mail using the $Sendmail program. - * @param string $header The message headers - * @param string $body The message body - * @see PHPMailer::$Sendmail - * @throws phpmailerException - * @access protected - * @return boolean - */ - protected function sendmailSend($header, $body) - { - if ($this->Sender != '') { - if ($this->Mailer == 'qmail') { - $sendmail = sprintf('%s -f%s', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); - } else { - $sendmail = sprintf('%s -oi -f%s -t', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); - } - } else { - if ($this->Mailer == 'qmail') { - $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail)); - } else { - $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail)); - } - } - if ($this->SingleTo) { - foreach ($this->SingleToArray as $toAddr) { - if (!@$mail = popen($sendmail, 'w')) { - throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - fputs($mail, 'To: ' . $toAddr . "\n"); - fputs($mail, $header); - fputs($mail, $body); - $result = pclose($mail); - $this->doCallback( - ($result == 0), - array($toAddr), - $this->cc, - $this->bcc, - $this->Subject, - $body, - $this->From - ); - if ($result != 0) { - throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - } - } else { - if (!@$mail = popen($sendmail, 'w')) { - throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - fputs($mail, $header); - fputs($mail, $body); - $result = pclose($mail); - $this->doCallback( - ($result == 0), - $this->to, - $this->cc, - $this->bcc, - $this->Subject, - $body, - $this->From - ); - if ($result != 0) { - throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - } - return true; - } - - /** - * Send mail using the PHP mail() function. - * @param string $header The message headers - * @param string $body The message body - * @link http://www.php.net/manual/en/book.mail.php - * @throws phpmailerException - * @access protected - * @return boolean - */ - protected function mailSend($header, $body) - { - $toArr = array(); - foreach ($this->to as $toaddr) { - $toArr[] = $this->addrFormat($toaddr); - } - $to = implode(', ', $toArr); - - $params = null; - //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver - if (!empty($this->Sender)) { - $params = sprintf('-f%s', $this->Sender); - } - if ($this->Sender != '' and !ini_get('safe_mode')) { - $old_from = ini_get('sendmail_from'); - ini_set('sendmail_from', $this->Sender); - } - $result = false; - if ($this->SingleTo and count($toArr) > 1) { - foreach ($toArr as $toAddr) { - $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params); - $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From); - } - } else { - $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params); - $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From); - } - if (isset($old_from)) { - ini_set('sendmail_from', $old_from); - } - if (!$result) { - throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL); - } - return true; - } - - /** - * Get an instance to use for SMTP operations. - * Override this function to load your own SMTP implementation - * @return SMTP - */ - public function getSMTPInstance() - { - if (!is_object($this->smtp)) { - $this->smtp = new SMTP; - } - return $this->smtp; - } - - /** - * Send mail via SMTP. - * Returns false if there is a bad MAIL FROM, RCPT, or DATA input. - * Uses the PHPMailerSMTP class by default. - * @see PHPMailer::getSMTPInstance() to use a different class. - * @param string $header The message headers - * @param string $body The message body - * @throws phpmailerException - * @uses SMTP - * @access protected - * @return boolean - */ - protected function smtpSend($header, $body) - { - $bad_rcpt = array(); - if (!$this->smtpConnect($this->SMTPOptions)) { - throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL); - } - if ('' == $this->Sender) { - $smtp_from = $this->From; - } else { - $smtp_from = $this->Sender; - } - if (!$this->smtp->mail($smtp_from)) { - $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError())); - throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL); - } - - // Attempt to send to all recipients - foreach (array($this->to, $this->cc, $this->bcc) as $togroup) { - foreach ($togroup as $to) { - if (!$this->smtp->recipient($to[0])) { - $error = $this->smtp->getError(); - $bad_rcpt[] = array('to' => $to[0], 'error' => $error['detail']); - $isSent = false; - } else { - $isSent = true; - } - $this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From); - } - } - - // Only send the DATA command if we have viable recipients - if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) { - throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL); - } - if ($this->SMTPKeepAlive) { - $this->smtp->reset(); - } else { - $this->smtp->quit(); - $this->smtp->close(); - } - //Create error message for any bad addresses - if (count($bad_rcpt) > 0) { - $errstr = ''; - foreach ($bad_rcpt as $bad) { - $errstr .= $bad['to'] . ': ' . $bad['error']; - } - throw new phpmailerException( - $this->lang('recipients_failed') . $errstr, - self::STOP_CONTINUE - ); - } - return true; - } - - /** - * Initiate a connection to an SMTP server. - * Returns false if the operation failed. - * @param array $options An array of options compatible with stream_context_create() - * @uses SMTP - * @access public - * @throws phpmailerException - * @return boolean - */ - public function smtpConnect($options = null) - { - if (is_null($this->smtp)) { - $this->smtp = $this->getSMTPInstance(); - } - - //If no options are provided, use whatever is set in the instance - if (is_null($options)) { - $options = $this->SMTPOptions; - } - - // Already connected? - if ($this->smtp->connected()) { - return true; - } - - $this->smtp->setTimeout($this->Timeout); - $this->smtp->setDebugLevel($this->SMTPDebug); - $this->smtp->setDebugOutput($this->Debugoutput); - $this->smtp->setVerp($this->do_verp); - $hosts = explode(';', $this->Host); - $lastexception = null; - - foreach ($hosts as $hostentry) { - $hostinfo = array(); - if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) { - // Not a valid host entry - continue; - } - // $hostinfo[2]: optional ssl or tls prefix - // $hostinfo[3]: the hostname - // $hostinfo[4]: optional port number - // The host string prefix can temporarily override the current setting for SMTPSecure - // If it's not specified, the default value is used - $prefix = ''; - $secure = $this->SMTPSecure; - $tls = ($this->SMTPSecure == 'tls'); - if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) { - $prefix = 'ssl://'; - $tls = false; // Can't have SSL and TLS at the same time - $secure = 'ssl'; - } elseif ($hostinfo[2] == 'tls') { - $tls = true; - // tls doesn't use a prefix - $secure = 'tls'; - } - //Do we need the OpenSSL extension? - $sslext = defined('OPENSSL_ALGO_SHA1'); - if ('tls' === $secure or 'ssl' === $secure) { - //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled - if (!$sslext) { - throw new phpmailerException($this->lang('extension_missing').'openssl', self::STOP_CRITICAL); - } - } - $host = $hostinfo[3]; - $port = $this->Port; - $tport = (integer)$hostinfo[4]; - if ($tport > 0 and $tport < 65536) { - $port = $tport; - } - if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) { - try { - if ($this->Helo) { - $hello = $this->Helo; - } else { - $hello = $this->serverHostname(); - } - $this->smtp->hello($hello); - //Automatically enable TLS encryption if: - // * it's not disabled - // * we have openssl extension - // * we are not already using SSL - // * the server offers STARTTLS - if ($this->SMTPAutoTLS and $sslext and $secure != 'ssl' and $this->smtp->getServerExt('STARTTLS')) { - $tls = true; - } - if ($tls) { - if (!$this->smtp->startTLS()) { - throw new phpmailerException($this->lang('connect_host')); - } - // We must resend EHLO after TLS negotiation - $this->smtp->hello($hello); - } - if ($this->SMTPAuth) { - if (!$this->smtp->authenticate( - $this->Username, - $this->Password, - $this->AuthType, - $this->Realm, - $this->Workstation - ) - ) { - throw new phpmailerException($this->lang('authenticate')); - } - } - return true; - } catch (phpmailerException $exc) { - $lastexception = $exc; - $this->edebug($exc->getMessage()); - // We must have connected, but then failed TLS or Auth, so close connection nicely - $this->smtp->quit(); - } - } - } - // If we get here, all connection attempts have failed, so close connection hard - $this->smtp->close(); - // As we've caught all exceptions, just report whatever the last one was - if ($this->exceptions and !is_null($lastexception)) { - throw $lastexception; - } - return false; - } - - /** - * Close the active SMTP session if one exists. - * @return void - */ - public function smtpClose() - { - if (is_a($this->smtp, 'SMTP')) { - if ($this->smtp->connected()) { - $this->smtp->quit(); - $this->smtp->close(); - } - } - } - - /** - * Set the language for error messages. - * Returns false if it cannot load the language file. - * The default language is English. - * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr") - * @param string $lang_path Path to the language file directory, with trailing separator (slash) - * @return boolean - * @access public - */ - public function setLanguage($langcode = 'en', $lang_path = '') - { - // Define full set of translatable strings in English - $PHPMAILER_LANG = array( - 'authenticate' => 'SMTP Error: Could not authenticate.', - 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', - 'data_not_accepted' => 'SMTP Error: data not accepted.', - 'empty_message' => 'Message body empty', - 'encoding' => 'Unknown encoding: ', - 'execute' => 'Could not execute: ', - 'file_access' => 'Could not access file: ', - 'file_open' => 'File Error: Could not open file: ', - 'from_failed' => 'The following From address failed: ', - 'instantiate' => 'Could not instantiate mail function.', - 'invalid_address' => 'Invalid address: ', - 'mailer_not_supported' => ' mailer is not supported.', - 'provide_address' => 'You must provide at least one recipient email address.', - 'recipients_failed' => 'SMTP Error: The following recipients failed: ', - 'signing' => 'Signing Error: ', - 'smtp_connect_failed' => 'SMTP connect() failed.', - 'smtp_error' => 'SMTP server error: ', - 'variable_set' => 'Cannot set or reset variable: ', - 'extension_missing' => 'Extension missing: ' - ); - if (empty($lang_path)) { - // Calculate an absolute path so it can work if CWD is not here - $lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR; - } - $foundlang = true; - $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php'; - // There is no English translation file - if ($langcode != 'en') { - // Make sure language file path is readable - if (!is_readable($lang_file)) { - $foundlang = false; - } else { - // Overwrite language-specific strings. - // This way we'll never have missing translation keys. - $foundlang = include $lang_file; - } - } - $this->language = $PHPMAILER_LANG; - return (boolean)$foundlang; // Returns false if language not found - } - - /** - * Get the array of strings for the current language. - * @return array - */ - public function getTranslations() - { - return $this->language; - } - - /** - * Create recipient headers. - * @access public - * @param string $type - * @param array $addr An array of recipient, - * where each recipient is a 2-element indexed array with element 0 containing an address - * and element 1 containing a name, like: - * array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User')) - * @return string - */ - public function addrAppend($type, $addr) - { - $addresses = array(); - foreach ($addr as $address) { - $addresses[] = $this->addrFormat($address); - } - return $type . ': ' . implode(', ', $addresses) . $this->LE; - } - - /** - * Format an address for use in a message header. - * @access public - * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name - * like array('joe@example.com', 'Joe User') - * @return string - */ - public function addrFormat($addr) - { - if (empty($addr[1])) { // No name provided - return $this->secureHeader($addr[0]); - } else { - return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader( - $addr[0] - ) . '>'; - } - } - - /** - * Word-wrap message. - * For use with mailers that do not automatically perform wrapping - * and for quoted-printable encoded messages. - * Original written by philippe. - * @param string $message The message to wrap - * @param integer $length The line length to wrap to - * @param boolean $qp_mode Whether to run in Quoted-Printable mode - * @access public - * @return string - */ - public function wrapText($message, $length, $qp_mode = false) - { - if ($qp_mode) { - $soft_break = sprintf(' =%s', $this->LE); - } else { - $soft_break = $this->LE; - } - // If utf-8 encoding is used, we will need to make sure we don't - // split multibyte characters when we wrap - $is_utf8 = (strtolower($this->CharSet) == 'utf-8'); - $lelen = strlen($this->LE); - $crlflen = strlen(self::CRLF); - - $message = $this->fixEOL($message); - //Remove a trailing line break - if (substr($message, -$lelen) == $this->LE) { - $message = substr($message, 0, -$lelen); - } - - //Split message into lines - $lines = explode($this->LE, $message); - //Message will be rebuilt in here - $message = ''; - foreach ($lines as $line) { - $words = explode(' ', $line); - $buf = ''; - $firstword = true; - foreach ($words as $word) { - if ($qp_mode and (strlen($word) > $length)) { - $space_left = $length - strlen($buf) - $crlflen; - if (!$firstword) { - if ($space_left > 20) { - $len = $space_left; - if ($is_utf8) { - $len = $this->utf8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == '=') { - $len--; - } elseif (substr($word, $len - 2, 1) == '=') { - $len -= 2; - } - $part = substr($word, 0, $len); - $word = substr($word, $len); - $buf .= ' ' . $part; - $message .= $buf . sprintf('=%s', self::CRLF); - } else { - $message .= $buf . $soft_break; - } - $buf = ''; - } - while (strlen($word) > 0) { - if ($length <= 0) { - break; - } - $len = $length; - if ($is_utf8) { - $len = $this->utf8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == '=') { - $len--; - } elseif (substr($word, $len - 2, 1) == '=') { - $len -= 2; - } - $part = substr($word, 0, $len); - $word = substr($word, $len); - - if (strlen($word) > 0) { - $message .= $part . sprintf('=%s', self::CRLF); - } else { - $buf = $part; - } - } - } else { - $buf_o = $buf; - if (!$firstword) { - $buf .= ' '; - } - $buf .= $word; - - if (strlen($buf) > $length and $buf_o != '') { - $message .= $buf_o . $soft_break; - $buf = $word; - } - } - $firstword = false; - } - $message .= $buf . self::CRLF; - } - - return $message; - } - - /** - * Find the last character boundary prior to $maxLength in a utf-8 - * quoted-printable encoded string. - * Original written by Colin Brown. - * @access public - * @param string $encodedText utf-8 QP text - * @param integer $maxLength Find the last character boundary prior to this length - * @return integer - */ - public function utf8CharBoundary($encodedText, $maxLength) - { - $foundSplitPos = false; - $lookBack = 3; - while (!$foundSplitPos) { - $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack); - $encodedCharPos = strpos($lastChunk, '='); - if (false !== $encodedCharPos) { - // Found start of encoded character byte within $lookBack block. - // Check the encoded byte value (the 2 chars after the '=') - $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); - $dec = hexdec($hex); - if ($dec < 128) { - // Single byte character. - // If the encoded char was found at pos 0, it will fit - // otherwise reduce maxLength to start of the encoded char - if ($encodedCharPos > 0) { - $maxLength = $maxLength - ($lookBack - $encodedCharPos); - } - $foundSplitPos = true; - } elseif ($dec >= 192) { - // First byte of a multi byte character - // Reduce maxLength to split at start of character - $maxLength = $maxLength - ($lookBack - $encodedCharPos); - $foundSplitPos = true; - } elseif ($dec < 192) { - // Middle byte of a multi byte character, look further back - $lookBack += 3; - } - } else { - // No encoded character found - $foundSplitPos = true; - } - } - return $maxLength; - } - - /** - * Apply word wrapping to the message body. - * Wraps the message body to the number of chars set in the WordWrap property. - * You should only do this to plain-text bodies as wrapping HTML tags may break them. - * This is called automatically by createBody(), so you don't need to call it yourself. - * @access public - * @return void - */ - public function setWordWrap() - { - if ($this->WordWrap < 1) { - return; - } - - switch ($this->message_type) { - case 'alt': - case 'alt_inline': - case 'alt_attach': - case 'alt_inline_attach': - $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap); - break; - default: - $this->Body = $this->wrapText($this->Body, $this->WordWrap); - break; - } - } - - /** - * Assemble message headers. - * @access public - * @return string The assembled headers - */ - public function createHeader() - { - $result = ''; - - if ($this->MessageDate == '') { - $this->MessageDate = self::rfcDate(); - } - $result .= $this->headerLine('Date', $this->MessageDate); - - // To be created automatically by mail() - if ($this->SingleTo) { - if ($this->Mailer != 'mail') { - foreach ($this->to as $toaddr) { - $this->SingleToArray[] = $this->addrFormat($toaddr); - } - } - } else { - if (count($this->to) > 0) { - if ($this->Mailer != 'mail') { - $result .= $this->addrAppend('To', $this->to); - } - } elseif (count($this->cc) == 0) { - $result .= $this->headerLine('To', 'undisclosed-recipients:;'); - } - } - - $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName))); - - // sendmail and mail() extract Cc from the header before sending - if (count($this->cc) > 0) { - $result .= $this->addrAppend('Cc', $this->cc); - } - - // sendmail and mail() extract Bcc from the header before sending - if (( - $this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail' - ) - and count($this->bcc) > 0 - ) { - $result .= $this->addrAppend('Bcc', $this->bcc); - } - - if (count($this->ReplyTo) > 0) { - $result .= $this->addrAppend('Reply-To', $this->ReplyTo); - } - - // mail() sets the subject itself - if ($this->Mailer != 'mail') { - $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject))); - } - - if ('' != $this->MessageID and preg_match('/^<.*@.*>$/', $this->MessageID)) { - $this->lastMessageID = $this->MessageID; - } else { - $this->lastMessageID = sprintf('<%s@%s>', $this->uniqueid, $this->serverHostname()); - } - $result .= $this->headerLine('Message-ID', $this->lastMessageID); - if (!is_null($this->Priority)) { - $result .= $this->headerLine('X-Priority', $this->Priority); - } - if ($this->XMailer == '') { - $result .= $this->headerLine( - 'X-Mailer', - 'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer)' - ); - } else { - $myXmailer = trim($this->XMailer); - if ($myXmailer) { - $result .= $this->headerLine('X-Mailer', $myXmailer); - } - } - - if ($this->ConfirmReadingTo != '') { - $result .= $this->headerLine('Disposition-Notification-To', '<' . $this->ConfirmReadingTo . '>'); - } - - // Add custom headers - foreach ($this->CustomHeader as $header) { - $result .= $this->headerLine( - trim($header[0]), - $this->encodeHeader(trim($header[1])) - ); - } - if (!$this->sign_key_file) { - $result .= $this->headerLine('MIME-Version', '1.0'); - $result .= $this->getMailMIME(); - } - - return $result; - } - - /** - * Get the message MIME type headers. - * @access public - * @return string - */ - public function getMailMIME() - { - $result = ''; - $ismultipart = true; - switch ($this->message_type) { - case 'inline': - $result .= $this->headerLine('Content-Type', 'multipart/related;'); - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - case 'attach': - case 'inline_attach': - case 'alt_attach': - case 'alt_inline_attach': - $result .= $this->headerLine('Content-Type', 'multipart/mixed;'); - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - case 'alt': - case 'alt_inline': - $result .= $this->headerLine('Content-Type', 'multipart/alternative;'); - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - default: - // Catches case 'plain': and case '': - $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet); - $ismultipart = false; - break; - } - // RFC1341 part 5 says 7bit is assumed if not specified - if ($this->Encoding != '7bit') { - // RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE - if ($ismultipart) { - if ($this->Encoding == '8bit') { - $result .= $this->headerLine('Content-Transfer-Encoding', '8bit'); - } - // The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible - } else { - $result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding); - } - } - - if ($this->Mailer != 'mail') { - $result .= $this->LE; - } - - return $result; - } - - /** - * Returns the whole MIME message. - * Includes complete headers and body. - * Only valid post preSend(). - * @see PHPMailer::preSend() - * @access public - * @return string - */ - public function getSentMIMEMessage() - { - return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . self::CRLF . self::CRLF . $this->MIMEBody; - } - - /** - * Assemble the message body. - * Returns an empty string on failure. - * @access public - * @throws phpmailerException - * @return string The assembled message body - */ - public function createBody() - { - $body = ''; - //Create unique IDs and preset boundaries - $this->uniqueid = md5(uniqid(time())); - $this->boundary[1] = 'b1_' . $this->uniqueid; - $this->boundary[2] = 'b2_' . $this->uniqueid; - $this->boundary[3] = 'b3_' . $this->uniqueid; - - if ($this->sign_key_file) { - $body .= $this->getMailMIME() . $this->LE; - } - - $this->setWordWrap(); - - $bodyEncoding = $this->Encoding; - $bodyCharSet = $this->CharSet; - //Can we do a 7-bit downgrade? - if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) { - $bodyEncoding = '7bit'; - //All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit - $bodyCharSet = 'us-ascii'; - } - //If lines are too long, and we're not already using an encoding that will shorten them, - //change to quoted-printable transfer encoding for the body part only - if ('base64' != $this->Encoding and self::hasLineLongerThanMax($this->Body)) { - $bodyEncoding = 'quoted-printable'; - } - - $altBodyEncoding = $this->Encoding; - $altBodyCharSet = $this->CharSet; - //Can we do a 7-bit downgrade? - if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) { - $altBodyEncoding = '7bit'; - //All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit - $altBodyCharSet = 'us-ascii'; - } - //If lines are too long, and we're not already using an encoding that will shorten them, - //change to quoted-printable transfer encoding for the alt body part only - if ('base64' != $altBodyEncoding and self::hasLineLongerThanMax($this->AltBody)) { - $altBodyEncoding = 'quoted-printable'; - } - //Use this as a preamble in all multipart message types - $mimepre = "This is a multi-part message in MIME format." . $this->LE . $this->LE; - switch ($this->message_type) { - case 'inline': - $body .= $mimepre; - $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('inline', $this->boundary[1]); - break; - case 'attach': - $body .= $mimepre; - $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('attachment', $this->boundary[1]); - break; - case 'inline_attach': - $body .= $mimepre; - $body .= $this->textLine('--' . $this->boundary[1]); - $body .= $this->headerLine('Content-Type', 'multipart/related;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('inline', $this->boundary[2]); - $body .= $this->LE; - $body .= $this->attachAll('attachment', $this->boundary[1]); - break; - case 'alt': - $body .= $mimepre; - $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - if (!empty($this->Ical)) { - $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', ''); - $body .= $this->encodeString($this->Ical, $this->Encoding); - $body .= $this->LE . $this->LE; - } - $body .= $this->endBoundary($this->boundary[1]); - break; - case 'alt_inline': - $body .= $mimepre; - $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->textLine('--' . $this->boundary[1]); - $body .= $this->headerLine('Content-Type', 'multipart/related;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('inline', $this->boundary[2]); - $body .= $this->LE; - $body .= $this->endBoundary($this->boundary[1]); - break; - case 'alt_attach': - $body .= $mimepre; - $body .= $this->textLine('--' . $this->boundary[1]); - $body .= $this->headerLine('Content-Type', 'multipart/alternative;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->endBoundary($this->boundary[2]); - $body .= $this->LE; - $body .= $this->attachAll('attachment', $this->boundary[1]); - break; - case 'alt_inline_attach': - $body .= $mimepre; - $body .= $this->textLine('--' . $this->boundary[1]); - $body .= $this->headerLine('Content-Type', 'multipart/alternative;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->textLine('--' . $this->boundary[2]); - $body .= $this->headerLine('Content-Type', 'multipart/related;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('inline', $this->boundary[3]); - $body .= $this->LE; - $body .= $this->endBoundary($this->boundary[2]); - $body .= $this->LE; - $body .= $this->attachAll('attachment', $this->boundary[1]); - break; - default: - // Catch case 'plain' and case '', applies to simple `text/plain` and `text/html` body content types - //Reset the `Encoding` property in case we changed it for line length reasons - $this->Encoding = $bodyEncoding; - $body .= $this->encodeString($this->Body, $this->Encoding); - break; - } - - if ($this->isError()) { - $body = ''; - } elseif ($this->sign_key_file) { - try { - if (!defined('PKCS7_TEXT')) { - throw new phpmailerException($this->lang('extension_missing') . 'openssl'); - } - // @TODO would be nice to use php://temp streams here, but need to wrap for PHP < 5.1 - $file = tempnam(sys_get_temp_dir(), 'mail'); - if (false === file_put_contents($file, $body)) { - throw new phpmailerException($this->lang('signing') . ' Could not write temp file'); - } - $signed = tempnam(sys_get_temp_dir(), 'signed'); - //Workaround for PHP bug https://bugs.php.net/bug.php?id=69197 - if (empty($this->sign_extracerts_file)) { - $sign = @openssl_pkcs7_sign( - $file, - $signed, - 'file://' . realpath($this->sign_cert_file), - array('file://' . realpath($this->sign_key_file), $this->sign_key_pass), - null - ); - } else { - $sign = @openssl_pkcs7_sign( - $file, - $signed, - 'file://' . realpath($this->sign_cert_file), - array('file://' . realpath($this->sign_key_file), $this->sign_key_pass), - null, - PKCS7_DETACHED, - $this->sign_extracerts_file - ); - } - if ($sign) { - @unlink($file); - $body = file_get_contents($signed); - @unlink($signed); - //The message returned by openssl contains both headers and body, so need to split them up - $parts = explode("\n\n", $body, 2); - $this->MIMEHeader .= $parts[0] . $this->LE . $this->LE; - $body = $parts[1]; - } else { - @unlink($file); - @unlink($signed); - throw new phpmailerException($this->lang('signing') . openssl_error_string()); - } - } catch (phpmailerException $exc) { - $body = ''; - if ($this->exceptions) { - throw $exc; - } - } - } - return $body; - } - - /** - * Return the start of a message boundary. - * @access protected - * @param string $boundary - * @param string $charSet - * @param string $contentType - * @param string $encoding - * @return string - */ - protected function getBoundary($boundary, $charSet, $contentType, $encoding) - { - $result = ''; - if ($charSet == '') { - $charSet = $this->CharSet; - } - if ($contentType == '') { - $contentType = $this->ContentType; - } - if ($encoding == '') { - $encoding = $this->Encoding; - } - $result .= $this->textLine('--' . $boundary); - $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet); - $result .= $this->LE; - // RFC1341 part 5 says 7bit is assumed if not specified - if ($encoding != '7bit') { - $result .= $this->headerLine('Content-Transfer-Encoding', $encoding); - } - $result .= $this->LE; - - return $result; - } - - /** - * Return the end of a message boundary. - * @access protected - * @param string $boundary - * @return string - */ - protected function endBoundary($boundary) - { - return $this->LE . '--' . $boundary . '--' . $this->LE; - } - - /** - * Set the message type. - * PHPMailer only supports some preset message types, not arbitrary MIME structures. - * @access protected - * @return void - */ - protected function setMessageType() - { - $type = array(); - if ($this->alternativeExists()) { - $type[] = 'alt'; - } - if ($this->inlineImageExists()) { - $type[] = 'inline'; - } - if ($this->attachmentExists()) { - $type[] = 'attach'; - } - $this->message_type = implode('_', $type); - if ($this->message_type == '') { - //The 'plain' message_type refers to the message having a single body element, not that it is plain-text - $this->message_type = 'plain'; - } - } - - /** - * Format a header line. - * @access public - * @param string $name - * @param string $value - * @return string - */ - public function headerLine($name, $value) - { - return $name . ': ' . $value . $this->LE; - } - - /** - * Return a formatted mail line. - * @access public - * @param string $value - * @return string - */ - public function textLine($value) - { - return $value . $this->LE; - } - - /** - * Add an attachment from a path on the filesystem. - * Returns false if the file could not be found or read. - * @param string $path Path to the attachment. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @param string $disposition Disposition to use - * @throws phpmailerException - * @return boolean - */ - public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment') - { - try { - if (!@is_file($path)) { - throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE); - } - - // If a MIME type is not specified, try to work it out from the file name - if ($type == '') { - $type = self::filenameToType($path); - } - - $filename = basename($path); - if ($name == '') { - $name = $filename; - } - - $this->attachment[] = array( - 0 => $path, - 1 => $filename, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => false, // isStringAttachment - 6 => $disposition, - 7 => 0 - ); - - } catch (phpmailerException $exc) { - $this->setError($exc->getMessage()); - $this->edebug($exc->getMessage()); - if ($this->exceptions) { - throw $exc; - } - return false; - } - return true; - } - - /** - * Return the array of attachments. - * @return array - */ - public function getAttachments() - { - return $this->attachment; - } - - /** - * Attach all file, string, and binary attachments to the message. - * Returns an empty string on failure. - * @access protected - * @param string $disposition_type - * @param string $boundary - * @return string - */ - protected function attachAll($disposition_type, $boundary) - { - // Return text of body - $mime = array(); - $cidUniq = array(); - $incl = array(); - - // Add all attachments - foreach ($this->attachment as $attachment) { - // Check if it is a valid disposition_filter - if ($attachment[6] == $disposition_type) { - // Check for string attachment - $string = ''; - $path = ''; - $bString = $attachment[5]; - if ($bString) { - $string = $attachment[0]; - } else { - $path = $attachment[0]; - } - - $inclhash = md5(serialize($attachment)); - if (in_array($inclhash, $incl)) { - continue; - } - $incl[] = $inclhash; - $name = $attachment[2]; - $encoding = $attachment[3]; - $type = $attachment[4]; - $disposition = $attachment[6]; - $cid = $attachment[7]; - if ($disposition == 'inline' && array_key_exists($cid, $cidUniq)) { - continue; - } - $cidUniq[$cid] = true; - - $mime[] = sprintf('--%s%s', $boundary, $this->LE); - //Only include a filename property if we have one - if (!empty($name)) { - $mime[] = sprintf( - 'Content-Type: %s; name="%s"%s', - $type, - $this->encodeHeader($this->secureHeader($name)), - $this->LE - ); - } else { - $mime[] = sprintf( - 'Content-Type: %s%s', - $type, - $this->LE - ); - } - // RFC1341 part 5 says 7bit is assumed if not specified - if ($encoding != '7bit') { - $mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, $this->LE); - } - - if ($disposition == 'inline') { - $mime[] = sprintf('Content-ID: <%s>%s', $cid, $this->LE); - } - - // If a filename contains any of these chars, it should be quoted, - // but not otherwise: RFC2183 & RFC2045 5.1 - // Fixes a warning in IETF's msglint MIME checker - // Allow for bypassing the Content-Disposition header totally - if (!(empty($disposition))) { - $encoded_name = $this->encodeHeader($this->secureHeader($name)); - if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) { - $mime[] = sprintf( - 'Content-Disposition: %s; filename="%s"%s', - $disposition, - $encoded_name, - $this->LE . $this->LE - ); - } else { - if (!empty($encoded_name)) { - $mime[] = sprintf( - 'Content-Disposition: %s; filename=%s%s', - $disposition, - $encoded_name, - $this->LE . $this->LE - ); - } else { - $mime[] = sprintf( - 'Content-Disposition: %s%s', - $disposition, - $this->LE . $this->LE - ); - } - } - } else { - $mime[] = $this->LE; - } - - // Encode as string attachment - if ($bString) { - $mime[] = $this->encodeString($string, $encoding); - if ($this->isError()) { - return ''; - } - $mime[] = $this->LE . $this->LE; - } else { - $mime[] = $this->encodeFile($path, $encoding); - if ($this->isError()) { - return ''; - } - $mime[] = $this->LE . $this->LE; - } - } - } - - $mime[] = sprintf('--%s--%s', $boundary, $this->LE); - - return implode('', $mime); - } - - /** - * Encode a file attachment in requested format. - * Returns an empty string on failure. - * @param string $path The full path to the file - * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' - * @throws phpmailerException - * @access protected - * @return string - */ - protected function encodeFile($path, $encoding = 'base64') - { - try { - if (!is_readable($path)) { - throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE); - } - $magic_quotes = get_magic_quotes_runtime(); - if ($magic_quotes) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime(false); - } else { - //Doesn't exist in PHP 5.4, but we don't need to check because - //get_magic_quotes_runtime always returns false in 5.4+ - //so it will never get here - ini_set('magic_quotes_runtime', false); - } - } - $file_buffer = file_get_contents($path); - $file_buffer = $this->encodeString($file_buffer, $encoding); - if ($magic_quotes) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime($magic_quotes); - } else { - ini_set('magic_quotes_runtime', $magic_quotes); - } - } - return $file_buffer; - } catch (Exception $exc) { - $this->setError($exc->getMessage()); - return ''; - } - } - - /** - * Encode a string in requested format. - * Returns an empty string on failure. - * @param string $str The text to encode - * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' - * @access public - * @return string - */ - public function encodeString($str, $encoding = 'base64') - { - $encoded = ''; - switch (strtolower($encoding)) { - case 'base64': - $encoded = chunk_split(base64_encode($str), 76, $this->LE); - break; - case '7bit': - case '8bit': - $encoded = $this->fixEOL($str); - // Make sure it ends with a line break - if (substr($encoded, -(strlen($this->LE))) != $this->LE) { - $encoded .= $this->LE; - } - break; - case 'binary': - $encoded = $str; - break; - case 'quoted-printable': - $encoded = $this->encodeQP($str); - break; - default: - $this->setError($this->lang('encoding') . $encoding); - break; - } - return $encoded; - } - - /** - * Encode a header string optimally. - * Picks shortest of Q, B, quoted-printable or none. - * @access public - * @param string $str - * @param string $position - * @return string - */ - public function encodeHeader($str, $position = 'text') - { - $matchcount = 0; - switch (strtolower($position)) { - case 'phrase': - if (!preg_match('/[\200-\377]/', $str)) { - // Can't use addslashes as we don't know the value of magic_quotes_sybase - $encoded = addcslashes($str, "\0..\37\177\\\""); - if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { - return ($encoded); - } else { - return ("\"$encoded\""); - } - } - $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); - break; - /** @noinspection PhpMissingBreakStatementInspection */ - case 'comment': - $matchcount = preg_match_all('/[()"]/', $str, $matches); - // Intentional fall-through - case 'text': - default: - $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); - break; - } - - //There are no chars that need encoding - if ($matchcount == 0) { - return ($str); - } - - $maxlen = 75 - 7 - strlen($this->CharSet); - // Try to select the encoding which should produce the shortest output - if ($matchcount > strlen($str) / 3) { - // More than a third of the content will need encoding, so B encoding will be most efficient - $encoding = 'B'; - if (function_exists('mb_strlen') && $this->hasMultiBytes($str)) { - // Use a custom function which correctly encodes and wraps long - // multibyte strings without breaking lines within a character - $encoded = $this->base64EncodeWrapMB($str, "\n"); - } else { - $encoded = base64_encode($str); - $maxlen -= $maxlen % 4; - $encoded = trim(chunk_split($encoded, $maxlen, "\n")); - } - } else { - $encoding = 'Q'; - $encoded = $this->encodeQ($str, $position); - $encoded = $this->wrapText($encoded, $maxlen, true); - $encoded = str_replace('=' . self::CRLF, "\n", trim($encoded)); - } - - $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded); - $encoded = trim(str_replace("\n", $this->LE, $encoded)); - - return $encoded; - } - - /** - * Check if a string contains multi-byte characters. - * @access public - * @param string $str multi-byte text to wrap encode - * @return boolean - */ - public function hasMultiBytes($str) - { - if (function_exists('mb_strlen')) { - return (strlen($str) > mb_strlen($str, $this->CharSet)); - } else { // Assume no multibytes (we can't handle without mbstring functions anyway) - return false; - } - } - - /** - * Does a string contain any 8-bit chars (in any charset)? - * @param string $text - * @return boolean - */ - public function has8bitChars($text) - { - return (boolean)preg_match('/[\x80-\xFF]/', $text); - } - - /** - * Encode and wrap long multibyte strings for mail headers - * without breaking lines within a character. - * Adapted from a function by paravoid - * @link http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283 - * @access public - * @param string $str multi-byte text to wrap encode - * @param string $linebreak string to use as linefeed/end-of-line - * @return string - */ - public function base64EncodeWrapMB($str, $linebreak = null) - { - $start = '=?' . $this->CharSet . '?B?'; - $end = '?='; - $encoded = ''; - if ($linebreak === null) { - $linebreak = $this->LE; - } - - $mb_length = mb_strlen($str, $this->CharSet); - // Each line must have length <= 75, including $start and $end - $length = 75 - strlen($start) - strlen($end); - // Average multi-byte ratio - $ratio = $mb_length / strlen($str); - // Base64 has a 4:3 ratio - $avgLength = floor($length * $ratio * .75); - - for ($i = 0; $i < $mb_length; $i += $offset) { - $lookBack = 0; - do { - $offset = $avgLength - $lookBack; - $chunk = mb_substr($str, $i, $offset, $this->CharSet); - $chunk = base64_encode($chunk); - $lookBack++; - } while (strlen($chunk) > $length); - $encoded .= $chunk . $linebreak; - } - - // Chomp the last linefeed - $encoded = substr($encoded, 0, -strlen($linebreak)); - return $encoded; - } - - /** - * Encode a string in quoted-printable format. - * According to RFC2045 section 6.7. - * @access public - * @param string $string The text to encode - * @param integer $line_max Number of chars allowed on a line before wrapping - * @return string - * @link http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 Adapted from this comment - */ - public function encodeQP($string, $line_max = 76) - { - // Use native function if it's available (>= PHP5.3) - if (function_exists('quoted_printable_encode')) { - return quoted_printable_encode($string); - } - // Fall back to a pure PHP implementation - $string = str_replace( - array('%20', '%0D%0A.', '%0D%0A', '%'), - array(' ', "\r\n=2E", "\r\n", '='), - rawurlencode($string) - ); - return preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string); - } - - /** - * Backward compatibility wrapper for an old QP encoding function that was removed. - * @see PHPMailer::encodeQP() - * @access public - * @param string $string - * @param integer $line_max - * @param boolean $space_conv - * @return string - * @deprecated Use encodeQP instead. - */ - public function encodeQPphp( - $string, - $line_max = 76, - /** @noinspection PhpUnusedParameterInspection */ $space_conv = false - ) { - return $this->encodeQP($string, $line_max); - } - - /** - * Encode a string using Q encoding. - * @link http://tools.ietf.org/html/rfc2047 - * @param string $str the text to encode - * @param string $position Where the text is going to be used, see the RFC for what that means - * @access public - * @return string - */ - public function encodeQ($str, $position = 'text') - { - // There should not be any EOL in the string - $pattern = ''; - $encoded = str_replace(array("\r", "\n"), '', $str); - switch (strtolower($position)) { - case 'phrase': - // RFC 2047 section 5.3 - $pattern = '^A-Za-z0-9!*+\/ -'; - break; - /** @noinspection PhpMissingBreakStatementInspection */ - case 'comment': - // RFC 2047 section 5.2 - $pattern = '\(\)"'; - // intentional fall-through - // for this reason we build the $pattern without including delimiters and [] - case 'text': - default: - // RFC 2047 section 5.1 - // Replace every high ascii, control, =, ? and _ characters - $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern; - break; - } - $matches = array(); - if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) { - // If the string contains an '=', make sure it's the first thing we replace - // so as to avoid double-encoding - $eqkey = array_search('=', $matches[0]); - if (false !== $eqkey) { - unset($matches[0][$eqkey]); - array_unshift($matches[0], '='); - } - foreach (array_unique($matches[0]) as $char) { - $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded); - } - } - // Replace every spaces to _ (more readable than =20) - return str_replace(' ', '_', $encoded); - } - - /** - * Add a string or binary attachment (non-filesystem). - * This method can be used to attach ascii or binary data, - * such as a BLOB record from a database. - * @param string $string String attachment data. - * @param string $filename Name of the attachment. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @param string $disposition Disposition to use - * @return void - */ - public function addStringAttachment( - $string, - $filename, - $encoding = 'base64', - $type = '', - $disposition = 'attachment' - ) { - // If a MIME type is not specified, try to work it out from the file name - if ($type == '') { - $type = self::filenameToType($filename); - } - // Append to $attachment array - $this->attachment[] = array( - 0 => $string, - 1 => $filename, - 2 => basename($filename), - 3 => $encoding, - 4 => $type, - 5 => true, // isStringAttachment - 6 => $disposition, - 7 => 0 - ); - } - - /** - * Add an embedded (inline) attachment from a file. - * This can include images, sounds, and just about any other document type. - * These differ from 'regular' attachments in that they are intended to be - * displayed inline with the message, not just attached for download. - * This is used in HTML messages that embed the images - * the HTML refers to using the $cid value. - * @param string $path Path to the attachment. - * @param string $cid Content ID of the attachment; Use this to reference - * the content when using an embedded image in HTML. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File MIME type. - * @param string $disposition Disposition to use - * @return boolean True on successfully adding an attachment - */ - public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline') - { - if (!@is_file($path)) { - $this->setError($this->lang('file_access') . $path); - return false; - } - - // If a MIME type is not specified, try to work it out from the file name - if ($type == '') { - $type = self::filenameToType($path); - } - - $filename = basename($path); - if ($name == '') { - $name = $filename; - } - - // Append to $attachment array - $this->attachment[] = array( - 0 => $path, - 1 => $filename, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => false, // isStringAttachment - 6 => $disposition, - 7 => $cid - ); - return true; - } - - /** - * Add an embedded stringified attachment. - * This can include images, sounds, and just about any other document type. - * Be sure to set the $type to an image type for images: - * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'. - * @param string $string The attachment binary data. - * @param string $cid Content ID of the attachment; Use this to reference - * the content when using an embedded image in HTML. - * @param string $name - * @param string $encoding File encoding (see $Encoding). - * @param string $type MIME type. - * @param string $disposition Disposition to use - * @return boolean True on successfully adding an attachment - */ - public function addStringEmbeddedImage( - $string, - $cid, - $name = '', - $encoding = 'base64', - $type = '', - $disposition = 'inline' - ) { - // If a MIME type is not specified, try to work it out from the name - if ($type == '' and !empty($name)) { - $type = self::filenameToType($name); - } - - // Append to $attachment array - $this->attachment[] = array( - 0 => $string, - 1 => $name, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => true, // isStringAttachment - 6 => $disposition, - 7 => $cid - ); - return true; - } - - /** - * Check if an inline attachment is present. - * @access public - * @return boolean - */ - public function inlineImageExists() - { - foreach ($this->attachment as $attachment) { - if ($attachment[6] == 'inline') { - return true; - } - } - return false; - } - - /** - * Check if an attachment (non-inline) is present. - * @return boolean - */ - public function attachmentExists() - { - foreach ($this->attachment as $attachment) { - if ($attachment[6] == 'attachment') { - return true; - } - } - return false; - } - - /** - * Check if this message has an alternative body set. - * @return boolean - */ - public function alternativeExists() - { - return !empty($this->AltBody); - } - - /** - * Clear queued addresses of given kind. - * @access protected - * @param string $kind 'to', 'cc', or 'bcc' - * @return void - */ - public function clearQueuedAddresses($kind) - { - $RecipientsQueue = $this->RecipientsQueue; - foreach ($RecipientsQueue as $address => $params) { - if ($params[0] == $kind) { - unset($this->RecipientsQueue[$address]); - } - } - } - - /** - * Clear all To recipients. - * @return void - */ - public function clearAddresses() - { - foreach ($this->to as $to) { - unset($this->all_recipients[strtolower($to[0])]); - } - $this->to = array(); - $this->clearQueuedAddresses('to'); - } - - /** - * Clear all CC recipients. - * @return void - */ - public function clearCCs() - { - foreach ($this->cc as $cc) { - unset($this->all_recipients[strtolower($cc[0])]); - } - $this->cc = array(); - $this->clearQueuedAddresses('cc'); - } - - /** - * Clear all BCC recipients. - * @return void - */ - public function clearBCCs() - { - foreach ($this->bcc as $bcc) { - unset($this->all_recipients[strtolower($bcc[0])]); - } - $this->bcc = array(); - $this->clearQueuedAddresses('bcc'); - } - - /** - * Clear all ReplyTo recipients. - * @return void - */ - public function clearReplyTos() - { - $this->ReplyTo = array(); - $this->ReplyToQueue = array(); - } - - /** - * Clear all recipient types. - * @return void - */ - public function clearAllRecipients() - { - $this->to = array(); - $this->cc = array(); - $this->bcc = array(); - $this->all_recipients = array(); - $this->RecipientsQueue = array(); - } - - /** - * Clear all filesystem, string, and binary attachments. - * @return void - */ - public function clearAttachments() - { - $this->attachment = array(); - } - - /** - * Clear all custom headers. - * @return void - */ - public function clearCustomHeaders() - { - $this->CustomHeader = array(); - } - - /** - * Add an error message to the error container. - * @access protected - * @param string $msg - * @return void - */ - protected function setError($msg) - { - $this->error_count++; - if ($this->Mailer == 'smtp' and !is_null($this->smtp)) { - $lasterror = $this->smtp->getError(); - if (!empty($lasterror['error'])) { - $msg .= $this->lang('smtp_error') . $lasterror['error']; - if (!empty($lasterror['detail'])) { - $msg .= ' Detail: '. $lasterror['detail']; - } - if (!empty($lasterror['smtp_code'])) { - $msg .= ' SMTP code: ' . $lasterror['smtp_code']; - } - if (!empty($lasterror['smtp_code_ex'])) { - $msg .= ' Additional SMTP info: ' . $lasterror['smtp_code_ex']; - } - } - } - $this->ErrorInfo = $msg; - } - - /** - * Return an RFC 822 formatted date. - * @access public - * @return string - * @static - */ - public static function rfcDate() - { - // Set the time zone to whatever the default is to avoid 500 errors - // Will default to UTC if it's not set properly in php.ini - date_default_timezone_set(@date_default_timezone_get()); - return date('D, j M Y H:i:s O'); - } - - /** - * Get the server hostname. - * Returns 'localhost.localdomain' if unknown. - * @access protected - * @return string - */ - protected function serverHostname() - { - $result = 'localhost.localdomain'; - if (!empty($this->Hostname)) { - $result = $this->Hostname; - } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) { - $result = $_SERVER['SERVER_NAME']; - } elseif (function_exists('gethostname') && gethostname() !== false) { - $result = gethostname(); - } elseif (php_uname('n') !== false) { - $result = php_uname('n'); - } - return $result; - } - - /** - * Get an error message in the current language. - * @access protected - * @param string $key - * @return string - */ - protected function lang($key) - { - if (count($this->language) < 1) { - $this->setLanguage('en'); // set the default language - } - - if (array_key_exists($key, $this->language)) { - if ($key == 'smtp_connect_failed') { - //Include a link to troubleshooting docs on SMTP connection failure - //this is by far the biggest cause of support questions - //but it's usually not PHPMailer's fault. - return $this->language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting'; - } - return $this->language[$key]; - } else { - //Return the key as a fallback - return $key; - } - } - - /** - * Check if an error occurred. - * @access public - * @return boolean True if an error did occur. - */ - public function isError() - { - return ($this->error_count > 0); - } - - /** - * Ensure consistent line endings in a string. - * Changes every end of line from CRLF, CR or LF to $this->LE. - * @access public - * @param string $str String to fixEOL - * @return string - */ - public function fixEOL($str) - { - // Normalise to \n - $nstr = str_replace(array("\r\n", "\r"), "\n", $str); - // Now convert LE as needed - if ($this->LE !== "\n") { - $nstr = str_replace("\n", $this->LE, $nstr); - } - return $nstr; - } - - /** - * Add a custom header. - * $name value can be overloaded to contain - * both header name and value (name:value) - * @access public - * @param string $name Custom header name - * @param string $value Header value - * @return void - */ - public function addCustomHeader($name, $value = null) - { - if ($value === null) { - // Value passed in as name:value - $this->CustomHeader[] = explode(':', $name, 2); - } else { - $this->CustomHeader[] = array($name, $value); - } - } - - /** - * Returns all custom headers. - * @return array - */ - public function getCustomHeaders() - { - return $this->CustomHeader; - } - - /** - * Create a message from an HTML string. - * Automatically makes modifications for inline images and backgrounds - * and creates a plain-text version by converting the HTML. - * Overwrites any existing values in $this->Body and $this->AltBody - * @access public - * @param string $message HTML message string - * @param string $basedir baseline directory for path - * @param boolean|callable $advanced Whether to use the internal HTML to text converter - * or your own custom converter @see PHPMailer::html2text() - * @return string $message - */ - public function msgHTML($message, $basedir = '', $advanced = false) - { - preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images); - if (array_key_exists(2, $images)) { - foreach ($images[2] as $imgindex => $url) { - // Convert data URIs into embedded images - if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) { - $data = substr($url, strpos($url, ',')); - if ($match[2]) { - $data = base64_decode($data); - } else { - $data = rawurldecode($data); - } - $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2 - if ($this->addStringEmbeddedImage($data, $cid, 'embed' . $imgindex, 'base64', $match[1])) { - $message = str_replace( - $images[0][$imgindex], - $images[1][$imgindex] . '="cid:' . $cid . '"', - $message - ); - } - } elseif (substr($url, 0, 4) !== 'cid:' && !preg_match('#^[a-z][a-z0-9+.-]*://#i', $url)) { - // Do not change urls for absolute images (thanks to corvuscorax) - // Do not change urls that are already inline images - $filename = basename($url); - $directory = dirname($url); - if ($directory == '.') { - $directory = ''; - } - $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2 - if (strlen($basedir) > 1 && substr($basedir, -1) != '/') { - $basedir .= '/'; - } - if (strlen($directory) > 1 && substr($directory, -1) != '/') { - $directory .= '/'; - } - if ($this->addEmbeddedImage( - $basedir . $directory . $filename, - $cid, - $filename, - 'base64', - self::_mime_types((string)self::mb_pathinfo($filename, PATHINFO_EXTENSION)) - ) - ) { - $message = preg_replace( - '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui', - $images[1][$imgindex] . '="cid:' . $cid . '"', - $message - ); - } - } - } - } - $this->isHTML(true); - // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better - $this->Body = $this->normalizeBreaks($message); - $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced)); - if (!$this->alternativeExists()) { - $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . - self::CRLF . self::CRLF; - } - return $this->Body; - } - - /** - * Convert an HTML string into plain text. - * This is used by msgHTML(). - * Note - older versions of this function used a bundled advanced converter - * which was been removed for license reasons in #232 - * Example usage: - * <code> - * // Use default conversion - * $plain = $mail->html2text($html); - * // Use your own custom converter - * $plain = $mail->html2text($html, function($html) { - * $converter = new MyHtml2text($html); - * return $converter->get_text(); - * }); - * </code> - * @param string $html The HTML text to convert - * @param boolean|callable $advanced Any boolean value to use the internal converter, - * or provide your own callable for custom conversion. - * @return string - */ - public function html2text($html, $advanced = false) - { - if (is_callable($advanced)) { - return call_user_func($advanced, $html); - } - return html_entity_decode( - trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))), - ENT_QUOTES, - $this->CharSet - ); - } - - /** - * Get the MIME type for a file extension. - * @param string $ext File extension - * @access public - * @return string MIME type of file. - * @static - */ - public static function _mime_types($ext = '') - { - $mimes = array( - 'xl' => 'application/excel', - 'js' => 'application/javascript', - 'hqx' => 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'bin' => 'application/macbinary', - 'doc' => 'application/msword', - 'word' => 'application/msword', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', - 'class' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'psd' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'so' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => 'application/pdf', - 'ai' => 'application/postscript', - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/vnd.ms-powerpoint', - 'wbxml' => 'application/vnd.wap.wbxml', - 'wmlc' => 'application/vnd.wap.wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'php3' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'xht' => 'application/xhtml+xml', - 'xhtml' => 'application/xhtml+xml', - 'zip' => 'application/zip', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'mpga' => 'audio/mpeg', - 'aif' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'wav' => 'audio/x-wav', - 'bmp' => 'image/bmp', - 'gif' => 'image/gif', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'png' => 'image/png', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'eml' => 'message/rfc822', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'log' => 'text/plain', - 'text' => 'text/plain', - 'txt' => 'text/plain', - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'vcf' => 'text/vcard', - 'vcard' => 'text/vcard', - 'xml' => 'text/xml', - 'xsl' => 'text/xml', - 'mpeg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mov' => 'video/quicktime', - 'qt' => 'video/quicktime', - 'rv' => 'video/vnd.rn-realvideo', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie' - ); - if (array_key_exists(strtolower($ext), $mimes)) { - return $mimes[strtolower($ext)]; - } - return 'application/octet-stream'; - } - - /** - * Map a file name to a MIME type. - * Defaults to 'application/octet-stream', i.e.. arbitrary binary data. - * @param string $filename A file name or full path, does not need to exist as a file - * @return string - * @static - */ - public static function filenameToType($filename) - { - // In case the path is a URL, strip any query string before getting extension - $qpos = strpos($filename, '?'); - if (false !== $qpos) { - $filename = substr($filename, 0, $qpos); - } - $pathinfo = self::mb_pathinfo($filename); - return self::_mime_types($pathinfo['extension']); - } - - /** - * Multi-byte-safe pathinfo replacement. - * Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe. - * Works similarly to the one in PHP >= 5.2.0 - * @link http://www.php.net/manual/en/function.pathinfo.php#107461 - * @param string $path A filename or path, does not need to exist as a file - * @param integer|string $options Either a PATHINFO_* constant, - * or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2 - * @return string|array - * @static - */ - public static function mb_pathinfo($path, $options = null) - { - $ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => ''); - $pathinfo = array(); - if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) { - if (array_key_exists(1, $pathinfo)) { - $ret['dirname'] = $pathinfo[1]; - } - if (array_key_exists(2, $pathinfo)) { - $ret['basename'] = $pathinfo[2]; - } - if (array_key_exists(5, $pathinfo)) { - $ret['extension'] = $pathinfo[5]; - } - if (array_key_exists(3, $pathinfo)) { - $ret['filename'] = $pathinfo[3]; - } - } - switch ($options) { - case PATHINFO_DIRNAME: - case 'dirname': - return $ret['dirname']; - case PATHINFO_BASENAME: - case 'basename': - return $ret['basename']; - case PATHINFO_EXTENSION: - case 'extension': - return $ret['extension']; - case PATHINFO_FILENAME: - case 'filename': - return $ret['filename']; - default: - return $ret; - } - } - - /** - * Set or reset instance properties. - * You should avoid this function - it's more verbose, less efficient, more error-prone and - * harder to debug than setting properties directly. - * Usage Example: - * `$mail->set('SMTPSecure', 'tls');` - * is the same as: - * `$mail->SMTPSecure = 'tls';` - * @access public - * @param string $name The property name to set - * @param mixed $value The value to set the property to - * @return boolean - * @TODO Should this not be using the __set() magic function? - */ - public function set($name, $value = '') - { - if (property_exists($this, $name)) { - $this->$name = $value; - return true; - } else { - $this->setError($this->lang('variable_set') . $name); - return false; - } - } - - /** - * Strip newlines to prevent header injection. - * @access public - * @param string $str - * @return string - */ - public function secureHeader($str) - { - return trim(str_replace(array("\r", "\n"), '', $str)); - } - - /** - * Normalize line breaks in a string. - * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format. - * Defaults to CRLF (for message bodies) and preserves consecutive breaks. - * @param string $text - * @param string $breaktype What kind of line break to use, defaults to CRLF - * @return string - * @access public - * @static - */ - public static function normalizeBreaks($text, $breaktype = "\r\n") - { - return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text); - } - - /** - * Set the public and private key files and password for S/MIME signing. - * @access public - * @param string $cert_filename - * @param string $key_filename - * @param string $key_pass Password for private key - * @param string $extracerts_filename Optional path to chain certificate - */ - public function sign($cert_filename, $key_filename, $key_pass, $extracerts_filename = '') - { - $this->sign_cert_file = $cert_filename; - $this->sign_key_file = $key_filename; - $this->sign_key_pass = $key_pass; - $this->sign_extracerts_file = $extracerts_filename; - } - - /** - * Quoted-Printable-encode a DKIM header. - * @access public - * @param string $txt - * @return string - */ - public function DKIM_QP($txt) - { - $line = ''; - for ($i = 0; $i < strlen($txt); $i++) { - $ord = ord($txt[$i]); - if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) { - $line .= $txt[$i]; - } else { - $line .= '=' . sprintf('%02X', $ord); - } - } - return $line; - } - - /** - * Generate a DKIM signature. - * @access public - * @param string $signHeader - * @throws phpmailerException - * @return string - */ - public function DKIM_Sign($signHeader) - { - if (!defined('PKCS7_TEXT')) { - if ($this->exceptions) { - throw new phpmailerException($this->lang('extension_missing') . 'openssl'); - } - return ''; - } - $privKeyStr = file_get_contents($this->DKIM_private); - if ($this->DKIM_passphrase != '') { - $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase); - } else { - $privKey = openssl_pkey_get_private($privKeyStr); - } - if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) { //sha1WithRSAEncryption - openssl_pkey_free($privKey); - return base64_encode($signature); - } - openssl_pkey_free($privKey); - return ''; - } - - /** - * Generate a DKIM canonicalization header. - * @access public - * @param string $signHeader Header - * @return string - */ - public function DKIM_HeaderC($signHeader) - { - $signHeader = preg_replace('/\r\n\s+/', ' ', $signHeader); - $lines = explode("\r\n", $signHeader); - foreach ($lines as $key => $line) { - list($heading, $value) = explode(':', $line, 2); - $heading = strtolower($heading); - $value = preg_replace('/\s{2,}/', ' ', $value); // Compress useless spaces - $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value - } - $signHeader = implode("\r\n", $lines); - return $signHeader; - } - - /** - * Generate a DKIM canonicalization body. - * @access public - * @param string $body Message Body - * @return string - */ - public function DKIM_BodyC($body) - { - if ($body == '') { - return "\r\n"; - } - // stabilize line endings - $body = str_replace("\r\n", "\n", $body); - $body = str_replace("\n", "\r\n", $body); - // END stabilize line endings - while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") { - $body = substr($body, 0, strlen($body) - 2); - } - return $body; - } - - /** - * Create the DKIM header and body in a new message header. - * @access public - * @param string $headers_line Header lines - * @param string $subject Subject - * @param string $body Body - * @return string - */ - public function DKIM_Add($headers_line, $subject, $body) - { - $DKIMsignatureType = 'rsa-sha256'; // Signature & hash algorithms - $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body - $DKIMquery = 'dns/txt'; // Query method - $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) - $subject_header = "Subject: $subject"; - $headers = explode($this->LE, $headers_line); - $from_header = ''; - $to_header = ''; - $date_header = ''; - $current = ''; - foreach ($headers as $header) { - if (strpos($header, 'From:') === 0) { - $from_header = $header; - $current = 'from_header'; - } elseif (strpos($header, 'To:') === 0) { - $to_header = $header; - $current = 'to_header'; - } elseif (strpos($header, 'Date:') === 0) { - $date_header = $header; - $current = 'date_header'; - } else { - if (!empty($$current) && strpos($header, ' =?') === 0) { - $$current .= $header; - } else { - $current = ''; - } - } - } - $from = str_replace('|', '=7C', $this->DKIM_QP($from_header)); - $to = str_replace('|', '=7C', $this->DKIM_QP($to_header)); - $date = str_replace('|', '=7C', $this->DKIM_QP($date_header)); - $subject = str_replace( - '|', - '=7C', - $this->DKIM_QP($subject_header) - ); // Copied header fields (dkim-quoted-printable) - $body = $this->DKIM_BodyC($body); - $DKIMlen = strlen($body); // Length of body - $DKIMb64 = base64_encode(pack('H*', hash('sha256', $body))); // Base64 of packed binary SHA-256 hash of body - if ('' == $this->DKIM_identity) { - $ident = ''; - } else { - $ident = ' i=' . $this->DKIM_identity . ';'; - } - $dkimhdrs = 'DKIM-Signature: v=1; a=' . - $DKIMsignatureType . '; q=' . - $DKIMquery . '; l=' . - $DKIMlen . '; s=' . - $this->DKIM_selector . - ";\r\n" . - "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" . - "\th=From:To:Date:Subject;\r\n" . - "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" . - "\tz=$from\r\n" . - "\t|$to\r\n" . - "\t|$date\r\n" . - "\t|$subject;\r\n" . - "\tbh=" . $DKIMb64 . ";\r\n" . - "\tb="; - $toSign = $this->DKIM_HeaderC( - $from_header . "\r\n" . - $to_header . "\r\n" . - $date_header . "\r\n" . - $subject_header . "\r\n" . - $dkimhdrs - ); - $signed = $this->DKIM_Sign($toSign); - return $dkimhdrs . $signed . "\r\n"; - } - - /** - * Detect if a string contains a line longer than the maximum line length allowed. - * @param string $str - * @return boolean - * @static - */ - public static function hasLineLongerThanMax($str) - { - //+2 to include CRLF line break for a 1000 total - return (boolean)preg_match('/^(.{'.(self::MAX_LINE_LENGTH + 2).',})/m', $str); - } - - /** - * Allows for public read access to 'to' property. - * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included. - * @access public - * @return array - */ - public function getToAddresses() - { - return $this->to; - } - - /** - * Allows for public read access to 'cc' property. - * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included. - * @access public - * @return array - */ - public function getCcAddresses() - { - return $this->cc; - } - - /** - * Allows for public read access to 'bcc' property. - * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included. - * @access public - * @return array - */ - public function getBccAddresses() - { - return $this->bcc; - } - - /** - * Allows for public read access to 'ReplyTo' property. - * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included. - * @access public - * @return array - */ - public function getReplyToAddresses() - { - return $this->ReplyTo; - } - - /** - * Allows for public read access to 'all_recipients' property. - * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included. - * @access public - * @return array - */ - public function getAllRecipientAddresses() - { - return $this->all_recipients; - } - - /** - * Perform a callback. - * @param boolean $isSent - * @param array $to - * @param array $cc - * @param array $bcc - * @param string $subject - * @param string $body - * @param string $from - */ - protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from) - { - if (!empty($this->action_function) && is_callable($this->action_function)) { - $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from); - call_user_func_array($this->action_function, $params); - } - } -} - -/** - * PHPMailer exception handler - * @package PHPMailer - */ -class phpmailerException extends Exception -{ - /** - * Prettify error message output - * @return string - */ - public function errorMessage() - { - $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n"; - return $errorMsg; - } -}
@@ -1,196 +0,0 @@
-<?php -/** - * PHPMailer - PHP email creation and transport class. - * PHP Version 5.4 - * @package PHPMailer - * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project - * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> - * @author Jim Jagielski (jimjag) <jimjag@gmail.com> - * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailerOAuth - PHPMailer subclass adding OAuth support. - * @package PHPMailer - * @author @sherryl4george - * @author Marcus Bointon (@Synchro) <phpmailer@synchromedia.co.uk> - */ -class PHPMailerOAuth extends PHPMailer -{ - /** - * The OAuth user's email address - * @var string - */ - public $oauthUserEmail = ''; - - /** - * The OAuth refresh token - * @var string - */ - public $oauthRefreshToken = ''; - - /** - * The OAuth client ID - * @var string - */ - public $oauthClientId = ''; - - /** - * The OAuth client secret - * @var string - */ - public $oauthClientSecret = ''; - - /** - * An instance of the PHPMailerOAuthGoogle class. - * @var PHPMailerOAuthGoogle - * @access protected - */ - protected $oauth = null; - - /** - * Get a PHPMailerOAuthGoogle instance to use. - * @return PHPMailerOAuthGoogle - */ - public function getOAUTHInstance() - { - if (!is_object($this->oauth)) { - $this->oauth = new PHPMailerOAuthGoogle( - $this->oauthUserEmail, - $this->oauthClientSecret, - $this->oauthClientId, - $this->oauthRefreshToken - ); - } - return $this->oauth; - } - - /** - * Initiate a connection to an SMTP server. - * Overrides the original smtpConnect method to add support for OAuth. - * @param array $options An array of options compatible with stream_context_create() - * @uses SMTP - * @access public - * @return bool - */ - public function smtpConnect($options = array()) - { - if (is_null($this->smtp)) { - $this->smtp = $this->getSMTPInstance(); - } - - if (is_null($this->oauth)) { - $this->oauth = $this->getOAUTHInstance(); - } - - // Already connected? - if ($this->smtp->connected()) { - return true; - } - - $this->smtp->setTimeout($this->Timeout); - $this->smtp->setDebugLevel($this->SMTPDebug); - $this->smtp->setDebugOutput($this->Debugoutput); - $this->smtp->setVerp($this->do_verp); - $hosts = explode(';', $this->Host); - $lastexception = null; - - foreach ($hosts as $hostentry) { - $hostinfo = array(); - if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) { - // Not a valid host entry - continue; - } - // $hostinfo[2]: optional ssl or tls prefix - // $hostinfo[3]: the hostname - // $hostinfo[4]: optional port number - // The host string prefix can temporarily override the current setting for SMTPSecure - // If it's not specified, the default value is used - $prefix = ''; - $secure = $this->SMTPSecure; - $tls = ($this->SMTPSecure == 'tls'); - if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) { - $prefix = 'ssl://'; - $tls = false; // Can't have SSL and TLS at the same time - $secure = 'ssl'; - } elseif ($hostinfo[2] == 'tls') { - $tls = true; - // tls doesn't use a prefix - $secure = 'tls'; - } - //Do we need the OpenSSL extension? - $sslext = defined('OPENSSL_ALGO_SHA1'); - if ('tls' === $secure or 'ssl' === $secure) { - //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled - if (!$sslext) { - throw new phpmailerException($this->lang('extension_missing').'openssl', self::STOP_CRITICAL); - } - } - $host = $hostinfo[3]; - $port = $this->Port; - $tport = (integer)$hostinfo[4]; - if ($tport > 0 and $tport < 65536) { - $port = $tport; - } - if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) { - try { - if ($this->Helo) { - $hello = $this->Helo; - } else { - $hello = $this->serverHostname(); - } - $this->smtp->hello($hello); - //Automatically enable TLS encryption if: - // * it's not disabled - // * we have openssl extension - // * we are not already using SSL - // * the server offers STARTTLS - if ($this->SMTPAutoTLS and $sslext and $secure != 'ssl' and $this->smtp->getServerExt('STARTTLS')) { - $tls = true; - } - if ($tls) { - if (!$this->smtp->startTLS()) { - throw new phpmailerException($this->lang('connect_host')); - } - // We must resend HELO after tls negotiation - $this->smtp->hello($hello); - } - if ($this->SMTPAuth) { - if (!$this->smtp->authenticate( - $this->Username, - $this->Password, - $this->AuthType, - $this->Realm, - $this->Workstation, - $this->oauth - ) - ) { - throw new phpmailerException($this->lang('authenticate')); - } - } - return true; - } catch (phpmailerException $exc) { - $lastexception = $exc; - $this->edebug($exc->getMessage()); - // We must have connected, but then failed TLS or Auth, so close connection nicely - $this->smtp->quit(); - } - } - } - // If we get here, all connection attempts have failed, so close connection hard - $this->smtp->close(); - // As we've caught all exceptions, just report whatever the last one was - if ($this->exceptions and !is_null($lastexception)) { - throw $lastexception; - } - return false; - } -}
@@ -1,77 +0,0 @@
-<?php -/** - * PHPMailer - PHP email creation and transport class. - * PHP Version 5.4 - * @package PHPMailer - * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project - * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> - * @author Jim Jagielski (jimjag) <jimjag@gmail.com> - * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailerOAuthGoogle - Wrapper for League OAuth2 Google provider. - * @package PHPMailer - * @author @sherryl4george - * @author Marcus Bointon (@Synchro) <phpmailer@synchromedia.co.uk> - * @link https://github.com/thephpleague/oauth2-client - */ -class PHPMailerOAuthGoogle -{ - private $oauthUserEmail = ''; - private $oauthRefreshToken = ''; - private $oauthClientId = ''; - private $oauthClientSecret = ''; - - /** - * @param string $UserEmail - * @param string $ClientSecret - * @param string $ClientId - * @param string $RefreshToken - */ - public function __construct( - $UserEmail, - $ClientSecret, - $ClientId, - $RefreshToken - ) { - $this->oauthClientId = $ClientId; - $this->oauthClientSecret = $ClientSecret; - $this->oauthRefreshToken = $RefreshToken; - $this->oauthUserEmail = $UserEmail; - } - - private function getProvider() - { - return new League\OAuth2\Client\Provider\Google([ - 'clientId' => $this->oauthClientId, - 'clientSecret' => $this->oauthClientSecret - ]); - } - - private function getGrant() - { - return new \League\OAuth2\Client\Grant\RefreshToken(); - } - - private function getToken() - { - $provider = $this->getProvider(); - $grant = $this->getGrant(); - return $provider->getAccessToken($grant, ['refresh_token' => $this->oauthRefreshToken]); - } - - public function getOauth64() - { - $token = $this->getToken(); - return base64_encode("user=" . $this->oauthUserEmail . "\001auth=Bearer " . $token . "\001\001"); - } -}
@@ -1,407 +0,0 @@
-<?php -/** - * PHPMailer POP-Before-SMTP Authentication Class. - * PHP Version 5 - * @package PHPMailer - * @link https://github.com/PHPMailer/PHPMailer/ - * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> - * @author Jim Jagielski (jimjag) <jimjag@gmail.com> - * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailer POP-Before-SMTP Authentication Class. - * Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication. - * Does not support APOP. - * @package PHPMailer - * @author Richard Davey (original author) <rich@corephp.co.uk> - * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> - * @author Jim Jagielski (jimjag) <jimjag@gmail.com> - * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> - */ -class POP3 -{ - /** - * The POP3 PHPMailer Version number. - * @var string - * @access public - */ - public $Version = '5.2.16'; - - /** - * Default POP3 port number. - * @var integer - * @access public - */ - public $POP3_PORT = 110; - - /** - * Default timeout in seconds. - * @var integer - * @access public - */ - public $POP3_TIMEOUT = 30; - - /** - * POP3 Carriage Return + Line Feed. - * @var string - * @access public - * @deprecated Use the constant instead - */ - public $CRLF = "\r\n"; - - /** - * Debug display level. - * Options: 0 = no, 1+ = yes - * @var integer - * @access public - */ - public $do_debug = 0; - - /** - * POP3 mail server hostname. - * @var string - * @access public - */ - public $host; - - /** - * POP3 port number. - * @var integer - * @access public - */ - public $port; - - /** - * POP3 Timeout Value in seconds. - * @var integer - * @access public - */ - public $tval; - - /** - * POP3 username - * @var string - * @access public - */ - public $username; - - /** - * POP3 password. - * @var string - * @access public - */ - public $password; - - /** - * Resource handle for the POP3 connection socket. - * @var resource - * @access protected - */ - protected $pop_conn; - - /** - * Are we connected? - * @var boolean - * @access protected - */ - protected $connected = false; - - /** - * Error container. - * @var array - * @access protected - */ - protected $errors = array(); - - /** - * Line break constant - */ - const CRLF = "\r\n"; - - /** - * Simple static wrapper for all-in-one POP before SMTP - * @param $host - * @param integer|boolean $port The port number to connect to - * @param integer|boolean $timeout The timeout value - * @param string $username - * @param string $password - * @param integer $debug_level - * @return boolean - */ - public static function popBeforeSmtp( - $host, - $port = false, - $timeout = false, - $username = '', - $password = '', - $debug_level = 0 - ) { - $pop = new POP3; - return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level); - } - - /** - * Authenticate with a POP3 server. - * A connect, login, disconnect sequence - * appropriate for POP-before SMTP authorisation. - * @access public - * @param string $host The hostname to connect to - * @param integer|boolean $port The port number to connect to - * @param integer|boolean $timeout The timeout value - * @param string $username - * @param string $password - * @param integer $debug_level - * @return boolean - */ - public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0) - { - $this->host = $host; - // If no port value provided, use default - if (false === $port) { - $this->port = $this->POP3_PORT; - } else { - $this->port = (integer)$port; - } - // If no timeout value provided, use default - if (false === $timeout) { - $this->tval = $this->POP3_TIMEOUT; - } else { - $this->tval = (integer)$timeout; - } - $this->do_debug = $debug_level; - $this->username = $username; - $this->password = $password; - // Reset the error log - $this->errors = array(); - // connect - $result = $this->connect($this->host, $this->port, $this->tval); - if ($result) { - $login_result = $this->login($this->username, $this->password); - if ($login_result) { - $this->disconnect(); - return true; - } - } - // We need to disconnect regardless of whether the login succeeded - $this->disconnect(); - return false; - } - - /** - * Connect to a POP3 server. - * @access public - * @param string $host - * @param integer|boolean $port - * @param integer $tval - * @return boolean - */ - public function connect($host, $port = false, $tval = 30) - { - // Are we already connected? - if ($this->connected) { - return true; - } - - //On Windows this will raise a PHP Warning error if the hostname doesn't exist. - //Rather than suppress it with @fsockopen, capture it cleanly instead - set_error_handler(array($this, 'catchWarning')); - - if (false === $port) { - $port = $this->POP3_PORT; - } - - // connect to the POP3 server - $this->pop_conn = fsockopen( - $host, // POP3 Host - $port, // Port # - $errno, // Error Number - $errstr, // Error Message - $tval - ); // Timeout (seconds) - // Restore the error handler - restore_error_handler(); - - // Did we connect? - if (false === $this->pop_conn) { - // It would appear not... - $this->setError(array( - 'error' => "Failed to connect to server $host on port $port", - 'errno' => $errno, - 'errstr' => $errstr - )); - return false; - } - - // Increase the stream time-out - stream_set_timeout($this->pop_conn, $tval, 0); - - // Get the POP3 server response - $pop3_response = $this->getResponse(); - // Check for the +OK - if ($this->checkResponse($pop3_response)) { - // The connection is established and the POP3 server is talking - $this->connected = true; - return true; - } - return false; - } - - /** - * Log in to the POP3 server. - * Does not support APOP (RFC 2828, 4949). - * @access public - * @param string $username - * @param string $password - * @return boolean - */ - public function login($username = '', $password = '') - { - if (!$this->connected) { - $this->setError('Not connected to POP3 server'); - } - if (empty($username)) { - $username = $this->username; - } - if (empty($password)) { - $password = $this->password; - } - - // Send the Username - $this->sendString("USER $username" . self::CRLF); - $pop3_response = $this->getResponse(); - if ($this->checkResponse($pop3_response)) { - // Send the Password - $this->sendString("PASS $password" . self::CRLF); - $pop3_response = $this->getResponse(); - if ($this->checkResponse($pop3_response)) { - return true; - } - } - return false; - } - - /** - * Disconnect from the POP3 server. - * @access public - */ - public function disconnect() - { - $this->sendString('QUIT'); - //The QUIT command may cause the daemon to exit, which will kill our connection - //So ignore errors here - try { - @fclose($this->pop_conn); - } catch (Exception $e) { - //Do nothing - }; - } - - /** - * Get a response from the POP3 server. - * $size is the maximum number of bytes to retrieve - * @param integer $size - * @return string - * @access protected - */ - protected function getResponse($size = 128) - { - $response = fgets($this->pop_conn, $size); - if ($this->do_debug >= 1) { - echo "Server -> Client: $response"; - } - return $response; - } - - /** - * Send raw data to the POP3 server. - * @param string $string - * @return integer - * @access protected - */ - protected function sendString($string) - { - if ($this->pop_conn) { - if ($this->do_debug >= 2) { //Show client messages when debug >= 2 - echo "Client -> Server: $string"; - } - return fwrite($this->pop_conn, $string, strlen($string)); - } - return 0; - } - - /** - * Checks the POP3 server response. - * Looks for for +OK or -ERR. - * @param string $string - * @return boolean - * @access protected - */ - protected function checkResponse($string) - { - if (substr($string, 0, 3) !== '+OK') { - $this->setError(array( - 'error' => "Server reported an error: $string", - 'errno' => 0, - 'errstr' => '' - )); - return false; - } else { - return true; - } - } - - /** - * Add an error to the internal error store. - * Also display debug output if it's enabled. - * @param $error - * @access protected - */ - protected function setError($error) - { - $this->errors[] = $error; - if ($this->do_debug >= 1) { - echo '<pre>'; - foreach ($this->errors as $error) { - print_r($error); - } - echo '</pre>'; - } - } - - /** - * Get an array of error messages, if any. - * @return array - */ - public function getErrors() - { - return $this->errors; - } - - /** - * POP3 connection error handler. - * @param integer $errno - * @param string $errstr - * @param string $errfile - * @param integer $errline - * @access protected - */ - protected function catchWarning($errno, $errstr, $errfile, $errline) - { - $this->setError(array( - 'error' => "Connecting to the POP3 server raised a PHP warning: ", - 'errno' => $errno, - 'errstr' => $errstr, - 'errfile' => $errfile, - 'errline' => $errline - )); - } -}
@@ -1,1192 +0,0 @@
-<?php -/** - * PHPMailer RFC821 SMTP email transport class. - * PHP Version 5 - * @package PHPMailer - * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project - * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> - * @author Jim Jagielski (jimjag) <jimjag@gmail.com> - * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> - * @author Brent R. Matzelle (original founder) - * @copyright 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailer RFC821 SMTP email transport class. - * Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server. - * @package PHPMailer - * @author Chris Ryan - * @author Marcus Bointon <phpmailer@synchromedia.co.uk> - */ -class SMTP -{ - /** - * The PHPMailer SMTP version number. - * @var string - */ - const VERSION = '5.2.16'; - - /** - * SMTP line break constant. - * @var string - */ - const CRLF = "\r\n"; - - /** - * The SMTP port to use if one is not specified. - * @var integer - */ - const DEFAULT_SMTP_PORT = 25; - - /** - * The maximum line length allowed by RFC 2822 section 2.1.1 - * @var integer - */ - const MAX_LINE_LENGTH = 998; - - /** - * Debug level for no output - */ - const DEBUG_OFF = 0; - - /** - * Debug level to show client -> server messages - */ - const DEBUG_CLIENT = 1; - - /** - * Debug level to show client -> server and server -> client messages - */ - const DEBUG_SERVER = 2; - - /** - * Debug level to show connection status, client -> server and server -> client messages - */ - const DEBUG_CONNECTION = 3; - - /** - * Debug level to show all messages - */ - const DEBUG_LOWLEVEL = 4; - - /** - * The PHPMailer SMTP Version number. - * @var string - * @deprecated Use the `VERSION` constant instead - * @see SMTP::VERSION - */ - public $Version = '5.2.16'; - - /** - * SMTP server port number. - * @var integer - * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead - * @see SMTP::DEFAULT_SMTP_PORT - */ - public $SMTP_PORT = 25; - - /** - * SMTP reply line ending. - * @var string - * @deprecated Use the `CRLF` constant instead - * @see SMTP::CRLF - */ - public $CRLF = "\r\n"; - - /** - * Debug output level. - * Options: - * * self::DEBUG_OFF (`0`) No debug output, default - * * self::DEBUG_CLIENT (`1`) Client commands - * * self::DEBUG_SERVER (`2`) Client commands and server responses - * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status - * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages - * @var integer - */ - public $do_debug = self::DEBUG_OFF; - - /** - * How to handle debug output. - * Options: - * * `echo` Output plain-text as-is, appropriate for CLI - * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output - * * `error_log` Output to error log as configured in php.ini - * - * Alternatively, you can provide a callable expecting two params: a message string and the debug level: - * <code> - * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";}; - * </code> - * @var string|callable - */ - public $Debugoutput = 'echo'; - - /** - * Whether to use VERP. - * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path - * @link http://www.postfix.org/VERP_README.html Info on VERP - * @var boolean - */ - public $do_verp = false; - - /** - * The timeout value for connection, in seconds. - * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 - * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure. - * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2 - * @var integer - */ - public $Timeout = 300; - - /** - * How long to wait for commands to complete, in seconds. - * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 - * @var integer - */ - public $Timelimit = 300; - - /** - * The socket for the server connection. - * @var resource - */ - protected $smtp_conn; - - /** - * Error information, if any, for the last SMTP command. - * @var array - */ - protected $error = array( - 'error' => '', - 'detail' => '', - 'smtp_code' => '', - 'smtp_code_ex' => '' - ); - - /** - * The reply the server sent to us for HELO. - * If null, no HELO string has yet been received. - * @var string|null - */ - protected $helo_rply = null; - - /** - * The set of SMTP extensions sent in reply to EHLO command. - * Indexes of the array are extension names. - * Value at index 'HELO' or 'EHLO' (according to command that was sent) - * represents the server name. In case of HELO it is the only element of the array. - * Other values can be boolean TRUE or an array containing extension options. - * If null, no HELO/EHLO string has yet been received. - * @var array|null - */ - protected $server_caps = null; - - /** - * The most recent reply received from the server. - * @var string - */ - protected $last_reply = ''; - - /** - * Output debugging info via a user-selected method. - * @see SMTP::$Debugoutput - * @see SMTP::$do_debug - * @param string $str Debug string to output - * @param integer $level The debug level of this message; see DEBUG_* constants - * @return void - */ - protected function edebug($str, $level = 0) - { - if ($level > $this->do_debug) { - return; - } - //Avoid clash with built-in function names - if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) { - call_user_func($this->Debugoutput, $str, $this->do_debug); - return; - } - switch ($this->Debugoutput) { - case 'error_log': - //Don't output, just log - error_log($str); - break; - case 'html': - //Cleans up output a bit for a better looking, HTML-safe output - echo htmlentities( - preg_replace('/[\r\n]+/', '', $str), - ENT_QUOTES, - 'UTF-8' - ) - . "<br>\n"; - break; - case 'echo': - default: - //Normalize line breaks - $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( - "\n", - "\n \t ", - trim($str) - )."\n"; - } - } - - /** - * Connect to an SMTP server. - * @param string $host SMTP server IP or host name - * @param integer $port The port number to connect to - * @param integer $timeout How long to wait for the connection to open - * @param array $options An array of options for stream_context_create() - * @access public - * @return boolean - */ - public function connect($host, $port = null, $timeout = 30, $options = array()) - { - static $streamok; - //This is enabled by default since 5.0.0 but some providers disable it - //Check this once and cache the result - if (is_null($streamok)) { - $streamok = function_exists('stream_socket_client'); - } - // Clear errors to avoid confusion - $this->setError(''); - // Make sure we are __not__ connected - if ($this->connected()) { - // Already connected, generate error - $this->setError('Already connected to a server'); - return false; - } - if (empty($port)) { - $port = self::DEFAULT_SMTP_PORT; - } - // Connect to the SMTP server - $this->edebug( - "Connection: opening to $host:$port, timeout=$timeout, options=".var_export($options, true), - self::DEBUG_CONNECTION - ); - $errno = 0; - $errstr = ''; - if ($streamok) { - $socket_context = stream_context_create($options); - //Suppress errors; connection failures are handled at a higher level - $this->smtp_conn = @stream_socket_client( - $host . ":" . $port, - $errno, - $errstr, - $timeout, - STREAM_CLIENT_CONNECT, - $socket_context - ); - } else { - //Fall back to fsockopen which should work in more places, but is missing some features - $this->edebug( - "Connection: stream_socket_client not available, falling back to fsockopen", - self::DEBUG_CONNECTION - ); - $this->smtp_conn = fsockopen( - $host, - $port, - $errno, - $errstr, - $timeout - ); - } - // Verify we connected properly - if (!is_resource($this->smtp_conn)) { - $this->setError( - 'Failed to connect to server', - $errno, - $errstr - ); - $this->edebug( - 'SMTP ERROR: ' . $this->error['error'] - . ": $errstr ($errno)", - self::DEBUG_CLIENT - ); - return false; - } - $this->edebug('Connection: opened', self::DEBUG_CONNECTION); - // SMTP server can take longer to respond, give longer timeout for first read - // Windows does not have support for this timeout function - if (substr(PHP_OS, 0, 3) != 'WIN') { - $max = ini_get('max_execution_time'); - // Don't bother if unlimited - if ($max != 0 && $timeout > $max) { - @set_time_limit($timeout); - } - stream_set_timeout($this->smtp_conn, $timeout, 0); - } - // Get any announcement - $announce = $this->get_lines(); - $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER); - return true; - } - - /** - * Initiate a TLS (encrypted) session. - * @access public - * @return boolean - */ - public function startTLS() - { - if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) { - return false; - } - - //Allow the best TLS version(s) we can - $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; - - //PHP 5.6.7 dropped inclusion of TLS 1.1 and 1.2 in STREAM_CRYPTO_METHOD_TLS_CLIENT - //so add them back in manually if we can - if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { - $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; - $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; - } - - // Begin encrypted connection - if (!stream_socket_enable_crypto( - $this->smtp_conn, - true, - $crypto_method - )) { - return false; - } - return true; - } - - /** - * Perform SMTP authentication. - * Must be run after hello(). - * @see hello() - * @param string $username The user name - * @param string $password The password - * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5, XOAUTH2) - * @param string $realm The auth realm for NTLM - * @param string $workstation The auth workstation for NTLM - * @param null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth) - * @return bool True if successfully authenticated.* @access public - */ - public function authenticate( - $username, - $password, - $authtype = null, - $realm = '', - $workstation = '', - $OAuth = null - ) { - if (!$this->server_caps) { - $this->setError('Authentication is not allowed before HELO/EHLO'); - return false; - } - - if (array_key_exists('EHLO', $this->server_caps)) { - // SMTP extensions are available. Let's try to find a proper authentication method - - if (!array_key_exists('AUTH', $this->server_caps)) { - $this->setError('Authentication is not allowed at this stage'); - // 'at this stage' means that auth may be allowed after the stage changes - // e.g. after STARTTLS - return false; - } - - self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL); - self::edebug( - 'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']), - self::DEBUG_LOWLEVEL - ); - - if (empty($authtype)) { - foreach (array('CRAM-MD5', 'LOGIN', 'PLAIN', 'NTLM', 'XOAUTH2') as $method) { - if (in_array($method, $this->server_caps['AUTH'])) { - $authtype = $method; - break; - } - } - if (empty($authtype)) { - $this->setError('No supported authentication methods found'); - return false; - } - self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL); - } - - if (!in_array($authtype, $this->server_caps['AUTH'])) { - $this->setError("The requested authentication method \"$authtype\" is not supported by the server"); - return false; - } - } elseif (empty($authtype)) { - $authtype = 'LOGIN'; - } - switch ($authtype) { - case 'PLAIN': - // Start authentication - if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) { - return false; - } - // Send encoded username and password - if (!$this->sendCommand( - 'User & Password', - base64_encode("\0" . $username . "\0" . $password), - 235 - ) - ) { - return false; - } - break; - case 'LOGIN': - // Start authentication - if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) { - return false; - } - if (!$this->sendCommand("Username", base64_encode($username), 334)) { - return false; - } - if (!$this->sendCommand("Password", base64_encode($password), 235)) { - return false; - } - break; - case 'XOAUTH2': - //If the OAuth Instance is not set. Can be a case when PHPMailer is used - //instead of PHPMailerOAuth - if (is_null($OAuth)) { - return false; - } - $oauth = $OAuth->getOauth64(); - - // Start authentication - if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) { - return false; - } - break; - case 'NTLM': - /* - * ntlm_sasl_client.php - * Bundled with Permission - * - * How to telnet in windows: - * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx - * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication - */ - require_once 'extras/ntlm_sasl_client.php'; - $temp = new stdClass; - $ntlm_client = new ntlm_sasl_client_class; - //Check that functions are available - if (!$ntlm_client->Initialize($temp)) { - $this->setError($temp->error); - $this->edebug( - 'You need to enable some modules in your php.ini file: ' - . $this->error['error'], - self::DEBUG_CLIENT - ); - return false; - } - //msg1 - $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1 - - if (!$this->sendCommand( - 'AUTH NTLM', - 'AUTH NTLM ' . base64_encode($msg1), - 334 - ) - ) { - return false; - } - //Though 0 based, there is a white space after the 3 digit number - //msg2 - $challenge = substr($this->last_reply, 3); - $challenge = base64_decode($challenge); - $ntlm_res = $ntlm_client->NTLMResponse( - substr($challenge, 24, 8), - $password - ); - //msg3 - $msg3 = $ntlm_client->TypeMsg3( - $ntlm_res, - $username, - $realm, - $workstation - ); - // send encoded username - return $this->sendCommand('Username', base64_encode($msg3), 235); - case 'CRAM-MD5': - // Start authentication - if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) { - return false; - } - // Get the challenge - $challenge = base64_decode(substr($this->last_reply, 4)); - - // Build the response - $response = $username . ' ' . $this->hmac($challenge, $password); - - // send encoded credentials - return $this->sendCommand('Username', base64_encode($response), 235); - default: - $this->setError("Authentication method \"$authtype\" is not supported"); - return false; - } - return true; - } - - /** - * Calculate an MD5 HMAC hash. - * Works like hash_hmac('md5', $data, $key) - * in case that function is not available - * @param string $data The data to hash - * @param string $key The key to hash with - * @access protected - * @return string - */ - protected function hmac($data, $key) - { - if (function_exists('hash_hmac')) { - return hash_hmac('md5', $data, $key); - } - - // The following borrowed from - // http://php.net/manual/en/function.mhash.php#27225 - - // RFC 2104 HMAC implementation for php. - // Creates an md5 HMAC. - // Eliminates the need to install mhash to compute a HMAC - // by Lance Rushing - - $bytelen = 64; // byte length for md5 - if (strlen($key) > $bytelen) { - $key = pack('H*', md5($key)); - } - $key = str_pad($key, $bytelen, chr(0x00)); - $ipad = str_pad('', $bytelen, chr(0x36)); - $opad = str_pad('', $bytelen, chr(0x5c)); - $k_ipad = $key ^ $ipad; - $k_opad = $key ^ $opad; - - return md5($k_opad . pack('H*', md5($k_ipad . $data))); - } - - /** - * Check connection state. - * @access public - * @return boolean True if connected. - */ - public function connected() - { - if (is_resource($this->smtp_conn)) { - $sock_status = stream_get_meta_data($this->smtp_conn); - if ($sock_status['eof']) { - // The socket is valid but we are not connected - $this->edebug( - 'SMTP NOTICE: EOF caught while checking if connected', - self::DEBUG_CLIENT - ); - $this->close(); - return false; - } - return true; // everything looks good - } - return false; - } - - /** - * Close the socket and clean up the state of the class. - * Don't use this function without first trying to use QUIT. - * @see quit() - * @access public - * @return void - */ - public function close() - { - $this->setError(''); - $this->server_caps = null; - $this->helo_rply = null; - if (is_resource($this->smtp_conn)) { - // close the connection and cleanup - fclose($this->smtp_conn); - $this->smtp_conn = null; //Makes for cleaner serialization - $this->edebug('Connection: closed', self::DEBUG_CONNECTION); - } - } - - /** - * Send an SMTP DATA command. - * Issues a data command and sends the msg_data to the server, - * finializing the mail transaction. $msg_data is the message - * that is to be send with the headers. Each header needs to be - * on a single line followed by a <CRLF> with the message headers - * and the message body being separated by and additional <CRLF>. - * Implements rfc 821: DATA <CRLF> - * @param string $msg_data Message data to send - * @access public - * @return boolean - */ - public function data($msg_data) - { - //This will use the standard timelimit - if (!$this->sendCommand('DATA', 'DATA', 354)) { - return false; - } - - /* The server is ready to accept data! - * According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF) - * so we will break the data up into lines by \r and/or \n then if needed we will break each of those into - * smaller lines to fit within the limit. - * We will also look for lines that start with a '.' and prepend an additional '.'. - * NOTE: this does not count towards line-length limit. - */ - - // Normalize line breaks before exploding - $lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data)); - - /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field - * of the first line (':' separated) does not contain a space then it _should_ be a header and we will - * process all lines before a blank line as headers. - */ - - $field = substr($lines[0], 0, strpos($lines[0], ':')); - $in_headers = false; - if (!empty($field) && strpos($field, ' ') === false) { - $in_headers = true; - } - - foreach ($lines as $line) { - $lines_out = array(); - if ($in_headers and $line == '') { - $in_headers = false; - } - //Break this line up into several smaller lines if it's too long - //Micro-optimisation: isset($str[$len]) is faster than (strlen($str) > $len), - while (isset($line[self::MAX_LINE_LENGTH])) { - //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on - //so as to avoid breaking in the middle of a word - $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' '); - //Deliberately matches both false and 0 - if (!$pos) { - //No nice break found, add a hard break - $pos = self::MAX_LINE_LENGTH - 1; - $lines_out[] = substr($line, 0, $pos); - $line = substr($line, $pos); - } else { - //Break at the found point - $lines_out[] = substr($line, 0, $pos); - //Move along by the amount we dealt with - $line = substr($line, $pos + 1); - } - //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1 - if ($in_headers) { - $line = "\t" . $line; - } - } - $lines_out[] = $line; - - //Send the lines to the server - foreach ($lines_out as $line_out) { - //RFC2821 section 4.5.2 - if (!empty($line_out) and $line_out[0] == '.') { - $line_out = '.' . $line_out; - } - $this->client_send($line_out . self::CRLF); - } - } - - //Message data has been sent, complete the command - //Increase timelimit for end of DATA command - $savetimelimit = $this->Timelimit; - $this->Timelimit = $this->Timelimit * 2; - $result = $this->sendCommand('DATA END', '.', 250); - //Restore timelimit - $this->Timelimit = $savetimelimit; - return $result; - } - - /** - * Send an SMTP HELO or EHLO command. - * Used to identify the sending server to the receiving server. - * This makes sure that client and server are in a known state. - * Implements RFC 821: HELO <SP> <domain> <CRLF> - * and RFC 2821 EHLO. - * @param string $host The host name or IP to connect to - * @access public - * @return boolean - */ - public function hello($host = '') - { - //Try extended hello first (RFC 2821) - return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host)); - } - - /** - * Send an SMTP HELO or EHLO command. - * Low-level implementation used by hello() - * @see hello() - * @param string $hello The HELO string - * @param string $host The hostname to say we are - * @access protected - * @return boolean - */ - protected function sendHello($hello, $host) - { - $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250); - $this->helo_rply = $this->last_reply; - if ($noerror) { - $this->parseHelloFields($hello); - } else { - $this->server_caps = null; - } - return $noerror; - } - - /** - * Parse a reply to HELO/EHLO command to discover server extensions. - * In case of HELO, the only parameter that can be discovered is a server name. - * @access protected - * @param string $type - 'HELO' or 'EHLO' - */ - protected function parseHelloFields($type) - { - $this->server_caps = array(); - $lines = explode("\n", $this->helo_rply); - - foreach ($lines as $n => $s) { - //First 4 chars contain response code followed by - or space - $s = trim(substr($s, 4)); - if (empty($s)) { - continue; - } - $fields = explode(' ', $s); - if (!empty($fields)) { - if (!$n) { - $name = $type; - $fields = $fields[0]; - } else { - $name = array_shift($fields); - switch ($name) { - case 'SIZE': - $fields = ($fields ? $fields[0] : 0); - break; - case 'AUTH': - if (!is_array($fields)) { - $fields = array(); - } - break; - default: - $fields = true; - } - } - $this->server_caps[$name] = $fields; - } - } - } - - /** - * Send an SMTP MAIL command. - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more recipient - * commands may be called followed by a data command. - * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF> - * @param string $from Source address of this message - * @access public - * @return boolean - */ - public function mail($from) - { - $useVerp = ($this->do_verp ? ' XVERP' : ''); - return $this->sendCommand( - 'MAIL FROM', - 'MAIL FROM:<' . $from . '>' . $useVerp, - 250 - ); - } - - /** - * Send an SMTP QUIT command. - * Closes the socket if there is no error or the $close_on_error argument is true. - * Implements from rfc 821: QUIT <CRLF> - * @param boolean $close_on_error Should the connection close if an error occurs? - * @access public - * @return boolean - */ - public function quit($close_on_error = true) - { - $noerror = $this->sendCommand('QUIT', 'QUIT', 221); - $err = $this->error; //Save any error - if ($noerror or $close_on_error) { - $this->close(); - $this->error = $err; //Restore any error from the quit command - } - return $noerror; - } - - /** - * Send an SMTP RCPT command. - * Sets the TO argument to $toaddr. - * Returns true if the recipient was accepted false if it was rejected. - * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF> - * @param string $address The address the message is being sent to - * @access public - * @return boolean - */ - public function recipient($address) - { - return $this->sendCommand( - 'RCPT TO', - 'RCPT TO:<' . $address . '>', - array(250, 251) - ); - } - - /** - * Send an SMTP RSET command. - * Abort any transaction that is currently in progress. - * Implements rfc 821: RSET <CRLF> - * @access public - * @return boolean True on success. - */ - public function reset() - { - return $this->sendCommand('RSET', 'RSET', 250); - } - - /** - * Send a command to an SMTP server and check its return code. - * @param string $command The command name - not sent to the server - * @param string $commandstring The actual command to send - * @param integer|array $expect One or more expected integer success codes - * @access protected - * @return boolean True on success. - */ - protected function sendCommand($command, $commandstring, $expect) - { - if (!$this->connected()) { - $this->setError("Called $command without being connected"); - return false; - } - //Reject line breaks in all commands - if (strpos($commandstring, "\n") !== false or strpos($commandstring, "\r") !== false) { - $this->setError("Command '$command' contained line breaks"); - return false; - } - $this->client_send($commandstring . self::CRLF); - - $this->last_reply = $this->get_lines(); - // Fetch SMTP code and possible error code explanation - $matches = array(); - if (preg_match("/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/", $this->last_reply, $matches)) { - $code = $matches[1]; - $code_ex = (count($matches) > 2 ? $matches[2] : null); - // Cut off error code from each response line - $detail = preg_replace( - "/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m", - '', - $this->last_reply - ); - } else { - // Fall back to simple parsing if regex fails - $code = substr($this->last_reply, 0, 3); - $code_ex = null; - $detail = substr($this->last_reply, 4); - } - - $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER); - - if (!in_array($code, (array)$expect)) { - $this->setError( - "$command command failed", - $detail, - $code, - $code_ex - ); - $this->edebug( - 'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply, - self::DEBUG_CLIENT - ); - return false; - } - - $this->setError(''); - return true; - } - - /** - * Send an SMTP SAML command. - * Starts a mail transaction from the email address specified in $from. - * Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more recipient - * commands may be called followed by a data command. This command - * will send the message to the users terminal if they are logged - * in and send them an email. - * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF> - * @param string $from The address the message is from - * @access public - * @return boolean - */ - public function sendAndMail($from) - { - return $this->sendCommand('SAML', "SAML FROM:$from", 250); - } - - /** - * Send an SMTP VRFY command. - * @param string $name The name to verify - * @access public - * @return boolean - */ - public function verify($name) - { - return $this->sendCommand('VRFY', "VRFY $name", array(250, 251)); - } - - /** - * Send an SMTP NOOP command. - * Used to keep keep-alives alive, doesn't actually do anything - * @access public - * @return boolean - */ - public function noop() - { - return $this->sendCommand('NOOP', 'NOOP', 250); - } - - /** - * Send an SMTP TURN command. - * This is an optional command for SMTP that this class does not support. - * This method is here to make the RFC821 Definition complete for this class - * and _may_ be implemented in future - * Implements from rfc 821: TURN <CRLF> - * @access public - * @return boolean - */ - public function turn() - { - $this->setError('The SMTP TURN command is not implemented'); - $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT); - return false; - } - - /** - * Send raw data to the server. - * @param string $data The data to send - * @access public - * @return integer|boolean The number of bytes sent to the server or false on error - */ - public function client_send($data) - { - $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT); - return fwrite($this->smtp_conn, $data); - } - - /** - * Get the latest error. - * @access public - * @return array - */ - public function getError() - { - return $this->error; - } - - /** - * Get SMTP extensions available on the server - * @access public - * @return array|null - */ - public function getServerExtList() - { - return $this->server_caps; - } - - /** - * A multipurpose method - * The method works in three ways, dependent on argument value and current state - * 1. HELO/EHLO was not sent - returns null and set up $this->error - * 2. HELO was sent - * $name = 'HELO': returns server name - * $name = 'EHLO': returns boolean false - * $name = any string: returns null and set up $this->error - * 3. EHLO was sent - * $name = 'HELO'|'EHLO': returns server name - * $name = any string: if extension $name exists, returns boolean True - * or its options. Otherwise returns boolean False - * In other words, one can use this method to detect 3 conditions: - * - null returned: handshake was not or we don't know about ext (refer to $this->error) - * - false returned: the requested feature exactly not exists - * - positive value returned: the requested feature exists - * @param string $name Name of SMTP extension or 'HELO'|'EHLO' - * @return mixed - */ - public function getServerExt($name) - { - if (!$this->server_caps) { - $this->setError('No HELO/EHLO was sent'); - return null; - } - - // the tight logic knot ;) - if (!array_key_exists($name, $this->server_caps)) { - if ($name == 'HELO') { - return $this->server_caps['EHLO']; - } - if ($name == 'EHLO' || array_key_exists('EHLO', $this->server_caps)) { - return false; - } - $this->setError('HELO handshake was used. Client knows nothing about server extensions'); - return null; - } - - return $this->server_caps[$name]; - } - - /** - * Get the last reply from the server. - * @access public - * @return string - */ - public function getLastReply() - { - return $this->last_reply; - } - - /** - * Read the SMTP server's response. - * Either before eof or socket timeout occurs on the operation. - * With SMTP we can tell if we have more lines to read if the - * 4th character is '-' symbol. If it is a space then we don't - * need to read anything else. - * @access protected - * @return string - */ - protected function get_lines() - { - // If the connection is bad, give up straight away - if (!is_resource($this->smtp_conn)) { - return ''; - } - $data = ''; - $endtime = 0; - stream_set_timeout($this->smtp_conn, $this->Timeout); - if ($this->Timelimit > 0) { - $endtime = time() + $this->Timelimit; - } - while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) { - $str = @fgets($this->smtp_conn, 515); - $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL); - $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL); - $data .= $str; - // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen - if ((isset($str[3]) and $str[3] == ' ')) { - break; - } - // Timed-out? Log and break - $info = stream_get_meta_data($this->smtp_conn); - if ($info['timed_out']) { - $this->edebug( - 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)', - self::DEBUG_LOWLEVEL - ); - break; - } - // Now check if reads took too long - if ($endtime and time() > $endtime) { - $this->edebug( - 'SMTP -> get_lines(): timelimit reached ('. - $this->Timelimit . ' sec)', - self::DEBUG_LOWLEVEL - ); - break; - } - } - return $data; - } - - /** - * Enable or disable VERP address generation. - * @param boolean $enabled - */ - public function setVerp($enabled = false) - { - $this->do_verp = $enabled; - } - - /** - * Get VERP address generation mode. - * @return boolean - */ - public function getVerp() - { - return $this->do_verp; - } - - /** - * Set error messages and codes. - * @param string $message The error message - * @param string $detail Further detail on the error - * @param string $smtp_code An associated SMTP error code - * @param string $smtp_code_ex Extended SMTP code - */ - protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '') - { - $this->error = array( - 'error' => $message, - 'detail' => $detail, - 'smtp_code' => $smtp_code, - 'smtp_code_ex' => $smtp_code_ex - ); - } - - /** - * Set debug output method. - * @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it. - */ - public function setDebugOutput($method = 'echo') - { - $this->Debugoutput = $method; - } - - /** - * Get debug output method. - * @return string - */ - public function getDebugOutput() - { - return $this->Debugoutput; - } - - /** - * Set debug output level. - * @param integer $level - */ - public function setDebugLevel($level = 0) - { - $this->do_debug = $level; - } - - /** - * Get debug output level. - * @return integer - */ - public function getDebugLevel() - { - return $this->do_debug; - } - - /** - * Set SMTP timeout. - * @param integer $timeout - */ - public function setTimeout($timeout = 0) - { - $this->Timeout = $timeout; - } - - /** - * Get SMTP timeout. - * @return integer - */ - public function getTimeout() - { - return $this->Timeout; - } -}
@@ -1,44 +0,0 @@
-{ - "name": "phpmailer/phpmailer", - "type": "library", - "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "authors": [ - { - "name": "Marcus Bointon", - "email": "phpmailer@synchromedia.co.uk" - }, - { - "name": "Jim Jagielski", - "email": "jimjag@gmail.com" - }, - { - "name": "Andy Prevost", - "email": "codeworxtech@users.sourceforge.net" - }, - { - "name": "Brent R. Matzelle" - } - ], - "require": { - "php": ">=5.0.0" - }, - "require-dev": { - "phpdocumentor/phpdocumentor": "*", - "phpunit/phpunit": "4.7.*" - }, - "suggest": { - "league/oauth2-google": "Needed for Google XOAUTH2 authentication" - }, - "autoload": { - "classmap": [ - "class.phpmailer.php", - "class.phpmaileroauth.php", - "class.phpmaileroauthgoogle.php", - "class.smtp.php", - "class.pop3.php", - "extras/EasyPeasyICS.php", - "extras/ntlm_sasl_client.php" - ] - }, - "license": "LGPL-2.1" -}
@@ -1,17 +0,0 @@
-NEW CALLBACK FUNCTION: -====================== - -We have had requests for a method to process the results of sending emails -through PHPMailer. In this new release, we have implemented a callback -function that passes the results of each email sent (to, cc, and/or bcc). -We have provided an example that echos the results back to the screen. The -callback function can be used for any purpose. With minor modifications, the -callback function can be used to create CSV logs, post results to databases, -etc. - -Please review the test.php script for the example. - -It's pretty straight forward. - -Enjoy! -Andy
@@ -1,55 +0,0 @@
-CREATE DKIM KEYS and DNS Resource Record: -========================================= - -To create DomainKeys Identified Mail keys, visit: -http://dkim.worxware.com/ -... read the information, fill in the form, and download the ZIP file -containing the public key, private key, DNS Resource Record and instructions -to add to your DNS Zone Record, and the PHPMailer code to enable DKIM -digital signing. - -/*** PROTECT YOUR PRIVATE & PUBLIC KEYS ***/ - -You need to protect your DKIM private and public keys from being viewed or -accessed. Add protection to your .htaccess file as in this example: - -# secure htkeyprivate file -<Files .htkeyprivate> - order allow,deny - deny from all -</Files> - -# secure htkeypublic file -<Files .htkeypublic> - order allow,deny - deny from all -</Files> - -(the actual .htaccess additions are in the ZIP file sent back to you from -http://dkim.worxware.com/ - -A few notes on using DomainKey Identified Mail (DKIM): - -You do not need to use PHPMailer to DKIM sign emails IF: -- you enable DomainKey support and add the DNS resource record -- you use your outbound mail server - -If you are a third-party emailer that works on behalf of domain owners to -send their emails from your own server: -- you absolutely have to DKIM sign outbound emails -- the domain owner has to add the DNS resource record to match the - private key, public key, selector, identity, and domain that you create -- use caution with the "selector" ... at least one "selector" will already - exist in the DNS Zone Record of the domain at the domain owner's server - you need to ensure that the "selector" you use is unique -Note: since the IP address will not match the domain owner's DNS Zone record -you can be certain that email providers that validate based on DomainKey will -check the domain owner's DNS Zone record for your DNS resource record. Before -sending out emails on behalf of domain owners, ensure they have entered the -DNS resource record you provided them. - -Enjoy! -Andy - -PS. if you need additional information about DKIM, please see: -http://www.dkim.org/info/dkim-faq.html
@@ -1,17 +0,0 @@
-If you are having problems connecting or sending emails through your SMTP server, the SMTP class can provide more information about the processing/errors taking place. -Use the debug functionality of the class to see what's going on in your connections. To do that, set the debug level in your script. For example: - -$mail->SMTPDebug = 1; -$mail->isSMTP(); // telling the class to use SMTP -$mail->SMTPAuth = true; // enable SMTP authentication -$mail->Port = 26; // set the SMTP port -$mail->Host = "mail.yourhost.com"; // SMTP server -$mail->Username = "name@yourhost.com"; // SMTP account username -$mail->Password = "your password"; // SMTP account password - -Notes on this: -$mail->SMTPDebug = 0; ... will disable debugging (you can also leave this out completely, 0 is the default) -$mail->SMTPDebug = 1; ... will echo errors and server responses -$mail->SMTPDebug = 2; ... will echo errors, server responses and client messages - -And finally, don't forget to disable debugging before going into production.
@@ -1,128 +0,0 @@
-<html> -<head> -<title>Examples using phpmailer</title> -</head> - -<body> - -<h2>Examples using PHPMailer</h2> - -<h3>1. Advanced Example</h3> -<p> - -This demonstrates sending multiple email messages with binary attachments -from a MySQL database using multipart/alternative messages.<p> - -<pre> -require 'PHPMailerAutoload.php'; - -$mail = new PHPMailer(); - -$mail->setFrom('list@example.com', 'List manager'); -$mail->Host = 'smtp1.example.com;smtp2.example.com'; -$mail->Mailer = 'smtp'; - -@mysqli_connect('localhost','root','password'); -@mysqli_select_db("my_company"); -$query = "SELECT full_name, email, photo FROM employee"; -$result = @mysqli_query($query); - -while ($row = mysqli_fetch_assoc($result)) -{ - // HTML body - $body = "Hello <font size=\"4\">" . $row['full_name'] . "</font>, <p>"; - $body .= "<i>Your</i> personal photograph to this message.<p>"; - $body .= "Sincerely, <br>"; - $body .= "phpmailer List manager"; - - // Plain text body (for mail clients that cannot read HTML) - $text_body = 'Hello ' . $row['full_name'] . ", \n\n"; - $text_body .= "Your personal photograph to this message.\n\n"; - $text_body .= "Sincerely, \n"; - $text_body .= 'phpmailer List manager'; - - $mail->Body = $body; - $mail->AltBody = $text_body; - $mail->addAddress($row['email'], $row['full_name']); - $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg'); - - if(!$mail->send()) - echo "There has been a mail error sending to " . $row['email'] . "<br>"; - - // Clear all addresses and attachments for next loop - $mail->clearAddresses(); - $mail->clearAttachments(); -} -</pre> -<p> - -<h3>2. Extending PHPMailer</h3> -<p> - -Extending classes with inheritance is one of the most -powerful features of object-oriented programming. It allows you to make changes to the -original class for your own personal use without hacking the original -classes, and it's very easy to do: - -<p> -Here's a class that extends the phpmailer class and sets the defaults -for the particular site:<br> -PHP include file: my_phpmailer.php -<p> - -<pre> -require 'PHPMailerAutoload.php'; - -class my_phpmailer extends PHPMailer { - // Set default variables for all new objects - public $From = 'from@example.com'; - public $FromName = 'Mailer'; - public $Host = 'smtp1.example.com;smtp2.example.com'; - public $Mailer = 'smtp'; // Alternative to isSMTP() - public $WordWrap = 75; - - // Replace the default debug output function - protected function edebug($msg) { - print('My Site Error'); - print('Description:'); - printf('%s', $msg); - exit; - } - - //Extend the send function - public function send() { - $this->Subject = '[Yay for me!] '.$this->Subject; - return parent::send() - } - - // Create an additional function - public function do_something($something) { - // Place your new code here - } -} -</pre> -<br> -Now here's a normal PHP page in the site, which will have all the defaults set above:<br> - -<pre> -require 'my_phpmailer.php'; - -// Instantiate your new class -$mail = new my_phpmailer; - -// Now you only need to add the necessary stuff -$mail->addAddress('josh@example.com', 'Josh Adams'); -$mail->Subject = 'Here is the subject'; -$mail->Body = 'This is the message body'; -$mail->addAttachment('c:/temp/11-10-00.zip', 'new_name.zip'); // optional name - -if(!$mail->send()) -{ - echo 'There was an error sending the message'; - exit; -} - -echo 'Message was sent successfully'; -</pre> -</body> -</html>
@@ -1,28 +0,0 @@
-<html> -<head> -<title>PHPMailer FAQ</title> -</head> -<body> -<h2>PHPMailer FAQ</h2> -<ul> - <li><strong>Q: I am concerned that using include files will take up too much - processing time on my computer. How can I make it run faster?</strong><br> - <strong>A:</strong> PHP by itself is fairly fast, but it recompiles scripts every time they are run, which takes up valuable - computer resources. You can bypass this by using an opcode cache which compiles - PHP code and store it in memory to reduce overhead immensely. <a href="http://www.php.net/apc/">APC - (Alternative PHP Cache)</a> is a free opcode cache extension in the PECL library.</li> - <li><strong>Q: Which mailer gives me the best performance?</strong><br> - <strong>A:</strong> On a single machine the <strong>sendmail (or Qmail)</strong> is fastest overall. - Next fastest is mail() to give you the best performance. Both do not have the overhead of SMTP. - If you do not have a local mail server (as is typical on Windows), SMTP is your only option.</li> - <li><strong>Q: When I try to attach a file with on my server I get a - "Could not find {file} on filesystem error". Why is this?</strong><br> - <strong>A:</strong> If you are using a Unix machine this is probably because the user - running your web server does not have read access to the directory in question. If you are using Windows, - then the problem is probably that you have used single backslashes to denote directories (\). - A single backslash has a special meaning to PHP so these are not - valid. Instead use double backslashes ("\\") or a single forward - slash ("/").</li> -</ul> -</body> -</html>
@@ -1,8 +0,0 @@
-#!/bin/sh -# Regenerate PHPMailer documentation -# Run from within the docs folder -rm -rf phpdoc/* -phpdoc --directory .. --target ./phpdoc --ignore test/,examples/,extras/,test_script/,vendor/,language/ --sourcecode --force --title PHPMailer --template="clean" -# You can merge regenerated docs into a separate docs working copy without messing up the git status like so: -# rsync -a --delete --exclude ".git" --exclude "phpdoc-cache-*/" --exclude "README.md" phpdoc/ ../../phpmailer-docs -# After updating docs, push/PR them to the phpmailer gh-pages branch: https://github.com/PHPMailer/PHPMailer/tree/gh-pages
@@ -1,50 +0,0 @@
-This is built for PHP Mailer 1.72 and was not tested with any previous version. It was developed under PHP 4.3.11 (E_ALL). It works under PHP 5 and 5.1 with E_ALL, but not in Strict mode due to var deprecation (but then neither does PHP Mailer either!). It follows the RFC 1939 standard explicitly and is fully commented. - -With that noted, here is how to implement it: - -I didn't want to modify the PHP Mailer classes at all, so you will have to include/require this class along with the base one. It can sit quite happily in the phpmailer directory. - -When you need it, create your POP3 object - -Right before I invoke PHP Mailer I activate the POP3 authorisation. POP3 before SMTP is a process whereby you login to your web hosts POP3 mail server BEFORE sending out any emails via SMTP. The POP3 logon 'verifies' your ability to send email by SMTP, which typically otherwise blocks you. On my web host (Pair Networks) a single POP3 logon is enough to 'verify' you for 90 minutes. Here is some sample PHP code that activates the POP3 logon and then sends an email via PHP Mailer: - -<?php -$pop->authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); -$mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->isSMTP(); -$mail->isHTML(false); $mail->Host = 'relay.example.com'; -$mail->From = 'mailer@example.com'; -$mail->FromName = 'Example Mailer'; -$mail->Subject = 'My subject'; -$mail->Body = 'Hello world'; -$mail->addAddress('rich@corephp.co.uk', 'Richard Davey'); -if (!$mail->send()) { - echo $mail->ErrorInfo; -} -?> - -The PHP Mailer parts of this code should be obvious to anyone who has used PHP Mailer before. One thing to note - you almost certainly will not need to use SMTP Authentication *and* POP3 before SMTP together. The Authorisation method is a proxy method to all of the others within that class. There are connect, Logon and disconnect methods available, but I wrapped them in the single Authorisation one to make things easier. -The Parameters - -The authorise parameters are as follows: - -$pop->authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); - - 1. pop3.example.com - The POP3 Mail Server Name (hostname or IP address) - 2. 110 - The POP3 Port on which to connect (default is usually 110, but check with your host) - 3. 30 - A connection time-out value (in seconds) - 4. mailer - The POP3 Username required to logon - 5. password - The POP3 Password required to logon - 6. 1 - The class debug level (0 = off, 1+ = debug output is echoed to the browser) - -Final Comments + the Download - -1) This class does not support APOP connections. This is only because I did not have an APOP server to test with, but if you'd like to see that added just contact me. - -2) Opening and closing lots of POP3 connections can be quite a resource/network drain. If you need to send a whole batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine. With my host that period is 90 minutes, i.e. plenty of time. - -3) If you have heavy requirements for this script (i.e. send a LOT of email on a frequent basis) then I would advise seeking out an alternative sending method (direct SMTP ideally). If this isn't possible then you could modify this class so the 'last authorised' date is recorded somewhere (MySQL, Flat file, etc) meaning you only open a new connection if the old one has expired, saving you precious overhead. - -4) There are lots of other POP3 classes for PHP available. However most of them implement the full POP3 command set, where-as this one is purely for authentication, and much lighter as a result. However using any of the other POP3 classes to just logon to your server would have the same net result. At the end of the day, use whatever method you feel most comfortable with. -Download - -My thanks to Chris Ryan for the inspiration (even if indirectly, via his SMTP class)
@@ -1,38 +0,0 @@
-<?php -/** - * This example shows how to use DKIM message authentication with PHPMailer. - * There's more to using DKIM than just this code - check out this article: - * @link https://yomotherboard.com/how-to-setup-email-server-dkim-keys/ - * See also the DKIM code in the PHPMailer unit tests, - * which shows how to make a key pair from PHP. - */ - -require '../PHPMailerAutoload.php'; - -//Create a new PHPMailer instance -$mail = new PHPMailer; -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); -//Set the subject line -$mail->Subject = 'PHPMailer DKIM test'; -//This should be the same as the domain of your From address -$mail->DKIM_domain = 'example.com'; -//Path to your private key file -$mail->DKIM_private = 'dkim_private.pem'; -//Set this to your own selector -$mail->DKIM_selector = 'phpmailer'; -//If your private key has a passphrase, set it here -$mail->DKIM_passphrase = ''; -//The identity you're signing as - usually your From address -$mail->DKIM_identity = $mail->From; - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -}
@@ -1,597 +0,0 @@
-<?php -/* - * A web form that both generates and uses PHPMailer code. - * revised, updated and corrected 27/02/2013 - * by matt.sturdy@gmail.com - */ -require '../PHPMailerAutoload.php'; - -$CFG['smtp_debug'] = 2; //0 == off, 1 for client output, 2 for client and server -$CFG['smtp_debugoutput'] = 'html'; -$CFG['smtp_server'] = 'localhost'; -$CFG['smtp_port'] = '25'; -$CFG['smtp_authenticate'] = false; -$CFG['smtp_username'] = 'name@example.com'; -$CFG['smtp_password'] = 'yourpassword'; -$CFG['smtp_secure'] = 'None'; - -$from_name = (isset($_POST['From_Name'])) ? $_POST['From_Name'] : ''; -$from_email = (isset($_POST['From_Email'])) ? $_POST['From_Email'] : ''; -$to_name = (isset($_POST['To_Name'])) ? $_POST['To_Name'] : ''; -$to_email = (isset($_POST['To_Email'])) ? $_POST['To_Email'] : ''; -$cc_email = (isset($_POST['cc_Email'])) ? $_POST['cc_Email'] : ''; -$bcc_email = (isset($_POST['bcc_Email'])) ? $_POST['bcc_Email'] : ''; -$subject = (isset($_POST['Subject'])) ? $_POST['Subject'] : ''; -$message = (isset($_POST['Message'])) ? $_POST['Message'] : ''; -$test_type = (isset($_POST['test_type'])) ? $_POST['test_type'] : 'smtp'; -$smtp_debug = (isset($_POST['smtp_debug'])) ? $_POST['smtp_debug'] : $CFG['smtp_debug']; -$smtp_server = (isset($_POST['smtp_server'])) ? $_POST['smtp_server'] : $CFG['smtp_server']; -$smtp_port = (isset($_POST['smtp_port'])) ? $_POST['smtp_port'] : $CFG['smtp_port']; -$smtp_secure = strtolower((isset($_POST['smtp_secure'])) ? $_POST['smtp_secure'] : $CFG['smtp_secure']); -$smtp_authenticate = (isset($_POST['smtp_authenticate'])) ? - $_POST['smtp_authenticate'] : $CFG['smtp_authenticate']; -$authenticate_password = (isset($_POST['authenticate_password'])) ? - $_POST['authenticate_password'] : $CFG['smtp_password']; -$authenticate_username = (isset($_POST['authenticate_username'])) ? - $_POST['authenticate_username'] : $CFG['smtp_username']; - -// storing all status output from the script to be shown to the user later -$results_messages = array(); - -// $example_code represents the "final code" that we're using, and will -// be shown to the user at the end. -$example_code = "\nrequire_once '../PHPMailerAutoload.php';"; -$example_code .= "\n\n\$results_messages = array();"; - -$mail = new PHPMailer(true); //PHPMailer instance with exceptions enabled -$mail->CharSet = 'utf-8'; -ini_set('default_charset', 'UTF-8'); -$mail->Debugoutput = $CFG['smtp_debugoutput']; -$example_code .= "\n\n\$mail = new PHPMailer(true);"; -$example_code .= "\n\$mail->CharSet = 'utf-8';"; -$example_code .= "\nini_set('default_charset', 'UTF-8');"; - -class phpmailerAppException extends phpmailerException -{ -} - -$example_code .= "\n\nclass phpmailerAppException extends phpmailerException {}"; -$example_code .= "\n\ntry {"; - -try { - if (isset($_POST["submit"]) && $_POST['submit'] == "Submit") { - $to = $_POST['To_Email']; - if (!PHPMailer::validateAddress($to)) { - throw new phpmailerAppException("Email address " . $to . " is invalid -- aborting!"); - } - - $example_code .= "\n\$to = '{$_POST['To_Email']}';"; - $example_code .= "\nif(!PHPMailer::validateAddress(\$to)) {"; - $example_code .= "\n throw new phpmailerAppException(\"Email address \" . " . - "\$to . \" is invalid -- aborting!\");"; - $example_code .= "\n}"; - - switch ($_POST['test_type']) { - case 'smtp': - $mail->isSMTP(); // telling the class to use SMTP - $mail->SMTPDebug = (integer)$_POST['smtp_debug']; - $mail->Host = $_POST['smtp_server']; // SMTP server - $mail->Port = (integer)$_POST['smtp_port']; // set the SMTP port - if ($_POST['smtp_secure']) { - $mail->SMTPSecure = strtolower($_POST['smtp_secure']); - } - $mail->SMTPAuth = array_key_exists('smtp_authenticate', $_POST); // enable SMTP authentication? - if (array_key_exists('smtp_authenticate', $_POST)) { - $mail->Username = $_POST['authenticate_username']; // SMTP account username - $mail->Password = $_POST['authenticate_password']; // SMTP account password - } - - $example_code .= "\n\$mail->isSMTP();"; - $example_code .= "\n\$mail->SMTPDebug = " . $_POST['smtp_debug'] . ";"; - $example_code .= "\n\$mail->Host = \"" . $_POST['smtp_server'] . "\";"; - $example_code .= "\n\$mail->Port = \"" . $_POST['smtp_port'] . "\";"; - $example_code .= "\n\$mail->SMTPSecure = \"" . strtolower($_POST['smtp_secure']) . "\";"; - $example_code .= "\n\$mail->SMTPAuth = " . (array_key_exists( - 'smtp_authenticate', - $_POST - ) ? 'true' : 'false') . ";"; - if (array_key_exists('smtp_authenticate', $_POST)) { - $example_code .= "\n\$mail->Username = \"" . $_POST['authenticate_username'] . "\";"; - $example_code .= "\n\$mail->Password = \"" . $_POST['authenticate_password'] . "\";"; - } - break; - case 'mail': - $mail->isMail(); // telling the class to use PHP's mail() - $example_code .= "\n\$mail->isMail();"; - break; - case 'sendmail': - $mail->isSendmail(); // telling the class to use Sendmail - $example_code .= "\n\$mail->isSendmail();"; - break; - case 'qmail': - $mail->isQmail(); // telling the class to use Qmail - $example_code .= "\n\$mail->isQmail();"; - break; - default: - throw new phpmailerAppException('Invalid test_type provided'); - } - - try { - if ($_POST['From_Name'] != '') { - $mail->addReplyTo($_POST['From_Email'], $_POST['From_Name']); - $mail->setFrom($_POST['From_Email'], $_POST['From_Name']); - - $example_code .= "\n\$mail->addReplyTo(\"" . - $_POST['From_Email'] . "\", \"" . $_POST['From_Name'] . "\");"; - $example_code .= "\n\$mail->setFrom(\"" . - $_POST['From_Email'] . "\", \"" . $_POST['From_Name'] . "\");"; - } else { - $mail->addReplyTo($_POST['From_Email']); - $mail->setFrom($_POST['From_Email'], $_POST['From_Email']); - - $example_code .= "\n\$mail->addReplyTo(\"" . $_POST['From_Email'] . "\");"; - $example_code .= "\n\$mail->setFrom(\"" . - $_POST['From_Email'] . "\", \"" . $_POST['From_Email'] . "\");"; - } - - if ($_POST['To_Name'] != '') { - $mail->addAddress($to, $_POST['To_Name']); - $example_code .= "\n\$mail->addAddress(\"$to\", \"" . $_POST['To_Name'] . "\");"; - } else { - $mail->addAddress($to); - $example_code .= "\n\$mail->addAddress(\"$to\");"; - } - - if ($_POST['bcc_Email'] != '') { - $indiBCC = explode(" ", $_POST['bcc_Email']); - foreach ($indiBCC as $key => $value) { - $mail->addBCC($value); - $example_code .= "\n\$mail->addBCC(\"$value\");"; - } - } - - if ($_POST['cc_Email'] != '') { - $indiCC = explode(" ", $_POST['cc_Email']); - foreach ($indiCC as $key => $value) { - $mail->addCC($value); - $example_code .= "\n\$mail->addCC(\"$value\");"; - } - } - } catch (phpmailerException $e) { //Catch all kinds of bad addressing - throw new phpmailerAppException($e->getMessage()); - } - $mail->Subject = $_POST['Subject'] . ' (PHPMailer test using ' . strtoupper($_POST['test_type']) . ')'; - $example_code .= "\n\$mail->Subject = \"" . $_POST['Subject'] . - ' (PHPMailer test using ' . strtoupper($_POST['test_type']) . ')";'; - - if ($_POST['Message'] == '') { - $body = file_get_contents('contents.html'); - } else { - $body = $_POST['Message']; - } - - $example_code .= "\n\$body = <<<'EOT'\n" . htmlentities($body) . "\nEOT;"; - - $mail->WordWrap = 78; // set word wrap to the RFC2822 limit - $mail->msgHTML($body, dirname(__FILE__), true); //Create message bodies and embed images - - $example_code .= "\n\$mail->WordWrap = 78;"; - $example_code .= "\n\$mail->msgHTML(\$body, dirname(__FILE__), true); //Create message bodies and embed images"; - - $mail->addAttachment('images/phpmailer_mini.png', 'phpmailer_mini.png'); // optional name - $mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name - $example_code .= "\n\$mail->addAttachment('images/phpmailer_mini.png'," . - "'phpmailer_mini.png'); // optional name"; - $example_code .= "\n\$mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name"; - - $example_code .= "\n\ntry {"; - $example_code .= "\n \$mail->send();"; - $example_code .= "\n \$results_messages[] = \"Message has been sent using " . - strtoupper($_POST['test_type']) . "\";"; - $example_code .= "\n}"; - $example_code .= "\ncatch (phpmailerException \$e) {"; - $example_code .= "\n throw new phpmailerAppException('Unable to send to: ' . \$to. ': '.\$e->getMessage());"; - $example_code .= "\n}"; - - try { - $mail->send(); - $results_messages[] = "Message has been sent using " . strtoupper($_POST["test_type"]); - } catch (phpmailerException $e) { - throw new phpmailerAppException("Unable to send to: " . $to . ': ' . $e->getMessage()); - } - } -} catch (phpmailerAppException $e) { - $results_messages[] = $e->errorMessage(); -} -$example_code .= "\n}"; -$example_code .= "\ncatch (phpmailerAppException \$e) {"; -$example_code .= "\n \$results_messages[] = \$e->errorMessage();"; -$example_code .= "\n}"; -$example_code .= "\n\nif (count(\$results_messages) > 0) {"; -$example_code .= "\n echo \"<h2>Run results</h2>\\n\";"; -$example_code .= "\n echo \"<ul>\\n\";"; -$example_code .= "\nforeach (\$results_messages as \$result) {"; -$example_code .= "\n echo \"<li>\$result</li>\\n\";"; -$example_code .= "\n}"; -$example_code .= "\necho \"</ul>\\n\";"; -$example_code .= "\n}"; -?><!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>PHPMailer Test Page</title> - <script type="text/javascript" src="scripts/shCore.js"></script> - <script type="text/javascript" src="scripts/shBrushPhp.js"></script> - <link type="text/css" rel="stylesheet" href="styles/shCore.css"> - <link type="text/css" rel="stylesheet" href="styles/shThemeDefault.css"> - <style> - body { - font-family: Arial, Helvetica, sans-serif; - font-size: 1em; - padding: 1em; - } - - table { - margin: 0 auto; - border-spacing: 0; - border-collapse: collapse; - } - - table.column { - border-collapse: collapse; - background-color: #FFFFFF; - padding: 0.5em; - width: 35em; - } - - td { - font-size: 1em; - padding: 0.1em 0.25em; - -moz-border-radius: 1em; - -webkit-border-radius: 1em; - border-radius: 1em; - } - - td.colleft { - text-align: right; - width: 35%; - } - - td.colrite { - text-align: left; - width: 65%; - } - - fieldset { - padding: 1em 1em 1em 1em; - margin: 0 2em; - border-radius: 1.5em; - -webkit-border-radius: 1em; - -moz-border-radius: 1em; - } - - fieldset.inner { - width: 40%; - } - - fieldset:hover, tr:hover { - background-color: #fafafa; - } - - legend { - font-weight: bold; - font-size: 1.1em; - } - - div.column-left { - float: left; - width: 45em; - height: 31em; - } - - div.column-right { - display: inline; - width: 45em; - max-height: 31em; - } - - input.radio { - float: left; - } - - div.radio { - padding: 0.2em; - } - </style> - <script> - SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf'; - SyntaxHighlighter.all(); - - function startAgain() { - var post_params = { - "From_Name": "<?php echo $from_name; ?>", - "From_Email": "<?php echo $from_email; ?>", - "To_Name": "<?php echo $to_name; ?>", - "To_Email": "<?php echo $to_email; ?>", - "cc_Email": "<?php echo $cc_email; ?>", - "bcc_Email": "<?php echo $bcc_email; ?>", - "Subject": "<?php echo $subject; ?>", - "Message": "<?php echo $message; ?>", - "test_type": "<?php echo $test_type; ?>", - "smtp_debug": "<?php echo $smtp_debug; ?>", - "smtp_server": "<?php echo $smtp_server; ?>", - "smtp_port": "<?php echo $smtp_port; ?>", - "smtp_secure": "<?php echo $smtp_secure; ?>", - "smtp_authenticate": "<?php echo $smtp_authenticate; ?>", - "authenticate_username": "<?php echo $authenticate_username; ?>", - "authenticate_password": "<?php echo $authenticate_password; ?>" - }; - - var resetForm = document.createElement("form"); - resetForm.setAttribute("method", "POST"); - resetForm.setAttribute("path", "index.php"); - - for (var k in post_params) { - var h = document.createElement("input"); - h.setAttribute("type", "hidden"); - h.setAttribute("name", k); - h.setAttribute("value", post_params[k]); - resetForm.appendChild(h); - } - - document.body.appendChild(resetForm); - resetForm.submit(); - } - - function showHideDiv(test, element_id) { - var ops = {"smtp-options-table": "smtp"}; - - if (test == ops[element_id]) { - document.getElementById(element_id).style.display = "block"; - } else { - document.getElementById(element_id).style.display = "none"; - } - } - </script> -</head> -<body> -<?php -if (version_compare(PHP_VERSION, '5.0.0', '<')) { - echo 'Current PHP version: ' . phpversion() . "<br>"; - echo exit("ERROR: Wrong PHP version. Must be PHP 5 or above."); -} - -if (count($results_messages) > 0) { - echo '<h2>Run results</h2>'; - echo '<ul>'; - foreach ($results_messages as $result) { - echo "<li>$result</li>"; - } - echo '</ul>'; -} - -if (isset($_POST["submit"]) && $_POST["submit"] == "Submit") { - echo "<button type=\"submit\" onclick=\"startAgain();\">Start Over</button><br>\n"; - echo "<br><span>Script:</span>\n"; - echo "<pre class=\"brush: php;\">\n"; - echo $example_code; - echo "\n</pre>\n"; - echo "\n<hr style=\"margin: 3em;\">\n"; -} -?> -<form method="POST" enctype="multipart/form-data"> - <div> - <div class="column-left"> - <fieldset> - <legend>Mail Details</legend> - <table border="1" class="column"> - <tr> - <td class="colleft"> - <label for="From_Name"><strong>From</strong> Name</label> - </td> - <td class="colrite"> - <input type="text" id="From_Name" name="From_Name" value="<?php echo $from_name; ?>" - style="width:95%;" autofocus placeholder="Your Name"> - </td> - </tr> - <tr> - <td class="colleft"> - <label for="From_Email"><strong>From</strong> Email Address</label> - </td> - <td class="colrite"> - <input type="text" id="From_Email" name="From_Email" value="<?php echo $from_email; ?>" - style="width:95%;" required placeholder="Your.Email@example.com"> - </td> - </tr> - <tr> - <td class="colleft"> - <label for="To_Name"><strong>To</strong> Name</label> - </td> - <td class="colrite"> - <input type="text" id="To_Name" name="To_Name" value="<?php echo $to_name; ?>" - style="width:95%;" placeholder="Recipient's Name"> - </td> - </tr> - <tr> - <td class="colleft"> - <label for="To_Email"><strong>To</strong> Email Address</label> - </td> - <td class="colrite"> - <input type="text" id="To_Email" name="To_Email" value="<?php echo $to_email; ?>" - style="width:95%;" required placeholder="Recipients.Email@example.com"> - </td> - </tr> - <tr> - <td class="colleft"> - <label for="cc_Email"><strong>CC Recipients</strong><br> - <small>(separate with commas)</small> - </label> - </td> - <td class="colrite"> - <input type="text" id="cc_Email" name="cc_Email" value="<?php echo $cc_email; ?>" - style="width:95%;" placeholder="cc1@example.com, cc2@example.com"> - </td> - </tr> - <tr> - <td class="colleft"> - <label for="bcc_Email"><strong>BCC Recipients</strong><br> - <small>(separate with commas)</small> - </label> - </td> - <td class="colrite"> - <input type="text" id="bcc_Email" name="bcc_Email" value="<?php echo $bcc_email; ?>" - style="width:95%;" placeholder="bcc1@example.com, bcc2@example.com"> - </td> - </tr> - <tr> - <td class="colleft"> - <label for="Subject"><strong>Subject</strong></label> - </td> - <td class="colrite"> - <input type="text" name="Subject" id="Subject" value="<?php echo $subject; ?>" - style="width:95%;" placeholder="Email Subject"> - </td> - </tr> - <tr> - <td class="colleft"> - <label for="Message"><strong>Message</strong><br> - <small>If blank, will use content.html</small> - </label> - </td> - <td class="colrite"> - <textarea name="Message" id="Message" style="width:95%;height:5em;" - placeholder="Body of your email"><?php echo $message; ?></textarea> - </td> - </tr> - </table> - <div style="margin:1em 0;">Test will include two attachments.</div> - </fieldset> - </div> - <div class="column-right"> - <fieldset class="inner"> <!-- SELECT TYPE OF MAIL --> - <legend>Mail Test Specs</legend> - <table border="1" class="column"> - <tr> - <td class="colleft">Test Type</td> - <td class="colrite"> - <div class="radio"> - <label for="radio-mail">Mail()</label> - <input class="radio" type="radio" name="test_type" value="mail" id="radio-mail" - onclick="showHideDiv(this.value, 'smtp-options-table');" - <?php echo ($test_type == 'mail') ? 'checked' : ''; ?> - required> - </div> - <div class="radio"> - <label for="radio-sendmail">Sendmail</label> - <input class="radio" type="radio" name="test_type" value="sendmail" id="radio-sendmail" - onclick="showHideDiv(this.value, 'smtp-options-table');" - <?php echo ($test_type == 'sendmail') ? 'checked' : ''; ?> - required> - </div> - <div class="radio"> - <label for="radio-qmail">Qmail</label> - <input class="radio" type="radio" name="test_type" value="qmail" id="radio-qmail" - onclick="showHideDiv(this.value, 'smtp-options-table');" - <?php echo ($test_type == 'qmail') ? 'checked' : ''; ?> - required> - </div> - <div class="radio"> - <label for="radio-smtp">SMTP</label> - <input class="radio" type="radio" name="test_type" value="smtp" id="radio-smtp" - onclick="showHideDiv(this.value, 'smtp-options-table');" - <?php echo ($test_type == 'smtp') ? 'checked' : ''; ?> - required> - </div> - </td> - </tr> - </table> - <div id="smtp-options-table" style="margin:1em 0 0 0; -<?php if ($test_type != 'smtp') { - echo "display: none;"; -} ?>"> - <span style="margin:1.25em 0; display:block;"><strong>SMTP Specific Options:</strong></span> - <table border="1" class="column"> - <tr> - <td class="colleft"><label for="smtp_debug">SMTP Debug ?</label></td> - <td class="colrite"> - <select size="1" id="smtp_debug" name="smtp_debug"> - <option <?php echo ($smtp_debug == '0') ? 'selected' : ''; ?> value="0"> - 0 - Disabled - </option> - <option <?php echo ($smtp_debug == '1') ? 'selected' : ''; ?> value="1"> - 1 - Client messages - </option> - <option <?php echo ($smtp_debug == '2') ? 'selected' : ''; ?> value="2"> - 2 - Client and server messages - </option> - </select> - </td> - </tr> - <tr> - <td class="colleft"><label for="smtp_server">SMTP Server</label></td> - <td class="colrite"> - <input type="text" id="smtp_server" name="smtp_server" - value="<?php echo $smtp_server; ?>" style="width:95%;" - placeholder="smtp.server.com"> - </td> - </tr> - <tr> - <td class="colleft" style="width: 5em;"><label for="smtp_port">SMTP Port</label></td> - <td class="colrite"> - <input type="text" name="smtp_port" id="smtp_port" size="3" - value="<?php echo $smtp_port; ?>" placeholder="Port"> - </td> - </tr> - <tr> - <td class="colleft"><label for="smtp_secure">SMTP Security</label></td> - <td> - <select size="1" name="smtp_secure" id="smtp_secure"> - <option <?php echo ($smtp_secure == 'none') ? 'selected' : '' ?>>None</option> - <option <?php echo ($smtp_secure == 'tls') ? 'selected' : '' ?>>TLS</option> - <option <?php echo ($smtp_secure == 'ssl') ? 'selected' : '' ?>>SSL</option> - </select> - </td> - </tr> - <tr> - <td class="colleft"><label for="smtp-authenticate">SMTP Authenticate?</label></td> - <td class="colrite"> - <input type="checkbox" id="smtp-authenticate" - name="smtp_authenticate" -<?php if ($smtp_authenticate != '') { - echo "checked"; -} ?> - value="<?php echo $smtp_authenticate; ?>"> - </td> - </tr> - <tr> - <td class="colleft"><label for="authenticate_username">Authenticate Username</label></td> - <td class="colrite"> - <input type="text" id="authenticate_username" name="authenticate_username" - value="<?php echo $authenticate_username; ?>" style="width:95%;" - placeholder="SMTP Server Username"> - </td> - </tr> - <tr> - <td class="colleft"><label for="authenticate_password">Authenticate Password</label></td> - <td class="colrite"> - <input type="password" name="authenticate_password" id="authenticate_password" - value="<?php echo $authenticate_password; ?>" style="width:95%;" - placeholder="SMTP Server Password"> - </td> - </tr> - </table> - </div> - </fieldset> - </div> - <br style="clear:both;"> - - <div style="margin-left:2em; margin-bottom:5em; float:left;"> - <div style="margin-bottom: 1em; "> - <input type="submit" value="Submit" name="submit"> - </div> - <?php echo 'Current PHP version: ' . phpversion(); ?> - </div> - </div> -</form> -</body> -</html>
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <title>PHPMailer Test</title> -</head> -<body> -<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;"> - <h1>This is a test of PHPMailer.</h1> - <div align="center"> - <a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a> - </div> - <p>This example uses <strong>HTML</strong>.</p> - <p>ISO-8859-1 text: éèîüçÅñæß</p> -</div> -</body> -</html>
@@ -1,20 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>PHPMailer Test</title> -</head> -<body> -<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;"> - <h1>This is a test of PHPMailer.</h1> - <div align="center"> - <a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a> - </div> - <p>This example uses <strong>HTML</strong>.</p> - <p>Chinese text: 郵件內容為空</p> - <p>Russian text: ПуÑтое тело ÑообщениÑ</p> - <p>Armenian text: Õ€Õ¡Õ²Õ¸Ö€Õ¤Õ¡Õ£Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨ Õ¤Õ¡Õ¿Õ¡Ö€Õ¯ Õ§</p> - <p>Czech text: Prázdné tÄ›lo zprávy</p> -</div> -</body> -</html>
@@ -1,35 +0,0 @@
-<?php -/** - * This example shows how to make use of PHPMailer's exceptions for error handling. - */ - -require '../PHPMailerAutoload.php'; - -//Create a new PHPMailer instance -//Passing true to the constructor enables the use of exceptions for error handling -$mail = new PHPMailer(true); -try { - //Set who the message is to be sent from - $mail->setFrom('from@example.com', 'First Last'); - //Set an alternative reply-to address - $mail->addReplyTo('replyto@example.com', 'First Last'); - //Set who the message is to be sent to - $mail->addAddress('whoto@example.com', 'John Doe'); - //Set the subject line - $mail->Subject = 'PHPMailer Exceptions test'; - //Read an HTML message body from an external file, convert referenced images to embedded, - //and convert the HTML into a basic plain-text alternative body - $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); - //Replace the plain text body with one created manually - $mail->AltBody = 'This is a plain-text message body'; - //Attach an image file - $mail->addAttachment('images/phpmailer_mini.png'); - //send the message - //Note that we don't need check the response from this because it will throw an exception if it has trouble - $mail->send(); - echo "Message sent!"; -} catch (phpmailerException $e) { - echo $e->errorMessage(); //Pretty error messages from PHPMailer -} catch (Exception $e) { - echo $e->getMessage(); //Boring error messages from anything else! -}
@@ -1,75 +0,0 @@
-<?php -/** - * This example shows settings to use when sending via Google's Gmail servers. - */ - -//SMTP needs accurate times, and the PHP time zone MUST be set -//This should be done in your php.ini, but this is how to do it if you don't have access to that -date_default_timezone_set('Etc/UTC'); - -require '../PHPMailerAutoload.php'; - -//Create a new PHPMailer instance -$mail = new PHPMailer; - -//Tell PHPMailer to use SMTP -$mail->isSMTP(); - -//Enable SMTP debugging -// 0 = off (for production use) -// 1 = client messages -// 2 = client and server messages -$mail->SMTPDebug = 2; - -//Ask for HTML-friendly debug output -$mail->Debugoutput = 'html'; - -//Set the hostname of the mail server -$mail->Host = 'smtp.gmail.com'; -// use -// $mail->Host = gethostbyname('smtp.gmail.com'); -// if your network does not support SMTP over IPv6 - -//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission -$mail->Port = 587; - -//Set the encryption system to use - ssl (deprecated) or tls -$mail->SMTPSecure = 'tls'; - -//Whether to use SMTP authentication -$mail->SMTPAuth = true; - -//Username to use for SMTP authentication - use full email address for gmail -$mail->Username = "username@gmail.com"; - -//Password to use for SMTP authentication -$mail->Password = "yourpassword"; - -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); - -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); - -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); - -//Set the subject line -$mail->Subject = 'PHPMailer GMail SMTP test'; - -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); - -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; - -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -}
@@ -1,85 +0,0 @@
-<?php -/** - * This example shows settings to use when sending via Google's Gmail servers. - */ - -//SMTP needs accurate times, and the PHP time zone MUST be set -//This should be done in your php.ini, but this is how to do it if you don't have access to that -date_default_timezone_set('Etc/UTC'); - -require '../PHPMailerAutoload.php'; - -//Load dependencies from composer -//If this causes an error, run 'composer install' -require '../vendor/autoload.php'; - -//Create a new PHPMailer instance -$mail = new PHPMailerOAuth; - -//Tell PHPMailer to use SMTP -$mail->isSMTP(); - -//Enable SMTP debugging -// 0 = off (for production use) -// 1 = client messages -// 2 = client and server messages -$mail->SMTPDebug = 0; - -//Ask for HTML-friendly debug output -$mail->Debugoutput = 'html'; - -//Set the hostname of the mail server -$mail->Host = 'smtp.gmail.com'; - -//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission -$mail->Port = 587; - -//Set the encryption system to use - ssl (deprecated) or tls -$mail->SMTPSecure = 'tls'; - -//Whether to use SMTP authentication -$mail->SMTPAuth = true; - -//Set AuthType -$mail->AuthType = 'XOAUTH2'; - -//User Email to use for SMTP authentication - Use the same Email used in Google Developer Console -$mail->oauthUserEmail = "someone@gmail.com"; - -//Obtained From Google Developer Console -$mail->oauthClientId = "RANDOMCHARS-----duv1n2.apps.googleusercontent.com"; - -//Obtained From Google Developer Console -$mail->oauthClientSecret = "RANDOMCHARS-----lGyjPcRtvP"; - -//Obtained By running get_oauth_token.php after setting up APP in Google Developer Console. -//Set Redirect URI in Developer Console as [https/http]://<yourdomain>/<folder>/get_oauth_token.php -// eg: http://localhost/phpmail/get_oauth_token.php -$mail->oauthRefreshToken = "RANDOMCHARS-----DWxgOvPT003r-yFUV49TQYag7_Aod7y0"; - -//Set who the message is to be sent from -//For gmail, this generally needs to be the same as the user you logged in as -$mail->setFrom('from@example.com', 'First Last'); - -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); - -//Set the subject line -$mail->Subject = 'PHPMailer GMail SMTP test'; - -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); - -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; - -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -}
@@ -1,48 +0,0 @@
-<!DOCTYPE html> -<html> -<head> - <meta charset="UTF-8"> - <title>PHPMailer Examples</title> -</head> -<body> -<h1>PHPMailer code examples<a href="https://github.com/PHPMailer/PHPMailer"><img src="images/phpmailer.png" style="float:right; border:0;" alt="PHPMailer logo"></a></h1> -<p>This folder contains a collection of examples of using <a href="https://github.com/PHPMailer/PHPMailer">PHPMailer</a>.</p> -<h2>About testing email sending</h2> -<p>When working on email sending code you'll find yourself worrying about what might happen if all these test emails got sent to your mailing list. The solution is to use a fake mail server, one that acts just like the real thing, but just doesn't actually send anything out. Some offer web interfaces, feedback, logging, the ability to return specific error codes, all things that are useful for testing error handling, authentication etc. Here's a selection of mail testing tools you might like to try:</p> -<ul> - <li><a href="https://github.com/Nilhcem/FakeSMTP">FakeSMTP</a>, a Java desktop app with the ability to show an SMTP log and save messages to a folder. </li> - <li><a href="https://github.com/isotoma/FakeEmail">FakeEmail</a>, a Python-based fake mail server with a web interface.</li> - <li><a href="http://www.postfix.org/smtp-sink.1.html">smtp-sink</a>, part of the Postfix mail server, so you probably already have this installed. This is used in the Travis-CI configuration to run PHPMailer's unit tests.</li> - <li><a href="http://smtp4dev.codeplex.com">smtp4dev</a>, a dummy SMTP server for Windows.</li> - <li><a href="https://github.com/PHPMailer/PHPMailer/blob/master/test/fakesendmail.sh">fakesendmail.sh</a>, part of PHPMailer's test setup, this is a shell script that emulates sendmail for testing 'mail' or 'sendmail' methods in PHPMailer.</li> - <li><a href="http://tools.ietf.org/tools/msglint/">msglint</a>, not a mail server, the IETF's MIME structure analyser checks the formatting of your messages.</li> -</ul> -<div style="padding: 8px; color: #333333; background-color: #dc8b92"> -<h2>Security note</h2> -<p>Before running these examples you'll need to rename them with '.php' extensions. They are supplied as '.phps' files which will usually be displayed with syntax highlighting by PHP instead of running them. This prevents potential security issues with running potential spam-gateway code if you happen to deploy these code examples on a live site - <em>please don't do that!</em> Similarly, don't leave your passwords in these files as they will be visible to the world!</p> -</div> -<h2><a href="code_generator.phps">code_generator.phps</a></h2> -<p>This script is a simple code generator - fill in the form and hit submit, and it will use when you entered to email you a message, and will also generate PHP code using your settings that you can copy and paste to use in your own apps. If you need to get going quickly, this is probably the best place to start.</p> -<h2><a href="mail.phps">mail.phps</a></h2> -<p>This script is a basic example which creates an email message from an external HTML file, creates a plain text body, sets various addresses, adds an attachment and sends the message. It uses PHP's built-in mail() function which is the simplest to use, but relies on the presence of a local mail server, something which is not usually available on Windows. If you find yourself in that situation, either install a local mail server, or use a remote one and send using SMTP instead.</p> -<h2><a href="exceptions.phps">exceptions.phps</a></h2> -<p>The same as the mail example, but shows how to use PHPMailer's optional exceptions for error handling.</p> -<h2><a href="smtp.phps">smtp.phps</a></h2> -<p>A simple example sending using SMTP with authentication.</p> -<h2><a href="smtp_no_auth.phps">smtp_no_auth.phps</a></h2> -<p>A simple example sending using SMTP without authentication.</p> -<h2><a href="sendmail.phps">sendmail.phps</a></h2> -<p>A simple example using sendmail. Sendmail is a program (usually found on Linux/BSD, OS X and other UNIX-alikes) that can be used to submit messages to a local mail server without a lengthy SMTP conversation. It's probably the fastest sending mechanism, but lacks some error reporting features. There are sendmail emulators for most popular mail servers including postfix, qmail, exim etc.</p> -<h2><a href="gmail.phps">gmail.phps</a></h2> -<p>Submitting email via Google's Gmail service is a popular use of PHPMailer. It's much the same as normal SMTP sending, just with some specific settings, namely using TLS encryption, authentication is enabled, and it connects to the SMTP submission port 587 on the smtp.gmail.com host. This example does all that.</p> -<h2><a href="pop_before_smtp.phps">pop_before_smtp.phps</a></h2> -<p>Before effective SMTP authentication mechanisms were available, it was common for ISPs to use POP-before-SMTP authentication. As it implies, you authenticate using the POP3 protocol (an older protocol now mostly replaced by the far superior IMAP), and then the SMTP server will allow send access from your IP address for a short while, usually 5-15 minutes. PHPMailer includes a POP3 protocol client, so it can carry out this sequence - it's just like a normal SMTP conversation (without authentication), but connects via POP first.</p> -<h2><a href="mailing_list.phps">mailing_list.phps</a></h2> -<p>This is a somewhat naïve example of sending similar emails to a list of different addresses. It sets up a PHPMailer instance using SMTP, then connects to a MySQL database to retrieve a list of recipients. The code loops over this list, sending email to each person using their info and marks them as sent in the database. It makes use of SMTP keepalive which saves reconnecting and re-authenticating between each message.</p> -<hr> -<h2><a href="smtp_check.phps">smtp_check.phps</a></h2> -<p>This is an example showing how to use the SMTP class by itself (without PHPMailer) to check an SMTP connection.</p> -<hr> -<p>Most of these examples use the 'example.com' domain. This domain is reserved by IANA for illustrative purposes, as documented in <a href="http://tools.ietf.org/html/rfc2606">RFC 2606</a>. Don't use made-up domains like 'mydomain.com' or 'somedomain.com' in examples as someone, somewhere, probably owns them!</p> -</body> -</html>
@@ -1,31 +0,0 @@
-<?php -/** - * This example shows sending a message using PHP's mail() function. - */ - -require '../PHPMailerAutoload.php'; - -//Create a new PHPMailer instance -$mail = new PHPMailer; -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); -//Set the subject line -$mail->Subject = 'PHPMailer mail() test'; -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -}
@@ -1,59 +0,0 @@
-<?php - -error_reporting(E_STRICT | E_ALL); - -date_default_timezone_set('Etc/UTC'); - -require '../PHPMailerAutoload.php'; - -$mail = new PHPMailer; - -$body = file_get_contents('contents.html'); - -$mail->isSMTP(); -$mail->Host = 'smtp.example.com'; -$mail->SMTPAuth = true; -$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead -$mail->Port = 25; -$mail->Username = 'yourname@example.com'; -$mail->Password = 'yourpassword'; -$mail->setFrom('list@example.com', 'List manager'); -$mail->addReplyTo('list@example.com', 'List manager'); - -$mail->Subject = "PHPMailer Simple database mailing list test"; - -//Same body for all messages, so set this before the sending loop -//If you generate a different body for each recipient (e.g. you're using a templating system), -//set it inside the loop -$mail->msgHTML($body); -//msgHTML also sets AltBody, but if you want a custom one, set it afterwards -$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; - -//Connect to the database and select the recipients from your mailing list that have not yet been sent to -//You'll need to alter this to match your database -$mysql = mysqli_connect('localhost', 'username', 'password'); -mysqli_select_db($mysql, 'mydb'); -$result = mysqli_query($mysql, 'SELECT full_name, email, photo FROM mailinglist WHERE sent = false'); - -foreach ($result as $row) { //This iterator syntax only works in PHP 5.4+ - $mail->addAddress($row['email'], $row['full_name']); - if (!empty($row['photo'])) { - $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg'); //Assumes the image data is stored in the DB - } - - if (!$mail->send()) { - echo "Mailer Error (" . str_replace("@", "@", $row["email"]) . ') ' . $mail->ErrorInfo . '<br />'; - break; //Abandon sending - } else { - echo "Message sent to :" . $row['full_name'] . ' (' . str_replace("@", "@", $row['email']) . ')<br />'; - //Mark it as sent in the DB - mysqli_query( - $mysql, - "UPDATE mailinglist SET sent = true WHERE email = '" . - mysqli_real_escape_string($mysql, $row['email']) . "'" - ); - } - // Clear all addresses and attachments for next loop - $mail->clearAddresses(); - $mail->clearAttachments(); -}
@@ -1,54 +0,0 @@
-<?php -/** - * This example shows how to use POP-before-SMTP for authentication. - */ - -require '../PHPMailerAutoload.php'; - -//Authenticate via POP3. -//After this you should be allowed to submit messages over SMTP for a while. -//Only applies if your host supports POP-before-SMTP. -$pop = POP3::popBeforeSmtp('pop3.example.com', 110, 30, 'username', 'password', 1); - -//Create a new PHPMailer instance -//Passing true to the constructor enables the use of exceptions for error handling -$mail = new PHPMailer(true); -try { - $mail->isSMTP(); - //Enable SMTP debugging - // 0 = off (for production use) - // 1 = client messages - // 2 = client and server messages - $mail->SMTPDebug = 2; - //Ask for HTML-friendly debug output - $mail->Debugoutput = 'html'; - //Set the hostname of the mail server - $mail->Host = "mail.example.com"; - //Set the SMTP port number - likely to be 25, 465 or 587 - $mail->Port = 25; - //Whether to use SMTP authentication - $mail->SMTPAuth = false; - //Set who the message is to be sent from - $mail->setFrom('from@example.com', 'First Last'); - //Set an alternative reply-to address - $mail->addReplyTo('replyto@example.com', 'First Last'); - //Set who the message is to be sent to - $mail->addAddress('whoto@example.com', 'John Doe'); - //Set the subject line - $mail->Subject = 'PHPMailer POP-before-SMTP test'; - //Read an HTML message body from an external file, convert referenced images to embedded, - //and convert the HTML into a basic plain-text alternative body - $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); - //Replace the plain text body with one created manually - $mail->AltBody = 'This is a plain-text message body'; - //Attach an image file - $mail->addAttachment('images/phpmailer_mini.png'); - //send the message - //Note that we don't need check the response from this because it will throw an exception if it has trouble - $mail->send(); - echo "Message sent!"; -} catch (phpmailerException $e) { - echo $e->errorMessage(); //Pretty error messages from PHPMailer -} catch (Exception $e) { - echo $e->getMessage(); //Boring error messages from anything else! -}
@@ -1,664 +0,0 @@
-// XRegExp 1.5.1 -// (c) 2007-2012 Steven Levithan -// MIT License -// <http://xregexp.com> -// Provides an augmented, extensible, cross-browser implementation of regular expressions, -// including support for additional syntax, flags, and methods - -var XRegExp; - -if (XRegExp) { - // Avoid running twice, since that would break references to native globals - throw Error("can't load XRegExp twice in the same frame"); -} - -// Run within an anonymous function to protect variables and avoid new globals -(function (undefined) { - - //--------------------------------- - // Constructor - //--------------------------------- - - // Accepts a pattern and flags; returns a new, extended `RegExp` object. Differs from a native - // regular expression in that additional syntax and flags are supported and cross-browser - // syntax inconsistencies are ameliorated. `XRegExp(/regex/)` clones an existing regex and - // converts to type XRegExp - XRegExp = function (pattern, flags) { - var output = [], - currScope = XRegExp.OUTSIDE_CLASS, - pos = 0, - context, tokenResult, match, chr, regex; - - if (XRegExp.isRegExp(pattern)) { - if (flags !== undefined) - throw TypeError("can't supply flags when constructing one RegExp from another"); - return clone(pattern); - } - // Tokens become part of the regex construction process, so protect against infinite - // recursion when an XRegExp is constructed within a token handler or trigger - if (isInsideConstructor) - throw Error("can't call the XRegExp constructor within token definition functions"); - - flags = flags || ""; - context = { // `this` object for custom tokens - hasNamedCapture: false, - captureNames: [], - hasFlag: function (flag) {return flags.indexOf(flag) > -1;}, - setFlag: function (flag) {flags += flag;} - }; - - while (pos < pattern.length) { - // Check for custom tokens at the current position - tokenResult = runTokens(pattern, pos, currScope, context); - - if (tokenResult) { - output.push(tokenResult.output); - pos += (tokenResult.match[0].length || 1); - } else { - // Check for native multicharacter metasequences (excluding character classes) at - // the current position - if (match = nativ.exec.call(nativeTokens[currScope], pattern.slice(pos))) { - output.push(match[0]); - pos += match[0].length; - } else { - chr = pattern.charAt(pos); - if (chr === "[") - currScope = XRegExp.INSIDE_CLASS; - else if (chr === "]") - currScope = XRegExp.OUTSIDE_CLASS; - // Advance position one character - output.push(chr); - pos++; - } - } - } - - regex = RegExp(output.join(""), nativ.replace.call(flags, flagClip, "")); - regex._xregexp = { - source: pattern, - captureNames: context.hasNamedCapture ? context.captureNames : null - }; - return regex; - }; - - - //--------------------------------- - // Public properties - //--------------------------------- - - XRegExp.version = "1.5.1"; - - // Token scope bitflags - XRegExp.INSIDE_CLASS = 1; - XRegExp.OUTSIDE_CLASS = 2; - - - //--------------------------------- - // Private variables - //--------------------------------- - - var replacementToken = /\$(?:(\d\d?|[$&`'])|{([$\w]+)})/g, - flagClip = /[^gimy]+|([\s\S])(?=[\s\S]*\1)/g, // Nonnative and duplicate flags - quantifier = /^(?:[?*+]|{\d+(?:,\d*)?})\??/, - isInsideConstructor = false, - tokens = [], - // Copy native globals for reference ("native" is an ES3 reserved keyword) - nativ = { - exec: RegExp.prototype.exec, - test: RegExp.prototype.test, - match: String.prototype.match, - replace: String.prototype.replace, - split: String.prototype.split - }, - compliantExecNpcg = nativ.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups - compliantLastIndexIncrement = function () { - var x = /^/g; - nativ.test.call(x, ""); - return !x.lastIndex; - }(), - hasNativeY = RegExp.prototype.sticky !== undefined, - nativeTokens = {}; - - // `nativeTokens` match native multicharacter metasequences only (including deprecated octals, - // excluding character classes) - nativeTokens[XRegExp.INSIDE_CLASS] = /^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/; - nativeTokens[XRegExp.OUTSIDE_CLASS] = /^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/; - - - //--------------------------------- - // Public methods - //--------------------------------- - - // Lets you extend or change XRegExp syntax and create custom flags. This is used internally by - // the XRegExp library and can be used to create XRegExp plugins. This function is intended for - // users with advanced knowledge of JavaScript's regular expression syntax and behavior. It can - // be disabled by `XRegExp.freezeTokens` - XRegExp.addToken = function (regex, handler, scope, trigger) { - tokens.push({ - pattern: clone(regex, "g" + (hasNativeY ? "y" : "")), - handler: handler, - scope: scope || XRegExp.OUTSIDE_CLASS, - trigger: trigger || null - }); - }; - - // Accepts a pattern and flags; returns an extended `RegExp` object. If the pattern and flag - // combination has previously been cached, the cached copy is returned; otherwise the newly - // created regex is cached - XRegExp.cache = function (pattern, flags) { - var key = pattern + "/" + (flags || ""); - return XRegExp.cache[key] || (XRegExp.cache[key] = XRegExp(pattern, flags)); - }; - - // Accepts a `RegExp` instance; returns a copy with the `/g` flag set. The copy has a fresh - // `lastIndex` (set to zero). If you want to copy a regex without forcing the `global` - // property, use `XRegExp(regex)`. Do not use `RegExp(regex)` because it will not preserve - // special properties required for named capture - XRegExp.copyAsGlobal = function (regex) { - return clone(regex, "g"); - }; - - // Accepts a string; returns the string with regex metacharacters escaped. The returned string - // can safely be used at any point within a regex to match the provided literal string. Escaped - // characters are [ ] { } ( ) * + ? - . , \ ^ $ | # and whitespace - XRegExp.escape = function (str) { - return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - }; - - // Accepts a string to search, regex to search with, position to start the search within the - // string (default: 0), and an optional Boolean indicating whether matches must start at-or- - // after the position or at the specified position only. This function ignores the `lastIndex` - // of the provided regex in its own handling, but updates the property for compatibility - XRegExp.execAt = function (str, regex, pos, anchored) { - var r2 = clone(regex, "g" + ((anchored && hasNativeY) ? "y" : "")), - match; - r2.lastIndex = pos = pos || 0; - match = r2.exec(str); // Run the altered `exec` (required for `lastIndex` fix, etc.) - if (anchored && match && match.index !== pos) - match = null; - if (regex.global) - regex.lastIndex = match ? r2.lastIndex : 0; - return match; - }; - - // Breaks the unrestorable link to XRegExp's private list of tokens, thereby preventing - // syntax and flag changes. Should be run after XRegExp and any plugins are loaded - XRegExp.freezeTokens = function () { - XRegExp.addToken = function () { - throw Error("can't run addToken after freezeTokens"); - }; - }; - - // Accepts any value; returns a Boolean indicating whether the argument is a `RegExp` object. - // Note that this is also `true` for regex literals and regexes created by the `XRegExp` - // constructor. This works correctly for variables created in another frame, when `instanceof` - // and `constructor` checks would fail to work as intended - XRegExp.isRegExp = function (o) { - return Object.prototype.toString.call(o) === "[object RegExp]"; - }; - - // Executes `callback` once per match within `str`. Provides a simpler and cleaner way to - // iterate over regex matches compared to the traditional approaches of subverting - // `String.prototype.replace` or repeatedly calling `exec` within a `while` loop - XRegExp.iterate = function (str, regex, callback, context) { - var r2 = clone(regex, "g"), - i = -1, match; - while (match = r2.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.) - if (regex.global) - regex.lastIndex = r2.lastIndex; // Doing this to follow expectations if `lastIndex` is checked within `callback` - callback.call(context, match, ++i, str, regex); - if (r2.lastIndex === match.index) - r2.lastIndex++; - } - if (regex.global) - regex.lastIndex = 0; - }; - - // Accepts a string and an array of regexes; returns the result of using each successive regex - // to search within the matches of the previous regex. The array of regexes can also contain - // objects with `regex` and `backref` properties, in which case the named or numbered back- - // references specified are passed forward to the next regex or returned. E.g.: - // var xregexpImgFileNames = XRegExp.matchChain(html, [ - // {regex: /<img\b([^>]+)>/i, backref: 1}, // <img> tag attributes - // {regex: XRegExp('(?ix) \\s src=" (?<src> [^"]+ )'), backref: "src"}, // src attribute values - // {regex: XRegExp("^http://xregexp\\.com(/[^#?]+)", "i"), backref: 1}, // xregexp.com paths - // /[^\/]+$/ // filenames (strip directory paths) - // ]); - XRegExp.matchChain = function (str, chain) { - return function recurseChain (values, level) { - var item = chain[level].regex ? chain[level] : {regex: chain[level]}, - regex = clone(item.regex, "g"), - matches = [], i; - for (i = 0; i < values.length; i++) { - XRegExp.iterate(values[i], regex, function (match) { - matches.push(item.backref ? (match[item.backref] || "") : match[0]); - }); - } - return ((level === chain.length - 1) || !matches.length) ? - matches : recurseChain(matches, level + 1); - }([str], 0); - }; - - - //--------------------------------- - // New RegExp prototype methods - //--------------------------------- - - // Accepts a context object and arguments array; returns the result of calling `exec` with the - // first value in the arguments array. the context is ignored but is accepted for congruity - // with `Function.prototype.apply` - RegExp.prototype.apply = function (context, args) { - return this.exec(args[0]); - }; - - // Accepts a context object and string; returns the result of calling `exec` with the provided - // string. the context is ignored but is accepted for congruity with `Function.prototype.call` - RegExp.prototype.call = function (context, str) { - return this.exec(str); - }; - - - //--------------------------------- - // Overriden native methods - //--------------------------------- - - // Adds named capture support (with backreferences returned as `result.name`), and fixes two - // cross-browser issues per ES3: - // - Captured values for nonparticipating capturing groups should be returned as `undefined`, - // rather than the empty string. - // - `lastIndex` should not be incremented after zero-length matches. - RegExp.prototype.exec = function (str) { - var match, name, r2, origLastIndex; - if (!this.global) - origLastIndex = this.lastIndex; - match = nativ.exec.apply(this, arguments); - if (match) { - // Fix browsers whose `exec` methods don't consistently return `undefined` for - // nonparticipating capturing groups - if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) { - r2 = RegExp(this.source, nativ.replace.call(getNativeFlags(this), "g", "")); - // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed - // matching due to characters outside the match - nativ.replace.call((str + "").slice(match.index), r2, function () { - for (var i = 1; i < arguments.length - 2; i++) { - if (arguments[i] === undefined) - match[i] = undefined; - } - }); - } - // Attach named capture properties - if (this._xregexp && this._xregexp.captureNames) { - for (var i = 1; i < match.length; i++) { - name = this._xregexp.captureNames[i - 1]; - if (name) - match[name] = match[i]; - } - } - // Fix browsers that increment `lastIndex` after zero-length matches - if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index)) - this.lastIndex--; - } - if (!this.global) - this.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows) - return match; - }; - - // Fix browser bugs in native method - RegExp.prototype.test = function (str) { - // Use the native `exec` to skip some processing overhead, even though the altered - // `exec` would take care of the `lastIndex` fixes - var match, origLastIndex; - if (!this.global) - origLastIndex = this.lastIndex; - match = nativ.exec.call(this, str); - // Fix browsers that increment `lastIndex` after zero-length matches - if (match && !compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index)) - this.lastIndex--; - if (!this.global) - this.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows) - return !!match; - }; - - // Adds named capture support and fixes browser bugs in native method - String.prototype.match = function (regex) { - if (!XRegExp.isRegExp(regex)) - regex = RegExp(regex); // Native `RegExp` - if (regex.global) { - var result = nativ.match.apply(this, arguments); - regex.lastIndex = 0; // Fix IE bug - return result; - } - return regex.exec(this); // Run the altered `exec` - }; - - // Adds support for `${n}` tokens for named and numbered backreferences in replacement text, - // and provides named backreferences to replacement functions as `arguments[0].name`. Also - // fixes cross-browser differences in replacement text syntax when performing a replacement - // using a nonregex search value, and the value of replacement regexes' `lastIndex` property - // during replacement iterations. Note that this doesn't support SpiderMonkey's proprietary - // third (`flags`) parameter - String.prototype.replace = function (search, replacement) { - var isRegex = XRegExp.isRegExp(search), - captureNames, result, str, origLastIndex; - - // There are too many combinations of search/replacement types/values and browser bugs that - // preclude passing to native `replace`, so don't try - //if (...) - // return nativ.replace.apply(this, arguments); - - if (isRegex) { - if (search._xregexp) - captureNames = search._xregexp.captureNames; // Array or `null` - if (!search.global) - origLastIndex = search.lastIndex; - } else { - search = search + ""; // Type conversion - } - - if (Object.prototype.toString.call(replacement) === "[object Function]") { - result = nativ.replace.call(this + "", search, function () { - if (captureNames) { - // Change the `arguments[0]` string primitive to a String object which can store properties - arguments[0] = new String(arguments[0]); - // Store named backreferences on `arguments[0]` - for (var i = 0; i < captureNames.length; i++) { - if (captureNames[i]) - arguments[0][captureNames[i]] = arguments[i + 1]; - } - } - // Update `lastIndex` before calling `replacement` (fix browsers) - if (isRegex && search.global) - search.lastIndex = arguments[arguments.length - 2] + arguments[0].length; - return replacement.apply(null, arguments); - }); - } else { - str = this + ""; // Type conversion, so `args[args.length - 1]` will be a string (given nonstring `this`) - result = nativ.replace.call(str, search, function () { - var args = arguments; // Keep this function's `arguments` available through closure - return nativ.replace.call(replacement + "", replacementToken, function ($0, $1, $2) { - // Numbered backreference (without delimiters) or special variable - if ($1) { - switch ($1) { - case "$": return "$"; - case "&": return args[0]; - case "`": return args[args.length - 1].slice(0, args[args.length - 2]); - case "'": return args[args.length - 1].slice(args[args.length - 2] + args[0].length); - // Numbered backreference - default: - // What does "$10" mean? - // - Backreference 10, if 10 or more capturing groups exist - // - Backreference 1 followed by "0", if 1-9 capturing groups exist - // - Otherwise, it's the string "$10" - // Also note: - // - Backreferences cannot be more than two digits (enforced by `replacementToken`) - // - "$01" is equivalent to "$1" if a capturing group exists, otherwise it's the string "$01" - // - There is no "$0" token ("$&" is the entire match) - var literalNumbers = ""; - $1 = +$1; // Type conversion; drop leading zero - if (!$1) // `$1` was "0" or "00" - return $0; - while ($1 > args.length - 3) { - literalNumbers = String.prototype.slice.call($1, -1) + literalNumbers; - $1 = Math.floor($1 / 10); // Drop the last digit - } - return ($1 ? args[$1] || "" : "$") + literalNumbers; - } - // Named backreference or delimited numbered backreference - } else { - // What does "${n}" mean? - // - Backreference to numbered capture n. Two differences from "$n": - // - n can be more than two digits - // - Backreference 0 is allowed, and is the entire match - // - Backreference to named capture n, if it exists and is not a number overridden by numbered capture - // - Otherwise, it's the string "${n}" - var n = +$2; // Type conversion; drop leading zeros - if (n <= args.length - 3) - return args[n]; - n = captureNames ? indexOf(captureNames, $2) : -1; - return n > -1 ? args[n + 1] : $0; - } - }); - }); - } - - if (isRegex) { - if (search.global) - search.lastIndex = 0; // Fix IE, Safari bug (last tested IE 9.0.5, Safari 5.1.2 on Windows) - else - search.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows) - } - - return result; - }; - - // A consistent cross-browser, ES3 compliant `split` - String.prototype.split = function (s /* separator */, limit) { - // If separator `s` is not a regex, use the native `split` - if (!XRegExp.isRegExp(s)) - return nativ.split.apply(this, arguments); - - var str = this + "", // Type conversion - output = [], - lastLastIndex = 0, - match, lastLength; - - // Behavior for `limit`: if it's... - // - `undefined`: No limit - // - `NaN` or zero: Return an empty array - // - A positive number: Use `Math.floor(limit)` - // - A negative number: No limit - // - Other: Type-convert, then use the above rules - if (limit === undefined || +limit < 0) { - limit = Infinity; - } else { - limit = Math.floor(+limit); - if (!limit) - return []; - } - - // This is required if not `s.global`, and it avoids needing to set `s.lastIndex` to zero - // and restore it to its original value when we're done using the regex - s = XRegExp.copyAsGlobal(s); - - while (match = s.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.) - if (s.lastIndex > lastLastIndex) { - output.push(str.slice(lastLastIndex, match.index)); - - if (match.length > 1 && match.index < str.length) - Array.prototype.push.apply(output, match.slice(1)); - - lastLength = match[0].length; - lastLastIndex = s.lastIndex; - - if (output.length >= limit) - break; - } - - if (s.lastIndex === match.index) - s.lastIndex++; - } - - if (lastLastIndex === str.length) { - if (!nativ.test.call(s, "") || lastLength) - output.push(""); - } else { - output.push(str.slice(lastLastIndex)); - } - - return output.length > limit ? output.slice(0, limit) : output; - }; - - - //--------------------------------- - // Private helper functions - //--------------------------------- - - // Supporting function for `XRegExp`, `XRegExp.copyAsGlobal`, etc. Returns a copy of a `RegExp` - // instance with a fresh `lastIndex` (set to zero), preserving properties required for named - // capture. Also allows adding new flags in the process of copying the regex - function clone (regex, additionalFlags) { - if (!XRegExp.isRegExp(regex)) - throw TypeError("type RegExp expected"); - var x = regex._xregexp; - regex = XRegExp(regex.source, getNativeFlags(regex) + (additionalFlags || "")); - if (x) { - regex._xregexp = { - source: x.source, - captureNames: x.captureNames ? x.captureNames.slice(0) : null - }; - } - return regex; - } - - function getNativeFlags (regex) { - return (regex.global ? "g" : "") + - (regex.ignoreCase ? "i" : "") + - (regex.multiline ? "m" : "") + - (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3 - (regex.sticky ? "y" : ""); - } - - function runTokens (pattern, index, scope, context) { - var i = tokens.length, - result, match, t; - // Protect against constructing XRegExps within token handler and trigger functions - isInsideConstructor = true; - // Must reset `isInsideConstructor`, even if a `trigger` or `handler` throws - try { - while (i--) { // Run in reverse order - t = tokens[i]; - if ((scope & t.scope) && (!t.trigger || t.trigger.call(context))) { - t.pattern.lastIndex = index; - match = t.pattern.exec(pattern); // Running the altered `exec` here allows use of named backreferences, etc. - if (match && match.index === index) { - result = { - output: t.handler.call(context, match, scope), - match: match - }; - break; - } - } - } - } catch (err) { - throw err; - } finally { - isInsideConstructor = false; - } - return result; - } - - function indexOf (array, item, from) { - if (Array.prototype.indexOf) // Use the native array method if available - return array.indexOf(item, from); - for (var i = from || 0; i < array.length; i++) { - if (array[i] === item) - return i; - } - return -1; - } - - - //--------------------------------- - // Built-in tokens - //--------------------------------- - - // Augment XRegExp's regular expression syntax and flags. Note that when adding tokens, the - // third (`scope`) argument defaults to `XRegExp.OUTSIDE_CLASS` - - // Comment pattern: (?# ) - XRegExp.addToken( - /\(\?#[^)]*\)/, - function (match) { - // Keep tokens separated unless the following token is a quantifier - return nativ.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)"; - } - ); - - // Capturing group (match the opening parenthesis only). - // Required for support of named capturing groups - XRegExp.addToken( - /\((?!\?)/, - function () { - this.captureNames.push(null); - return "("; - } - ); - - // Named capturing group (match the opening delimiter only): (?<name> - XRegExp.addToken( - /\(\?<([$\w]+)>/, - function (match) { - this.captureNames.push(match[1]); - this.hasNamedCapture = true; - return "("; - } - ); - - // Named backreference: \k<name> - XRegExp.addToken( - /\\k<([\w$]+)>/, - function (match) { - var index = indexOf(this.captureNames, match[1]); - // Keep backreferences separate from subsequent literal numbers. Preserve back- - // references to named groups that are undefined at this point as literal strings - return index > -1 ? - "\\" + (index + 1) + (isNaN(match.input.charAt(match.index + match[0].length)) ? "" : "(?:)") : - match[0]; - } - ); - - // Empty character class: [] or [^] - XRegExp.addToken( - /\[\^?]/, - function (match) { - // For cross-browser compatibility with ES3, convert [] to \b\B and [^] to [\s\S]. - // (?!) should work like \b\B, but is unreliable in Firefox - return match[0] === "[]" ? "\\b\\B" : "[\\s\\S]"; - } - ); - - // Mode modifier at the start of the pattern only, with any combination of flags imsx: (?imsx) - // Does not support x(?i), (?-i), (?i-m), (?i: ), (?i)(?m), etc. - XRegExp.addToken( - /^\(\?([imsx]+)\)/, - function (match) { - this.setFlag(match[1]); - return ""; - } - ); - - // Whitespace and comments, in free-spacing (aka extended) mode only - XRegExp.addToken( - /(?:\s+|#.*)+/, - function (match) { - // Keep tokens separated unless the following token is a quantifier - return nativ.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)"; - }, - XRegExp.OUTSIDE_CLASS, - function () {return this.hasFlag("x");} - ); - - // Dot, in dotall (aka singleline) mode only - XRegExp.addToken( - /\./, - function () {return "[\\s\\S]";}, - XRegExp.OUTSIDE_CLASS, - function () {return this.hasFlag("s");} - ); - - - //--------------------------------- - // Backward compatibility - //--------------------------------- - - // Uncomment the following block for compatibility with XRegExp 1.0-1.2: - /* - XRegExp.matchWithinChain = XRegExp.matchChain; - RegExp.prototype.addFlags = function (s) {return clone(this, s);}; - RegExp.prototype.execAll = function (s) {var r = []; XRegExp.iterate(s, this, function (m) {r.push(m);}); return r;}; - RegExp.prototype.forEachExec = function (s, f, c) {return XRegExp.iterate(s, this, f, c);}; - RegExp.prototype.validate = function (s) {var r = RegExp("^(?:" + this.source + ")$(?!\\s)", getNativeFlags(this)); if (this.global) this.lastIndex = 0; return s.search(r) === 0;}; - */ - -})(); -
@@ -1,122 +0,0 @@
-(function() { - -var sh = SyntaxHighlighter; - -/** - * Provides functionality to dynamically load only the brushes that a needed to render the current page. - * - * There are two syntaxes that autoload understands. For example: - * - * SyntaxHighlighter.autoloader( - * [ 'applescript', 'Scripts/shBrushAppleScript.js' ], - * [ 'actionscript3', 'as3', 'Scripts/shBrushAS3.js' ] - * ); - * - * or a more easily comprehendable one: - * - * SyntaxHighlighter.autoloader( - * 'applescript Scripts/shBrushAppleScript.js', - * 'actionscript3 as3 Scripts/shBrushAS3.js' - * ); - */ -sh.autoloader = function() -{ - var list = arguments, - elements = sh.findElements(), - brushes = {}, - scripts = {}, - all = SyntaxHighlighter.all, - allCalled = false, - allParams = null, - i - ; - - SyntaxHighlighter.all = function(params) - { - allParams = params; - allCalled = true; - }; - - function addBrush(aliases, url) - { - for (var i = 0; i < aliases.length; i++) - brushes[aliases[i]] = url; - }; - - function getAliases(item) - { - return item.pop - ? item - : item.split(/\s+/) - ; - } - - // create table of aliases and script urls - for (i = 0; i < list.length; i++) - { - var aliases = getAliases(list[i]), - url = aliases.pop() - ; - - addBrush(aliases, url); - } - - // dynamically add <script /> tags to the document body - for (i = 0; i < elements.length; i++) - { - var url = brushes[elements[i].params.brush]; - - if(url && scripts[url] === undefined) - { - if(elements[i].params['html-script'] === 'true') - { - if(scripts[brushes['xml']] === undefined) { - loadScript(brushes['xml']); - scripts[url] = false; - } - } - - scripts[url] = false; - loadScript(url); - } - } - - function loadScript(url) - { - var script = document.createElement('script'), - done = false - ; - - script.src = url; - script.type = 'text/javascript'; - script.language = 'javascript'; - script.onload = script.onreadystatechange = function() - { - if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) - { - done = true; - scripts[url] = true; - checkAll(); - - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; - script.parentNode.removeChild(script); - } - }; - - // sync way of adding script tags to the page - document.body.appendChild(script); - }; - - function checkAll() - { - for(var url in scripts) - if (scripts[url] == false) - return; - - if (allCalled) - SyntaxHighlighter.highlight(allParams); - }; -}; - -})();
@@ -1,72 +0,0 @@
-;(function() -{ - // CommonJS - SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); - - function Brush() - { - var funcs = 'abs acos acosh addcslashes addslashes ' + - 'array_change_key_case array_chunk array_combine array_count_values array_diff '+ - 'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+ - 'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+ - 'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+ - 'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+ - 'array_push array_rand array_reduce array_reverse array_search array_shift '+ - 'array_slice array_splice array_sum array_udiff array_udiff_assoc '+ - 'array_udiff_uassoc array_uintersect array_uintersect_assoc '+ - 'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+ - 'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+ - 'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+ - 'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+ - 'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+ - 'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+ - 'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+ - 'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+ - 'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+ - 'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+ - 'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+ - 'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+ - 'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+ - 'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+ - 'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+ - 'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+ - 'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+ - 'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+ - 'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+ - 'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir '+ - 'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+ - 'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+ - 'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+ - 'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+ - 'strtoupper strtr strval substr substr_compare'; - - var keywords = 'abstract and array as break case catch cfunction class clone const continue declare default die do ' + - 'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach ' + - 'function global goto if implements include include_once interface instanceof insteadof namespace new ' + - 'old_function or private protected public return require require_once static switch ' + - 'trait throw try use var while xor '; - - var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__'; - - this.regexList = [ - { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments - { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings - { regex: /\$\w+/g, css: 'variable' }, // variables - { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions - { regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword - ]; - - this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags); - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['php']; - - SyntaxHighlighter.brushes.Php = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})();
@@ -1,1 +0,0 @@
-var XRegExp;if(XRegExp)throw Error("can't load XRegExp twice in the same frame");(function(e){function c(e,t){if(!XRegExp.isRegExp(e))throw TypeError("type RegExp expected");var n=e._xregexp;return e=XRegExp(e.source,h(e)+(t||"")),n&&(e._xregexp={source:n.source,captureNames:n.captureNames?n.captureNames.slice(0):null}),e}function h(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":"")}function p(e,t,n,r){var o=s.length,u,a,f;i=!0;try{while(o--){f=s[o];if(n&f.scope&&(!f.trigger||f.trigger.call(r))){f.pattern.lastIndex=t,a=f.pattern.exec(e);if(a&&a.index===t){u={output:f.handler.call(r,a,n),match:a};break}}}}catch(l){throw l}finally{i=!1}return u}function d(e,t,n){if(Array.prototype.indexOf)return e.indexOf(t,n);for(var r=n||0;r<e.length;r++)if(e[r]===t)return r;return-1}XRegExp=function(t,r){var s=[],u=XRegExp.OUTSIDE_CLASS,a=0,f,h,d,v,m;if(XRegExp.isRegExp(t)){if(r!==e)throw TypeError("can't supply flags when constructing one RegExp from another");return c(t)}if(i)throw Error("can't call the XRegExp constructor within token definition functions");r=r||"",f={hasNamedCapture:!1,captureNames:[],hasFlag:function(e){return r.indexOf(e)>-1},setFlag:function(e){r+=e}};while(a<t.length)h=p(t,a,u,f),h?(s.push(h.output),a+=h.match[0].length||1):(d=o.exec.call(l[u],t.slice(a)))?(s.push(d[0]),a+=d[0].length):(v=t.charAt(a),v==="["?u=XRegExp.INSIDE_CLASS:v==="]"&&(u=XRegExp.OUTSIDE_CLASS),s.push(v),a++);return m=RegExp(s.join(""),o.replace.call(r,n,"")),m._xregexp={source:t,captureNames:f.hasNamedCapture?f.captureNames:null},m},XRegExp.version="1.5.1",XRegExp.INSIDE_CLASS=1,XRegExp.OUTSIDE_CLASS=2;var t=/\$(?:(\d\d?|[$&`'])|{([$\w]+)})/g,n=/[^gimy]+|([\s\S])(?=[\s\S]*\1)/g,r=/^(?:[?*+]|{\d+(?:,\d*)?})\??/,i=!1,s=[],o={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},u=o.exec.call(/()??/,"")[1]===e,a=function(){var e=/^/g;return o.test.call(e,""),!e.lastIndex}(),f=RegExp.prototype.sticky!==e,l={};l[XRegExp.INSIDE_CLASS]=/^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/,l[XRegExp.OUTSIDE_CLASS]=/^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/,XRegExp.addToken=function(e,t,n,r){s.push({pattern:c(e,"g"+(f?"y":"")),handler:t,scope:n||XRegExp.OUTSIDE_CLASS,trigger:r||null})},XRegExp.cache=function(e,t){var n=e+"/"+(t||"");return XRegExp.cache[n]||(XRegExp.cache[n]=XRegExp(e,t))},XRegExp.copyAsGlobal=function(e){return c(e,"g")},XRegExp.escape=function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},XRegExp.execAt=function(e,t,n,r){var i=c(t,"g"+(r&&f?"y":"")),s;return i.lastIndex=n=n||0,s=i.exec(e),r&&s&&s.index!==n&&(s=null),t.global&&(t.lastIndex=s?i.lastIndex:0),s},XRegExp.freezeTokens=function(){XRegExp.addToken=function(){throw Error("can't run addToken after freezeTokens")}},XRegExp.isRegExp=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},XRegExp.iterate=function(e,t,n,r){var i=c(t,"g"),s=-1,o;while(o=i.exec(e))t.global&&(t.lastIndex=i.lastIndex),n.call(r,o,++s,e,t),i.lastIndex===o.index&&i.lastIndex++;t.global&&(t.lastIndex=0)},XRegExp.matchChain=function(e,t){return function n(e,r){var i=t[r].regex?t[r]:{regex:t[r]},s=c(i.regex,"g"),o=[],u;for(u=0;u<e.length;u++)XRegExp.iterate(e[u],s,function(e){o.push(i.backref?e[i.backref]||"":e[0])});return r===t.length-1||!o.length?o:n(o,r+1)}([e],0)},RegExp.prototype.apply=function(e,t){return this.exec(t[0])},RegExp.prototype.call=function(e,t){return this.exec(t)},RegExp.prototype.exec=function(t){var n,r,i,s;this.global||(s=this.lastIndex),n=o.exec.apply(this,arguments);if(n){!u&&n.length>1&&d(n,"")>-1&&(i=RegExp(this.source,o.replace.call(h(this),"g","")),o.replace.call((t+"").slice(n.index),i,function(){for(var t=1;t<arguments.length-2;t++)arguments[t]===e&&(n[t]=e)}));if(this._xregexp&&this._xregexp.captureNames)for(var f=1;f<n.length;f++)r=this._xregexp.captureNames[f-1],r&&(n[r]=n[f]);!a&&this.global&&!n[0].length&&this.lastIndex>n.index&&this.lastIndex--}return this.global||(this.lastIndex=s),n},RegExp.prototype.test=function(e){var t,n;return this.global||(n=this.lastIndex),t=o.exec.call(this,e),t&&!a&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,this.global||(this.lastIndex=n),!!t},String.prototype.match=function(e){XRegExp.isRegExp(e)||(e=RegExp(e));if(e.global){var t=o.match.apply(this,arguments);return e.lastIndex=0,t}return e.exec(this)},String.prototype.replace=function(e,n){var r=XRegExp.isRegExp(e),i,s,u,a;return r?(e._xregexp&&(i=e._xregexp.captureNames),e.global||(a=e.lastIndex)):e+="",Object.prototype.toString.call(n)==="[object Function]"?s=o.replace.call(this+"",e,function(){if(i){arguments[0]=new String(arguments[0]);for(var t=0;t<i.length;t++)i[t]&&(arguments[0][i[t]]=arguments[t+1])}return r&&e.global&&(e.lastIndex=arguments[arguments.length-2]+arguments[0].length),n.apply(null,arguments)}):(u=this+"",s=o.replace.call(u,e,function(){var e=arguments;return o.replace.call(n+"",t,function(t,n,r){if(!n){var o=+r;return o<=e.length-3?e[o]:(o=i?d(i,r):-1,o>-1?e[o+1]:t)}switch(n){case"$":return"$";case"&":return e[0];case"`":return e[e.length-1].slice(0,e[e.length-2]);case"'":return e[e.length-1].slice(e[e.length-2]+e[0].length);default:var s="";n=+n;if(!n)return t;while(n>e.length-3)s=String.prototype.slice.call(n,-1)+s,n=Math.floor(n/10);return(n?e[n]||"":"$")+s}})})),r&&(e.global?e.lastIndex=0:e.lastIndex=a),s},String.prototype.split=function(t,n){if(!XRegExp.isRegExp(t))return o.split.apply(this,arguments);var r=this+"",i=[],s=0,u,a;if(n===e||+n<0)n=Infinity;else{n=Math.floor(+n);if(!n)return[]}t=XRegExp.copyAsGlobal(t);while(u=t.exec(r)){if(t.lastIndex>s){i.push(r.slice(s,u.index)),u.length>1&&u.index<r.length&&Array.prototype.push.apply(i,u.slice(1)),a=u[0].length,s=t.lastIndex;if(i.length>=n)break}t.lastIndex===u.index&&t.lastIndex++}return s===r.length?(!o.test.call(t,"")||a)&&i.push(""):i.push(r.slice(s)),i.length>n?i.slice(0,n):i},XRegExp.addToken(/\(\?#[^)]*\)/,function(e){return o.test.call(r,e.input.slice(e.index+e[0].length))?"":"(?:)"}),XRegExp.addToken(/\((?!\?)/,function(){return this.captureNames.push(null),"("}),XRegExp.addToken(/\(\?<([$\w]+)>/,function(e){return this.captureNames.push(e[1]),this.hasNamedCapture=!0,"("}),XRegExp.addToken(/\\k<([\w$]+)>/,function(e){var t=d(this.captureNames,e[1]);return t>-1?"\\"+(t+1)+(isNaN(e.input.charAt(e.index+e[0].length))?"":"(?:)"):e[0]}),XRegExp.addToken(/\[\^?]/,function(e){return e[0]==="[]"?"\\b\\B":"[\\s\\S]"}),XRegExp.addToken(/^\(\?([imsx]+)\)/,function(e){return this.setFlag(e[1]),""}),XRegExp.addToken(/(?:\s+|#.*)+/,function(e){return o.test.call(r,e.input.slice(e.index+e[0].length))?"":"(?:)"},XRegExp.OUTSIDE_CLASS,function(){return this.hasFlag("x")}),XRegExp.addToken(/\./,function(){return"[\\s\\S]"},XRegExp.OUTSIDE_CLASS,function(){return this.hasFlag("s")})})();if(typeof SyntaxHighlighter=="undefined")var SyntaxHighlighter=function(){function t(e,t){return e.className.indexOf(t)!=-1}function n(e,n){t(e,n)||(e.className+=" "+n)}function r(e,t){e.className=e.className.replace(t,"")}function i(e){var t=[];for(var n=0;n<e.length;n++)t.push(e[n]);return t}function s(e){return e.split(/\r?\n/)}function o(e){var t="highlighter_";return e.indexOf(t)==0?e:t+e}function u(t){return e.vars.highlighters[o(t)]}function a(e){return document.getElementById(o(e))}function f(t){e.vars.highlighters[o(t.id)]=t}function l(e,t,n){if(e==null)return null;var r=n!=1?e.childNodes:[e.parentNode],i={"#":"id",".":"className"}[t.substr(0,1)]||"nodeName",s,o;s=i!="nodeName"?t.substr(1):t.toUpperCase();if((e[i]||"").indexOf(s)!=-1)return e;for(var u=0;r&&u<r.length&&o==null;u++)o=l(r[u],t,n);return o}function c(e,t){return l(e,t,!0)}function h(e,t,n){n=Math.max(n||0,0);for(var r=n;r<e.length;r++)if(e[r]==t)return r;return-1}function p(e){return(e||"")+Math.round(Math.random()*1e6).toString()}function d(e,t){var n={},r;for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n}function v(e){var t={"true":!0,"false":!1}[e];return t==null?e:t}function m(e,t,n,r,i){var s=(screen.width-n)/2,o=(screen.height-r)/2;i+=", left="+s+", top="+o+", width="+n+", height="+r,i=i.replace(/^,/,"");var u=window.open(e,t,i);return u.focus(),u}function g(e,t,n,r){function i(e){e=e||window.event,e.target||(e.target=e.srcElement,e.preventDefault=function(){this.returnValue=!1}),n.call(r||window,e)}e.attachEvent?e.attachEvent("on"+t,i):e.addEventListener(t,i,!1)}function y(t){window.alert(e.config.strings.alert+t)}function b(t,n){var r=e.vars.discoveredBrushes,i=null;if(r==null){r={};for(var s in e.brushes){var o=e.brushes[s],u=o.aliases;if(u==null)continue;o.brushName=s.toLowerCase();for(var a=0;a<u.length;a++)r[u[a]]=s}e.vars.discoveredBrushes=r}return i=e.brushes[r[t]],i==null&&n&&y(e.config.strings.noBrush+t),i}function w(e,t){var n=s(e);for(var r=0;r<n.length;r++)n[r]=t(n[r],r);return n.join("\r\n")}function E(e){return e.replace(/^[ ]*[\n]+|[\n]*[ ]*$/g,"")}function S(e){var t,n={},r=new XRegExp("^\\[(?<values>(.*?))\\]$"),i=new XRegExp("(?<name>[\\w-]+)\\s*:\\s*(?<value>[\\w-%#]+|\\[.*?\\]|\".*?\"|'.*?')\\s*;?","g");while((t=i.exec(e))!=null){var s=t.value.replace(/^['"]|['"]$/g,"");if(s!=null&&r.test(s)){var o=r.exec(s);s=o.values.length>0?o.values.split(/\s*,\s*/):[]}n[t.name]=s}return n}function x(t,n){return t==null||t.length==0||t=="\n"?t:(t=t.replace(/</g,"<"),t=t.replace(/ {2,}/g,function(t){var n="";for(var r=0;r<t.length-1;r++)n+=e.config.space;return n+" "}),n!=null&&(t=w(t,function(e){if(e.length==0)return"";var t="";return e=e.replace(/^( | )+/,function(e){return t=e,""}),e.length==0?t:t+'<code class="'+n+'">'+e+"</code>"})),t)}function T(e,t){var n=e.toString();while(n.length<t)n="0"+n;return n}function N(e,t){var n="";for(var r=0;r<t;r++)n+=" ";return e.replace(/\t/g,n)}function C(e,t){function u(e,t,n){return e.substr(0,t)+i.substr(0,n)+e.substr(t+1,e.length)}var n=s(e),r=" ",i="";for(var o=0;o<50;o++)i+=" ";return e=w(e,function(e){if(e.indexOf(r)==-1)return e;var n=0;while((n=e.indexOf(r))!=-1){var i=t-n%t;e=u(e,n,i)}return e}),e}function k(t){var n=/<br\s*\/?>|<br\s*\/?>/gi;return e.config.bloggerMode==1&&(t=t.replace(n,"\n")),e.config.stripBrs==1&&(t=t.replace(n,"")),t}function L(e){return e.replace(/^\s+|\s+$/g,"")}function A(e){var t=s(k(e)),n=new Array,r=/^\s*/,i=1e3;for(var o=0;o<t.length&&i>0;o++){var u=t[o];if(L(u).length==0)continue;var a=r.exec(u);if(a==null)return e;i=Math.min(a[0].length,i)}if(i>0)for(var o=0;o<t.length;o++)t[o]=t[o].substr(i);return t.join("\n")}function O(e,t){return e.index<t.index?-1:e.index>t.index?1:e.length<t.length?-1:e.length>t.length?1:0}function M(t,n){function r(e,t){return e[0]}var i=0,s=null,o=[],u=n.func?n.func:r;while((s=n.regex.exec(t))!=null){var a=u(s,n);typeof a=="string"&&(a=[new e.Match(a,s.index,n.css)]),o=o.concat(a)}return o}function _(t){var n=/(.*)((>|<).*)/;return t.replace(e.regexLib.url,function(e){var t="",r=null;if(r=n.exec(e))e=r[1],t=r[2];return'<a href="'+e+'">'+e+"</a>"+t})}function D(){var e=document.getElementsByTagName("script"),t=[];for(var n=0;n<e.length;n++)e[n].type=="syntaxhighlighter"&&t.push(e[n]);return t}function P(e){var t="<![CDATA[",n="]]>",r=L(e),i=!1,s=t.length,o=n.length;r.indexOf(t)==0&&(r=r.substring(s),i=!0);var u=r.length;return r.indexOf(n)==u-o&&(r=r.substring(0,u-o),i=!0),i?r:e}function H(e){var t=e.target,i=c(t,".syntaxhighlighter"),s=c(t,".container"),o=document.createElement("textarea"),a;if(!s||!i||l(s,"textarea"))return;a=u(i.id),n(i,"source");var f=s.childNodes,h=[];for(var p=0;p<f.length;p++)h.push(f[p].innerText||f[p].textContent);h=h.join("\r"),h=h.replace(/\u00a0/g," "),o.appendChild(document.createTextNode(h)),s.appendChild(o),o.focus(),o.select(),g(o,"blur",function(e){o.parentNode.removeChild(o),r(i,"source")})}typeof require!="undefined"&&typeof XRegExp=="undefined"&&(XRegExp=require("XRegExp").XRegExp);var e={defaults:{"class-name":"","first-line":1,"pad-line-numbers":!1,highlight:null,title:null,"smart-tabs":!0,"tab-size":4,gutter:!0,toolbar:!0,"quick-code":!0,collapse:!1,"auto-links":!0,light:!1,unindent:!0,"html-script":!1},config:{space:" ",useScriptTags:!0,bloggerMode:!1,stripBrs:!1,tagName:"pre",strings:{expandSource:"expand source",help:"?",alert:"SyntaxHighlighter\n\n",noBrush:"Can't find brush for: ",brushNotHtmlScript:"Brush wasn't configured for html-script option: ",aboutDialog:"@ABOUT@"}},vars:{discoveredBrushes:null,highlighters:{}},brushes:{},regexLib:{multiLineCComments:/\/\*[\s\S]*?\*\//gm,singleLineCComments:/\/\/.*$/gm,singleLinePerlComments:/#.*$/gm,doubleQuotedString:/"([^\\"\n]|\\.)*"/g,singleQuotedString:/'([^\\'\n]|\\.)*'/g,multiLineDoubleQuotedString:new XRegExp('"([^\\\\"]|\\\\.)*"',"gs"),multiLineSingleQuotedString:new XRegExp("'([^\\\\']|\\\\.)*'","gs"),xmlComments:/(<|<)!--[\s\S]*?--(>|>)/gm,url:/\w+:\/\/[\w-.\/?%&=:@;#]*/g,phpScriptTags:{left:/(<|<)\?(?:=|php)?/g,right:/\?(>|>)/g,eof:!0},aspScriptTags:{left:/(<|<)%=?/g,right:/%(>|>)/g},scriptScriptTags:{left:/(<|<)\s*script.*?(>|>)/gi,right:/(<|<)\/\s*script\s*(>|>)/gi}},toolbar:{getHtml:function(t){function s(t,n){return e.toolbar.getButtonHtml(t,n,e.config.strings[n])}var n='<div class="toolbar">',r=e.toolbar.items,i=r.list;for(var o=0;o<i.length;o++)n+=(r[i[o]].getHtml||s)(t,i[o]);return n+="</div>",n},getButtonHtml:function(e,t,n){return'<span><a href="#" class="toolbar_item command_'+t+" "+t+'">'+n+"</a></span>"},handler:function(t){function i(e){var t=new RegExp(e+"_(\\w+)"),n=t.exec(r);return n?n[1]:null}var n=t.target,r=n.className||"",s=u(c(n,".syntaxhighlighter").id),o=i("command");s&&o&&e.toolbar.items[o].execute(s),t.preventDefault()},items:{list:["expandSource","help"],expandSource:{getHtml:function(t){if(t.getParam("collapse")!=1)return"";var n=t.getParam("title");return e.toolbar.getButtonHtml(t,"expandSource",n?n:e.config.strings.expandSource)},execute:function(e){var t=a(e.id);r(t,"collapsed")}},help:{execute:function(t){var n=m("","_blank",500,250,"scrollbars=0"),r=n.document;r.write(e.config.strings.aboutDialog),r.close(),n.focus()}}}},findElements:function(t,n){var r=n?[n]:i(document.getElementsByTagName(e.config.tagName)),s=e.config,o=[];s.useScriptTags&&(r=r.concat(D()));if(r.length===0)return o;for(var u=0;u<r.length;u++){var a={target:r[u],params:d(t,S(r[u].className))};if(a.params["brush"]==null)continue;o.push(a)}return o},highlight:function(t,n){var r=this.findElements(t,n),i="innerHTML",s=null,o=e.config;if(r.length===0)return;for(var u=0;u<r.length;u++){var n=r[u],a=n.target,f=n.params,l=f.brush,c;if(l==null)continue;if(f["html-script"]=="true"||e.defaults["html-script"]==1)s=new e.HtmlScript(l),l="htmlscript";else{var h=b(l);if(!h)continue;s=new h}c=a[i],o.useScriptTags&&(c=P(c)),(a.title||"")!=""&&(f.title=a.title),f.brush=l,s.init(f),n=s.getDiv(c),(a.id||"")!=""&&(n.id=a.id),a.parentNode.replaceChild(n,a)}},all:function(t){g(window,"load",function(){e.highlight(t)})}};return e.Match=function(e,t,n){this.value=e,this.index=t,this.length=e.length,this.css=n,this.brushName=null},e.Match.prototype.toString=function(){return this.value},e.HtmlScript=function(t){function f(e,t){for(var n=0;n<e.length;n++)e[n].index+=t}function l(e,t){var i=e.code,s=[],o=r.regexList,u=e.index+e.left.length,a=r.htmlScript,l;for(var c=0;c<o.length;c++)l=M(i,o[c]),f(l,u),s=s.concat(l);a.left!=null&&e.left!=null&&(l=M(e.left,a.left),f(l,e.index),s=s.concat(l)),a.right!=null&&e.right!=null&&(l=M(e.right,a.right),f(l,e.index+e[0].lastIndexOf(e.right)),s=s.concat(l));for(var h=0;h<s.length;h++)s[h].brushName=n.brushName;return s}var n=b(t),r,i=new e.brushes.Xml,s=null,o=this,u="getDiv getHtml init".split(" ");if(n==null)return;r=new n;for(var a=0;a<u.length;a++)(function(){var e=u[a];o[e]=function(){return i[e].apply(i,arguments)}})();if(r.htmlScript==null){y(e.config.strings.brushNotHtmlScript+t);return}i.regexList.push({regex:r.htmlScript.code,func:l})},e.Highlighter=function(){},e.Highlighter.prototype={getParam:function(e,t){var n=this.params[e];return v(n==null?t:n)},create:function(e){return document.createElement(e)},findMatches:function(e,t){var n=[];if(e!=null)for(var r=0;r<e.length;r++)typeof e[r]=="object"&&(n=n.concat(M(t,e[r])));return this.removeNestedMatches(n.sort(O))},removeNestedMatches:function(e){for(var t=0;t<e.length;t++){if(e[t]===null)continue;var n=e[t],r=n.index+n.length;for(var i=t+1;i<e.length&&e[t]!==null;i++){var s=e[i];if(s===null)continue;if(s.index>r)break;s.index==n.index&&s.length>n.length?e[t]=null:s.index>=n.index&&s.index<r&&(e[i]=null)}}return e},figureOutLineNumbers:function(e){var t=[],n=parseInt(this.getParam("first-line"));return w(e,function(e,r){t.push(r+n)}),t},isLineHighlighted:function(e){var t=this.getParam("highlight",[]);return typeof t!="object"&&t.push==null&&(t=[t]),h(t,e.toString())!=-1},getLineHtml:function(e,t,n){var r=["line","number"+t,"index"+e,"alt"+(t%2==0?1:2).toString()];return this.isLineHighlighted(t)&&r.push("highlighted"),t==0&&r.push("break"),'<div class="'+r.join(" ")+'">'+n+"</div>"},getLineNumbersHtml:function(t,n){var r="",i=s(t).length,o=parseInt(this.getParam("first-line")),u=this.getParam("pad-line-numbers");u==1?u=(o+i-1).toString().length:isNaN(u)==1&&(u=0);for(var a=0;a<i;a++){var f=n?n[a]:o+a,t=f==0?e.config.space:T(f,u);r+=this.getLineHtml(a,f,t)}return r},getCodeLinesHtml:function(t,n){t=L(t);var r=s(t),i=this.getParam("pad-line-numbers"),o=parseInt(this.getParam("first-line")),t="",u=this.getParam("brush");for(var a=0;a<r.length;a++){var f=r[a],l=/^( |\s)+/.exec(f),c=null,h=n?n[a]:o+a;l!=null&&(c=l[0].toString(),f=f.substr(c.length),c=c.replace(" ",e.config.space)),f=L(f),f.length==0&&(f=e.config.space),t+=this.getLineHtml(a,h,(c!=null?'<code class="'+u+' spaces">'+c+"</code>":"")+f)}return t},getTitleHtml:function(e){return e?"<caption>"+e+"</caption>":""},getMatchesHtml:function(e,t){function s(e){var t=e?e.brushName||i:i;return t?t+" ":""}var n=0,r="",i=this.getParam("brush","");for(var o=0;o<t.length;o++){var u=t[o],a;if(u===null||u.length===0)continue;a=s(u),r+=x(e.substr(n,u.index-n),a+"plain")+x(u.value,a+u.css),n=u.index+u.length+(u.offset||0)}return r+=x(e.substr(n),s()+"plain"),r},getHtml:function(t){var n="",r=["syntaxhighlighter"],i,s,u;return this.getParam("light")==1&&(this.params.toolbar=this.params.gutter=!1),className="syntaxhighlighter",this.getParam("collapse")==1&&r.push("collapsed"),(gutter=this.getParam("gutter"))==0&&r.push("nogutter"),r.push(this.getParam("class-name")),r.push(this.getParam("brush")),t=E(t).replace(/\r/g," "),i=this.getParam("tab-size"),t=this.getParam("smart-tabs")==1?C(t,i):N(t,i),this.getParam("unindent")&&(t=A(t)),gutter&&(u=this.figureOutLineNumbers(t)),s=this.findMatches(this.regexList,t),n=this.getMatchesHtml(t,s),n=this.getCodeLinesHtml(n,u),this.getParam("auto-links")&&(n=_(n)),typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.match(/MSIE/)&&r.push("ie"),n='<div id="'+o(this.id)+'" class="'+r.join(" ")+'">'+(this.getParam("toolbar")?e.toolbar.getHtml(this):"")+'<table border="0" cellpadding="0" cellspacing="0">'+this.getTitleHtml(this.getParam("title"))+"<tbody>"+"<tr>"+(gutter?'<td class="gutter">'+this.getLineNumbersHtml(t)+"</td>":"")+'<td class="code">'+'<div class="container">'+n+"</div>"+"</td>"+"</tr>"+"</tbody>"+"</table>"+"</div>",n},getDiv:function(t){t===null&&(t=""),this.code=t;var n=this.create("div");return n.innerHTML=this.getHtml(t),this.getParam("toolbar")&&g(l(n,".toolbar"),"click",e.toolbar.handler),this.getParam("quick-code")&&g(l(n,".code"),"dblclick",H),n},init:function(t){this.id=p(),f(this),this.params=d(e.defaults,t||{}),this.getParam("light")==1&&(this.params.toolbar=this.params.gutter=!1)},getKeywords:function(e){return e=e.replace(/^\s+|\s+$/g,"").replace(/\s+/g,"|"),"\\b(?:"+e+")\\b"},forHtmlScript:function(e){var t={end:e.right.source};e.eof&&(t.end="(?:(?:"+t.end+")|$)"),this.htmlScript={left:{regex:e.left,css:"script"},right:{regex:e.right,css:"script"},code:new XRegExp("(?<left>"+e.left.source+")"+"(?<code>.*?)"+"(?<right>"+t.end+")","sgi")}}},e}();typeof exports!="undefined"?exports.SyntaxHighlighter=SyntaxHighlighter:null
@@ -1,141 +0,0 @@
-var dp = { - SyntaxHighlighter : {} -}; - -dp.SyntaxHighlighter = { - parseParams: function( - input, - showGutter, - showControls, - collapseAll, - firstLine, - showColumns - ) - { - function getValue(list, name) - { - var regex = new XRegExp('^' + name + '\\[(?<value>\\w+)\\]$', 'gi'), - match = null - ; - - for (var i = 0; i < list.length; i++) - if ((match = regex.exec(list[i])) != null) - return match.value; - - return null; - }; - - function defaultValue(value, def) - { - return value != null ? value : def; - }; - - function asString(value) - { - return value != null ? value.toString() : null; - }; - - var parts = input.split(':'), - brushName = parts[0], - options = {}, - straight = { 'true' : true } - reverse = { 'true' : false }, - result = null, - defaults = SyntaxHighlighter.defaults - ; - - for (var i in parts) - options[parts[i]] = 'true'; - - showGutter = asString(defaultValue(showGutter, defaults.gutter)); - showControls = asString(defaultValue(showControls, defaults.toolbar)); - collapseAll = asString(defaultValue(collapseAll, defaults.collapse)); - showColumns = asString(defaultValue(showColumns, defaults.ruler)); - firstLine = asString(defaultValue(firstLine, defaults['first-line'])); - - return { - brush : brushName, - gutter : defaultValue(reverse[options.nogutter], showGutter), - toolbar : defaultValue(reverse[options.nocontrols], showControls), - collapse : defaultValue(straight[options.collapse], collapseAll), - // ruler : defaultValue(straight[options.showcolumns], showColumns), - 'first-line' : defaultValue(getValue(parts, 'firstline'), firstLine) - }; - }, - - HighlightAll: function( - name, - showGutter /* optional */, - showControls /* optional */, - collapseAll /* optional */, - firstLine /* optional */, - showColumns /* optional */ - ) - { - function findValue() - { - var a = arguments; - - for (var i = 0; i < a.length; i++) - { - if (a[i] === null) - continue; - - if (typeof(a[i]) == 'string' && a[i] != '') - return a[i] + ''; - - if (typeof(a[i]) == 'object' && a[i].value != '') - return a[i].value + ''; - } - - return null; - }; - - function findTagsByName(list, name, tagName) - { - var tags = document.getElementsByTagName(tagName); - - for (var i = 0; i < tags.length; i++) - if (tags[i].getAttribute('name') == name) - list.push(tags[i]); - } - - var elements = [], - highlighter = null, - registered = {}, - propertyName = 'innerHTML' - ; - - // for some reason IE doesn't find <pre/> by name, however it does see them just fine by tag name... - findTagsByName(elements, name, 'pre'); - findTagsByName(elements, name, 'textarea'); - - if (elements.length === 0) - return; - - for (var i = 0; i < elements.length; i++) - { - var element = elements[i], - params = findValue( - element.attributes['class'], element.className, - element.attributes['language'], element.language - ), - language = '' - ; - - if (params === null) - continue; - - params = dp.SyntaxHighlighter.parseParams( - params, - showGutter, - showControls, - collapseAll, - firstLine, - showColumns - ); - - SyntaxHighlighter.highlight(params, element); - } - } -};
@@ -1,49 +0,0 @@
-<?php -/** - * PHPMailer simple file upload and send example - */ -$msg = ''; -if (array_key_exists('userfile', $_FILES)) { - // First handle the upload - // Don't trust provided filename - same goes for MIME types - // See http://php.net/manual/en/features.file-upload.php#114004 for more thorough upload validation - $uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['userfile']['name'])); - if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { - // Upload handled successfully - // Now create a message - // This should be somewhere in your include_path - require '../PHPMailerAutoload.php'; - $mail = new PHPMailer; - $mail->setFrom('from@example.com', 'First Last'); - $mail->addAddress('whoto@example.com', 'John Doe'); - $mail->Subject = 'PHPMailer file sender'; - $mail->msgHTML("My message body"); - // Attach the uploaded file - $mail->addAttachment($uploadfile, 'My uploaded file'); - if (!$mail->send()) { - $msg .= "Mailer Error: " . $mail->ErrorInfo; - } else { - $msg .= "Message sent!"; - } - } else { - $msg .= 'Failed to move file to ' . $uploadfile; - } -} -?> -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>PHPMailer Upload</title> -</head> -<body> -<?php if (empty($msg)) { ?> - <form method="post" enctype="multipart/form-data"> - <input type="hidden" name="MAX_FILE_SIZE" value="100000"> Send this file: <input name="userfile" type="file"> - <input type="submit" value="Send File"> - </form> -<?php } else { - echo $msg; -} ?> -</body> -</html>
@@ -1,51 +0,0 @@
-<?php -/** - * PHPMailer multiple files upload and send example - */ -$msg = ''; -if (array_key_exists('userfile', $_FILES)) { - - // Create a message - // This should be somewhere in your include_path - require '../PHPMailerAutoload.php'; - $mail = new PHPMailer; - $mail->setFrom('from@example.com', 'First Last'); - $mail->addAddress('whoto@example.com', 'John Doe'); - $mail->Subject = 'PHPMailer file sender'; - $mail->msgHTML('My message body'); - //Attach multiple files one by one - for ($ct = 0; $ct < count($_FILES['userfile']['tmp_name']); $ct++) { - $uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['userfile']['name'][$ct])); - $filename = $_FILES['userfile']['name'][$ct]; - if (move_uploaded_file($_FILES['userfile']['tmp_name'][$ct], $uploadfile)) { - $mail->addAttachment($uploadfile, $filename); - } else { - $msg .= 'Failed to move file to ' . $uploadfile; - } - } - if (!$mail->send()) { - $msg .= "Mailer Error: " . $mail->ErrorInfo; - } else { - $msg .= "Message sent!"; - } -} -?> -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>PHPMailer Upload</title> -</head> -<body> -<?php if (empty($msg)) { ?> - <form method="post" enctype="multipart/form-data"> - <input type="hidden" name="MAX_FILE_SIZE" value="100000"> - Select one or more files: - <input name="userfile[]" type="file" multiple="multiple"> - <input type="submit" value="Send Files"> - </form> -<?php } else { - echo $msg; -} ?> -</body> -</html>
@@ -1,33 +0,0 @@
-<?php -/** - * This example shows sending a message using a local sendmail binary. - */ - -require '../PHPMailerAutoload.php'; - -//Create a new PHPMailer instance -$mail = new PHPMailer; -// Set PHPMailer to use the sendmail transport -$mail->isSendmail(); -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); -//Set the subject line -$mail->Subject = 'PHPMailer sendmail test'; -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -}
@@ -1,89 +0,0 @@
-<?php -/** - * This example shows signing a message and then sending it via the mail() function of PHP. - * - * Before you can sign the mail certificates are needed. - * - * - * STEP 1 - Creating a certificate: - * You can either use a self signed certificate, pay for a signed one or use free alternatives such as StartSSL/Comodo etc. - * Check out this link for more providers: http://kb.mozillazine.org/Getting_an_SMIME_certificate - * In this example I am using Comodo. - * The form is directly available via https://secure.comodo.com/products/frontpage?area=SecureEmailCertificate - * Fill it out and you'll get an email with a link to download your certificate. - * Usually the certificate will be directly installed into your browser (FireFox/Chrome). - * - * - * STEP 2 - Exporting the certificate - * This is specific to your browser, however, most browsers will give you the option to export your recently added certificate in PKCS12 (.pfx) - * Include your private key if you are asked for it. - * Set up a password to protect your exported file. - * - * STEP 3 - Splitting the .pfx into a private key and the certificate. - * I use openssl for this. You only need two commands. In my case the certificate file is called 'exported-cert.pfx' - * To create the private key do the following: - * - * openssl pkcs12 -in exported-cert.pfx -nocerts -out cert.key - * - * Of course the way you name your file (-out) is up to you. - * You will be asked for a password for the Import password. This is the password you just set while exporting the certificate into the pfx file. - * Afterwards, you can password protect your private key (recommended) - * Also make sure to set the permissions to a minimum level and suitable for your application. - * To create the certificate file use the following command: - * - * openssl pkcs12 -in exported-cert.pfx -clcerts -nokeys -out cert.crt - * - * Again, the way you name your certificate is up to you. You will be also asked for the Import Password. - * To create the certificate-chain file use the following command: - * - * openssl pkcs12 -in exported-cert.pfx -cacerts -out certchain.pem - * - * Again, the way you name your chain file is up to you. You will be also asked for the Import Password. - * - * - * STEP 3 - Code - */ - -require '../PHPMailerAutoload.php'; - -//Create a new PHPMailer instance -$mail = new PHPMailer(); -//Set who the message is to be sent from -//IMPORTANT: This must match the email address of your certificate. -//Although the certificate will be valid, an error will be thrown since it cannot be verified that the sender and the signer are the same person. -$mail->setFrom('from@example.com', 'First Last'); -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); -//Set the subject line -$mail->Subject = 'PHPMailer mail() test'; -//Read an HTML message body from an external file, convert referenced images to embedded, -//Convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//Configure message signing (the actual signing does not occur until sending) -$mail->sign( - '/path/to/cert.crt', //The location of your certificate file - '/path/to/cert.key', //The location of your private key file - 'yourSecretPrivateKeyPassword', //The password you protected your private key with (not the Import Password! may be empty but parameter must not be omitted!) - '/path/to/certchain.pem' //The location of your chain file -); - -//Send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -} - -/** - * REMARKS: - * If your email client does not support S/MIME it will most likely just show an attachment smime.p7s which is the signature contained in the email. - * Other clients, such as Thunderbird support S/MIME natively and will validate the signature automatically and report the result in some way. - */ -?>
@@ -1,54 +0,0 @@
-<?php -/** - * This example shows making an SMTP connection with authentication. - */ - -//SMTP needs accurate times, and the PHP time zone MUST be set -//This should be done in your php.ini, but this is how to do it if you don't have access to that -date_default_timezone_set('Etc/UTC'); - -require '../PHPMailerAutoload.php'; - -//Create a new PHPMailer instance -$mail = new PHPMailer; -//Tell PHPMailer to use SMTP -$mail->isSMTP(); -//Enable SMTP debugging -// 0 = off (for production use) -// 1 = client messages -// 2 = client and server messages -$mail->SMTPDebug = 2; -//Ask for HTML-friendly debug output -$mail->Debugoutput = 'html'; -//Set the hostname of the mail server -$mail->Host = "mail.example.com"; -//Set the SMTP port number - likely to be 25, 465 or 587 -$mail->Port = 25; -//Whether to use SMTP authentication -$mail->SMTPAuth = true; -//Username to use for SMTP authentication -$mail->Username = "yourname@example.com"; -//Password to use for SMTP authentication -$mail->Password = "yourpassword"; -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); -//Set the subject line -$mail->Subject = 'PHPMailer SMTP test'; -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -}
@@ -1,55 +0,0 @@
-<?php -/** - * This uses the SMTP class alone to check that a connection can be made to an SMTP server, - * authenticate, then disconnect - */ - -//SMTP needs accurate times, and the PHP time zone MUST be set -//This should be done in your php.ini, but this is how to do it if you don't have access to that -date_default_timezone_set('Etc/UTC'); - -require '../PHPMailerAutoload.php'; - -//Create a new SMTP instance -$smtp = new SMTP; - -//Enable connection-level debug output -$smtp->do_debug = SMTP::DEBUG_CONNECTION; - -try { - //Connect to an SMTP server - if (!$smtp->connect('mail.example.com', 25)) { - throw new Exception('Connect failed'); - } - //Say hello - if (!$smtp->hello(gethostname())) { - throw new Exception('EHLO failed: ' . $smtp->getError()['error']); - } - //Get the list of ESMTP services the server offers - $e = $smtp->getServerExtList(); - //If server can do TLS encryption, use it - if (array_key_exists('STARTTLS', $e)) { - $tlsok = $smtp->startTLS(); - if (!$tlsok) { - throw new Exception('Failed to start encryption: ' . $smtp->getError()['error']); - } - //Repeat EHLO after STARTTLS - if (!$smtp->hello(gethostname())) { - throw new Exception('EHLO (2) failed: ' . $smtp->getError()['error']); - } - //Get new capabilities list, which will usually now include AUTH if it didn't before - $e = $smtp->getServerExtList(); - } - //If server supports authentication, do it (even if no encryption) - if (array_key_exists('AUTH', $e)) { - if ($smtp->authenticate('username', 'password')) { - echo "Connected ok!"; - } else { - throw new Exception('Authentication failed: ' . $smtp->getError()['error']); - } - } -} catch (Exception $e) { - echo 'SMTP error: ' . $e->getMessage(), "\n"; -} -//Whatever happened, close the connection. -$smtp->quit(true);
@@ -1,50 +0,0 @@
-<?php -/** - * This example shows making an SMTP connection without using authentication. - */ - -//SMTP needs accurate times, and the PHP time zone MUST be set -//This should be done in your php.ini, but this is how to do it if you don't have access to that -date_default_timezone_set('Etc/UTC'); - -require_once '../PHPMailerAutoload.php'; - -//Create a new PHPMailer instance -$mail = new PHPMailer; -//Tell PHPMailer to use SMTP -$mail->isSMTP(); -//Enable SMTP debugging -// 0 = off (for production use) -// 1 = client messages -// 2 = client and server messages -$mail->SMTPDebug = 2; -//Ask for HTML-friendly debug output -$mail->Debugoutput = 'html'; -//Set the hostname of the mail server -$mail->Host = "mail.example.com"; -//Set the SMTP port number - likely to be 25, 465 or 587 -$mail->Port = 25; -//Whether to use SMTP authentication -$mail->SMTPAuth = false; -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); -//Set the subject line -$mail->Subject = 'PHPMailer SMTP without auth test'; -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -}
@@ -1,74 +0,0 @@
-<?php -/** - * This example shows settings to use when sending over SMTP with TLS and custom connection options. - */ - -//SMTP needs accurate times, and the PHP time zone MUST be set -//This should be done in your php.ini, but this is how to do it if you don't have access to that -date_default_timezone_set('Etc/UTC'); - -require '../PHPMailerAutoload.php'; - -//Create a new PHPMailer instance -$mail = new PHPMailer; - -//Tell PHPMailer to use SMTP -$mail->isSMTP(); - -//Enable SMTP debugging -// 0 = off (for production use) -// 1 = client messages -// 2 = client and server messages -$mail->SMTPDebug = 2; - -//Ask for HTML-friendly debug output -$mail->Debugoutput = 'html'; - -//Set the hostname of the mail server -$mail->Host = 'smtp.example.com'; - -//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission -$mail->Port = 587; - -//Set the encryption system to use - ssl (deprecated) or tls -$mail->SMTPSecure = 'tls'; - -//Custom connection options -$mail->SMTPOptions = array ( - 'ssl' => array( - 'verify_peer' => true, - 'verify_depth' => 3, - 'allow_self_signed' => true, - 'peer_name' => 'smtp.example.com', - 'cafile' => '/etc/ssl/ca_cert.pem', - ) -); - -//Whether to use SMTP authentication -$mail->SMTPAuth = true; - -//Username to use for SMTP authentication - use full email address for gmail -$mail->Username = "username@example.com"; - -//Password to use for SMTP authentication -$mail->Password = "yourpassword"; - -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); - -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); - -//Set the subject line -$mail->Subject = 'PHPMailer SMTP options test'; - -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -}
@@ -1,46 +0,0 @@
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;} -.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;} -.syntaxhighlighter.source{overflow:hidden !important;} -.syntaxhighlighter .bold{font-weight:bold !important;} -.syntaxhighlighter .italic{font-style:italic !important;} -.syntaxhighlighter .line{white-space:pre !important;} -.syntaxhighlighter table{width:100% !important;} -.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;} -.syntaxhighlighter table td.code{width:100% !important;} -.syntaxhighlighter table td.code .container{position:relative !important;} -.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;} -.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;} -.syntaxhighlighter table td.code .line{padding:0 1em !important;} -.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;} -.syntaxhighlighter.show{display:block !important;} -.syntaxhighlighter.collapsed table{display:none !important;} -.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;} -.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;} -.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;} -.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;} -.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;} -.syntaxhighlighter .toolbar span.title{display:inline !important;} -.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;} -.syntaxhighlighter .toolbar a.expandSource{display:none !important;} -.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;} -.syntaxhighlighter.ie .toolbar{line-height:8px !important;} -.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;} -.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;} -.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;} -.syntaxhighlighter.printing .line .content{color:black !important;} -.syntaxhighlighter.printing .toolbar{display:none !important;} -.syntaxhighlighter.printing a{text-decoration:none !important;} -.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;} -.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;} -.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;} -.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;} -.syntaxhighlighter.printing .preprocessor{color:gray !important;} -.syntaxhighlighter.printing .variable{color:#aa7700 !important;} -.syntaxhighlighter.printing .value{color:#009900 !important;} -.syntaxhighlighter.printing .functions{color:#ff1493 !important;} -.syntaxhighlighter.printing .constants{color:#0066cc !important;} -.syntaxhighlighter.printing .script{font-weight:bold !important;} -.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;} -.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;} -.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;} -.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
@@ -1,77 +0,0 @@
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;} -.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;} -.syntaxhighlighter.source{overflow:hidden !important;} -.syntaxhighlighter .bold{font-weight:bold !important;} -.syntaxhighlighter .italic{font-style:italic !important;} -.syntaxhighlighter .line{white-space:pre !important;} -.syntaxhighlighter table{width:100% !important;} -.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;} -.syntaxhighlighter table td.code{width:100% !important;} -.syntaxhighlighter table td.code .container{position:relative !important;} -.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;} -.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;} -.syntaxhighlighter table td.code .line{padding:0 1em !important;} -.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;} -.syntaxhighlighter.show{display:block !important;} -.syntaxhighlighter.collapsed table{display:none !important;} -.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;} -.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;} -.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;} -.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;} -.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;} -.syntaxhighlighter .toolbar span.title{display:inline !important;} -.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;} -.syntaxhighlighter .toolbar a.expandSource{display:none !important;} -.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;} -.syntaxhighlighter.ie .toolbar{line-height:8px !important;} -.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;} -.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;} -.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;} -.syntaxhighlighter.printing .line .content{color:black !important;} -.syntaxhighlighter.printing .toolbar{display:none !important;} -.syntaxhighlighter.printing a{text-decoration:none !important;} -.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;} -.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;} -.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;} -.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;} -.syntaxhighlighter.printing .preprocessor{color:gray !important;} -.syntaxhighlighter.printing .variable{color:#aa7700 !important;} -.syntaxhighlighter.printing .value{color:#009900 !important;} -.syntaxhighlighter.printing .functions{color:#ff1493 !important;} -.syntaxhighlighter.printing .constants{color:#0066cc !important;} -.syntaxhighlighter.printing .script{font-weight:bold !important;} -.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;} -.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;} -.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;} -.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;} -.syntaxhighlighter{background-color:white !important;} -.syntaxhighlighter .line.alt1{background-color:white !important;} -.syntaxhighlighter .line.alt2{background-color:white !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0 !important;} -.syntaxhighlighter .line.highlighted.number{color:black !important;} -.syntaxhighlighter table caption{color:black !important;} -.syntaxhighlighter .gutter{color:#afafaf !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c !important;color:white !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:blue !important;background:white !important;border:1px solid #6ce26c !important;} -.syntaxhighlighter.collapsed .toolbar a{color:blue !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:red !important;} -.syntaxhighlighter .toolbar{color:white !important;background:#6ce26c !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:white !important;} -.syntaxhighlighter .toolbar a:hover{color:black !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200 !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:blue !important;} -.syntaxhighlighter .keyword{color:#006699 !important;} -.syntaxhighlighter .preprocessor{color:gray !important;} -.syntaxhighlighter .variable{color:#aa7700 !important;} -.syntaxhighlighter .value{color:#009900 !important;} -.syntaxhighlighter .functions{color:#ff1493 !important;} -.syntaxhighlighter .constants{color:#0066cc !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#006699 !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;} -.syntaxhighlighter .keyword{font-weight:bold !important;}
@@ -1,78 +0,0 @@
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;} -.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;} -.syntaxhighlighter.source{overflow:hidden !important;} -.syntaxhighlighter .bold{font-weight:bold !important;} -.syntaxhighlighter .italic{font-style:italic !important;} -.syntaxhighlighter .line{white-space:pre !important;} -.syntaxhighlighter table{width:100% !important;} -.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;} -.syntaxhighlighter table td.code{width:100% !important;} -.syntaxhighlighter table td.code .container{position:relative !important;} -.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;} -.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;} -.syntaxhighlighter table td.code .line{padding:0 1em !important;} -.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;} -.syntaxhighlighter.show{display:block !important;} -.syntaxhighlighter.collapsed table{display:none !important;} -.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;} -.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;} -.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;} -.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;} -.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;} -.syntaxhighlighter .toolbar span.title{display:inline !important;} -.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;} -.syntaxhighlighter .toolbar a.expandSource{display:none !important;} -.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;} -.syntaxhighlighter.ie .toolbar{line-height:8px !important;} -.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;} -.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;} -.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;} -.syntaxhighlighter.printing .line .content{color:black !important;} -.syntaxhighlighter.printing .toolbar{display:none !important;} -.syntaxhighlighter.printing a{text-decoration:none !important;} -.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;} -.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;} -.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;} -.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;} -.syntaxhighlighter.printing .preprocessor{color:gray !important;} -.syntaxhighlighter.printing .variable{color:#aa7700 !important;} -.syntaxhighlighter.printing .value{color:#009900 !important;} -.syntaxhighlighter.printing .functions{color:#ff1493 !important;} -.syntaxhighlighter.printing .constants{color:#0066cc !important;} -.syntaxhighlighter.printing .script{font-weight:bold !important;} -.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;} -.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;} -.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;} -.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;} -.syntaxhighlighter{background-color:#0a2b1d !important;} -.syntaxhighlighter .line.alt1{background-color:#0a2b1d !important;} -.syntaxhighlighter .line.alt2{background-color:#0a2b1d !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#233729 !important;} -.syntaxhighlighter .line.highlighted.number{color:white !important;} -.syntaxhighlighter table caption{color:#f8f8f8 !important;} -.syntaxhighlighter .gutter{color:#497958 !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #41a83e !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#41a83e !important;color:#0a2b1d !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#96dd3b !important;background:black !important;border:1px solid #41a83e !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#96dd3b !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:white !important;} -.syntaxhighlighter .toolbar{color:white !important;background:#41a83e !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:white !important;} -.syntaxhighlighter .toolbar a:hover{color:#ffe862 !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#f8f8f8 !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#336442 !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#9df39f !important;} -.syntaxhighlighter .keyword{color:#96dd3b !important;} -.syntaxhighlighter .preprocessor{color:#91bb9e !important;} -.syntaxhighlighter .variable{color:#ffaa3e !important;} -.syntaxhighlighter .value{color:#f7e741 !important;} -.syntaxhighlighter .functions{color:#ffaa3e !important;} -.syntaxhighlighter .constants{color:#e0e8ff !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#96dd3b !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#eb939a !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#91bb9e !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#edef7d !important;} -.syntaxhighlighter .comments{font-style:italic !important;} -.syntaxhighlighter .keyword{font-weight:bold !important;}
@@ -1,80 +0,0 @@
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;} -.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;} -.syntaxhighlighter.source{overflow:hidden !important;} -.syntaxhighlighter .bold{font-weight:bold !important;} -.syntaxhighlighter .italic{font-style:italic !important;} -.syntaxhighlighter .line{white-space:pre !important;} -.syntaxhighlighter table{width:100% !important;} -.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;} -.syntaxhighlighter table td.code{width:100% !important;} -.syntaxhighlighter table td.code .container{position:relative !important;} -.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;} -.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;} -.syntaxhighlighter table td.code .line{padding:0 1em !important;} -.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;} -.syntaxhighlighter.show{display:block !important;} -.syntaxhighlighter.collapsed table{display:none !important;} -.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;} -.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;} -.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;} -.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;} -.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;} -.syntaxhighlighter .toolbar span.title{display:inline !important;} -.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;} -.syntaxhighlighter .toolbar a.expandSource{display:none !important;} -.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;} -.syntaxhighlighter.ie .toolbar{line-height:8px !important;} -.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;} -.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;} -.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;} -.syntaxhighlighter.printing .line .content{color:black !important;} -.syntaxhighlighter.printing .toolbar{display:none !important;} -.syntaxhighlighter.printing a{text-decoration:none !important;} -.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;} -.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;} -.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;} -.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;} -.syntaxhighlighter.printing .preprocessor{color:gray !important;} -.syntaxhighlighter.printing .variable{color:#aa7700 !important;} -.syntaxhighlighter.printing .value{color:#009900 !important;} -.syntaxhighlighter.printing .functions{color:#ff1493 !important;} -.syntaxhighlighter.printing .constants{color:#0066cc !important;} -.syntaxhighlighter.printing .script{font-weight:bold !important;} -.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;} -.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;} -.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;} -.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;} -.syntaxhighlighter{background-color:white !important;} -.syntaxhighlighter .line.alt1{background-color:white !important;} -.syntaxhighlighter .line.alt2{background-color:white !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#c3defe !important;} -.syntaxhighlighter .line.highlighted.number{color:white !important;} -.syntaxhighlighter table caption{color:black !important;} -.syntaxhighlighter .gutter{color:#787878 !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #d4d0c8 !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#d4d0c8 !important;color:white !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#3f5fbf !important;background:white !important;border:1px solid #d4d0c8 !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#3f5fbf !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:#aa7700 !important;} -.syntaxhighlighter .toolbar{color:#a0a0a0 !important;background:#d4d0c8 !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:#a0a0a0 !important;} -.syntaxhighlighter .toolbar a:hover{color:red !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#3f5fbf !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#2a00ff !important;} -.syntaxhighlighter .keyword{color:#7f0055 !important;} -.syntaxhighlighter .preprocessor{color:#646464 !important;} -.syntaxhighlighter .variable{color:#aa7700 !important;} -.syntaxhighlighter .value{color:#009900 !important;} -.syntaxhighlighter .functions{color:#ff1493 !important;} -.syntaxhighlighter .constants{color:#0066cc !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#7f0055 !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;} -.syntaxhighlighter .keyword{font-weight:bold !important;} -.syntaxhighlighter .xml .keyword{color:#3f7f7f !important;font-weight:normal !important;} -.syntaxhighlighter .xml .color1,.syntaxhighlighter .xml .color1 a{color:#7f007f !important;} -.syntaxhighlighter .xml .string{font-style:italic !important;color:#2a00ff !important;}
@@ -1,76 +0,0 @@
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;} -.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;} -.syntaxhighlighter.source{overflow:hidden !important;} -.syntaxhighlighter .bold{font-weight:bold !important;} -.syntaxhighlighter .italic{font-style:italic !important;} -.syntaxhighlighter .line{white-space:pre !important;} -.syntaxhighlighter table{width:100% !important;} -.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;} -.syntaxhighlighter table td.code{width:100% !important;} -.syntaxhighlighter table td.code .container{position:relative !important;} -.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;} -.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;} -.syntaxhighlighter table td.code .line{padding:0 1em !important;} -.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;} -.syntaxhighlighter.show{display:block !important;} -.syntaxhighlighter.collapsed table{display:none !important;} -.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;} -.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;} -.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;} -.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;} -.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;} -.syntaxhighlighter .toolbar span.title{display:inline !important;} -.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;} -.syntaxhighlighter .toolbar a.expandSource{display:none !important;} -.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;} -.syntaxhighlighter.ie .toolbar{line-height:8px !important;} -.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;} -.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;} -.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;} -.syntaxhighlighter.printing .line .content{color:black !important;} -.syntaxhighlighter.printing .toolbar{display:none !important;} -.syntaxhighlighter.printing a{text-decoration:none !important;} -.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;} -.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;} -.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;} -.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;} -.syntaxhighlighter.printing .preprocessor{color:gray !important;} -.syntaxhighlighter.printing .variable{color:#aa7700 !important;} -.syntaxhighlighter.printing .value{color:#009900 !important;} -.syntaxhighlighter.printing .functions{color:#ff1493 !important;} -.syntaxhighlighter.printing .constants{color:#0066cc !important;} -.syntaxhighlighter.printing .script{font-weight:bold !important;} -.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;} -.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;} -.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;} -.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;} -.syntaxhighlighter{background-color:black !important;} -.syntaxhighlighter .line.alt1{background-color:black !important;} -.syntaxhighlighter .line.alt2{background-color:black !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2a3133 !important;} -.syntaxhighlighter .line.highlighted.number{color:white !important;} -.syntaxhighlighter table caption{color:#d3d3d3 !important;} -.syntaxhighlighter .gutter{color:#d3d3d3 !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #990000 !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#990000 !important;color:black !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#ebdb8d !important;background:black !important;border:1px solid #990000 !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#ebdb8d !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:#ff7d27 !important;} -.syntaxhighlighter .toolbar{color:white !important;background:#990000 !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:white !important;} -.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d3d3d3 !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#ff7d27 !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#ff9e7b !important;} -.syntaxhighlighter .keyword{color:aqua !important;} -.syntaxhighlighter .preprocessor{color:#aec4de !important;} -.syntaxhighlighter .variable{color:#ffaa3e !important;} -.syntaxhighlighter .value{color:#009900 !important;} -.syntaxhighlighter .functions{color:#81cef9 !important;} -.syntaxhighlighter .constants{color:#ff9e7b !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:aqua !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ebdb8d !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff7d27 !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#aec4de !important;}
@@ -1,77 +0,0 @@
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;} -.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;} -.syntaxhighlighter.source{overflow:hidden !important;} -.syntaxhighlighter .bold{font-weight:bold !important;} -.syntaxhighlighter .italic{font-style:italic !important;} -.syntaxhighlighter .line{white-space:pre !important;} -.syntaxhighlighter table{width:100% !important;} -.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;} -.syntaxhighlighter table td.code{width:100% !important;} -.syntaxhighlighter table td.code .container{position:relative !important;} -.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;} -.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;} -.syntaxhighlighter table td.code .line{padding:0 1em !important;} -.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;} -.syntaxhighlighter.show{display:block !important;} -.syntaxhighlighter.collapsed table{display:none !important;} -.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;} -.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;} -.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;} -.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;} -.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;} -.syntaxhighlighter .toolbar span.title{display:inline !important;} -.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;} -.syntaxhighlighter .toolbar a.expandSource{display:none !important;} -.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;} -.syntaxhighlighter.ie .toolbar{line-height:8px !important;} -.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;} -.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;} -.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;} -.syntaxhighlighter.printing .line .content{color:black !important;} -.syntaxhighlighter.printing .toolbar{display:none !important;} -.syntaxhighlighter.printing a{text-decoration:none !important;} -.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;} -.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;} -.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;} -.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;} -.syntaxhighlighter.printing .preprocessor{color:gray !important;} -.syntaxhighlighter.printing .variable{color:#aa7700 !important;} -.syntaxhighlighter.printing .value{color:#009900 !important;} -.syntaxhighlighter.printing .functions{color:#ff1493 !important;} -.syntaxhighlighter.printing .constants{color:#0066cc !important;} -.syntaxhighlighter.printing .script{font-weight:bold !important;} -.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;} -.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;} -.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;} -.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;} -.syntaxhighlighter{background-color:#121212 !important;} -.syntaxhighlighter .line.alt1{background-color:#121212 !important;} -.syntaxhighlighter .line.alt2{background-color:#121212 !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2c2c29 !important;} -.syntaxhighlighter .line.highlighted.number{color:white !important;} -.syntaxhighlighter table caption{color:white !important;} -.syntaxhighlighter .gutter{color:#afafaf !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #3185b9 !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#3185b9 !important;color:#121212 !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#3185b9 !important;background:black !important;border:1px solid #3185b9 !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#3185b9 !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:#d01d33 !important;} -.syntaxhighlighter .toolbar{color:white !important;background:#3185b9 !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:white !important;} -.syntaxhighlighter .toolbar a:hover{color:#96daff !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:white !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#696854 !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#e3e658 !important;} -.syntaxhighlighter .keyword{color:#d01d33 !important;} -.syntaxhighlighter .preprocessor{color:#435a5f !important;} -.syntaxhighlighter .variable{color:#898989 !important;} -.syntaxhighlighter .value{color:#009900 !important;} -.syntaxhighlighter .functions{color:#aaaaaa !important;} -.syntaxhighlighter .constants{color:#96daff !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#d01d33 !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ffc074 !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#4a8cdb !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#96daff !important;} -.syntaxhighlighter .functions{font-weight:bold !important;}
@@ -1,76 +0,0 @@
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;} -.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;} -.syntaxhighlighter.source{overflow:hidden !important;} -.syntaxhighlighter .bold{font-weight:bold !important;} -.syntaxhighlighter .italic{font-style:italic !important;} -.syntaxhighlighter .line{white-space:pre !important;} -.syntaxhighlighter table{width:100% !important;} -.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;} -.syntaxhighlighter table td.code{width:100% !important;} -.syntaxhighlighter table td.code .container{position:relative !important;} -.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;} -.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;} -.syntaxhighlighter table td.code .line{padding:0 1em !important;} -.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;} -.syntaxhighlighter.show{display:block !important;} -.syntaxhighlighter.collapsed table{display:none !important;} -.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;} -.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;} -.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;} -.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;} -.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;} -.syntaxhighlighter .toolbar span.title{display:inline !important;} -.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;} -.syntaxhighlighter .toolbar a.expandSource{display:none !important;} -.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;} -.syntaxhighlighter.ie .toolbar{line-height:8px !important;} -.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;} -.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;} -.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;} -.syntaxhighlighter.printing .line .content{color:black !important;} -.syntaxhighlighter.printing .toolbar{display:none !important;} -.syntaxhighlighter.printing a{text-decoration:none !important;} -.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;} -.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;} -.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;} -.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;} -.syntaxhighlighter.printing .preprocessor{color:gray !important;} -.syntaxhighlighter.printing .variable{color:#aa7700 !important;} -.syntaxhighlighter.printing .value{color:#009900 !important;} -.syntaxhighlighter.printing .functions{color:#ff1493 !important;} -.syntaxhighlighter.printing .constants{color:#0066cc !important;} -.syntaxhighlighter.printing .script{font-weight:bold !important;} -.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;} -.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;} -.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;} -.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;} -.syntaxhighlighter{background-color:#222222 !important;} -.syntaxhighlighter .line.alt1{background-color:#222222 !important;} -.syntaxhighlighter .line.alt2{background-color:#222222 !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;} -.syntaxhighlighter .line.highlighted.number{color:white !important;} -.syntaxhighlighter table caption{color:lime !important;} -.syntaxhighlighter .gutter{color:#38566f !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#222222 !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:lime !important;} -.syntaxhighlighter .toolbar{color:#aaaaff !important;background:#435a5f !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:#aaaaff !important;} -.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:lime !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:lime !important;} -.syntaxhighlighter .keyword{color:#aaaaff !important;} -.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;} -.syntaxhighlighter .variable{color:aqua !important;} -.syntaxhighlighter .value{color:#f7e741 !important;} -.syntaxhighlighter .functions{color:#ff8000 !important;} -.syntaxhighlighter .constants{color:yellow !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#aaaaff !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:red !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:yellow !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
@@ -1,76 +0,0 @@
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;} -.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;} -.syntaxhighlighter.source{overflow:hidden !important;} -.syntaxhighlighter .bold{font-weight:bold !important;} -.syntaxhighlighter .italic{font-style:italic !important;} -.syntaxhighlighter .line{white-space:pre !important;} -.syntaxhighlighter table{width:100% !important;} -.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;} -.syntaxhighlighter table td.code{width:100% !important;} -.syntaxhighlighter table td.code .container{position:relative !important;} -.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;} -.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;} -.syntaxhighlighter table td.code .line{padding:0 1em !important;} -.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;} -.syntaxhighlighter.show{display:block !important;} -.syntaxhighlighter.collapsed table{display:none !important;} -.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;} -.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;} -.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;} -.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;} -.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;} -.syntaxhighlighter .toolbar span.title{display:inline !important;} -.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;} -.syntaxhighlighter .toolbar a.expandSource{display:none !important;} -.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;} -.syntaxhighlighter.ie .toolbar{line-height:8px !important;} -.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;} -.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;} -.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;} -.syntaxhighlighter.printing .line .content{color:black !important;} -.syntaxhighlighter.printing .toolbar{display:none !important;} -.syntaxhighlighter.printing a{text-decoration:none !important;} -.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;} -.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;} -.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;} -.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;} -.syntaxhighlighter.printing .preprocessor{color:gray !important;} -.syntaxhighlighter.printing .variable{color:#aa7700 !important;} -.syntaxhighlighter.printing .value{color:#009900 !important;} -.syntaxhighlighter.printing .functions{color:#ff1493 !important;} -.syntaxhighlighter.printing .constants{color:#0066cc !important;} -.syntaxhighlighter.printing .script{font-weight:bold !important;} -.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;} -.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;} -.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;} -.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;} -.syntaxhighlighter{background-color:#0f192a !important;} -.syntaxhighlighter .line.alt1{background-color:#0f192a !important;} -.syntaxhighlighter .line.alt2{background-color:#0f192a !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;} -.syntaxhighlighter .line.highlighted.number{color:#38566f !important;} -.syntaxhighlighter table caption{color:#d1edff !important;} -.syntaxhighlighter .gutter{color:#afafaf !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#0f192a !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:#1dc116 !important;} -.syntaxhighlighter .toolbar{color:#d1edff !important;background:#435a5f !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:#d1edff !important;} -.syntaxhighlighter .toolbar a:hover{color:#8aa6c1 !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d1edff !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#1dc116 !important;} -.syntaxhighlighter .keyword{color:#b43d3d !important;} -.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;} -.syntaxhighlighter .variable{color:#ffaa3e !important;} -.syntaxhighlighter .value{color:#f7e741 !important;} -.syntaxhighlighter .functions{color:#ffaa3e !important;} -.syntaxhighlighter .constants{color:#e0e8ff !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#b43d3d !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#f8bb00 !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
@@ -1,76 +0,0 @@
-.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;} -.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;} -.syntaxhighlighter.source{overflow:hidden !important;} -.syntaxhighlighter .bold{font-weight:bold !important;} -.syntaxhighlighter .italic{font-style:italic !important;} -.syntaxhighlighter .line{white-space:pre !important;} -.syntaxhighlighter table{width:100% !important;} -.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;} -.syntaxhighlighter table td.code{width:100% !important;} -.syntaxhighlighter table td.code .container{position:relative !important;} -.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;} -.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;} -.syntaxhighlighter table td.code .line{padding:0 1em !important;} -.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;} -.syntaxhighlighter.show{display:block !important;} -.syntaxhighlighter.collapsed table{display:none !important;} -.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;} -.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;} -.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;} -.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;} -.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;} -.syntaxhighlighter .toolbar span.title{display:inline !important;} -.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;} -.syntaxhighlighter .toolbar a.expandSource{display:none !important;} -.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;} -.syntaxhighlighter.ie .toolbar{line-height:8px !important;} -.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;} -.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;} -.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;} -.syntaxhighlighter.printing .line .content{color:black !important;} -.syntaxhighlighter.printing .toolbar{display:none !important;} -.syntaxhighlighter.printing a{text-decoration:none !important;} -.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;} -.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;} -.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;} -.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;} -.syntaxhighlighter.printing .preprocessor{color:gray !important;} -.syntaxhighlighter.printing .variable{color:#aa7700 !important;} -.syntaxhighlighter.printing .value{color:#009900 !important;} -.syntaxhighlighter.printing .functions{color:#ff1493 !important;} -.syntaxhighlighter.printing .constants{color:#0066cc !important;} -.syntaxhighlighter.printing .script{font-weight:bold !important;} -.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;} -.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;} -.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;} -.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;} -.syntaxhighlighter{background-color:#1b2426 !important;} -.syntaxhighlighter .line.alt1{background-color:#1b2426 !important;} -.syntaxhighlighter .line.alt2{background-color:#1b2426 !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#323e41 !important;} -.syntaxhighlighter .line.highlighted.number{color:#b9bdb6 !important;} -.syntaxhighlighter table caption{color:#b9bdb6 !important;} -.syntaxhighlighter .gutter{color:#afafaf !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#1b2426 !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#5ba1cf !important;background:black !important;border:1px solid #435a5f !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#5ba1cf !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:#5ce638 !important;} -.syntaxhighlighter .toolbar{color:white !important;background:#435a5f !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:white !important;} -.syntaxhighlighter .toolbar a:hover{color:#e0e8ff !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#b9bdb6 !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#878a85 !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#5ce638 !important;} -.syntaxhighlighter .keyword{color:#5ba1cf !important;} -.syntaxhighlighter .preprocessor{color:#435a5f !important;} -.syntaxhighlighter .variable{color:#ffaa3e !important;} -.syntaxhighlighter .value{color:#009900 !important;} -.syntaxhighlighter .functions{color:#ffaa3e !important;} -.syntaxhighlighter .constants{color:#e0e8ff !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#5ba1cf !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#e0e8ff !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
@@ -1,21 +0,0 @@
-.syntaxhighlighter.applescript{background:white;font-size:1em;color:black;} -.syntaxhighlighter.applescript div,.syntaxhighlighter.applescript code{font:1em/1.25 Verdana,sans-serif !important;} -.syntaxhighlighter.applescript .code .line{overflow:hidden !important;} -.syntaxhighlighter.applescript .code .line.highlighted{background:#b5d5ff !important;} -.syntaxhighlighter.applescript .color1{color:#000000 !important;} -.syntaxhighlighter.applescript .color2{color:#000000 !important;} -.syntaxhighlighter.applescript .color3{color:#000000 !important;font-weight:bold !important;} -.syntaxhighlighter.applescript .keyword{color:#000000 !important;font-weight:bold !important;} -.syntaxhighlighter.applescript .color4{color:#0000ff !important;font-style:italic !important;} -.syntaxhighlighter.applescript .comments{color:#4c4d4d !important;} -.syntaxhighlighter.applescript .plain{color:#408000 !important;} -.syntaxhighlighter.applescript .string{color:#000000 !important;} -.syntaxhighlighter.applescript .commandNames{color:#0000ff !important;font-weight:bold !important;} -.syntaxhighlighter.applescript .parameterNames{color:#0000ff !important;} -.syntaxhighlighter.applescript .classes{color:#0000ff !important;font-style:italic !important;} -.syntaxhighlighter.applescript .properties{color:#6c04d4 !important;} -.syntaxhighlighter.applescript .enumeratedValues{color:#4a1e7f !important;} -.syntaxhighlighter.applescript .additionCommandNames{color:#0016b0 !important;font-weight:bold !important;} -.syntaxhighlighter.applescript .additionParameterNames{color:#0016b0 !important;} -.syntaxhighlighter.applescript .additionClasses{color:#0016b0 !important;font-style:italic !important;} -.syntaxhighlighter.applescript .spaces{display:inline-block;height:0 !important;font-size:1.75em !important;line-height:0 !important;}
@@ -1,31 +0,0 @@
-.syntaxhighlighter{background-color:white !important;} -.syntaxhighlighter .line.alt1{background-color:white !important;} -.syntaxhighlighter .line.alt2{background-color:white !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0 !important;} -.syntaxhighlighter .line.highlighted.number{color:black !important;} -.syntaxhighlighter table caption{color:black !important;} -.syntaxhighlighter .gutter{color:#afafaf !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c !important;color:white !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:blue !important;background:white !important;border:1px solid #6ce26c !important;} -.syntaxhighlighter.collapsed .toolbar a{color:blue !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:red !important;} -.syntaxhighlighter .toolbar{color:white !important;background:#6ce26c !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:white !important;} -.syntaxhighlighter .toolbar a:hover{color:black !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200 !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:blue !important;} -.syntaxhighlighter .keyword{color:#006699 !important;} -.syntaxhighlighter .preprocessor{color:gray !important;} -.syntaxhighlighter .variable{color:#aa7700 !important;} -.syntaxhighlighter .value{color:#009900 !important;} -.syntaxhighlighter .functions{color:#ff1493 !important;} -.syntaxhighlighter .constants{color:#0066cc !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#006699 !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;} -.syntaxhighlighter .keyword{font-weight:bold !important;}
@@ -1,32 +0,0 @@
-.syntaxhighlighter{background-color:#0a2b1d !important;} -.syntaxhighlighter .line.alt1{background-color:#0a2b1d !important;} -.syntaxhighlighter .line.alt2{background-color:#0a2b1d !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#233729 !important;} -.syntaxhighlighter .line.highlighted.number{color:white !important;} -.syntaxhighlighter table caption{color:#f8f8f8 !important;} -.syntaxhighlighter .gutter{color:#497958 !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #41a83e !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#41a83e !important;color:#0a2b1d !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#96dd3b !important;background:black !important;border:1px solid #41a83e !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#96dd3b !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:white !important;} -.syntaxhighlighter .toolbar{color:white !important;background:#41a83e !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:white !important;} -.syntaxhighlighter .toolbar a:hover{color:#ffe862 !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#f8f8f8 !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#336442 !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#9df39f !important;} -.syntaxhighlighter .keyword{color:#96dd3b !important;} -.syntaxhighlighter .preprocessor{color:#91bb9e !important;} -.syntaxhighlighter .variable{color:#ffaa3e !important;} -.syntaxhighlighter .value{color:#f7e741 !important;} -.syntaxhighlighter .functions{color:#ffaa3e !important;} -.syntaxhighlighter .constants{color:#e0e8ff !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#96dd3b !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#eb939a !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#91bb9e !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#edef7d !important;} -.syntaxhighlighter .comments{font-style:italic !important;} -.syntaxhighlighter .keyword{font-weight:bold !important;}
@@ -1,34 +0,0 @@
-.syntaxhighlighter{background-color:white !important;} -.syntaxhighlighter .line.alt1{background-color:white !important;} -.syntaxhighlighter .line.alt2{background-color:white !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#c3defe !important;} -.syntaxhighlighter .line.highlighted.number{color:white !important;} -.syntaxhighlighter table caption{color:black !important;} -.syntaxhighlighter .gutter{color:#787878 !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #d4d0c8 !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#d4d0c8 !important;color:white !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#3f5fbf !important;background:white !important;border:1px solid #d4d0c8 !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#3f5fbf !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:#aa7700 !important;} -.syntaxhighlighter .toolbar{color:#a0a0a0 !important;background:#d4d0c8 !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:#a0a0a0 !important;} -.syntaxhighlighter .toolbar a:hover{color:red !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#3f5fbf !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#2a00ff !important;} -.syntaxhighlighter .keyword{color:#7f0055 !important;} -.syntaxhighlighter .preprocessor{color:#646464 !important;} -.syntaxhighlighter .variable{color:#aa7700 !important;} -.syntaxhighlighter .value{color:#009900 !important;} -.syntaxhighlighter .functions{color:#ff1493 !important;} -.syntaxhighlighter .constants{color:#0066cc !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#7f0055 !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;} -.syntaxhighlighter .keyword{font-weight:bold !important;} -.syntaxhighlighter .xml .keyword{color:#3f7f7f !important;font-weight:normal !important;} -.syntaxhighlighter .xml .color1,.syntaxhighlighter .xml .color1 a{color:#7f007f !important;} -.syntaxhighlighter .xml .string{font-style:italic !important;color:#2a00ff !important;}
@@ -1,30 +0,0 @@
-.syntaxhighlighter{background-color:black !important;} -.syntaxhighlighter .line.alt1{background-color:black !important;} -.syntaxhighlighter .line.alt2{background-color:black !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2a3133 !important;} -.syntaxhighlighter .line.highlighted.number{color:white !important;} -.syntaxhighlighter table caption{color:#d3d3d3 !important;} -.syntaxhighlighter .gutter{color:#d3d3d3 !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #990000 !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#990000 !important;color:black !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#ebdb8d !important;background:black !important;border:1px solid #990000 !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#ebdb8d !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:#ff7d27 !important;} -.syntaxhighlighter .toolbar{color:white !important;background:#990000 !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:white !important;} -.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d3d3d3 !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#ff7d27 !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#ff9e7b !important;} -.syntaxhighlighter .keyword{color:aqua !important;} -.syntaxhighlighter .preprocessor{color:#aec4de !important;} -.syntaxhighlighter .variable{color:#ffaa3e !important;} -.syntaxhighlighter .value{color:#009900 !important;} -.syntaxhighlighter .functions{color:#81cef9 !important;} -.syntaxhighlighter .constants{color:#ff9e7b !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:aqua !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ebdb8d !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff7d27 !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#aec4de !important;}
@@ -1,31 +0,0 @@
-.syntaxhighlighter{background-color:#121212 !important;} -.syntaxhighlighter .line.alt1{background-color:#121212 !important;} -.syntaxhighlighter .line.alt2{background-color:#121212 !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2c2c29 !important;} -.syntaxhighlighter .line.highlighted.number{color:white !important;} -.syntaxhighlighter table caption{color:white !important;} -.syntaxhighlighter .gutter{color:#afafaf !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #3185b9 !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#3185b9 !important;color:#121212 !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#3185b9 !important;background:black !important;border:1px solid #3185b9 !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#3185b9 !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:#d01d33 !important;} -.syntaxhighlighter .toolbar{color:white !important;background:#3185b9 !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:white !important;} -.syntaxhighlighter .toolbar a:hover{color:#96daff !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:white !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#696854 !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#e3e658 !important;} -.syntaxhighlighter .keyword{color:#d01d33 !important;} -.syntaxhighlighter .preprocessor{color:#435a5f !important;} -.syntaxhighlighter .variable{color:#898989 !important;} -.syntaxhighlighter .value{color:#009900 !important;} -.syntaxhighlighter .functions{color:#aaaaaa !important;} -.syntaxhighlighter .constants{color:#96daff !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#d01d33 !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ffc074 !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#4a8cdb !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#96daff !important;} -.syntaxhighlighter .functions{font-weight:bold !important;}
@@ -1,30 +0,0 @@
-.syntaxhighlighter{background-color:#222222 !important;} -.syntaxhighlighter .line.alt1{background-color:#222222 !important;} -.syntaxhighlighter .line.alt2{background-color:#222222 !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;} -.syntaxhighlighter .line.highlighted.number{color:white !important;} -.syntaxhighlighter table caption{color:lime !important;} -.syntaxhighlighter .gutter{color:#38566f !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#222222 !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:lime !important;} -.syntaxhighlighter .toolbar{color:#aaaaff !important;background:#435a5f !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:#aaaaff !important;} -.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:lime !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:lime !important;} -.syntaxhighlighter .keyword{color:#aaaaff !important;} -.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;} -.syntaxhighlighter .variable{color:aqua !important;} -.syntaxhighlighter .value{color:#f7e741 !important;} -.syntaxhighlighter .functions{color:#ff8000 !important;} -.syntaxhighlighter .constants{color:yellow !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#aaaaff !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:red !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:yellow !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
@@ -1,30 +0,0 @@
-.syntaxhighlighter{background-color:#0f192a !important;} -.syntaxhighlighter .line.alt1{background-color:#0f192a !important;} -.syntaxhighlighter .line.alt2{background-color:#0f192a !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;} -.syntaxhighlighter .line.highlighted.number{color:#38566f !important;} -.syntaxhighlighter table caption{color:#d1edff !important;} -.syntaxhighlighter .gutter{color:#afafaf !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#0f192a !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:#1dc116 !important;} -.syntaxhighlighter .toolbar{color:#d1edff !important;background:#435a5f !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:#d1edff !important;} -.syntaxhighlighter .toolbar a:hover{color:#8aa6c1 !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d1edff !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#1dc116 !important;} -.syntaxhighlighter .keyword{color:#b43d3d !important;} -.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;} -.syntaxhighlighter .variable{color:#ffaa3e !important;} -.syntaxhighlighter .value{color:#f7e741 !important;} -.syntaxhighlighter .functions{color:#ffaa3e !important;} -.syntaxhighlighter .constants{color:#e0e8ff !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#b43d3d !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#f8bb00 !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
@@ -1,30 +0,0 @@
-.syntaxhighlighter{background-color:#1b2426 !important;} -.syntaxhighlighter .line.alt1{background-color:#1b2426 !important;} -.syntaxhighlighter .line.alt2{background-color:#1b2426 !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#323e41 !important;} -.syntaxhighlighter .line.highlighted.number{color:#b9bdb6 !important;} -.syntaxhighlighter table caption{color:#b9bdb6 !important;} -.syntaxhighlighter .gutter{color:#afafaf !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#1b2426 !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:#5ba1cf !important;background:black !important;border:1px solid #435a5f !important;} -.syntaxhighlighter.collapsed .toolbar a{color:#5ba1cf !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:#5ce638 !important;} -.syntaxhighlighter .toolbar{color:white !important;background:#435a5f !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:white !important;} -.syntaxhighlighter .toolbar a:hover{color:#e0e8ff !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#b9bdb6 !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#878a85 !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#5ce638 !important;} -.syntaxhighlighter .keyword{color:#5ba1cf !important;} -.syntaxhighlighter .preprocessor{color:#435a5f !important;} -.syntaxhighlighter .variable{color:#ffaa3e !important;} -.syntaxhighlighter .value{color:#009900 !important;} -.syntaxhighlighter .functions{color:#ffaa3e !important;} -.syntaxhighlighter .constants{color:#e0e8ff !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#5ba1cf !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#e0e8ff !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
@@ -1,31 +0,0 @@
-.syntaxhighlighter{background-color:white !important;} -.syntaxhighlighter .line.alt1{background-color:white !important;} -.syntaxhighlighter .line.alt2{background-color:white !important;} -.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0 !important;} -.syntaxhighlighter .line.highlighted.number{color:black !important;} -.syntaxhighlighter table caption{color:black !important;} -.syntaxhighlighter .gutter{color:#afafaf !important;} -.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c !important;} -.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c !important;color:white !important;} -.syntaxhighlighter.printing .line .content{border:none !important;} -.syntaxhighlighter.collapsed{overflow:visible !important;} -.syntaxhighlighter.collapsed .toolbar{color:blue !important;background:white !important;border:1px solid #6ce26c !important;} -.syntaxhighlighter.collapsed .toolbar a{color:blue !important;} -.syntaxhighlighter.collapsed .toolbar a:hover{color:red !important;} -.syntaxhighlighter .toolbar{color:white !important;background:#6ce26c !important;border:none !important;} -.syntaxhighlighter .toolbar a{color:white !important;} -.syntaxhighlighter .toolbar a:hover{color:black !important;} -.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;} -.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200 !important;} -.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#d11010 !important;} -.syntaxhighlighter .keyword{color:#006699 !important;} -.syntaxhighlighter .preprocessor{color:gray !important;} -.syntaxhighlighter .variable{color:#aa7700 !important;} -.syntaxhighlighter .value{color:#009900 !important;} -.syntaxhighlighter .functions{color:#ff1493 !important;} -.syntaxhighlighter .constants{color:#0066cc !important;} -.syntaxhighlighter .script{font-weight:bold !important;color:#006699 !important;background-color:none !important;} -.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;} -.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;} -.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;} -.syntaxhighlighter .keyword{font-weight:bold !important;}
@@ -1,148 +0,0 @@
-<?php -/** - * EasyPeasyICS Simple ICS/vCal data generator. - * @author Marcus Bointon <phpmailer@synchromedia.co.uk> - * @author Manuel Reinhard <manu@sprain.ch> - * - * Built with inspiration from - * http://stackoverflow.com/questions/1463480/how-can-i-use-php-to-dynamically-publish-an-ical-file-to-be-read-by-google-calend/1464355#1464355 - * History: - * 2010/12/17 - Manuel Reinhard - when it all started - * 2014 PHPMailer project becomes maintainer - */ - -/** - * Class EasyPeasyICS. - * Simple ICS data generator - * @package phpmailer - * @subpackage easypeasyics - */ -class EasyPeasyICS -{ - /** - * The name of the calendar - * @var string - */ - protected $calendarName; - /** - * The array of events to add to this calendar - * @var array - */ - protected $events = array(); - - /** - * Constructor - * @param string $calendarName - */ - public function __construct($calendarName = "") - { - $this->calendarName = $calendarName; - } - - /** - * Add an event to this calendar. - * @param string $start The start date and time as a unix timestamp - * @param string $end The end date and time as a unix timestamp - * @param string $summary A summary or title for the event - * @param string $description A description of the event - * @param string $url A URL for the event - * @param string $uid A unique identifier for the event - generated automatically if not provided - * @return array An array of event details, including any generated UID - */ - public function addEvent($start, $end, $summary = '', $description = '', $url = '', $uid = '') - { - if (empty($uid)) { - $uid = md5(uniqid(mt_rand(), true)) . '@EasyPeasyICS'; - } - $event = array( - 'start' => gmdate('Ymd', $start) . 'T' . gmdate('His', $start) . 'Z', - 'end' => gmdate('Ymd', $end) . 'T' . gmdate('His', $end) . 'Z', - 'summary' => $summary, - 'description' => $description, - 'url' => $url, - 'uid' => $uid - ); - $this->events[] = $event; - return $event; - } - - /** - * @return array Get the array of events. - */ - public function getEvents() - { - return $this->events; - } - - /** - * Clear all events. - */ - public function clearEvents() - { - $this->events = array(); - } - - /** - * Get the name of the calendar. - * @return string - */ - public function getName() - { - return $this->calendarName; - } - - /** - * Set the name of the calendar. - * @param $name - */ - public function setName($name) - { - $this->calendarName = $name; - } - - /** - * Render and optionally output a vcal string. - * @param bool $output Whether to output the calendar data directly (the default). - * @return string The complete rendered vlal - */ - public function render($output = true) - { - //Add header - $ics = 'BEGIN:VCALENDAR -METHOD:PUBLISH -VERSION:2.0 -X-WR-CALNAME:' . $this->calendarName . ' -PRODID:-//hacksw/handcal//NONSGML v1.0//EN'; - - //Add events - foreach ($this->events as $event) { - $ics .= ' -BEGIN:VEVENT -UID:' . $event['uid'] . ' -DTSTAMP:' . gmdate('Ymd') . 'T' . gmdate('His') . 'Z -DTSTART:' . $event['start'] . ' -DTEND:' . $event['end'] . ' -SUMMARY:' . str_replace("\n", "\\n", $event['summary']) . ' -DESCRIPTION:' . str_replace("\n", "\\n", $event['description']) . ' -URL;VALUE=URI:' . $event['url'] . ' -END:VEVENT'; - } - - //Add footer - $ics .= ' -END:VCALENDAR'; - - if ($output) { - //Output - $filename = $this->calendarName; - //Filename needs quoting if it contains spaces - if (strpos($filename, ' ') !== false) { - $filename = '"'.$filename.'"'; - } - header('Content-type: text/calendar; charset=utf-8'); - header('Content-Disposition: inline; filename=' . $filename . '.ics'); - echo $ics; - } - return $ics; - } -}
@@ -1,17 +0,0 @@
-#PHPMailer Extras - -These classes provide optional additional functions to PHPMailer. - -These are not loaded by the PHPMailer autoloader, so in some cases you may need to `require` them yourself before using them. - -##EasyPeasyICS - -This class was originally written by Manuel Reinhard and provides a simple means of generating ICS/vCal files that are used in sending calendar events. PHPMailer does not use it directly, but you can use it to generate content appropriate for placing in the `Ical` property of PHPMailer. The PHPMailer project is now its official home as Manuel has given permission for that and is no longer maintaining it himself. - -##htmlfilter - -This class by Konstantin Riabitsev and Jim Jagielski implements HTML filtering to remove potentially malicious tags, such as `<script>` or `onclick=` attributes that can result in XSS attacks. This is a simple filter and is not as comprehensive as [HTMLawed](http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/) or [HTMLPurifier](http://htmlpurifier.org), but it's easier to use and considerably better than nothing! PHPMailer does not use it directly, but you may want to apply it to user-supplied HTML before using it as a message body. - -##NTLM_SASL_client - -This class by Manuel Lemos (bundled with permission) adds the ability to authenticate with Microsoft Windows mail servers that use NTLM-based authentication. It is used by PHPMailer if you send via SMTP and set the `AuthType` property to `NTLM`; you will also need to use the `Realm` and `Workstation` properties. The original source is [here](http://www.phpclasses.org/browse/file/7495.html).
@@ -1,1166 +0,0 @@
-<?php -/** - * htmlfilter.inc - * --------------- - * This set of functions allows you to filter html in order to remove - * any malicious tags from it. Useful in cases when you need to filter - * user input for any cross-site-scripting attempts. - * - * Copyright (C) 2002-2004 by Duke University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - * @Author Konstantin Riabitsev <icon@linux.duke.edu> - * @Author Jim Jagielski <jim@jaguNET.com / jimjag@gmail.com> - * @Version 1.1 ($Date$) - */ - -/** - * This function returns the final tag out of the tag name, an array - * of attributes, and the type of the tag. This function is called by - * tln_sanitize internally. - * - * @param string $tagname the name of the tag. - * @param array $attary the array of attributes and their values - * @param integer $tagtype The type of the tag (see in comments). - * @return string A string with the final tag representation. - */ -function tln_tagprint($tagname, $attary, $tagtype) -{ - if ($tagtype == 2) { - $fulltag = '</' . $tagname . '>'; - } else { - $fulltag = '<' . $tagname; - if (is_array($attary) && sizeof($attary)) { - $atts = array(); - while (list($attname, $attvalue) = each($attary)) { - array_push($atts, "$attname=$attvalue"); - } - $fulltag .= ' ' . join(' ', $atts); - } - if ($tagtype == 3) { - $fulltag .= ' /'; - } - $fulltag .= '>'; - } - return $fulltag; -} - -/** - * A small helper function to use with array_walk. Modifies a by-ref - * value and makes it lowercase. - * - * @param string $val a value passed by-ref. - * @return void since it modifies a by-ref value. - */ -function tln_casenormalize(&$val) -{ - $val = strtolower($val); -} - -/** - * This function skips any whitespace from the current position within - * a string and to the next non-whitespace value. - * - * @param string $body the string - * @param integer $offset the offset within the string where we should start - * looking for the next non-whitespace character. - * @return integer the location within the $body where the next - * non-whitespace char is located. - */ -function tln_skipspace($body, $offset) -{ - preg_match('/^(\s*)/s', substr($body, $offset), $matches); - if (sizeof($matches[1])) { - $count = strlen($matches[1]); - $offset += $count; - } - return $offset; -} - -/** - * This function looks for the next character within a string. It's - * really just a glorified "strpos", except it catches the failures - * nicely. - * - * @param string $body The string to look for needle in. - * @param integer $offset Start looking from this position. - * @param string $needle The character/string to look for. - * @return integer location of the next occurrence of the needle, or - * strlen($body) if needle wasn't found. - */ -function tln_findnxstr($body, $offset, $needle) -{ - $pos = strpos($body, $needle, $offset); - if ($pos === false) { - $pos = strlen($body); - } - return $pos; -} - -/** - * This function takes a PCRE-style regexp and tries to match it - * within the string. - * - * @param string $body The string to look for needle in. - * @param integer $offset Start looking from here. - * @param string $reg A PCRE-style regex to match. - * @return array|boolean Returns a false if no matches found, or an array - * with the following members: - * - integer with the location of the match within $body - * - string with whatever content between offset and the match - * - string with whatever it is we matched - */ -function tln_findnxreg($body, $offset, $reg) -{ - $matches = array(); - $retarr = array(); - $preg_rule = '%^(.*?)(' . $reg . ')%s'; - preg_match($preg_rule, substr($body, $offset), $matches); - if (!isset($matches[0]) || !$matches[0]) { - $retarr = false; - } else { - $retarr[0] = $offset + strlen($matches[1]); - $retarr[1] = $matches[1]; - $retarr[2] = $matches[2]; - } - return $retarr; -} - -/** - * This function looks for the next tag. - * - * @param string $body String where to look for the next tag. - * @param integer $offset Start looking from here. - * @return array|boolean false if no more tags exist in the body, or - * an array with the following members: - * - string with the name of the tag - * - array with attributes and their values - * - integer with tag type (1, 2, or 3) - * - integer where the tag starts (starting "<") - * - integer where the tag ends (ending ">") - * first three members will be false, if the tag is invalid. - */ -function tln_getnxtag($body, $offset) -{ - if ($offset > strlen($body)) { - return false; - } - $lt = tln_findnxstr($body, $offset, '<'); - if ($lt == strlen($body)) { - return false; - } - /** - * We are here: - * blah blah <tag attribute="value"> - * \---------^ - */ - $pos = tln_skipspace($body, $lt + 1); - if ($pos >= strlen($body)) { - return array(false, false, false, $lt, strlen($body)); - } - /** - * There are 3 kinds of tags: - * 1. Opening tag, e.g.: - * <a href="blah"> - * 2. Closing tag, e.g.: - * </a> - * 3. XHTML-style content-less tag, e.g.: - * <img src="blah"/> - */ - switch (substr($body, $pos, 1)) { - case '/': - $tagtype = 2; - $pos++; - break; - case '!': - /** - * A comment or an SGML declaration. - */ - if (substr($body, $pos + 1, 2) == '--') { - $gt = strpos($body, '-->', $pos); - if ($gt === false) { - $gt = strlen($body); - } else { - $gt += 2; - } - return array(false, false, false, $lt, $gt); - } else { - $gt = tln_findnxstr($body, $pos, '>'); - return array(false, false, false, $lt, $gt); - } - break; - default: - /** - * Assume tagtype 1 for now. If it's type 3, we'll switch values - * later. - */ - $tagtype = 1; - break; - } - - /** - * Look for next [\W-_], which will indicate the end of the tag name. - */ - $regary = tln_findnxreg($body, $pos, '[^\w\-_]'); - if ($regary == false) { - return array(false, false, false, $lt, strlen($body)); - } - list($pos, $tagname, $match) = $regary; - $tagname = strtolower($tagname); - - /** - * $match can be either of these: - * '>' indicating the end of the tag entirely. - * '\s' indicating the end of the tag name. - * '/' indicating that this is type-3 xhtml tag. - * - * Whatever else we find there indicates an invalid tag. - */ - switch ($match) { - case '/': - /** - * This is an xhtml-style tag with a closing / at the - * end, like so: <img src="blah"/>. Check if it's followed - * by the closing bracket. If not, then this tag is invalid - */ - if (substr($body, $pos, 2) == '/>') { - $pos++; - $tagtype = 3; - } else { - $gt = tln_findnxstr($body, $pos, '>'); - $retary = array(false, false, false, $lt, $gt); - return $retary; - } - //intentional fall-through - case '>': - return array($tagname, false, $tagtype, $lt, $pos); - break; - default: - /** - * Check if it's whitespace - */ - if (!preg_match('/\s/', $match)) { - /** - * This is an invalid tag! Look for the next closing ">". - */ - $gt = tln_findnxstr($body, $lt, '>'); - return array(false, false, false, $lt, $gt); - } - break; - } - - /** - * At this point we're here: - * <tagname attribute='blah'> - * \-------^ - * - * At this point we loop in order to find all attributes. - */ - $attary = array(); - - while ($pos <= strlen($body)) { - $pos = tln_skipspace($body, $pos); - if ($pos == strlen($body)) { - /** - * Non-closed tag. - */ - return array(false, false, false, $lt, $pos); - } - /** - * See if we arrived at a ">" or "/>", which means that we reached - * the end of the tag. - */ - $matches = array(); - if (preg_match('%^(\s*)(>|/>)%s', substr($body, $pos), $matches)) { - /** - * Yep. So we did. - */ - $pos += strlen($matches[1]); - if ($matches[2] == '/>') { - $tagtype = 3; - $pos++; - } - return array($tagname, $attary, $tagtype, $lt, $pos); - } - - /** - * There are several types of attributes, with optional - * [:space:] between members. - * Type 1: - * attrname[:space:]=[:space:]'CDATA' - * Type 2: - * attrname[:space:]=[:space:]"CDATA" - * Type 3: - * attr[:space:]=[:space:]CDATA - * Type 4: - * attrname - * - * We leave types 1 and 2 the same, type 3 we check for - * '"' and convert to """ if needed, then wrap in - * double quotes. Type 4 we convert into: - * attrname="yes". - */ - $regary = tln_findnxreg($body, $pos, '[^\w\-_]'); - if ($regary == false) { - /** - * Looks like body ended before the end of tag. - */ - return array(false, false, false, $lt, strlen($body)); - } - list($pos, $attname, $match) = $regary; - $attname = strtolower($attname); - /** - * We arrived at the end of attribute name. Several things possible - * here: - * '>' means the end of the tag and this is attribute type 4 - * '/' if followed by '>' means the same thing as above - * '\s' means a lot of things -- look what it's followed by. - * anything else means the attribute is invalid. - */ - switch ($match) { - case '/': - /** - * This is an xhtml-style tag with a closing / at the - * end, like so: <img src="blah"/>. Check if it's followed - * by the closing bracket. If not, then this tag is invalid - */ - if (substr($body, $pos, 2) == '/>') { - $pos++; - $tagtype = 3; - } else { - $gt = tln_findnxstr($body, $pos, '>'); - $retary = array(false, false, false, $lt, $gt); - return $retary; - } - //intentional fall-through - case '>': - $attary{$attname} = '"yes"'; - return array($tagname, $attary, $tagtype, $lt, $pos); - break; - default: - /** - * Skip whitespace and see what we arrive at. - */ - $pos = tln_skipspace($body, $pos); - $char = substr($body, $pos, 1); - /** - * Two things are valid here: - * '=' means this is attribute type 1 2 or 3. - * \w means this was attribute type 4. - * anything else we ignore and re-loop. End of tag and - * invalid stuff will be caught by our checks at the beginning - * of the loop. - */ - if ($char == '=') { - $pos++; - $pos = tln_skipspace($body, $pos); - /** - * Here are 3 possibilities: - * "'" attribute type 1 - * '"' attribute type 2 - * everything else is the content of tag type 3 - */ - $quot = substr($body, $pos, 1); - if ($quot == '\'') { - $regary = tln_findnxreg($body, $pos + 1, '\''); - if ($regary == false) { - return array(false, false, false, $lt, strlen($body)); - } - list($pos, $attval, $match) = $regary; - $pos++; - $attary{$attname} = '\'' . $attval . '\''; - } elseif ($quot == '"') { - $regary = tln_findnxreg($body, $pos + 1, '\"'); - if ($regary == false) { - return array(false, false, false, $lt, strlen($body)); - } - list($pos, $attval, $match) = $regary; - $pos++; - $attary{$attname} = '"' . $attval . '"'; - } else { - /** - * These are hateful. Look for \s, or >. - */ - $regary = tln_findnxreg($body, $pos, '[\s>]'); - if ($regary == false) { - return array(false, false, false, $lt, strlen($body)); - } - list($pos, $attval, $match) = $regary; - /** - * If it's ">" it will be caught at the top. - */ - $attval = preg_replace('/\"/s', '"', $attval); - $attary{$attname} = '"' . $attval . '"'; - } - } elseif (preg_match('|[\w/>]|', $char)) { - /** - * That was attribute type 4. - */ - $attary{$attname} = '"yes"'; - } else { - /** - * An illegal character. Find next '>' and return. - */ - $gt = tln_findnxstr($body, $pos, '>'); - return array(false, false, false, $lt, $gt); - } - break; - } - } - /** - * The fact that we got here indicates that the tag end was never - * found. Return invalid tag indication so it gets stripped. - */ - return array(false, false, false, $lt, strlen($body)); -} - -/** - * Translates entities into literal values so they can be checked. - * - * @param string $attvalue the by-ref value to check. - * @param string $regex the regular expression to check against. - * @param boolean $hex whether the entites are hexadecimal. - * @return boolean True or False depending on whether there were matches. - */ -function tln_deent(&$attvalue, $regex, $hex = false) -{ - preg_match_all($regex, $attvalue, $matches); - if (is_array($matches) && sizeof($matches[0]) > 0) { - $repl = array(); - for ($i = 0; $i < sizeof($matches[0]); $i++) { - $numval = $matches[1][$i]; - if ($hex) { - $numval = hexdec($numval); - } - $repl{$matches[0][$i]} = chr($numval); - } - $attvalue = strtr($attvalue, $repl); - return true; - } else { - return false; - } -} - -/** - * This function checks attribute values for entity-encoded values - * and returns them translated into 8-bit strings so we can run - * checks on them. - * - * @param string $attvalue A string to run entity check against. - * @return Void, modifies a reference value. - */ -function tln_defang(&$attvalue) -{ - /** - * Skip this if there aren't ampersands or backslashes. - */ - if (strpos($attvalue, '&') === false - && strpos($attvalue, '\\') === false - ) { - return; - } - do { - $m = false; - $m = $m || tln_deent($attvalue, '/\�*(\d+);*/s'); - $m = $m || tln_deent($attvalue, '/\�*((\d|[a-f])+);*/si', true); - $m = $m || tln_deent($attvalue, '/\\\\(\d+)/s', true); - } while ($m == true); - $attvalue = stripslashes($attvalue); -} - -/** - * Kill any tabs, newlines, or carriage returns. Our friends the - * makers of the browser with 95% market value decided that it'd - * be funny to make "java[tab]script" be just as good as "javascript". - * - * @param string $attvalue The attribute value before extraneous spaces removed. - * @return Void, modifies a reference value. - */ -function tln_unspace(&$attvalue) -{ - if (strcspn($attvalue, "\t\r\n\0 ") != strlen($attvalue)) { - $attvalue = str_replace( - array("\t", "\r", "\n", "\0", " "), - array('', '', '', '', ''), - $attvalue - ); - } -} - -/** - * This function runs various checks against the attributes. - * - * @param string $tagname String with the name of the tag. - * @param array $attary Array with all tag attributes. - * @param array $rm_attnames See description for tln_sanitize - * @param array $bad_attvals See description for tln_sanitize - * @param array $add_attr_to_tag See description for tln_sanitize - * @param string $trans_image_path - * @param boolean $block_external_images - * @return Array with modified attributes. - */ -function tln_fixatts( - $tagname, - $attary, - $rm_attnames, - $bad_attvals, - $add_attr_to_tag, - $trans_image_path, - $block_external_images -) { - while (list($attname, $attvalue) = each($attary)) { - /** - * See if this attribute should be removed. - */ - foreach ($rm_attnames as $matchtag => $matchattrs) { - if (preg_match($matchtag, $tagname)) { - foreach ($matchattrs as $matchattr) { - if (preg_match($matchattr, $attname)) { - unset($attary{$attname}); - continue; - } - } - } - } - /** - * Remove any backslashes, entities, or extraneous whitespace. - */ - $oldattvalue = $attvalue; - tln_defang($attvalue); - if ($attname == 'style' && $attvalue !== $oldattvalue) { - $attvalue = "idiocy"; - $attary{$attname} = $attvalue; - } - tln_unspace($attvalue); - - /** - * Now let's run checks on the attvalues. - * I don't expect anyone to comprehend this. If you do, - * get in touch with me so I can drive to where you live and - * shake your hand personally. :) - */ - foreach ($bad_attvals as $matchtag => $matchattrs) { - if (preg_match($matchtag, $tagname)) { - foreach ($matchattrs as $matchattr => $valary) { - if (preg_match($matchattr, $attname)) { - /** - * There are two arrays in valary. - * First is matches. - * Second one is replacements - */ - list($valmatch, $valrepl) = $valary; - $newvalue = preg_replace($valmatch, $valrepl, $attvalue); - if ($newvalue != $attvalue) { - $attary{$attname} = $newvalue; - $attvalue = $newvalue; - } - } - } - } - } - if ($attname == 'style') { - if (preg_match('/[\0-\37\200-\377]+/', $attvalue)) { - $attary{$attname} = '"disallowed character"'; - } - preg_match_all("/url\s*\((.+)\)/si", $attvalue, $aMatch); - if (count($aMatch)) { - foreach($aMatch[1] as $sMatch) { - $urlvalue = $sMatch; - tln_fixurl($attname, $urlvalue, $trans_image_path, $block_external_images); - $attary{$attname} = str_replace($sMatch, $urlvalue, $attvalue); - } - } - } - } - /** - * See if we need to append any attributes to this tag. - */ - foreach ($add_attr_to_tag as $matchtag => $addattary) { - if (preg_match($matchtag, $tagname)) { - $attary = array_merge($attary, $addattary); - } - } - return $attary; -} - -function tln_fixurl($attname, &$attvalue, $trans_image_path, $block_external_images) -{ - $sQuote = '"'; - $attvalue = trim($attvalue); - if ($attvalue && ($attvalue[0] =='"'|| $attvalue[0] == "'")) { - // remove the double quotes - $sQuote = $attvalue[0]; - $attvalue = trim(substr($attvalue,1,-1)); - } - - /** - * Replace empty src tags with the blank image. src is only used - * for frames, images, and image inputs. Doing a replace should - * not affect them working as should be, however it will stop - * IE from being kicked off when src for img tags are not set - */ - if ($attvalue == '') { - $attvalue = $sQuote . $trans_image_path . $sQuote; - } else { - // first, disallow 8 bit characters and control characters - if (preg_match('/[\0-\37\200-\377]+/',$attvalue)) { - switch ($attname) { - case 'href': - $attvalue = $sQuote . 'http://invalid-stuff-detected.example.com' . $sQuote; - break; - default: - $attvalue = $sQuote . $trans_image_path . $sQuote; - break; - } - } else { - $aUrl = parse_url($attvalue); - if (isset($aUrl['scheme'])) { - switch(strtolower($aUrl['scheme'])) { - case 'mailto': - case 'http': - case 'https': - case 'ftp': - if ($attname != 'href') { - if ($block_external_images == true) { - $attvalue = $sQuote . $trans_image_path . $sQuote; - } else { - if (!isset($aUrl['path'])) { - $attvalue = $sQuote . $trans_image_path . $sQuote; - } - } - } else { - $attvalue = $sQuote . $attvalue . $sQuote; - } - break; - case 'outbind': - $attvalue = $sQuote . $attvalue . $sQuote; - break; - case 'cid': - $attvalue = $sQuote . $attvalue . $sQuote; - break; - default: - $attvalue = $sQuote . $trans_image_path . $sQuote; - break; - } - } else { - if (!isset($aUrl['path']) || $aUrl['path'] != $trans_image_path) { - $$attvalue = $sQuote . $trans_image_path . $sQuote; - } - } - } - } -} - -function tln_fixstyle($body, $pos, $trans_image_path, $block_external_images) -{ - $me = 'tln_fixstyle'; - // workaround for </style> in between comments - $iCurrentPos = $pos; - $content = ''; - $sToken = ''; - $bSucces = false; - $bEndTag = false; - for ($i=$pos,$iCount=strlen($body);$i<$iCount;++$i) { - $char = $body{$i}; - switch ($char) { - case '<': - $sToken = $char; - break; - case '/': - if ($sToken == '<') { - $sToken .= $char; - $bEndTag = true; - } else { - $content .= $char; - } - break; - case '>': - if ($bEndTag) { - $sToken .= $char; - if (preg_match('/\<\/\s*style\s*\>/i',$sToken,$aMatch)) { - $newpos = $i + 1; - $bSucces = true; - break 2; - } else { - $content .= $sToken; - } - $bEndTag = false; - } else { - $content .= $char; - } - break; - case '!': - if ($sToken == '<') { - // possible comment - if (isset($body{$i+2}) && substr($body,$i,3) == '!--') { - $i = strpos($body,'-->',$i+3); - if ($i === false) { // no end comment - $i = strlen($body); - } - $sToken = ''; - } - } else { - $content .= $char; - } - break; - default: - if ($bEndTag) { - $sToken .= $char; - } else { - $content .= $char; - } - break; - } - } - if ($bSucces == FALSE){ - return array(FALSE, strlen($body)); - } - - - - /** - * First look for general BODY style declaration, which would be - * like so: - * body {background: blah-blah} - * and change it to .bodyclass so we can just assign it to a <div> - */ - $content = preg_replace("|body(\s*\{.*?\})|si", ".bodyclass\\1", $content); - - $trans_image_path = $trans_image_path; - - /** - * Fix url('blah') declarations. - */ - // $content = preg_replace("|url\s*\(\s*([\'\"])\s*\S+script\s*:.*?([\'\"])\s*\)|si", - // "url(\\1$trans_image_path\\2)", $content); - - // first check for 8bit sequences and disallowed control characters - if (preg_match('/[\16-\37\200-\377]+/',$content)) { - $content = '<!-- style block removed by html filter due to presence of 8bit characters -->'; - return array($content, $newpos); - } - - // remove @import line - $content = preg_replace("/^\s*(@import.*)$/mi","\n<!-- @import rules forbidden -->\n",$content); - - $content = preg_replace("/(\\\\)?u(\\\\)?r(\\\\)?l(\\\\)?/i", 'url', $content); - preg_match_all("/url\s*\((.+)\)/si",$content,$aMatch); - if (count($aMatch)) { - $aValue = $aReplace = array(); - foreach($aMatch[1] as $sMatch) { - // url value - $urlvalue = $sMatch; - tln_fixurl('style',$urlvalue, $trans_image_path, $block_external_images); - $aValue[] = $sMatch; - $aReplace[] = $urlvalue; - } - $content = str_replace($aValue,$aReplace,$content); - } - - /** - * Remove any backslashes, entities, and extraneous whitespace. - */ - $contentTemp = $content; - tln_defang($contentTemp); - tln_unspace($contentTemp); - - $match = Array('/\/\*.*\*\//', - '/expression/i', - '/behaviou*r/i', - '/binding/i', - '/include-source/i', - '/javascript/i', - '/script/i', - '/position/i'); - $replace = Array('','idiocy', 'idiocy', 'idiocy', 'idiocy', 'idiocy', 'idiocy', ''); - $contentNew = preg_replace($match, $replace, $contentTemp); - if ($contentNew !== $contentTemp) { - $content = $contentNew; - } - return array($content, $newpos); -} - -function tln_body2div($attary, $trans_image_path) -{ - $me = 'tln_body2div'; - $divattary = array('class' => "'bodyclass'"); - $text = '#000000'; - $has_bgc_stl = $has_txt_stl = false; - $styledef = ''; - if (is_array($attary) && sizeof($attary) > 0){ - foreach ($attary as $attname=>$attvalue){ - $quotchar = substr($attvalue, 0, 1); - $attvalue = str_replace($quotchar, "", $attvalue); - switch ($attname){ - case 'background': - $styledef .= "background-image: url('$trans_image_path'); "; - break; - case 'bgcolor': - $has_bgc_stl = true; - $styledef .= "background-color: $attvalue; "; - break; - case 'text': - $has_txt_stl = true; - $styledef .= "color: $attvalue; "; - break; - } - } - // Outlook defines a white bgcolor and no text color. This can lead to - // white text on a white bg with certain themes. - if ($has_bgc_stl && !$has_txt_stl) { - $styledef .= "color: $text; "; - } - if (strlen($styledef) > 0){ - $divattary{"style"} = "\"$styledef\""; - } - } - return $divattary; -} - -/** - * - * @param string $body The HTML you wish to filter - * @param array $tag_list see description above - * @param array $rm_tags_with_content see description above - * @param array $self_closing_tags see description above - * @param boolean $force_tag_closing see description above - * @param array $rm_attnames see description above - * @param array $bad_attvals see description above - * @param array $add_attr_to_tag see description above - * @param string $trans_image_path - * @param boolean $block_external_images - - * @return string Sanitized html safe to show on your pages. - */ -function tln_sanitize( - $body, - $tag_list, - $rm_tags_with_content, - $self_closing_tags, - $force_tag_closing, - $rm_attnames, - $bad_attvals, - $add_attr_to_tag, - $trans_image_path, - $block_external_images -) { - /** - * Normalize rm_tags and rm_tags_with_content. - */ - $rm_tags = array_shift($tag_list); - @array_walk($tag_list, 'tln_casenormalize'); - @array_walk($rm_tags_with_content, 'tln_casenormalize'); - @array_walk($self_closing_tags, 'tln_casenormalize'); - /** - * See if tag_list is of tags to remove or tags to allow. - * false means remove these tags - * true means allow these tags - */ - $curpos = 0; - $open_tags = array(); - $trusted = "<!-- begin tln_sanitized html -->\n"; - $skip_content = false; - /** - * Take care of netscape's stupid javascript entities like - * &{alert('boo')}; - */ - $body = preg_replace('/&(\{.*?\};)/si', '&\\1', $body); - while (($curtag = tln_getnxtag($body, $curpos)) != false) { - list($tagname, $attary, $tagtype, $lt, $gt) = $curtag; - $free_content = substr($body, $curpos, $lt-$curpos); - /** - * Take care of <style> - */ - if ($tagname == "style" && $tagtype == 1){ - list($free_content, $curpos) = - tln_fixstyle($body, $gt+1, $trans_image_path, $block_external_images); - if ($free_content != FALSE){ - if ( !empty($attary) ) { - $attary = tln_fixatts($tagname, - $attary, - $rm_attnames, - $bad_attvals, - $add_attr_to_tag, - $trans_image_path, - $block_external_images - ); - } - $trusted .= tln_tagprint($tagname, $attary, $tagtype); - $trusted .= $free_content; - $trusted .= tln_tagprint($tagname, false, 2); - } - continue; - } - if ($skip_content == false){ - $trusted .= $free_content; - } - if ($tagname != false) { - if ($tagtype == 2) { - if ($skip_content == $tagname) { - /** - * Got to the end of tag we needed to remove. - */ - $tagname = false; - $skip_content = false; - } else { - if ($skip_content == false) { - if ($tagname == "body") { - $tagname = "div"; - } - if (isset($open_tags{$tagname}) && - $open_tags{$tagname} > 0 - ) { - $open_tags{$tagname}--; - } else { - $tagname = false; - } - } - } - } else { - /** - * $rm_tags_with_content - */ - if ($skip_content == false) { - /** - * See if this is a self-closing type and change - * tagtype appropriately. - */ - if ($tagtype == 1 - && in_array($tagname, $self_closing_tags) - ) { - $tagtype = 3; - } - /** - * See if we should skip this tag and any content - * inside it. - */ - if ($tagtype == 1 - && in_array($tagname, $rm_tags_with_content) - ) { - $skip_content = $tagname; - } else { - if (($rm_tags == false - && in_array($tagname, $tag_list)) || - ($rm_tags == true - && !in_array($tagname, $tag_list)) - ) { - $tagname = false; - } else { - /** - * Convert body into div. - */ - if ($tagname == "body"){ - $tagname = "div"; - $attary = tln_body2div($attary, $trans_image_path); - } - if ($tagtype == 1) { - if (isset($open_tags{$tagname})) { - $open_tags{$tagname}++; - } else { - $open_tags{$tagname} = 1; - } - } - /** - * This is where we run other checks. - */ - if (is_array($attary) && sizeof($attary) > 0) { - $attary = tln_fixatts( - $tagname, - $attary, - $rm_attnames, - $bad_attvals, - $add_attr_to_tag, - $trans_image_path, - $block_external_images - ); - } - } - } - } - } - if ($tagname != false && $skip_content == false) { - $trusted .= tln_tagprint($tagname, $attary, $tagtype); - } - } - $curpos = $gt + 1; - } - $trusted .= substr($body, $curpos, strlen($body) - $curpos); - if ($force_tag_closing == true) { - foreach ($open_tags as $tagname => $opentimes) { - while ($opentimes > 0) { - $trusted .= '</' . $tagname . '>'; - $opentimes--; - } - } - $trusted .= "\n"; - } - $trusted .= "<!-- end tln_sanitized html -->\n"; - return $trusted; -} - -// -// Use the nifty htmlfilter library -// - - -function HTMLFilter($body, $trans_image_path, $block_external_images = false) -{ - - $tag_list = array( - false, - "object", - "meta", - "html", - "head", - "base", - "link", - "frame", - "iframe", - "plaintext", - "marquee" - ); - - $rm_tags_with_content = array( - "script", - "applet", - "embed", - "title", - "frameset", - "xmp", - "xml" - ); - - $self_closing_tags = array( - "img", - "br", - "hr", - "input", - "outbind" - ); - - $force_tag_closing = true; - - $rm_attnames = array( - "/.*/" => - array( - // "/target/i", - "/^on.*/i", - "/^dynsrc/i", - "/^data.*/i", - "/^lowsrc.*/i" - ) - ); - - $bad_attvals = array( - "/.*/" => - array( - "/^src|background/i" => - array( - array( - '/^([\'"])\s*\S+script\s*:.*([\'"])/si', - '/^([\'"])\s*mocha\s*:*.*([\'"])/si', - '/^([\'"])\s*about\s*:.*([\'"])/si' - ), - array( - "\\1$trans_image_path\\2", - "\\1$trans_image_path\\2", - "\\1$trans_image_path\\2" - ) - ), - "/^href|action/i" => - array( - array( - '/^([\'"])\s*\S+script\s*:.*([\'"])/si', - '/^([\'"])\s*mocha\s*:*.*([\'"])/si', - '/^([\'"])\s*about\s*:.*([\'"])/si' - ), - array( - "\\1#\\1", - "\\1#\\1", - "\\1#\\1" - ) - ), - "/^style/i" => - array( - array( - "/\/\*.*\*\//", - "/expression/i", - "/binding/i", - "/behaviou*r/i", - "/include-source/i", - '/position\s*:/i', - '/(\\\\)?u(\\\\)?r(\\\\)?l(\\\\)?/i', - '/url\s*\(\s*([\'"])\s*\S+script\s*:.*([\'"])\s*\)/si', - '/url\s*\(\s*([\'"])\s*mocha\s*:.*([\'"])\s*\)/si', - '/url\s*\(\s*([\'"])\s*about\s*:.*([\'"])\s*\)/si', - '/(.*)\s*:\s*url\s*\(\s*([\'"]*)\s*\S+script\s*:.*([\'"]*)\s*\)/si' - ), - array( - "", - "idiocy", - "idiocy", - "idiocy", - "idiocy", - "idiocy", - "url", - "url(\\1#\\1)", - "url(\\1#\\1)", - "url(\\1#\\1)", - "\\1:url(\\2#\\3)" - ) - ) - ) - ); - - if ($block_external_images) { - array_push( - $bad_attvals{'/.*/'}{'/^src|background/i'}[0], - '/^([\'\"])\s*https*:.*([\'\"])/si' - ); - array_push( - $bad_attvals{'/.*/'}{'/^src|background/i'}[1], - "\\1$trans_image_path\\1" - ); - array_push( - $bad_attvals{'/.*/'}{'/^style/i'}[0], - '/url\(([\'\"])\s*https*:.*([\'\"])\)/si' - ); - array_push( - $bad_attvals{'/.*/'}{'/^style/i'}[1], - "url(\\1$trans_image_path\\1)" - ); - } - - $add_attr_to_tag = array( - "/^a$/i" => - array('target' => '"_blank"') - ); - - $trusted = tln_sanitize( - $body, - $tag_list, - $rm_tags_with_content, - $self_closing_tags, - $force_tag_closing, - $rm_attnames, - $bad_attvals, - $add_attr_to_tag, - $trans_image_path, - $block_external_images - ); - return $trusted; -}
@@ -1,185 +0,0 @@
-<?php -/* - * ntlm_sasl_client.php - * - * @(#) $Id: ntlm_sasl_client.php,v 1.3 2004/11/17 08:00:37 mlemos Exp $ - * - */ - -define("SASL_NTLM_STATE_START", 0); -define("SASL_NTLM_STATE_IDENTIFY_DOMAIN", 1); -define("SASL_NTLM_STATE_RESPOND_CHALLENGE", 2); -define("SASL_NTLM_STATE_DONE", 3); -define("SASL_FAIL", -1); -define("SASL_CONTINUE", 1); - -class ntlm_sasl_client_class -{ - public $credentials = array(); - public $state = SASL_NTLM_STATE_START; - - public function initialize(&$client) - { - if (!function_exists($function = "mcrypt_encrypt") - || !function_exists($function = "mhash") - ) { - $extensions = array( - "mcrypt_encrypt" => "mcrypt", - "mhash" => "mhash" - ); - $client->error = "the extension " . $extensions[$function] . - " required by the NTLM SASL client class is not available in this PHP configuration"; - return (0); - } - return (1); - } - - public function ASCIIToUnicode($ascii) - { - for ($unicode = "", $a = 0; $a < strlen($ascii); $a++) { - $unicode .= substr($ascii, $a, 1) . chr(0); - } - return ($unicode); - } - - public function typeMsg1($domain, $workstation) - { - $domain_length = strlen($domain); - $workstation_length = strlen($workstation); - $workstation_offset = 32; - $domain_offset = $workstation_offset + $workstation_length; - return ( - "NTLMSSP\0" . - "\x01\x00\x00\x00" . - "\x07\x32\x00\x00" . - pack("v", $domain_length) . - pack("v", $domain_length) . - pack("V", $domain_offset) . - pack("v", $workstation_length) . - pack("v", $workstation_length) . - pack("V", $workstation_offset) . - $workstation . - $domain - ); - } - - public function NTLMResponse($challenge, $password) - { - $unicode = $this->ASCIIToUnicode($password); - $md4 = mhash(MHASH_MD4, $unicode); - $padded = $md4 . str_repeat(chr(0), 21 - strlen($md4)); - $iv_size = mcrypt_get_iv_size(MCRYPT_DES, MCRYPT_MODE_ECB); - $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); - for ($response = "", $third = 0; $third < 21; $third += 7) { - for ($packed = "", $p = $third; $p < $third + 7; $p++) { - $packed .= str_pad(decbin(ord(substr($padded, $p, 1))), 8, "0", STR_PAD_LEFT); - } - for ($key = "", $p = 0; $p < strlen($packed); $p += 7) { - $s = substr($packed, $p, 7); - $b = $s . ((substr_count($s, "1") % 2) ? "0" : "1"); - $key .= chr(bindec($b)); - } - $ciphertext = mcrypt_encrypt(MCRYPT_DES, $key, $challenge, MCRYPT_MODE_ECB, $iv); - $response .= $ciphertext; - } - return $response; - } - - public function typeMsg3($ntlm_response, $user, $domain, $workstation) - { - $domain_unicode = $this->ASCIIToUnicode($domain); - $domain_length = strlen($domain_unicode); - $domain_offset = 64; - $user_unicode = $this->ASCIIToUnicode($user); - $user_length = strlen($user_unicode); - $user_offset = $domain_offset + $domain_length; - $workstation_unicode = $this->ASCIIToUnicode($workstation); - $workstation_length = strlen($workstation_unicode); - $workstation_offset = $user_offset + $user_length; - $lm = ""; - $lm_length = strlen($lm); - $lm_offset = $workstation_offset + $workstation_length; - $ntlm = $ntlm_response; - $ntlm_length = strlen($ntlm); - $ntlm_offset = $lm_offset + $lm_length; - $session = ""; - $session_length = strlen($session); - $session_offset = $ntlm_offset + $ntlm_length; - return ( - "NTLMSSP\0" . - "\x03\x00\x00\x00" . - pack("v", $lm_length) . - pack("v", $lm_length) . - pack("V", $lm_offset) . - pack("v", $ntlm_length) . - pack("v", $ntlm_length) . - pack("V", $ntlm_offset) . - pack("v", $domain_length) . - pack("v", $domain_length) . - pack("V", $domain_offset) . - pack("v", $user_length) . - pack("v", $user_length) . - pack("V", $user_offset) . - pack("v", $workstation_length) . - pack("v", $workstation_length) . - pack("V", $workstation_offset) . - pack("v", $session_length) . - pack("v", $session_length) . - pack("V", $session_offset) . - "\x01\x02\x00\x00" . - $domain_unicode . - $user_unicode . - $workstation_unicode . - $lm . - $ntlm - ); - } - - public function start(&$client, &$message, &$interactions) - { - if ($this->state != SASL_NTLM_STATE_START) { - $client->error = "NTLM authentication state is not at the start"; - return (SASL_FAIL); - } - $this->credentials = array( - "user" => "", - "password" => "", - "realm" => "", - "workstation" => "" - ); - $defaults = array(); - $status = $client->GetCredentials($this->credentials, $defaults, $interactions); - if ($status == SASL_CONTINUE) { - $this->state = SASL_NTLM_STATE_IDENTIFY_DOMAIN; - } - unset($message); - return ($status); - } - - public function step(&$client, $response, &$message, &$interactions) - { - switch ($this->state) { - case SASL_NTLM_STATE_IDENTIFY_DOMAIN: - $message = $this->TypeMsg1($this->credentials["realm"], $this->credentials["workstation"]); - $this->state = SASL_NTLM_STATE_RESPOND_CHALLENGE; - break; - case SASL_NTLM_STATE_RESPOND_CHALLENGE: - $ntlm_response = $this->NTLMResponse(substr($response, 24, 8), $this->credentials["password"]); - $message = $this->TypeMsg3( - $ntlm_response, - $this->credentials["user"], - $this->credentials["realm"], - $this->credentials["workstation"] - ); - $this->state = SASL_NTLM_STATE_DONE; - break; - case SASL_NTLM_STATE_DONE: - $client->error = "NTLM authentication was finished without success"; - return (SASL_FAIL); - default: - $client->error = "invalid NTLM authentication step state"; - return (SASL_FAIL); - } - return (SASL_CONTINUE); - } -}
@@ -1,162 +0,0 @@
-<?php -/** - * Get an OAuth2 token from Google. - * * Install this script on your server so that it's accessible - * as [https/http]://<yourdomain>/<folder>/get_oauth_token.php - * e.g.: http://localhost/phpmail/get_oauth_token.php - * * Ensure dependencies are installed with 'composer install' - * * Set up an app in your Google developer console - * * Set the script address as the app's redirect URL - * If no refresh token is obtained when running this file, revoke access to your app - * using link: https://accounts.google.com/b/0/IssuedAuthSubTokens and run the script again. - * This script requires PHP 5.4 or later - * PHP Version 5.4 - */ - -namespace League\OAuth2\Client\Provider; - -require 'vendor/autoload.php'; - -use League\OAuth2\Client\Provider\Exception\IdentityProviderException; -use League\OAuth2\Client\Token\AccessToken; -use League\OAuth2\Client\Tool\BearerAuthorizationTrait; -use Psr\Http\Message\ResponseInterface; - -session_start(); - -//If this automatic URL doesn't work, set it yourself manually -$redirectUri = isset($_SERVER['HTTPS']) ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; -//$redirectUri = 'http://localhost/phpmailer/get_oauth_token.php'; - -//These details obtained are by setting up app in Google developer console. -$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com'; -$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP'; - -class Google extends AbstractProvider -{ - use BearerAuthorizationTrait; - - const ACCESS_TOKEN_RESOURCE_OWNER_ID = 'id'; - - /** - * @var string If set, this will be sent to google as the "access_type" parameter. - * @link https://developers.google.com/accounts/docs/OAuth2WebServer#offline - */ - protected $accessType; - - /** - * @var string If set, this will be sent to google as the "hd" parameter. - * @link https://developers.google.com/accounts/docs/OAuth2Login#hd-param - */ - protected $hostedDomain; - - /** - * @var string If set, this will be sent to google as the "scope" parameter. - * @link https://developers.google.com/gmail/api/auth/scopes - */ - protected $scope; - - public function getBaseAuthorizationUrl() - { - return 'https://accounts.google.com/o/oauth2/auth'; - } - - public function getBaseAccessTokenUrl(array $params) - { - return 'https://accounts.google.com/o/oauth2/token'; - } - - public function getResourceOwnerDetailsUrl(AccessToken $token) - { - return ' '; - } - - protected function getAuthorizationParameters(array $options) - { - if (is_array($this->scope)) { - $separator = $this->getScopeSeparator(); - $this->scope = implode($separator, $this->scope); - } - - $params = array_merge( - parent::getAuthorizationParameters($options), - array_filter([ - 'hd' => $this->hostedDomain, - 'access_type' => $this->accessType, - 'scope' => $this->scope, - // if the user is logged in with more than one account ask which one to use for the login! - 'authuser' => '-1' - ]) - ); - return $params; - } - - protected function getDefaultScopes() - { - return [ - 'email', - 'openid', - 'profile', - ]; - } - - protected function getScopeSeparator() - { - return ' '; - } - - protected function checkResponse(ResponseInterface $response, $data) - { - if (!empty($data['error'])) { - $code = 0; - $error = $data['error']; - - if (is_array($error)) { - $code = $error['code']; - $error = $error['message']; - } - - throw new IdentityProviderException($error, $code, $data); - } - } - - protected function createResourceOwner(array $response, AccessToken $token) - { - return new GoogleUser($response); - } -} - - -//Set Redirect URI in Developer Console as [https/http]://<yourdomain>/<folder>/get_oauth_token.php -$provider = new Google( - array( - 'clientId' => $clientId, - 'clientSecret' => $clientSecret, - 'redirectUri' => $redirectUri, - 'scope' => array('https://mail.google.com/'), - 'accessType' => 'offline' - ) -); - -if (!isset($_GET['code'])) { - // If we don't have an authorization code then get one - $authUrl = $provider->getAuthorizationUrl(); - $_SESSION['oauth2state'] = $provider->getState(); - header('Location: ' . $authUrl); - exit; -// Check given state against previously stored one to mitigate CSRF attack -} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) { - unset($_SESSION['oauth2state']); - exit('Invalid state'); -} else { - // Try to get an access token (using the authorization code grant) - $token = $provider->getAccessToken( - 'authorization_code', - array( - 'code' => $_GET['code'] - ) - ); - - // Use this to get a new access token if the old one expires - echo 'Refresh Token: ' . $token->getRefreshToken(); -}
@@ -1,26 +0,0 @@
-<?php -/** - * Armenian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Hrayr Grigoryan <hrayr@bits.am> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP -Õ« Õ½ÕÕ¡Õ¬: Õ¹Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Ö Õ½Õ¿Õ¸Ö‚Õ£Õ¥Õ¬ Õ«Õ½Õ¯Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP -Õ« Õ½ÕÕ¡Õ¬: Õ¹Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Ö Õ¯Õ¡Õº Õ°Õ¡Õ½Õ¿Õ¡Õ¿Õ¥Õ¬ SMTP Õ½Õ¥Ö€Õ¾Õ¥Ö€Õ« Õ°Õ¥Õ¿.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP -Õ« Õ½ÕÕ¡Õ¬: Õ¿Õ¾ÕµÕ¡Õ¬Õ¶Õ¥Ö€Õ¨ Õ¨Õ¶Õ¤Õ¸Ö‚Õ¶Õ¾Õ¡Õ® Õ¹Õ¥Õ¶.'; -$PHPMAILER_LANG['empty_message'] = 'Õ€Õ¡Õ²Õ¸Ö€Õ¤Õ¡Õ£Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨ Õ¤Õ¡Õ¿Õ¡Ö€Õ¯ Õ§'; -$PHPMAILER_LANG['encoding'] = 'Ô¿Õ¸Õ¤Õ¡Õ¾Õ¸Ö€Õ´Õ¡Õ¶ Õ¡Õ¶Õ°Õ¡ÕµÕ¿ Õ¿Õ¥Õ½Õ¡Õ¯: '; -$PHPMAILER_LANG['execute'] = 'Õ‰Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Ö Õ«Ö€Õ¡Õ¯Õ¡Õ¶Õ¡ÖÕ¶Õ¥Õ¬ Õ°Ö€Õ¡Õ´Õ¡Õ¶Õ¨: '; -$PHPMAILER_LANG['file_access'] = 'Õ–Õ¡ÕµÕ¬Õ¨ Õ°Õ¡Õ½Õ¡Õ¶Õ¥Õ¬Õ« Õ¹Õ§: '; -$PHPMAILER_LANG['file_open'] = 'Õ–Õ¡ÕµÕ¬Õ« Õ½ÕÕ¡Õ¬: Ö†Õ¡ÕµÕ¬Õ¨ Õ¹Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Ö Õ¢Õ¡ÖÕ¥Õ¬: '; -$PHPMAILER_LANG['from_failed'] = 'ÕˆÖ‚Õ²Õ¡Ö€Õ¯Õ¸Õ²Õ« Õ°Õ¥Õ¿Ö‡ÕµÕ¡Õ¬ Õ°Õ¡Õ½ÖÕ¥Õ¶ Õ½ÕÕ¡Õ¬ Õ§: '; -$PHPMAILER_LANG['instantiate'] = 'Õ€Õ¶Õ¡Ö€Õ¡Õ¾Õ¸Ö€ Õ¹Õ§ Õ¯Õ¡Õ¶Õ¹Õ¥Õ¬ mail Ö†Õ¸Ö‚Õ¶Õ¯ÖÕ«Õ¡Õ¶.'; -$PHPMAILER_LANG['invalid_address'] = 'Õ€Õ¡Õ½ÖÕ¥Õ¶ Õ½ÕÕ¡Õ¬ Õ§: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' ÖƒÕ¸Õ½Õ¿Õ¡ÕµÕ«Õ¶ Õ½Õ¥Ö€Õ¾Õ¥Ö€Õ« Õ°Õ¥Õ¿ Õ¹Õ« Õ¡Õ·ÕÕ¡Õ¿Õ¸Ö‚Õ´.'; -$PHPMAILER_LANG['provide_address'] = 'Ô±Õ¶Õ°Ö€Õ¡ÕªÕ¥Õ·Õ¿ Õ§ Õ¿Ö€Õ¡Õ´Õ¡Õ¤Ö€Õ¥Õ¬ Õ£Õ¸Õ¶Õ¥ Õ´Õ¥Õ¯ Õ½Õ¿Õ¡ÖÕ¸Õ²Õ« e-mail Õ°Õ¡Õ½ÖÕ¥.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP -Õ« Õ½ÕÕ¡Õ¬: Õ¹Õ« Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Õ¬ Õ¸Ö‚Õ²Õ¡Ö€Õ¯Õ¥Õ¬ Õ°Õ¥Õ¿Ö‡ÕµÕ¡Õ¬ Õ½Õ¿Õ¡ÖÕ¸Õ²Õ¶Õ¥Ö€Õ« Õ°Õ¡Õ½ÖÕ¥Õ¶Õ¥Ö€Õ«Õ¶: '; -$PHPMAILER_LANG['signing'] = 'ÕÕ¿Õ¸Ö€Õ¡Õ£Ö€Õ´Õ¡Õ¶ Õ½ÕÕ¡Õ¬: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP -Õ« connect() Ö†Õ¸Ö‚Õ¶Õ¯ÖÕ«Õ¡Õ¶ Õ¹Õ« Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Õ¬'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP Õ½Õ¥Ö€Õ¾Õ¥Ö€Õ« Õ½ÕÕ¡Õ¬: '; -$PHPMAILER_LANG['variable_set'] = 'Õ‰Õ« Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¸Ö‚Õ´ Õ½Õ¿Õ¥Õ²Õ®Õ¥Õ¬ Õ¯Õ¡Õ´ Õ¾Õ¥Ö€Õ¡ÖƒÕ¸ÕÕ¥Õ¬ ÖƒÕ¸ÖƒÕ¸ÕÕ¡Õ¯Õ¡Õ¶Õ¨: '; -$PHPMAILER_LANG['extension_missing'] = 'Õ€Õ¡Õ¾Õ¥Õ¬Õ¾Õ¡Õ®Õ¨ Õ¢Õ¡ÖÕ¡Õ¯Õ¡ÕµÕ¸Ö‚Õ´ Õ§: ';
@@ -1,27 +0,0 @@
-<?php -/** - * Arabic PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author bahjat al mostafa <bahjat983@hotmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'خطأ SMTP : لا يمكن تأكيد الهوية.'; -$PHPMAILER_LANG['connect_host'] = 'خطأ SMTP: لا يمكن الاتصال بالخادم SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'خطأ SMTP: لم يتم قبول المعلومات .'; -$PHPMAILER_LANG['empty_message'] = 'نص الرسالة ÙØ§Ø±Øº'; -$PHPMAILER_LANG['encoding'] = 'ترميز غير معروÙ: '; -$PHPMAILER_LANG['execute'] = 'لا يمكن تنÙيذ : '; -$PHPMAILER_LANG['file_access'] = 'لا يمكن الوصول للملÙ: '; -$PHPMAILER_LANG['file_open'] = 'خطأ ÙÙŠ الملÙ: لا يمكن ÙØªØÙ‡: '; -$PHPMAILER_LANG['from_failed'] = 'خطأ على مستوى عنوان المرسل : '; -$PHPMAILER_LANG['instantiate'] = 'لا يمكن توÙير خدمة البريد.'; -$PHPMAILER_LANG['invalid_address'] = 'الإرسال غير ممكن لأن عنوان البريد الإلكتروني غير صالØ: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' برنامج الإرسال غير مدعوم.'; -$PHPMAILER_LANG['provide_address'] = 'يجب توÙير عنوان البريد الإلكتروني لمستلم ÙˆØ§ØØ¯ على الأقل.'; -$PHPMAILER_LANG['recipients_failed'] = 'خطأ SMTP: الأخطاء التالية ' . - 'ÙØ´Ù„ ÙÙŠ الارسال لكل من : '; -$PHPMAILER_LANG['signing'] = 'خطأ ÙÙŠ التوقيع: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() غير ممكن.'; -$PHPMAILER_LANG['smtp_error'] = 'خطأ على مستوى الخادم SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'لا يمكن تعيين أو إعادة تعيين متغير: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Azerbaijani PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author @mirjalal - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP xÉ™tası: GiriÅŸ uÄŸursuz oldu.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP xÉ™tası: SMTP serverinÉ™ qoÅŸulma uÄŸursuz oldu.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP xÉ™tası: VerilÉ™nlÉ™r qÉ™bul edilmÉ™yib.'; -$PHPMAILER_LANG['empty_message'] = 'BoÅŸ mesaj göndÉ™rilÉ™ bilmÉ™z.'; -$PHPMAILER_LANG['encoding'] = 'Qeyri-müəyyÉ™n kodlaÅŸdırma: '; -$PHPMAILER_LANG['execute'] = 'Æmr yerinÉ™ yetirilmÉ™di: '; -$PHPMAILER_LANG['file_access'] = 'Fayla giriÅŸ yoxdur: '; -$PHPMAILER_LANG['file_open'] = 'Fayl xÉ™tası: Fayl açıla bilmÉ™di: '; -$PHPMAILER_LANG['from_failed'] = 'GöstÉ™rilÉ™n poçtlara göndÉ™rmÉ™ uÄŸursuz oldu: '; -$PHPMAILER_LANG['instantiate'] = 'Mail funksiyası iÅŸÉ™ salına bilmÉ™di.'; -$PHPMAILER_LANG['invalid_address'] = 'Düzgün olmayan e-mail adresi: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' - e-mail kitabxanası dÉ™stÉ™klÉ™nmir.'; -$PHPMAILER_LANG['provide_address'] = 'Æn azı bir e-mail adresi daxil edilmÉ™lidir.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP xÉ™tası: AÅŸağıdakı ünvanlar üzrÉ™ alıcılara göndÉ™rmÉ™ uÄŸursuzdur: '; -$PHPMAILER_LANG['signing'] = 'İmzalama xÉ™tası: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP serverinÉ™ qoÅŸulma uÄŸursuz oldu.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP serveri xÉ™tası: '; -$PHPMAILER_LANG['variable_set'] = 'DÉ™yiÅŸÉ™nin quraÅŸdırılması uÄŸursuz oldu: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Belarusian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Aleksander Maksymiuk <info@setpro.pl> - */ - -$PHPMAILER_LANG['authenticate'] = 'Памылка SMTP: памылка ідÑнтыфікацыі.'; -$PHPMAILER_LANG['connect_host'] = 'Памылка SMTP: нельга ÑžÑтанавіць ÑувÑзь з SMTP-Ñерверам.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Памылка SMTP: звеÑткі непрынÑтыÑ.'; -$PHPMAILER_LANG['empty_message'] = 'ПуÑтое паведамленне.'; -$PHPMAILER_LANG['encoding'] = 'ÐевÑÐ´Ð¾Ð¼Ð°Ñ ÐºÐ°Ð´Ñ‹Ñ€Ð¾ÑžÐºÐ° Ñ‚ÑкÑту: '; -$PHPMAILER_LANG['execute'] = 'Ðельга выканаць каманду: '; -$PHPMAILER_LANG['file_access'] = 'ÐÑма доÑтупу да файла: '; -$PHPMAILER_LANG['file_open'] = 'Ðельга адкрыць файл: '; -$PHPMAILER_LANG['from_failed'] = 'ÐÑправільны Ð°Ð´Ñ€Ð°Ñ Ð°Ð´Ð¿Ñ€Ð°ÑžÐ½Ñ–ÐºÐ°: '; -$PHPMAILER_LANG['instantiate'] = 'Ðельга прымÑніць функцыю mail().'; -$PHPMAILER_LANG['invalid_address'] = 'Ðельга даÑлаць паведамленне, нÑправільны email атрымальніка: '; -$PHPMAILER_LANG['provide_address'] = 'Запоўніце, калі лаÑка, правільны email атрымальніка.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' - паштовы Ñервер не падтрымліваецца.'; -$PHPMAILER_LANG['recipients_failed'] = 'Памылка SMTP: нÑÐ¿Ñ€Ð°Ð²Ñ–Ð»ÑŒÐ½Ñ‹Ñ Ð°Ñ‚Ñ€Ñ‹Ð¼Ð°Ð»ÑŒÐ½Ñ–ÐºÑ–: '; -$PHPMAILER_LANG['signing'] = 'Памылка подпіÑу паведамленнÑ: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Памылка ÑувÑзі з SMTP-Ñерверам.'; -$PHPMAILER_LANG['smtp_error'] = 'Памылка SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Ðельга ÑžÑтанавіць або перамÑніць значÑнне пераменнай: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Bulgarian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Mikhail Kyosev <mialygk@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP грешка: Ðе може да Ñе удоÑтовери пред Ñървъра.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP грешка: Ðе може да Ñе Ñвърже Ñ SMTP хоÑта.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP грешка: данните не Ñа приети.'; -$PHPMAILER_LANG['empty_message'] = 'Съдържанието на Ñъобщението е празно'; -$PHPMAILER_LANG['encoding'] = 'ÐеизвеÑтно кодиране: '; -$PHPMAILER_LANG['execute'] = 'Ðе може да Ñе изпълни: '; -$PHPMAILER_LANG['file_access'] = 'ÐÑма доÑтъп до файл: '; -$PHPMAILER_LANG['file_open'] = 'Файлова грешка: Ðе може да Ñе отвори файл: '; -$PHPMAILER_LANG['from_failed'] = 'Следните адреÑи за подател Ñа невалидни: '; -$PHPMAILER_LANG['instantiate'] = 'Ðе може да Ñе инÑтанцира функциÑта mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Ðевалиден адреÑ: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' - пощенÑки Ñървър не Ñе поддържа.'; -$PHPMAILER_LANG['provide_address'] = 'ТрÑбва да предоÑтавите поне един email Ð°Ð´Ñ€ÐµÑ Ð·Ð° получател.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP грешка: Следните адреÑи за Получател Ñа невалидни: '; -$PHPMAILER_LANG['signing'] = 'Грешка при подпиÑване: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP провален connect().'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP Ñървърна грешка: '; -$PHPMAILER_LANG['variable_set'] = 'Ðе може да Ñе уÑтанови или възÑтанови променлива: '; -$PHPMAILER_LANG['extension_missing'] = 'ЛипÑва разширение: ';
@@ -1,28 +0,0 @@
-<?php -/** - * Brazilian Portuguese PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Paulo Henrique Garcia <paulo@controllerweb.com.br> - * @author Lucas Guimarães <lucas@lucasguimaraes.com> - * @author Phelipe Alves <phelipealvesdesouza@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'Erro de SMTP: Não foi possÃvel autenticar.'; -$PHPMAILER_LANG['connect_host'] = 'Erro de SMTP: Não foi possÃvel conectar com o servidor SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Erro de SMTP: Dados rejeitados.'; -$PHPMAILER_LANG['empty_message'] = 'Corpo da mensagem vazio'; -$PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: '; -$PHPMAILER_LANG['execute'] = 'Não foi possÃvel executar: '; -$PHPMAILER_LANG['file_access'] = 'Não foi possÃvel acessar o arquivo: '; -$PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: Não foi possÃvel abrir o arquivo: '; -$PHPMAILER_LANG['from_failed'] = 'Os endereços dos remententes a seguir falharam: '; -$PHPMAILER_LANG['instantiate'] = 'Não foi possÃvel iniciar uma instância da função mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Não enviando, endereço de e-mail inválido: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.'; -$PHPMAILER_LANG['provide_address'] = 'Você deve fornecer pelo menos um endereço de destinatário de e-mail.'; -$PHPMAILER_LANG['recipients_failed'] = 'Erro de SMTP: Os endereços de destinatário a seguir falharam: '; -$PHPMAILER_LANG['signing'] = 'Erro ao assinar: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.'; -$PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Não foi possÃvel definir ou resetar a variável: '; -$PHPMAILER_LANG['extension_missing'] = 'Extensão ausente: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Catalan PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Ivan <web AT microstudi DOT com> - */ - -$PHPMAILER_LANG['authenticate'] = 'Error SMTP: No s’ha pogut autenticar.'; -$PHPMAILER_LANG['connect_host'] = 'Error SMTP: No es pot connectar al servidor SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Dades no acceptades.'; -$PHPMAILER_LANG['empty_message'] = 'El cos del missatge està buit.'; -$PHPMAILER_LANG['encoding'] = 'Codificació desconeguda: '; -$PHPMAILER_LANG['execute'] = 'No es pot executar: '; -$PHPMAILER_LANG['file_access'] = 'No es pot accedir a l’arxiu: '; -$PHPMAILER_LANG['file_open'] = 'Error d’Arxiu: No es pot obrir l’arxiu: '; -$PHPMAILER_LANG['from_failed'] = 'La(s) següent(s) adreces de remitent han fallat: '; -$PHPMAILER_LANG['instantiate'] = 'No s’ha pogut crear una instà ncia de la funció Mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Adreça d’email invalida: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer no està suportat'; -$PHPMAILER_LANG['provide_address'] = 'S’ha de proveir almenys una adreça d’email com a destinatari.'; -$PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Els següents destinataris han fallat: '; -$PHPMAILER_LANG['signing'] = 'Error al signar: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Ha fallat el SMTP Connect().'; -$PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'No s’ha pogut establir o restablir la variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Chinese PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author LiuXin <http://www.80x86.cn/blog/> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:身份验è¯å¤±è´¥ã€‚'; -$PHPMAILER_LANG['connect_host'] = 'SMTP 错误: ä¸èƒ½è¿žæŽ¥SMTP主机。'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误: æ•°æ®ä¸å¯æŽ¥å—。'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = '未知编ç :'; -$PHPMAILER_LANG['execute'] = 'ä¸èƒ½æ‰§è¡Œ: '; -$PHPMAILER_LANG['file_access'] = 'ä¸èƒ½è®¿é—®æ–‡ä»¶ï¼š'; -$PHPMAILER_LANG['file_open'] = '文件错误:ä¸èƒ½æ‰“开文件:'; -$PHPMAILER_LANG['from_failed'] = '下é¢çš„å‘é€åœ°å€é‚®ä»¶å‘é€å¤±è´¥äº†ï¼š '; -$PHPMAILER_LANG['instantiate'] = 'ä¸èƒ½å®žçްmail方法。'; -//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' 您所选择的å‘é€é‚®ä»¶çš„æ–¹æ³•并䏿”¯æŒã€‚'; -$PHPMAILER_LANG['provide_address'] = '您必须æä¾›è‡³å°‘一个 收信人的email地å€ã€‚'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误: 下é¢çš„ æ”¶ä»¶äººå¤±è´¥äº†ï¼š '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,25 +0,0 @@
-<?php -/** - * Czech PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - */ - -$PHPMAILER_LANG['authenticate'] = 'Chyba SMTP: Autentizace selhala.'; -$PHPMAILER_LANG['connect_host'] = 'Chyba SMTP: Nelze navázat spojenà se SMTP serverem.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Chyba SMTP: Data nebyla pÅ™ijata.'; -$PHPMAILER_LANG['empty_message'] = 'Prázdné tÄ›lo zprávy'; -$PHPMAILER_LANG['encoding'] = 'Neznámé kódovánÃ: '; -$PHPMAILER_LANG['execute'] = 'Nelze provést: '; -$PHPMAILER_LANG['file_access'] = 'Nelze zÃskat pÅ™Ãstup k souboru: '; -$PHPMAILER_LANG['file_open'] = 'Chyba souboru: Nelze otevÅ™Ãt soubor pro ÄtenÃ: '; -$PHPMAILER_LANG['from_failed'] = 'NásledujÃcà adresa odesÃlatele je nesprávná: '; -$PHPMAILER_LANG['instantiate'] = 'Nelze vytvoÅ™it instanci emailové funkce.'; -$PHPMAILER_LANG['invalid_address'] = 'Neplatná adresa: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nenà podporován.'; -$PHPMAILER_LANG['provide_address'] = 'MusÃte zadat alespoň jednu emailovou adresu pÅ™Ãjemce.'; -$PHPMAILER_LANG['recipients_failed'] = 'Chyba SMTP: NásledujÃcà adresy pÅ™Ãjemců nejsou správnÄ›: '; -$PHPMAILER_LANG['signing'] = 'Chyba pÅ™ihlaÅ¡ovánÃ: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() selhal.'; -$PHPMAILER_LANG['smtp_error'] = 'Chyba SMTP serveru: '; -$PHPMAILER_LANG['variable_set'] = 'Nelze nastavit nebo zmÄ›nit promÄ›nnou: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,25 +0,0 @@
-<?php -/** - * German PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Fehler: Authentifizierung fehlgeschlagen.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Fehler: Konnte keine Verbindung zum SMTP-Host herstellen.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Fehler: Daten werden nicht akzeptiert.'; -$PHPMAILER_LANG['empty_message'] = 'E-Mail Inhalt ist leer.'; -$PHPMAILER_LANG['encoding'] = 'Unbekanntes Encoding-Format: '; -$PHPMAILER_LANG['execute'] = 'Konnte folgenden Befehl nicht ausführen: '; -$PHPMAILER_LANG['file_access'] = 'Zugriff auf folgende Datei fehlgeschlagen: '; -$PHPMAILER_LANG['file_open'] = 'Datei Fehler: konnte folgende Datei nicht öffnen: '; -$PHPMAILER_LANG['from_failed'] = 'Die folgende Absenderadresse ist nicht korrekt: '; -$PHPMAILER_LANG['instantiate'] = 'Mail Funktion konnte nicht initialisiert werden.'; -$PHPMAILER_LANG['invalid_address'] = 'E-Mail wird nicht gesendet, die Adresse ist ungültig: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wird nicht unterstützt.'; -$PHPMAILER_LANG['provide_address'] = 'Bitte geben Sie mindestens eine Empfänger E-Mailadresse an.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Fehler: Die folgenden Empfänger sind nicht korrekt: '; -$PHPMAILER_LANG['signing'] = 'Fehler beim Signieren: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Verbindung zu SMTP Server fehlgeschlagen.'; -$PHPMAILER_LANG['smtp_error'] = 'Fehler vom SMTP Server: '; -$PHPMAILER_LANG['variable_set'] = 'Kann Variable nicht setzen oder zurücksetzen: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Danish PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Mikael Stokkebro <info@stokkebro.dk> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP fejl: Kunne ikke logge på.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP fejl: Kunne ikke tilslutte SMTP serveren.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fejl: Data kunne ikke accepteres.'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = 'Ukendt encode-format: '; -$PHPMAILER_LANG['execute'] = 'Kunne ikke køre: '; -$PHPMAILER_LANG['file_access'] = 'Ingen adgang til fil: '; -$PHPMAILER_LANG['file_open'] = 'Fil fejl: Kunne ikke åbne filen: '; -$PHPMAILER_LANG['from_failed'] = 'Følgende afsenderadresse er forkert: '; -$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere email funktionen.'; -//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer understøttes ikke.'; -$PHPMAILER_LANG['provide_address'] = 'Du skal indtaste mindst en modtagers emailadresse.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP fejl: Følgende modtagere er forkerte: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,25 +0,0 @@
-<?php -/** - * Greek PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Σφάλμα: Αδυναμία πιστοποίησης (authentication).'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Σφάλμα: Αδυναμία σÏνδεσης στον SMTP-Host.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Σφάλμα: Τα δεδομÎνα δεν Îγιναν αποδεκτά.'; -$PHPMAILER_LANG['empty_message'] = 'Το E-Mail δεν Îχει πεÏιεχόμενο .'; -$PHPMAILER_LANG['encoding'] = 'Αγνωστο Encoding-Format: '; -$PHPMAILER_LANG['execute'] = 'Αδυναμία εκτÎλεσης ακόλουθης εντολής: '; -$PHPMAILER_LANG['file_access'] = 'Αδυναμία Ï€ÏοσπÎλασης του αÏχείου: '; -$PHPMAILER_LANG['file_open'] = 'Σφάλμα ΑÏχείου: Δεν είναι δυνατό το άνοιγμα του ακόλουθου αÏχείου: '; -$PHPMAILER_LANG['from_failed'] = 'Η παÏακάτω διεÏθυνση αποστολÎα δεν είναι σωστή: '; -$PHPMAILER_LANG['instantiate'] = 'Αδυναμία εκκίνησης Mail function.'; -$PHPMAILER_LANG['invalid_address'] = 'Το μήνυμα δεν εστάλη, η διεÏθυνση δεν είναι ÎγκυÏη: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer δεν υποστηÏίζεται.'; -$PHPMAILER_LANG['provide_address'] = 'ΠαÏακαλοÏμε δώστε τουλάχιστον μια e-mail διεÏθυνση παÏαλήπτη.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Σφάλμα: Οι παÏακάτω διευθÏνσεις παÏαλήπτη δεν είναι ÎγκυÏες: '; -$PHPMAILER_LANG['signing'] = 'Σφάλμα υπογÏαφής: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Αποτυχία σÏνδεσης στον SMTP Server.'; -$PHPMAILER_LANG['smtp_error'] = 'Σφάλμα από τον SMTP Server: '; -$PHPMAILER_LANG['variable_set'] = 'Αδυναμία οÏÎ¹ÏƒÎ¼Î¿Ï Î® αÏχικοποίησης μεταβλητής: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,25 +0,0 @@
-<?php -/** - * Esperanto PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - */ - -$PHPMAILER_LANG['authenticate'] = 'Eraro de servilo SMTP : aÅtentigo malsukcesis.'; -$PHPMAILER_LANG['connect_host'] = 'Eraro de servilo SMTP : konektado al servilo malsukcesis.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Eraro de servilo SMTP : neÄustaj datumoj.'; -$PHPMAILER_LANG['empty_message'] = 'Teksto de mesaÄo mankas.'; -$PHPMAILER_LANG['encoding'] = 'Nekonata kodoprezento: '; -$PHPMAILER_LANG['execute'] = 'Lanĉi rulumadon ne eblis: '; -$PHPMAILER_LANG['file_access'] = 'Aliro al dosiero ne sukcesis: '; -$PHPMAILER_LANG['file_open'] = 'Eraro de dosiero: malfermo neeblas: '; -$PHPMAILER_LANG['from_failed'] = 'Jena adreso de sendinto malsukcesis: '; -$PHPMAILER_LANG['instantiate'] = 'Genero de retmesaÄa funkcio neeblis.'; -$PHPMAILER_LANG['invalid_address'] = 'Retadreso ne validas: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mesaÄilo ne subtenata.'; -$PHPMAILER_LANG['provide_address'] = 'Vi devas tajpi almenaÅ unu recevontan retadreson.'; -$PHPMAILER_LANG['recipients_failed'] = 'Eraro de servilo SMTP : la jenaj poÅtrecivuloj kaÅzis eraron: '; -$PHPMAILER_LANG['signing'] = 'Eraro de subskribo: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP konektado malsukcesis.'; -$PHPMAILER_LANG['smtp_error'] = 'Eraro de servilo SMTP : '; -$PHPMAILER_LANG['variable_set'] = 'Variablo ne pravalorizeblas aÅ ne repravalorizeblas: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Spanish PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Matt Sturdy <matt.sturdy@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'Error SMTP: Imposible autentificar.'; -$PHPMAILER_LANG['connect_host'] = 'Error SMTP: Imposible conectar al servidor SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Datos no aceptados.'; -$PHPMAILER_LANG['empty_message'] = 'El cuerpo del mensaje está vacÃo'; -$PHPMAILER_LANG['encoding'] = 'Codificación desconocida: '; -$PHPMAILER_LANG['execute'] = 'Imposible ejecutar: '; -$PHPMAILER_LANG['file_access'] = 'Imposible acceder al archivo: '; -$PHPMAILER_LANG['file_open'] = 'Error de Archivo: Imposible abrir el archivo: '; -$PHPMAILER_LANG['from_failed'] = 'La(s) siguiente(s) direcciones de remitente fallaron: '; -$PHPMAILER_LANG['instantiate'] = 'Imposible crear una instancia de la función Mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Imposible enviar: dirección de email inválido: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer no está soportado.'; -$PHPMAILER_LANG['provide_address'] = 'Debe proporcionar al menos una dirección de email de destino.'; -$PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Los siguientes destinos fallaron: '; -$PHPMAILER_LANG['signing'] = 'Error al firmar: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falló.'; -$PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'No se pudo configurar la variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,27 +0,0 @@
-<?php -/** - * Estonian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Indrek Päri - * @author Elan Ruusamäe <glen@delfi.ee> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Viga: Autoriseerimise viga.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Viga: Ei õnnestunud luua ühendust SMTP serveriga.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Viga: Vigased andmed.'; -$PHPMAILER_LANG['empty_message'] = 'Tühi kirja sisu'; -$PHPMAILER_LANG["encoding"] = 'Tundmatu kodeering: '; -$PHPMAILER_LANG['execute'] = 'Tegevus ebaõnnestus: '; -$PHPMAILER_LANG['file_access'] = 'Pole piisavalt õiguseid järgneva faili avamiseks: '; -$PHPMAILER_LANG['file_open'] = 'Faili Viga: Faili avamine ebaõnnestus: '; -$PHPMAILER_LANG['from_failed'] = 'Järgnev saatja e-posti aadress on vigane: '; -$PHPMAILER_LANG['instantiate'] = 'mail funktiooni käivitamine ebaõnnestus.'; -$PHPMAILER_LANG['invalid_address'] = 'Saatmine peatatud, e-posti address vigane: '; -$PHPMAILER_LANG['provide_address'] = 'Te peate määrama vähemalt ühe saaja e-posti aadressi.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' maileri tugi puudub.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Viga: Järgnevate saajate e-posti aadressid on vigased: '; -$PHPMAILER_LANG["signing"] = 'Viga allkirjastamisel: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() ebaõnnestus.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP serveri viga: '; -$PHPMAILER_LANG['variable_set'] = 'Ei õnnestunud määrata või lähtestada muutujat: '; -$PHPMAILER_LANG['extension_missing'] = 'Nõutud laiendus on puudu: ';
@@ -1,27 +0,0 @@
-<?php -/** - * Persian/Farsi PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Ali Jazayeri <jaza.ali@gmail.com> - * @author Mohammad Hossein Mojtahedi <mhm5000@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'خطای SMTP: Ø§ØØ±Ø§Ø² هویت با شکست مواجه شد.'; -$PHPMAILER_LANG['connect_host'] = 'خطای SMTP: اتصال به سرور SMTP برقرار نشد.'; -$PHPMAILER_LANG['data_not_accepted'] = 'خطای SMTP: داده‌ها نا‌درست هستند.'; -$PHPMAILER_LANG['empty_message'] = 'بخش متن پیام خالی است.'; -$PHPMAILER_LANG['encoding'] = 'کد‌گذاری نا‌شناخته: '; -$PHPMAILER_LANG['execute'] = 'امکان اجرا وجود ندارد: '; -$PHPMAILER_LANG['file_access'] = 'امکان دسترسی به ÙØ§ÛŒÙ„ وجود ندارد: '; -$PHPMAILER_LANG['file_open'] = 'خطای File: امکان بازکردن ÙØ§ÛŒÙ„ وجود ندارد: '; -$PHPMAILER_LANG['from_failed'] = 'آدرس ÙØ±Ø³ØªÙ†Ø¯Ù‡ اشتباه است: '; -$PHPMAILER_LANG['instantiate'] = 'امکان معرÙÛŒ تابع ایمیل وجود ندارد.'; -$PHPMAILER_LANG['invalid_address'] = 'آدرس ایمیل معتبر نیست: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer پشتیبانی نمی‌شود.'; -$PHPMAILER_LANG['provide_address'] = 'باید ØØ¯Ø§Ù‚Ù„ یک آدرس گیرنده وارد کنید.'; -$PHPMAILER_LANG['recipients_failed'] = 'خطای SMTP: ارسال به آدرس گیرنده با خطا مواجه شد: '; -$PHPMAILER_LANG['signing'] = 'خطا در امضا: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'خطا در اتصال به SMTP.'; -$PHPMAILER_LANG['smtp_error'] = 'خطا در SMTP Server: '; -$PHPMAILER_LANG['variable_set'] = 'امکان ارسال یا ارسال مجدد متغیر‌ها وجود ندارد: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,27 +0,0 @@
-<?php -/** - * Finnish PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Jyry Kuukanen - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP-virhe: käyttäjätunnistus epäonnistui.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP-virhe: yhteys palvelimeen ei onnistu.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-virhe: data on virheellinen.'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: '; -$PHPMAILER_LANG['execute'] = 'Suoritus epäonnistui: '; -$PHPMAILER_LANG['file_access'] = 'Seuraavaan tiedostoon ei ole oikeuksia: '; -$PHPMAILER_LANG['file_open'] = 'Tiedostovirhe: Ei voida avata tiedostoa: '; -$PHPMAILER_LANG['from_failed'] = 'Seuraava lähettäjän osoite on virheellinen: '; -$PHPMAILER_LANG['instantiate'] = 'mail-funktion luonti epäonnistui.'; -//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; -$PHPMAILER_LANG['mailer_not_supported'] = 'postivälitintyyppiä ei tueta.'; -$PHPMAILER_LANG['provide_address'] = 'Aseta vähintään yksi vastaanottajan sähköpostiosoite.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP-virhe: seuraava vastaanottaja osoite on virheellinen.'; -$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Faroese PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Dávur Sørensen <http://www.profo-webdesign.dk> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP feilur: Kundi ikki góðkenna.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP feilur: Kundi ikki knýta samband við SMTP vert.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP feilur: Data ikki góðkent.'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = 'Ókend encoding: '; -$PHPMAILER_LANG['execute'] = 'Kundi ikki útføra: '; -$PHPMAILER_LANG['file_access'] = 'Kundi ikki tilganga fÃlu: '; -$PHPMAILER_LANG['file_open'] = 'FÃlu feilur: Kundi ikki opna fÃlu: '; -$PHPMAILER_LANG['from_failed'] = 'fylgjandi Frá/From adressa miseydnaðist: '; -$PHPMAILER_LANG['instantiate'] = 'Kuni ikki instantiera mail funktión.'; -//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' er ikki supporterað.'; -$PHPMAILER_LANG['provide_address'] = 'Tú skal uppgeva minst móttakara-emailadressu(r).'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Feilur: Fylgjandi móttakarar miseydnaðust: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,29 +0,0 @@
-<?php -/** - * French PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * Some French punctuation requires a thin non-breaking space (U+202F) character before it, - * for example before a colon or exclamation mark. - * There is one of these characters between these quotes: " " - * @link http://unicode.org/udhr/n/notes_fra.html - */ - -$PHPMAILER_LANG['authenticate'] = 'Erreur SMTP : échec de l\'authentification.'; -$PHPMAILER_LANG['connect_host'] = 'Erreur SMTP : impossible de se connecter au serveur SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Erreur SMTP : données incorrectes.'; -$PHPMAILER_LANG['empty_message'] = 'Corps du message vide.'; -$PHPMAILER_LANG['encoding'] = 'Encodage inconnu : '; -$PHPMAILER_LANG['execute'] = 'Impossible de lancer l\'exécution : '; -$PHPMAILER_LANG['file_access'] = 'Impossible d\'accéder au fichier : '; -$PHPMAILER_LANG['file_open'] = 'Ouverture du fichier impossible : '; -$PHPMAILER_LANG['from_failed'] = 'L\'adresse d\'expéditeur suivante a échoué : '; -$PHPMAILER_LANG['instantiate'] = 'Impossible d\'instancier la fonction mail.'; -$PHPMAILER_LANG['invalid_address'] = 'L\'adresse courriel n\'est pas valide : '; -$PHPMAILER_LANG['mailer_not_supported'] = ' client de messagerie non supporté.'; -$PHPMAILER_LANG['provide_address'] = 'Vous devez fournir au moins une adresse de destinataire.'; -$PHPMAILER_LANG['recipients_failed'] = 'Erreur SMTP : les destinataires suivants sont en erreur : '; -$PHPMAILER_LANG['signing'] = 'Erreur de signature : '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Échec de la connexion SMTP.'; -$PHPMAILER_LANG['smtp_error'] = 'Erreur du serveur SMTP : '; -$PHPMAILER_LANG['variable_set'] = 'Impossible d\'initialiser ou de réinitialiser une variable : '; -$PHPMAILER_LANG['extension_missing'] = 'Extension manquante : ';
@@ -1,26 +0,0 @@
-<?php -/** - * Galician PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author by Donato Rouco <donatorouco@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'Erro SMTP: Non puido ser autentificado.'; -$PHPMAILER_LANG['connect_host'] = 'Erro SMTP: Non puido conectar co servidor SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Erro SMTP: Datos non aceptados.'; -$PHPMAILER_LANG['empty_message'] = 'Corpo da mensaxe vacÃa'; -$PHPMAILER_LANG['encoding'] = 'Codificación descoñecida: '; -$PHPMAILER_LANG['execute'] = 'Non puido ser executado: '; -$PHPMAILER_LANG['file_access'] = 'Nob puido acceder ó arquivo: '; -$PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: No puido abrir o arquivo: '; -$PHPMAILER_LANG['from_failed'] = 'A(s) seguinte(s) dirección(s) de remitente(s) deron erro: '; -$PHPMAILER_LANG['instantiate'] = 'Non puido crear unha instancia da función Mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Non puido envia-lo correo: dirección de email inválida: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer non está soportado.'; -$PHPMAILER_LANG['provide_address'] = 'Debe engadir polo menos unha dirección de email coma destino.'; -$PHPMAILER_LANG['recipients_failed'] = 'Erro SMTP: Os seguintes destinos fallaron: '; -$PHPMAILER_LANG['signing'] = 'Erro ó firmar: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() fallou.'; -$PHPMAILER_LANG['smtp_error'] = 'Erro do servidor SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Non puidemos axustar ou reaxustar a variábel: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Hebrew PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Ronny Sherer <ronny@hoojima.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'שגי×ת SMTP: פעולת ×”×ימות × ×›×©×œ×”.'; -$PHPMAILER_LANG['connect_host'] = 'שגי×ת SMTP: ×œ× ×”×¦×œ×—×ª×™ להתחבר לשרת SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'שגי×ת SMTP: מידע ×œ× ×”×ª×§×‘×œ.'; -$PHPMAILER_LANG['empty_message'] = 'גוף ההודעה ריק'; -$PHPMAILER_LANG['invalid_address'] = 'כתובת שגויה: '; -$PHPMAILER_LANG['encoding'] = 'קידוד ×œ× ×ž×•×›×¨: '; -$PHPMAILER_LANG['execute'] = '×œ× ×”×¦×œ×—×ª×™ להפעיל ×ת: '; -$PHPMAILER_LANG['file_access'] = '×œ× × ×™×ª×Ÿ לגשת לקובץ: '; -$PHPMAILER_LANG['file_open'] = 'שגי×ת קובץ: ×œ× × ×™×ª×Ÿ לגשת לקובץ: '; -$PHPMAILER_LANG['from_failed'] = 'כתובות ×”× ×ž×¢× ×™× ×”×‘×ות × ×›×©×œ×•: '; -$PHPMAILER_LANG['instantiate'] = '×œ× ×”×¦×œ×—×ª×™ להפעיל ×ת ×¤×•× ×§×¦×™×™×ª המייל.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' ××™× ×” × ×ª×ž×›×ª.'; -$PHPMAILER_LANG['provide_address'] = 'חובה לספק לפחות כתובת ×חת של מקבל המייל.'; -$PHPMAILER_LANG['recipients_failed'] = 'שגי×ת SMTP: ×”× ×ž×¢× ×™× ×”×‘××™× × ×›×©×œ×•: '; -$PHPMAILER_LANG['signing'] = 'שגי×ת חתימה: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -$PHPMAILER_LANG['smtp_error'] = 'שגי×ת שרת SMTP: '; -$PHPMAILER_LANG['variable_set'] = '×œ× × ×™×ª×Ÿ לקבוע ×ו ×œ×©× ×•×ª ×ת ×”×ž×©×ª× ×”: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Croatian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Hrvoj3e <hrvoj3e@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Greška: Neuspjela autentikacija.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Greška: Ne mogu se spojiti na SMTP poslužitelj.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Greška: Podatci nisu prihvaćeni.'; -$PHPMAILER_LANG['empty_message'] = 'Sadržaj poruke je prazan.'; -$PHPMAILER_LANG['encoding'] = 'Nepoznati encoding: '; -$PHPMAILER_LANG['execute'] = 'Nije moguće izvršiti naredbu: '; -$PHPMAILER_LANG['file_access'] = 'Nije moguće pristupiti datoteci: '; -$PHPMAILER_LANG['file_open'] = 'Nije moguće otvoriti datoteku: '; -$PHPMAILER_LANG['from_failed'] = 'SMTP Greška: Slanje s navedenih e-mail adresa nije uspjelo: '; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Greška: Slanje na navedenih e-mail adresa nije uspjelo: '; -$PHPMAILER_LANG['instantiate'] = 'Ne mogu pokrenuti mail funkcionalnost.'; -$PHPMAILER_LANG['invalid_address'] = 'E-mail nije poslan. Neispravna e-mail adresa: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nije podržan.'; -$PHPMAILER_LANG['provide_address'] = 'Definirajte barem jednu adresu primatelja.'; -$PHPMAILER_LANG['signing'] = 'Greška prilikom prijave: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Spajanje na SMTP poslužitelj nije uspjelo.'; -$PHPMAILER_LANG['smtp_error'] = 'Greška SMTP poslužitelja: '; -$PHPMAILER_LANG['variable_set'] = 'Ne mogu postaviti varijablu niti ju vratiti nazad: '; -$PHPMAILER_LANG['extension_missing'] = 'Nedostaje proširenje: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Hungarian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author @dominicus-75 - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP hiba: az azonosÃtás sikertelen.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP hiba: nem lehet kapcsolódni az SMTP-szerverhez.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP hiba: adatok visszautasÃtva.'; -$PHPMAILER_LANG['empty_message'] = 'Üres az üzenettörzs.'; -$PHPMAILER_LANG['encoding'] = 'Ismeretlen kódolás: '; -$PHPMAILER_LANG['execute'] = 'Nem lehet végrehajtani: '; -$PHPMAILER_LANG['file_access'] = 'A következÅ‘ fájl nem elérhetÅ‘: '; -$PHPMAILER_LANG['file_open'] = 'Fájl hiba: a következÅ‘ fájlt nem lehet megnyitni: '; -$PHPMAILER_LANG['from_failed'] = 'A feladóként megadott következÅ‘ cÃm hibás: '; -$PHPMAILER_LANG['instantiate'] = 'A PHP mail() függvényt nem sikerült végrehajtani.'; -$PHPMAILER_LANG['invalid_address'] = 'Érvénytelen cÃm: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' a mailer-osztály nem támogatott.'; -$PHPMAILER_LANG['provide_address'] = 'Legalább egy cÃmzettet fel kell tüntetni.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP hiba: a cÃmzettként megadott következÅ‘ cÃmek hibásak: '; -$PHPMAILER_LANG['signing'] = 'Hibás aláÃrás: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Hiba az SMTP-kapcsolatban.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP-szerver hiba: '; -$PHPMAILER_LANG['variable_set'] = 'A következÅ‘ változók beállÃtása nem sikerült: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Indonesian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Cecep Prawiro <cecep.prawiro@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'Kesalahan SMTP: Tidak dapat mengautentikasi.'; -$PHPMAILER_LANG['connect_host'] = 'Kesalahan SMTP: Tidak dapat terhubung ke host SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Kesalahan SMTP: Data tidak diterima peladen.'; -$PHPMAILER_LANG['empty_message'] = 'Isi pesan kosong'; -$PHPMAILER_LANG['encoding'] = 'Pengkodean karakter tidak dikenali: '; -$PHPMAILER_LANG['execute'] = 'Tidak dapat menjalankan proses : '; -$PHPMAILER_LANG['file_access'] = 'Tidak dapat mengakses berkas : '; -$PHPMAILER_LANG['file_open'] = 'Kesalahan File: Berkas tidak bisa dibuka : '; -$PHPMAILER_LANG['from_failed'] = 'Alamat pengirim berikut mengakibatkan error : '; -$PHPMAILER_LANG['instantiate'] = 'Tidak dapat menginisialisasi fungsi email'; -$PHPMAILER_LANG['invalid_address'] = 'Gagal terkirim, alamat email tidak valid : '; -$PHPMAILER_LANG['provide_address'] = 'Harus disediakan minimal satu alamat tujuan'; -$PHPMAILER_LANG['mailer_not_supported'] = 'Mailer tidak didukung'; -$PHPMAILER_LANG['recipients_failed'] = 'Kesalahan SMTP: Alamat tujuan berikut menghasilkan error : '; -$PHPMAILER_LANG['signing'] = 'Kesalahan dalam tanda tangan : '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() gagal.'; -$PHPMAILER_LANG['smtp_error'] = 'Kesalahan peladen SMTP : '; -$PHPMAILER_LANG['variable_set'] = 'Tidak berhasil mengatur atau mengatur ulang variable : '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,27 +0,0 @@
-<?php -/** - * Italian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Ilias Bartolini <brain79@inwind.it> - * @author Stefano Sabatini <sabas88@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Impossibile autenticarsi.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Impossibile connettersi all\'host SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Dati non accettati dal server.'; -$PHPMAILER_LANG['empty_message'] = 'Il corpo del messaggio è vuoto'; -$PHPMAILER_LANG['encoding'] = 'Codifica dei caratteri sconosciuta: '; -$PHPMAILER_LANG['execute'] = 'Impossibile eseguire l\'operazione: '; -$PHPMAILER_LANG['file_access'] = 'Impossibile accedere al file: '; -$PHPMAILER_LANG['file_open'] = 'File Error: Impossibile aprire il file: '; -$PHPMAILER_LANG['from_failed'] = 'I seguenti indirizzi mittenti hanno generato errore: '; -$PHPMAILER_LANG['instantiate'] = 'Impossibile istanziare la funzione mail'; -$PHPMAILER_LANG['invalid_address'] = 'Impossibile inviare, l\'indirizzo email non è valido: '; -$PHPMAILER_LANG['provide_address'] = 'Deve essere fornito almeno un indirizzo ricevente'; -$PHPMAILER_LANG['mailer_not_supported'] = 'Mailer non supportato'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: I seguenti indirizzi destinatari hanno generato un errore: '; -$PHPMAILER_LANG['signing'] = 'Errore nella firma: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() fallita.'; -$PHPMAILER_LANG['smtp_error'] = 'Errore del server SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Impossibile impostare o resettare la variabile: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,27 +0,0 @@
-<?php -/** - * Japanese PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Mitsuhiro Yoshida <http://mitstek.com/> - * @author Yoshi Sakai <http://bluemooninc.jp/> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTPエラー: èªè¨¼ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚'; -$PHPMAILER_LANG['connect_host'] = 'SMTPエラー: SMTPãƒ›ã‚¹ãƒˆã«æŽ¥ç¶šã§ãã¾ã›ã‚“ã§ã—ãŸã€‚'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTPエラー: データãŒå—ã‘付ã‘られã¾ã›ã‚“ã§ã—ãŸã€‚'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = '䏿˜Žãªã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°: '; -$PHPMAILER_LANG['execute'] = '実行ã§ãã¾ã›ã‚“ã§ã—ãŸ: '; -$PHPMAILER_LANG['file_access'] = 'ファイルã«ã‚¢ã‚¯ã‚»ã‚¹ã§ãã¾ã›ã‚“: '; -$PHPMAILER_LANG['file_open'] = 'ファイルエラー: ファイルを開ã‘ã¾ã›ã‚“: '; -$PHPMAILER_LANG['from_failed'] = 'Fromアドレスを登録ã™ã‚‹éš›ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ: '; -$PHPMAILER_LANG['instantiate'] = 'ãƒ¡ãƒ¼ãƒ«é–¢æ•°ãŒæ£å¸¸ã«å‹•作ã—ã¾ã›ã‚“ã§ã—ãŸã€‚'; -//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; -$PHPMAILER_LANG['provide_address'] = 'å°‘ãªãã¨ã‚‚1ã¤ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’ 指定ã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚'; -$PHPMAILER_LANG['mailer_not_supported'] = ' メーラーãŒã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“。'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTPエラー: 次ã®å—信者アドレス㫠間é•ã„ãŒã‚りã¾ã™: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Georgian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP შეცდáƒáƒ›áƒ: áƒáƒ•ტáƒáƒ იზáƒáƒªáƒ˜áƒ შეუძლებელიáƒ.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP შეცდáƒáƒ›áƒ: SMTP სერვერთáƒáƒœ დáƒáƒ™áƒáƒ•შირებრშეუძლებელიáƒ.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP შეცდáƒáƒ›áƒ: მáƒáƒœáƒáƒªáƒ”მები áƒáƒ იქნრმიღებული.'; -$PHPMAILER_LANG['encoding'] = 'კáƒáƒ“ირების უცნáƒáƒ‘ი ტიპი: '; -$PHPMAILER_LANG['execute'] = 'შეუძლებელირშემდეგი ბრძáƒáƒœáƒ”ბის შესრულებáƒ: '; -$PHPMAILER_LANG['file_access'] = 'შეუძლებელირწვდáƒáƒ›áƒ ფáƒáƒ˜áƒšáƒ—áƒáƒœ: '; -$PHPMAILER_LANG['file_open'] = 'ფáƒáƒ˜áƒšáƒ£áƒ ი სისტემის შეცდáƒáƒ›áƒ: áƒáƒ იხსნებრფáƒáƒ˜áƒšáƒ˜: '; -$PHPMAILER_LANG['from_failed'] = 'გáƒáƒ›áƒ’ზáƒáƒ•ნის áƒáƒ áƒáƒ¡áƒ¬áƒáƒ ი მისáƒáƒ›áƒáƒ თი: '; -$PHPMAILER_LANG['instantiate'] = 'mail ფუნქციის გáƒáƒ¨áƒ•ებრვერხერხდებáƒ.'; -$PHPMAILER_LANG['provide_address'] = 'გთხáƒáƒ•თ მიუთითáƒáƒ— ერთი áƒáƒ“რესáƒáƒ¢áƒ˜áƒ¡ e-mail მისáƒáƒ›áƒáƒ თი მáƒáƒ˜áƒœáƒª.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' - სáƒáƒ¤áƒáƒ¡áƒ¢áƒ სერვერის მხáƒáƒ დáƒáƒáƒ”რრáƒáƒ áƒáƒ ის.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP შეცდáƒáƒ›áƒ: შემდეგ მისáƒáƒ›áƒáƒ თებზე გáƒáƒ’ზáƒáƒ•ნრვერმáƒáƒ®áƒ”რხდáƒ: '; -$PHPMAILER_LANG['empty_message'] = 'შეტყáƒáƒ‘ინებრცáƒáƒ იელიáƒ'; -$PHPMAILER_LANG['invalid_address'] = 'áƒáƒ გáƒáƒ˜áƒ’ზáƒáƒ•ნáƒ, e-mail მისáƒáƒ›áƒáƒ თის áƒáƒ áƒáƒ¡áƒ¬áƒáƒ ი ფáƒáƒ მáƒáƒ¢áƒ˜: '; -$PHPMAILER_LANG['signing'] = 'ხელმáƒáƒ¬áƒ”რის შეცდáƒáƒ›áƒ: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'შეცდáƒáƒ›áƒ SMTP სერვერთáƒáƒœ დáƒáƒ™áƒáƒ•შირებისáƒáƒ¡'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP სერვერის შეცდáƒáƒ›áƒ: '; -$PHPMAILER_LANG['variable_set'] = 'შეუძლებელირშემდეგი ცვლáƒáƒ“ის შექმნრáƒáƒœ შეცვლáƒ: '; -$PHPMAILER_LANG['extension_missing'] = 'ბიბლიáƒáƒ—ეკრáƒáƒ áƒáƒ სებáƒáƒ‘ს: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Korean PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author ChalkPE <amato0617@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP 오류: ì¸ì¦í• 수 없습니다.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP 오류: SMTP í˜¸ìŠ¤íŠ¸ì— ì ‘ì†í• 수 없습니다.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 오류: ë°ì´í„°ê°€ 받아들여지지 않았습니다.'; -$PHPMAILER_LANG['empty_message'] = '메세지 ë‚´ìš©ì´ ì—†ìŠµë‹ˆë‹¤'; -$PHPMAILER_LANG['encoding'] = '알 수 없는 ì¸ì½”딩: '; -$PHPMAILER_LANG['execute'] = '실행 불가: '; -$PHPMAILER_LANG['file_access'] = 'íŒŒì¼ ì ‘ê·¼ 불가: '; -$PHPMAILER_LANG['file_open'] = 'íŒŒì¼ ì˜¤ë¥˜: 파ì¼ì„ ì—´ 수 없습니다: '; -$PHPMAILER_LANG['from_failed'] = 'ë‹¤ìŒ From 주소ì—서 오류가 ë°œìƒí–ˆìŠµë‹ˆë‹¤: '; -$PHPMAILER_LANG['instantiate'] = 'mail 함수를 ì¸ìŠ¤í„´ìŠ¤í™”í• ìˆ˜ 없습니다'; -$PHPMAILER_LANG['invalid_address'] = 'ìž˜ëª»ëœ ì£¼ì†Œ: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' ë©”ì¼ëŸ¬ëŠ” ì§€ì›ë˜ì§€ 않습니다.'; -$PHPMAILER_LANG['provide_address'] = 'ì ì–´ë„ í•œ ê°œ ì´ìƒì˜ ìˆ˜ì‹ ìž ë©”ì¼ ì£¼ì†Œë¥¼ ì œê³µí•´ì•¼ 합니다.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP 오류: ë‹¤ìŒ ìˆ˜ì‹ ìžì—서 오류가 ë°œìƒí–ˆìŠµë‹ˆë‹¤: '; -$PHPMAILER_LANG['signing'] = '서명 오류: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP ì—°ê²°ì„ ì‹¤íŒ¨í•˜ì˜€ìŠµë‹ˆë‹¤.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP 서버 오류: '; -$PHPMAILER_LANG['variable_set'] = '변수 ì„¤ì • ë° ì´ˆê¸°í™” 불가: '; -$PHPMAILER_LANG['extension_missing'] = 'í™•ìž¥ìž ì—†ìŒ: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Lithuanian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Dainius Kaupaitis <dk@sum.lt> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP klaida: autentifikacija nepavyko.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP klaida: nepavyksta prisijungti prie SMTP stoties.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP klaida: duomenys nepriimti.'; -$PHPMAILER_LANG['empty_message'] = 'LaiÅ¡ko turinys tuÅ¡Äias'; -$PHPMAILER_LANG['encoding'] = 'Neatpažinta koduotÄ—: '; -$PHPMAILER_LANG['execute'] = 'Nepavyko įvykdyti komandos: '; -$PHPMAILER_LANG['file_access'] = 'Byla nepasiekiama: '; -$PHPMAILER_LANG['file_open'] = 'Bylos klaida: Nepavyksta atidaryti: '; -$PHPMAILER_LANG['from_failed'] = 'Neteisingas siuntÄ—jo adresas: '; -$PHPMAILER_LANG['instantiate'] = 'Nepavyko paleisti mail funkcijos.'; -$PHPMAILER_LANG['invalid_address'] = 'Neteisingas adresas: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' paÅ¡to stotis nepalaikoma.'; -$PHPMAILER_LANG['provide_address'] = 'Nurodykite bent vienÄ… gavÄ—jo adresÄ….'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP klaida: nepavyko iÅ¡siųsti Å¡iems gavÄ—jams: '; -$PHPMAILER_LANG['signing'] = 'Prisijungimo klaida: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP susijungimo klaida'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP stoties klaida: '; -$PHPMAILER_LANG['variable_set'] = 'Nepavyko priskirti reikÅ¡mÄ—s kintamajam: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Latvian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Eduards M. <e@npd.lv> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP kļūda: AutorizÄcija neizdevÄs.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Kļūda: Nevar izveidot savienojumu ar SMTP serveri.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Kļūda: Nepieņem informÄciju.'; -$PHPMAILER_LANG['empty_message'] = 'Ziņojuma teksts ir tukÅ¡s'; -$PHPMAILER_LANG['encoding'] = 'NeatpazÄ«ts kodÄ“jums: '; -$PHPMAILER_LANG['execute'] = 'NeizdevÄs izpildÄ«t komandu: '; -$PHPMAILER_LANG['file_access'] = 'Fails nav pieejams: '; -$PHPMAILER_LANG['file_open'] = 'Faila kļūda: Nevar atvÄ“rt failu: '; -$PHPMAILER_LANG['from_failed'] = 'Nepareiza sÅ«tÄ«tÄja adrese: '; -$PHPMAILER_LANG['instantiate'] = 'Nevar palaist sÅ«tīšanas funkciju.'; -$PHPMAILER_LANG['invalid_address'] = 'Nepareiza adrese: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' sÅ«tÄ«tÄjs netiek atbalstÄ«ts.'; -$PHPMAILER_LANG['provide_address'] = 'LÅ«dzu, norÄdiet vismaz vienu adresÄtu.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP kļūda: neizdevÄs nosÅ«tÄ«t Å¡Ädiem saņēmÄ“jiem: '; -$PHPMAILER_LANG['signing'] = 'AutorizÄcijas kļūda: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP savienojuma kļūda'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP servera kļūda: '; -$PHPMAILER_LANG['variable_set'] = 'Nevar piešķirt mainÄ«gÄ vÄ“rtÄ«bu: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Malaysian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Nawawi Jamili <nawawi@rutweb.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'Ralat SMTP: Tidak dapat pengesahan.'; -$PHPMAILER_LANG['connect_host'] = 'Ralat SMTP: Tidak dapat menghubungi hos pelayan SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Ralat SMTP: Data tidak diterima oleh pelayan.'; -$PHPMAILER_LANG['empty_message'] = 'Tiada isi untuk mesej'; -$PHPMAILER_LANG['encoding'] = 'Pengekodan tidak diketahui: '; -$PHPMAILER_LANG['execute'] = 'Tidak dapat melaksanakan: '; -$PHPMAILER_LANG['file_access'] = 'Tidak dapat mengakses fail: '; -$PHPMAILER_LANG['file_open'] = 'Ralat Fail: Tidak dapat membuka fail: '; -$PHPMAILER_LANG['from_failed'] = 'Berikut merupakan ralat dari alamat e-mel: '; -$PHPMAILER_LANG['instantiate'] = 'Tidak dapat memberi contoh fungsi e-mel.'; -$PHPMAILER_LANG['invalid_address'] = 'Alamat emel tidak sah: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' jenis penghantar emel tidak disokong.'; -$PHPMAILER_LANG['provide_address'] = 'Anda perlu menyediakan sekurang-kurangnya satu alamat e-mel penerima.'; -$PHPMAILER_LANG['recipients_failed'] = 'Ralat SMTP: Penerima e-mel berikut telah gagal: '; -$PHPMAILER_LANG['signing'] = 'Ralat pada tanda tangan: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() telah gagal.'; -$PHPMAILER_LANG['smtp_error'] = 'Ralat pada pelayan SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Tidak boleh menetapkan atau menetapkan semula pembolehubah: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Dutch PHPMailer language file: refer to class.phpmailer.php for definitive list. - * @package PHPMailer - * @author Tuxion <team@tuxion.nl> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP-fout: authenticatie mislukt.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP-fout: kon niet verbinden met SMTP-host.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-fout: data niet geaccepteerd.'; -$PHPMAILER_LANG['empty_message'] = 'Berichttekst is leeg'; -$PHPMAILER_LANG['encoding'] = 'Onbekende codering: '; -$PHPMAILER_LANG['execute'] = 'Kon niet uitvoeren: '; -$PHPMAILER_LANG['file_access'] = 'Kreeg geen toegang tot bestand: '; -$PHPMAILER_LANG['file_open'] = 'Bestandsfout: kon bestand niet openen: '; -$PHPMAILER_LANG['from_failed'] = 'Het volgende afzendersadres is mislukt: '; -$PHPMAILER_LANG['instantiate'] = 'Kon mailfunctie niet initialiseren.'; -$PHPMAILER_LANG['invalid_address'] = 'Ongeldig adres: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wordt niet ondersteund.'; -$PHPMAILER_LANG['provide_address'] = 'Er moet minstens één ontvanger worden opgegeven.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP-fout: de volgende ontvangers zijn mislukt: '; -$PHPMAILER_LANG['signing'] = 'Signeerfout: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Verbinding mislukt.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfout: '; -$PHPMAILER_LANG['variable_set'] = 'Kan de volgende variabele niet instellen of resetten: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,25 +0,0 @@
-<?php -/** - * Norwegian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Feil: Kunne ikke autentisere.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Feil: Kunne ikke koble til SMTP tjener.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Feil: Data ble ikke akseptert.'; -$PHPMAILER_LANG['empty_message'] = 'Meldingsinnholdet er tomt'; -$PHPMAILER_LANG['encoding'] = 'Ukjent tegnkoding: '; -$PHPMAILER_LANG['execute'] = 'Kunne ikke utføre: '; -$PHPMAILER_LANG['file_access'] = 'Får ikke tilgang til filen: '; -$PHPMAILER_LANG['file_open'] = 'Fil feil: Kunne ikke åpne filen: '; -$PHPMAILER_LANG['from_failed'] = 'Følgende avsenderadresse feilet: '; -$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere mailfunksjonen.'; -$PHPMAILER_LANG['invalid_address'] = 'Meldingen ble ikke sendt, følgende adresse er ugyldig: '; -$PHPMAILER_LANG['provide_address'] = 'Du må angi minst en mottakeradresse.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer er ikke supportert.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Feil: Følgende mottagere feilet: '; -$PHPMAILER_LANG['signing'] = 'Signeringsfeil: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() feilet.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfeil: '; -$PHPMAILER_LANG['variable_set'] = 'Kan ikke sette eller resette variabelen: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Polish PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - */ - -$PHPMAILER_LANG['authenticate'] = 'Błąd SMTP: Nie można przeprowadzić uwierzytelnienia.'; -$PHPMAILER_LANG['connect_host'] = 'Błąd SMTP: Nie można połączyć się z wybranym hostem.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Błąd SMTP: Dane nie zostały przyjęte.'; -$PHPMAILER_LANG['empty_message'] = 'Wiadomość jest pusta.'; -$PHPMAILER_LANG['encoding'] = 'Nieznany sposób kodowania znaków: '; -$PHPMAILER_LANG['execute'] = 'Nie można uruchomić: '; -$PHPMAILER_LANG['file_access'] = 'Brak dostępu do pliku: '; -$PHPMAILER_LANG['file_open'] = 'Nie można otworzyć pliku: '; -$PHPMAILER_LANG['from_failed'] = 'Następujący adres Nadawcy jest nieprawidłowy: '; -$PHPMAILER_LANG['instantiate'] = 'Nie można wywołać funkcji mail(). Sprawdź konfigurację serwera.'; -$PHPMAILER_LANG['invalid_address'] = 'Nie można wysłać wiadomości, '. - 'następujący adres Odbiorcy jest nieprawidłowy: '; -$PHPMAILER_LANG['provide_address'] = 'Należy podać prawidłowy adres email Odbiorcy.'; -$PHPMAILER_LANG['mailer_not_supported'] = 'Wybrana metoda wysyłki wiadomości nie jest obsługiwana.'; -$PHPMAILER_LANG['recipients_failed'] = 'Błąd SMTP: Następujący odbiorcy są nieprawidłowi: '; -$PHPMAILER_LANG['signing'] = 'Błąd podpisywania wiadomości: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() zakończone niepowodzeniem.'; -$PHPMAILER_LANG['smtp_error'] = 'Błąd SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Nie można ustawić lub zmodyfikować zmiennej: '; -$PHPMAILER_LANG['extension_missing'] = 'Brakujące rozszerzenie: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Portuguese (European) PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Jonadabe <jonadabe@hotmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'Erro do SMTP: Não foi possÃvel realizar a autenticação.'; -$PHPMAILER_LANG['connect_host'] = 'Erro do SMTP: Não foi possÃvel realizar ligação com o servidor SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Erro do SMTP: Os dados foram rejeitados.'; -$PHPMAILER_LANG['empty_message'] = 'A mensagem no e-mail está vazia.'; -$PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: '; -$PHPMAILER_LANG['execute'] = 'Não foi possÃvel executar: '; -$PHPMAILER_LANG['file_access'] = 'Não foi possÃvel aceder o ficheiro: '; -$PHPMAILER_LANG['file_open'] = 'Abertura do ficheiro: Não foi possÃvel abrir o ficheiro: '; -$PHPMAILER_LANG['from_failed'] = 'Ocorreram falhas nos endereços dos seguintes remententes: '; -$PHPMAILER_LANG['instantiate'] = 'Não foi possÃvel iniciar uma instância da função mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Não foi enviado nenhum e-mail para o endereço de e-mail inválido: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.'; -$PHPMAILER_LANG['provide_address'] = 'Tem de fornecer pelo menos um endereço como destinatário do e-mail.'; -$PHPMAILER_LANG['recipients_failed'] = 'Erro do SMTP: O endereço do seguinte destinatário falhou: '; -$PHPMAILER_LANG['signing'] = 'Erro ao assinar: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.'; -$PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Não foi possÃvel definir ou redefinir a variável: '; -$PHPMAILER_LANG['extension_missing'] = 'Extensão em falta: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Romanian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Catalin Constantin <catalin@dazoot.ro> - */ - -$PHPMAILER_LANG['authenticate'] = 'Eroare SMTP: Nu a functionat autentificarea.'; -$PHPMAILER_LANG['connect_host'] = 'Eroare SMTP: Nu m-am putut conecta la adresa SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Eroare SMTP: Continutul mailului nu a fost acceptat.'; -$PHPMAILER_LANG['empty_message'] = 'Mesajul este gol.'; -$PHPMAILER_LANG['encoding'] = 'Encodare necunoscuta: '; -$PHPMAILER_LANG['execute'] = 'Nu pot executa: '; -$PHPMAILER_LANG['file_access'] = 'Nu pot accesa fisierul: '; -$PHPMAILER_LANG['file_open'] = 'Eroare de fisier: Nu pot deschide fisierul: '; -$PHPMAILER_LANG['from_failed'] = 'Urmatoarele adrese From au dat eroare: '; -$PHPMAILER_LANG['instantiate'] = 'Nu am putut instantia functia mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Adresa de email nu este valida: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nu este suportat.'; -$PHPMAILER_LANG['provide_address'] = 'Trebuie sa adaugati cel putin un recipient (adresa de mail).'; -$PHPMAILER_LANG['recipients_failed'] = 'Eroare SMTP: Urmatoarele adrese de mail au dat eroare: '; -$PHPMAILER_LANG['signing'] = 'A aparut o problema la semnarea emailului. '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Conectarea la serverul SMTP a esuat.'; -$PHPMAILER_LANG['smtp_error'] = 'A aparut o eroare la serverul SMTP. '; -$PHPMAILER_LANG['variable_set'] = 'Nu se poate seta/reseta variabila. '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,27 +0,0 @@
-<?php -/** - * Russian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Alexey Chumakov <alex@chumakov.ru> - * @author Foster Snowhill <i18n@forstwoof.ru> - */ - -$PHPMAILER_LANG['authenticate'] = 'Ошибка SMTP: ошибка авторизации.'; -$PHPMAILER_LANG['connect_host'] = 'Ошибка SMTP: не удаетÑÑ Ð¿Ð¾Ð´ÐºÐ»ÑŽÑ‡Ð¸Ñ‚ÑŒÑÑ Ðº Ñерверу SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Ошибка SMTP: данные не принÑты.'; -$PHPMAILER_LANG['encoding'] = 'ÐеизвеÑтный вид кодировки: '; -$PHPMAILER_LANG['execute'] = 'Ðевозможно выполнить команду: '; -$PHPMAILER_LANG['file_access'] = 'Ðет доÑтупа к файлу: '; -$PHPMAILER_LANG['file_open'] = 'Ð¤Ð°Ð¹Ð»Ð¾Ð²Ð°Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ°: не удаетÑÑ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚ÑŒ файл: '; -$PHPMAILER_LANG['from_failed'] = 'Ðеверный Ð°Ð´Ñ€ÐµÑ Ð¾Ñ‚Ð¿Ñ€Ð°Ð²Ð¸Ñ‚ÐµÐ»Ñ: '; -$PHPMAILER_LANG['instantiate'] = 'Ðевозможно запуÑтить функцию mail.'; -$PHPMAILER_LANG['provide_address'] = 'ПожалуйÑта, введите Ñ…Ð¾Ñ‚Ñ Ð±Ñ‹ один Ð°Ð´Ñ€ÐµÑ e-mail получателÑ.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' — почтовый Ñервер не поддерживаетÑÑ.'; -$PHPMAILER_LANG['recipients_failed'] = 'Ошибка SMTP: отправка по Ñледующим адреÑам получателей не удалаÑÑŒ: '; -$PHPMAILER_LANG['empty_message'] = 'ПуÑтое Ñообщение'; -$PHPMAILER_LANG['invalid_address'] = 'Ðе отоÑлано, неправильный формат email адреÑа: '; -$PHPMAILER_LANG['signing'] = 'Ошибка подпиÑи: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Ошибка ÑÐ¾ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ Ñ SMTP-Ñервером'; -$PHPMAILER_LANG['smtp_error'] = 'Ошибка SMTP-Ñервера: '; -$PHPMAILER_LANG['variable_set'] = 'Ðевозможно уÑтановить или переуÑтановить переменную: '; -$PHPMAILER_LANG['extension_missing'] = 'РаÑширение отÑутÑтвует: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Swedish PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Johan Linnér <johan@linner.biz> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP fel: Kunde inte autentisera.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP fel: Kunde inte ansluta till SMTP-server.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fel: Data accepterades inte.'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = 'Okänt encode-format: '; -$PHPMAILER_LANG['execute'] = 'Kunde inte köra: '; -$PHPMAILER_LANG['file_access'] = 'Ingen åtkomst till fil: '; -$PHPMAILER_LANG['file_open'] = 'Fil fel: Kunde inte öppna fil: '; -$PHPMAILER_LANG['from_failed'] = 'Följande avsändaradress är felaktig: '; -$PHPMAILER_LANG['instantiate'] = 'Kunde inte initiera e-postfunktion.'; -//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; -$PHPMAILER_LANG['provide_address'] = 'Du måste ange minst en mottagares e-postadress.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer stöds inte.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP fel: Följande mottagare är felaktig: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Slovak PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Michal Tinka <michaltinka@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Chyba autentifikácie.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Nebolo možné nadviazaÅ¥ spojenie so SMTP serverom.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Dáta neboli prijaté'; -$PHPMAILER_LANG['empty_message'] = 'Prázdne telo správy.'; -$PHPMAILER_LANG['encoding'] = 'Neznáme kódovanie: '; -$PHPMAILER_LANG['execute'] = 'Nedá sa vykonaÅ¥: '; -$PHPMAILER_LANG['file_access'] = 'Súbor nebol nájdený: '; -$PHPMAILER_LANG['file_open'] = 'File Error: Súbor sa otvoriÅ¥ pre ÄÃtanie: '; -$PHPMAILER_LANG['from_failed'] = 'Následujúca adresa From je nesprávna: '; -$PHPMAILER_LANG['instantiate'] = 'Nedá sa vytvoriÅ¥ inÅ¡tancia emailovej funkcie.'; -$PHPMAILER_LANG['invalid_address'] = 'Neodoslané, emailová adresa je nesprávna: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' emailový klient nieje podporovaný.'; -$PHPMAILER_LANG['provide_address'] = 'MusÃte zadaÅ¥ aspoň jednu emailovú adresu prÃjemcu.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Adresy prÃjemcov niesu správne '; -$PHPMAILER_LANG['signing'] = 'Chyba prihlasovania: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() zlyhalo.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP chyba serveru: '; -$PHPMAILER_LANG['variable_set'] = 'Nemožno nastaviÅ¥ alebo resetovaÅ¥ premennú: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Slovene PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Klemen TuÅ¡ar <techouse@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP napaka: Avtentikacija ni uspela.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP napaka: Ne morem vzpostaviti povezave s SMTP gostiteljem.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP napaka: Strežnik zavraÄa podatke.'; -$PHPMAILER_LANG['empty_message'] = 'E-poÅ¡tno sporoÄilo nima vsebine.'; -$PHPMAILER_LANG['encoding'] = 'Nepoznan tip kodiranja: '; -$PHPMAILER_LANG['execute'] = 'Operacija ni uspela: '; -$PHPMAILER_LANG['file_access'] = 'Nimam dostopa do datoteke: '; -$PHPMAILER_LANG['file_open'] = 'Ne morem odpreti datoteke: '; -$PHPMAILER_LANG['from_failed'] = 'Neveljaven e-naslov poÅ¡iljatelja: '; -$PHPMAILER_LANG['instantiate'] = 'Ne morem inicializirati mail funkcije.'; -$PHPMAILER_LANG['invalid_address'] = 'E-poÅ¡tno sporoÄilo ni bilo poslano. E-naslov je neveljaven: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer ni podprt.'; -$PHPMAILER_LANG['provide_address'] = 'Prosim vnesite vsaj enega naslovnika.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP napaka: SledeÄi naslovniki so neveljavni: '; -$PHPMAILER_LANG['signing'] = 'Napaka pri podpisovanju: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Ne morem vzpostaviti povezave s SMTP strežnikom.'; -$PHPMAILER_LANG['smtp_error'] = 'Napaka SMTP strežnika: '; -$PHPMAILER_LANG['variable_set'] = 'Ne morem nastaviti oz. ponastaviti spremenljivke: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Serbian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author ÐлекÑандар Јевремовић <ajevremovic@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP грешка: аутентификација није уÑпела.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP грешка: није могуће повезивање Ñа SMTP Ñервером.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP грешка: подаци ниÑу прихваћени.'; -$PHPMAILER_LANG['empty_message'] = 'Садржај поруке је празан.'; -$PHPMAILER_LANG['encoding'] = 'Ðепознато кодовање: '; -$PHPMAILER_LANG['execute'] = 'Ðије могуће извршити наредбу: '; -$PHPMAILER_LANG['file_access'] = 'Ðије могуће приÑтупити датотеци: '; -$PHPMAILER_LANG['file_open'] = 'Ðије могуће отворити датотеку: '; -$PHPMAILER_LANG['from_failed'] = 'SMTP грешка: Ñлање Ñа Ñледећих адреÑа није уÑпело: '; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP грешка: Ñлање на Ñледеће адреÑе није уÑпело: '; -$PHPMAILER_LANG['instantiate'] = 'Ðије могуће покренути mail функцију.'; -$PHPMAILER_LANG['invalid_address'] = 'Порука није поÑлата због неиÑправне адреÑе: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' мејлер није подржан.'; -$PHPMAILER_LANG['provide_address'] = 'Потребно је задати најмање једну адреÑу.'; -$PHPMAILER_LANG['signing'] = 'Грешка приликом пријављивања: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Повезивање Ñа SMTP Ñервером није уÑпело.'; -$PHPMAILER_LANG['smtp_error'] = 'Грешка SMTP Ñервера: '; -$PHPMAILER_LANG['variable_set'] = 'Ðије могуће задати променљиву, нити је вратити уназад: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,29 +0,0 @@
-<?php -/** - * Turkish PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Elçin Özel - * @author Can Yılmaz - * @author Mehmet Benlioğlu - * @author @yasinaydin - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Hatası: Oturum açılamadı.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Hatası: SMTP sunucusuna bağlanılamadı.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Hatası: Veri kabul edilmedi.'; -$PHPMAILER_LANG['empty_message'] = 'Mesajın içeriği boş'; -$PHPMAILER_LANG['encoding'] = 'Bilinmeyen karakter kodlama: '; -$PHPMAILER_LANG['execute'] = 'Çalıştırılamadı: '; -$PHPMAILER_LANG['file_access'] = 'Dosyaya erişilemedi: '; -$PHPMAILER_LANG['file_open'] = 'Dosya Hatası: Dosya açılamadı: '; -$PHPMAILER_LANG['from_failed'] = 'Belirtilen adreslere gönderme başarısız: '; -$PHPMAILER_LANG['instantiate'] = 'Örnek e-posta fonksiyonu oluşturulamadı.'; -$PHPMAILER_LANG['invalid_address'] = 'Geçersiz e-posta adresi: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' e-posta kütüphanesi desteklenmiyor.'; -$PHPMAILER_LANG['provide_address'] = 'En az bir alıcı e-posta adresi belirtmelisiniz.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Hatası: Belirtilen alıcılara ulaşılamadı: '; -$PHPMAILER_LANG['signing'] = 'İmzalama hatası: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP connect() fonksiyonu başarısız.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP sunucu hatası: '; -$PHPMAILER_LANG['variable_set'] = 'Değişken ayarlanamadı ya da sıfırlanamadı: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,27 +0,0 @@
-<?php -/** - * Ukrainian PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author Yuriy Rudyy <yrudyy@prs.net.ua> - * @fixed by Boris Yurchenko <boris@yurchenko.pp.ua> - */ - -$PHPMAILER_LANG['authenticate'] = 'Помилка SMTP: помилка авторизації.'; -$PHPMAILER_LANG['connect_host'] = 'Помилка SMTP: не вдаєтьÑÑ Ð¿Ñ–Ð´\'єднатиÑÑ Ð´Ð¾ Ñерверу SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Помилка SMTP: дані не прийнÑті.'; -$PHPMAILER_LANG['encoding'] = 'Ðевідомий тип кодуваннÑ: '; -$PHPMAILER_LANG['execute'] = 'Ðеможливо виконати команду: '; -$PHPMAILER_LANG['file_access'] = 'Ðемає доÑтупу до файлу: '; -$PHPMAILER_LANG['file_open'] = 'Помилка файлової ÑиÑтеми: не вдаєтьÑÑ Ð²Ñ–Ð´ÐºÑ€Ð¸Ñ‚Ð¸ файл: '; -$PHPMAILER_LANG['from_failed'] = 'Ðевірна адреÑа відправника: '; -$PHPMAILER_LANG['instantiate'] = 'Ðеможливо запуÑтити функцію mail.'; -$PHPMAILER_LANG['provide_address'] = 'Будь-лаÑка, введіть хоча б одну адреÑу e-mail отримувача.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' - поштовий Ñервер не підтримуєтьÑÑ.'; -$PHPMAILER_LANG['recipients_failed'] = 'Помилка SMTP: Ð²Ñ–Ð´Ð¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð½Ñ Ð½Ð°Ñтупним отримувачам не вдалоÑÑ: '; -$PHPMAILER_LANG['empty_message'] = 'ПуÑте тіло повідомленнÑ'; -$PHPMAILER_LANG['invalid_address'] = 'Ðе відправлено, невірний формат адреÑи e-mail: '; -$PHPMAILER_LANG['signing'] = 'Помилка підпиÑу: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Помилка з\'Ñ”Ð´Ð½Ð°Ð½Ð½Ñ Ñ–Ð· SMTP-Ñервером'; -$PHPMAILER_LANG['smtp_error'] = 'Помилка SMTP-Ñервера: '; -$PHPMAILER_LANG['variable_set'] = 'Ðеможливо вÑтановити або перевÑтановити змінну: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,26 +0,0 @@
-<?php -/** - * Vietnamese (Tiếng Việt) PHPMailer language file: refer to English translation for definitive list. - * @package PHPMailer - * @author VINADES.,JSC <contact@vinades.vn> - */ - -$PHPMAILER_LANG['authenticate'] = 'Lá»—i SMTP: Không thể xác thá»±c.'; -$PHPMAILER_LANG['connect_host'] = 'Lá»—i SMTP: Không thể kết nối máy chá»§ SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Lá»—i SMTP: Dữ liệu không được chấp nháºn.'; -$PHPMAILER_LANG['empty_message'] = 'Không có ná»™i dung'; -$PHPMAILER_LANG['encoding'] = 'Mã hóa không xác định: '; -$PHPMAILER_LANG['execute'] = 'Không thá»±c hiện được: '; -$PHPMAILER_LANG['file_access'] = 'Không thể truy cáºp tệp tin '; -$PHPMAILER_LANG['file_open'] = 'Lá»—i Táºp tin: Không thể mở tệp tin: '; -$PHPMAILER_LANG['from_failed'] = 'Lá»—i địa chỉ gá»i Ä‘i: '; -$PHPMAILER_LANG['instantiate'] = 'Không dùng được các hà m gá»i thư.'; -$PHPMAILER_LANG['invalid_address'] = 'Äại chỉ emai không đúng: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' trình gá»i thư không được há»— trợ.'; -$PHPMAILER_LANG['provide_address'] = 'Bạn phải cung cấp Ãt nhất má»™t địa chỉ ngưá»i nháºn.'; -$PHPMAILER_LANG['recipients_failed'] = 'Lá»—i SMTP: lá»—i địa chỉ ngưá»i nháºn: '; -$PHPMAILER_LANG['signing'] = 'Lá»—i đăng nháºp: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Lá»—i kết nối vá»›i SMTP'; -$PHPMAILER_LANG['smtp_error'] = 'Lá»—i máy chá»§ smtp '; -$PHPMAILER_LANG['variable_set'] = 'Không thể thiết láºp hoặc thiết láºp lại biến: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,28 +0,0 @@
-<?php -/** - * Traditional Chinese PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author liqwei <liqwei@liqwei.com> - * @author Peter Dave Hello <@PeterDaveHello/> - * @author Jason Chiang <xcojad@gmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP 錯誤:登入失敗。'; -$PHPMAILER_LANG['connect_host'] = 'SMTP 錯誤:無法連線到 SMTP 主機。'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 錯誤:無法接å—的資料。'; -$PHPMAILER_LANG['empty_message'] = '郵件內容為空'; -$PHPMAILER_LANG['encoding'] = '未知編碼: '; -$PHPMAILER_LANG['execute'] = '無法執行:'; -$PHPMAILER_LANG['file_access'] = '無法å˜å–檔案:'; -$PHPMAILER_LANG['file_open'] = '檔案錯誤:無法開啟檔案:'; -$PHPMAILER_LANG['from_failed'] = '發é€åœ°å€éŒ¯èª¤ï¼š'; -$PHPMAILER_LANG['instantiate'] = '未知函數呼å«ã€‚'; -$PHPMAILER_LANG['invalid_address'] = 'å› ç‚ºé›»å郵件地å€ç„¡æ•ˆï¼Œç„¡æ³•傳é€: '; -$PHPMAILER_LANG['mailer_not_supported'] = '䏿”¯æ´çš„發信客戶端。'; -$PHPMAILER_LANG['provide_address'] = 'å¿…é ˆæä¾›è‡³å°‘一個收件人地å€ã€‚'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP 錯誤:以下收件人地å€éŒ¯èª¤ï¼š'; -$PHPMAILER_LANG['signing'] = 'é›»åç°½ç« éŒ¯èª¤: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP 連線失敗'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP 伺æœå™¨éŒ¯èª¤: '; -$PHPMAILER_LANG['variable_set'] = '無法è¨å®šæˆ–é‡è¨è®Šæ•¸: '; -$PHPMAILER_LANG['extension_missing'] = 'éºå¤±æ¨¡çµ„ Extension: ';
@@ -1,27 +0,0 @@
-<?php -/** - * Simplified Chinese PHPMailer language file: refer to English translation for definitive list - * @package PHPMailer - * @author liqwei <liqwei@liqwei.com> - * @author young <masxy@foxmail.com> - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:登录失败。'; -$PHPMAILER_LANG['connect_host'] = 'SMTP é”™è¯¯ï¼šæ— æ³•è¿žæŽ¥åˆ° SMTP 主机。'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误:数æ®ä¸è¢«æŽ¥å—。'; -$PHPMAILER_LANG['empty_message'] = 'é‚®ä»¶æ£æ–‡ä¸ºç©ºã€‚'; -$PHPMAILER_LANG['encoding'] = '未知编ç : '; -$PHPMAILER_LANG['execute'] = 'æ— æ³•æ‰§è¡Œï¼š'; -$PHPMAILER_LANG['file_access'] = 'æ— æ³•è®¿é—®æ–‡ä»¶ï¼š'; -$PHPMAILER_LANG['file_open'] = 'æ–‡ä»¶é”™è¯¯ï¼šæ— æ³•æ‰“å¼€æ–‡ä»¶ï¼š'; -$PHPMAILER_LANG['from_failed'] = 'å‘é€åœ°å€é”™è¯¯ï¼š'; -$PHPMAILER_LANG['instantiate'] = '未知函数调用。'; -$PHPMAILER_LANG['invalid_address'] = 'å‘é€å¤±è´¥ï¼Œç”µåé‚®ç®±åœ°å€æ˜¯æ— 效的:'; -$PHPMAILER_LANG['mailer_not_supported'] = 'å‘信客户端ä¸è¢«æ”¯æŒã€‚'; -$PHPMAILER_LANG['provide_address'] = 'å¿…é¡»æä¾›è‡³å°‘一个收件人地å€ã€‚'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误:收件人地å€é”™è¯¯ï¼š'; -$PHPMAILER_LANG['signing'] = '登录失败:'; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTPæœåŠ¡å™¨è¿žæŽ¥å¤±è´¥ã€‚'; -$PHPMAILER_LANG['smtp_error'] = 'SMTPæœåŠ¡å™¨å‡ºé”™: '; -$PHPMAILER_LANG['variable_set'] = 'æ— æ³•è®¾ç½®æˆ–é‡ç½®å˜é‡ï¼š'; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
@@ -1,5 +0,0 @@
-<?php -require_once 'vendor/autoload.php'; -spl_autoload_register(function ($class) { - require_once strtr($class, '\\_', '//').'.php'; -});
@@ -1,125 +0,0 @@
-#!/usr/bin/env bash - -# Fake POP3 server -# By Marcus Bointon <phpmailer@synchromedia.co.uk> -# Based on code by 'Frater' found at http://www.linuxquestions.org/questions/programming-9/fake-pop3-server-to-capture-pop3-passwords-933733 -# Does not actually serve any mail, but supports commands sufficient to test POP-before SMTP -# Can be run directly from a shell like this: -# mkfifo fifo; nc -l 1100 <fifo |./fakepopserver.sh >fifo; rm fifo -# It will accept any user name and will return a positive response for the password 'test' - -# Licensed under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html - -# Enable debug output -#set -xv -export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin - -LOGFOLDER=/tmp - -LOGFILE=${LOGFOLDER}/fakepop.log - -LOGGING=1 -DEBUG=1 -TIMEOUT=60 - -POP_USER= -POP_PASSWRD=test - -LINES=1 -BREAK=0 - -write_log () { - if [ ${LINES} -eq 1 ] ; then - echo '---' >>${LOGFILE} - fi - let LINES+=1 - [ ${LOGGING} = 0 ] || echo -e "`date '+%b %d %H:%M'` pop3 $*" >>${LOGFILE} -} - -ANSWER="+OK Fake POP3 Service Ready" - -while [ ${BREAK} -eq 0 ] ; do - echo -en "${ANSWER}\r\n" - - REPLY="" - - #Input appears in $REPLY - read -t ${TIMEOUT} - - ANSWER="+OK " - COMMAND="" - ARGS="" - TIMEOUT=30 - - if [ "$REPLY" ] ; then - write_log "RAW input: '`echo "${REPLY}" | tr -cd '[ -~]'`'" - - COMMAND="`echo "${REPLY}" | awk '{print $1}' | tr -cd '\40-\176' | tr 'a-z' 'A-Z'`" - ARGS="`echo "${REPLY}" | tr -cd '\40-\176' | awk '{for(i=2;i<=NF;i++){printf "%s ", $i};printf "\n"}' | sed 's/ $//'`" - - write_log "Command: \"${COMMAND}\"" - write_log "Arguments: \"${ARGS}\"" - - case "$COMMAND" in - QUIT) - break - ;; - USER) - if [ -n "${ARGS}" ] ; then - POP_USER="${ARGS}" - ANSWER="+OK Please send PASS command" - fi - ;; - AUTH) - ANSWER="+OK \r\n." - ;; - CAPA) - ANSWER="+OK Capabilities include\r\nUSER\r\nCAPA\r\n." - ;; - PASS) - if [ "${POP_PASSWRD}" == "${ARGS}" ] ; then - ANSWER="+OK Logged in." - AUTH=1 - else - ANSWER="-ERR Login failed." - fi - ;; - LIST) - if [ "${AUTH}" = 0 ] ; then - ANSWER="-ERR Not authenticated" - else - if [ -z "${ARGS}" ] ; then - ANSWER="+OK No messages, really\r\n." - else - ANSWER="-ERR No messages, no list, no status" - fi - fi - ;; - RSET) - ANSWER="+OK Resetting or whatever\r\n." - ;; - LAST) - if [ "${AUTH}" = 0 ] ; then - ANSWER="-ERR Not authenticated" - else - ANSWER="+OK 0" - fi - ;; - STAT) - if [ "${AUTH}" = 0 ] ; then - ANSWER="-ERR Not authenticated" - else - ANSWER="+OK 0 0" - fi - ;; - NOOP) - ANSWER="+OK Hang on, doing nothing" - ;; - esac - else - echo "+OK Connection timed out" - break - fi -done - -echo "+OK Bye!\r\n"
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash -#Fake sendmail script, adapted from: -#https://github.com/mrded/MNPP/blob/ee64fb2a88efc70ba523b78e9ce61f9f1ed3b4a9/init/fake-sendmail.sh - -#Create a temp folder to put messages in -numPath="${TMPDIR-/tmp/}fakemail" -umask 037 -mkdir -p $numPath - -if [ ! -f $numPath/num ]; then - echo "0" > $numPath/num -fi -num=`cat $numPath/num` -num=$(($num + 1)) -echo $num > $numPath/num - -name="$numPath/message_$num.eml" -while read line -do - echo $line >> $name -done -exit 0
@@ -1,76 +0,0 @@
-<?php -/** - * PHPMailer - language file tests - * Requires PHPUnit 3.3 or later. - * - * PHP version 5.0.0 - * - * @package PHPMailer - * @author Andy Prevost - * @author Marcus Bointon <phpmailer@synchromedia.co.uk> - * @copyright 2004 - 2009 Andy Prevost - * @copyright 2010 Marcus Bointon - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - */ - -require_once '../PHPMailerAutoload.php'; - -/** - * PHPMailer - PHP email transport unit test class - * Performs authentication tests - */ -class PHPMailerLangTest extends PHPUnit_Framework_TestCase -{ - /** - * Holds a phpmailer instance. - * @private - * @var PHPMailer - */ - public $Mail; - - /** - * @var string Default include path - */ - public $INCLUDE_DIR = '../'; - - /** - * Run before each test is started. - */ - public function setUp() - { - $this->Mail = new PHPMailer; - } - - /** - * Test language files for missing and excess translations - * All languages are compared with English - * @group languages - */ - public function testTranslations() - { - $this->Mail->setLanguage('en'); - $definedStrings = $this->Mail->getTranslations(); - $err = ''; - foreach (new DirectoryIterator('../language') as $fileInfo) { - if ($fileInfo->isDot()) { - continue; - } - $matches = array(); - //Only look at language files, ignore anything else in there - if (preg_match('/^phpmailer\.lang-([a-z_]{2,})\.php$/', $fileInfo->getFilename(), $matches)) { - $lang = $matches[1]; //Extract language code - $PHPMAILER_LANG = array(); //Language strings get put in here - include $fileInfo->getPathname(); //Get language strings - $missing = array_diff(array_keys($definedStrings), array_keys($PHPMAILER_LANG)); - $extra = array_diff(array_keys($PHPMAILER_LANG), array_keys($definedStrings)); - if (!empty($missing)) { - $err .= "\nMissing translations in $lang: " . implode(', ', $missing); - } - if (!empty($extra)) { - $err .= "\nExtra translations in $lang: " . implode(', ', $extra); - } - } - } - $this->assertEmpty($err, $err); - } -}
@@ -1,2166 +0,0 @@
-<?php -/** - * PHPMailer - PHP email transport unit tests - * Requires PHPUnit 3.3 or later. - * - * PHP version 5.0.0 - * - * @package PHPMailer - * @author Andy Prevost - * @author Marcus Bointon <phpmailer@synchromedia.co.uk> - * @copyright 2004 - 2009 Andy Prevost - * @copyright 2010 Marcus Bointon - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - */ - -require_once realpath('../PHPMailerAutoload.php'); - -/** - * PHPMailer - PHP email transport unit test class - * Performs authentication tests - */ -class PHPMailerTest extends PHPUnit_Framework_TestCase -{ - /** - * Holds the default phpmailer instance. - * @private - * @var PHPMailer - */ - public $Mail; - - /** - * Holds the SMTP mail host. - * @public - * @var string - */ - public $Host = ''; - - /** - * Holds the change log. - * @private - * @var string[] - */ - public $ChangeLog = array(); - - /** - * Holds the note log. - * @private - * @var string[] - */ - public $NoteLog = array(); - - /** - * PIDs of any processes we need to kill - * @var array - * @access private - */ - private $pids = array(); - - /** - * Default include path - * @var string - */ - const INCLUDE_DIR = '../'; - - /** - * Run before each test is started. - */ - public function setUp() - { - if (file_exists('testbootstrap.php')) { - include 'testbootstrap.php'; //Overrides go in here - } - $this->Mail = new PHPMailer; - $this->Mail->SMTPDebug = 3; //Full debug output - $this->Mail->Priority = 3; - $this->Mail->Encoding = '8bit'; - $this->Mail->CharSet = 'iso-8859-1'; - if (array_key_exists('mail_from', $_REQUEST)) { - $this->Mail->From = $_REQUEST['mail_from']; - } else { - $this->Mail->From = 'unit_test@phpmailer.example.com'; - } - $this->Mail->FromName = 'Unit Tester'; - $this->Mail->Sender = ''; - $this->Mail->Subject = 'Unit Test'; - $this->Mail->Body = ''; - $this->Mail->AltBody = ''; - $this->Mail->WordWrap = 0; - if (array_key_exists('mail_host', $_REQUEST)) { - $this->Mail->Host = $_REQUEST['mail_host']; - } else { - $this->Mail->Host = 'mail.example.com'; - } - if (array_key_exists('mail_port', $_REQUEST)) { - $this->Mail->Port = $_REQUEST['mail_port']; - } else { - $this->Mail->Port = 25; - } - $this->Mail->Helo = 'localhost.localdomain'; - $this->Mail->SMTPAuth = false; - $this->Mail->Username = ''; - $this->Mail->Password = ''; - $this->Mail->addReplyTo('no_reply@phpmailer.example.com', 'Reply Guy'); - $this->Mail->Sender = 'unit_test@phpmailer.example.com'; - if (strlen($this->Mail->Host) > 0) { - $this->Mail->Mailer = 'smtp'; - } else { - $this->Mail->Mailer = 'mail'; - } - if (array_key_exists('mail_to', $_REQUEST)) { - $this->setAddress($_REQUEST['mail_to'], 'Test User', 'to'); - } - if (array_key_exists('mail_cc', $_REQUEST) and strlen($_REQUEST['mail_cc']) > 0) { - $this->setAddress($_REQUEST['mail_cc'], 'Carbon User', 'cc'); - } - } - - /** - * Run after each test is completed. - */ - public function tearDown() - { - // Clean global variables - $this->Mail = null; - $this->ChangeLog = array(); - $this->NoteLog = array(); - - foreach ($this->pids as $pid) { - $p = escapeshellarg($pid); - shell_exec("ps $p && kill -TERM $p"); - } - } - - - /** - * Build the body of the message in the appropriate format. - * - * @private - * @return void - */ - public function buildBody() - { - $this->checkChanges(); - - // Determine line endings for message - if ($this->Mail->ContentType == 'text/html' || strlen($this->Mail->AltBody) > 0) { - $eol = "<br>\r\n"; - $bullet_start = '<li>'; - $bullet_end = "</li>\r\n"; - $list_start = "<ul>\r\n"; - $list_end = "</ul>\r\n"; - } else { - $eol = "\r\n"; - $bullet_start = ' - '; - $bullet_end = "\r\n"; - $list_start = ''; - $list_end = ''; - } - - $ReportBody = ''; - - $ReportBody .= '---------------------' . $eol; - $ReportBody .= 'Unit Test Information' . $eol; - $ReportBody .= '---------------------' . $eol; - $ReportBody .= 'phpmailer version: ' . $this->Mail->Version . $eol; - $ReportBody .= 'Content Type: ' . $this->Mail->ContentType . $eol; - $ReportBody .= 'CharSet: ' . $this->Mail->CharSet . $eol; - - if (strlen($this->Mail->Host) > 0) { - $ReportBody .= 'Host: ' . $this->Mail->Host . $eol; - } - - // If attachments then create an attachment list - $attachments = $this->Mail->getAttachments(); - if (count($attachments) > 0) { - $ReportBody .= 'Attachments:' . $eol; - $ReportBody .= $list_start; - foreach ($attachments as $attachment) { - $ReportBody .= $bullet_start . 'Name: ' . $attachment[1] . ', '; - $ReportBody .= 'Encoding: ' . $attachment[3] . ', '; - $ReportBody .= 'Type: ' . $attachment[4] . $bullet_end; - } - $ReportBody .= $list_end . $eol; - } - - // If there are changes then list them - if (count($this->ChangeLog) > 0) { - $ReportBody .= 'Changes' . $eol; - $ReportBody .= '-------' . $eol; - - $ReportBody .= $list_start; - for ($i = 0; $i < count($this->ChangeLog); $i++) { - $ReportBody .= $bullet_start . $this->ChangeLog[$i][0] . ' was changed to [' . - $this->ChangeLog[$i][1] . ']' . $bullet_end; - } - $ReportBody .= $list_end . $eol . $eol; - } - - // If there are notes then list them - if (count($this->NoteLog) > 0) { - $ReportBody .= 'Notes' . $eol; - $ReportBody .= '-----' . $eol; - - $ReportBody .= $list_start; - for ($i = 0; $i < count($this->NoteLog); $i++) { - $ReportBody .= $bullet_start . $this->NoteLog[$i] . $bullet_end; - } - $ReportBody .= $list_end; - } - - // Re-attach the original body - $this->Mail->Body .= $eol . $ReportBody; - } - - /** - * Check which default settings have been changed for the report. - * @private - * @return void - */ - public function checkChanges() - { - if ($this->Mail->Priority != 3) { - $this->addChange('Priority', $this->Mail->Priority); - } - if ($this->Mail->Encoding != '8bit') { - $this->addChange('Encoding', $this->Mail->Encoding); - } - if ($this->Mail->CharSet != 'iso-8859-1') { - $this->addChange('CharSet', $this->Mail->CharSet); - } - if ($this->Mail->Sender != '') { - $this->addChange('Sender', $this->Mail->Sender); - } - if ($this->Mail->WordWrap != 0) { - $this->addChange('WordWrap', $this->Mail->WordWrap); - } - if ($this->Mail->Mailer != 'mail') { - $this->addChange('Mailer', $this->Mail->Mailer); - } - if ($this->Mail->Port != 25) { - $this->addChange('Port', $this->Mail->Port); - } - if ($this->Mail->Helo != 'localhost.localdomain') { - $this->addChange('Helo', $this->Mail->Helo); - } - if ($this->Mail->SMTPAuth) { - $this->addChange('SMTPAuth', 'true'); - } - } - - /** - * Add a changelog entry. - * @access private - * @param string $sName - * @param string $sNewValue - * @return void - */ - public function addChange($sName, $sNewValue) - { - $this->ChangeLog[] = array($sName, $sNewValue); - } - - /** - * Adds a simple note to the message. - * @public - * @param string $sValue - * @return void - */ - public function addNote($sValue) - { - $this->NoteLog[] = $sValue; - } - - /** - * Adds all of the addresses - * @access public - * @param string $sAddress - * @param string $sName - * @param string $sType - * @return boolean - */ - public function setAddress($sAddress, $sName = '', $sType = 'to') - { - switch ($sType) { - case 'to': - return $this->Mail->addAddress($sAddress, $sName); - case 'cc': - return $this->Mail->addCC($sAddress, $sName); - case 'bcc': - return $this->Mail->addBCC($sAddress, $sName); - } - return false; - } - - /** - * Check that we have loaded default test params. - * Pretty much everything will fail due to unset recipient if this is not done. - */ - public function testBootstrap() - { - $this->assertTrue( - file_exists('testbootstrap.php'), - 'Test config params missing - copy testbootstrap.php to testbootstrap-dist.php and change as appropriate' - ); - } - - /** - * Test CRAM-MD5 authentication. - * Needs a connection to a server that supports this auth mechanism, so commented out by default - */ - public function testAuthCRAMMD5() - { - $this->Mail->Host = 'hostname'; - $this->Mail->Port = 587; - $this->Mail->SMTPAuth = true; - $this->Mail->SMTPSecure = 'tls'; - $this->Mail->AuthType = 'CRAM-MD5'; - $this->Mail->Username = 'username'; - $this->Mail->Password = 'password'; - $this->Mail->Body = 'Test body'; - $this->Mail->Subject .= ': Auth CRAM-MD5'; - $this->Mail->From = 'from@example.com'; - $this->Mail->Sender = 'from@example.com'; - $this->Mail->clearAllRecipients(); - $this->Mail->addAddress('user@example.com'); - //$this->assertTrue($this->mail->send(), $this->mail->ErrorInfo); - } - - /** - * Test email address validation. - * Test addresses obtained from http://isemail.info - * Some failing cases commented out that are apparently up for debate! - */ - public function testValidate() - { - $validaddresses = array( - 'first@iana.org', - 'first.last@iana.org', - '1234567890123456789012345678901234567890123456789012345678901234@iana.org', - '"first\"last"@iana.org', - '"first@last"@iana.org', - '"first\last"@iana.org', - 'first.last@[12.34.56.78]', - 'first.last@[IPv6:::12.34.56.78]', - 'first.last@[IPv6:1111:2222:3333::4444:12.34.56.78]', - 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.56.78]', - 'first.last@[IPv6:::1111:2222:3333:4444:5555:6666]', - 'first.last@[IPv6:1111:2222:3333::4444:5555:6666]', - 'first.last@[IPv6:1111:2222:3333:4444:5555:6666::]', - 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888]', - 'first.last@x23456789012345678901234567890123456789012345678901234567890123.iana.org', - 'first.last@3com.com', - 'first.last@123.iana.org', - '"first\last"@iana.org', - 'first.last@[IPv6:1111:2222:3333::4444:5555:12.34.56.78]', - 'first.last@[IPv6:1111:2222:3333::4444:5555:6666:7777]', - 'first.last@example.123', - 'first.last@com', - '"Abc\@def"@iana.org', - '"Fred\ Bloggs"@iana.org', - '"Joe.\Blow"@iana.org', - '"Abc@def"@iana.org', - 'user+mailbox@iana.org', - 'customer/department=shipping@iana.org', - '$A12345@iana.org', - '!def!xyz%abc@iana.org', - '_somename@iana.org', - 'dclo@us.ibm.com', - 'peter.piper@iana.org', - '"Doug \"Ace\" L."@iana.org', - 'test@iana.org', - 'TEST@iana.org', - '1234567890@iana.org', - 'test+test@iana.org', - 'test-test@iana.org', - 't*est@iana.org', - '+1~1+@iana.org', - '{_test_}@iana.org', - '"[[ test ]]"@iana.org', - 'test.test@iana.org', - '"test.test"@iana.org', - 'test."test"@iana.org', - '"test@test"@iana.org', - 'test@123.123.123.x123', - 'test@123.123.123.123', - 'test@[123.123.123.123]', - 'test@example.iana.org', - 'test@example.example.iana.org', - '"test\test"@iana.org', - 'test@example', - '"test\blah"@iana.org', - '"test\blah"@iana.org', - '"test\"blah"@iana.org', - 'customer/department@iana.org', - '_Yosemite.Sam@iana.org', - '~@iana.org', - '"Austin@Powers"@iana.org', - 'Ima.Fool@iana.org', - '"Ima.Fool"@iana.org', - '"Ima Fool"@iana.org', - '"first"."last"@iana.org', - '"first".middle."last"@iana.org', - '"first".last@iana.org', - 'first."last"@iana.org', - '"first"."middle"."last"@iana.org', - '"first.middle"."last"@iana.org', - '"first.middle.last"@iana.org', - '"first..last"@iana.org', - '"first\"last"@iana.org', - 'first."mid\dle"."last"@iana.org', - '"test blah"@iana.org', - '(foo)cal(bar)@(baz)iamcal.com(quux)', - 'cal@iamcal(woo).(yay)com', - 'cal(woo(yay)hoopla)@iamcal.com', - 'cal(foo\@bar)@iamcal.com', - 'cal(foo\)bar)@iamcal.com', - 'first().last@iana.org', - 'pete(his account)@silly.test(his host)', - 'c@(Chris\'s host.)public.example', - 'jdoe@machine(comment). example', - '1234 @ local(blah) .machine .example', - 'first(abc.def).last@iana.org', - 'first(a"bc.def).last@iana.org', - 'first.(")middle.last(")@iana.org', - 'first(abc\(def)@iana.org', - 'first.last@x(1234567890123456789012345678901234567890123456789012345678901234567890).com', - 'a(a(b(c)d(e(f))g)h(i)j)@iana.org', - 'name.lastname@domain.com', - 'a@b', - 'a@bar.com', - 'aaa@[123.123.123.123]', - 'a@bar', - 'a-b@bar.com', - '+@b.c', - '+@b.com', - 'a@b.co-foo.uk', - '"hello my name is"@stutter.com', - '"Test \"Fail\" Ing"@iana.org', - 'valid@about.museum', - 'shaitan@my-domain.thisisminekthx', - 'foobar@192.168.0.1', - '"Joe\Blow"@iana.org', - 'HM2Kinsists@(that comments are allowed)this.is.ok', - 'user%uucp!path@berkeley.edu', - 'first.last @iana.org', - 'cdburgess+!#$%&\'*-/=?+_{}|~test@gmail.com', - 'first.last@[IPv6:::a2:a3:a4:b1:b2:b3:b4]', - 'first.last@[IPv6:a1:a2:a3:a4:b1:b2:b3::]', - 'first.last@[IPv6:::]', - 'first.last@[IPv6:::b4]', - 'first.last@[IPv6:::b3:b4]', - 'first.last@[IPv6:a1::b4]', - 'first.last@[IPv6:a1::]', - 'first.last@[IPv6:a1:a2::]', - 'first.last@[IPv6:0123:4567:89ab:cdef::]', - 'first.last@[IPv6:0123:4567:89ab:CDEF::]', - 'first.last@[IPv6:::a3:a4:b1:ffff:11.22.33.44]', - 'first.last@[IPv6:::a2:a3:a4:b1:ffff:11.22.33.44]', - 'first.last@[IPv6:a1:a2:a3:a4::11.22.33.44]', - 'first.last@[IPv6:a1:a2:a3:a4:b1::11.22.33.44]', - 'first.last@[IPv6:a1::11.22.33.44]', - 'first.last@[IPv6:a1:a2::11.22.33.44]', - 'first.last@[IPv6:0123:4567:89ab:cdef::11.22.33.44]', - 'first.last@[IPv6:0123:4567:89ab:CDEF::11.22.33.44]', - 'first.last@[IPv6:a1::b2:11.22.33.44]', - 'test@test.com', - 'test@xn--example.com', - 'test@example.com' - ); - $invalidaddresses = array( - 'first.last@sub.do,com', - 'first\@last@iana.org', - '123456789012345678901234567890123456789012345678901234567890' . - '@12345678901234567890123456789012345678901234 [...]', - 'first.last', - '12345678901234567890123456789012345678901234567890123456789012345@iana.org', - '.first.last@iana.org', - 'first.last.@iana.org', - 'first..last@iana.org', - '"first"last"@iana.org', - '"""@iana.org', - '"\"@iana.org', - //'""@iana.org', - 'first\@last@iana.org', - 'first.last@', - 'x@x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.' . - 'x23456789.x23456789.x23456789.x23 [...]', - 'first.last@[.12.34.56.78]', - 'first.last@[12.34.56.789]', - 'first.last@[::12.34.56.78]', - 'first.last@[IPv5:::12.34.56.78]', - 'first.last@[IPv6:1111:2222:3333:4444:5555:12.34.56.78]', - 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:12.34.56.78]', - 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777]', - 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999]', - 'first.last@[IPv6:1111:2222::3333::4444:5555:6666]', - 'first.last@[IPv6:1111:2222:333x::4444:5555]', - 'first.last@[IPv6:1111:2222:33333::4444:5555]', - 'first.last@-xample.com', - 'first.last@exampl-.com', - 'first.last@x234567890123456789012345678901234567890123456789012345678901234.iana.org', - 'abc\@def@iana.org', - 'abc\@iana.org', - 'Doug\ \"Ace\"\ Lovell@iana.org', - 'abc@def@iana.org', - 'abc\@def@iana.org', - 'abc\@iana.org', - '@iana.org', - 'doug@', - '"qu@iana.org', - 'ote"@iana.org', - '.dot@iana.org', - 'dot.@iana.org', - 'two..dot@iana.org', - '"Doug "Ace" L."@iana.org', - 'Doug\ \"Ace\"\ L\.@iana.org', - 'hello world@iana.org', - //'helloworld@iana .org', - 'gatsby@f.sc.ot.t.f.i.tzg.era.l.d.', - 'test.iana.org', - 'test.@iana.org', - 'test..test@iana.org', - '.test@iana.org', - 'test@test@iana.org', - 'test@@iana.org', - '-- test --@iana.org', - '[test]@iana.org', - '"test"test"@iana.org', - '()[]\;:,><@iana.org', - 'test@.', - 'test@example.', - 'test@.org', - 'test@12345678901234567890123456789012345678901234567890123456789012345678901234567890' . - '12345678901234567890 [...]', - 'test@[123.123.123.123', - 'test@123.123.123.123]', - 'NotAnEmail', - '@NotAnEmail', - '"test"blah"@iana.org', - '.wooly@iana.org', - 'wo..oly@iana.org', - 'pootietang.@iana.org', - '.@iana.org', - 'Ima Fool@iana.org', - 'phil.h\@\@ck@haacked.com', - 'foo@[\1.2.3.4]', - //'first."".last@iana.org', - 'first\last@iana.org', - 'Abc\@def@iana.org', - 'Fred\ Bloggs@iana.org', - 'Joe.\Blow@iana.org', - 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.567.89]', - '{^c\@**Dog^}@cartoon.com', - //'"foo"(yay)@(hoopla)[1.2.3.4]', - 'cal(foo(bar)@iamcal.com', - 'cal(foo)bar)@iamcal.com', - 'cal(foo\)@iamcal.com', - 'first(12345678901234567890123456789012345678901234567890)last@(1234567890123456789' . - '01234567890123456789012 [...]', - 'first(middle)last@iana.org', - 'first(abc("def".ghi).mno)middle(abc("def".ghi).mno).last@(abc("def".ghi).mno)example' . - '(abc("def".ghi).mno). [...]', - 'a(a(b(c)d(e(f))g)(h(i)j)@iana.org', - '.@', - '@bar.com', - '@@bar.com', - 'aaa.com', - 'aaa@.com', - 'aaa@.123', - 'aaa@[123.123.123.123]a', - 'aaa@[123.123.123.333]', - 'a@bar.com.', - 'a@-b.com', - 'a@b-.com', - '-@..com', - '-@a..com', - 'invalid@about.museum-', - 'test@...........com', - '"Unicode NULL' . chr(0) . '"@char.com', - 'Unicode NULL' . chr(0) . '@char.com', - 'first.last@[IPv6::]', - 'first.last@[IPv6::::]', - 'first.last@[IPv6::b4]', - 'first.last@[IPv6::::b4]', - 'first.last@[IPv6::b3:b4]', - 'first.last@[IPv6::::b3:b4]', - 'first.last@[IPv6:a1:::b4]', - 'first.last@[IPv6:a1:]', - 'first.last@[IPv6:a1:::]', - 'first.last@[IPv6:a1:a2:]', - 'first.last@[IPv6:a1:a2:::]', - 'first.last@[IPv6::11.22.33.44]', - 'first.last@[IPv6::::11.22.33.44]', - 'first.last@[IPv6:a1:11.22.33.44]', - 'first.last@[IPv6:a1:::11.22.33.44]', - 'first.last@[IPv6:a1:a2:::11.22.33.44]', - 'first.last@[IPv6:0123:4567:89ab:cdef::11.22.33.xx]', - 'first.last@[IPv6:0123:4567:89ab:CDEFF::11.22.33.44]', - 'first.last@[IPv6:a1::a4:b1::b4:11.22.33.44]', - 'first.last@[IPv6:a1::11.22.33]', - 'first.last@[IPv6:a1::11.22.33.44.55]', - 'first.last@[IPv6:a1::b211.22.33.44]', - 'first.last@[IPv6:a1::b2::11.22.33.44]', - 'first.last@[IPv6:a1::b3:]', - 'first.last@[IPv6::a2::b4]', - 'first.last@[IPv6:a1:a2:a3:a4:b1:b2:b3:]', - 'first.last@[IPv6::a2:a3:a4:b1:b2:b3:b4]', - 'first.last@[IPv6:a1:a2:a3:a4::b1:b2:b3:b4]', - //This is a valid RCC5322 address, but we don't want to allow it for obvious reasons! - "(\r\n RCPT TO:user@example.com\r\n DATA \\\nSubject: spam10\\\n\r\n Hello,\r\n". - " this is a spam mail.\\\n.\r\n QUIT\r\n ) a@example.net" - ); - // IDNs in Unicode and ASCII forms. - $unicodeaddresses = array( - 'first.last@bücher.ch', - 'first.last@кто.рф', - 'first.last@phplÃst.com', - ); - $asciiaddresses = array( - 'first.last@xn--bcher-kva.ch', - 'first.last@xn--j1ail.xn--p1ai', - 'first.last@xn--phplst-6va.com', - ); - $goodfails = array(); - foreach (array_merge($validaddresses, $asciiaddresses) as $address) { - if (!PHPMailer::validateAddress($address)) { - $goodfails[] = $address; - } - } - $badpasses = array(); - foreach (array_merge($invalidaddresses, $unicodeaddresses) as $address) { - if (PHPMailer::validateAddress($address)) { - $badpasses[] = $address; - } - } - $err = ''; - if (count($goodfails) > 0) { - $err .= "Good addresses that failed validation:\n"; - $err .= implode("\n", $goodfails); - } - if (count($badpasses) > 0) { - if (!empty($err)) { - $err .= "\n\n"; - } - $err .= "Bad addresses that passed validation:\n"; - $err .= implode("\n", $badpasses); - } - $this->assertEmpty($err, $err); - //For coverage - $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'auto')); - $this->assertFalse(PHPMailer::validateAddress('test@example.com.', 'auto')); - $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'pcre')); - $this->assertFalse(PHPMailer::validateAddress('test@example.com.', 'pcre')); - $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'pcre8')); - $this->assertFalse(PHPMailer::validateAddress('test@example.com.', 'pcre8')); - $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'php')); - $this->assertFalse(PHPMailer::validateAddress('test@example.com.', 'php')); - $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'noregex')); - $this->assertFalse(PHPMailer::validateAddress('bad', 'noregex')); - } - - /** - * Test injecting a custom validator. - */ - public function testCustomValidator() - { - //Inject a one-off custom validator - $this->assertTrue( - PHPMailer::validateAddress( - 'user@example.com', - function ($address) { - return (strpos($address, '@') !== false); - } - ), - 'Custom validator false negative' - ); - $this->assertFalse( - PHPMailer::validateAddress( - 'userexample.com', - function ($address) { - return (strpos($address, '@') !== false); - } - ), - 'Custom validator false positive' - ); - //Set the default validator to an injected function - PHPMailer::$validator = function ($address) { - return ('user@example.com' === $address); - }; - $this->assertTrue( - $this->Mail->addAddress('user@example.com'), - 'Custom default validator false negative' - ); - $this->assertFalse( - //Need to pick a failing value which would pass all other validators - //to be sure we're using our custom one - $this->Mail->addAddress('bananas@example.com'), - 'Custom default validator false positive' - ); - //Set default validator to PHP built-in - PHPMailer::$validator = 'php'; - $this->assertFalse( - //This is a valid address that FILTER_VALIDATE_EMAIL thinks is invalid - $this->Mail->addAddress('first.last@example.123'), - 'PHP validator not behaving as expected' - ); - } - - /** - * Word-wrap an ASCII message. - */ - public function testWordWrap() - { - $this->Mail->WordWrap = 40; - $my_body = str_repeat( - 'Here is the main body of this message. It should ' . - 'be quite a few lines. It should be wrapped at ' . - '40 characters. Make sure that it is. ', - 10 - ); - $nBodyLen = strlen($my_body); - $my_body .= "\n\nThis is the above body length: " . $nBodyLen; - - $this->Mail->Body = $my_body; - $this->Mail->Subject .= ': Wordwrap'; - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Word-wrap a multibyte message. - */ - public function testWordWrapMultibyte() - { - $this->Mail->WordWrap = 40; - $my_body = str_repeat( - '飛兒樂 團光茫 飛兒樂 團光茫 飛兒樂 團光茫 飛兒樂 團光茫 ' . - '飛飛兒樂 團光茫兒樂 團光茫飛兒樂 團光飛兒樂 團光茫飛兒樂 團光茫兒樂 團光茫 ' . - '飛兒樂 團光茫飛兒樂 團飛兒樂 團光茫光茫飛兒樂 團光茫. ', - 10 - ); - $nBodyLen = strlen($my_body); - $my_body .= "\n\nThis is the above body length: " . $nBodyLen; - - $this->Mail->Body = $my_body; - $this->Mail->Subject .= ': Wordwrap multibyte'; - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Test low priority. - */ - public function testLowPriority() - { - $this->Mail->Priority = 5; - $this->Mail->Body = 'Here is the main body. There should be ' . - 'a reply to address in this message.'; - $this->Mail->Subject .= ': Low Priority'; - $this->Mail->addReplyTo('nobody@nobody.com', 'Nobody (Unit Test)'); - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Simple plain file attachment test. - */ - public function testMultiplePlainFileAttachment() - { - $this->Mail->Body = 'Here is the text body'; - $this->Mail->Subject .= ': Plain + Multiple FileAttachments'; - - if (!$this->Mail->addAttachment(realpath(self::INCLUDE_DIR . 'examples/images/phpmailer.png'))) { - $this->assertTrue(false, $this->Mail->ErrorInfo); - return; - } - - if (!$this->Mail->addAttachment(__FILE__, 'test.txt')) { - $this->assertTrue(false, $this->Mail->ErrorInfo); - return; - } - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Simple plain string attachment test. - */ - public function testPlainStringAttachment() - { - $this->Mail->Body = 'Here is the text body'; - $this->Mail->Subject .= ': Plain + StringAttachment'; - - $sAttachment = 'These characters are the content of the ' . - "string attachment.\nThis might be taken from a " . - 'database or some other such thing. '; - - $this->Mail->addStringAttachment($sAttachment, 'string_attach.txt'); - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Plain quoted-printable message. - */ - public function testQuotedPrintable() - { - $this->Mail->Body = 'Here is the main body'; - $this->Mail->Subject .= ': Plain + Quoted-printable'; - $this->Mail->Encoding = 'quoted-printable'; - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - - //Check that a quoted printable encode and decode results in the same as went in - $t = file_get_contents(__FILE__); //Use this file as test content - //Force line breaks to UNIX-style - $t = str_replace(array("\r\n", "\r"), "\n", $t); - $this->assertEquals( - $t, - quoted_printable_decode($this->Mail->encodeQP($t)), - 'Quoted-Printable encoding round-trip failed' - ); - $this->assertEquals( - $this->Mail->encodeQP($t), - $this->Mail->encodeQPphp($t), - 'Quoted-Printable BC wrapper failed' - ); - //Force line breaks to Windows-style - $t = str_replace("\n", "\r\n", $t); - $this->assertEquals( - $t, - quoted_printable_decode($this->Mail->encodeQP($t)), - 'Quoted-Printable encoding round-trip failed (Windows line breaks)' - ); - } - - /** - * Send an HTML message. - */ - public function testHtml() - { - $this->Mail->isHTML(true); - $this->Mail->Subject .= ": HTML only"; - - $this->Mail->Body = <<<EOT -<html> - <head> - <title>HTML email test</title> - </head> - <body> - <h1>PHPMailer does HTML!</h1> - <p>This is a <strong>test message</strong> written in HTML.<br> - Go to <a href="https://github.com/PHPMailer/PHPMailer/">https://github.com/PHPMailer/PHPMailer/</a> - for new versions of PHPMailer.</p> - <p>Thank you!</p> - </body> -</html> -EOT; - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - $msg = $this->Mail->getSentMIMEMessage(); - $this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers'); - } - - /** - * Send a message containing ISO-8859-1 text. - */ - public function testHtmlIso8859() - { - $this->Mail->isHTML(true); - $this->Mail->Subject .= ": ISO-8859-1 HTML"; - $this->Mail->CharSet = 'iso-8859-1'; - - //This file is in ISO-8859-1 charset - //Needs to be external because this file is in UTF-8 - $content = file_get_contents(realpath('../examples/contents.html')); - // This is the string 'éèîüçÅñæß' in ISO-8859-1, base-64 encoded - $check = base64_decode('6eju/OfF8ebf'); - //Make sure it really is in ISO-8859-1! - $this->Mail->msgHTML( - mb_convert_encoding( - $content, - "ISO-8859-1", - mb_detect_encoding($content, "UTF-8, ISO-8859-1, ISO-8859-15", true) - ), - realpath(self::INCLUDE_DIR . 'examples') - ); - $this->buildBody(); - $this->assertTrue( - strpos($this->Mail->Body, $check) !== false, - 'ISO message body does not contain expected text' - ); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Send a message containing multilingual UTF-8 text. - */ - public function testHtmlUtf8() - { - $this->Mail->isHTML(true); - $this->Mail->Subject .= ": UTF-8 HTML"; - $this->Mail->CharSet = 'UTF-8'; - - $this->Mail->Body = <<<EOT -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>HTML email test</title> - </head> - <body> - <p>Chinese text: 郵件內容為空</p> - <p>Russian text: ПуÑтое тело ÑообщениÑ</p> - <p>Armenian text: Õ€Õ¡Õ²Õ¸Ö€Õ¤Õ¡Õ£Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨ Õ¤Õ¡Õ¿Õ¡Ö€Õ¯ Õ§</p> - <p>Czech text: Prázdné tÄ›lo zprávy</p> - </body> -</html> -EOT; - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - $msg = $this->Mail->getSentMIMEMessage(); - $this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers'); - } - - /** - * Send a message containing multilingual UTF-8 text with an embedded image. - */ - public function testUtf8WithEmbeddedImage() - { - $this->Mail->isHTML(true); - $this->Mail->Subject .= ": UTF-8 with embedded image"; - $this->Mail->CharSet = 'UTF-8'; - - $this->Mail->Body = <<<EOT -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>HTML email test</title> - </head> - <body> - <p>Chinese text: 郵件內容為空</p> - <p>Russian text: ПуÑтое тело ÑообщениÑ</p> - <p>Armenian text: Õ€Õ¡Õ²Õ¸Ö€Õ¤Õ¡Õ£Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨ Õ¤Õ¡Õ¿Õ¡Ö€Õ¯ Õ§</p> - <p>Czech text: Prázdné tÄ›lo zprávy</p> - Embedded Image: <img alt="phpmailer" src="cid:my-attach"> - </body> -</html> -EOT; - $this->Mail->addEmbeddedImage( - realpath(self::INCLUDE_DIR . 'examples/images/phpmailer.png'), - 'my-attach', - 'phpmailer.png', - 'base64', - 'image/png' - ); - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Send a message containing multilingual UTF-8 text. - */ - public function testPlainUtf8() - { - $this->Mail->isHTML(false); - $this->Mail->Subject .= ": UTF-8 plain text"; - $this->Mail->CharSet = 'UTF-8'; - - $this->Mail->Body = <<<EOT -Chinese text: 郵件內容為空 -Russian text: ПуÑтое тело ÑÐ¾Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ñ -Armenian text: Õ€Õ¡Õ²Õ¸Ö€Õ¤Õ¡Õ£Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨ Õ¤Õ¡Õ¿Õ¡Ö€Õ¯ Õ§ -Czech text: Prázdné tÄ›lo zprávy -EOT; - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - $msg = $this->Mail->getSentMIMEMessage(); - $this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers'); - } - - /** - * Test simple message builder and html2text converters - */ - public function testMsgHTML() - { - $message = file_get_contents(realpath(self::INCLUDE_DIR . 'examples/contentsutf8.html')); - $this->Mail->CharSet = 'utf-8'; - $this->Mail->Body = ''; - $this->Mail->AltBody = ''; - //Uses internal HTML to text conversion - $this->Mail->msgHTML($message, realpath(self::INCLUDE_DIR . 'examples')); - $this->Mail->Subject .= ': msgHTML'; - - $this->assertNotEmpty($this->Mail->Body, 'Body not set by msgHTML'); - $this->assertNotEmpty($this->Mail->AltBody, 'AltBody not set by msgHTML'); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - - //Again, using a custom HTML to text converter - $this->Mail->AltBody = ''; - $this->Mail->msgHTML($message, realpath(self::INCLUDE_DIR . 'examples'), function ($html) { - return strtoupper(strip_tags($html)); - }); - $this->Mail->Subject .= ' + custom html2text'; - $this->assertNotEmpty($this->Mail->AltBody, 'Custom AltBody not set by msgHTML'); - - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Simple HTML and attachment test - */ - public function testHTMLAttachment() - { - $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.'; - $this->Mail->Subject .= ': HTML + Attachment'; - $this->Mail->isHTML(true); - - if (!$this->Mail->addAttachment( - realpath(self::INCLUDE_DIR . 'examples/images/phpmailer_mini.png'), 'phpmailer_mini.png') - ) { - $this->assertTrue(false, $this->Mail->ErrorInfo); - return; - } - - //Make sure that trying to attach a nonexistent file fails - $this->assertFalse($this->Mail->addAttachment(__FILE__ . md5(microtime()), 'nonexistent_file.txt')); - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Test embedded image without a name - */ - public function testHTMLStringEmbedNoName() - { - $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.'; - $this->Mail->Subject .= ': HTML + unnamed embedded image'; - $this->Mail->isHTML(true); - - if (!$this->Mail->addStringEmbeddedImage( - file_get_contents(realpath(self::INCLUDE_DIR . 'examples/images/phpmailer_mini.png')), - md5('phpmailer_mini.png').'@phpmailer.0', - '', //intentionally empty name - 'base64', - 'image/png', - 'inline') - ) { - $this->assertTrue(false, $this->Mail->ErrorInfo); - return; - } - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Simple HTML and multiple attachment test - */ - public function testHTMLMultiAttachment() - { - $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.'; - $this->Mail->Subject .= ': HTML + multiple Attachment'; - $this->Mail->isHTML(true); - - if (!$this->Mail->addAttachment(realpath(self::INCLUDE_DIR . 'examples/images/phpmailer_mini.png'), 'phpmailer_mini.png')) { - $this->assertTrue(false, $this->Mail->ErrorInfo); - return; - } - - if (!$this->Mail->addAttachment(realpath(self::INCLUDE_DIR . 'examples/images/phpmailer.png'), 'phpmailer.png')) { - $this->assertTrue(false, $this->Mail->ErrorInfo); - return; - } - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * An embedded attachment test. - */ - public function testEmbeddedImage() - { - $this->Mail->Body = 'Embedded Image: <img alt="phpmailer" src="cid:my-attach">' . - 'Here is an image!'; - $this->Mail->Subject .= ': Embedded Image'; - $this->Mail->isHTML(true); - - if (!$this->Mail->addEmbeddedImage( - realpath(self::INCLUDE_DIR . 'examples/images/phpmailer.png'), - 'my-attach', - 'phpmailer.png', - 'base64', - 'image/png' - ) - ) { - $this->assertTrue(false, $this->Mail->ErrorInfo); - return; - } - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - //For code coverage - $this->Mail->addEmbeddedImage('thisfiledoesntexist', 'xyz'); //Non-existent file - $this->Mail->addEmbeddedImage(__FILE__, '123'); //Missing name - } - - /** - * An embedded attachment test. - */ - public function testMultiEmbeddedImage() - { - $this->Mail->Body = 'Embedded Image: <img alt="phpmailer" src="cid:my-attach">' . - 'Here is an image!</a>'; - $this->Mail->Subject .= ': Embedded Image + Attachment'; - $this->Mail->isHTML(true); - - if (!$this->Mail->addEmbeddedImage( - realpath(self::INCLUDE_DIR . 'examples/images/phpmailer.png'), - 'my-attach', - 'phpmailer.png', - 'base64', - 'image/png' - ) - ) { - $this->assertTrue(false, $this->Mail->ErrorInfo); - return; - } - - if (!$this->Mail->addAttachment(__FILE__, 'test.txt')) { - $this->assertTrue(false, $this->Mail->ErrorInfo); - return; - } - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Simple multipart/alternative test. - */ - public function testAltBody() - { - $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.'; - $this->Mail->AltBody = 'Here is the text body of this message. ' . - 'It should be quite a few lines. It should be wrapped at the ' . - '40 characters. Make sure that it is.'; - $this->Mail->WordWrap = 40; - $this->addNote('This is a mulipart alternative email'); - $this->Mail->Subject .= ': AltBody + Word Wrap'; - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Simple HTML and attachment test - */ - public function testAltBodyAttachment() - { - $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.'; - $this->Mail->AltBody = 'This is the text part of the email.'; - $this->Mail->Subject .= ': AltBody + Attachment'; - $this->Mail->isHTML(true); - - if (!$this->Mail->addAttachment(__FILE__, 'test_attach.txt')) { - $this->assertTrue(false, $this->Mail->ErrorInfo); - return; - } - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * iCal event test. - */ - public function testIcal() - { - //Standalone ICS tests - require_once realpath(self::INCLUDE_DIR . 'extras/EasyPeasyICS.php'); - $ICS = new EasyPeasyICS("PHPMailer test calendar"); - $this->assertNotEmpty( - $ICS->addEvent( - strtotime('tomorrow 10:00 Europe/Paris'), - strtotime('tomorrow 11:00 Europe/Paris'), - 'PHPMailer iCal test', - 'A test of PHPMailer iCal support', - 'https://github.com/PHPMailer/PHPMailer' - ), - 'Generated event string is empty' - ); - $ICS->addEvent( - strtotime('tomorrow 10:00 Europe/Paris'), - strtotime('tomorrow 11:00 Europe/Paris'), - 'PHPMailer iCal test', - 'A test of PHPMailer iCal support', - 'https://github.com/PHPMailer/PHPMailer' - ); - $events = $ICS->getEvents(); - $this->assertEquals(2, count($events), 'Event count mismatch'); - $ICS->clearEvents(); - $events = $ICS->getEvents(); - $this->assertEquals(0, count($events), 'Event clearing failed'); - $ICS->setName('test'); - $this->assertEquals('test', $ICS->getName(), 'Setting ICS name failed'); - $this->assertNotEmpty($ICS->render(false), 'Empty calendar'); - //Need to test generated output but PHPUnit isn't playing nice - //$rendered = $ICS->render(); - - //Test sending an ICS - $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.'; - $this->Mail->AltBody = 'This is the text part of the email.'; - $this->Mail->Subject .= ': iCal'; - $this->Mail->isHTML(true); - $this->buildBody(); - $this->Mail->Ical = $ICS->render(false); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Test sending multiple messages with separate connections. - */ - public function testMultipleSend() - { - $this->Mail->Body = 'Sending two messages without keepalive'; - $this->buildBody(); - $subject = $this->Mail->Subject; - - $this->Mail->Subject = $subject . ': SMTP 1'; - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - - $this->Mail->Subject = $subject . ': SMTP 2'; - $this->Mail->Sender = 'blah@example.com'; - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Test sending using SendMail. - */ - public function testSendmailSend() - { - $this->Mail->Body = 'Sending via sendmail'; - $this->buildBody(); - $subject = $this->Mail->Subject; - - $this->Mail->Subject = $subject . ': sendmail'; - $this->Mail->isSendmail(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Test sending using Qmail. - */ - public function testQmailSend() - { - //Only run if we have qmail installed - if (file_exists('/var/qmail/bin/qmail-inject')) { - $this->Mail->Body = 'Sending via qmail'; - $this->BuildBody(); - $subject = $this->Mail->Subject; - - $this->Mail->Subject = $subject . ': qmail'; - $this->Mail->IsQmail(); - $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); - } else { - $this->markTestSkipped('Qmail is not installed'); - } - } - - /** - * Test sending using PHP mail() function. - */ - public function testMailSend() - { - $sendmail = ini_get('sendmail_path'); - //No path in sendmail_path - if (strpos($sendmail, '/') === false) { - ini_set('sendmail_path', '/usr/sbin/sendmail -t -i '); - } - $this->Mail->Body = 'Sending via mail()'; - $this->buildBody(); - - $this->Mail->Subject = $this->Mail->Subject . ': mail()'; - $this->Mail->isMail(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - $msg = $this->Mail->getSentMIMEMessage(); - $this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers'); - } - - /** - * Test sending an empty body. - */ - public function testEmptyBody() - { - $this->buildBody(); - $this->Mail->Body = ''; - $this->Mail->Subject = $this->Mail->Subject . ': Empty Body'; - $this->Mail->isMail(); - $this->Mail->AllowEmpty = true; - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - $this->Mail->AllowEmpty = false; - $this->assertFalse($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Test constructing a multipart message that contains lines that are too long for RFC compliance. - */ - public function testLongBody() - { - $oklen = str_repeat(str_repeat('0', PHPMailer::MAX_LINE_LENGTH) . PHPMailer::CRLF, 2); - $badlen = str_repeat(str_repeat('1', PHPMailer::MAX_LINE_LENGTH + 1) . PHPMailer::CRLF, 2); - - $this->Mail->Body = "This message contains lines that are too long.". - PHPMailer::CRLF . $oklen . $badlen . $oklen; - $this->assertTrue( - PHPMailer::hasLineLongerThanMax($this->Mail->Body), - 'Test content does not contain long lines!' - ); - $this->Mail->isHTML(); - $this->buildBody(); - $this->Mail->AltBody = $this->Mail->Body; - $this->Mail->Encoding = '8bit'; - $this->Mail->preSend(); - $message = $this->Mail->getSentMIMEMessage(); - $this->assertFalse(PHPMailer::hasLineLongerThanMax($message), 'Long line not corrected.'); - $this->assertContains( - 'Content-Transfer-Encoding: quoted-printable', - $message, - 'Long line did not cause transfer encoding switch.' - ); - } - - /** - * Test constructing a message that does NOT contain lines that are too long for RFC compliance. - */ - public function testShortBody() - { - $oklen = str_repeat(str_repeat('0', PHPMailer::MAX_LINE_LENGTH) . PHPMailer::CRLF, 10); - - $this->Mail->Body = "This message does not contain lines that are too long.". - PHPMailer::CRLF . $oklen; - $this->assertFalse( - PHPMailer::hasLineLongerThanMax($this->Mail->Body), - 'Test content contains long lines!' - ); - $this->buildBody(); - $this->Mail->Encoding = '8bit'; - $this->Mail->preSend(); - $message = $this->Mail->getSentMIMEMessage(); - $this->assertFalse(PHPMailer::hasLineLongerThanMax($message), 'Long line not corrected.'); - $this->assertNotContains( - 'Content-Transfer-Encoding: quoted-printable', - $message, - 'Short line caused transfer encoding switch.' - ); - } - - /** - * Test keepalive (sending multiple messages in a single connection). - */ - public function testSmtpKeepAlive() - { - $this->Mail->Body = 'SMTP keep-alive test.'; - $this->buildBody(); - $subject = $this->Mail->Subject; - - $this->Mail->SMTPKeepAlive = true; - $this->Mail->Subject = $subject . ': SMTP keep-alive 1'; - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - - $this->Mail->Subject = $subject . ': SMTP keep-alive 2'; - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - $this->Mail->smtpClose(); - } - - /** - * Tests this denial of service attack: - * @link http://www.cybsec.com/vuln/PHPMailer-DOS.pdf - */ - public function testDenialOfServiceAttack() - { - $this->Mail->Body = 'This should no longer cause a denial of service.'; - $this->buildBody(); - - $this->Mail->Subject = substr(str_repeat('0123456789', 100), 0, 998); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - } - - /** - * Tests this denial of service attack: - * @link https://sourceforge.net/p/phpmailer/bugs/383/ - * According to the ticket, this should get stuck in a loop, though I can't make it happen. - * @TODO No assertions in here - how can you assert for this? - */ - public function testDenialOfServiceAttack2() - { - //Encoding name longer than 68 chars - $this->Mail->Encoding = '1234567890123456789012345678901234567890123456789012345678901234567890'; - //Call wrapText with a zero length value - $this->Mail->wrapText(str_repeat('This should no longer cause a denial of service. ', 30), 0); - } - - /** - * Test error handling. - */ - public function testError() - { - $this->Mail->Subject .= ': Error handling test - this should be sent ok'; - $this->buildBody(); - $this->Mail->clearAllRecipients(); // no addresses should cause an error - $this->assertTrue($this->Mail->isError() == false, 'Error found'); - $this->assertTrue($this->Mail->send() == false, 'send succeeded'); - $this->assertTrue($this->Mail->isError(), 'No error found'); - $this->assertEquals('You must provide at least one recipient email address.', $this->Mail->ErrorInfo); - $this->Mail->addAddress($_REQUEST['mail_to']); - $this->assertTrue($this->Mail->send(), 'send failed'); - } - - /** - * Test addressing. - */ - public function testAddressing() - { - $this->assertFalse($this->Mail->addAddress(''), 'Empty address accepted'); - $this->assertFalse($this->Mail->addAddress('', 'Nobody'), 'Empty address with name accepted'); - $this->assertFalse($this->Mail->addAddress('a@example..com'), 'Invalid address accepted'); - $this->assertTrue($this->Mail->addAddress('a@example.com'), 'Addressing failed'); - $this->assertFalse($this->Mail->addAddress('a@example.com'), 'Duplicate addressing failed'); - $this->assertTrue($this->Mail->addCC('b@example.com'), 'CC addressing failed'); - $this->assertFalse($this->Mail->addCC('b@example.com'), 'CC duplicate addressing failed'); - $this->assertFalse($this->Mail->addCC('a@example.com'), 'CC duplicate addressing failed (2)'); - $this->assertTrue($this->Mail->addBCC('c@example.com'), 'BCC addressing failed'); - $this->assertFalse($this->Mail->addBCC('c@example.com'), 'BCC duplicate addressing failed'); - $this->assertFalse($this->Mail->addBCC('a@example.com'), 'BCC duplicate addressing failed (2)'); - $this->assertTrue($this->Mail->addReplyTo('a@example.com'), 'Replyto Addressing failed'); - $this->assertFalse($this->Mail->addReplyTo('a@example..com'), 'Invalid Replyto address accepted'); - $this->assertTrue($this->Mail->setFrom('a@example.com', 'some name'), 'setFrom failed'); - $this->assertFalse($this->Mail->setFrom('a@example.com.', 'some name'), 'setFrom accepted invalid address'); - $this->Mail->Sender = ''; - $this->Mail->setFrom('a@example.com', 'some name', true); - $this->assertEquals($this->Mail->Sender, 'a@example.com', 'setFrom failed to set sender'); - $this->Mail->Sender = ''; - $this->Mail->setFrom('a@example.com', 'some name', false); - $this->assertEquals($this->Mail->Sender, '', 'setFrom should not have set sender'); - $this->Mail->clearCCs(); - $this->Mail->clearBCCs(); - $this->Mail->clearReplyTos(); - } - - /** - * Test RFC822 address splitting. - */ - public function testAddressSplitting() - { - //Test built-in address parser - $this->assertCount( - 2, - $this->Mail->parseAddresses( - 'Joe User <joe@example.com>, Jill User <jill@example.net>' - ), - 'Failed to recognise address list (IMAP parser)' - ); - $this->assertEquals( - array( - array("name" => 'Joe User', 'address' => 'joe@example.com'), - array("name" => 'Jill User', 'address' => 'jill@example.net'), - array("name" => '', 'address' => 'frank@example.com'), - ), - $this->Mail->parseAddresses( - 'Joe User <joe@example.com>,' - . 'Jill User <jill@example.net>,' - . 'frank@example.com,' - ), - 'Parsed addresses' - ); - //Test simple address parser - $this->assertCount( - 2, - $this->Mail->parseAddresses( - 'Joe User <joe@example.com>, Jill User <jill@example.net>', - false - ), - 'Failed to recognise address list' - ); - //Test single address - $this->assertNotEmpty( - $this->Mail->parseAddresses( - 'Joe User <joe@example.com>', - false - ), - 'Failed to recognise single address' - ); - //Test quoted name IMAP - $this->assertNotEmpty( - $this->Mail->parseAddresses( - 'Tim "The Book" O\'Reilly <foo@example.com>' - ), - 'Failed to recognise quoted name (IMAP)' - ); - //Test quoted name - $this->assertNotEmpty( - $this->Mail->parseAddresses( - 'Tim "The Book" O\'Reilly <foo@example.com>', - false - ), - 'Failed to recognise quoted name' - ); - //Test single address IMAP - $this->assertNotEmpty( - $this->Mail->parseAddresses( - 'Joe User <joe@example.com>' - ), - 'Failed to recognise single address (IMAP)' - ); - //Test unnamed address - $this->assertNotEmpty( - $this->Mail->parseAddresses( - 'joe@example.com', - false - ), - 'Failed to recognise unnamed address' - ); - //Test unnamed address IMAP - $this->assertNotEmpty( - $this->Mail->parseAddresses( - 'joe@example.com' - ), - 'Failed to recognise unnamed address (IMAP)' - ); - //Test invalid addresses - $this->assertEmpty( - $this->Mail->parseAddresses( - 'Joe User <joe@example.com.>, Jill User <jill.@example.net>' - ), - 'Failed to recognise invalid addresses (IMAP)' - ); - //Test invalid addresses - $this->assertEmpty( - $this->Mail->parseAddresses( - 'Joe User <joe@example.com.>, Jill User <jill.@example.net>', - false - ), - 'Failed to recognise invalid addresses' - ); - } - - /** - * Test address escaping. - */ - public function testAddressEscaping() - { - $this->Mail->Subject .= ': Address escaping'; - $this->Mail->clearAddresses(); - $this->Mail->addAddress('foo@example.com', 'Tim "The Book" O\'Reilly'); - $this->Mail->Body = 'Test correct escaping of quotes in addresses.'; - $this->buildBody(); - $this->Mail->preSend(); - $b = $this->Mail->getSentMIMEMessage(); - $this->assertTrue((strpos($b, 'To: "Tim \"The Book\" O\'Reilly" <foo@example.com>') !== false)); - } - - /** - * Test MIME structure assembly. - */ - public function testMIMEStructure() - { - $this->Mail->Subject .= ': MIME structure'; - $this->Mail->Body = '<h3>MIME structure test.</h3>'; - $this->Mail->AltBody = 'MIME structure test.'; - $this->buildBody(); - $this->Mail->preSend(); - $this->assertRegExp( - "/Content-Transfer-Encoding: 8bit\r\n\r\n". - "This is a multi-part message in MIME format./", - $this->Mail->getSentMIMEMessage(), - 'MIME structure broken' - ); - } - - /** - * Test BCC-only addressing. - */ - public function testBCCAddressing() - { - $this->Mail->Subject .= ': BCC-only addressing'; - $this->buildBody(); - $this->Mail->clearAllRecipients(); - $this->assertTrue($this->Mail->addBCC('a@example.com'), 'BCC addressing failed'); - $this->assertTrue($this->Mail->send(), 'send failed'); - } - - /** - * Encoding and charset tests. - */ - public function testEncodings() - { - $this->Mail->CharSet = 'iso-8859-1'; - $this->assertEquals( - '=A1Hola!_Se=F1or!', - $this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'text'), - 'Q Encoding (text) failed' - ); - $this->assertEquals( - '=A1Hola!_Se=F1or!', - $this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'comment'), - 'Q Encoding (comment) failed' - ); - $this->assertEquals( - '=A1Hola!_Se=F1or!', - $this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'phrase'), - 'Q Encoding (phrase) failed' - ); - $this->Mail->CharSet = 'UTF-8'; - $this->assertEquals( - '=C2=A1Hola!_Se=C3=B1or!', - $this->Mail->encodeQ("\xc2\xa1Hola! Se\xc3\xb1or!", 'text'), - 'Q Encoding (text) failed' - ); - //Strings containing '=' are a special case - $this->assertEquals( - 'Nov=C3=A1=3D', - $this->Mail->encodeQ("Nov\xc3\xa1=", 'text'), - 'Q Encoding (text) failed 2' - ); - } - - /** - * Test base-64 encoding. - */ - public function testBase64() - { - $this->Mail->Subject .= ': Base-64 encoding'; - $this->Mail->Encoding = 'base64'; - $this->buildBody(); - $this->assertTrue($this->Mail->send(), 'Base64 encoding failed'); - } - /** - * S/MIME Signing tests (self-signed). - * @requires extension openssl - */ - public function testSigning() - { - $this->Mail->Subject .= ': S/MIME signing'; - $this->Mail->Body = 'This message is S/MIME signed.'; - $this->buildBody(); - - $dn = array( - 'countryName' => 'UK', - 'stateOrProvinceName' => 'Here', - 'localityName' => 'There', - 'organizationName' => 'PHP', - 'organizationalUnitName' => 'PHPMailer', - 'commonName' => 'PHPMailer Test', - 'emailAddress' => 'phpmailer@example.com' - ); - $keyconfig = array( - "digest_alg" => "sha256", - "private_key_bits" => 2048, - "private_key_type" => OPENSSL_KEYTYPE_RSA, - ); - $password = 'password'; - $certfile = 'certfile.pem'; - $keyfile = 'keyfile.pem'; - - //Make a new key pair - $pk = openssl_pkey_new($keyconfig); - //Create a certificate signing request - $csr = openssl_csr_new($dn, $pk); - //Create a self-signed cert - $cert = openssl_csr_sign($csr, null, $pk, 1); - //Save the cert - openssl_x509_export($cert, $certout); - file_put_contents($certfile, $certout); - //Save the key - openssl_pkey_export($pk, $pkeyout, $password); - file_put_contents($keyfile, $pkeyout); - - $this->Mail->sign( - $certfile, - $keyfile, - $password - ); - $this->assertTrue($this->Mail->send(), 'S/MIME signing failed'); - - $msg = $this->Mail->getSentMIMEMessage(); - $this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers'); - unlink($certfile); - unlink($keyfile); - } - - /** - * S/MIME Signing tests using a CA chain cert. - * To test that a generated message is signed correctly, save the message in a file - * and use openssl along with the certs generated by this script: - * `openssl smime -verify -in signed.eml -signer certfile.pem -CAfile cacertfile.pem` - * @requires extension openssl - */ - public function testSigningWithCA() - { - $this->Mail->Subject .= ': S/MIME signing with CA'; - $this->Mail->Body = 'This message is S/MIME signed with an extra CA cert.'; - $this->buildBody(); - - $certprops = array( - 'countryName' => 'UK', - 'stateOrProvinceName' => 'Here', - 'localityName' => 'There', - 'organizationName' => 'PHP', - 'organizationalUnitName' => 'PHPMailer', - 'commonName' => 'PHPMailer Test', - 'emailAddress' => 'phpmailer@example.com' - ); - $cacertprops = array( - 'countryName' => 'UK', - 'stateOrProvinceName' => 'Here', - 'localityName' => 'There', - 'organizationName' => 'PHP', - 'organizationalUnitName' => 'PHPMailer CA', - 'commonName' => 'PHPMailer Test CA', - 'emailAddress' => 'phpmailer@example.com' - ); - $keyconfig = array( - "digest_alg" => "sha256", - "private_key_bits" => 2048, - "private_key_type" => OPENSSL_KEYTYPE_RSA, - ); - $password = 'password'; - $cacertfile = 'cacertfile.pem'; - $cakeyfile = 'cakeyfile.pem'; - $certfile = 'certfile.pem'; - $keyfile = 'keyfile.pem'; - - //Create a CA cert - //Make a new key pair - $capk = openssl_pkey_new($keyconfig); - //Create a certificate signing request - $csr = openssl_csr_new($cacertprops, $capk); - //Create a self-signed cert - $cert = openssl_csr_sign($csr, null, $capk, 1); - //Save the CA cert - openssl_x509_export($cert, $certout); - file_put_contents($cacertfile, $certout); - //Save the CA key - openssl_pkey_export($capk, $pkeyout, $password); - file_put_contents($cakeyfile, $pkeyout); - - //Create a cert signed by our CA - //Make a new key pair - $pk = openssl_pkey_new($keyconfig); - //Create a certificate signing request - $csr = openssl_csr_new($certprops, $pk); - //Create a self-signed cert - $cert = openssl_csr_sign($csr, 'file://' . $cacertfile, $capk, 1); - //Save the cert - openssl_x509_export($cert, $certout); - file_put_contents($certfile, $certout); - //Save the key - openssl_pkey_export($pk, $pkeyout, $password); - file_put_contents($keyfile, $pkeyout); - - $this->Mail->sign( - $certfile, - $keyfile, - $password, - $cacertfile - ); - $this->assertTrue($this->Mail->send(), 'S/MIME signing with CA failed'); - unlink($cacertfile); - unlink($cakeyfile); - unlink($certfile); - unlink($keyfile); - } - - /** - * DKIM Signing tests. - * @requires extension openssl - */ - public function testDKIM() - { - $this->Mail->Subject .= ': DKIM signing'; - $this->Mail->Body = 'This message is DKIM signed.'; - $this->buildBody(); - $privatekeyfile = 'dkim_private.key'; - //Make a new key pair - //(2048 bits is the recommended minimum key length - - //gmail won't accept less than 1024 bits) - $pk = openssl_pkey_new( - array( - 'private_key_bits' => 2048, - 'private_key_type' => OPENSSL_KEYTYPE_RSA - ) - ); - openssl_pkey_export_to_file($pk, $privatekeyfile); - $this->Mail->DKIM_domain = 'example.com'; - $this->Mail->DKIM_private = $privatekeyfile; - $this->Mail->DKIM_selector = 'phpmailer'; - $this->Mail->DKIM_passphrase = ''; //key is not encrypted - $this->assertTrue($this->Mail->send(), 'DKIM signed mail failed'); - unlink($privatekeyfile); - } - - /** - * Test line break reformatting. - */ - public function testLineBreaks() - { - $unixsrc = "hello\nWorld\nAgain\n"; - $macsrc = "hello\rWorld\rAgain\r"; - $windowssrc = "hello\r\nWorld\r\nAgain\r\n"; - $mixedsrc = "hello\nWorld\rAgain\r\n"; - $target = "hello\r\nWorld\r\nAgain\r\n"; - $this->assertEquals($target, PHPMailer::normalizeBreaks($unixsrc), 'UNIX break reformatting failed'); - $this->assertEquals($target, PHPMailer::normalizeBreaks($macsrc), 'Mac break reformatting failed'); - $this->assertEquals($target, PHPMailer::normalizeBreaks($windowssrc), 'Windows break reformatting failed'); - $this->assertEquals($target, PHPMailer::normalizeBreaks($mixedsrc), 'Mixed break reformatting failed'); - } - - /** - * Test line length detection - */ - public function testLineLength() - { - $oklen = str_repeat(str_repeat('0', PHPMailer::MAX_LINE_LENGTH)."\r\n", 2); - $badlen = str_repeat(str_repeat('1', PHPMailer::MAX_LINE_LENGTH + 1) . "\r\n", 2); - $this->assertTrue(PHPMailer::hasLineLongerThanMax($badlen), 'Long line not detected (only)'); - $this->assertTrue(PHPMailer::hasLineLongerThanMax($oklen . $badlen), 'Long line not detected (first)'); - $this->assertTrue(PHPMailer::hasLineLongerThanMax($badlen . $oklen), 'Long line not detected (last)'); - $this->assertTrue( - PHPMailer::hasLineLongerThanMax($oklen . $badlen . $oklen), - 'Long line not detected (middle)' - ); - $this->assertFalse(PHPMailer::hasLineLongerThanMax($oklen), 'Long line false positive'); - $this->Mail->isHTML(false); - $this->Mail->Subject .= ": Line length test"; - $this->Mail->CharSet = 'UTF-8'; - $this->Mail->Encoding = '8bit'; - $this->Mail->Body = $oklen . $badlen . $oklen . $badlen; - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - $this->assertEquals('quoted-printable', $this->Mail->Encoding, 'Long line did not override transfer encoding'); - } - - /** - * Test setting and retrieving message ID. - */ - public function testMessageID() - { - $this->Mail->Body = 'Test message ID.'; - $id = md5(12345); - $this->Mail->MessageID = $id; - $this->buildBody(); - $this->Mail->preSend(); - $lastid = $this->Mail->getLastMessageID(); - $this->assertNotEquals($lastid, $id, 'Invalid Message ID allowed'); - $id = '<'.md5(12345).'@example.com>'; - $this->Mail->MessageID = $id; - $this->buildBody(); - $this->Mail->preSend(); - $lastid = $this->Mail->getLastMessageID(); - $this->assertEquals($lastid, $id, 'Custom Message ID not used'); - $this->Mail->MessageID = ''; - $this->buildBody(); - $this->Mail->preSend(); - $lastid = $this->Mail->getLastMessageID(); - $this->assertRegExp('/^<.*@.*>$/', $lastid, 'Invalid default Message ID'); - } - - /** - * Miscellaneous calls to improve test coverage and some small tests. - */ - public function testMiscellaneous() - { - $this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed'); - $this->Mail->addCustomHeader('SomeHeader: Some Value'); - $this->Mail->clearCustomHeaders(); - $this->Mail->clearAttachments(); - $this->Mail->isHTML(false); - $this->Mail->isSMTP(); - $this->Mail->isMail(); - $this->Mail->isSendmail(); - $this->Mail->isQmail(); - $this->Mail->setLanguage('fr'); - $this->Mail->Sender = ''; - $this->Mail->createHeader(); - $this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded'); - $this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed'); - $this->assertTrue($this->Mail->set('AllowEmpty', null), 'Null property set failed'); - $this->assertTrue($this->Mail->set('AllowEmpty', false), 'Valid property set of null property failed'); - //Test pathinfo - $a = '/mnt/files/飛兒樂 團光茫.mp3'; - $q = PHPMailer::mb_pathinfo($a); - $this->assertEquals($q['dirname'], '/mnt/files', 'UNIX dirname not matched'); - $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'UNIX basename not matched'); - $this->assertEquals($q['extension'], 'mp3', 'UNIX extension not matched'); - $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'UNIX filename not matched'); - $this->assertEquals( - PHPMailer::mb_pathinfo($a, PATHINFO_DIRNAME), - '/mnt/files', - 'Dirname path element not matched' - ); - $this->assertEquals(PHPMailer::mb_pathinfo($a, 'filename'), '飛兒樂 團光茫', 'Filename path element not matched'); - $a = 'c:\mnt\files\飛兒樂 團光茫.mp3'; - $q = PHPMailer::mb_pathinfo($a); - $this->assertEquals($q['dirname'], 'c:\mnt\files', 'Windows dirname not matched'); - $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'Windows basename not matched'); - $this->assertEquals($q['extension'], 'mp3', 'Windows extension not matched'); - $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'Windows filename not matched'); - } - public function testBadSMTP() - { - $this->Mail->smtpConnect(); - $smtp = $this->Mail->getSMTPInstance(); - $this->assertFalse($smtp->mail("somewhere\nbad"), 'Bad SMTP command containing breaks accepted'); - } - - /** - * Tests the Custom header getter - */ - public function testCustomHeaderGetter() - { - $this->Mail->addCustomHeader('foo', 'bar'); - $this->assertEquals(array(array('foo', 'bar')), $this->Mail->getCustomHeaders()); - - $this->Mail->addCustomHeader('foo', 'baz'); - $this->assertEquals(array( - array('foo', 'bar'), - array('foo', 'baz') - ), $this->Mail->getCustomHeaders()); - - $this->Mail->clearCustomHeaders(); - $this->assertEmpty($this->Mail->getCustomHeaders()); - - $this->Mail->addCustomHeader('yux'); - $this->assertEquals(array(array('yux')), $this->Mail->getCustomHeaders()); - - $this->Mail->addCustomHeader('Content-Type: application/json'); - $this->assertEquals(array( - array('yux'), - array('Content-Type', ' application/json') - ), $this->Mail->getCustomHeaders()); - } - - /** - * Tests setting and retrieving ConfirmReadingTo address, also known as "read receipt" address. - */ - public function testConfirmReadingTo() - { - $this->Mail->CharSet = 'utf-8'; - $this->buildBody(); - - $this->Mail->ConfirmReadingTo = 'test@example..com'; //Invalid address - $this->assertFalse($this->Mail->send(), $this->Mail->ErrorInfo); - - $this->Mail->ConfirmReadingTo = ' test@example.com'; //Extra space to trim - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - $this->assertEquals( - 'test@example.com', - $this->Mail->ConfirmReadingTo, - 'Unexpected read receipt address'); - - $this->Mail->ConfirmReadingTo = 'test@françois.ch'; //Address with IDN - if ($this->Mail->idnSupported()) { - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - $this->assertEquals( - 'test@xn--franois-xxa.ch', - $this->Mail->ConfirmReadingTo, - 'IDN address not converted to punycode'); - } else { - $this->assertFalse($this->Mail->send(), $this->Mail->ErrorInfo); - } - } - - /** - * Tests CharSet and Unicode -> ASCII conversions for addresses with IDN. - */ - public function testConvertEncoding() - { - if (!$this->Mail->idnSupported()) { - $this->markTestSkipped('intl and/or mbstring extensions are not available'); - } - - $this->Mail->clearAllRecipients(); - $this->Mail->clearReplyTos(); - - // This file is UTF-8 encoded. Create a domain encoded in "iso-8859-1". - $domain = '@' . mb_convert_encoding('françois.ch', 'ISO-8859-1', 'UTF-8'); - $this->Mail->addAddress('test' . $domain); - $this->Mail->addCC('test+cc' . $domain); - $this->Mail->addBCC('test+bcc' . $domain); - $this->Mail->addReplyTo('test+replyto' . $domain); - - // Queued addresses are not returned by get*Addresses() before send() call. - $this->assertEmpty($this->Mail->getToAddresses(), 'Bad "to" recipients'); - $this->assertEmpty($this->Mail->getCcAddresses(), 'Bad "cc" recipients'); - $this->assertEmpty($this->Mail->getBccAddresses(), 'Bad "bcc" recipients'); - $this->assertEmpty($this->Mail->getReplyToAddresses(), 'Bad "reply-to" recipients'); - - // Clear queued BCC recipient. - $this->Mail->clearBCCs(); - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - - // Addresses with IDN are returned by get*Addresses() after send() call. - $domain = $this->Mail->punyencodeAddress($domain); - $this->assertEquals( - array(array('test' . $domain, '')), - $this->Mail->getToAddresses(), - 'Bad "to" recipients'); - $this->assertEquals( - array(array('test+cc' . $domain, '')), - $this->Mail->getCcAddresses(), - 'Bad "cc" recipients'); - $this->assertEmpty($this->Mail->getBccAddresses(), 'Bad "bcc" recipients'); - $this->assertEquals( - array('test+replyto' . $domain => array('test+replyto' . $domain, '')), - $this->Mail->getReplyToAddresses(), - 'Bad "reply-to" addresses'); - } - - /** - * Tests removal of duplicate recipients and reply-tos. - */ - public function testDuplicateIDNRemoved() - { - if (!$this->Mail->idnSupported()) { - $this->markTestSkipped('intl and/or mbstring extensions are not available'); - } - - $this->Mail->clearAllRecipients(); - $this->Mail->clearReplyTos(); - - $this->Mail->CharSet = 'utf-8'; - - $this->assertTrue($this->Mail->addAddress('test@françois.ch')); - $this->assertFalse($this->Mail->addAddress('test@françois.ch')); - $this->assertTrue($this->Mail->addAddress('test@FRANÇOIS.CH')); - $this->assertFalse($this->Mail->addAddress('test@FRANÇOIS.CH')); - $this->assertTrue($this->Mail->addAddress('test@xn--franois-xxa.ch')); - $this->assertFalse($this->Mail->addAddress('test@xn--franois-xxa.ch')); - $this->assertFalse($this->Mail->addAddress('test@XN--FRANOIS-XXA.CH')); - - $this->assertTrue($this->Mail->addReplyTo('test+replyto@françois.ch')); - $this->assertFalse($this->Mail->addReplyTo('test+replyto@françois.ch')); - $this->assertTrue($this->Mail->addReplyTo('test+replyto@FRANÇOIS.CH')); - $this->assertFalse($this->Mail->addReplyTo('test+replyto@FRANÇOIS.CH')); - $this->assertTrue($this->Mail->addReplyTo('test+replyto@xn--franois-xxa.ch')); - $this->assertFalse($this->Mail->addReplyTo('test+replyto@xn--franois-xxa.ch')); - $this->assertFalse($this->Mail->addReplyTo('test+replyto@XN--FRANOIS-XXA.CH')); - - $this->buildBody(); - $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); - - // There should be only one "To" address and one "Reply-To" address. - $this->assertEquals( - 1, - count($this->Mail->getToAddresses()), - 'Bad count of "to" recipients'); - $this->assertEquals( - 1, - count($this->Mail->getReplyToAddresses()), - 'Bad count of "reply-to" addresses'); - } - - /** - * Use a fake POP3 server to test POP-before-SMTP auth. - * With a known-good login - */ - public function testPopBeforeSmtpGood() - { - //Start a fake POP server - $pid = shell_exec('nohup ./runfakepopserver.sh >/dev/null 2>/dev/null & printf "%u" $!'); - $this->pids[] = $pid; - - sleep(2); - //Test a known-good login - $this->assertTrue( - POP3::popBeforeSmtp('localhost', 1100, 10, 'user', 'test', $this->Mail->SMTPDebug), - 'POP before SMTP failed' - ); - //Kill the fake server - shell_exec('kill -TERM ' . escapeshellarg($pid)); - sleep(2); - } - - /** - * Use a fake POP3 server to test POP-before-SMTP auth - * with a known-bad login. - */ - public function testPopBeforeSmtpBad() - { - //Start a fake POP server on a different port - //so we don't inadvertently connect to the previous instance - $pid = shell_exec('nohup ./runfakepopserver.sh 1101 >/dev/null 2>/dev/null & printf "%u" $!'); - $this->pids[] = $pid; - - sleep(2); - //Test a known-bad login - $this->assertFalse( - POP3::popBeforeSmtp('localhost', 1101, 10, 'user', 'xxx', $this->Mail->SMTPDebug), - 'POP before SMTP should have failed' - ); - shell_exec('kill -TERM ' . escapeshellarg($pid)); - sleep(2); - } - - /** - * Test SMTP host connections. - * This test can take a long time, so run it last - */ - public function testSmtpConnect() - { - $this->Mail->SMTPDebug = 4; //Show connection-level errors - $this->assertTrue($this->Mail->smtpConnect(), 'SMTP single connect failed'); - $this->Mail->smtpClose(); - $this->Mail->Host = "ssl://localhost:12345;tls://localhost:587;10.10.10.10:54321;localhost:12345;10.10.10.10"; - $this->assertFalse($this->Mail->smtpConnect(), 'SMTP bad multi-connect succeeded'); - $this->Mail->smtpClose(); - $this->Mail->Host = "localhost:12345;10.10.10.10:54321;" . $_REQUEST['mail_host']; - $this->assertTrue($this->Mail->smtpConnect(), 'SMTP multi-connect failed'); - $this->Mail->smtpClose(); - $this->Mail->Host = " localhost:12345 ; " . $_REQUEST['mail_host'] . ' '; - $this->assertTrue($this->Mail->smtpConnect(), 'SMTP hosts with stray spaces failed'); - $this->Mail->smtpClose(); - $this->Mail->Host = $_REQUEST['mail_host']; - //Need to pick a harmless option so as not cause problems of its own! socket:bind doesn't work with Travis-CI - $this->assertTrue( - $this->Mail->smtpConnect(array('ssl' => array('verify_depth' => 10))), - 'SMTP connect with options failed' - ); - } -} - -/** - * This is a sample form for setting appropriate test values through a browser - * These values can also be set using a file called testbootstrap.php (not in repo) in the same folder as this script - * which is probably more useful if you run these tests a lot - * <html> - * <body> - * <h3>phpmailer Unit Test</h3> - * By entering a SMTP hostname it will automatically perform tests with SMTP. - * - * <form name="phpmailer_unit" action=__FILE__ method="get"> - * <input type="hidden" name="submitted" value="1"/> - * From Address: <input type="text" size="50" name="mail_from" value="<?php echo get("mail_from"); ?>"/> - * <br/> - * To Address: <input type="text" size="50" name="mail_to" value="<?php echo get("mail_to"); ?>"/> - * <br/> - * Cc Address: <input type="text" size="50" name="mail_cc" value="<?php echo get("mail_cc"); ?>"/> - * <br/> - * SMTP Hostname: <input type="text" size="50" name="mail_host" value="<?php echo get("mail_host"); ?>"/> - * <p/> - * <input type="submit" value="Run Test"/> - * - * </form> - * </body> - * </html> - */
@@ -1,10 +0,0 @@
-#!/usr/bin/env bash - -# Run the fake pop server from bash -# Idea from http://blog.ale-re.net/2007/09/ipersimple-remote-shell-with-netcat.html -# Defaults to port 1100 so it can be run by unpriv users and not clash with a real server -# Optionally, pass in a port number as the first arg - -mkfifo fifo -nc -l ${1:-1100} <fifo |bash ./fakepopserver.sh >fifo -rm fifo
@@ -1,81 +0,0 @@
-<html> -<head> - <title>PHPMailer Lite - DKIM and Callback Function test</title> -</head> -<body> - -<?php -/* This is a sample callback function for PHPMailer Lite. - * This callback function will echo the results of PHPMailer processing. - */ - -/* Callback (action) function - * boolean $result result of the send action - * string $to email address of the recipient - * string $cc cc email addresses - * string $bcc bcc email addresses - * string $subject the subject - * string $body the email body - * @return boolean - */ -function callbackAction($result, $to, $cc, $bcc, $subject, $body) -{ - /* - this callback example echos the results to the screen - implement to - post to databases, build CSV log files, etc., with minor changes - */ - $to = cleanEmails($to, 'to'); - $cc = cleanEmails($cc[0], 'cc'); - $bcc = cleanEmails($bcc[0], 'cc'); - echo $result . "\tTo: " . $to['Name'] . "\tTo: " . $to['Email'] . "\tCc: " . $cc['Name'] . - "\tCc: " . $cc['Email'] . "\tBcc: " . $bcc['Name'] . "\tBcc: " . $bcc['Email'] . - "\t" . $subject . "\n\n". $body . "\n"; - return true; -} - -require_once '../PHPMailerAutoload.php'; -$mail = new PHPMailer(); - -try { - $mail->isMail(); - $mail->setFrom('you@example.com', 'Your Name'); - $mail->addAddress('another@example.com', 'John Doe'); - $mail->Subject = 'PHPMailer Test Subject'; - $mail->msgHTML(file_get_contents('../examples/contents.html')); - // optional - msgHTML will create an alternate automatically - $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; - $mail->addAttachment('../examples/images/phpmailer.png'); // attachment - $mail->addAttachment('../examples/images/phpmailer_mini.png'); // attachment - $mail->action_function = 'callbackAction'; - $mail->send(); - echo "Message Sent OK</p>\n"; -} catch (phpmailerException $e) { - echo $e->errorMessage(); //Pretty error messages from PHPMailer -} catch (Exception $e) { - echo $e->getMessage(); //Boring error messages from anything else! -} - -function cleanEmails($str, $type) -{ - if ($type == 'cc') { - $addy['Email'] = $str[0]; - $addy['Name'] = $str[1]; - return $addy; - } - if (!strstr($str, ' <')) { - $addy['Name'] = ''; - $addy['Email'] = $addy; - return $addy; - } - $addyArr = explode(' <', $str); - if (substr($addyArr[1], -1) == '>') { - $addyArr[1] = substr($addyArr[1], 0, -1); - } - $addy['Name'] = $addyArr[0]; - $addy['Email'] = $addyArr[1]; - $addy['Email'] = str_replace('@', '@', $addy['Email']); - return $addy; -} -?> -</body> -</html>
@@ -1,7 +0,0 @@
-<?php -$_REQUEST['submitted'] = 1; -$_REQUEST['mail_to'] = 'somebody@example.com'; -$_REQUEST['mail_from'] = 'phpunit@example.com'; -$_REQUEST['mail_cc'] = 'cc@example.com'; -$_REQUEST['mail_host'] = 'localhost'; -$_REQUEST['mail_port'] = 2500;
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?> -<phpunit - verbose="false" - stopOnError="false" - stopOnFailure="false" - stopOnIncomplete="false" - stopOnSkipped="false" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - colors="false" - forceCoversAnnotation="false" - processIsolation="false"> - <testsuites> - <testsuite name="PHPMailer Tests"> - <directory>./test/</directory> - </testsuite> - </testsuites> - <filter> - <blacklist> - <directory suffix=".php">./extras</directory> - </blacklist> - </filter> - <groups> - <exclude> - <group>languages</group> - </exclude> - </groups> - <logging> - <log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/> - <log type="coverage-clover" target="build/logs/clover.xml"/> - <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/> - </logging> -</phpunit>
@@ -1,15 +0,0 @@
-language: php -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - hhvm -matrix: - allow_failures: - - php: hhvm - - php: 7.0 -branches: - except: - - one-dot-two
@@ -1,26 +0,0 @@
-Copyright (c) 2004-2007, Ryan Parman and Geoffrey Sneddon. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of - conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this list - of conditions and the following disclaimer in the documentation and/or other materials - provided with the distribution. - - * Neither the name of the SimplePie Team nor the names of its contributors may be used - to endorse or promote products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS -OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS -AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE.
@@ -1,117 +0,0 @@
-SimplePie -========= - -SimplePie is a very fast and easy-to-use class, written in PHP, that puts the -'simple' back into 'really simple syndication'. Flexible enough to suit -beginners and veterans alike, SimplePie is focused on [speed, ease of use, -compatibility and standards compliance][what_is]. - -[what_is]: http://simplepie.org/wiki/faq/what_is_simplepie - - -Requirements ------------- -* PHP 5.2.0 or newer -* libxml2 (certain 2.7.x releases are too buggy for words, and will crash) -* Either the iconv or mbstring extension -* cURL or fsockopen() -* PCRE support - -If you're looking for PHP 4.x support, pull the "one-dot-two" branch, as that's -the last version to support PHP 4.x. - - -What comes in the package? --------------------------- -1. `library/` - SimplePie classes for use with the autoloader -2. `autoloader.php` - The SimplePie Autoloader if you want to use the separate - file version. -3. `README.markdown` - This document. -4. `LICENSE.txt` - A copy of the BSD license. -5. `compatibility_test/` - The SimplePie compatibility test that checks your - server for required settings. -6. `demo/` - A basic feed reader demo that shows off some of SimplePie's more - noticeable features. -7. `idn/` - A third-party library that SimplePie can optionally use to - understand Internationalized Domain Names (IDNs). -8. `build/` - Scripts related to generating pieces of SimplePie -9. `test/` - SimplePie's unit test suite. - -### Where's `simplepie.inc`? -Since SimplePie 1.3, we've split the classes into separate files to make it easier -to maintain and use. - -If you'd like a single monolithic file, you can run `php build/compile.php` to -generate `SimplePie.compiled.php`, or grab a copy from -[dev.simplepie.org][dev_compiled] (this is kept up-to-date with the latest -code from Git). - -[dev_compiled]: http://dev.simplepie.org/SimplePie.compiled.php - - -To start the demo ------------------ -1. Upload this package to your webserver. -2. Make sure that the cache folder inside of the demo folder is server-writable. -3. Navigate your browser to the demo folder. - - -Need support? -------------- -For further setup and install documentation, function references, etc., visit -[the wiki][wiki]. If you're using the latest version off GitHub, you can also -check out the [API documentation][]. - -If you can't find an answer to your question in the documentation, head on over -to one of our [support channels][]. For bug reports and feature requests, visit -the [issue tracker][]. - -[API documentation]: http://dev.simplepie.org/api/ -[wiki]: http://simplepie.org/wiki/ -[support channels]: http://simplepie.org/support/ -[issue tracker]: http://github.com/simplepie/simplepie/issues - - -Project status --------------- -SimplePie is currently maintained by Ryan McCue. - -As an open source project, SimplePie is maintained on a somewhat sporadic basis. -This means that feature requests may not be fulfilled straight away, as time has -to be prioritized. - -If you'd like to contribute to SimplePie, the best way to get started is to fork -the project on GitHub and send pull requests for patches. When doing so, please -be aware of our [coding standards][]. - -[coding standards]: http://simplepie.org/wiki/misc/coding_standards - - -Authors and contributors ------------------------- -### Current -* [Ryan McCue][] (Maintainer, support) - -### Alumni -* [Ryan Parman][] (Creator, developer, evangelism, support) -* [Geoffrey Sneddon][] (Lead developer) -* [Michael Shipley][] (Submitter of patches, support) -* [Steve Minutillo][] (Submitter of patches) - -[Ryan McCue]: http://ryanmccue.info -[Ryan Parman]: http://ryanparman.com -[Geoffrey Sneddon]: http://gsnedders.com -[Michael Shipley]: http://michaelpshipley.com -[Steve Minutillo]: http://minutillo.com/steve/ - - -### Contributors -For a complete list of contributors: - -1. Pull down the latest SimplePie code -2. In the `simplepie` directory, run `git shortlog -ns` - - -License -------- -[New BSD license](http://www.opensource.org/licenses/BSD-3-Clause)
@@ -1,85 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - - -// autoloader -spl_autoload_register(array(new SimplePie_Autoloader(), 'autoload')); - -if (!class_exists('SimplePie')) -{ - trigger_error('Autoloader not registered properly', E_USER_ERROR); -} - -/** - * Autoloader class - * - * @package SimplePie - * @subpackage API - */ -class SimplePie_Autoloader -{ - /** - * Constructor - */ - public function __construct() - { - $this->path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'library'; - } - - /** - * Autoloader - * - * @param string $class The name of the class to attempt to load. - */ - public function autoload($class) - { - // Only load the class if it starts with "SimplePie" - if (strpos($class, 'SimplePie') !== 0) - { - return; - } - - $filename = $this->path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; - include $filename; - } -}
@@ -1,34 +0,0 @@
-{ - "name": "simplepie/simplepie", - "description": "A simple Atom/RSS parsing library for PHP", - "type": "library", - "keywords": ["rss", "atom", "feeds"], - "homepage": "http://simplepie.org/", - "license": "BSD-3-Clause", - "authors": [ - { - "name": "Ryan Parman", - "homepage": "http://ryanparman.com/", - "role": "Creator, alumnus developer" - }, - { - "name": "Geoffrey Sneddon", - "homepage": "http://gsnedders.com/", - "role": "Alumnus developer" - }, - { - "name": "Ryan McCue", - "email": "me@ryanmccue.info", - "homepage": "http://ryanmccue.info/", - "role": "Developer" - } - ], - "require": { - "php": ">=5.3.0" - }, - "autoload": { - "psr-0": { - "SimplePie": "library" - } - } -}
@@ -1,40 +0,0 @@
-/* SQLite */ -CREATE TABLE cache_data ( - id TEXT NOT NULL, - items SMALLINT NOT NULL DEFAULT 0, - data BLOB NOT NULL, - mtime INTEGER UNSIGNED NOT NULL -); -CREATE UNIQUE INDEX id ON cache_data(id); - -CREATE TABLE items ( - feed_id TEXT NOT NULL, - id TEXT NOT NULL, - data TEXT NOT NULL, - posted INTEGER UNSIGNED NOT NULL -); -CREATE INDEX feed_id ON items(feed_id); - - -/* MySQL */ ---- Don't paste this to create tables, since SimplePie will create ---- tables by its own. -CREATE TABLE `cache_data` ( - `id` TEXT CHARACTER SET utf8 NOT NULL, - `items` SMALLINT NOT NULL DEFAULT 0, - `data` BLOB NOT NULL, - `mtime` INT UNSIGNED NOT NULL, - UNIQUE ( - `id`(125) - ) -); - -CREATE TABLE `items` ( - `feed_id` TEXT CHARACTER SET utf8 NOT NULL, - `id` TEXT CHARACTER SET utf8 NOT NULL, - `data` MEDIUMBLOB NOT NULL, - `posted` INT UNSIGNED NOT NULL, - INDEX `feed_id` ( - `feed_id`(125) - ) -);
@@ -1,502 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it!
@@ -1,123 +0,0 @@
-******************************************************************************* -* * -* IDNA Convert (idna_convert.class.php) * -* * -* http://idnaconv.phlymail.de mailto:phlymail@phlylabs.de * -******************************************************************************* -* (c) 2004-2007 phlyLabs, Berlin * -* This file is encoded in UTF-8 * -******************************************************************************* - -Introduction ------------- - -The class idna_convert allows to convert internationalized domain names -(see RFC 3490, 3491, 3492 and 3454 for detials) as they can be used with various -registries worldwide to be translated between their original (localized) form -and their encoded form as it will be used in the DNS (Domain Name System). - -The class provides two public methods, encode() and decode(), which do exactly -what you would expect them to do. You are allowed to use complete domain names, -simple strings and complete email addresses as well. That means, that you might -use any of the following notations: - -- www.nörgler.com -- xn--nrgler-wxa -- xn--brse-5qa.xn--knrz-1ra.info - -Errors, incorrectly encoded or invalid strings will lead to either a FALSE -response (when in strict mode) or to only partially converted strings. -You can query the occured error by calling the method get_last_error(). - -Unicode strings are expected to be either UTF-8 strings, UCS-4 strings or UCS-4 -arrays. The default format is UTF-8. For setting different encodings, you can -call the method setParams() - please see the inline documentation for details. -ACE strings (the Punycode form) are always 7bit ASCII strings. - -ATTENTION: We no longer supply the PHP5 version of the class. It is not -necessary for achieving a successfull conversion, since the supplied PHP code is -compatible with both PHP4 and PHP5. We expect to see no compatibility issues -with the upcoming PHP6, too. - - -Files ------ - -idna_convert.class.php - The actual class -idna_convert.create.npdata.php - Useful for (re)creating the NPData file -npdata.ser - Serialized data for NamePrep -example.php - An example web page for converting -ReadMe.txt - This file -LICENCE - The LGPL licence file - -The class is contained in idna_convert.class.php. -MAKE SURE to copy the npdata.ser file into the same folder as the class file -itself! - - -Examples --------- - -1. Say we wish to encode the domain name nörgler.com: - -// Include the class -include_once('idna_convert.class.php'); -// Instantiate it * -$IDN = new idna_convert(); -// The input string, if input is not UTF-8 or UCS-4, it must be converted before -$input = utf8_encode('nörgler.com'); -// Encode it to its punycode presentation -$output = $IDN->encode($input); -// Output, what we got now -echo $output; // This will read: xn--nrgler-wxa.com - - -2. We received an email from a punycoded domain and are willing to learn, how - the domain name reads originally - -// Include the class -include_once('idna_convert.class.php'); -// Instantiate it (depending on the version you are using) with -$IDN = new idna_convert(); -// The input string -$input = 'andre@xn--brse-5qa.xn--knrz-1ra.info'; -// Encode it to its punycode presentation -$output = $IDN->decode($input); -// Output, what we got now, if output should be in a format different to UTF-8 -// or UCS-4, you will have to convert it before outputting it -echo utf8_decode($output); // This will read: andre@börse.knörz.info - - -3. The input is read from a UCS-4 coded file and encoded line by line. By - appending the optional second parameter we tell enode() about the input - format to be used - -// Include the class -include_once('idna_convert.class.php'); -// Instantiate it -$IDN = new dinca_convert(); -// Iterate through the input file line by line -foreach (file('ucs4-domains.txt') as $line) { - echo $IDN->encode(trim($line), 'ucs4_string'); - echo "\n"; -} - - -NPData ------- - -Should you need to recreate the npdata.ser file, which holds all necessary translation -tables in a serialized format, you can run the file idna_convert.create.npdata.php, which -creates the file for you and stores it in the same folder, where it is placed. -Should you need to do changes to the tables you can do so, but beware of the consequences. - - -Contact us ----------- - -In case of errors, bugs, questions, wishes, please don't hesitate to contact us -under the email address above. - -The team of phlyLabs -http://phlylabs.de -mailto:phlymail@phlylabs.de
@@ -1,969 +0,0 @@
-<?php -// {{{ license - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */ -// -// +----------------------------------------------------------------------+ -// | This library is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU Lesser General Public License as | -// | published by the Free Software Foundation; either version 2.1 of the | -// | License, or (at your option) any later version. | -// | | -// | This library is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | Lesser General Public License for more details. | -// | | -// | You should have received a copy of the GNU Lesser General Public | -// | License along with this library; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | -// | USA. | -// +----------------------------------------------------------------------+ -// - -// }}} - -/** - * Encode/decode Internationalized Domain Names. - * - * The class allows to convert internationalized domain names - * (see RFC 3490 for details) as they can be used with various registries worldwide - * to be translated between their original (localized) form and their encoded form - * as it will be used in the DNS (Domain Name System). - * - * The class provides two public methods, encode() and decode(), which do exactly - * what you would expect them to do. You are allowed to use complete domain names, - * simple strings and complete email addresses as well. That means, that you might - * use any of the following notations: - * - * - www.nörgler.com - * - xn--nrgler-wxa - * - xn--brse-5qa.xn--knrz-1ra.info - * - * Unicode input might be given as either UTF-8 string, UCS-4 string or UCS-4 - * array. Unicode output is available in the same formats. - * You can select your preferred format via {@link set_paramter()}. - * - * ACE input and output is always expected to be ASCII. - * - * @author Matthias Sommerfeld <mso@phlylabs.de> - * @copyright 2004-2007 phlyLabs Berlin, http://phlylabs.de - * @version 0.5.1 - * - */ -class idna_convert -{ - /** - * Holds all relevant mapping tables, loaded from a seperate file on construct - * See RFC3454 for details - * - * @var array - * @access private - */ - var $NP = array(); - - // Internal settings, do not mess with them - var $_punycode_prefix = 'xn--'; - var $_invalid_ucs = 0x80000000; - var $_max_ucs = 0x10FFFF; - var $_base = 36; - var $_tmin = 1; - var $_tmax = 26; - var $_skew = 38; - var $_damp = 700; - var $_initial_bias = 72; - var $_initial_n = 0x80; - var $_sbase = 0xAC00; - var $_lbase = 0x1100; - var $_vbase = 0x1161; - var $_tbase = 0x11A7; - var $_lcount = 19; - var $_vcount = 21; - var $_tcount = 28; - var $_ncount = 588; // _vcount * _tcount - var $_scount = 11172; // _lcount * _tcount * _vcount - var $_error = false; - - // See {@link set_paramter()} for details of how to change the following - // settings from within your script / application - var $_api_encoding = 'utf8'; // Default input charset is UTF-8 - var $_allow_overlong = false; // Overlong UTF-8 encodings are forbidden - var $_strict_mode = false; // Behave strict or not - - // The constructor - function idna_convert($options = false) - { - $this->slast = $this->_sbase + $this->_lcount * $this->_vcount * $this->_tcount; - if (function_exists('file_get_contents')) { - $this->NP = unserialize(file_get_contents(dirname(__FILE__).'/npdata.ser')); - } else { - $this->NP = unserialize(join('', file(dirname(__FILE__).'/npdata.ser'))); - } - // If parameters are given, pass these to the respective method - if (is_array($options)) { - return $this->set_parameter($options); - } - return true; - } - - /** - * Sets a new option value. Available options and values: - * [encoding - Use either UTF-8, UCS4 as array or UCS4 as string as input ('utf8' for UTF-8, - * 'ucs4_string' and 'ucs4_array' respectively for UCS4); The output is always UTF-8] - * [overlong - Unicode does not allow unnecessarily long encodings of chars, - * to allow this, set this parameter to true, else to false; - * default is false.] - * [strict - true: strict mode, good for registration purposes - Causes errors - * on failures; false: loose mode, ideal for "wildlife" applications - * by silently ignoring errors and returning the original input instead - * - * @param mixed Parameter to set (string: single parameter; array of Parameter => Value pairs) - * @param string Value to use (if parameter 1 is a string) - * @return boolean true on success, false otherwise - * @access public - */ - function set_parameter($option, $value = false) - { - if (!is_array($option)) { - $option = array($option => $value); - } - foreach ($option as $k => $v) { - switch ($k) { - case 'encoding': - switch ($v) { - case 'utf8': - case 'ucs4_string': - case 'ucs4_array': - $this->_api_encoding = $v; - break; - default: - $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); - return false; - } - break; - case 'overlong': - $this->_allow_overlong = ($v) ? true : false; - break; - case 'strict': - $this->_strict_mode = ($v) ? true : false; - break; - default: - $this->_error('Set Parameter: Unknown option '.$k); - return false; - } - } - return true; - } - - /** - * Decode a given ACE domain name - * @param string Domain name (ACE string) - * [@param string Desired output encoding, see {@link set_parameter}] - * @return string Decoded Domain name (UTF-8 or UCS-4) - * @access public - */ - function decode($input, $one_time_encoding = false) - { - // Optionally set - if ($one_time_encoding) { - switch ($one_time_encoding) { - case 'utf8': - case 'ucs4_string': - case 'ucs4_array': - break; - default: - $this->_error('Unknown encoding '.$one_time_encoding); - return false; - } - } - // Make sure to drop any newline characters around - $input = trim($input); - - // Negotiate input and try to determine, whether it is a plain string, - // an email address or something like a complete URL - if (strpos($input, '@')) { // Maybe it is an email address - // No no in strict mode - if ($this->_strict_mode) { - $this->_error('Only simple domain name parts can be handled in strict mode'); - return false; - } - list ($email_pref, $input) = explode('@', $input, 2); - $arr = explode('.', $input); - foreach ($arr as $k => $v) { - if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { - $conv = $this->_decode($v); - if ($conv) $arr[$k] = $conv; - } - } - $input = join('.', $arr); - $arr = explode('.', $email_pref); - foreach ($arr as $k => $v) { - if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { - $conv = $this->_decode($v); - if ($conv) $arr[$k] = $conv; - } - } - $email_pref = join('.', $arr); - $return = $email_pref . '@' . $input; - } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters) - // No no in strict mode - if ($this->_strict_mode) { - $this->_error('Only simple domain name parts can be handled in strict mode'); - return false; - } - $parsed = parse_url($input); - if (isset($parsed['host'])) { - $arr = explode('.', $parsed['host']); - foreach ($arr as $k => $v) { - $conv = $this->_decode($v); - if ($conv) $arr[$k] = $conv; - } - $parsed['host'] = join('.', $arr); - $return = - (empty($parsed['scheme']) ? '' : $parsed['scheme'].(strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')) - .(empty($parsed['user']) ? '' : $parsed['user'].(empty($parsed['pass']) ? '' : ':'.$parsed['pass']).'@') - .$parsed['host'] - .(empty($parsed['port']) ? '' : ':'.$parsed['port']) - .(empty($parsed['path']) ? '' : $parsed['path']) - .(empty($parsed['query']) ? '' : '?'.$parsed['query']) - .(empty($parsed['fragment']) ? '' : '#'.$parsed['fragment']); - } else { // parse_url seems to have failed, try without it - $arr = explode('.', $input); - foreach ($arr as $k => $v) { - $conv = $this->_decode($v); - $arr[$k] = ($conv) ? $conv : $v; - } - $return = join('.', $arr); - } - } else { // Otherwise we consider it being a pure domain name string - $return = $this->_decode($input); - if (!$return) $return = $input; - } - // The output is UTF-8 by default, other output formats need conversion here - // If one time encoding is given, use this, else the objects property - switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) { - case 'utf8': - return $return; - break; - case 'ucs4_string': - return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); - break; - case 'ucs4_array': - return $this->_utf8_to_ucs4($return); - break; - default: - $this->_error('Unsupported output format'); - return false; - } - } - - /** - * Encode a given UTF-8 domain name - * @param string Domain name (UTF-8 or UCS-4) - * [@param string Desired input encoding, see {@link set_parameter}] - * @return string Encoded Domain name (ACE string) - * @access public - */ - function encode($decoded, $one_time_encoding = false) - { - // Forcing conversion of input to UCS4 array - // If one time encoding is given, use this, else the objects property - switch ($one_time_encoding ? $one_time_encoding : $this->_api_encoding) { - case 'utf8': - $decoded = $this->_utf8_to_ucs4($decoded); - break; - case 'ucs4_string': - $decoded = $this->_ucs4_string_to_ucs4($decoded); - case 'ucs4_array': - break; - default: - $this->_error('Unsupported input format: '.($one_time_encoding ? $one_time_encoding : $this->_api_encoding)); - return false; - } - - // No input, no output, what else did you expect? - if (empty($decoded)) return ''; - - // Anchors for iteration - $last_begin = 0; - // Output string - $output = ''; - foreach ($decoded as $k => $v) { - // Make sure to use just the plain dot - switch($v) { - case 0x3002: - case 0xFF0E: - case 0xFF61: - $decoded[$k] = 0x2E; - // Right, no break here, the above are converted to dots anyway - // Stumbling across an anchoring character - case 0x2E: - case 0x2F: - case 0x3A: - case 0x3F: - case 0x40: - // Neither email addresses nor URLs allowed in strict mode - if ($this->_strict_mode) { - $this->_error('Neither email addresses nor URLs are allowed in strict mode.'); - return false; - } else { - // Skip first char - if ($k) { - $encoded = ''; - $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k)-$last_begin))); - if ($encoded) { - $output .= $encoded; - } else { - $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k)-$last_begin))); - } - $output .= chr($decoded[$k]); - } - $last_begin = $k + 1; - } - } - } - // Catch the rest of the string - if ($last_begin) { - $inp_len = sizeof($decoded); - $encoded = ''; - $encoded = $this->_encode(array_slice($decoded, $last_begin, (($inp_len)-$last_begin))); - if ($encoded) { - $output .= $encoded; - } else { - $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($inp_len)-$last_begin))); - } - return $output; - } else { - if ($output = $this->_encode($decoded)) { - return $output; - } else { - return $this->_ucs4_to_utf8($decoded); - } - } - } - - /** - * Use this method to get the last error ocurred - * @param void - * @return string The last error, that occured - * @access public - */ - function get_last_error() - { - return $this->_error; - } - - /** - * The actual decoding algorithm - * @access private - */ - function _decode($encoded) - { - // We do need to find the Punycode prefix - if (!preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $encoded)) { - $this->_error('This is not a punycode string'); - return false; - } - $encode_test = preg_replace('!^'.preg_quote($this->_punycode_prefix, '!').'!', '', $encoded); - // If nothing left after removing the prefix, it is hopeless - if (!$encode_test) { - $this->_error('The given encoded string was empty'); - return false; - } - // Find last occurence of the delimiter - $delim_pos = strrpos($encoded, '-'); - if ($delim_pos > strlen($this->_punycode_prefix)) { - for ($k = strlen($this->_punycode_prefix); $k < $delim_pos; ++$k) { - $decoded[] = ord($encoded{$k}); - } - } else { - $decoded = array(); - } - $deco_len = count($decoded); - $enco_len = strlen($encoded); - - // Wandering through the strings; init - $is_first = true; - $bias = $this->_initial_bias; - $idx = 0; - $char = $this->_initial_n; - - for ($enco_idx = ($delim_pos) ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) { - for ($old_idx = $idx, $w = 1, $k = $this->_base; 1 ; $k += $this->_base) { - $digit = $this->_decode_digit($encoded{$enco_idx++}); - $idx += $digit * $w; - $t = ($k <= $bias) ? $this->_tmin : - (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); - if ($digit < $t) break; - $w = (int) ($w * ($this->_base - $t)); - } - $bias = $this->_adapt($idx - $old_idx, $deco_len + 1, $is_first); - $is_first = false; - $char += (int) ($idx / ($deco_len + 1)); - $idx %= ($deco_len + 1); - if ($deco_len > 0) { - // Make room for the decoded char - for ($i = $deco_len; $i > $idx; $i--) { - $decoded[$i] = $decoded[($i - 1)]; - } - } - $decoded[$idx++] = $char; - } - return $this->_ucs4_to_utf8($decoded); - } - - /** - * The actual encoding algorithm - * @access private - */ - function _encode($decoded) - { - // We cannot encode a domain name containing the Punycode prefix - $extract = strlen($this->_punycode_prefix); - $check_pref = $this->_utf8_to_ucs4($this->_punycode_prefix); - $check_deco = array_slice($decoded, 0, $extract); - - if ($check_pref == $check_deco) { - $this->_error('This is already a punycode string'); - return false; - } - // We will not try to encode strings consisting of basic code points only - $encodable = false; - foreach ($decoded as $k => $v) { - if ($v > 0x7a) { - $encodable = true; - break; - } - } - if (!$encodable) { - $this->_error('The given string does not contain encodable chars'); - return false; - } - - // Do NAMEPREP - $decoded = $this->_nameprep($decoded); - if (!$decoded || !is_array($decoded)) return false; // NAMEPREP failed - - $deco_len = count($decoded); - if (!$deco_len) return false; // Empty array - - $codecount = 0; // How many chars have been consumed - - $encoded = ''; - // Copy all basic code points to output - for ($i = 0; $i < $deco_len; ++$i) { - $test = $decoded[$i]; - // Will match [-0-9a-zA-Z] - if ((0x2F < $test && $test < 0x40) || (0x40 < $test && $test < 0x5B) - || (0x60 < $test && $test <= 0x7B) || (0x2D == $test)) { - $encoded .= chr($decoded[$i]); - $codecount++; - } - } - if ($codecount == $deco_len) return $encoded; // All codepoints were basic ones - - // Start with the prefix; copy it to output - $encoded = $this->_punycode_prefix.$encoded; - - // If we have basic code points in output, add an hyphen to the end - if ($codecount) $encoded .= '-'; - - // Now find and encode all non-basic code points - $is_first = true; - $cur_code = $this->_initial_n; - $bias = $this->_initial_bias; - $delta = 0; - while ($codecount < $deco_len) { - // Find the smallest code point >= the current code point and - // remember the last ouccrence of it in the input - for ($i = 0, $next_code = $this->_max_ucs; $i < $deco_len; $i++) { - if ($decoded[$i] >= $cur_code && $decoded[$i] <= $next_code) { - $next_code = $decoded[$i]; - } - } - - $delta += ($next_code - $cur_code) * ($codecount + 1); - $cur_code = $next_code; - - // Scan input again and encode all characters whose code point is $cur_code - for ($i = 0; $i < $deco_len; $i++) { - if ($decoded[$i] < $cur_code) { - $delta++; - } elseif ($decoded[$i] == $cur_code) { - for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) { - $t = ($k <= $bias) ? $this->_tmin : - (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias); - if ($q < $t) break; - $encoded .= $this->_encode_digit(intval($t + (($q - $t) % ($this->_base - $t)))); //v0.4.5 Changed from ceil() to intval() - $q = (int) (($q - $t) / ($this->_base - $t)); - } - $encoded .= $this->_encode_digit($q); - $bias = $this->_adapt($delta, $codecount+1, $is_first); - $codecount++; - $delta = 0; - $is_first = false; - } - } - $delta++; - $cur_code++; - } - return $encoded; - } - - /** - * Adapt the bias according to the current code point and position - * @access private - */ - function _adapt($delta, $npoints, $is_first) - { - $delta = intval($is_first ? ($delta / $this->_damp) : ($delta / 2)); - $delta += intval($delta / $npoints); - for ($k = 0; $delta > (($this->_base - $this->_tmin) * $this->_tmax) / 2; $k += $this->_base) { - $delta = intval($delta / ($this->_base - $this->_tmin)); - } - return intval($k + ($this->_base - $this->_tmin + 1) * $delta / ($delta + $this->_skew)); - } - - /** - * Encoding a certain digit - * @access private - */ - function _encode_digit($d) - { - return chr($d + 22 + 75 * ($d < 26)); - } - - /** - * Decode a certain digit - * @access private - */ - function _decode_digit($cp) - { - $cp = ord($cp); - return ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $this->_base)); - } - - /** - * Internal error handling method - * @access private - */ - function _error($error = '') - { - $this->_error = $error; - } - - /** - * Do Nameprep according to RFC3491 and RFC3454 - * @param array Unicode Characters - * @return string Unicode Characters, Nameprep'd - * @access private - */ - function _nameprep($input) - { - $output = array(); - $error = false; - // - // Mapping - // Walking through the input array, performing the required steps on each of - // the input chars and putting the result into the output array - // While mapping required chars we apply the cannonical ordering - foreach ($input as $v) { - // Map to nothing == skip that code point - if (in_array($v, $this->NP['map_nothing'])) continue; - - // Try to find prohibited input - if (in_array($v, $this->NP['prohibit']) || in_array($v, $this->NP['general_prohibited'])) { - $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); - return false; - } - foreach ($this->NP['prohibit_ranges'] as $range) { - if ($range[0] <= $v && $v <= $range[1]) { - $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); - return false; - } - } - // - // Hangul syllable decomposition - if (0xAC00 <= $v && $v <= 0xD7AF) { - foreach ($this->_hangul_decompose($v) as $out) { - $output[] = (int) $out; - } - // There's a decomposition mapping for that code point - } elseif (isset($this->NP['replacemaps'][$v])) { - foreach ($this->_apply_cannonical_ordering($this->NP['replacemaps'][$v]) as $out) { - $output[] = (int) $out; - } - } else { - $output[] = (int) $v; - } - } - // Before applying any Combining, try to rearrange any Hangul syllables - $output = $this->_hangul_compose($output); - // - // Combine code points - // - $last_class = 0; - $last_starter = 0; - $out_len = count($output); - for ($i = 0; $i < $out_len; ++$i) { - $class = $this->_get_combining_class($output[$i]); - if ((!$last_class || $last_class > $class) && $class) { - // Try to match - $seq_len = $i - $last_starter; - $out = $this->_combine(array_slice($output, $last_starter, $seq_len)); - // On match: Replace the last starter with the composed character and remove - // the now redundant non-starter(s) - if ($out) { - $output[$last_starter] = $out; - if (count($out) != $seq_len) { - for ($j = $i+1; $j < $out_len; ++$j) { - $output[$j-1] = $output[$j]; - } - unset($output[$out_len]); - } - // Rewind the for loop by one, since there can be more possible compositions - $i--; - $out_len--; - $last_class = ($i == $last_starter) ? 0 : $this->_get_combining_class($output[$i-1]); - continue; - } - } - // The current class is 0 - if (!$class) $last_starter = $i; - $last_class = $class; - } - return $output; - } - - /** - * Decomposes a Hangul syllable - * (see http://www.unicode.org/unicode/reports/tr15/#Hangul - * @param integer 32bit UCS4 code point - * @return array Either Hangul Syllable decomposed or original 32bit value as one value array - * @access private - */ - function _hangul_decompose($char) - { - $sindex = (int) $char - $this->_sbase; - if ($sindex < 0 || $sindex >= $this->_scount) { - return array($char); - } - $result = array(); - $result[] = (int) $this->_lbase + $sindex / $this->_ncount; - $result[] = (int) $this->_vbase + ($sindex % $this->_ncount) / $this->_tcount; - $T = intval($this->_tbase + $sindex % $this->_tcount); - if ($T != $this->_tbase) $result[] = $T; - return $result; - } - /** - * Ccomposes a Hangul syllable - * (see http://www.unicode.org/unicode/reports/tr15/#Hangul - * @param array Decomposed UCS4 sequence - * @return array UCS4 sequence with syllables composed - * @access private - */ - function _hangul_compose($input) - { - $inp_len = count($input); - if (!$inp_len) return array(); - $result = array(); - $last = (int) $input[0]; - $result[] = $last; // copy first char from input to output - - for ($i = 1; $i < $inp_len; ++$i) { - $char = (int) $input[$i]; - $sindex = $last - $this->_sbase; - $lindex = $last - $this->_lbase; - $vindex = $char - $this->_vbase; - $tindex = $char - $this->_tbase; - // Find out, whether two current characters are LV and T - if (0 <= $sindex && $sindex < $this->_scount && ($sindex % $this->_tcount == 0) - && 0 <= $tindex && $tindex <= $this->_tcount) { - // create syllable of form LVT - $last += $tindex; - $result[(count($result) - 1)] = $last; // reset last - continue; // discard char - } - // Find out, whether two current characters form L and V - if (0 <= $lindex && $lindex < $this->_lcount && 0 <= $vindex && $vindex < $this->_vcount) { - // create syllable of form LV - $last = (int) $this->_sbase + ($lindex * $this->_vcount + $vindex) * $this->_tcount; - $result[(count($result) - 1)] = $last; // reset last - continue; // discard char - } - // if neither case was true, just add the character - $last = $char; - $result[] = $char; - } - return $result; - } - - /** - * Returns the combining class of a certain wide char - * @param integer Wide char to check (32bit integer) - * @return integer Combining class if found, else 0 - * @access private - */ - function _get_combining_class($char) - { - return isset($this->NP['norm_combcls'][$char]) ? $this->NP['norm_combcls'][$char] : 0; - } - - /** - * Apllies the cannonical ordering of a decomposed UCS4 sequence - * @param array Decomposed UCS4 sequence - * @return array Ordered USC4 sequence - * @access private - */ - function _apply_cannonical_ordering($input) - { - $swap = true; - $size = count($input); - while ($swap) { - $swap = false; - $last = $this->_get_combining_class(intval($input[0])); - for ($i = 0; $i < $size-1; ++$i) { - $next = $this->_get_combining_class(intval($input[$i+1])); - if ($next != 0 && $last > $next) { - // Move item leftward until it fits - for ($j = $i + 1; $j > 0; --$j) { - if ($this->_get_combining_class(intval($input[$j-1])) <= $next) break; - $t = intval($input[$j]); - $input[$j] = intval($input[$j-1]); - $input[$j-1] = $t; - $swap = true; - } - // Reentering the loop looking at the old character again - $next = $last; - } - $last = $next; - } - } - return $input; - } - - /** - * Do composition of a sequence of starter and non-starter - * @param array UCS4 Decomposed sequence - * @return array Ordered USC4 sequence - * @access private - */ - function _combine($input) - { - $inp_len = count($input); - foreach ($this->NP['replacemaps'] as $np_src => $np_target) { - if ($np_target[0] != $input[0]) continue; - if (count($np_target) != $inp_len) continue; - $hit = false; - foreach ($input as $k2 => $v2) { - if ($v2 == $np_target[$k2]) { - $hit = true; - } else { - $hit = false; - break; - } - } - if ($hit) return $np_src; - } - return false; - } - - /** - * This converts an UTF-8 encoded string to its UCS-4 representation - * By talking about UCS-4 "strings" we mean arrays of 32bit integers representing - * each of the "chars". This is due to PHP not being able to handle strings with - * bit depth different from 8. This apllies to the reverse method _ucs4_to_utf8(), too. - * The following UTF-8 encodings are supported: - * bytes bits representation - * 1 7 0xxxxxxx - * 2 11 110xxxxx 10xxxxxx - * 3 16 1110xxxx 10xxxxxx 10xxxxxx - * 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - * 5 26 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - * 6 31 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - * Each x represents a bit that can be used to store character data. - * The five and six byte sequences are part of Annex D of ISO/IEC 10646-1:2000 - * @access private - */ - function _utf8_to_ucs4($input) - { - $output = array(); - $out_len = 0; - $inp_len = strlen($input); - $mode = 'next'; - $test = 'none'; - for ($k = 0; $k < $inp_len; ++$k) { - $v = ord($input{$k}); // Extract byte from input string - - if ($v < 128) { // We found an ASCII char - put into stirng as is - $output[$out_len] = $v; - ++$out_len; - if ('add' == $mode) { - $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); - return false; - } - continue; - } - if ('next' == $mode) { // Try to find the next start byte; determine the width of the Unicode char - $start_byte = $v; - $mode = 'add'; - $test = 'range'; - if ($v >> 5 == 6) { // &110xxxxx 10xxxxx - $next_byte = 0; // Tells, how many times subsequent bitmasks must rotate 6bits to the left - $v = ($v - 192) << 6; - } elseif ($v >> 4 == 14) { // &1110xxxx 10xxxxxx 10xxxxxx - $next_byte = 1; - $v = ($v - 224) << 12; - } elseif ($v >> 3 == 30) { // &11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - $next_byte = 2; - $v = ($v - 240) << 18; - } elseif ($v >> 2 == 62) { // &111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - $next_byte = 3; - $v = ($v - 248) << 24; - } elseif ($v >> 1 == 126) { // &1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - $next_byte = 4; - $v = ($v - 252) << 30; - } else { - $this->_error('This might be UTF-8, but I don\'t understand it at byte '.$k); - return false; - } - if ('add' == $mode) { - $output[$out_len] = (int) $v; - ++$out_len; - continue; - } - } - if ('add' == $mode) { - if (!$this->_allow_overlong && $test == 'range') { - $test = 'none'; - if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) { - $this->_error('Bogus UTF-8 character detected (out of legal range) at byte '.$k); - return false; - } - } - if ($v >> 6 == 2) { // Bit mask must be 10xxxxxx - $v = ($v - 128) << ($next_byte * 6); - $output[($out_len - 1)] += $v; - --$next_byte; - } else { - $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); - return false; - } - if ($next_byte < 0) { - $mode = 'next'; - } - } - } // for - return $output; - } - - /** - * Convert UCS-4 string into UTF-8 string - * See _utf8_to_ucs4() for details - * @access private - */ - function _ucs4_to_utf8($input) - { - $output = ''; - $k = 0; - foreach ($input as $v) { - ++$k; - // $v = ord($v); - if ($v < 128) { // 7bit are transferred literally - $output .= chr($v); - } elseif ($v < (1 << 11)) { // 2 bytes - $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); - } elseif ($v < (1 << 16)) { // 3 bytes - $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); - } elseif ($v < (1 << 21)) { // 4 bytes - $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) - . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); - } elseif ($v < (1 << 26)) { // 5 bytes - $output .= chr(248 + ($v >> 24)) . chr(128 + (($v >> 18) & 63)) - . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) - . chr(128 + ($v & 63)); - } elseif ($v < (1 << 31)) { // 6 bytes - $output .= chr(252 + ($v >> 30)) . chr(128 + (($v >> 24) & 63)) - . chr(128 + (($v >> 18) & 63)) . chr(128 + (($v >> 12) & 63)) - . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); - } else { - $this->_error('Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k); - return false; - } - } - return $output; - } - - /** - * Convert UCS-4 array into UCS-4 string - * - * @access private - */ - function _ucs4_to_ucs4_string($input) - { - $output = ''; - // Take array values and split output to 4 bytes per value - // The bit mask is 255, which reads &11111111 - foreach ($input as $v) { - $output .= chr(($v >> 24) & 255).chr(($v >> 16) & 255).chr(($v >> 8) & 255).chr($v & 255); - } - return $output; - } - - /** - * Convert UCS-4 strin into UCS-4 garray - * - * @access private - */ - function _ucs4_string_to_ucs4($input) - { - $output = array(); - $inp_len = strlen($input); - // Input length must be dividable by 4 - if ($inp_len % 4) { - $this->_error('Input UCS4 string is broken'); - return false; - } - // Empty input - return empty output - if (!$inp_len) return $output; - for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) { - // Increment output position every 4 input bytes - if (!($i % 4)) { - $out_len++; - $output[$out_len] = 0; - } - $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) ); - } - return $output; - } -} - -/** -* Adapter class for aligning the API of idna_convert with that of Net_IDNA -* @author Matthias Sommerfeld <mso@phlylabs.de> -*/ -class Net_IDNA_php4 extends idna_convert -{ - /** - * Sets a new option value. Available options and values: - * [encoding - Use either UTF-8, UCS4 as array or UCS4 as string as input ('utf8' for UTF-8, - * 'ucs4_string' and 'ucs4_array' respectively for UCS4); The output is always UTF-8] - * [overlong - Unicode does not allow unnecessarily long encodings of chars, - * to allow this, set this parameter to true, else to false; - * default is false.] - * [strict - true: strict mode, good for registration purposes - Causes errors - * on failures; false: loose mode, ideal for "wildlife" applications - * by silently ignoring errors and returning the original input instead - * - * @param mixed Parameter to set (string: single parameter; array of Parameter => Value pairs) - * @param string Value to use (if parameter 1 is a string) - * @return boolean true on success, false otherwise - * @access public - */ - function setParams($option, $param = false) - { - return $this->IC->set_parameters($option, $param); - } -} - -?>
@@ -1,1 +0,0 @@
-a:6:{s:11:"map_nothing";a:27:{i:0;i:173;i:1;i:847;i:2;i:6150;i:3;i:6155;i:4;i:6156;i:5;i:6157;i:6;i:8203;i:7;i:8204;i:8;i:8205;i:9;i:8288;i:10;i:65024;i:11;i:65025;i:12;i:65026;i:13;i:65027;i:14;i:65028;i:15;i:65029;i:16;i:65030;i:17;i:65031;i:18;i:65032;i:19;i:65033;i:20;i:65034;i:21;i:65035;i:22;i:65036;i:23;i:65037;i:24;i:65038;i:25;i:65039;i:26;i:65279;}s:18:"general_prohibited";a:64:{i:0;i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:5;i:6;i:6;i:7;i:7;i:8;i:8;i:9;i:9;i:10;i:10;i:11;i:11;i:12;i:12;i:13;i:13;i:14;i:14;i:15;i:15;i:16;i:16;i:17;i:17;i:18;i:18;i:19;i:19;i:20;i:20;i:21;i:21;i:22;i:22;i:23;i:23;i:24;i:24;i:25;i:25;i:26;i:26;i:27;i:27;i:28;i:28;i:29;i:29;i:30;i:30;i:31;i:31;i:32;i:32;i:33;i:33;i:34;i:34;i:35;i:35;i:36;i:36;i:37;i:37;i:38;i:38;i:39;i:39;i:40;i:40;i:41;i:41;i:42;i:42;i:43;i:43;i:44;i:44;i:45;i:47;i:46;i:59;i:47;i:60;i:48;i:61;i:49;i:62;i:50;i:63;i:51;i:64;i:52;i:91;i:53;i:92;i:54;i:93;i:55;i:94;i:56;i:95;i:57;i:96;i:58;i:123;i:59;i:124;i:60;i:125;i:61;i:126;i:62;i:127;i:63;i:12290;}s:8:"prohibit";a:84:{i:0;i:160;i:1;i:5760;i:2;i:8192;i:3;i:8193;i:4;i:8194;i:5;i:8195;i:6;i:8196;i:7;i:8197;i:8;i:8198;i:9;i:8199;i:10;i:8200;i:11;i:8201;i:12;i:8202;i:13;i:8203;i:14;i:8239;i:15;i:8287;i:16;i:12288;i:17;i:1757;i:18;i:1807;i:19;i:6158;i:20;i:8204;i:21;i:8205;i:22;i:8232;i:23;i:8233;i:24;i:65279;i:25;i:65529;i:26;i:65530;i:27;i:65531;i:28;i:65532;i:29;i:65534;i:30;i:65535;i:31;i:131070;i:32;i:131071;i:33;i:196606;i:34;i:196607;i:35;i:262142;i:36;i:262143;i:37;i:327678;i:38;i:327679;i:39;i:393214;i:40;i:393215;i:41;i:458750;i:42;i:458751;i:43;i:524286;i:44;i:524287;i:45;i:589822;i:46;i:589823;i:47;i:655358;i:48;i:655359;i:49;i:720894;i:50;i:720895;i:51;i:786430;i:52;i:786431;i:53;i:851966;i:54;i:851967;i:55;i:917502;i:56;i:917503;i:57;i:983038;i:58;i:983039;i:59;i:1048574;i:60;i:1048575;i:61;i:1114110;i:62;i:1114111;i:63;i:65529;i:64;i:65530;i:65;i:65531;i:66;i:65532;i:67;i:65533;i:68;i:832;i:69;i:833;i:70;i:8206;i:71;i:8207;i:72;i:8234;i:73;i:8235;i:74;i:8236;i:75;i:8237;i:76;i:8238;i:77;i:8298;i:78;i:8299;i:79;i:8300;i:80;i:8301;i:81;i:8302;i:82;i:8303;i:83;i:917505;}s:15:"prohibit_ranges";a:10:{i:0;a:2:{i:0;i:128;i:1;i:159;}i:1;a:2:{i:0;i:8288;i:1;i:8303;}i:2;a:2:{i:0;i:119155;i:1;i:119162;}i:3;a:2:{i:0;i:57344;i:1;i:63743;}i:4;a:2:{i:0;i:983040;i:1;i:1048573;}i:5;a:2:{i:0;i:1048576;i:1;i:1114109;}i:6;a:2:{i:0;i:64976;i:1;i:65007;}i:7;a:2:{i:0;i:55296;i:1;i:57343;}i:8;a:2:{i:0;i:12272;i:1;i:12283;}i:9;a:2:{i:0;i:917536;i:1;i:917631;}}s:11:"replacemaps";a:1401:{i:65;a:1:{i:0;i:97;}i:66;a:1:{i:0;i:98;}i:67;a:1:{i:0;i:99;}i:68;a:1:{i:0;i:100;}i:69;a:1:{i:0;i:101;}i:70;a:1:{i:0;i:102;}i:71;a:1:{i:0;i:103;}i:72;a:1:{i:0;i:104;}i:73;a:1:{i:0;i:105;}i:74;a:1:{i:0;i:106;}i:75;a:1:{i:0;i:107;}i:76;a:1:{i:0;i:108;}i:77;a:1:{i:0;i:109;}i:78;a:1:{i:0;i:110;}i:79;a:1:{i:0;i:111;}i:80;a:1:{i:0;i:112;}i:81;a:1:{i:0;i:113;}i:82;a:1:{i:0;i:114;}i:83;a:1:{i:0;i:115;}i:84;a:1:{i:0;i:116;}i:85;a:1:{i:0;i:117;}i:86;a:1:{i:0;i:118;}i:87;a:1:{i:0;i:119;}i:88;a:1:{i:0;i:120;}i:89;a:1:{i:0;i:121;}i:90;a:1:{i:0;i:122;}i:181;a:1:{i:0;i:956;}i:192;a:1:{i:0;i:224;}i:193;a:1:{i:0;i:225;}i:194;a:1:{i:0;i:226;}i:195;a:1:{i:0;i:227;}i:196;a:1:{i:0;i:228;}i:197;a:1:{i:0;i:229;}i:198;a:1:{i:0;i:230;}i:199;a:1:{i:0;i:231;}i:200;a:1:{i:0;i:232;}i:201;a:1:{i:0;i:233;}i:202;a:1:{i:0;i:234;}i:203;a:1:{i:0;i:235;}i:204;a:1:{i:0;i:236;}i:205;a:1:{i:0;i:237;}i:206;a:1:{i:0;i:238;}i:207;a:1:{i:0;i:239;}i:208;a:1:{i:0;i:240;}i:209;a:1:{i:0;i:241;}i:210;a:1:{i:0;i:242;}i:211;a:1:{i:0;i:243;}i:212;a:1:{i:0;i:244;}i:213;a:1:{i:0;i:245;}i:214;a:1:{i:0;i:246;}i:216;a:1:{i:0;i:248;}i:217;a:1:{i:0;i:249;}i:218;a:1:{i:0;i:250;}i:219;a:1:{i:0;i:251;}i:220;a:1:{i:0;i:252;}i:221;a:1:{i:0;i:253;}i:222;a:1:{i:0;i:254;}i:223;a:2:{i:0;i:115;i:1;i:115;}i:256;a:1:{i:0;i:257;}i:258;a:1:{i:0;i:259;}i:260;a:1:{i:0;i:261;}i:262;a:1:{i:0;i:263;}i:264;a:1:{i:0;i:265;}i:266;a:1:{i:0;i:267;}i:268;a:1:{i:0;i:269;}i:270;a:1:{i:0;i:271;}i:272;a:1:{i:0;i:273;}i:274;a:1:{i:0;i:275;}i:276;a:1:{i:0;i:277;}i:278;a:1:{i:0;i:279;}i:280;a:1:{i:0;i:281;}i:282;a:1:{i:0;i:283;}i:284;a:1:{i:0;i:285;}i:286;a:1:{i:0;i:287;}i:288;a:1:{i:0;i:289;}i:290;a:1:{i:0;i:291;}i:292;a:1:{i:0;i:293;}i:294;a:1:{i:0;i:295;}i:296;a:1:{i:0;i:297;}i:298;a:1:{i:0;i:299;}i:300;a:1:{i:0;i:301;}i:302;a:1:{i:0;i:303;}i:304;a:2:{i:0;i:105;i:1;i:775;}i:306;a:1:{i:0;i:307;}i:308;a:1:{i:0;i:309;}i:310;a:1:{i:0;i:311;}i:313;a:1:{i:0;i:314;}i:315;a:1:{i:0;i:316;}i:317;a:1:{i:0;i:318;}i:319;a:1:{i:0;i:320;}i:321;a:1:{i:0;i:322;}i:323;a:1:{i:0;i:324;}i:325;a:1:{i:0;i:326;}i:327;a:1:{i:0;i:328;}i:329;a:2:{i:0;i:700;i:1;i:110;}i:330;a:1:{i:0;i:331;}i:332;a:1:{i:0;i:333;}i:334;a:1:{i:0;i:335;}i:336;a:1:{i:0;i:337;}i:338;a:1:{i:0;i:339;}i:340;a:1:{i:0;i:341;}i:342;a:1:{i:0;i:343;}i:344;a:1:{i:0;i:345;}i:346;a:1:{i:0;i:347;}i:348;a:1:{i:0;i:349;}i:350;a:1:{i:0;i:351;}i:352;a:1:{i:0;i:353;}i:354;a:1:{i:0;i:355;}i:356;a:1:{i:0;i:357;}i:358;a:1:{i:0;i:359;}i:360;a:1:{i:0;i:361;}i:362;a:1:{i:0;i:363;}i:364;a:1:{i:0;i:365;}i:366;a:1:{i:0;i:367;}i:368;a:1:{i:0;i:369;}i:370;a:1:{i:0;i:371;}i:372;a:1:{i:0;i:373;}i:374;a:1:{i:0;i:375;}i:376;a:1:{i:0;i:255;}i:377;a:1:{i:0;i:378;}i:379;a:1:{i:0;i:380;}i:381;a:1:{i:0;i:382;}i:383;a:1:{i:0;i:115;}i:385;a:1:{i:0;i:595;}i:386;a:1:{i:0;i:387;}i:388;a:1:{i:0;i:389;}i:390;a:1:{i:0;i:596;}i:391;a:1:{i:0;i:392;}i:393;a:1:{i:0;i:598;}i:394;a:1:{i:0;i:599;}i:395;a:1:{i:0;i:396;}i:398;a:1:{i:0;i:477;}i:399;a:1:{i:0;i:601;}i:400;a:1:{i:0;i:603;}i:401;a:1:{i:0;i:402;}i:403;a:1:{i:0;i:608;}i:404;a:1:{i:0;i:611;}i:406;a:1:{i:0;i:617;}i:407;a:1:{i:0;i:616;}i:408;a:1:{i:0;i:409;}i:412;a:1:{i:0;i:623;}i:413;a:1:{i:0;i:626;}i:415;a:1:{i:0;i:629;}i:416;a:1:{i:0;i:417;}i:418;a:1:{i:0;i:419;}i:420;a:1:{i:0;i:421;}i:422;a:1:{i:0;i:640;}i:423;a:1:{i:0;i:424;}i:425;a:1:{i:0;i:643;}i:428;a:1:{i:0;i:429;}i:430;a:1:{i:0;i:648;}i:431;a:1:{i:0;i:432;}i:433;a:1:{i:0;i:650;}i:434;a:1:{i:0;i:651;}i:435;a:1:{i:0;i:436;}i:437;a:1:{i:0;i:438;}i:439;a:1:{i:0;i:658;}i:440;a:1:{i:0;i:441;}i:444;a:1:{i:0;i:445;}i:452;a:1:{i:0;i:454;}i:453;a:1:{i:0;i:454;}i:455;a:1:{i:0;i:457;}i:456;a:1:{i:0;i:457;}i:458;a:1:{i:0;i:460;}i:459;a:1:{i:0;i:460;}i:461;a:1:{i:0;i:462;}i:463;a:1:{i:0;i:464;}i:465;a:1:{i:0;i:466;}i:467;a:1:{i:0;i:468;}i:469;a:1:{i:0;i:470;}i:471;a:1:{i:0;i:472;}i:473;a:1:{i:0;i:474;}i:475;a:1:{i:0;i:476;}i:478;a:1:{i:0;i:479;}i:480;a:1:{i:0;i:481;}i:482;a:1:{i:0;i:483;}i:484;a:1:{i:0;i:485;}i:486;a:1:{i:0;i:487;}i:488;a:1:{i:0;i:489;}i:490;a:1:{i:0;i:491;}i:492;a:1:{i:0;i:493;}i:494;a:1:{i:0;i:495;}i:496;a:2:{i:0;i:106;i:1;i:780;}i:497;a:1:{i:0;i:499;}i:498;a:1:{i:0;i:499;}i:500;a:1:{i:0;i:501;}i:502;a:1:{i:0;i:405;}i:503;a:1:{i:0;i:447;}i:504;a:1:{i:0;i:505;}i:506;a:1:{i:0;i:507;}i:508;a:1:{i:0;i:509;}i:510;a:1:{i:0;i:511;}i:512;a:1:{i:0;i:513;}i:514;a:1:{i:0;i:515;}i:516;a:1:{i:0;i:517;}i:518;a:1:{i:0;i:519;}i:520;a:1:{i:0;i:521;}i:522;a:1:{i:0;i:523;}i:524;a:1:{i:0;i:525;}i:526;a:1:{i:0;i:527;}i:528;a:1:{i:0;i:529;}i:530;a:1:{i:0;i:531;}i:532;a:1:{i:0;i:533;}i:534;a:1:{i:0;i:535;}i:536;a:1:{i:0;i:537;}i:538;a:1:{i:0;i:539;}i:540;a:1:{i:0;i:541;}i:542;a:1:{i:0;i:543;}i:544;a:1:{i:0;i:414;}i:546;a:1:{i:0;i:547;}i:548;a:1:{i:0;i:549;}i:550;a:1:{i:0;i:551;}i:552;a:1:{i:0;i:553;}i:554;a:1:{i:0;i:555;}i:556;a:1:{i:0;i:557;}i:558;a:1:{i:0;i:559;}i:560;a:1:{i:0;i:561;}i:562;a:1:{i:0;i:563;}i:837;a:1:{i:0;i:953;}i:890;a:2:{i:0;i:32;i:1;i:953;}i:902;a:1:{i:0;i:940;}i:904;a:1:{i:0;i:941;}i:905;a:1:{i:0;i:942;}i:906;a:1:{i:0;i:943;}i:908;a:1:{i:0;i:972;}i:910;a:1:{i:0;i:973;}i:911;a:1:{i:0;i:974;}i:912;a:3:{i:0;i:953;i:1;i:776;i:2;i:769;}i:913;a:1:{i:0;i:945;}i:914;a:1:{i:0;i:946;}i:915;a:1:{i:0;i:947;}i:916;a:1:{i:0;i:948;}i:917;a:1:{i:0;i:949;}i:918;a:1:{i:0;i:950;}i:919;a:1:{i:0;i:951;}i:920;a:1:{i:0;i:952;}i:921;a:1:{i:0;i:953;}i:922;a:1:{i:0;i:954;}i:923;a:1:{i:0;i:955;}i:924;a:1:{i:0;i:956;}i:925;a:1:{i:0;i:957;}i:926;a:1:{i:0;i:958;}i:927;a:1:{i:0;i:959;}i:928;a:1:{i:0;i:960;}i:929;a:1:{i:0;i:961;}i:931;a:1:{i:0;i:963;}i:932;a:1:{i:0;i:964;}i:933;a:1:{i:0;i:965;}i:934;a:1:{i:0;i:966;}i:935;a:1:{i:0;i:967;}i:936;a:1:{i:0;i:968;}i:937;a:1:{i:0;i:969;}i:938;a:1:{i:0;i:970;}i:939;a:1:{i:0;i:971;}i:944;a:3:{i:0;i:965;i:1;i:776;i:2;i:769;}i:962;a:1:{i:0;i:963;}i:976;a:1:{i:0;i:946;}i:977;a:1:{i:0;i:952;}i:978;a:1:{i:0;i:965;}i:979;a:1:{i:0;i:973;}i:980;a:1:{i:0;i:971;}i:981;a:1:{i:0;i:966;}i:982;a:1:{i:0;i:960;}i:984;a:1:{i:0;i:985;}i:986;a:1:{i:0;i:987;}i:988;a:1:{i:0;i:989;}i:990;a:1:{i:0;i:991;}i:992;a:1:{i:0;i:993;}i:994;a:1:{i:0;i:995;}i:996;a:1:{i:0;i:997;}i:998;a:1:{i:0;i:999;}i:1000;a:1:{i:0;i:1001;}i:1002;a:1:{i:0;i:1003;}i:1004;a:1:{i:0;i:1005;}i:1006;a:1:{i:0;i:1007;}i:1008;a:1:{i:0;i:954;}i:1009;a:1:{i:0;i:961;}i:1010;a:1:{i:0;i:963;}i:1012;a:1:{i:0;i:952;}i:1013;a:1:{i:0;i:949;}i:1024;a:1:{i:0;i:1104;}i:1025;a:1:{i:0;i:1105;}i:1026;a:1:{i:0;i:1106;}i:1027;a:1:{i:0;i:1107;}i:1028;a:1:{i:0;i:1108;}i:1029;a:1:{i:0;i:1109;}i:1030;a:1:{i:0;i:1110;}i:1031;a:1:{i:0;i:1111;}i:1032;a:1:{i:0;i:1112;}i:1033;a:1:{i:0;i:1113;}i:1034;a:1:{i:0;i:1114;}i:1035;a:1:{i:0;i:1115;}i:1036;a:1:{i:0;i:1116;}i:1037;a:1:{i:0;i:1117;}i:1038;a:1:{i:0;i:1118;}i:1039;a:1:{i:0;i:1119;}i:1040;a:1:{i:0;i:1072;}i:1041;a:1:{i:0;i:1073;}i:1042;a:1:{i:0;i:1074;}i:1043;a:1:{i:0;i:1075;}i:1044;a:1:{i:0;i:1076;}i:1045;a:1:{i:0;i:1077;}i:1046;a:1:{i:0;i:1078;}i:1047;a:1:{i:0;i:1079;}i:1048;a:1:{i:0;i:1080;}i:1049;a:1:{i:0;i:1081;}i:1050;a:1:{i:0;i:1082;}i:1051;a:1:{i:0;i:1083;}i:1052;a:1:{i:0;i:1084;}i:1053;a:1:{i:0;i:1085;}i:1054;a:1:{i:0;i:1086;}i:1055;a:1:{i:0;i:1087;}i:1056;a:1:{i:0;i:1088;}i:1057;a:1:{i:0;i:1089;}i:1058;a:1:{i:0;i:1090;}i:1059;a:1:{i:0;i:1091;}i:1060;a:1:{i:0;i:1092;}i:1061;a:1:{i:0;i:1093;}i:1062;a:1:{i:0;i:1094;}i:1063;a:1:{i:0;i:1095;}i:1064;a:1:{i:0;i:1096;}i:1065;a:1:{i:0;i:1097;}i:1066;a:1:{i:0;i:1098;}i:1067;a:1:{i:0;i:1099;}i:1068;a:1:{i:0;i:1100;}i:1069;a:1:{i:0;i:1101;}i:1070;a:1:{i:0;i:1102;}i:1071;a:1:{i:0;i:1103;}i:1120;a:1:{i:0;i:1121;}i:1122;a:1:{i:0;i:1123;}i:1124;a:1:{i:0;i:1125;}i:1126;a:1:{i:0;i:1127;}i:1128;a:1:{i:0;i:1129;}i:1130;a:1:{i:0;i:1131;}i:1132;a:1:{i:0;i:1133;}i:1134;a:1:{i:0;i:1135;}i:1136;a:1:{i:0;i:1137;}i:1138;a:1:{i:0;i:1139;}i:1140;a:1:{i:0;i:1141;}i:1142;a:1:{i:0;i:1143;}i:1144;a:1:{i:0;i:1145;}i:1146;a:1:{i:0;i:1147;}i:1148;a:1:{i:0;i:1149;}i:1150;a:1:{i:0;i:1151;}i:1152;a:1:{i:0;i:1153;}i:1162;a:1:{i:0;i:1163;}i:1164;a:1:{i:0;i:1165;}i:1166;a:1:{i:0;i:1167;}i:1168;a:1:{i:0;i:1169;}i:1170;a:1:{i:0;i:1171;}i:1172;a:1:{i:0;i:1173;}i:1174;a:1:{i:0;i:1175;}i:1176;a:1:{i:0;i:1177;}i:1178;a:1:{i:0;i:1179;}i:1180;a:1:{i:0;i:1181;}i:1182;a:1:{i:0;i:1183;}i:1184;a:1:{i:0;i:1185;}i:1186;a:1:{i:0;i:1187;}i:1188;a:1:{i:0;i:1189;}i:1190;a:1:{i:0;i:1191;}i:1192;a:1:{i:0;i:1193;}i:1194;a:1:{i:0;i:1195;}i:1196;a:1:{i:0;i:1197;}i:1198;a:1:{i:0;i:1199;}i:1200;a:1:{i:0;i:1201;}i:1202;a:1:{i:0;i:1203;}i:1204;a:1:{i:0;i:1205;}i:1206;a:1:{i:0;i:1207;}i:1208;a:1:{i:0;i:1209;}i:1210;a:1:{i:0;i:1211;}i:1212;a:1:{i:0;i:1213;}i:1214;a:1:{i:0;i:1215;}i:1217;a:1:{i:0;i:1218;}i:1219;a:1:{i:0;i:1220;}i:1221;a:1:{i:0;i:1222;}i:1223;a:1:{i:0;i:1224;}i:1225;a:1:{i:0;i:1226;}i:1227;a:1:{i:0;i:1228;}i:1229;a:1:{i:0;i:1230;}i:1232;a:1:{i:0;i:1233;}i:1234;a:1:{i:0;i:1235;}i:1236;a:1:{i:0;i:1237;}i:1238;a:1:{i:0;i:1239;}i:1240;a:1:{i:0;i:1241;}i:1242;a:1:{i:0;i:1243;}i:1244;a:1:{i:0;i:1245;}i:1246;a:1:{i:0;i:1247;}i:1248;a:1:{i:0;i:1249;}i:1250;a:1:{i:0;i:1251;}i:1252;a:1:{i:0;i:1253;}i:1254;a:1:{i:0;i:1255;}i:1256;a:1:{i:0;i:1257;}i:1258;a:1:{i:0;i:1259;}i:1260;a:1:{i:0;i:1261;}i:1262;a:1:{i:0;i:1263;}i:1264;a:1:{i:0;i:1265;}i:1266;a:1:{i:0;i:1267;}i:1268;a:1:{i:0;i:1269;}i:1272;a:1:{i:0;i:1273;}i:1280;a:1:{i:0;i:1281;}i:1282;a:1:{i:0;i:1283;}i:1284;a:1:{i:0;i:1285;}i:1286;a:1:{i:0;i:1287;}i:1288;a:1:{i:0;i:1289;}i:1290;a:1:{i:0;i:1291;}i:1292;a:1:{i:0;i:1293;}i:1294;a:1:{i:0;i:1295;}i:1329;a:1:{i:0;i:1377;}i:1330;a:1:{i:0;i:1378;}i:1331;a:1:{i:0;i:1379;}i:1332;a:1:{i:0;i:1380;}i:1333;a:1:{i:0;i:1381;}i:1334;a:1:{i:0;i:1382;}i:1335;a:1:{i:0;i:1383;}i:1336;a:1:{i:0;i:1384;}i:1337;a:1:{i:0;i:1385;}i:1338;a:1:{i:0;i:1386;}i:1339;a:1:{i:0;i:1387;}i:1340;a:1:{i:0;i:1388;}i:1341;a:1:{i:0;i:1389;}i:1342;a:1:{i:0;i:1390;}i:1343;a:1:{i:0;i:1391;}i:1344;a:1:{i:0;i:1392;}i:1345;a:1:{i:0;i:1393;}i:1346;a:1:{i:0;i:1394;}i:1347;a:1:{i:0;i:1395;}i:1348;a:1:{i:0;i:1396;}i:1349;a:1:{i:0;i:1397;}i:1350;a:1:{i:0;i:1398;}i:1351;a:1:{i:0;i:1399;}i:1352;a:1:{i:0;i:1400;}i:1353;a:1:{i:0;i:1401;}i:1354;a:1:{i:0;i:1402;}i:1355;a:1:{i:0;i:1403;}i:1356;a:1:{i:0;i:1404;}i:1357;a:1:{i:0;i:1405;}i:1358;a:1:{i:0;i:1406;}i:1359;a:1:{i:0;i:1407;}i:1360;a:1:{i:0;i:1408;}i:1361;a:1:{i:0;i:1409;}i:1362;a:1:{i:0;i:1410;}i:1363;a:1:{i:0;i:1411;}i:1364;a:1:{i:0;i:1412;}i:1365;a:1:{i:0;i:1413;}i:1366;a:1:{i:0;i:1414;}i:1415;a:2:{i:0;i:1381;i:1;i:1410;}i:7680;a:1:{i:0;i:7681;}i:7682;a:1:{i:0;i:7683;}i:7684;a:1:{i:0;i:7685;}i:7686;a:1:{i:0;i:7687;}i:7688;a:1:{i:0;i:7689;}i:7690;a:1:{i:0;i:7691;}i:7692;a:1:{i:0;i:7693;}i:7694;a:1:{i:0;i:7695;}i:7696;a:1:{i:0;i:7697;}i:7698;a:1:{i:0;i:7699;}i:7700;a:1:{i:0;i:7701;}i:7702;a:1:{i:0;i:7703;}i:7704;a:1:{i:0;i:7705;}i:7706;a:1:{i:0;i:7707;}i:7708;a:1:{i:0;i:7709;}i:7710;a:1:{i:0;i:7711;}i:7712;a:1:{i:0;i:7713;}i:7714;a:1:{i:0;i:7715;}i:7716;a:1:{i:0;i:7717;}i:7718;a:1:{i:0;i:7719;}i:7720;a:1:{i:0;i:7721;}i:7722;a:1:{i:0;i:7723;}i:7724;a:1:{i:0;i:7725;}i:7726;a:1:{i:0;i:7727;}i:7728;a:1:{i:0;i:7729;}i:7730;a:1:{i:0;i:7731;}i:7732;a:1:{i:0;i:7733;}i:7734;a:1:{i:0;i:7735;}i:7736;a:1:{i:0;i:7737;}i:7738;a:1:{i:0;i:7739;}i:7740;a:1:{i:0;i:7741;}i:7742;a:1:{i:0;i:7743;}i:7744;a:1:{i:0;i:7745;}i:7746;a:1:{i:0;i:7747;}i:7748;a:1:{i:0;i:7749;}i:7750;a:1:{i:0;i:7751;}i:7752;a:1:{i:0;i:7753;}i:7754;a:1:{i:0;i:7755;}i:7756;a:1:{i:0;i:7757;}i:7758;a:1:{i:0;i:7759;}i:7760;a:1:{i:0;i:7761;}i:7762;a:1:{i:0;i:7763;}i:7764;a:1:{i:0;i:7765;}i:7766;a:1:{i:0;i:7767;}i:7768;a:1:{i:0;i:7769;}i:7770;a:1:{i:0;i:7771;}i:7772;a:1:{i:0;i:7773;}i:7774;a:1:{i:0;i:7775;}i:7776;a:1:{i:0;i:7777;}i:7778;a:1:{i:0;i:7779;}i:7780;a:1:{i:0;i:7781;}i:7782;a:1:{i:0;i:7783;}i:7784;a:1:{i:0;i:7785;}i:7786;a:1:{i:0;i:7787;}i:7788;a:1:{i:0;i:7789;}i:7790;a:1:{i:0;i:7791;}i:7792;a:1:{i:0;i:7793;}i:7794;a:1:{i:0;i:7795;}i:7796;a:1:{i:0;i:7797;}i:7798;a:1:{i:0;i:7799;}i:7800;a:1:{i:0;i:7801;}i:7802;a:1:{i:0;i:7803;}i:7804;a:1:{i:0;i:7805;}i:7806;a:1:{i:0;i:7807;}i:7808;a:1:{i:0;i:7809;}i:7810;a:1:{i:0;i:7811;}i:7812;a:1:{i:0;i:7813;}i:7814;a:1:{i:0;i:7815;}i:7816;a:1:{i:0;i:7817;}i:7818;a:1:{i:0;i:7819;}i:7820;a:1:{i:0;i:7821;}i:7822;a:1:{i:0;i:7823;}i:7824;a:1:{i:0;i:7825;}i:7826;a:1:{i:0;i:7827;}i:7828;a:1:{i:0;i:7829;}i:7830;a:2:{i:0;i:104;i:1;i:817;}i:7831;a:2:{i:0;i:116;i:1;i:776;}i:7832;a:2:{i:0;i:119;i:1;i:778;}i:7833;a:2:{i:0;i:121;i:1;i:778;}i:7834;a:2:{i:0;i:97;i:1;i:702;}i:7835;a:1:{i:0;i:7777;}i:7840;a:1:{i:0;i:7841;}i:7842;a:1:{i:0;i:7843;}i:7844;a:1:{i:0;i:7845;}i:7846;a:1:{i:0;i:7847;}i:7848;a:1:{i:0;i:7849;}i:7850;a:1:{i:0;i:7851;}i:7852;a:1:{i:0;i:7853;}i:7854;a:1:{i:0;i:7855;}i:7856;a:1:{i:0;i:7857;}i:7858;a:1:{i:0;i:7859;}i:7860;a:1:{i:0;i:7861;}i:7862;a:1:{i:0;i:7863;}i:7864;a:1:{i:0;i:7865;}i:7866;a:1:{i:0;i:7867;}i:7868;a:1:{i:0;i:7869;}i:7870;a:1:{i:0;i:7871;}i:7872;a:1:{i:0;i:7873;}i:7874;a:1:{i:0;i:7875;}i:7876;a:1:{i:0;i:7877;}i:7878;a:1:{i:0;i:7879;}i:7880;a:1:{i:0;i:7881;}i:7882;a:1:{i:0;i:7883;}i:7884;a:1:{i:0;i:7885;}i:7886;a:1:{i:0;i:7887;}i:7888;a:1:{i:0;i:7889;}i:7890;a:1:{i:0;i:7891;}i:7892;a:1:{i:0;i:7893;}i:7894;a:1:{i:0;i:7895;}i:7896;a:1:{i:0;i:7897;}i:7898;a:1:{i:0;i:7899;}i:7900;a:1:{i:0;i:7901;}i:7902;a:1:{i:0;i:7903;}i:7904;a:1:{i:0;i:7905;}i:7906;a:1:{i:0;i:7907;}i:7908;a:1:{i:0;i:7909;}i:7910;a:1:{i:0;i:7911;}i:7912;a:1:{i:0;i:7913;}i:7914;a:1:{i:0;i:7915;}i:7916;a:1:{i:0;i:7917;}i:7918;a:1:{i:0;i:7919;}i:7920;a:1:{i:0;i:7921;}i:7922;a:1:{i:0;i:7923;}i:7924;a:1:{i:0;i:7925;}i:7926;a:1:{i:0;i:7927;}i:7928;a:1:{i:0;i:7929;}i:7944;a:1:{i:0;i:7936;}i:7945;a:1:{i:0;i:7937;}i:7946;a:1:{i:0;i:7938;}i:7947;a:1:{i:0;i:7939;}i:7948;a:1:{i:0;i:7940;}i:7949;a:1:{i:0;i:7941;}i:7950;a:1:{i:0;i:7942;}i:7951;a:1:{i:0;i:7943;}i:7960;a:1:{i:0;i:7952;}i:7961;a:1:{i:0;i:7953;}i:7962;a:1:{i:0;i:7954;}i:7963;a:1:{i:0;i:7955;}i:7964;a:1:{i:0;i:7956;}i:7965;a:1:{i:0;i:7957;}i:7976;a:1:{i:0;i:7968;}i:7977;a:1:{i:0;i:7969;}i:7978;a:1:{i:0;i:7970;}i:7979;a:1:{i:0;i:7971;}i:7980;a:1:{i:0;i:7972;}i:7981;a:1:{i:0;i:7973;}i:7982;a:1:{i:0;i:7974;}i:7983;a:1:{i:0;i:7975;}i:7992;a:1:{i:0;i:7984;}i:7993;a:1:{i:0;i:7985;}i:7994;a:1:{i:0;i:7986;}i:7995;a:1:{i:0;i:7987;}i:7996;a:1:{i:0;i:7988;}i:7997;a:1:{i:0;i:7989;}i:7998;a:1:{i:0;i:7990;}i:7999;a:1:{i:0;i:7991;}i:8008;a:1:{i:0;i:8000;}i:8009;a:1:{i:0;i:8001;}i:8010;a:1:{i:0;i:8002;}i:8011;a:1:{i:0;i:8003;}i:8012;a:1:{i:0;i:8004;}i:8013;a:1:{i:0;i:8005;}i:8016;a:2:{i:0;i:965;i:1;i:787;}i:8018;a:3:{i:0;i:965;i:1;i:787;i:2;i:768;}i:8020;a:3:{i:0;i:965;i:1;i:787;i:2;i:769;}i:8022;a:3:{i:0;i:965;i:1;i:787;i:2;i:834;}i:8025;a:1:{i:0;i:8017;}i:8027;a:1:{i:0;i:8019;}i:8029;a:1:{i:0;i:8021;}i:8031;a:1:{i:0;i:8023;}i:8040;a:1:{i:0;i:8032;}i:8041;a:1:{i:0;i:8033;}i:8042;a:1:{i:0;i:8034;}i:8043;a:1:{i:0;i:8035;}i:8044;a:1:{i:0;i:8036;}i:8045;a:1:{i:0;i:8037;}i:8046;a:1:{i:0;i:8038;}i:8047;a:1:{i:0;i:8039;}i:8064;a:2:{i:0;i:7936;i:1;i:953;}i:8065;a:2:{i:0;i:7937;i:1;i:953;}i:8066;a:2:{i:0;i:7938;i:1;i:953;}i:8067;a:2:{i:0;i:7939;i:1;i:953;}i:8068;a:2:{i:0;i:7940;i:1;i:953;}i:8069;a:2:{i:0;i:7941;i:1;i:953;}i:8070;a:2:{i:0;i:7942;i:1;i:953;}i:8071;a:2:{i:0;i:7943;i:1;i:953;}i:8072;a:2:{i:0;i:7936;i:1;i:953;}i:8073;a:2:{i:0;i:7937;i:1;i:953;}i:8074;a:2:{i:0;i:7938;i:1;i:953;}i:8075;a:2:{i:0;i:7939;i:1;i:953;}i:8076;a:2:{i:0;i:7940;i:1;i:953;}i:8077;a:2:{i:0;i:7941;i:1;i:953;}i:8078;a:2:{i:0;i:7942;i:1;i:953;}i:8079;a:2:{i:0;i:7943;i:1;i:953;}i:8080;a:2:{i:0;i:7968;i:1;i:953;}i:8081;a:2:{i:0;i:7969;i:1;i:953;}i:8082;a:2:{i:0;i:7970;i:1;i:953;}i:8083;a:2:{i:0;i:7971;i:1;i:953;}i:8084;a:2:{i:0;i:7972;i:1;i:953;}i:8085;a:2:{i:0;i:7973;i:1;i:953;}i:8086;a:2:{i:0;i:7974;i:1;i:953;}i:8087;a:2:{i:0;i:7975;i:1;i:953;}i:8088;a:2:{i:0;i:7968;i:1;i:953;}i:8089;a:2:{i:0;i:7969;i:1;i:953;}i:8090;a:2:{i:0;i:7970;i:1;i:953;}i:8091;a:2:{i:0;i:7971;i:1;i:953;}i:8092;a:2:{i:0;i:7972;i:1;i:953;}i:8093;a:2:{i:0;i:7973;i:1;i:953;}i:8094;a:2:{i:0;i:7974;i:1;i:953;}i:8095;a:2:{i:0;i:7975;i:1;i:953;}i:8096;a:2:{i:0;i:8032;i:1;i:953;}i:8097;a:2:{i:0;i:8033;i:1;i:953;}i:8098;a:2:{i:0;i:8034;i:1;i:953;}i:8099;a:2:{i:0;i:8035;i:1;i:953;}i:8100;a:2:{i:0;i:8036;i:1;i:953;}i:8101;a:2:{i:0;i:8037;i:1;i:953;}i:8102;a:2:{i:0;i:8038;i:1;i:953;}i:8103;a:2:{i:0;i:8039;i:1;i:953;}i:8104;a:2:{i:0;i:8032;i:1;i:953;}i:8105;a:2:{i:0;i:8033;i:1;i:953;}i:8106;a:2:{i:0;i:8034;i:1;i:953;}i:8107;a:2:{i:0;i:8035;i:1;i:953;}i:8108;a:2:{i:0;i:8036;i:1;i:953;}i:8109;a:2:{i:0;i:8037;i:1;i:953;}i:8110;a:2:{i:0;i:8038;i:1;i:953;}i:8111;a:2:{i:0;i:8039;i:1;i:953;}i:8114;a:2:{i:0;i:8048;i:1;i:953;}i:8115;a:2:{i:0;i:945;i:1;i:953;}i:8116;a:2:{i:0;i:940;i:1;i:953;}i:8118;a:2:{i:0;i:945;i:1;i:834;}i:8119;a:3:{i:0;i:945;i:1;i:834;i:2;i:953;}i:8120;a:1:{i:0;i:8112;}i:8121;a:1:{i:0;i:8113;}i:8122;a:1:{i:0;i:8048;}i:8123;a:1:{i:0;i:8049;}i:8124;a:2:{i:0;i:945;i:1;i:953;}i:8126;a:1:{i:0;i:953;}i:8130;a:2:{i:0;i:8052;i:1;i:953;}i:8131;a:2:{i:0;i:951;i:1;i:953;}i:8132;a:2:{i:0;i:942;i:1;i:953;}i:8134;a:2:{i:0;i:951;i:1;i:834;}i:8135;a:3:{i:0;i:951;i:1;i:834;i:2;i:953;}i:8136;a:1:{i:0;i:8050;}i:8137;a:1:{i:0;i:8051;}i:8138;a:1:{i:0;i:8052;}i:8139;a:1:{i:0;i:8053;}i:8140;a:2:{i:0;i:951;i:1;i:953;}i:8146;a:3:{i:0;i:953;i:1;i:776;i:2;i:768;}i:8147;a:3:{i:0;i:953;i:1;i:776;i:2;i:769;}i:8150;a:2:{i:0;i:953;i:1;i:834;}i:8151;a:3:{i:0;i:953;i:1;i:776;i:2;i:834;}i:8152;a:1:{i:0;i:8144;}i:8153;a:1:{i:0;i:8145;}i:8154;a:1:{i:0;i:8054;}i:8155;a:1:{i:0;i:8055;}i:8162;a:3:{i:0;i:965;i:1;i:776;i:2;i:768;}i:8163;a:3:{i:0;i:965;i:1;i:776;i:2;i:769;}i:8164;a:2:{i:0;i:961;i:1;i:787;}i:8166;a:2:{i:0;i:965;i:1;i:834;}i:8167;a:3:{i:0;i:965;i:1;i:776;i:2;i:834;}i:8168;a:1:{i:0;i:8160;}i:8169;a:1:{i:0;i:8161;}i:8170;a:1:{i:0;i:8058;}i:8171;a:1:{i:0;i:8059;}i:8172;a:1:{i:0;i:8165;}i:8178;a:2:{i:0;i:8060;i:1;i:953;}i:8179;a:2:{i:0;i:969;i:1;i:953;}i:8180;a:2:{i:0;i:974;i:1;i:953;}i:8182;a:2:{i:0;i:969;i:1;i:834;}i:8183;a:3:{i:0;i:969;i:1;i:834;i:2;i:953;}i:8184;a:1:{i:0;i:8056;}i:8185;a:1:{i:0;i:8057;}i:8186;a:1:{i:0;i:8060;}i:8187;a:1:{i:0;i:8061;}i:8188;a:2:{i:0;i:969;i:1;i:953;}i:8360;a:2:{i:0;i:114;i:1;i:115;}i:8450;a:1:{i:0;i:99;}i:8451;a:2:{i:0;i:176;i:1;i:99;}i:8455;a:1:{i:0;i:603;}i:8457;a:2:{i:0;i:176;i:1;i:102;}i:8459;a:1:{i:0;i:104;}i:8460;a:1:{i:0;i:104;}i:8461;a:1:{i:0;i:104;}i:8464;a:1:{i:0;i:105;}i:8465;a:1:{i:0;i:105;}i:8466;a:1:{i:0;i:108;}i:8469;a:1:{i:0;i:110;}i:8470;a:2:{i:0;i:110;i:1;i:111;}i:8473;a:1:{i:0;i:112;}i:8474;a:1:{i:0;i:113;}i:8475;a:1:{i:0;i:114;}i:8476;a:1:{i:0;i:114;}i:8477;a:1:{i:0;i:114;}i:8480;a:2:{i:0;i:115;i:1;i:109;}i:8481;a:3:{i:0;i:116;i:1;i:101;i:2;i:108;}i:8482;a:2:{i:0;i:116;i:1;i:109;}i:8484;a:1:{i:0;i:122;}i:8486;a:1:{i:0;i:969;}i:8488;a:1:{i:0;i:122;}i:8490;a:1:{i:0;i:107;}i:8491;a:1:{i:0;i:229;}i:8492;a:1:{i:0;i:98;}i:8493;a:1:{i:0;i:99;}i:8496;a:1:{i:0;i:101;}i:8497;a:1:{i:0;i:102;}i:8499;a:1:{i:0;i:109;}i:8510;a:1:{i:0;i:947;}i:8511;a:1:{i:0;i:960;}i:8517;a:1:{i:0;i:100;}i:8544;a:1:{i:0;i:8560;}i:8545;a:1:{i:0;i:8561;}i:8546;a:1:{i:0;i:8562;}i:8547;a:1:{i:0;i:8563;}i:8548;a:1:{i:0;i:8564;}i:8549;a:1:{i:0;i:8565;}i:8550;a:1:{i:0;i:8566;}i:8551;a:1:{i:0;i:8567;}i:8552;a:1:{i:0;i:8568;}i:8553;a:1:{i:0;i:8569;}i:8554;a:1:{i:0;i:8570;}i:8555;a:1:{i:0;i:8571;}i:8556;a:1:{i:0;i:8572;}i:8557;a:1:{i:0;i:8573;}i:8558;a:1:{i:0;i:8574;}i:8559;a:1:{i:0;i:8575;}i:9398;a:1:{i:0;i:9424;}i:9399;a:1:{i:0;i:9425;}i:9400;a:1:{i:0;i:9426;}i:9401;a:1:{i:0;i:9427;}i:9402;a:1:{i:0;i:9428;}i:9403;a:1:{i:0;i:9429;}i:9404;a:1:{i:0;i:9430;}i:9405;a:1:{i:0;i:9431;}i:9406;a:1:{i:0;i:9432;}i:9407;a:1:{i:0;i:9433;}i:9408;a:1:{i:0;i:9434;}i:9409;a:1:{i:0;i:9435;}i:9410;a:1:{i:0;i:9436;}i:9411;a:1:{i:0;i:9437;}i:9412;a:1:{i:0;i:9438;}i:9413;a:1:{i:0;i:9439;}i:9414;a:1:{i:0;i:9440;}i:9415;a:1:{i:0;i:9441;}i:9416;a:1:{i:0;i:9442;}i:9417;a:1:{i:0;i:9443;}i:9418;a:1:{i:0;i:9444;}i:9419;a:1:{i:0;i:9445;}i:9420;a:1:{i:0;i:9446;}i:9421;a:1:{i:0;i:9447;}i:9422;a:1:{i:0;i:9448;}i:9423;a:1:{i:0;i:9449;}i:13169;a:3:{i:0;i:104;i:1;i:112;i:2;i:97;}i:13171;a:2:{i:0;i:97;i:1;i:117;}i:13173;a:2:{i:0;i:111;i:1;i:118;}i:13184;a:2:{i:0;i:112;i:1;i:97;}i:13185;a:2:{i:0;i:110;i:1;i:97;}i:13186;a:2:{i:0;i:956;i:1;i:97;}i:13187;a:2:{i:0;i:109;i:1;i:97;}i:13188;a:2:{i:0;i:107;i:1;i:97;}i:13189;a:2:{i:0;i:107;i:1;i:98;}i:13190;a:2:{i:0;i:109;i:1;i:98;}i:13191;a:2:{i:0;i:103;i:1;i:98;}i:13194;a:2:{i:0;i:112;i:1;i:102;}i:13195;a:2:{i:0;i:110;i:1;i:102;}i:13196;a:2:{i:0;i:956;i:1;i:102;}i:13200;a:2:{i:0;i:104;i:1;i:122;}i:13201;a:3:{i:0;i:107;i:1;i:104;i:2;i:122;}i:13202;a:3:{i:0;i:109;i:1;i:104;i:2;i:122;}i:13203;a:3:{i:0;i:103;i:1;i:104;i:2;i:122;}i:13204;a:3:{i:0;i:116;i:1;i:104;i:2;i:122;}i:13225;a:2:{i:0;i:112;i:1;i:97;}i:13226;a:3:{i:0;i:107;i:1;i:112;i:2;i:97;}i:13227;a:3:{i:0;i:109;i:1;i:112;i:2;i:97;}i:13228;a:3:{i:0;i:103;i:1;i:112;i:2;i:97;}i:13236;a:2:{i:0;i:112;i:1;i:118;}i:13237;a:2:{i:0;i:110;i:1;i:118;}i:13238;a:2:{i:0;i:956;i:1;i:118;}i:13239;a:2:{i:0;i:109;i:1;i:118;}i:13240;a:2:{i:0;i:107;i:1;i:118;}i:13241;a:2:{i:0;i:109;i:1;i:118;}i:13242;a:2:{i:0;i:112;i:1;i:119;}i:13243;a:2:{i:0;i:110;i:1;i:119;}i:13244;a:2:{i:0;i:956;i:1;i:119;}i:13245;a:2:{i:0;i:109;i:1;i:119;}i:13246;a:2:{i:0;i:107;i:1;i:119;}i:13247;a:2:{i:0;i:109;i:1;i:119;}i:13248;a:2:{i:0;i:107;i:1;i:969;}i:13249;a:2:{i:0;i:109;i:1;i:969;}i:13251;a:2:{i:0;i:98;i:1;i:113;}i:13254;a:4:{i:0;i:99;i:1;i:8725;i:2;i:107;i:3;i:103;}i:13255;a:3:{i:0;i:99;i:1;i:111;i:2;i:46;}i:13256;a:2:{i:0;i:100;i:1;i:98;}i:13257;a:2:{i:0;i:103;i:1;i:121;}i:13259;a:2:{i:0;i:104;i:1;i:112;}i:13261;a:2:{i:0;i:107;i:1;i:107;}i:13262;a:2:{i:0;i:107;i:1;i:109;}i:13271;a:2:{i:0;i:112;i:1;i:104;}i:13273;a:3:{i:0;i:112;i:1;i:112;i:2;i:109;}i:13274;a:2:{i:0;i:112;i:1;i:114;}i:13276;a:2:{i:0;i:115;i:1;i:118;}i:13277;a:2:{i:0;i:119;i:1;i:98;}i:64256;a:2:{i:0;i:102;i:1;i:102;}i:64257;a:2:{i:0;i:102;i:1;i:105;}i:64258;a:2:{i:0;i:102;i:1;i:108;}i:64259;a:3:{i:0;i:102;i:1;i:102;i:2;i:105;}i:64260;a:3:{i:0;i:102;i:1;i:102;i:2;i:108;}i:64261;a:2:{i:0;i:115;i:1;i:116;}i:64262;a:2:{i:0;i:115;i:1;i:116;}i:64275;a:2:{i:0;i:1396;i:1;i:1398;}i:64276;a:2:{i:0;i:1396;i:1;i:1381;}i:64277;a:2:{i:0;i:1396;i:1;i:1387;}i:64278;a:2:{i:0;i:1406;i:1;i:1398;}i:64279;a:2:{i:0;i:1396;i:1;i:1389;}i:65313;a:1:{i:0;i:65345;}i:65314;a:1:{i:0;i:65346;}i:65315;a:1:{i:0;i:65347;}i:65316;a:1:{i:0;i:65348;}i:65317;a:1:{i:0;i:65349;}i:65318;a:1:{i:0;i:65350;}i:65319;a:1:{i:0;i:65351;}i:65320;a:1:{i:0;i:65352;}i:65321;a:1:{i:0;i:65353;}i:65322;a:1:{i:0;i:65354;}i:65323;a:1:{i:0;i:65355;}i:65324;a:1:{i:0;i:65356;}i:65325;a:1:{i:0;i:65357;}i:65326;a:1:{i:0;i:65358;}i:65327;a:1:{i:0;i:65359;}i:65328;a:1:{i:0;i:65360;}i:65329;a:1:{i:0;i:65361;}i:65330;a:1:{i:0;i:65362;}i:65331;a:1:{i:0;i:65363;}i:65332;a:1:{i:0;i:65364;}i:65333;a:1:{i:0;i:65365;}i:65334;a:1:{i:0;i:65366;}i:65335;a:1:{i:0;i:65367;}i:65336;a:1:{i:0;i:65368;}i:65337;a:1:{i:0;i:65369;}i:65338;a:1:{i:0;i:65370;}i:66560;a:1:{i:0;i:66600;}i:66561;a:1:{i:0;i:66601;}i:66562;a:1:{i:0;i:66602;}i:66563;a:1:{i:0;i:66603;}i:66564;a:1:{i:0;i:66604;}i:66565;a:1:{i:0;i:66605;}i:66566;a:1:{i:0;i:66606;}i:66567;a:1:{i:0;i:66607;}i:66568;a:1:{i:0;i:66608;}i:66569;a:1:{i:0;i:66609;}i:66570;a:1:{i:0;i:66610;}i:66571;a:1:{i:0;i:66611;}i:66572;a:1:{i:0;i:66612;}i:66573;a:1:{i:0;i:66613;}i:66574;a:1:{i:0;i:66614;}i:66575;a:1:{i:0;i:66615;}i:66576;a:1:{i:0;i:66616;}i:66577;a:1:{i:0;i:66617;}i:66578;a:1:{i:0;i:66618;}i:66579;a:1:{i:0;i:66619;}i:66580;a:1:{i:0;i:66620;}i:66581;a:1:{i:0;i:66621;}i:66582;a:1:{i:0;i:66622;}i:66583;a:1:{i:0;i:66623;}i:66584;a:1:{i:0;i:66624;}i:66585;a:1:{i:0;i:66625;}i:66586;a:1:{i:0;i:66626;}i:66587;a:1:{i:0;i:66627;}i:66588;a:1:{i:0;i:66628;}i:66589;a:1:{i:0;i:66629;}i:66590;a:1:{i:0;i:66630;}i:66591;a:1:{i:0;i:66631;}i:66592;a:1:{i:0;i:66632;}i:66593;a:1:{i:0;i:66633;}i:66594;a:1:{i:0;i:66634;}i:66595;a:1:{i:0;i:66635;}i:66596;a:1:{i:0;i:66636;}i:66597;a:1:{i:0;i:66637;}i:119808;a:1:{i:0;i:97;}i:119809;a:1:{i:0;i:98;}i:119810;a:1:{i:0;i:99;}i:119811;a:1:{i:0;i:100;}i:119812;a:1:{i:0;i:101;}i:119813;a:1:{i:0;i:102;}i:119814;a:1:{i:0;i:103;}i:119815;a:1:{i:0;i:104;}i:119816;a:1:{i:0;i:105;}i:119817;a:1:{i:0;i:106;}i:119818;a:1:{i:0;i:107;}i:119819;a:1:{i:0;i:108;}i:119820;a:1:{i:0;i:109;}i:119821;a:1:{i:0;i:110;}i:119822;a:1:{i:0;i:111;}i:119823;a:1:{i:0;i:112;}i:119824;a:1:{i:0;i:113;}i:119825;a:1:{i:0;i:114;}i:119826;a:1:{i:0;i:115;}i:119827;a:1:{i:0;i:116;}i:119828;a:1:{i:0;i:117;}i:119829;a:1:{i:0;i:118;}i:119830;a:1:{i:0;i:119;}i:119831;a:1:{i:0;i:120;}i:119832;a:1:{i:0;i:121;}i:119833;a:1:{i:0;i:122;}i:119860;a:1:{i:0;i:97;}i:119861;a:1:{i:0;i:98;}i:119862;a:1:{i:0;i:99;}i:119863;a:1:{i:0;i:100;}i:119864;a:1:{i:0;i:101;}i:119865;a:1:{i:0;i:102;}i:119866;a:1:{i:0;i:103;}i:119867;a:1:{i:0;i:104;}i:119868;a:1:{i:0;i:105;}i:119869;a:1:{i:0;i:106;}i:119870;a:1:{i:0;i:107;}i:119871;a:1:{i:0;i:108;}i:119872;a:1:{i:0;i:109;}i:119873;a:1:{i:0;i:110;}i:119874;a:1:{i:0;i:111;}i:119875;a:1:{i:0;i:112;}i:119876;a:1:{i:0;i:113;}i:119877;a:1:{i:0;i:114;}i:119878;a:1:{i:0;i:115;}i:119879;a:1:{i:0;i:116;}i:119880;a:1:{i:0;i:117;}i:119881;a:1:{i:0;i:118;}i:119882;a:1:{i:0;i:119;}i:119883;a:1:{i:0;i:120;}i:119884;a:1:{i:0;i:121;}i:119885;a:1:{i:0;i:122;}i:119912;a:1:{i:0;i:97;}i:119913;a:1:{i:0;i:98;}i:119914;a:1:{i:0;i:99;}i:119915;a:1:{i:0;i:100;}i:119916;a:1:{i:0;i:101;}i:119917;a:1:{i:0;i:102;}i:119918;a:1:{i:0;i:103;}i:119919;a:1:{i:0;i:104;}i:119920;a:1:{i:0;i:105;}i:119921;a:1:{i:0;i:106;}i:119922;a:1:{i:0;i:107;}i:119923;a:1:{i:0;i:108;}i:119924;a:1:{i:0;i:109;}i:119925;a:1:{i:0;i:110;}i:119926;a:1:{i:0;i:111;}i:119927;a:1:{i:0;i:112;}i:119928;a:1:{i:0;i:113;}i:119929;a:1:{i:0;i:114;}i:119930;a:1:{i:0;i:115;}i:119931;a:1:{i:0;i:116;}i:119932;a:1:{i:0;i:117;}i:119933;a:1:{i:0;i:118;}i:119934;a:1:{i:0;i:119;}i:119935;a:1:{i:0;i:120;}i:119936;a:1:{i:0;i:121;}i:119937;a:1:{i:0;i:122;}i:119964;a:1:{i:0;i:97;}i:119966;a:1:{i:0;i:99;}i:119967;a:1:{i:0;i:100;}i:119970;a:1:{i:0;i:103;}i:119973;a:1:{i:0;i:106;}i:119974;a:1:{i:0;i:107;}i:119977;a:1:{i:0;i:110;}i:119978;a:1:{i:0;i:111;}i:119979;a:1:{i:0;i:112;}i:119980;a:1:{i:0;i:113;}i:119982;a:1:{i:0;i:115;}i:119983;a:1:{i:0;i:116;}i:119984;a:1:{i:0;i:117;}i:119985;a:1:{i:0;i:118;}i:119986;a:1:{i:0;i:119;}i:119987;a:1:{i:0;i:120;}i:119988;a:1:{i:0;i:121;}i:119989;a:1:{i:0;i:122;}i:120016;a:1:{i:0;i:97;}i:120017;a:1:{i:0;i:98;}i:120018;a:1:{i:0;i:99;}i:120019;a:1:{i:0;i:100;}i:120020;a:1:{i:0;i:101;}i:120021;a:1:{i:0;i:102;}i:120022;a:1:{i:0;i:103;}i:120023;a:1:{i:0;i:104;}i:120024;a:1:{i:0;i:105;}i:120025;a:1:{i:0;i:106;}i:120026;a:1:{i:0;i:107;}i:120027;a:1:{i:0;i:108;}i:120028;a:1:{i:0;i:109;}i:120029;a:1:{i:0;i:110;}i:120030;a:1:{i:0;i:111;}i:120031;a:1:{i:0;i:112;}i:120032;a:1:{i:0;i:113;}i:120033;a:1:{i:0;i:114;}i:120034;a:1:{i:0;i:115;}i:120035;a:1:{i:0;i:116;}i:120036;a:1:{i:0;i:117;}i:120037;a:1:{i:0;i:118;}i:120038;a:1:{i:0;i:119;}i:120039;a:1:{i:0;i:120;}i:120040;a:1:{i:0;i:121;}i:120041;a:1:{i:0;i:122;}i:120068;a:1:{i:0;i:97;}i:120069;a:1:{i:0;i:98;}i:120071;a:1:{i:0;i:100;}i:120072;a:1:{i:0;i:101;}i:120073;a:1:{i:0;i:102;}i:120074;a:1:{i:0;i:103;}i:120077;a:1:{i:0;i:106;}i:120078;a:1:{i:0;i:107;}i:120079;a:1:{i:0;i:108;}i:120080;a:1:{i:0;i:109;}i:120081;a:1:{i:0;i:110;}i:120082;a:1:{i:0;i:111;}i:120083;a:1:{i:0;i:112;}i:120084;a:1:{i:0;i:113;}i:120086;a:1:{i:0;i:115;}i:120087;a:1:{i:0;i:116;}i:120088;a:1:{i:0;i:117;}i:120089;a:1:{i:0;i:118;}i:120090;a:1:{i:0;i:119;}i:120091;a:1:{i:0;i:120;}i:120092;a:1:{i:0;i:121;}i:120120;a:1:{i:0;i:97;}i:120121;a:1:{i:0;i:98;}i:120123;a:1:{i:0;i:100;}i:120124;a:1:{i:0;i:101;}i:120125;a:1:{i:0;i:102;}i:120126;a:1:{i:0;i:103;}i:120128;a:1:{i:0;i:105;}i:120129;a:1:{i:0;i:106;}i:120130;a:1:{i:0;i:107;}i:120131;a:1:{i:0;i:108;}i:120132;a:1:{i:0;i:109;}i:120134;a:1:{i:0;i:111;}i:120138;a:1:{i:0;i:115;}i:120139;a:1:{i:0;i:116;}i:120140;a:1:{i:0;i:117;}i:120141;a:1:{i:0;i:118;}i:120142;a:1:{i:0;i:119;}i:120143;a:1:{i:0;i:120;}i:120144;a:1:{i:0;i:121;}i:120172;a:1:{i:0;i:97;}i:120173;a:1:{i:0;i:98;}i:120174;a:1:{i:0;i:99;}i:120175;a:1:{i:0;i:100;}i:120176;a:1:{i:0;i:101;}i:120177;a:1:{i:0;i:102;}i:120178;a:1:{i:0;i:103;}i:120179;a:1:{i:0;i:104;}i:120180;a:1:{i:0;i:105;}i:120181;a:1:{i:0;i:106;}i:120182;a:1:{i:0;i:107;}i:120183;a:1:{i:0;i:108;}i:120184;a:1:{i:0;i:109;}i:120185;a:1:{i:0;i:110;}i:120186;a:1:{i:0;i:111;}i:120187;a:1:{i:0;i:112;}i:120188;a:1:{i:0;i:113;}i:120189;a:1:{i:0;i:114;}i:120190;a:1:{i:0;i:115;}i:120191;a:1:{i:0;i:116;}i:120192;a:1:{i:0;i:117;}i:120193;a:1:{i:0;i:118;}i:120194;a:1:{i:0;i:119;}i:120195;a:1:{i:0;i:120;}i:120196;a:1:{i:0;i:121;}i:120197;a:1:{i:0;i:122;}i:120224;a:1:{i:0;i:97;}i:120225;a:1:{i:0;i:98;}i:120226;a:1:{i:0;i:99;}i:120227;a:1:{i:0;i:100;}i:120228;a:1:{i:0;i:101;}i:120229;a:1:{i:0;i:102;}i:120230;a:1:{i:0;i:103;}i:120231;a:1:{i:0;i:104;}i:120232;a:1:{i:0;i:105;}i:120233;a:1:{i:0;i:106;}i:120234;a:1:{i:0;i:107;}i:120235;a:1:{i:0;i:108;}i:120236;a:1:{i:0;i:109;}i:120237;a:1:{i:0;i:110;}i:120238;a:1:{i:0;i:111;}i:120239;a:1:{i:0;i:112;}i:120240;a:1:{i:0;i:113;}i:120241;a:1:{i:0;i:114;}i:120242;a:1:{i:0;i:115;}i:120243;a:1:{i:0;i:116;}i:120244;a:1:{i:0;i:117;}i:120245;a:1:{i:0;i:118;}i:120246;a:1:{i:0;i:119;}i:120247;a:1:{i:0;i:120;}i:120248;a:1:{i:0;i:121;}i:120249;a:1:{i:0;i:122;}i:120276;a:1:{i:0;i:97;}i:120277;a:1:{i:0;i:98;}i:120278;a:1:{i:0;i:99;}i:120279;a:1:{i:0;i:100;}i:120280;a:1:{i:0;i:101;}i:120281;a:1:{i:0;i:102;}i:120282;a:1:{i:0;i:103;}i:120283;a:1:{i:0;i:104;}i:120284;a:1:{i:0;i:105;}i:120285;a:1:{i:0;i:106;}i:120286;a:1:{i:0;i:107;}i:120287;a:1:{i:0;i:108;}i:120288;a:1:{i:0;i:109;}i:120289;a:1:{i:0;i:110;}i:120290;a:1:{i:0;i:111;}i:120291;a:1:{i:0;i:112;}i:120292;a:1:{i:0;i:113;}i:120293;a:1:{i:0;i:114;}i:120294;a:1:{i:0;i:115;}i:120295;a:1:{i:0;i:116;}i:120296;a:1:{i:0;i:117;}i:120297;a:1:{i:0;i:118;}i:120298;a:1:{i:0;i:119;}i:120299;a:1:{i:0;i:120;}i:120300;a:1:{i:0;i:121;}i:120301;a:1:{i:0;i:122;}i:120328;a:1:{i:0;i:97;}i:120329;a:1:{i:0;i:98;}i:120330;a:1:{i:0;i:99;}i:120331;a:1:{i:0;i:100;}i:120332;a:1:{i:0;i:101;}i:120333;a:1:{i:0;i:102;}i:120334;a:1:{i:0;i:103;}i:120335;a:1:{i:0;i:104;}i:120336;a:1:{i:0;i:105;}i:120337;a:1:{i:0;i:106;}i:120338;a:1:{i:0;i:107;}i:120339;a:1:{i:0;i:108;}i:120340;a:1:{i:0;i:109;}i:120341;a:1:{i:0;i:110;}i:120342;a:1:{i:0;i:111;}i:120343;a:1:{i:0;i:112;}i:120344;a:1:{i:0;i:113;}i:120345;a:1:{i:0;i:114;}i:120346;a:1:{i:0;i:115;}i:120347;a:1:{i:0;i:116;}i:120348;a:1:{i:0;i:117;}i:120349;a:1:{i:0;i:118;}i:120350;a:1:{i:0;i:119;}i:120351;a:1:{i:0;i:120;}i:120352;a:1:{i:0;i:121;}i:120353;a:1:{i:0;i:122;}i:120380;a:1:{i:0;i:97;}i:120381;a:1:{i:0;i:98;}i:120382;a:1:{i:0;i:99;}i:120383;a:1:{i:0;i:100;}i:120384;a:1:{i:0;i:101;}i:120385;a:1:{i:0;i:102;}i:120386;a:1:{i:0;i:103;}i:120387;a:1:{i:0;i:104;}i:120388;a:1:{i:0;i:105;}i:120389;a:1:{i:0;i:106;}i:120390;a:1:{i:0;i:107;}i:120391;a:1:{i:0;i:108;}i:120392;a:1:{i:0;i:109;}i:120393;a:1:{i:0;i:110;}i:120394;a:1:{i:0;i:111;}i:120395;a:1:{i:0;i:112;}i:120396;a:1:{i:0;i:113;}i:120397;a:1:{i:0;i:114;}i:120398;a:1:{i:0;i:115;}i:120399;a:1:{i:0;i:116;}i:120400;a:1:{i:0;i:117;}i:120401;a:1:{i:0;i:118;}i:120402;a:1:{i:0;i:119;}i:120403;a:1:{i:0;i:120;}i:120404;a:1:{i:0;i:121;}i:120405;a:1:{i:0;i:122;}i:120432;a:1:{i:0;i:97;}i:120433;a:1:{i:0;i:98;}i:120434;a:1:{i:0;i:99;}i:120435;a:1:{i:0;i:100;}i:120436;a:1:{i:0;i:101;}i:120437;a:1:{i:0;i:102;}i:120438;a:1:{i:0;i:103;}i:120439;a:1:{i:0;i:104;}i:120440;a:1:{i:0;i:105;}i:120441;a:1:{i:0;i:106;}i:120442;a:1:{i:0;i:107;}i:120443;a:1:{i:0;i:108;}i:120444;a:1:{i:0;i:109;}i:120445;a:1:{i:0;i:110;}i:120446;a:1:{i:0;i:111;}i:120447;a:1:{i:0;i:112;}i:120448;a:1:{i:0;i:113;}i:120449;a:1:{i:0;i:114;}i:120450;a:1:{i:0;i:115;}i:120451;a:1:{i:0;i:116;}i:120452;a:1:{i:0;i:117;}i:120453;a:1:{i:0;i:118;}i:120454;a:1:{i:0;i:119;}i:120455;a:1:{i:0;i:120;}i:120456;a:1:{i:0;i:121;}i:120457;a:1:{i:0;i:122;}i:120488;a:1:{i:0;i:945;}i:120489;a:1:{i:0;i:946;}i:120490;a:1:{i:0;i:947;}i:120491;a:1:{i:0;i:948;}i:120492;a:1:{i:0;i:949;}i:120493;a:1:{i:0;i:950;}i:120494;a:1:{i:0;i:951;}i:120495;a:1:{i:0;i:952;}i:120496;a:1:{i:0;i:953;}i:120497;a:1:{i:0;i:954;}i:120498;a:1:{i:0;i:955;}i:120499;a:1:{i:0;i:956;}i:120500;a:1:{i:0;i:957;}i:120501;a:1:{i:0;i:958;}i:120502;a:1:{i:0;i:959;}i:120503;a:1:{i:0;i:960;}i:120504;a:1:{i:0;i:961;}i:120505;a:1:{i:0;i:952;}i:120506;a:1:{i:0;i:963;}i:120507;a:1:{i:0;i:964;}i:120508;a:1:{i:0;i:965;}i:120509;a:1:{i:0;i:966;}i:120510;a:1:{i:0;i:967;}i:120511;a:1:{i:0;i:968;}i:120512;a:1:{i:0;i:969;}i:120531;a:1:{i:0;i:963;}i:120546;a:1:{i:0;i:945;}i:120547;a:1:{i:0;i:946;}i:120548;a:1:{i:0;i:947;}i:120549;a:1:{i:0;i:948;}i:120550;a:1:{i:0;i:949;}i:120551;a:1:{i:0;i:950;}i:120552;a:1:{i:0;i:951;}i:120553;a:1:{i:0;i:952;}i:120554;a:1:{i:0;i:953;}i:120555;a:1:{i:0;i:954;}i:120556;a:1:{i:0;i:955;}i:120557;a:1:{i:0;i:956;}i:120558;a:1:{i:0;i:957;}i:120559;a:1:{i:0;i:958;}i:120560;a:1:{i:0;i:959;}i:120561;a:1:{i:0;i:960;}i:120562;a:1:{i:0;i:961;}i:120563;a:1:{i:0;i:952;}i:120564;a:1:{i:0;i:963;}i:120565;a:1:{i:0;i:964;}i:120566;a:1:{i:0;i:965;}i:120567;a:1:{i:0;i:966;}i:120568;a:1:{i:0;i:967;}i:120569;a:1:{i:0;i:968;}i:120570;a:1:{i:0;i:969;}i:120589;a:1:{i:0;i:963;}i:120604;a:1:{i:0;i:945;}i:120605;a:1:{i:0;i:946;}i:120606;a:1:{i:0;i:947;}i:120607;a:1:{i:0;i:948;}i:120608;a:1:{i:0;i:949;}i:120609;a:1:{i:0;i:950;}i:120610;a:1:{i:0;i:951;}i:120611;a:1:{i:0;i:952;}i:120612;a:1:{i:0;i:953;}i:120613;a:1:{i:0;i:954;}i:120614;a:1:{i:0;i:955;}i:120615;a:1:{i:0;i:956;}i:120616;a:1:{i:0;i:957;}i:120617;a:1:{i:0;i:958;}i:120618;a:1:{i:0;i:959;}i:120619;a:1:{i:0;i:960;}i:120620;a:1:{i:0;i:961;}i:120621;a:1:{i:0;i:952;}i:120622;a:1:{i:0;i:963;}i:120623;a:1:{i:0;i:964;}i:120624;a:1:{i:0;i:965;}i:120625;a:1:{i:0;i:966;}i:120626;a:1:{i:0;i:967;}i:120627;a:1:{i:0;i:968;}i:120628;a:1:{i:0;i:969;}i:120647;a:1:{i:0;i:963;}i:120662;a:1:{i:0;i:945;}i:120663;a:1:{i:0;i:946;}i:120664;a:1:{i:0;i:947;}i:120665;a:1:{i:0;i:948;}i:120666;a:1:{i:0;i:949;}i:120667;a:1:{i:0;i:950;}i:120668;a:1:{i:0;i:951;}i:120669;a:1:{i:0;i:952;}i:120670;a:1:{i:0;i:953;}i:120671;a:1:{i:0;i:954;}i:120672;a:1:{i:0;i:955;}i:120673;a:1:{i:0;i:956;}i:120674;a:1:{i:0;i:957;}i:120675;a:1:{i:0;i:958;}i:120676;a:1:{i:0;i:959;}i:120677;a:1:{i:0;i:960;}i:120678;a:1:{i:0;i:961;}i:120679;a:1:{i:0;i:952;}i:120680;a:1:{i:0;i:963;}i:120681;a:1:{i:0;i:964;}i:120682;a:1:{i:0;i:965;}i:120683;a:1:{i:0;i:966;}i:120684;a:1:{i:0;i:967;}i:120685;a:1:{i:0;i:968;}i:120686;a:1:{i:0;i:969;}i:120705;a:1:{i:0;i:963;}i:120720;a:1:{i:0;i:945;}i:120721;a:1:{i:0;i:946;}i:120722;a:1:{i:0;i:947;}i:120723;a:1:{i:0;i:948;}i:120724;a:1:{i:0;i:949;}i:120725;a:1:{i:0;i:950;}i:120726;a:1:{i:0;i:951;}i:120727;a:1:{i:0;i:952;}i:120728;a:1:{i:0;i:953;}i:120729;a:1:{i:0;i:954;}i:120730;a:1:{i:0;i:955;}i:120731;a:1:{i:0;i:956;}i:120732;a:1:{i:0;i:957;}i:120733;a:1:{i:0;i:958;}i:120734;a:1:{i:0;i:959;}i:120735;a:1:{i:0;i:960;}i:120736;a:1:{i:0;i:961;}i:120737;a:1:{i:0;i:952;}i:120738;a:1:{i:0;i:963;}i:120739;a:1:{i:0;i:964;}i:120740;a:1:{i:0;i:965;}i:120741;a:1:{i:0;i:966;}i:120742;a:1:{i:0;i:967;}i:120743;a:1:{i:0;i:968;}i:120744;a:1:{i:0;i:969;}i:120763;a:1:{i:0;i:963;}i:1017;a:1:{i:0;i:963;}i:7468;a:1:{i:0;i:97;}i:7469;a:1:{i:0;i:230;}i:7470;a:1:{i:0;i:98;}i:7472;a:1:{i:0;i:100;}i:7473;a:1:{i:0;i:101;}i:7474;a:1:{i:0;i:477;}i:7475;a:1:{i:0;i:103;}i:7476;a:1:{i:0;i:104;}i:7477;a:1:{i:0;i:105;}i:7478;a:1:{i:0;i:106;}i:7479;a:1:{i:0;i:107;}i:7480;a:1:{i:0;i:108;}i:7481;a:1:{i:0;i:109;}i:7482;a:1:{i:0;i:110;}i:7484;a:1:{i:0;i:111;}i:7485;a:1:{i:0;i:547;}i:7486;a:1:{i:0;i:112;}i:7487;a:1:{i:0;i:114;}i:7488;a:1:{i:0;i:116;}i:7489;a:1:{i:0;i:117;}i:7490;a:1:{i:0;i:119;}i:8507;a:3:{i:0;i:102;i:1;i:97;i:2;i:120;}i:12880;a:3:{i:0;i:112;i:1;i:116;i:2;i:101;}i:13004;a:2:{i:0;i:104;i:1;i:103;}i:13006;a:2:{i:0;i:101;i:1;i:118;}i:13007;a:3:{i:0;i:108;i:1;i:116;i:2;i:100;}i:13178;a:2:{i:0;i:105;i:1;i:117;}i:13278;a:3:{i:0;i:118;i:1;i:8725;i:2;i:109;}i:13279;a:3:{i:0;i:97;i:1;i:8725;i:2;i:109;}}s:12:"norm_combcls";a:341:{i:820;i:1;i:821;i:1;i:822;i:1;i:823;i:1;i:824;i:1;i:2364;i:7;i:2492;i:7;i:2620;i:7;i:2748;i:7;i:2876;i:7;i:3260;i:7;i:4151;i:7;i:12441;i:8;i:12442;i:8;i:2381;i:9;i:2509;i:9;i:2637;i:9;i:2765;i:9;i:2893;i:9;i:3021;i:9;i:3149;i:9;i:3277;i:9;i:3405;i:9;i:3530;i:9;i:3642;i:9;i:3972;i:9;i:4153;i:9;i:5908;i:9;i:5940;i:9;i:6098;i:9;i:1456;i:10;i:1457;i:11;i:1458;i:12;i:1459;i:13;i:1460;i:14;i:1461;i:15;i:1462;i:16;i:1463;i:17;i:1464;i:18;i:1465;i:19;i:1467;i:20;i:1468;i:21;i:1469;i:22;i:1471;i:23;i:1473;i:24;i:1474;i:25;i:64286;i:26;i:1611;i:27;i:1612;i:28;i:1613;i:29;i:1614;i:30;i:1615;i:31;i:1616;i:32;i:1617;i:33;i:1618;i:34;i:1648;i:35;i:1809;i:36;i:3157;i:84;i:3158;i:91;i:3640;i:103;i:3641;i:103;i:3656;i:107;i:3657;i:107;i:3658;i:107;i:3659;i:107;i:3768;i:118;i:3769;i:118;i:3784;i:122;i:3785;i:122;i:3786;i:122;i:3787;i:122;i:3953;i:129;i:3954;i:130;i:3962;i:130;i:3963;i:130;i:3964;i:130;i:3965;i:130;i:3968;i:130;i:3956;i:132;i:801;i:202;i:802;i:202;i:807;i:202;i:808;i:202;i:795;i:216;i:3897;i:216;i:119141;i:216;i:119142;i:216;i:119150;i:216;i:119151;i:216;i:119152;i:216;i:119153;i:216;i:119154;i:216;i:12330;i:218;i:790;i:220;i:791;i:220;i:792;i:220;i:793;i:220;i:796;i:220;i:797;i:220;i:798;i:220;i:799;i:220;i:800;i:220;i:803;i:220;i:804;i:220;i:805;i:220;i:806;i:220;i:809;i:220;i:810;i:220;i:811;i:220;i:812;i:220;i:813;i:220;i:814;i:220;i:815;i:220;i:816;i:220;i:817;i:220;i:818;i:220;i:819;i:220;i:825;i:220;i:826;i:220;i:827;i:220;i:828;i:220;i:839;i:220;i:840;i:220;i:841;i:220;i:845;i:220;i:846;i:220;i:851;i:220;i:852;i:220;i:853;i:220;i:854;i:220;i:1425;i:220;i:1430;i:220;i:1435;i:220;i:1443;i:220;i:1444;i:220;i:1445;i:220;i:1446;i:220;i:1447;i:220;i:1450;i:220;i:1621;i:220;i:1622;i:220;i:1763;i:220;i:1770;i:220;i:1773;i:220;i:1841;i:220;i:1844;i:220;i:1847;i:220;i:1848;i:220;i:1849;i:220;i:1851;i:220;i:1852;i:220;i:1854;i:220;i:1858;i:220;i:1860;i:220;i:1862;i:220;i:1864;i:220;i:2386;i:220;i:3864;i:220;i:3865;i:220;i:3893;i:220;i:3895;i:220;i:4038;i:220;i:6459;i:220;i:8424;i:220;i:119163;i:220;i:119164;i:220;i:119165;i:220;i:119166;i:220;i:119167;i:220;i:119168;i:220;i:119169;i:220;i:119170;i:220;i:119178;i:220;i:119179;i:220;i:1434;i:222;i:1453;i:222;i:6441;i:222;i:12333;i:222;i:12334;i:224;i:12335;i:224;i:119149;i:226;i:1454;i:228;i:6313;i:228;i:12331;i:228;i:768;i:230;i:769;i:230;i:770;i:230;i:771;i:230;i:772;i:230;i:773;i:230;i:774;i:230;i:775;i:230;i:776;i:230;i:777;i:230;i:778;i:230;i:779;i:230;i:780;i:230;i:781;i:230;i:782;i:230;i:783;i:230;i:784;i:230;i:785;i:230;i:786;i:230;i:787;i:230;i:788;i:230;i:829;i:230;i:830;i:230;i:831;i:230;i:832;i:230;i:833;i:230;i:834;i:230;i:835;i:230;i:836;i:230;i:838;i:230;i:842;i:230;i:843;i:230;i:844;i:230;i:848;i:230;i:849;i:230;i:850;i:230;i:855;i:230;i:867;i:230;i:868;i:230;i:869;i:230;i:870;i:230;i:871;i:230;i:872;i:230;i:873;i:230;i:874;i:230;i:875;i:230;i:876;i:230;i:877;i:230;i:878;i:230;i:879;i:230;i:1155;i:230;i:1156;i:230;i:1157;i:230;i:1158;i:230;i:1426;i:230;i:1427;i:230;i:1428;i:230;i:1429;i:230;i:1431;i:230;i:1432;i:230;i:1433;i:230;i:1436;i:230;i:1437;i:230;i:1438;i:230;i:1439;i:230;i:1440;i:230;i:1441;i:230;i:1448;i:230;i:1449;i:230;i:1451;i:230;i:1452;i:230;i:1455;i:230;i:1476;i:230;i:1552;i:230;i:1553;i:230;i:1554;i:230;i:1555;i:230;i:1556;i:230;i:1557;i:230;i:1619;i:230;i:1620;i:230;i:1623;i:230;i:1624;i:230;i:1750;i:230;i:1751;i:230;i:1752;i:230;i:1753;i:230;i:1754;i:230;i:1755;i:230;i:1756;i:230;i:1759;i:230;i:1760;i:230;i:1761;i:230;i:1762;i:230;i:1764;i:230;i:1767;i:230;i:1768;i:230;i:1771;i:230;i:1772;i:230;i:1840;i:230;i:1842;i:230;i:1843;i:230;i:1845;i:230;i:1846;i:230;i:1850;i:230;i:1853;i:230;i:1855;i:230;i:1856;i:230;i:1857;i:230;i:1859;i:230;i:1861;i:230;i:1863;i:230;i:1865;i:230;i:1866;i:230;i:2385;i:230;i:2387;i:230;i:2388;i:230;i:3970;i:230;i:3971;i:230;i:3974;i:230;i:3975;i:230;i:5901;i:230;i:6458;i:230;i:8400;i:230;i:8401;i:230;i:8404;i:230;i:8405;i:230;i:8406;i:230;i:8407;i:230;i:8411;i:230;i:8412;i:230;i:8417;i:230;i:8423;i:230;i:8425;i:230;i:65056;i:230;i:65057;i:230;i:65058;i:230;i:65059;i:230;i:119173;i:230;i:119174;i:230;i:119175;i:230;i:119177;i:230;i:119176;i:230;i:119210;i:230;i:119211;i:230;i:119212;i:230;i:119213;i:230;i:789;i:232;i:794;i:232;i:12332;i:232;i:863;i:233;i:866;i:233;i:861;i:234;i:862;i:234;i:864;i:234;i:865;i:234;i:837;i:240;}}
@@ -1,3274 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @version 1.4.1 - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * SimplePie Name - */ -define('SIMPLEPIE_NAME', 'SimplePie'); - -/** - * SimplePie Version - */ -define('SIMPLEPIE_VERSION', '1.4.1'); - -/** - * SimplePie Build - * @todo Hardcode for release (there's no need to have to call SimplePie_Misc::get_build() only every load of simplepie.inc) - */ -define('SIMPLEPIE_BUILD', gmdate('YmdHis', SimplePie_Misc::get_build())); - -/** - * SimplePie Website URL - */ -define('SIMPLEPIE_URL', 'http://simplepie.org'); - -/** - * SimplePie Useragent - * @see SimplePie::set_useragent() - */ -define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed Parser; ' . SIMPLEPIE_URL . '; Allow like Gecko) Build/' . SIMPLEPIE_BUILD); - -/** - * SimplePie Linkback - */ -define('SIMPLEPIE_LINKBACK', '<a href="' . SIMPLEPIE_URL . '" title="' . SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . '">' . SIMPLEPIE_NAME . '</a>'); - -/** - * No Autodiscovery - * @see SimplePie::set_autodiscovery_level() - */ -define('SIMPLEPIE_LOCATOR_NONE', 0); - -/** - * Feed Link Element Autodiscovery - * @see SimplePie::set_autodiscovery_level() - */ -define('SIMPLEPIE_LOCATOR_AUTODISCOVERY', 1); - -/** - * Local Feed Extension Autodiscovery - * @see SimplePie::set_autodiscovery_level() - */ -define('SIMPLEPIE_LOCATOR_LOCAL_EXTENSION', 2); - -/** - * Local Feed Body Autodiscovery - * @see SimplePie::set_autodiscovery_level() - */ -define('SIMPLEPIE_LOCATOR_LOCAL_BODY', 4); - -/** - * Remote Feed Extension Autodiscovery - * @see SimplePie::set_autodiscovery_level() - */ -define('SIMPLEPIE_LOCATOR_REMOTE_EXTENSION', 8); - -/** - * Remote Feed Body Autodiscovery - * @see SimplePie::set_autodiscovery_level() - */ -define('SIMPLEPIE_LOCATOR_REMOTE_BODY', 16); - -/** - * All Feed Autodiscovery - * @see SimplePie::set_autodiscovery_level() - */ -define('SIMPLEPIE_LOCATOR_ALL', 31); - -/** - * No known feed type - */ -define('SIMPLEPIE_TYPE_NONE', 0); - -/** - * RSS 0.90 - */ -define('SIMPLEPIE_TYPE_RSS_090', 1); - -/** - * RSS 0.91 (Netscape) - */ -define('SIMPLEPIE_TYPE_RSS_091_NETSCAPE', 2); - -/** - * RSS 0.91 (Userland) - */ -define('SIMPLEPIE_TYPE_RSS_091_USERLAND', 4); - -/** - * RSS 0.91 (both Netscape and Userland) - */ -define('SIMPLEPIE_TYPE_RSS_091', 6); - -/** - * RSS 0.92 - */ -define('SIMPLEPIE_TYPE_RSS_092', 8); - -/** - * RSS 0.93 - */ -define('SIMPLEPIE_TYPE_RSS_093', 16); - -/** - * RSS 0.94 - */ -define('SIMPLEPIE_TYPE_RSS_094', 32); - -/** - * RSS 1.0 - */ -define('SIMPLEPIE_TYPE_RSS_10', 64); - -/** - * RSS 2.0 - */ -define('SIMPLEPIE_TYPE_RSS_20', 128); - -/** - * RDF-based RSS - */ -define('SIMPLEPIE_TYPE_RSS_RDF', 65); - -/** - * Non-RDF-based RSS (truly intended as syndication format) - */ -define('SIMPLEPIE_TYPE_RSS_SYNDICATION', 190); - -/** - * All RSS - */ -define('SIMPLEPIE_TYPE_RSS_ALL', 255); - -/** - * Atom 0.3 - */ -define('SIMPLEPIE_TYPE_ATOM_03', 256); - -/** - * Atom 1.0 - */ -define('SIMPLEPIE_TYPE_ATOM_10', 512); - -/** - * All Atom - */ -define('SIMPLEPIE_TYPE_ATOM_ALL', 768); - -/** - * All feed types - */ -define('SIMPLEPIE_TYPE_ALL', 1023); - -/** - * No construct - */ -define('SIMPLEPIE_CONSTRUCT_NONE', 0); - -/** - * Text construct - */ -define('SIMPLEPIE_CONSTRUCT_TEXT', 1); - -/** - * HTML construct - */ -define('SIMPLEPIE_CONSTRUCT_HTML', 2); - -/** - * XHTML construct - */ -define('SIMPLEPIE_CONSTRUCT_XHTML', 4); - -/** - * base64-encoded construct - */ -define('SIMPLEPIE_CONSTRUCT_BASE64', 8); - -/** - * IRI construct - */ -define('SIMPLEPIE_CONSTRUCT_IRI', 16); - -/** - * A construct that might be HTML - */ -define('SIMPLEPIE_CONSTRUCT_MAYBE_HTML', 32); - -/** - * All constructs - */ -define('SIMPLEPIE_CONSTRUCT_ALL', 63); - -/** - * Don't change case - */ -define('SIMPLEPIE_SAME_CASE', 1); - -/** - * Change to lowercase - */ -define('SIMPLEPIE_LOWERCASE', 2); - -/** - * Change to uppercase - */ -define('SIMPLEPIE_UPPERCASE', 4); - -/** - * PCRE for HTML attributes - */ -define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:[\x09\x0A\x0B\x0C\x0D\x20]+[^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*'); - -/** - * PCRE for XML attributes - */ -define('SIMPLEPIE_PCRE_XML_ATTRIBUTE', '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*'); - -/** - * XML Namespace - */ -define('SIMPLEPIE_NAMESPACE_XML', 'http://www.w3.org/XML/1998/namespace'); - -/** - * Atom 1.0 Namespace - */ -define('SIMPLEPIE_NAMESPACE_ATOM_10', 'http://www.w3.org/2005/Atom'); - -/** - * Atom 0.3 Namespace - */ -define('SIMPLEPIE_NAMESPACE_ATOM_03', 'http://purl.org/atom/ns#'); - -/** - * RDF Namespace - */ -define('SIMPLEPIE_NAMESPACE_RDF', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); - -/** - * RSS 0.90 Namespace - */ -define('SIMPLEPIE_NAMESPACE_RSS_090', 'http://my.netscape.com/rdf/simple/0.9/'); - -/** - * RSS 1.0 Namespace - */ -define('SIMPLEPIE_NAMESPACE_RSS_10', 'http://purl.org/rss/1.0/'); - -/** - * RSS 1.0 Content Module Namespace - */ -define('SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT', 'http://purl.org/rss/1.0/modules/content/'); - -/** - * RSS 2.0 Namespace - * (Stupid, I know, but I'm certain it will confuse people less with support.) - */ -define('SIMPLEPIE_NAMESPACE_RSS_20', ''); - -/** - * DC 1.0 Namespace - */ -define('SIMPLEPIE_NAMESPACE_DC_10', 'http://purl.org/dc/elements/1.0/'); - -/** - * DC 1.1 Namespace - */ -define('SIMPLEPIE_NAMESPACE_DC_11', 'http://purl.org/dc/elements/1.1/'); - -/** - * W3C Basic Geo (WGS84 lat/long) Vocabulary Namespace - */ -define('SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO', 'http://www.w3.org/2003/01/geo/wgs84_pos#'); - -/** - * GeoRSS Namespace - */ -define('SIMPLEPIE_NAMESPACE_GEORSS', 'http://www.georss.org/georss'); - -/** - * Media RSS Namespace - */ -define('SIMPLEPIE_NAMESPACE_MEDIARSS', 'http://search.yahoo.com/mrss/'); - -/** - * Wrong Media RSS Namespace. Caused by a long-standing typo in the spec. - */ -define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss'); - -/** - * Wrong Media RSS Namespace #2. New namespace introduced in Media RSS 1.5. - */ -define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG2', 'http://video.search.yahoo.com/mrss'); - -/** - * Wrong Media RSS Namespace #3. A possible typo of the Media RSS 1.5 namespace. - */ -define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG3', 'http://video.search.yahoo.com/mrss/'); - -/** - * Wrong Media RSS Namespace #4. New spec location after the RSS Advisory Board takes it over, but not a valid namespace. - */ -define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG4', 'http://www.rssboard.org/media-rss'); - -/** - * Wrong Media RSS Namespace #5. A possible typo of the RSS Advisory Board URL. - */ -define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5', 'http://www.rssboard.org/media-rss/'); - -/** - * iTunes RSS Namespace - */ -define('SIMPLEPIE_NAMESPACE_ITUNES', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); - -/** - * XHTML Namespace - */ -define('SIMPLEPIE_NAMESPACE_XHTML', 'http://www.w3.org/1999/xhtml'); - -/** - * IANA Link Relations Registry - */ -define('SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY', 'http://www.iana.org/assignments/relation/'); - -/** - * No file source - */ -define('SIMPLEPIE_FILE_SOURCE_NONE', 0); - -/** - * Remote file source - */ -define('SIMPLEPIE_FILE_SOURCE_REMOTE', 1); - -/** - * Local file source - */ -define('SIMPLEPIE_FILE_SOURCE_LOCAL', 2); - -/** - * fsockopen() file source - */ -define('SIMPLEPIE_FILE_SOURCE_FSOCKOPEN', 4); - -/** - * cURL file source - */ -define('SIMPLEPIE_FILE_SOURCE_CURL', 8); - -/** - * file_get_contents() file source - */ -define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16); - - - -/** - * SimplePie - * - * @package SimplePie - * @subpackage API - */ -class SimplePie -{ - /** - * @var array Raw data - * @access private - */ - public $data = array(); - - /** - * @var mixed Error string - * @access private - */ - public $error; - - /** - * @var object Instance of SimplePie_Sanitize (or other class) - * @see SimplePie::set_sanitize_class() - * @access private - */ - public $sanitize; - - /** - * @var string SimplePie Useragent - * @see SimplePie::set_useragent() - * @access private - */ - public $useragent = SIMPLEPIE_USERAGENT; - - /** - * @var string Feed URL - * @see SimplePie::set_feed_url() - * @access private - */ - public $feed_url; - - /** - * @var string Original feed URL, or new feed URL iff HTTP 301 Moved Permanently - * @see SimplePie::subscribe_url() - * @access private - */ - public $permanent_url = null; - - /** - * @var object Instance of SimplePie_File to use as a feed - * @see SimplePie::set_file() - * @access private - */ - public $file; - - /** - * @var string Raw feed data - * @see SimplePie::set_raw_data() - * @access private - */ - public $raw_data; - - /** - * @var int Timeout for fetching remote files - * @see SimplePie::set_timeout() - * @access private - */ - public $timeout = 10; - - /** - * @var array Custom curl options - * @see SimplePie::set_curl_options() - * @access private - */ - public $curl_options = array(); - - /** - * @var bool Forces fsockopen() to be used for remote files instead - * of cURL, even if a new enough version is installed - * @see SimplePie::force_fsockopen() - * @access private - */ - public $force_fsockopen = false; - - /** - * @var bool Force the given data/URL to be treated as a feed no matter what - * it appears like - * @see SimplePie::force_feed() - * @access private - */ - public $force_feed = false; - - /** - * @var bool Enable/Disable Caching - * @see SimplePie::enable_cache() - * @access private - */ - public $cache = true; - - /** - * @var bool Force SimplePie to fallback to expired cache, if enabled, - * when feed is unavailable. - * @see SimplePie::force_cache_fallback() - * @access private - */ - public $force_cache_fallback = false; - - /** - * @var int Cache duration (in seconds) - * @see SimplePie::set_cache_duration() - * @access private - */ - public $cache_duration = 3600; - - /** - * @var int Auto-discovery cache duration (in seconds) - * @see SimplePie::set_autodiscovery_cache_duration() - * @access private - */ - public $autodiscovery_cache_duration = 604800; // 7 Days. - - /** - * @var string Cache location (relative to executing script) - * @see SimplePie::set_cache_location() - * @access private - */ - public $cache_location = './cache'; - - /** - * @var string Function that creates the cache filename - * @see SimplePie::set_cache_name_function() - * @access private - */ - public $cache_name_function = 'md5'; - - /** - * @var bool Reorder feed by date descending - * @see SimplePie::enable_order_by_date() - * @access private - */ - public $order_by_date = true; - - /** - * @var mixed Force input encoding to be set to the follow value - * (false, or anything type-cast to false, disables this feature) - * @see SimplePie::set_input_encoding() - * @access private - */ - public $input_encoding = false; - - /** - * @var int Feed Autodiscovery Level - * @see SimplePie::set_autodiscovery_level() - * @access private - */ - public $autodiscovery = SIMPLEPIE_LOCATOR_ALL; - - /** - * Class registry object - * - * @var SimplePie_Registry - */ - public $registry; - - /** - * @var int Maximum number of feeds to check with autodiscovery - * @see SimplePie::set_max_checked_feeds() - * @access private - */ - public $max_checked_feeds = 10; - - /** - * @var array All the feeds found during the autodiscovery process - * @see SimplePie::get_all_discovered_feeds() - * @access private - */ - public $all_discovered_feeds = array(); - - /** - * @var string Web-accessible path to the handler_image.php file. - * @see SimplePie::set_image_handler() - * @access private - */ - public $image_handler = ''; - - /** - * @var array Stores the URLs when multiple feeds are being initialized. - * @see SimplePie::set_feed_url() - * @access private - */ - public $multifeed_url = array(); - - /** - * @var array Stores SimplePie objects when multiple feeds initialized. - * @access private - */ - public $multifeed_objects = array(); - - /** - * @var array Stores the get_object_vars() array for use with multifeeds. - * @see SimplePie::set_feed_url() - * @access private - */ - public $config_settings = null; - - /** - * @var integer Stores the number of items to return per-feed with multifeeds. - * @see SimplePie::set_item_limit() - * @access private - */ - public $item_limit = 0; - - /** - * @var bool Stores if last-modified and/or etag headers were sent with the - * request when checking a feed. - */ - public $check_modified = false; - - /** - * @var array Stores the default attributes to be stripped by strip_attributes(). - * @see SimplePie::strip_attributes() - * @access private - */ - public $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'); - - /** - * @var array Stores the default attributes to add to different tags by add_attributes(). - * @see SimplePie::add_attributes() - * @access private - */ - public $add_attributes = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none')); - - /** - * @var array Stores the default tags to be stripped by strip_htmltags(). - * @see SimplePie::strip_htmltags() - * @access private - */ - public $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); - - /** - * The SimplePie class contains feed level data and options - * - * To use SimplePie, create the SimplePie object with no parameters. You can - * then set configuration options using the provided methods. After setting - * them, you must initialise the feed using $feed->init(). At that point the - * object's methods and properties will be available to you. - * - * Previously, it was possible to pass in the feed URL along with cache - * options directly into the constructor. This has been removed as of 1.3 as - * it caused a lot of confusion. - * - * @since 1.0 Preview Release - */ - public function __construct() - { - if (version_compare(PHP_VERSION, '5.2', '<')) - { - trigger_error('PHP 4.x, 5.0 and 5.1 are no longer supported. Please upgrade to PHP 5.2 or newer.'); - die(); - } - - // Other objects, instances created here so we can set options on them - $this->sanitize = new SimplePie_Sanitize(); - $this->registry = new SimplePie_Registry(); - - if (func_num_args() > 0) - { - $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; - trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_duration() directly.', $level); - - $args = func_get_args(); - switch (count($args)) { - case 3: - $this->set_cache_duration($args[2]); - case 2: - $this->set_cache_location($args[1]); - case 1: - $this->set_feed_url($args[0]); - $this->init(); - } - } - } - - /** - * Used for converting object to a string - */ - public function __toString() - { - return md5(serialize($this->data)); - } - - /** - * Remove items that link back to this before destroying this object - */ - public function __destruct() - { - if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) - { - if (!empty($this->data['items'])) - { - foreach ($this->data['items'] as $item) - { - $item->__destruct(); - } - unset($item, $this->data['items']); - } - if (!empty($this->data['ordered_items'])) - { - foreach ($this->data['ordered_items'] as $item) - { - $item->__destruct(); - } - unset($item, $this->data['ordered_items']); - } - } - } - - /** - * Force the given data/URL to be treated as a feed - * - * This tells SimplePie to ignore the content-type provided by the server. - * Be careful when using this option, as it will also disable autodiscovery. - * - * @since 1.1 - * @param bool $enable Force the given data/URL to be treated as a feed - */ - public function force_feed($enable = false) - { - $this->force_feed = (bool) $enable; - } - - /** - * Set the URL of the feed you want to parse - * - * This allows you to enter the URL of the feed you want to parse, or the - * website you want to try to use auto-discovery on. This takes priority - * over any set raw data. - * - * You can set multiple feeds to mash together by passing an array instead - * of a string for the $url. Remember that with each additional feed comes - * additional processing and resources. - * - * @since 1.0 Preview Release - * @see set_raw_data() - * @param string|array $url This is the URL (or array of URLs) that you want to parse. - */ - public function set_feed_url($url) - { - $this->multifeed_url = array(); - if (is_array($url)) - { - foreach ($url as $value) - { - $this->multifeed_url[] = $this->registry->call('Misc', 'fix_protocol', array($value, 1)); - } - } - else - { - $this->feed_url = $this->registry->call('Misc', 'fix_protocol', array($url, 1)); - $this->permanent_url = $this->feed_url; - } - } - - /** - * Set an instance of {@see SimplePie_File} to use as a feed - * - * @param SimplePie_File &$file - * @return bool True on success, false on failure - */ - public function set_file(&$file) - { - if ($file instanceof SimplePie_File) - { - $this->feed_url = $file->url; - $this->permanent_url = $this->feed_url; - $this->file =& $file; - return true; - } - return false; - } - - /** - * Set the raw XML data to parse - * - * Allows you to use a string of RSS/Atom data instead of a remote feed. - * - * If you have a feed available as a string in PHP, you can tell SimplePie - * to parse that data string instead of a remote feed. Any set feed URL - * takes precedence. - * - * @since 1.0 Beta 3 - * @param string $data RSS or Atom data as a string. - * @see set_feed_url() - */ - public function set_raw_data($data) - { - $this->raw_data = $data; - } - - /** - * Set the the default timeout for fetching remote feeds - * - * This allows you to change the maximum time the feed's server to respond - * and send the feed back. - * - * @since 1.0 Beta 3 - * @param int $timeout The maximum number of seconds to spend waiting to retrieve a feed. - */ - public function set_timeout($timeout = 10) - { - $this->timeout = (int) $timeout; - } - - /** - * Set custom curl options - * - * This allows you to change default curl options - * - * @since 1.0 Beta 3 - * @param array $curl_options Curl options to add to default settings - */ - public function set_curl_options(array $curl_options = array()) - { - $this->curl_options = $curl_options; - } - - /** - * Force SimplePie to use fsockopen() instead of cURL - * - * @since 1.0 Beta 3 - * @param bool $enable Force fsockopen() to be used - */ - public function force_fsockopen($enable = false) - { - $this->force_fsockopen = (bool) $enable; - } - - /** - * Enable/disable caching in SimplePie. - * - * This option allows you to disable caching all-together in SimplePie. - * However, disabling the cache can lead to longer load times. - * - * @since 1.0 Preview Release - * @param bool $enable Enable caching - */ - public function enable_cache($enable = true) - { - $this->cache = (bool) $enable; - } - - /** - * SimplePie to continue to fall back to expired cache, if enabled, when - * feed is unavailable. - * - * This tells SimplePie to ignore any file errors and fall back to cache - * instead. This only works if caching is enabled and cached content - * still exists. - - * @param bool $enable Force use of cache on fail. - */ - public function force_cache_fallback($enable = false) - { - $this->force_cache_fallback= (bool) $enable; - } - - /** - * Set the length of time (in seconds) that the contents of a feed will be - * cached - * - * @param int $seconds The feed content cache duration - */ - public function set_cache_duration($seconds = 3600) - { - $this->cache_duration = (int) $seconds; - } - - /** - * Set the length of time (in seconds) that the autodiscovered feed URL will - * be cached - * - * @param int $seconds The autodiscovered feed URL cache duration. - */ - public function set_autodiscovery_cache_duration($seconds = 604800) - { - $this->autodiscovery_cache_duration = (int) $seconds; - } - - /** - * Set the file system location where the cached files should be stored - * - * @param string $location The file system location. - */ - public function set_cache_location($location = './cache') - { - $this->cache_location = (string) $location; - } - - /** - * Set whether feed items should be sorted into reverse chronological order - * - * @param bool $enable Sort as reverse chronological order. - */ - public function enable_order_by_date($enable = true) - { - $this->order_by_date = (bool) $enable; - } - - /** - * Set the character encoding used to parse the feed - * - * This overrides the encoding reported by the feed, however it will fall - * back to the normal encoding detection if the override fails - * - * @param string $encoding Character encoding - */ - public function set_input_encoding($encoding = false) - { - if ($encoding) - { - $this->input_encoding = (string) $encoding; - } - else - { - $this->input_encoding = false; - } - } - - /** - * Set how much feed autodiscovery to do - * - * @see SIMPLEPIE_LOCATOR_NONE - * @see SIMPLEPIE_LOCATOR_AUTODISCOVERY - * @see SIMPLEPIE_LOCATOR_LOCAL_EXTENSION - * @see SIMPLEPIE_LOCATOR_LOCAL_BODY - * @see SIMPLEPIE_LOCATOR_REMOTE_EXTENSION - * @see SIMPLEPIE_LOCATOR_REMOTE_BODY - * @see SIMPLEPIE_LOCATOR_ALL - * @param int $level Feed Autodiscovery Level (level can be a combination of the above constants, see bitwise OR operator) - */ - public function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL) - { - $this->autodiscovery = (int) $level; - } - - /** - * Get the class registry - * - * Use this to override SimplePie's default classes - * @see SimplePie_Registry - * @return SimplePie_Registry - */ - public function &get_registry() - { - return $this->registry; - } - - /**#@+ - * Useful when you are overloading or extending SimplePie's default classes. - * - * @deprecated Use {@see get_registry()} instead - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation - * @param string $class Name of custom class - * @return boolean True on success, false otherwise - */ - /** - * Set which class SimplePie uses for caching - */ - public function set_cache_class($class = 'SimplePie_Cache') - { - return $this->registry->register('Cache', $class, true); - } - - /** - * Set which class SimplePie uses for auto-discovery - */ - public function set_locator_class($class = 'SimplePie_Locator') - { - return $this->registry->register('Locator', $class, true); - } - - /** - * Set which class SimplePie uses for XML parsing - */ - public function set_parser_class($class = 'SimplePie_Parser') - { - return $this->registry->register('Parser', $class, true); - } - - /** - * Set which class SimplePie uses for remote file fetching - */ - public function set_file_class($class = 'SimplePie_File') - { - return $this->registry->register('File', $class, true); - } - - /** - * Set which class SimplePie uses for data sanitization - */ - public function set_sanitize_class($class = 'SimplePie_Sanitize') - { - return $this->registry->register('Sanitize', $class, true); - } - - /** - * Set which class SimplePie uses for handling feed items - */ - public function set_item_class($class = 'SimplePie_Item') - { - return $this->registry->register('Item', $class, true); - } - - /** - * Set which class SimplePie uses for handling author data - */ - public function set_author_class($class = 'SimplePie_Author') - { - return $this->registry->register('Author', $class, true); - } - - /** - * Set which class SimplePie uses for handling category data - */ - public function set_category_class($class = 'SimplePie_Category') - { - return $this->registry->register('Category', $class, true); - } - - /** - * Set which class SimplePie uses for feed enclosures - */ - public function set_enclosure_class($class = 'SimplePie_Enclosure') - { - return $this->registry->register('Enclosure', $class, true); - } - - /** - * Set which class SimplePie uses for `<media:text>` captions - */ - public function set_caption_class($class = 'SimplePie_Caption') - { - return $this->registry->register('Caption', $class, true); - } - - /** - * Set which class SimplePie uses for `<media:copyright>` - */ - public function set_copyright_class($class = 'SimplePie_Copyright') - { - return $this->registry->register('Copyright', $class, true); - } - - /** - * Set which class SimplePie uses for `<media:credit>` - */ - public function set_credit_class($class = 'SimplePie_Credit') - { - return $this->registry->register('Credit', $class, true); - } - - /** - * Set which class SimplePie uses for `<media:rating>` - */ - public function set_rating_class($class = 'SimplePie_Rating') - { - return $this->registry->register('Rating', $class, true); - } - - /** - * Set which class SimplePie uses for `<media:restriction>` - */ - public function set_restriction_class($class = 'SimplePie_Restriction') - { - return $this->registry->register('Restriction', $class, true); - } - - /** - * Set which class SimplePie uses for content-type sniffing - */ - public function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer') - { - return $this->registry->register('Content_Type_Sniffer', $class, true); - } - - /** - * Set which class SimplePie uses item sources - */ - public function set_source_class($class = 'SimplePie_Source') - { - return $this->registry->register('Source', $class, true); - } - /**#@-*/ - - /** - * Set the user agent string - * - * @param string $ua New user agent string. - */ - public function set_useragent($ua = SIMPLEPIE_USERAGENT) - { - $this->useragent = (string) $ua; - } - - /** - * Set callback function to create cache filename with - * - * @param mixed $function Callback function - */ - public function set_cache_name_function($function = 'md5') - { - if (is_callable($function)) - { - $this->cache_name_function = $function; - } - } - - /** - * Set options to make SP as fast as possible - * - * Forgoes a substantial amount of data sanitization in favor of speed. This - * turns SimplePie into a dumb parser of feeds. - * - * @param bool $set Whether to set them or not - */ - public function set_stupidly_fast($set = false) - { - if ($set) - { - $this->enable_order_by_date(false); - $this->remove_div(false); - $this->strip_comments(false); - $this->strip_htmltags(false); - $this->strip_attributes(false); - $this->add_attributes(false); - $this->set_image_handler(false); - } - } - - /** - * Set maximum number of feeds to check with autodiscovery - * - * @param int $max Maximum number of feeds to check - */ - public function set_max_checked_feeds($max = 10) - { - $this->max_checked_feeds = (int) $max; - } - - public function remove_div($enable = true) - { - $this->sanitize->remove_div($enable); - } - - public function strip_htmltags($tags = '', $encode = null) - { - if ($tags === '') - { - $tags = $this->strip_htmltags; - } - $this->sanitize->strip_htmltags($tags); - if ($encode !== null) - { - $this->sanitize->encode_instead_of_strip($tags); - } - } - - public function encode_instead_of_strip($enable = true) - { - $this->sanitize->encode_instead_of_strip($enable); - } - - public function strip_attributes($attribs = '') - { - if ($attribs === '') - { - $attribs = $this->strip_attributes; - } - $this->sanitize->strip_attributes($attribs); - } - - public function add_attributes($attribs = '') - { - if ($attribs === '') - { - $attribs = $this->add_attributes; - } - $this->sanitize->add_attributes($attribs); - } - - /** - * Set the output encoding - * - * Allows you to override SimplePie's output to match that of your webpage. - * This is useful for times when your webpages are not being served as - * UTF-8. This setting will be obeyed by {@see handle_content_type()}, and - * is similar to {@see set_input_encoding()}. - * - * It should be noted, however, that not all character encodings can support - * all characters. If your page is being served as ISO-8859-1 and you try - * to display a Japanese feed, you'll likely see garbled characters. - * Because of this, it is highly recommended to ensure that your webpages - * are served as UTF-8. - * - * The number of supported character encodings depends on whether your web - * host supports {@link http://php.net/mbstring mbstring}, - * {@link http://php.net/iconv iconv}, or both. See - * {@link http://simplepie.org/wiki/faq/Supported_Character_Encodings} for - * more information. - * - * @param string $encoding - */ - public function set_output_encoding($encoding = 'UTF-8') - { - $this->sanitize->set_output_encoding($encoding); - } - - public function strip_comments($strip = false) - { - $this->sanitize->strip_comments($strip); - } - - /** - * Set element/attribute key/value pairs of HTML attributes - * containing URLs that need to be resolved relative to the feed - * - * Defaults to |a|@href, |area|@href, |blockquote|@cite, |del|@cite, - * |form|@action, |img|@longdesc, |img|@src, |input|@src, |ins|@cite, - * |q|@cite - * - * @since 1.0 - * @param array|null $element_attribute Element/attribute key/value pairs, null for default - */ - public function set_url_replacements($element_attribute = null) - { - $this->sanitize->set_url_replacements($element_attribute); - } - - /** - * Set the handler to enable the display of cached images. - * - * @param str $page Web-accessible path to the handler_image.php file. - * @param str $qs The query string that the value should be passed to. - */ - public function set_image_handler($page = false, $qs = 'i') - { - if ($page !== false) - { - $this->sanitize->set_image_handler($page . '?' . $qs . '='); - } - else - { - $this->image_handler = ''; - } - } - - /** - * Set the limit for items returned per-feed with multifeeds - * - * @param integer $limit The maximum number of items to return. - */ - public function set_item_limit($limit = 0) - { - $this->item_limit = (int) $limit; - } - - /** - * Enable throwing exceptions - * - * @param boolean $enable Should we throw exceptions, or use the old-style error property? - */ - public function enable_exceptions($enable = true) - { - $this->enable_exceptions = $enable; - } - - /** - * Initialize the feed object - * - * This is what makes everything happen. Period. This is where all of the - * configuration options get processed, feeds are fetched, cached, and - * parsed, and all of that other good stuff. - * - * @return boolean True if successful, false otherwise - */ - public function init() - { - // Check absolute bare minimum requirements. - if (!extension_loaded('xml') || !extension_loaded('pcre')) - { - return false; - } - // Then check the xml extension is sane (i.e., libxml 2.7.x issue on PHP < 5.2.9 and libxml 2.7.0 to 2.7.2 on any version) if we don't have xmlreader. - elseif (!extension_loaded('xmlreader')) - { - static $xml_is_sane = null; - if ($xml_is_sane === null) - { - $parser_check = xml_parser_create(); - xml_parse_into_struct($parser_check, '<foo>&</foo>', $values); - xml_parser_free($parser_check); - $xml_is_sane = isset($values[0]['value']); - } - if (!$xml_is_sane) - { - return false; - } - } - - if (method_exists($this->sanitize, 'set_registry')) - { - $this->sanitize->set_registry($this->registry); - } - - // Pass whatever was set with config options over to the sanitizer. - // Pass the classes in for legacy support; new classes should use the registry instead - $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->registry->get_class('Cache')); - $this->sanitize->pass_file_data($this->registry->get_class('File'), $this->timeout, $this->useragent, $this->force_fsockopen, $this->curl_options); - - if (!empty($this->multifeed_url)) - { - $i = 0; - $success = 0; - $this->multifeed_objects = array(); - $this->error = array(); - foreach ($this->multifeed_url as $url) - { - $this->multifeed_objects[$i] = clone $this; - $this->multifeed_objects[$i]->set_feed_url($url); - $single_success = $this->multifeed_objects[$i]->init(); - $success |= $single_success; - if (!$single_success) - { - $this->error[$i] = $this->multifeed_objects[$i]->error(); - } - $i++; - } - return (bool) $success; - } - elseif ($this->feed_url === null && $this->raw_data === null) - { - return false; - } - - $this->error = null; - $this->data = array(); - $this->check_modified = false; - $this->multifeed_objects = array(); - $cache = false; - - if ($this->feed_url !== null) - { - $parsed_feed_url = $this->registry->call('Misc', 'parse_url', array($this->feed_url)); - - // Decide whether to enable caching - if ($this->cache && $parsed_feed_url['scheme'] !== '') - { - $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc')); - } - - // Fetch the data via SimplePie_File into $this->raw_data - if (($fetched = $this->fetch_data($cache)) === true) - { - return true; - } - elseif ($fetched === false) { - return false; - } - - list($headers, $sniffed) = $fetched; - } - - // Set up array of possible encodings - $encodings = array(); - - // First check to see if input has been overridden. - if ($this->input_encoding !== false) - { - $encodings[] = strtoupper($this->input_encoding); - } - - $application_types = array('application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity'); - $text_types = array('text/xml', 'text/xml-external-parsed-entity'); - - // RFC 3023 (only applies to sniffed content) - if (isset($sniffed)) - { - if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml') - { - if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) - { - $encodings[] = strtoupper($charset[1]); - } - $encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry))); - $encodings[] = 'UTF-8'; - } - elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml') - { - if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) - { - $encodings[] = strtoupper($charset[1]); - } - $encodings[] = 'US-ASCII'; - } - // Text MIME-type default - elseif (substr($sniffed, 0, 5) === 'text/') - { - $encodings[] = 'UTF-8'; - } - } - - // Fallback to XML 1.0 Appendix F.1/UTF-8/ISO-8859-1 - $encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry))); - $encodings[] = 'UTF-8'; - $encodings[] = 'ISO-8859-1'; - - // There's no point in trying an encoding twice - $encodings = array_unique($encodings); - - // Loop through each possible encoding, till we return something, or run out of possibilities - foreach ($encodings as $encoding) - { - // Change the encoding to UTF-8 (as we always use UTF-8 internally) - if ($utf8_data = $this->registry->call('Misc', 'change_encoding', array($this->raw_data, $encoding, 'UTF-8'))) - { - // Create new parser - $parser = $this->registry->create('Parser'); - - // If it's parsed fine - if ($parser->parse($utf8_data, 'UTF-8', $this->permanent_url)) - { - $this->data = $parser->get_data(); - if (!($this->get_type() & ~SIMPLEPIE_TYPE_NONE)) - { - $this->error = "A feed could not be found at $this->feed_url. This does not appear to be a valid RSS or Atom feed."; - $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); - return false; - } - - if (isset($headers)) - { - $this->data['headers'] = $headers; - } - $this->data['build'] = SIMPLEPIE_BUILD; - - // Cache the file if caching is enabled - if ($cache && !$cache->save($this)) - { - trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); - } - return true; - } - } - } - - if (isset($parser)) - { - // We have an error, just set SimplePie_Misc::error to it and quit - $this->error = $this->feed_url; - $this->error .= sprintf(' is invalid XML, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column()); - } - else - { - $this->error = 'The data could not be converted to UTF-8. You MUST have either the iconv or mbstring extension installed. Upgrading to PHP 5.x (which includes iconv) is highly recommended.'; - } - - $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); - - return false; - } - - /** - * Fetch the data via SimplePie_File - * - * If the data is already cached, attempt to fetch it from there instead - * @param SimplePie_Cache|false $cache Cache handler, or false to not load from the cache - * @return array|true Returns true if the data was loaded from the cache, or an array of HTTP headers and sniffed type - */ - protected function fetch_data(&$cache) - { - // If it's enabled, use the cache - if ($cache) - { - // Load the Cache - $this->data = $cache->load(); - if (!empty($this->data)) - { - // If the cache is for an outdated build of SimplePie - if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD) - { - $cache->unlink(); - $this->data = array(); - } - // If we've hit a collision just rerun it with caching disabled - elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url) - { - $cache = false; - $this->data = array(); - } - // If we've got a non feed_url stored (if the page isn't actually a feed, or is a redirect) use that URL. - elseif (isset($this->data['feed_url'])) - { - // If the autodiscovery cache is still valid use it. - if ($cache->mtime() + $this->autodiscovery_cache_duration > time()) - { - // Do not need to do feed autodiscovery yet. - if ($this->data['feed_url'] !== $this->data['url']) - { - $this->set_feed_url($this->data['feed_url']); - return $this->init(); - } - - $cache->unlink(); - $this->data = array(); - } - } - // Check if the cache has been updated - elseif ($cache->mtime() + $this->cache_duration < time()) - { - // Want to know if we tried to send last-modified and/or etag headers - // when requesting this file. (Note that it's up to the file to - // support this, but we don't always send the headers either.) - $this->check_modified = true; - if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) - { - $headers = array( - 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', - ); - if (isset($this->data['headers']['last-modified'])) - { - $headers['if-modified-since'] = $this->data['headers']['last-modified']; - } - if (isset($this->data['headers']['etag'])) - { - $headers['if-none-match'] = $this->data['headers']['etag']; - } - - $file = $this->registry->create('File', array($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options)); - - if ($file->success) - { - if ($file->status_code === 304) - { - // Set raw_data to false here too, to signify that the cache - // is still valid. - $this->raw_data = false; - $cache->touch(); - return true; - } - } - else - { - $this->check_modified = false; - if($this->force_cache_fallback) - { - $cache->touch(); - return true; - } - - unset($file); - } - } - } - // If the cache is still valid, just return true - else - { - $this->raw_data = false; - return true; - } - } - // If the cache is empty, delete it - else - { - $cache->unlink(); - $this->data = array(); - } - } - // If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it. - if (!isset($file)) - { - if ($this->file instanceof SimplePie_File && $this->file->url === $this->feed_url) - { - $file =& $this->file; - } - else - { - $headers = array( - 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', - ); - $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options)); - } - } - // If the file connection has an error, set SimplePie::error to that and quit - if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) - { - $this->error = $file->error; - return !empty($this->data); - } - - if (!$this->force_feed) - { - // Check if the supplied URL is a feed, if it isn't, look for it. - $locate = $this->registry->create('Locator', array(&$file, $this->timeout, $this->useragent, $this->max_checked_feeds)); - - if (!$locate->is_feed($file)) - { - $copyStatusCode = $file->status_code; - $copyContentType = $file->headers['content-type']; - try - { - $microformats = false; - if (function_exists('Mf2\parse')) { - // Check for both h-feed and h-entry, as both a feed with no entries - // and a list of entries without an h-feed wrapper are both valid. - $position = 0; - while ($position = strpos($file->body, 'h-feed', $position)) - { - $start = $position < 200 ? 0 : $position - 200; - $check = substr($file->body, $start, 400); - if ($microformats = preg_match('/class="[^"]*h-feed/', $check)) - { - break; - } - $position += 7; - } - $position = 0; - while ($position = strpos($file->body, 'h-entry', $position)) - { - $start = $position < 200 ? 0 : $position - 200; - $check = substr($file->body, $start, 400); - if ($microformats = preg_match('/class="[^"]*h-entry/', $check)) - { - break; - } - $position += 7; - } - } - // Now also do feed discovery, but if an h-entry was found don't - // overwrite the current value of file. - $discovered = $locate->find($this->autodiscovery, - $this->all_discovered_feeds); - if ($microformats) - { - if ($hub = $locate->get_rel_link('hub')) - { - $self = $locate->get_rel_link('self'); - $this->store_links($file, $hub, $self); - } - // Push the current file onto all_discovered feeds so the user can - // be shown this as one of the options. - if (isset($this->all_discovered_feeds)) { - $this->all_discovered_feeds[] = $file; - } - } - else - { - if ($discovered) - { - $file = $discovered; - } - else - { - // We need to unset this so that if SimplePie::set_file() has - // been called that object is untouched - unset($file); - $this->error = "A feed could not be found at `$this->feed_url`; the status code is `$copyStatusCode` and content-type is `$copyContentType`"; - $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); - return false; - } - } - } - catch (SimplePie_Exception $e) - { - // We need to unset this so that if SimplePie::set_file() has been called that object is untouched - unset($file); - // This is usually because DOMDocument doesn't exist - $this->error = $e->getMessage(); - $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, $e->getFile(), $e->getLine())); - return false; - } - if ($cache) - { - $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD); - if (!$cache->save($this)) - { - trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); - } - $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc')); - } - $this->feed_url = $file->url; - } - $locate = null; - } - - $this->raw_data = $file->body; - $this->permanent_url = $file->permanent_url; - $headers = $file->headers; - $sniffer = $this->registry->create('Content_Type_Sniffer', array(&$file)); - $sniffed = $sniffer->get_type(); - - return array($headers, $sniffed); - } - - /** - * Get the error message for the occured error - * - * @return string|array Error message, or array of messages for multifeeds - */ - public function error() - { - return $this->error; - } - - /** - * Get the raw XML - * - * This is the same as the old `$feed->enable_xml_dump(true)`, but returns - * the data instead of printing it. - * - * @return string|boolean Raw XML data, false if the cache is used - */ - public function get_raw_data() - { - return $this->raw_data; - } - - /** - * Get the character encoding used for output - * - * @since Preview Release - * @return string - */ - public function get_encoding() - { - return $this->sanitize->output_encoding; - } - - /** - * Send the content-type header with correct encoding - * - * This method ensures that the SimplePie-enabled page is being served with - * the correct {@link http://www.iana.org/assignments/media-types/ mime-type} - * and character encoding HTTP headers (character encoding determined by the - * {@see set_output_encoding} config option). - * - * This won't work properly if any content or whitespace has already been - * sent to the browser, because it relies on PHP's - * {@link http://php.net/header header()} function, and these are the - * circumstances under which the function works. - * - * Because it's setting these settings for the entire page (as is the nature - * of HTTP headers), this should only be used once per page (again, at the - * top). - * - * @param string $mime MIME type to serve the page as - */ - public function handle_content_type($mime = 'text/html') - { - if (!headers_sent()) - { - $header = "Content-type: $mime;"; - if ($this->get_encoding()) - { - $header .= ' charset=' . $this->get_encoding(); - } - else - { - $header .= ' charset=UTF-8'; - } - header($header); - } - } - - /** - * Get the type of the feed - * - * This returns a SIMPLEPIE_TYPE_* constant, which can be tested against - * using {@link http://php.net/language.operators.bitwise bitwise operators} - * - * @since 0.8 (usage changed to using constants in 1.0) - * @see SIMPLEPIE_TYPE_NONE Unknown. - * @see SIMPLEPIE_TYPE_RSS_090 RSS 0.90. - * @see SIMPLEPIE_TYPE_RSS_091_NETSCAPE RSS 0.91 (Netscape). - * @see SIMPLEPIE_TYPE_RSS_091_USERLAND RSS 0.91 (Userland). - * @see SIMPLEPIE_TYPE_RSS_091 RSS 0.91. - * @see SIMPLEPIE_TYPE_RSS_092 RSS 0.92. - * @see SIMPLEPIE_TYPE_RSS_093 RSS 0.93. - * @see SIMPLEPIE_TYPE_RSS_094 RSS 0.94. - * @see SIMPLEPIE_TYPE_RSS_10 RSS 1.0. - * @see SIMPLEPIE_TYPE_RSS_20 RSS 2.0.x. - * @see SIMPLEPIE_TYPE_RSS_RDF RDF-based RSS. - * @see SIMPLEPIE_TYPE_RSS_SYNDICATION Non-RDF-based RSS (truly intended as syndication format). - * @see SIMPLEPIE_TYPE_RSS_ALL Any version of RSS. - * @see SIMPLEPIE_TYPE_ATOM_03 Atom 0.3. - * @see SIMPLEPIE_TYPE_ATOM_10 Atom 1.0. - * @see SIMPLEPIE_TYPE_ATOM_ALL Any version of Atom. - * @see SIMPLEPIE_TYPE_ALL Any known/supported feed type. - * @return int SIMPLEPIE_TYPE_* constant - */ - public function get_type() - { - if (!isset($this->data['type'])) - { - $this->data['type'] = SIMPLEPIE_TYPE_ALL; - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'])) - { - $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10; - } - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'])) - { - $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03; - } - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'])) - { - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel']) - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image']) - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']) - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput'])) - { - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_10; - } - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['channel']) - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image']) - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']) - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput'])) - { - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090; - } - } - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'])) - { - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL; - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) - { - switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) - { - case '0.91': - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091; - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) - { - switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) - { - case '0': - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE; - break; - - case '24': - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND; - break; - } - } - break; - - case '0.92': - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_092; - break; - - case '0.93': - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_093; - break; - - case '0.94': - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_094; - break; - - case '2.0': - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_20; - break; - } - } - } - else - { - $this->data['type'] = SIMPLEPIE_TYPE_NONE; - } - } - return $this->data['type']; - } - - /** - * Get the URL for the feed - * - * When the 'permanent' mode is enabled, returns the original feed URL, - * except in the case of an `HTTP 301 Moved Permanently` status response, - * in which case the location of the first redirection is returned. - * - * When the 'permanent' mode is disabled (default), - * may or may not be different from the URL passed to {@see set_feed_url()}, - * depending on whether auto-discovery was used. - * - * @since Preview Release (previously called `get_feed_url()` since SimplePie 0.8.) - * @todo Support <itunes:new-feed-url> - * @todo Also, |atom:link|@rel=self - * @param bool $permanent Permanent mode to return only the original URL or the first redirection - * iff it is a 301 redirection - * @return string|null - */ - public function subscribe_url($permanent = false) - { - if ($permanent) - { - if ($this->permanent_url !== null) - { - // sanitize encodes ampersands which are required when used in a url. - return str_replace('&', '&', - $this->sanitize($this->permanent_url, - SIMPLEPIE_CONSTRUCT_IRI)); - } - } - else - { - if ($this->feed_url !== null) - { - return str_replace('&', '&', - $this->sanitize($this->feed_url, - SIMPLEPIE_CONSTRUCT_IRI)); - } - } - return null; - } - - /** - * Get data for an feed-level element - * - * This method allows you to get access to ANY element/attribute that is a - * sub-element of the opening feed tag. - * - * The return value is an indexed array of elements matching the given - * namespace and tag name. Each element has `attribs`, `data` and `child` - * subkeys. For `attribs` and `child`, these contain namespace subkeys. - * `attribs` then has one level of associative name => value data (where - * `value` is a string) after the namespace. `child` has tag-indexed keys - * after the namespace, each member of which is an indexed array matching - * this same format. - * - * For example: - * <pre> - * // This is probably a bad example because we already support - * // <media:content> natively, but it shows you how to parse through - * // the nodes. - * $group = $item->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group'); - * $content = $group[0]['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']; - * $file = $content[0]['attribs']['']['url']; - * echo $file; - * </pre> - * - * @since 1.0 - * @see http://simplepie.org/wiki/faq/supported_xml_namespaces - * @param string $namespace The URL of the XML namespace of the elements you're trying to access - * @param string $tag Tag name - * @return array - */ - public function get_feed_tags($namespace, $tag) - { - $type = $this->get_type(); - if ($type & SIMPLEPIE_TYPE_ATOM_10) - { - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag])) - { - return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag]; - } - } - if ($type & SIMPLEPIE_TYPE_ATOM_03) - { - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag])) - { - return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag]; - } - } - if ($type & SIMPLEPIE_TYPE_RSS_RDF) - { - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag])) - { - return $this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag]; - } - } - if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) - { - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag])) - { - return $this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]; - } - } - return null; - } - - /** - * Get data for an channel-level element - * - * This method allows you to get access to ANY element/attribute in the - * channel/header section of the feed. - * - * See {@see SimplePie::get_feed_tags()} for a description of the return value - * - * @since 1.0 - * @see http://simplepie.org/wiki/faq/supported_xml_namespaces - * @param string $namespace The URL of the XML namespace of the elements you're trying to access - * @param string $tag Tag name - * @return array - */ - public function get_channel_tags($namespace, $tag) - { - $type = $this->get_type(); - if ($type & SIMPLEPIE_TYPE_ATOM_ALL) - { - if ($return = $this->get_feed_tags($namespace, $tag)) - { - return $return; - } - } - if ($type & SIMPLEPIE_TYPE_RSS_10) - { - if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'channel')) - { - if (isset($channel[0]['child'][$namespace][$tag])) - { - return $channel[0]['child'][$namespace][$tag]; - } - } - } - if ($type & SIMPLEPIE_TYPE_RSS_090) - { - if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'channel')) - { - if (isset($channel[0]['child'][$namespace][$tag])) - { - return $channel[0]['child'][$namespace][$tag]; - } - } - } - if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) - { - if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel')) - { - if (isset($channel[0]['child'][$namespace][$tag])) - { - return $channel[0]['child'][$namespace][$tag]; - } - } - } - return null; - } - - /** - * Get data for an channel-level element - * - * This method allows you to get access to ANY element/attribute in the - * image/logo section of the feed. - * - * See {@see SimplePie::get_feed_tags()} for a description of the return value - * - * @since 1.0 - * @see http://simplepie.org/wiki/faq/supported_xml_namespaces - * @param string $namespace The URL of the XML namespace of the elements you're trying to access - * @param string $tag Tag name - * @return array - */ - public function get_image_tags($namespace, $tag) - { - $type = $this->get_type(); - if ($type & SIMPLEPIE_TYPE_RSS_10) - { - if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'image')) - { - if (isset($image[0]['child'][$namespace][$tag])) - { - return $image[0]['child'][$namespace][$tag]; - } - } - } - if ($type & SIMPLEPIE_TYPE_RSS_090) - { - if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'image')) - { - if (isset($image[0]['child'][$namespace][$tag])) - { - return $image[0]['child'][$namespace][$tag]; - } - } - } - if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) - { - if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image')) - { - if (isset($image[0]['child'][$namespace][$tag])) - { - return $image[0]['child'][$namespace][$tag]; - } - } - } - return null; - } - - /** - * Get the base URL value from the feed - * - * Uses `<xml:base>` if available, otherwise uses the first link in the - * feed, or failing that, the URL of the feed itself. - * - * @see get_link - * @see subscribe_url - * - * @param array $element - * @return string - */ - public function get_base($element = array()) - { - if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base'])) - { - return $element['xml_base']; - } - elseif ($this->get_link() !== null) - { - return $this->get_link(); - } - else - { - return $this->subscribe_url(); - } - } - - /** - * Sanitize feed data - * - * @access private - * @see SimplePie_Sanitize::sanitize() - * @param string $data Data to sanitize - * @param int $type One of the SIMPLEPIE_CONSTRUCT_* constants - * @param string $base Base URL to resolve URLs against - * @return string Sanitized data - */ - public function sanitize($data, $type, $base = '') - { - try - { - return $this->sanitize->sanitize($data, $type, $base); - } - catch (SimplePie_Exception $e) - { - if (!$this->enable_exceptions) - { - $this->error = $e->getMessage(); - $this->registry->call('Misc', 'error', array($this->error, E_USER_WARNING, $e->getFile(), $e->getLine())); - return ''; - } - - throw $e; - } - } - - /** - * Get the title of the feed - * - * Uses `<atom:title>`, `<title>` or `<dc:title>` - * - * @since 1.0 (previously called `get_feed_title` since 0.8) - * @return string|null - */ - public function get_title() - { - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - return null; - } - } - - /** - * Get a category for the feed - * - * @since Unknown - * @param int $key The category that you want to return. Remember that arrays begin with 0, not 1 - * @return SimplePie_Category|null - */ - public function get_category($key = 0) - { - $categories = $this->get_categories(); - if (isset($categories[$key])) - { - return $categories[$key]; - } - else - { - return null; - } - } - - /** - * Get all categories for the feed - * - * Uses `<atom:category>`, `<category>` or `<dc:subject>` - * - * @since Unknown - * @return array|null List of {@see SimplePie_Category} objects - */ - public function get_categories() - { - $categories = array(); - - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) - { - $term = null; - $scheme = null; - $label = null; - if (isset($category['attribs']['']['term'])) - { - $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($category['attribs']['']['scheme'])) - { - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($category['attribs']['']['label'])) - { - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); - } - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) - { - // This is really the label, but keep this as the term also for BC. - // Label will also work on retrieving because that falls back to term. - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); - if (isset($category['attribs']['']['domain'])) - { - $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $scheme = null; - } - $categories[] = $this->registry->create('Category', array($term, $scheme, null)); - } - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) - { - $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); - } - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) - { - $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); - } - - if (!empty($categories)) - { - return array_unique($categories); - } - else - { - return null; - } - } - - /** - * Get an author for the feed - * - * @since 1.1 - * @param int $key The author that you want to return. Remember that arrays begin with 0, not 1 - * @return SimplePie_Author|null - */ - public function get_author($key = 0) - { - $authors = $this->get_authors(); - if (isset($authors[$key])) - { - return $authors[$key]; - } - else - { - return null; - } - } - - /** - * Get all authors for the feed - * - * Uses `<atom:author>`, `<author>`, `<dc:creator>` or `<itunes:author>` - * - * @since 1.1 - * @return array|null List of {@see SimplePie_Author} objects - */ - public function get_authors() - { - $authors = array(); - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) - { - $name = null; - $uri = null; - $email = null; - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) - { - $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) - { - $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); - } - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) - { - $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if ($name !== null || $email !== null || $uri !== null) - { - $authors[] = $this->registry->create('Author', array($name, $uri, $email)); - } - } - if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) - { - $name = null; - $url = null; - $email = null; - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) - { - $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) - { - $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); - } - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) - { - $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if ($name !== null || $email !== null || $url !== null) - { - $authors[] = $this->registry->create('Author', array($name, $url, $email)); - } - } - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) - { - $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); - } - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) - { - $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); - } - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) - { - $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); - } - - if (!empty($authors)) - { - return array_unique($authors); - } - else - { - return null; - } - } - - /** - * Get a contributor for the feed - * - * @since 1.1 - * @param int $key The contrbutor that you want to return. Remember that arrays begin with 0, not 1 - * @return SimplePie_Author|null - */ - public function get_contributor($key = 0) - { - $contributors = $this->get_contributors(); - if (isset($contributors[$key])) - { - return $contributors[$key]; - } - else - { - return null; - } - } - - /** - * Get all contributors for the feed - * - * Uses `<atom:contributor>` - * - * @since 1.1 - * @return array|null List of {@see SimplePie_Author} objects - */ - public function get_contributors() - { - $contributors = array(); - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) - { - $name = null; - $uri = null; - $email = null; - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) - { - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) - { - $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); - } - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) - { - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if ($name !== null || $email !== null || $uri !== null) - { - $contributors[] = $this->registry->create('Author', array($name, $uri, $email)); - } - } - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) - { - $name = null; - $url = null; - $email = null; - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) - { - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) - { - $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); - } - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) - { - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if ($name !== null || $email !== null || $url !== null) - { - $contributors[] = $this->registry->create('Author', array($name, $url, $email)); - } - } - - if (!empty($contributors)) - { - return array_unique($contributors); - } - else - { - return null; - } - } - - /** - * Get a single link for the feed - * - * @since 1.0 (previously called `get_feed_link` since Preview Release, `get_feed_permalink()` since 0.8) - * @param int $key The link that you want to return. Remember that arrays begin with 0, not 1 - * @param string $rel The relationship of the link to return - * @return string|null Link URL - */ - public function get_link($key = 0, $rel = 'alternate') - { - $links = $this->get_links($rel); - if (isset($links[$key])) - { - return $links[$key]; - } - else - { - return null; - } - } - - /** - * Get the permalink for the item - * - * Returns the first link available with a relationship of "alternate". - * Identical to {@see get_link()} with key 0 - * - * @see get_link - * @since 1.0 (previously called `get_feed_link` since Preview Release, `get_feed_permalink()` since 0.8) - * @internal Added for parity between the parent-level and the item/entry-level. - * @return string|null Link URL - */ - public function get_permalink() - { - return $this->get_link(0); - } - - /** - * Get all links for the feed - * - * Uses `<atom:link>` or `<link>` - * - * @since Beta 2 - * @param string $rel The relationship of links to return - * @return array|null Links found for the feed (strings) - */ - public function get_links($rel = 'alternate') - { - if (!isset($this->data['links'])) - { - $this->data['links'] = array(); - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) - { - foreach ($links as $link) - { - if (isset($link['attribs']['']['href'])) - { - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); - } - } - } - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link')) - { - foreach ($links as $link) - { - if (isset($link['attribs']['']['href'])) - { - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); - - } - } - } - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) - { - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); - } - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) - { - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); - } - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) - { - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); - } - - $keys = array_keys($this->data['links']); - foreach ($keys as $key) - { - if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key))) - { - if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) - { - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); - $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; - } - else - { - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; - } - } - elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) - { - $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; - } - $this->data['links'][$key] = array_unique($this->data['links'][$key]); - } - } - - if (isset($this->data['links'][$rel])) - { - return $this->data['links'][$rel]; - } - else if (isset($this->data['headers']['link']) && - preg_match('/<([^>]+)>; rel='.preg_quote($rel).'/', - $this->data['headers']['link'], $match)) - { - return array($match[1]); - } - else - { - return null; - } - } - - public function get_all_discovered_feeds() - { - return $this->all_discovered_feeds; - } - - /** - * Get the content for the item - * - * Uses `<atom:subtitle>`, `<atom:tagline>`, `<description>`, - * `<dc:description>`, `<itunes:summary>` or `<itunes:subtitle>` - * - * @since 1.0 (previously called `get_feed_description()` since 0.8) - * @return string|null - */ - public function get_description() - { - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); - } - else - { - return null; - } - } - - /** - * Get the copyright info for the feed - * - * Uses `<atom:rights>`, `<atom:copyright>` or `<dc:rights>` - * - * @since 1.0 (previously called `get_feed_copyright()` since 0.8) - * @return string|null - */ - public function get_copyright() - { - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - return null; - } - } - - /** - * Get the language for the feed - * - * Uses `<language>`, `<dc:language>`, or @xml_lang - * - * @since 1.0 (previously called `get_feed_language()` since 0.8) - * @return string|null - */ - public function get_language() - { - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'])) - { - return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'])) - { - return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'])) - { - return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif (isset($this->data['headers']['content-language'])) - { - return $this->sanitize($this->data['headers']['content-language'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - return null; - } - } - - /** - * Get the latitude coordinates for the item - * - * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications - * - * Uses `<geo:lat>` or `<georss:point>` - * - * @since 1.0 - * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo - * @link http://www.georss.org/ GeoRSS - * @return string|null - */ - public function get_latitude() - { - - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) - { - return (float) $return[0]['data']; - } - elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) - { - return (float) $match[1]; - } - else - { - return null; - } - } - - /** - * Get the longitude coordinates for the feed - * - * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications - * - * Uses `<geo:long>`, `<geo:lon>` or `<georss:point>` - * - * @since 1.0 - * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo - * @link http://www.georss.org/ GeoRSS - * @return string|null - */ - public function get_longitude() - { - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) - { - return (float) $return[0]['data']; - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) - { - return (float) $return[0]['data']; - } - elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) - { - return (float) $match[2]; - } - else - { - return null; - } - } - - /** - * Get the feed logo's title - * - * RSS 0.9.0, 1.0 and 2.0 feeds are allowed to have a "feed logo" title. - * - * Uses `<image><title>` or `<image><dc:title>` - * - * @return string|null - */ - public function get_image_title() - { - if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - return null; - } - } - - /** - * Get the feed logo's URL - * - * RSS 0.9.0, 2.0, Atom 1.0, and feeds with iTunes RSS tags are allowed to - * have a "feed logo" URL. This points directly to the image itself. - * - * Uses `<itunes:image>`, `<atom:logo>`, `<atom:icon>`, - * `<image><title>` or `<image><dc:title>` - * - * @return string|null - */ - public function get_image_url() - { - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) - { - return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); - } - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); - } - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); - } - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); - } - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); - } - else - { - return null; - } - } - - - /** - * Get the feed logo's link - * - * RSS 0.9.0, 1.0 and 2.0 feeds are allowed to have a "feed logo" link. This - * points to a human-readable page that the image should link to. - * - * Uses `<itunes:image>`, `<atom:logo>`, `<atom:icon>`, - * `<image><title>` or `<image><dc:title>` - * - * @return string|null - */ - public function get_image_link() - { - if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); - } - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); - } - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); - } - else - { - return null; - } - } - - /** - * Get the feed logo's link - * - * RSS 2.0 feeds are allowed to have a "feed logo" width. - * - * Uses `<image><width>` or defaults to 88.0 if no width is specified and - * the feed is an RSS 2.0 feed. - * - * @return int|float|null - */ - public function get_image_width() - { - if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width')) - { - return round($return[0]['data']); - } - elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) - { - return 88.0; - } - else - { - return null; - } - } - - /** - * Get the feed logo's height - * - * RSS 2.0 feeds are allowed to have a "feed logo" height. - * - * Uses `<image><height>` or defaults to 31.0 if no height is specified and - * the feed is an RSS 2.0 feed. - * - * @return int|float|null - */ - public function get_image_height() - { - if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height')) - { - return round($return[0]['data']); - } - elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) - { - return 31.0; - } - else - { - return null; - } - } - - /** - * Get the number of items in the feed - * - * This is well-suited for {@link http://php.net/for for()} loops with - * {@see get_item()} - * - * @param int $max Maximum value to return. 0 for no limit - * @return int Number of items in the feed - */ - public function get_item_quantity($max = 0) - { - $max = (int) $max; - $qty = count($this->get_items()); - if ($max === 0) - { - return $qty; - } - else - { - return ($qty > $max) ? $max : $qty; - } - } - - /** - * Get a single item from the feed - * - * This is better suited for {@link http://php.net/for for()} loops, whereas - * {@see get_items()} is better suited for - * {@link http://php.net/foreach foreach()} loops. - * - * @see get_item_quantity() - * @since Beta 2 - * @param int $key The item that you want to return. Remember that arrays begin with 0, not 1 - * @return SimplePie_Item|null - */ - public function get_item($key = 0) - { - $items = $this->get_items(); - if (isset($items[$key])) - { - return $items[$key]; - } - else - { - return null; - } - } - - /** - * Get all items from the feed - * - * This is better suited for {@link http://php.net/for for()} loops, whereas - * {@see get_items()} is better suited for - * {@link http://php.net/foreach foreach()} loops. - * - * @see get_item_quantity - * @since Beta 2 - * @param int $start Index to start at - * @param int $end Number of items to return. 0 for all items after `$start` - * @return SimplePie_Item[]|null List of {@see SimplePie_Item} objects - */ - public function get_items($start = 0, $end = 0) - { - if (!isset($this->data['items'])) - { - if (!empty($this->multifeed_objects)) - { - $this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit); - if (empty($this->data['items'])) - { - return array(); - } - return $this->data['items']; - } - $this->data['items'] = array(); - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry')) - { - $keys = array_keys($items); - foreach ($keys as $key) - { - $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); - } - } - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry')) - { - $keys = array_keys($items); - foreach ($keys as $key) - { - $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); - } - } - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item')) - { - $keys = array_keys($items); - foreach ($keys as $key) - { - $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); - } - } - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item')) - { - $keys = array_keys($items); - foreach ($keys as $key) - { - $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); - } - } - if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item')) - { - $keys = array_keys($items); - foreach ($keys as $key) - { - $this->data['items'][] = $this->registry->create('Item', array($this, $items[$key])); - } - } - } - - if (empty($this->data['items'])) - { - return array(); - } - - if ($this->order_by_date) - { - if (!isset($this->data['ordered_items'])) - { - $this->data['ordered_items'] = $this->data['items']; - usort($this->data['ordered_items'], array(get_class($this), 'sort_items')); - } - $items = $this->data['ordered_items']; - } - else - { - $items = $this->data['items']; - } - // Slice the data as desired - if ($end === 0) - { - return array_slice($items, $start); - } - else - { - return array_slice($items, $start, $end); - } - } - - /** - * Set the favicon handler - * - * @deprecated Use your own favicon handling instead - */ - public function set_favicon_handler($page = false, $qs = 'i') - { - $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; - trigger_error('Favicon handling has been removed, please use your own handling', $level); - return false; - } - - /** - * Get the favicon for the current feed - * - * @deprecated Use your own favicon handling instead - */ - public function get_favicon() - { - $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; - trigger_error('Favicon handling has been removed, please use your own handling', $level); - - if (($url = $this->get_link()) !== null) - { - return 'http://g.etfv.co/' . urlencode($url); - } - - return false; - } - - /** - * Magic method handler - * - * @param string $method Method name - * @param array $args Arguments to the method - * @return mixed - */ - public function __call($method, $args) - { - if (strpos($method, 'subscribe_') === 0) - { - $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; - trigger_error('subscribe_*() has been deprecated, implement the callback yourself', $level); - return ''; - } - if ($method === 'enable_xml_dump') - { - $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; - trigger_error('enable_xml_dump() has been deprecated, use get_raw_data() instead', $level); - return false; - } - - $class = get_class($this); - $trace = debug_backtrace(); - $file = $trace[0]['file']; - $line = $trace[0]['line']; - trigger_error("Call to undefined method $class::$method() in $file on line $line", E_USER_ERROR); - } - - /** - * Sorting callback for items - * - * @access private - * @param SimplePie $a - * @param SimplePie $b - * @return boolean - */ - public static function sort_items($a, $b) - { - $a_date = $a->get_date('U'); - $b_date = $b->get_date('U'); - if ($a_date && $b_date) { - return $a_date > $b_date ? -1 : 1; - } - // Sort items without dates to the top. - if ($a_date) { - return 1; - } - if ($b_date) { - return -1; - } - return 0; - } - - /** - * Merge items from several feeds into one - * - * If you're merging multiple feeds together, they need to all have dates - * for the items or else SimplePie will refuse to sort them. - * - * @link http://simplepie.org/wiki/tutorial/sort_multiple_feeds_by_time_and_date#if_feeds_require_separate_per-feed_settings - * @param array $urls List of SimplePie feed objects to merge - * @param int $start Starting item - * @param int $end Number of items to return - * @param int $limit Maximum number of items per feed - * @return array - */ - public static function merge_items($urls, $start = 0, $end = 0, $limit = 0) - { - if (is_array($urls) && sizeof($urls) > 0) - { - $items = array(); - foreach ($urls as $arg) - { - if ($arg instanceof SimplePie) - { - $items = array_merge($items, $arg->get_items(0, $limit)); - } - else - { - trigger_error('Arguments must be SimplePie objects', E_USER_WARNING); - } - } - - usort($items, array(get_class($urls[0]), 'sort_items')); - - if ($end === 0) - { - return array_slice($items, $start); - } - else - { - return array_slice($items, $start, $end); - } - } - else - { - trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING); - return array(); - } - } - - /** - * Store PubSubHubbub links as headers - * - * There is no way to find PuSH links in the body of a microformats feed, - * so they are added to the headers when found, to be used later by get_links. - * @param SimplePie_File $file - * @param string $hub - * @param string $self - */ - private function store_links(&$file, $hub, $self) { - if (isset($file->headers['link']['hub']) || - (isset($file->headers['link']) && - preg_match('/rel=hub/', $file->headers['link']))) - { - return; - } - - if ($hub) - { - if (isset($file->headers['link'])) - { - if ($file->headers['link'] !== '') - { - $file->headers['link'] = ', '; - } - } - else - { - $file->headers['link'] = ''; - } - $file->headers['link'] .= '<'.$hub.'>; rel=hub'; - if ($self) - { - $file->headers['link'] .= ', <'.$self.'>; rel=self'; - } - } - } -}
@@ -1,156 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Manages all author-related data - * - * Used by {@see SimplePie_Item::get_author()} and {@see SimplePie::get_authors()} - * - * This class can be overloaded with {@see SimplePie::set_author_class()} - * - * @package SimplePie - * @subpackage API - */ -class SimplePie_Author -{ - /** - * Author's name - * - * @var string - * @see get_name() - */ - var $name; - - /** - * Author's link - * - * @var string - * @see get_link() - */ - var $link; - - /** - * Author's email address - * - * @var string - * @see get_email() - */ - var $email; - - /** - * Constructor, used to input the data - * - * @param string $name - * @param string $link - * @param string $email - */ - public function __construct($name = null, $link = null, $email = null) - { - $this->name = $name; - $this->link = $link; - $this->email = $email; - } - - /** - * String-ified version - * - * @return string - */ - public function __toString() - { - // There is no $this->data here - return md5(serialize($this)); - } - - /** - * Author's name - * - * @return string|null - */ - public function get_name() - { - if ($this->name !== null) - { - return $this->name; - } - else - { - return null; - } - } - - /** - * Author's link - * - * @return string|null - */ - public function get_link() - { - if ($this->link !== null) - { - return $this->link; - } - else - { - return null; - } - } - - /** - * Author's email address - * - * @return string|null - */ - public function get_email() - { - if ($this->email !== null) - { - return $this->email; - } - else - { - return null; - } - } -} -
@@ -1,134 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Used to create cache objects - * - * This class can be overloaded with {@see SimplePie::set_cache_class()}, - * although the preferred way is to create your own handler - * via {@see register()} - * - * @package SimplePie - * @subpackage Caching - */ -class SimplePie_Cache -{ - /** - * Cache handler classes - * - * These receive 3 parameters to their constructor, as documented in - * {@see register()} - * @var array - */ - protected static $handlers = array( - 'mysql' => 'SimplePie_Cache_MySQL', - 'memcache' => 'SimplePie_Cache_Memcache', - 'memcached' => 'SimplePie_Cache_Memcached', - 'redis' => 'SimplePie_Cache_Redis' - ); - - /** - * Don't call the constructor. Please. - */ - private function __construct() { } - - /** - * Create a new SimplePie_Cache object - * - * @param string $location URL location (scheme is used to determine handler) - * @param string $filename Unique identifier for cache object - * @param string $extension 'spi' or 'spc' - * @return SimplePie_Cache_Base Type of object depends on scheme of `$location` - */ - public static function get_handler($location, $filename, $extension) - { - $type = explode(':', $location, 2); - $type = $type[0]; - if (!empty(self::$handlers[$type])) - { - $class = self::$handlers[$type]; - return new $class($location, $filename, $extension); - } - - return new SimplePie_Cache_File($location, $filename, $extension); - } - - /** - * Create a new SimplePie_Cache object - * - * @deprecated Use {@see get_handler} instead - */ - public function create($location, $filename, $extension) - { - trigger_error('Cache::create() has been replaced with Cache::get_handler(). Switch to the registry system to use this.', E_USER_DEPRECATED); - return self::get_handler($location, $filename, $extension); - } - - /** - * Register a handler - * - * @param string $type DSN type to register for - * @param string $class Name of handler class. Must implement SimplePie_Cache_Base - */ - public static function register($type, $class) - { - self::$handlers[$type] = $class; - } - - /** - * Parse a URL into an array - * - * @param string $url - * @return array - */ - public static function parse_URL($url) - { - $params = parse_url($url); - $params['extras'] = array(); - if (isset($params['query'])) - { - parse_str($params['query'], $params['extras']); - } - return $params; - } -}
@@ -1,113 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Base for cache objects - * - * Classes to be used with {@see SimplePie_Cache::register()} are expected - * to implement this interface. - * - * @package SimplePie - * @subpackage Caching - */ -interface SimplePie_Cache_Base -{ - /** - * Feed cache type - * - * @var string - */ - const TYPE_FEED = 'spc'; - - /** - * Image cache type - * - * @var string - */ - const TYPE_IMAGE = 'spi'; - - /** - * Create a new cache object - * - * @param string $location Location string (from SimplePie::$cache_location) - * @param string $name Unique ID for the cache - * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data - */ - public function __construct($location, $name, $type); - - /** - * Save data to the cache - * - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property - * @return bool Successfulness - */ - public function save($data); - - /** - * Retrieve the data saved to the cache - * - * @return array Data for SimplePie::$data - */ - public function load(); - - /** - * Retrieve the last modified time for the cache - * - * @return int Timestamp - */ - public function mtime(); - - /** - * Set the last modified time to the current time - * - * @return bool Success status - */ - public function touch(); - - /** - * Remove the cache - * - * @return bool Success status - */ - public function unlink(); -}
@@ -1,136 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Base class for database-based caches - * - * @package SimplePie - * @subpackage Caching - */ -abstract class SimplePie_Cache_DB implements SimplePie_Cache_Base -{ - /** - * Helper for database conversion - * - * Converts a given {@see SimplePie} object into data to be stored - * - * @param SimplePie $data - * @return array First item is the serialized data for storage, second item is the unique ID for this item - */ - protected static function prepare_simplepie_object_for_cache($data) - { - $items = $data->get_items(); - $items_by_id = array(); - - if (!empty($items)) - { - foreach ($items as $item) - { - $items_by_id[$item->get_id()] = $item; - } - - if (count($items_by_id) !== count($items)) - { - $items_by_id = array(); - foreach ($items as $item) - { - $items_by_id[$item->get_id(true)] = $item; - } - } - - if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) - { - $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; - } - elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) - { - $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; - } - elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) - { - $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; - } - elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0])) - { - $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]; - } - else - { - $channel = null; - } - - if ($channel !== null) - { - if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'])) - { - unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry']); - } - if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry'])) - { - unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry']); - } - if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])) - { - unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']); - } - if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])) - { - unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']); - } - if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item'])) - { - unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item']); - } - } - if (isset($data->data['items'])) - { - unset($data->data['items']); - } - if (isset($data->data['ordered_items'])) - { - unset($data->data['ordered_items']); - } - } - return array(serialize($data->data), $items_by_id); - } -}
@@ -1,164 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Caches data to the filesystem - * - * @package SimplePie - * @subpackage Caching - */ -class SimplePie_Cache_File implements SimplePie_Cache_Base -{ - /** - * Location string - * - * @see SimplePie::$cache_location - * @var string - */ - protected $location; - - /** - * Filename - * - * @var string - */ - protected $filename; - - /** - * File extension - * - * @var string - */ - protected $extension; - - /** - * File path - * - * @var string - */ - protected $name; - - /** - * Create a new cache object - * - * @param string $location Location string (from SimplePie::$cache_location) - * @param string $name Unique ID for the cache - * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data - */ - public function __construct($location, $name, $type) - { - $this->location = $location; - $this->filename = $name; - $this->extension = $type; - $this->name = "$this->location/$this->filename.$this->extension"; - } - - /** - * Save data to the cache - * - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property - * @return bool Successfulness - */ - public function save($data) - { - if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location)) - { - if ($data instanceof SimplePie) - { - $data = $data->data; - } - - $data = serialize($data); - return (bool) file_put_contents($this->name, $data); - } - return false; - } - - /** - * Retrieve the data saved to the cache - * - * @return array Data for SimplePie::$data - */ - public function load() - { - if (file_exists($this->name) && is_readable($this->name)) - { - return unserialize(file_get_contents($this->name)); - } - return false; - } - - /** - * Retrieve the last modified time for the cache - * - * @return int Timestamp - */ - public function mtime() - { - return @filemtime($this->name); - } - - /** - * Set the last modified time to the current time - * - * @return bool Success status - */ - public function touch() - { - return @touch($this->name); - } - - /** - * Remove the cache - * - * @return bool Success status - */ - public function unlink() - { - if (file_exists($this->name)) - { - return unlink($this->name); - } - return false; - } -}
@@ -1,180 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Caches data to memcache - * - * Registered for URLs with the "memcache" protocol - * - * For example, `memcache://localhost:11211/?timeout=3600&prefix=sp_` will - * connect to memcache on `localhost` on port 11211. All tables will be - * prefixed with `sp_` and data will expire after 3600 seconds - * - * @package SimplePie - * @subpackage Caching - * @uses Memcache - */ -class SimplePie_Cache_Memcache implements SimplePie_Cache_Base -{ - /** - * Memcache instance - * - * @var Memcache - */ - protected $cache; - - /** - * Options - * - * @var array - */ - protected $options; - - /** - * Cache name - * - * @var string - */ - protected $name; - - /** - * Create a new cache object - * - * @param string $location Location string (from SimplePie::$cache_location) - * @param string $name Unique ID for the cache - * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data - */ - public function __construct($location, $name, $type) - { - $this->options = array( - 'host' => '127.0.0.1', - 'port' => 11211, - 'extras' => array( - 'timeout' => 3600, // one hour - 'prefix' => 'simplepie_', - ), - ); - $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); - - $this->name = $this->options['extras']['prefix'] . md5("$name:$type"); - - $this->cache = new Memcache(); - $this->cache->addServer($this->options['host'], (int) $this->options['port']); - } - - /** - * Save data to the cache - * - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property - * @return bool Successfulness - */ - public function save($data) - { - if ($data instanceof SimplePie) - { - $data = $data->data; - } - return $this->cache->set($this->name, serialize($data), MEMCACHE_COMPRESSED, (int) $this->options['extras']['timeout']); - } - - /** - * Retrieve the data saved to the cache - * - * @return array Data for SimplePie::$data - */ - public function load() - { - $data = $this->cache->get($this->name); - - if ($data !== false) - { - return unserialize($data); - } - return false; - } - - /** - * Retrieve the last modified time for the cache - * - * @return int Timestamp - */ - public function mtime() - { - $data = $this->cache->get($this->name); - - if ($data !== false) - { - // essentially ignore the mtime because Memcache expires on its own - return time(); - } - - return false; - } - - /** - * Set the last modified time to the current time - * - * @return bool Success status - */ - public function touch() - { - $data = $this->cache->get($this->name); - - if ($data !== false) - { - return $this->cache->set($this->name, $data, MEMCACHE_COMPRESSED, (int) $this->options['extras']['timeout']); - } - - return false; - } - - /** - * Remove the cache - * - * @return bool Success status - */ - public function unlink() - { - return $this->cache->delete($this->name, 0); - } -}
@@ -1,166 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Caches data to memcached - * - * Registered for URLs with the "memcached" protocol - * - * For example, `memcached://localhost:11211/?timeout=3600&prefix=sp_` will - * connect to memcached on `localhost` on port 11211. All tables will be - * prefixed with `sp_` and data will expire after 3600 seconds - * - * @package SimplePie - * @subpackage Caching - * @author Paul L. McNeely - * @uses Memcached - */ -class SimplePie_Cache_Memcached implements SimplePie_Cache_Base -{ - /** - * Memcached instance - * @var Memcached - */ - protected $cache; - - /** - * Options - * @var array - */ - protected $options; - - /** - * Cache name - * @var string - */ - protected $name; - - /** - * Create a new cache object - * @param string $location Location string (from SimplePie::$cache_location) - * @param string $name Unique ID for the cache - * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data - */ - public function __construct($location, $name, $type) { - $this->options = array( - 'host' => '127.0.0.1', - 'port' => 11211, - 'extras' => array( - 'timeout' => 3600, // one hour - 'prefix' => 'simplepie_', - ), - ); - $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); - - $this->name = $this->options['extras']['prefix'] . md5("$name:$type"); - - $this->cache = new Memcached(); - $this->cache->addServer($this->options['host'], (int)$this->options['port']); - } - - /** - * Save data to the cache - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property - * @return bool Successfulness - */ - public function save($data) { - if ($data instanceof SimplePie) { - $data = $data->data; - } - - return $this->setData(serialize($data)); - } - - /** - * Retrieve the data saved to the cache - * @return array Data for SimplePie::$data - */ - public function load() { - $data = $this->cache->get($this->name); - - if ($data !== false) { - return unserialize($data); - } - return false; - } - - /** - * Retrieve the last modified time for the cache - * @return int Timestamp - */ - public function mtime() { - $data = $this->cache->get($this->name . '_mtime'); - return (int) $data; - } - - /** - * Set the last modified time to the current time - * @return bool Success status - */ - public function touch() { - $data = $this->cache->get($this->name); - return $this->setData($data); - } - - /** - * Remove the cache - * @return bool Success status - */ - public function unlink() { - return $this->cache->delete($this->name, 0); - } - - /** - * Set the last modified time and data to Memcached - * @return bool Success status - */ - private function setData($data) { - - if ($data !== false) { - $this->cache->set($this->name . '_mtime', time(), (int)$this->options['extras']['timeout']); - return $this->cache->set($this->name, $data, (int)$this->options['extras']['timeout']); - } - - return false; - } -}
@@ -1,454 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Caches data to a MySQL database - * - * Registered for URLs with the "mysql" protocol - * - * For example, `mysql://root:password@localhost:3306/mydb?prefix=sp_` will - * connect to the `mydb` database on `localhost` on port 3306, with the user - * `root` and the password `password`. All tables will be prefixed with `sp_` - * - * @package SimplePie - * @subpackage Caching - */ -class SimplePie_Cache_MySQL extends SimplePie_Cache_DB -{ - /** - * PDO instance - * - * @var PDO - */ - protected $mysql; - - /** - * Options - * - * @var array - */ - protected $options; - - /** - * Cache ID - * - * @var string - */ - protected $id; - - /** - * Create a new cache object - * - * @param string $location Location string (from SimplePie::$cache_location) - * @param string $name Unique ID for the cache - * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data - */ - public function __construct($location, $name, $type) - { - $this->options = array( - 'user' => null, - 'pass' => null, - 'host' => '127.0.0.1', - 'port' => '3306', - 'path' => '', - 'extras' => array( - 'prefix' => '', - 'cache_purge_time' => 2592000 - ), - ); - - $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); - - // Path is prefixed with a "/" - $this->options['dbname'] = substr($this->options['path'], 1); - - try - { - $this->mysql = new PDO("mysql:dbname={$this->options['dbname']};host={$this->options['host']};port={$this->options['port']}", $this->options['user'], $this->options['pass'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - catch (PDOException $e) - { - $this->mysql = null; - return; - } - - $this->id = $name . $type; - - if (!$query = $this->mysql->query('SHOW TABLES')) - { - $this->mysql = null; - return; - } - - $db = array(); - while ($row = $query->fetchColumn()) - { - $db[] = $row; - } - - if (!in_array($this->options['extras']['prefix'] . 'cache_data', $db)) - { - $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))'); - if ($query === false) - { - trigger_error("Can't create " . $this->options['extras']['prefix'] . "cache_data table, check permissions", E_USER_WARNING); - $this->mysql = null; - return; - } - } - - if (!in_array($this->options['extras']['prefix'] . 'items', $db)) - { - $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` MEDIUMBLOB NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))'); - if ($query === false) - { - trigger_error("Can't create " . $this->options['extras']['prefix'] . "items table, check permissions", E_USER_WARNING); - $this->mysql = null; - return; - } - } - } - - /** - * Save data to the cache - * - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property - * @return bool Successfulness - */ - public function save($data) - { - if ($this->mysql === null) - { - return false; - } - - $query = $this->mysql->prepare('DELETE i, cd FROM `' . $this->options['extras']['prefix'] . 'cache_data` cd, ' . - '`' . $this->options['extras']['prefix'] . 'items` i ' . - 'WHERE cd.id = i.feed_id ' . - 'AND cd.mtime < (unix_timestamp() - :purge_time)'); - $query->bindValue(':purge_time', $this->options['extras']['cache_purge_time']); - - if (!$query->execute()) - { - return false; - } - - if ($data instanceof SimplePie) - { - $data = clone $data; - - $prepared = self::prepare_simplepie_object_for_cache($data); - - $query = $this->mysql->prepare('SELECT COUNT(*) FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed'); - $query->bindValue(':feed', $this->id); - if ($query->execute()) - { - if ($query->fetchColumn() > 0) - { - $items = count($prepared[1]); - if ($items) - { - $sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = :items, `data` = :data, `mtime` = :time WHERE `id` = :feed'; - $query = $this->mysql->prepare($sql); - $query->bindValue(':items', $items); - } - else - { - $sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `data` = :data, `mtime` = :time WHERE `id` = :feed'; - $query = $this->mysql->prepare($sql); - } - - $query->bindValue(':data', $prepared[0]); - $query->bindValue(':time', time()); - $query->bindValue(':feed', $this->id); - if (!$query->execute()) - { - return false; - } - } - else - { - $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:feed, :count, :data, :time)'); - $query->bindValue(':feed', $this->id); - $query->bindValue(':count', count($prepared[1])); - $query->bindValue(':data', $prepared[0]); - $query->bindValue(':time', time()); - if (!$query->execute()) - { - return false; - } - } - - $ids = array_keys($prepared[1]); - if (!empty($ids)) - { - foreach ($ids as $id) - { - $database_ids[] = $this->mysql->quote($id); - } - - $query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `id` = ' . implode(' OR `id` = ', $database_ids) . ' AND `feed_id` = :feed'); - $query->bindValue(':feed', $this->id); - - if ($query->execute()) - { - $existing_ids = array(); - while ($row = $query->fetchColumn()) - { - $existing_ids[] = $row; - } - - $new_ids = array_diff($ids, $existing_ids); - - foreach ($new_ids as $new_id) - { - if (!($date = $prepared[1][$new_id]->get_date('U'))) - { - $date = time(); - } - - $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'items` (`feed_id`, `id`, `data`, `posted`) VALUES(:feed, :id, :data, :date)'); - $query->bindValue(':feed', $this->id); - $query->bindValue(':id', $new_id); - $query->bindValue(':data', serialize($prepared[1][$new_id]->data)); - $query->bindValue(':date', $date); - if (!$query->execute()) - { - return false; - } - } - return true; - } - } - else - { - return true; - } - } - } - else - { - $query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed'); - $query->bindValue(':feed', $this->id); - if ($query->execute()) - { - if ($query->rowCount() > 0) - { - $query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = 0, `data` = :data, `mtime` = :time WHERE `id` = :feed'); - $query->bindValue(':data', serialize($data)); - $query->bindValue(':time', time()); - $query->bindValue(':feed', $this->id); - if ($this->execute()) - { - return true; - } - } - else - { - $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:id, 0, :data, :time)'); - $query->bindValue(':id', $this->id); - $query->bindValue(':data', serialize($data)); - $query->bindValue(':time', time()); - if ($query->execute()) - { - return true; - } - } - } - } - return false; - } - - /** - * Retrieve the data saved to the cache - * - * @return array Data for SimplePie::$data - */ - public function load() - { - if ($this->mysql === null) - { - return false; - } - - $query = $this->mysql->prepare('SELECT `items`, `data` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id'); - $query->bindValue(':id', $this->id); - if ($query->execute() && ($row = $query->fetch())) - { - $data = unserialize($row[1]); - - if (isset($this->options['items'][0])) - { - $items = (int) $this->options['items'][0]; - } - else - { - $items = (int) $row[0]; - } - - if ($items !== 0) - { - if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) - { - $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; - } - elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) - { - $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; - } - elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) - { - $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; - } - elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0])) - { - $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]; - } - else - { - $feed = null; - } - - if ($feed !== null) - { - $sql = 'SELECT `data` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :feed ORDER BY `posted` DESC'; - if ($items > 0) - { - $sql .= ' LIMIT ' . $items; - } - - $query = $this->mysql->prepare($sql); - $query->bindValue(':feed', $this->id); - if ($query->execute()) - { - while ($row = $query->fetchColumn()) - { - $feed['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'][] = unserialize($row); - } - } - else - { - return false; - } - } - } - return $data; - } - return false; - } - - /** - * Retrieve the last modified time for the cache - * - * @return int Timestamp - */ - public function mtime() - { - if ($this->mysql === null) - { - return false; - } - - $query = $this->mysql->prepare('SELECT `mtime` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id'); - $query->bindValue(':id', $this->id); - if ($query->execute() && ($time = $query->fetchColumn())) - { - return $time; - } - else - { - return false; - } - } - - /** - * Set the last modified time to the current time - * - * @return bool Success status - */ - public function touch() - { - if ($this->mysql === null) - { - return false; - } - - $query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `mtime` = :time WHERE `id` = :id'); - $query->bindValue(':time', time()); - $query->bindValue(':id', $this->id); - if ($query->execute() && $query->rowCount() > 0) - { - return true; - } - else - { - return false; - } - } - - /** - * Remove the cache - * - * @return bool Success status - */ - public function unlink() - { - if ($this->mysql === null) - { - return false; - } - - $query = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id'); - $query->bindValue(':id', $this->id); - $query2 = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :id'); - $query2->bindValue(':id', $this->id); - if ($query->execute() && $query2->execute()) - { - return true; - } - else - { - return false; - } - } -}
@@ -1,166 +0,0 @@
-<?php - -/** - * SimplePie Redis Cache Extension - * - * @package SimplePie - * @author Jan Kozak <galvani78@gmail.com> - * @link http://galvani.cz/ - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - * @version 0.2.9 - */ - - -/** - * Caches data to redis - * - * Registered for URLs with the "redis" protocol - * - * For example, `redis://localhost:6379/?timeout=3600&prefix=sp_&dbIndex=0` will - * connect to redis on `localhost` on port 6379. All tables will be - * prefixed with `simple_primary-` and data will expire after 3600 seconds - * - * @package SimplePie - * @subpackage Caching - * @uses Redis - */ -class SimplePie_Cache_Redis implements SimplePie_Cache_Base { - /** - * Redis instance - * - * @var \Redis - */ - protected $cache; - - /** - * Options - * - * @var array - */ - protected $options; - - /** - * Cache name - * - * @var string - */ - protected $name; - - /** - * Cache Data - * - * @var type - */ - protected $data; - - /** - * Create a new cache object - * - * @param string $location Location string (from SimplePie::$cache_location) - * @param string $name Unique ID for the cache - * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data - */ - public function __construct($location, $name, $options = null) { - //$this->cache = \flow\simple\cache\Redis::getRedisClientInstance(); - $parsed = SimplePie_Cache::parse_URL($location); - $redis = new Redis(); - $redis->connect($parsed['host'], $parsed['port']); - $this->cache = $redis; - - if (!is_null($options) && is_array($options)) { - $this->options = $options; - } else { - $this->options = array ( - 'prefix' => 'rss:simple_primary:', - 'expire' => 0, - ); - } - - $this->name = $this->options['prefix'] . $name; - } - - /** - * @param \Redis $cache - */ - public function setRedisClient(\Redis $cache) { - $this->cache = $cache; - } - - /** - * Save data to the cache - * - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property - * @return bool Successfulness - */ - public function save($data) { - if ($data instanceof SimplePie) { - $data = $data->data; - } - $response = $this->cache->set($this->name, serialize($data)); - if ($this->options['expire']) { - $this->cache->expire($this->name, $this->options['expire']); - } - - return $response; - } - - /** - * Retrieve the data saved to the cache - * - * @return array Data for SimplePie::$data - */ - public function load() { - $data = $this->cache->get($this->name); - - if ($data !== false) { - return unserialize($data); - } - return false; - } - - /** - * Retrieve the last modified time for the cache - * - * @return int Timestamp - */ - public function mtime() { - - $data = $this->cache->get($this->name); - - if ($data !== false) { - return time(); - } - - return false; - } - - /** - * Set the last modified time to the current time - * - * @return bool Success status - */ - public function touch() { - - $data = $this->cache->get($this->name); - - if ($data !== false) { - $return = $this->cache->set($this->name, $data); - if ($this->options['expire']) { - return $this->cache->expire($this->name, $this->ttl); - } - return $return; - } - - return false; - } - - /** - * Remove the cache - * - * @return bool Success status - */ - public function unlink() { - return $this->cache->set($this->name, null); - } - -}
@@ -1,209 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - - -/** - * Handles `<media:text>` captions as defined in Media RSS. - * - * Used by {@see SimplePie_Enclosure::get_caption()} and {@see SimplePie_Enclosure::get_captions()} - * - * This class can be overloaded with {@see SimplePie::set_caption_class()} - * - * @package SimplePie - * @subpackage API - */ -class SimplePie_Caption -{ - /** - * Content type - * - * @var string - * @see get_type() - */ - var $type; - - /** - * Language - * - * @var string - * @see get_language() - */ - var $lang; - - /** - * Start time - * - * @var string - * @see get_starttime() - */ - var $startTime; - - /** - * End time - * - * @var string - * @see get_endtime() - */ - var $endTime; - - /** - * Caption text - * - * @var string - * @see get_text() - */ - var $text; - - /** - * Constructor, used to input the data - * - * For documentation on all the parameters, see the corresponding - * properties and their accessors - */ - public function __construct($type = null, $lang = null, $startTime = null, $endTime = null, $text = null) - { - $this->type = $type; - $this->lang = $lang; - $this->startTime = $startTime; - $this->endTime = $endTime; - $this->text = $text; - } - - /** - * String-ified version - * - * @return string - */ - public function __toString() - { - // There is no $this->data here - return md5(serialize($this)); - } - - /** - * Get the end time - * - * @return string|null Time in the format 'hh:mm:ss.SSS' - */ - public function get_endtime() - { - if ($this->endTime !== null) - { - return $this->endTime; - } - else - { - return null; - } - } - - /** - * Get the language - * - * @link http://tools.ietf.org/html/rfc3066 - * @return string|null Language code as per RFC 3066 - */ - public function get_language() - { - if ($this->lang !== null) - { - return $this->lang; - } - else - { - return null; - } - } - - /** - * Get the start time - * - * @return string|null Time in the format 'hh:mm:ss.SSS' - */ - public function get_starttime() - { - if ($this->startTime !== null) - { - return $this->startTime; - } - else - { - return null; - } - } - - /** - * Get the text of the caption - * - * @return string|null - */ - public function get_text() - { - if ($this->text !== null) - { - return $this->text; - } - else - { - return null; - } - } - - /** - * Get the content type (not MIME type) - * - * @return string|null Either 'text' or 'html' - */ - public function get_type() - { - if ($this->type !== null) - { - return $this->type; - } - else - { - return null; - } - } -} -
@@ -1,156 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Manages all category-related data - * - * Used by {@see SimplePie_Item::get_category()} and {@see SimplePie_Item::get_categories()} - * - * This class can be overloaded with {@see SimplePie::set_category_class()} - * - * @package SimplePie - * @subpackage API - */ -class SimplePie_Category -{ - /** - * Category identifier - * - * @var string - * @see get_term - */ - var $term; - - /** - * Categorization scheme identifier - * - * @var string - * @see get_scheme() - */ - var $scheme; - - /** - * Human readable label - * - * @var string - * @see get_label() - */ - var $label; - - /** - * Constructor, used to input the data - * - * @param string $term - * @param string $scheme - * @param string $label - */ - public function __construct($term = null, $scheme = null, $label = null) - { - $this->term = $term; - $this->scheme = $scheme; - $this->label = $label; - } - - /** - * String-ified version - * - * @return string - */ - public function __toString() - { - // There is no $this->data here - return md5(serialize($this)); - } - - /** - * Get the category identifier - * - * @return string|null - */ - public function get_term() - { - if ($this->term !== null) - { - return $this->term; - } - else - { - return null; - } - } - - /** - * Get the categorization scheme identifier - * - * @return string|null - */ - public function get_scheme() - { - if ($this->scheme !== null) - { - return $this->scheme; - } - else - { - return null; - } - } - - /** - * Get the human readable label - * - * @return string|null - */ - public function get_label() - { - if ($this->label !== null) - { - return $this->label; - } - else - { - return $this->get_term(); - } - } -} -
@@ -1,331 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - - -/** - * Content-type sniffing - * - * Based on the rules in http://tools.ietf.org/html/draft-abarth-mime-sniff-06 - * - * This is used since we can't always trust Content-Type headers, and is based - * upon the HTML5 parsing rules. - * - * - * This class can be overloaded with {@see SimplePie::set_content_type_sniffer_class()} - * - * @package SimplePie - * @subpackage HTTP - */ -class SimplePie_Content_Type_Sniffer -{ - /** - * File object - * - * @var SimplePie_File - */ - var $file; - - /** - * Create an instance of the class with the input file - * - * @param SimplePie_Content_Type_Sniffer $file Input file - */ - public function __construct($file) - { - $this->file = $file; - } - - /** - * Get the Content-Type of the specified file - * - * @return string Actual Content-Type - */ - public function get_type() - { - if (isset($this->file->headers['content-type'])) - { - if (!isset($this->file->headers['content-encoding']) - && ($this->file->headers['content-type'] === 'text/plain' - || $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1' - || $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1' - || $this->file->headers['content-type'] === 'text/plain; charset=UTF-8')) - { - return $this->text_or_binary(); - } - - if (($pos = strpos($this->file->headers['content-type'], ';')) !== false) - { - $official = substr($this->file->headers['content-type'], 0, $pos); - } - else - { - $official = $this->file->headers['content-type']; - } - $official = trim(strtolower($official)); - - if ($official === 'unknown/unknown' - || $official === 'application/unknown') - { - return $this->unknown(); - } - elseif (substr($official, -4) === '+xml' - || $official === 'text/xml' - || $official === 'application/xml') - { - return $official; - } - elseif (substr($official, 0, 6) === 'image/') - { - if ($return = $this->image()) - { - return $return; - } - else - { - return $official; - } - } - elseif ($official === 'text/html') - { - return $this->feed_or_html(); - } - else - { - return $official; - } - } - else - { - return $this->unknown(); - } - } - - /** - * Sniff text or binary - * - * @return string Actual Content-Type - */ - public function text_or_binary() - { - if (substr($this->file->body, 0, 2) === "\xFE\xFF" - || substr($this->file->body, 0, 2) === "\xFF\xFE" - || substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF" - || substr($this->file->body, 0, 3) === "\xEF\xBB\xBF") - { - return 'text/plain'; - } - elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body)) - { - return 'application/octect-stream'; - } - else - { - return 'text/plain'; - } - } - - /** - * Sniff unknown - * - * @return string Actual Content-Type - */ - public function unknown() - { - $ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20"); - if (strtolower(substr($this->file->body, $ws, 14)) === '<!doctype html' - || strtolower(substr($this->file->body, $ws, 5)) === '<html' - || strtolower(substr($this->file->body, $ws, 7)) === '<script') - { - return 'text/html'; - } - elseif (substr($this->file->body, 0, 5) === '%PDF-') - { - return 'application/pdf'; - } - elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-') - { - return 'application/postscript'; - } - elseif (substr($this->file->body, 0, 6) === 'GIF87a' - || substr($this->file->body, 0, 6) === 'GIF89a') - { - return 'image/gif'; - } - elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") - { - return 'image/png'; - } - elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") - { - return 'image/jpeg'; - } - elseif (substr($this->file->body, 0, 2) === "\x42\x4D") - { - return 'image/bmp'; - } - elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00") - { - return 'image/vnd.microsoft.icon'; - } - else - { - return $this->text_or_binary(); - } - } - - /** - * Sniff images - * - * @return string Actual Content-Type - */ - public function image() - { - if (substr($this->file->body, 0, 6) === 'GIF87a' - || substr($this->file->body, 0, 6) === 'GIF89a') - { - return 'image/gif'; - } - elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") - { - return 'image/png'; - } - elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") - { - return 'image/jpeg'; - } - elseif (substr($this->file->body, 0, 2) === "\x42\x4D") - { - return 'image/bmp'; - } - elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00") - { - return 'image/vnd.microsoft.icon'; - } - else - { - return false; - } - } - - /** - * Sniff HTML - * - * @return string Actual Content-Type - */ - public function feed_or_html() - { - $len = strlen($this->file->body); - $pos = strspn($this->file->body, "\x09\x0A\x0D\x20"); - - while ($pos < $len) - { - switch ($this->file->body[$pos]) - { - case "\x09": - case "\x0A": - case "\x0D": - case "\x20": - $pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos); - continue 2; - - case '<': - $pos++; - break; - - default: - return 'text/html'; - } - - if (substr($this->file->body, $pos, 3) === '!--') - { - $pos += 3; - if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false) - { - $pos += 3; - } - else - { - return 'text/html'; - } - } - elseif (substr($this->file->body, $pos, 1) === '!') - { - if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false) - { - $pos++; - } - else - { - return 'text/html'; - } - } - elseif (substr($this->file->body, $pos, 1) === '?') - { - if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false) - { - $pos += 2; - } - else - { - return 'text/html'; - } - } - elseif (substr($this->file->body, $pos, 3) === 'rss' - || substr($this->file->body, $pos, 7) === 'rdf:RDF') - { - return 'application/rss+xml'; - } - elseif (substr($this->file->body, $pos, 4) === 'feed') - { - return 'application/atom+xml'; - } - else - { - return 'text/html'; - } - } - - return 'text/html'; - } -} -
@@ -1,129 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Manages `<media:copyright>` copyright tags as defined in Media RSS - * - * Used by {@see SimplePie_Enclosure::get_copyright()} - * - * This class can be overloaded with {@see SimplePie::set_copyright_class()} - * - * @package SimplePie - * @subpackage API - */ -class SimplePie_Copyright -{ - /** - * Copyright URL - * - * @var string - * @see get_url() - */ - var $url; - - /** - * Attribution - * - * @var string - * @see get_attribution() - */ - var $label; - - /** - * Constructor, used to input the data - * - * For documentation on all the parameters, see the corresponding - * properties and their accessors - */ - public function __construct($url = null, $label = null) - { - $this->url = $url; - $this->label = $label; - } - - /** - * String-ified version - * - * @return string - */ - public function __toString() - { - // There is no $this->data here - return md5(serialize($this)); - } - - /** - * Get the copyright URL - * - * @return string|null URL to copyright information - */ - public function get_url() - { - if ($this->url !== null) - { - return $this->url; - } - else - { - return null; - } - } - - /** - * Get the attribution text - * - * @return string|null - */ - public function get_attribution() - { - if ($this->label !== null) - { - return $this->label; - } - else - { - return null; - } - } -} -
@@ -1,56 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * SimplePie class. - * - * Class for backward compatibility. - * - * @deprecated Use {@see SimplePie} directly - * @package SimplePie - * @subpackage API - */ -class SimplePie_Core extends SimplePie -{ - -}
@@ -1,155 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Handles `<media:credit>` as defined in Media RSS - * - * Used by {@see SimplePie_Enclosure::get_credit()} and {@see SimplePie_Enclosure::get_credits()} - * - * This class can be overloaded with {@see SimplePie::set_credit_class()} - * - * @package SimplePie - * @subpackage API - */ -class SimplePie_Credit -{ - /** - * Credited role - * - * @var string - * @see get_role() - */ - var $role; - - /** - * Organizational scheme - * - * @var string - * @see get_scheme() - */ - var $scheme; - - /** - * Credited name - * - * @var string - * @see get_name() - */ - var $name; - - /** - * Constructor, used to input the data - * - * For documentation on all the parameters, see the corresponding - * properties and their accessors - */ - public function __construct($role = null, $scheme = null, $name = null) - { - $this->role = $role; - $this->scheme = $scheme; - $this->name = $name; - } - - /** - * String-ified version - * - * @return string - */ - public function __toString() - { - // There is no $this->data here - return md5(serialize($this)); - } - - /** - * Get the role of the person receiving credit - * - * @return string|null - */ - public function get_role() - { - if ($this->role !== null) - { - return $this->role; - } - else - { - return null; - } - } - - /** - * Get the organizational scheme - * - * @return string|null - */ - public function get_scheme() - { - if ($this->scheme !== null) - { - return $this->scheme; - } - else - { - return null; - } - } - - /** - * Get the credited person/entity's name - * - * @return string|null - */ - public function get_name() - { - if ($this->name !== null) - { - return $this->name; - } - else - { - return null; - } - } -} -
@@ -1,615 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - - -/** - * Decode HTML Entities - * - * This implements HTML5 as of revision 967 (2007-06-28) - * - * @deprecated Use DOMDocument instead! - * @package SimplePie - */ -class SimplePie_Decode_HTML_Entities -{ - /** - * Data to be parsed - * - * @access private - * @var string - */ - var $data = ''; - - /** - * Currently consumed bytes - * - * @access private - * @var string - */ - var $consumed = ''; - - /** - * Position of the current byte being parsed - * - * @access private - * @var int - */ - var $position = 0; - - /** - * Create an instance of the class with the input data - * - * @access public - * @param string $data Input data - */ - public function __construct($data) - { - $this->data = $data; - } - - /** - * Parse the input data - * - * @access public - * @return string Output data - */ - public function parse() - { - while (($this->position = strpos($this->data, '&', $this->position)) !== false) - { - $this->consume(); - $this->entity(); - $this->consumed = ''; - } - return $this->data; - } - - /** - * Consume the next byte - * - * @access private - * @return mixed The next byte, or false, if there is no more data - */ - public function consume() - { - if (isset($this->data[$this->position])) - { - $this->consumed .= $this->data[$this->position]; - return $this->data[$this->position++]; - } - else - { - return false; - } - } - - /** - * Consume a range of characters - * - * @access private - * @param string $chars Characters to consume - * @return mixed A series of characters that match the range, or false - */ - public function consume_range($chars) - { - if ($len = strspn($this->data, $chars, $this->position)) - { - $data = substr($this->data, $this->position, $len); - $this->consumed .= $data; - $this->position += $len; - return $data; - } - else - { - return false; - } - } - - /** - * Unconsume one byte - * - * @access private - */ - public function unconsume() - { - $this->consumed = substr($this->consumed, 0, -1); - $this->position--; - } - - /** - * Decode an entity - * - * @access private - */ - public function entity() - { - switch ($this->consume()) - { - case "\x09": - case "\x0A": - case "\x0B": - case "\x0C": - case "\x20": - case "\x3C": - case "\x26": - case false: - break; - - case "\x23": - switch ($this->consume()) - { - case "\x78": - case "\x58": - $range = '0123456789ABCDEFabcdef'; - $hex = true; - break; - - default: - $range = '0123456789'; - $hex = false; - $this->unconsume(); - break; - } - - if ($codepoint = $this->consume_range($range)) - { - static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8"); - - if ($hex) - { - $codepoint = hexdec($codepoint); - } - else - { - $codepoint = intval($codepoint); - } - - if (isset($windows_1252_specials[$codepoint])) - { - $replacement = $windows_1252_specials[$codepoint]; - } - else - { - $replacement = SimplePie_Misc::codepoint_to_utf8($codepoint); - } - - if (!in_array($this->consume(), array(';', false), true)) - { - $this->unconsume(); - } - - $consumed_length = strlen($this->consumed); - $this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length); - $this->position += strlen($replacement) - $consumed_length; - } - break; - - default: - static $entities = array( - 'Aacute' => "\xC3\x81", - 'aacute' => "\xC3\xA1", - 'Aacute;' => "\xC3\x81", - 'aacute;' => "\xC3\xA1", - 'Acirc' => "\xC3\x82", - 'acirc' => "\xC3\xA2", - 'Acirc;' => "\xC3\x82", - 'acirc;' => "\xC3\xA2", - 'acute' => "\xC2\xB4", - 'acute;' => "\xC2\xB4", - 'AElig' => "\xC3\x86", - 'aelig' => "\xC3\xA6", - 'AElig;' => "\xC3\x86", - 'aelig;' => "\xC3\xA6", - 'Agrave' => "\xC3\x80", - 'agrave' => "\xC3\xA0", - 'Agrave;' => "\xC3\x80", - 'agrave;' => "\xC3\xA0", - 'alefsym;' => "\xE2\x84\xB5", - 'Alpha;' => "\xCE\x91", - 'alpha;' => "\xCE\xB1", - 'AMP' => "\x26", - 'amp' => "\x26", - 'AMP;' => "\x26", - 'amp;' => "\x26", - 'and;' => "\xE2\x88\xA7", - 'ang;' => "\xE2\x88\xA0", - 'apos;' => "\x27", - 'Aring' => "\xC3\x85", - 'aring' => "\xC3\xA5", - 'Aring;' => "\xC3\x85", - 'aring;' => "\xC3\xA5", - 'asymp;' => "\xE2\x89\x88", - 'Atilde' => "\xC3\x83", - 'atilde' => "\xC3\xA3", - 'Atilde;' => "\xC3\x83", - 'atilde;' => "\xC3\xA3", - 'Auml' => "\xC3\x84", - 'auml' => "\xC3\xA4", - 'Auml;' => "\xC3\x84", - 'auml;' => "\xC3\xA4", - 'bdquo;' => "\xE2\x80\x9E", - 'Beta;' => "\xCE\x92", - 'beta;' => "\xCE\xB2", - 'brvbar' => "\xC2\xA6", - 'brvbar;' => "\xC2\xA6", - 'bull;' => "\xE2\x80\xA2", - 'cap;' => "\xE2\x88\xA9", - 'Ccedil' => "\xC3\x87", - 'ccedil' => "\xC3\xA7", - 'Ccedil;' => "\xC3\x87", - 'ccedil;' => "\xC3\xA7", - 'cedil' => "\xC2\xB8", - 'cedil;' => "\xC2\xB8", - 'cent' => "\xC2\xA2", - 'cent;' => "\xC2\xA2", - 'Chi;' => "\xCE\xA7", - 'chi;' => "\xCF\x87", - 'circ;' => "\xCB\x86", - 'clubs;' => "\xE2\x99\xA3", - 'cong;' => "\xE2\x89\x85", - 'COPY' => "\xC2\xA9", - 'copy' => "\xC2\xA9", - 'COPY;' => "\xC2\xA9", - 'copy;' => "\xC2\xA9", - 'crarr;' => "\xE2\x86\xB5", - 'cup;' => "\xE2\x88\xAA", - 'curren' => "\xC2\xA4", - 'curren;' => "\xC2\xA4", - 'Dagger;' => "\xE2\x80\xA1", - 'dagger;' => "\xE2\x80\xA0", - 'dArr;' => "\xE2\x87\x93", - 'darr;' => "\xE2\x86\x93", - 'deg' => "\xC2\xB0", - 'deg;' => "\xC2\xB0", - 'Delta;' => "\xCE\x94", - 'delta;' => "\xCE\xB4", - 'diams;' => "\xE2\x99\xA6", - 'divide' => "\xC3\xB7", - 'divide;' => "\xC3\xB7", - 'Eacute' => "\xC3\x89", - 'eacute' => "\xC3\xA9", - 'Eacute;' => "\xC3\x89", - 'eacute;' => "\xC3\xA9", - 'Ecirc' => "\xC3\x8A", - 'ecirc' => "\xC3\xAA", - 'Ecirc;' => "\xC3\x8A", - 'ecirc;' => "\xC3\xAA", - 'Egrave' => "\xC3\x88", - 'egrave' => "\xC3\xA8", - 'Egrave;' => "\xC3\x88", - 'egrave;' => "\xC3\xA8", - 'empty;' => "\xE2\x88\x85", - 'emsp;' => "\xE2\x80\x83", - 'ensp;' => "\xE2\x80\x82", - 'Epsilon;' => "\xCE\x95", - 'epsilon;' => "\xCE\xB5", - 'equiv;' => "\xE2\x89\xA1", - 'Eta;' => "\xCE\x97", - 'eta;' => "\xCE\xB7", - 'ETH' => "\xC3\x90", - 'eth' => "\xC3\xB0", - 'ETH;' => "\xC3\x90", - 'eth;' => "\xC3\xB0", - 'Euml' => "\xC3\x8B", - 'euml' => "\xC3\xAB", - 'Euml;' => "\xC3\x8B", - 'euml;' => "\xC3\xAB", - 'euro;' => "\xE2\x82\xAC", - 'exist;' => "\xE2\x88\x83", - 'fnof;' => "\xC6\x92", - 'forall;' => "\xE2\x88\x80", - 'frac12' => "\xC2\xBD", - 'frac12;' => "\xC2\xBD", - 'frac14' => "\xC2\xBC", - 'frac14;' => "\xC2\xBC", - 'frac34' => "\xC2\xBE", - 'frac34;' => "\xC2\xBE", - 'frasl;' => "\xE2\x81\x84", - 'Gamma;' => "\xCE\x93", - 'gamma;' => "\xCE\xB3", - 'ge;' => "\xE2\x89\xA5", - 'GT' => "\x3E", - 'gt' => "\x3E", - 'GT;' => "\x3E", - 'gt;' => "\x3E", - 'hArr;' => "\xE2\x87\x94", - 'harr;' => "\xE2\x86\x94", - 'hearts;' => "\xE2\x99\xA5", - 'hellip;' => "\xE2\x80\xA6", - 'Iacute' => "\xC3\x8D", - 'iacute' => "\xC3\xAD", - 'Iacute;' => "\xC3\x8D", - 'iacute;' => "\xC3\xAD", - 'Icirc' => "\xC3\x8E", - 'icirc' => "\xC3\xAE", - 'Icirc;' => "\xC3\x8E", - 'icirc;' => "\xC3\xAE", - 'iexcl' => "\xC2\xA1", - 'iexcl;' => "\xC2\xA1", - 'Igrave' => "\xC3\x8C", - 'igrave' => "\xC3\xAC", - 'Igrave;' => "\xC3\x8C", - 'igrave;' => "\xC3\xAC", - 'image;' => "\xE2\x84\x91", - 'infin;' => "\xE2\x88\x9E", - 'int;' => "\xE2\x88\xAB", - 'Iota;' => "\xCE\x99", - 'iota;' => "\xCE\xB9", - 'iquest' => "\xC2\xBF", - 'iquest;' => "\xC2\xBF", - 'isin;' => "\xE2\x88\x88", - 'Iuml' => "\xC3\x8F", - 'iuml' => "\xC3\xAF", - 'Iuml;' => "\xC3\x8F", - 'iuml;' => "\xC3\xAF", - 'Kappa;' => "\xCE\x9A", - 'kappa;' => "\xCE\xBA", - 'Lambda;' => "\xCE\x9B", - 'lambda;' => "\xCE\xBB", - 'lang;' => "\xE3\x80\x88", - 'laquo' => "\xC2\xAB", - 'laquo;' => "\xC2\xAB", - 'lArr;' => "\xE2\x87\x90", - 'larr;' => "\xE2\x86\x90", - 'lceil;' => "\xE2\x8C\x88", - 'ldquo;' => "\xE2\x80\x9C", - 'le;' => "\xE2\x89\xA4", - 'lfloor;' => "\xE2\x8C\x8A", - 'lowast;' => "\xE2\x88\x97", - 'loz;' => "\xE2\x97\x8A", - 'lrm;' => "\xE2\x80\x8E", - 'lsaquo;' => "\xE2\x80\xB9", - 'lsquo;' => "\xE2\x80\x98", - 'LT' => "\x3C", - 'lt' => "\x3C", - 'LT;' => "\x3C", - 'lt;' => "\x3C", - 'macr' => "\xC2\xAF", - 'macr;' => "\xC2\xAF", - 'mdash;' => "\xE2\x80\x94", - 'micro' => "\xC2\xB5", - 'micro;' => "\xC2\xB5", - 'middot' => "\xC2\xB7", - 'middot;' => "\xC2\xB7", - 'minus;' => "\xE2\x88\x92", - 'Mu;' => "\xCE\x9C", - 'mu;' => "\xCE\xBC", - 'nabla;' => "\xE2\x88\x87", - 'nbsp' => "\xC2\xA0", - 'nbsp;' => "\xC2\xA0", - 'ndash;' => "\xE2\x80\x93", - 'ne;' => "\xE2\x89\xA0", - 'ni;' => "\xE2\x88\x8B", - 'not' => "\xC2\xAC", - 'not;' => "\xC2\xAC", - 'notin;' => "\xE2\x88\x89", - 'nsub;' => "\xE2\x8A\x84", - 'Ntilde' => "\xC3\x91", - 'ntilde' => "\xC3\xB1", - 'Ntilde;' => "\xC3\x91", - 'ntilde;' => "\xC3\xB1", - 'Nu;' => "\xCE\x9D", - 'nu;' => "\xCE\xBD", - 'Oacute' => "\xC3\x93", - 'oacute' => "\xC3\xB3", - 'Oacute;' => "\xC3\x93", - 'oacute;' => "\xC3\xB3", - 'Ocirc' => "\xC3\x94", - 'ocirc' => "\xC3\xB4", - 'Ocirc;' => "\xC3\x94", - 'ocirc;' => "\xC3\xB4", - 'OElig;' => "\xC5\x92", - 'oelig;' => "\xC5\x93", - 'Ograve' => "\xC3\x92", - 'ograve' => "\xC3\xB2", - 'Ograve;' => "\xC3\x92", - 'ograve;' => "\xC3\xB2", - 'oline;' => "\xE2\x80\xBE", - 'Omega;' => "\xCE\xA9", - 'omega;' => "\xCF\x89", - 'Omicron;' => "\xCE\x9F", - 'omicron;' => "\xCE\xBF", - 'oplus;' => "\xE2\x8A\x95", - 'or;' => "\xE2\x88\xA8", - 'ordf' => "\xC2\xAA", - 'ordf;' => "\xC2\xAA", - 'ordm' => "\xC2\xBA", - 'ordm;' => "\xC2\xBA", - 'Oslash' => "\xC3\x98", - 'oslash' => "\xC3\xB8", - 'Oslash;' => "\xC3\x98", - 'oslash;' => "\xC3\xB8", - 'Otilde' => "\xC3\x95", - 'otilde' => "\xC3\xB5", - 'Otilde;' => "\xC3\x95", - 'otilde;' => "\xC3\xB5", - 'otimes;' => "\xE2\x8A\x97", - 'Ouml' => "\xC3\x96", - 'ouml' => "\xC3\xB6", - 'Ouml;' => "\xC3\x96", - 'ouml;' => "\xC3\xB6", - 'para' => "\xC2\xB6", - 'para;' => "\xC2\xB6", - 'part;' => "\xE2\x88\x82", - 'permil;' => "\xE2\x80\xB0", - 'perp;' => "\xE2\x8A\xA5", - 'Phi;' => "\xCE\xA6", - 'phi;' => "\xCF\x86", - 'Pi;' => "\xCE\xA0", - 'pi;' => "\xCF\x80", - 'piv;' => "\xCF\x96", - 'plusmn' => "\xC2\xB1", - 'plusmn;' => "\xC2\xB1", - 'pound' => "\xC2\xA3", - 'pound;' => "\xC2\xA3", - 'Prime;' => "\xE2\x80\xB3", - 'prime;' => "\xE2\x80\xB2", - 'prod;' => "\xE2\x88\x8F", - 'prop;' => "\xE2\x88\x9D", - 'Psi;' => "\xCE\xA8", - 'psi;' => "\xCF\x88", - 'QUOT' => "\x22", - 'quot' => "\x22", - 'QUOT;' => "\x22", - 'quot;' => "\x22", - 'radic;' => "\xE2\x88\x9A", - 'rang;' => "\xE3\x80\x89", - 'raquo' => "\xC2\xBB", - 'raquo;' => "\xC2\xBB", - 'rArr;' => "\xE2\x87\x92", - 'rarr;' => "\xE2\x86\x92", - 'rceil;' => "\xE2\x8C\x89", - 'rdquo;' => "\xE2\x80\x9D", - 'real;' => "\xE2\x84\x9C", - 'REG' => "\xC2\xAE", - 'reg' => "\xC2\xAE", - 'REG;' => "\xC2\xAE", - 'reg;' => "\xC2\xAE", - 'rfloor;' => "\xE2\x8C\x8B", - 'Rho;' => "\xCE\xA1", - 'rho;' => "\xCF\x81", - 'rlm;' => "\xE2\x80\x8F", - 'rsaquo;' => "\xE2\x80\xBA", - 'rsquo;' => "\xE2\x80\x99", - 'sbquo;' => "\xE2\x80\x9A", - 'Scaron;' => "\xC5\xA0", - 'scaron;' => "\xC5\xA1", - 'sdot;' => "\xE2\x8B\x85", - 'sect' => "\xC2\xA7", - 'sect;' => "\xC2\xA7", - 'shy' => "\xC2\xAD", - 'shy;' => "\xC2\xAD", - 'Sigma;' => "\xCE\xA3", - 'sigma;' => "\xCF\x83", - 'sigmaf;' => "\xCF\x82", - 'sim;' => "\xE2\x88\xBC", - 'spades;' => "\xE2\x99\xA0", - 'sub;' => "\xE2\x8A\x82", - 'sube;' => "\xE2\x8A\x86", - 'sum;' => "\xE2\x88\x91", - 'sup;' => "\xE2\x8A\x83", - 'sup1' => "\xC2\xB9", - 'sup1;' => "\xC2\xB9", - 'sup2' => "\xC2\xB2", - 'sup2;' => "\xC2\xB2", - 'sup3' => "\xC2\xB3", - 'sup3;' => "\xC2\xB3", - 'supe;' => "\xE2\x8A\x87", - 'szlig' => "\xC3\x9F", - 'szlig;' => "\xC3\x9F", - 'Tau;' => "\xCE\xA4", - 'tau;' => "\xCF\x84", - 'there4;' => "\xE2\x88\xB4", - 'Theta;' => "\xCE\x98", - 'theta;' => "\xCE\xB8", - 'thetasym;' => "\xCF\x91", - 'thinsp;' => "\xE2\x80\x89", - 'THORN' => "\xC3\x9E", - 'thorn' => "\xC3\xBE", - 'THORN;' => "\xC3\x9E", - 'thorn;' => "\xC3\xBE", - 'tilde;' => "\xCB\x9C", - 'times' => "\xC3\x97", - 'times;' => "\xC3\x97", - 'TRADE;' => "\xE2\x84\xA2", - 'trade;' => "\xE2\x84\xA2", - 'Uacute' => "\xC3\x9A", - 'uacute' => "\xC3\xBA", - 'Uacute;' => "\xC3\x9A", - 'uacute;' => "\xC3\xBA", - 'uArr;' => "\xE2\x87\x91", - 'uarr;' => "\xE2\x86\x91", - 'Ucirc' => "\xC3\x9B", - 'ucirc' => "\xC3\xBB", - 'Ucirc;' => "\xC3\x9B", - 'ucirc;' => "\xC3\xBB", - 'Ugrave' => "\xC3\x99", - 'ugrave' => "\xC3\xB9", - 'Ugrave;' => "\xC3\x99", - 'ugrave;' => "\xC3\xB9", - 'uml' => "\xC2\xA8", - 'uml;' => "\xC2\xA8", - 'upsih;' => "\xCF\x92", - 'Upsilon;' => "\xCE\xA5", - 'upsilon;' => "\xCF\x85", - 'Uuml' => "\xC3\x9C", - 'uuml' => "\xC3\xBC", - 'Uuml;' => "\xC3\x9C", - 'uuml;' => "\xC3\xBC", - 'weierp;' => "\xE2\x84\x98", - 'Xi;' => "\xCE\x9E", - 'xi;' => "\xCE\xBE", - 'Yacute' => "\xC3\x9D", - 'yacute' => "\xC3\xBD", - 'Yacute;' => "\xC3\x9D", - 'yacute;' => "\xC3\xBD", - 'yen' => "\xC2\xA5", - 'yen;' => "\xC2\xA5", - 'yuml' => "\xC3\xBF", - 'Yuml;' => "\xC5\xB8", - 'yuml;' => "\xC3\xBF", - 'Zeta;' => "\xCE\x96", - 'zeta;' => "\xCE\xB6", - 'zwj;' => "\xE2\x80\x8D", - 'zwnj;' => "\xE2\x80\x8C" - ); - - for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++) - { - $consumed = substr($this->consumed, 1); - if (isset($entities[$consumed])) - { - $match = $consumed; - } - } - - if ($match !== null) - { - $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1); - $this->position += strlen($entities[$match]) - strlen($consumed) - 1; - } - break; - } - } -} -
@@ -1,1379 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Handles everything related to enclosures (including Media RSS and iTunes RSS) - * - * Used by {@see SimplePie_Item::get_enclosure()} and {@see SimplePie_Item::get_enclosures()} - * - * This class can be overloaded with {@see SimplePie::set_enclosure_class()} - * - * @package SimplePie - * @subpackage API - */ -class SimplePie_Enclosure -{ - /** - * @var string - * @see get_bitrate() - */ - var $bitrate; - - /** - * @var array - * @see get_captions() - */ - var $captions; - - /** - * @var array - * @see get_categories() - */ - var $categories; - - /** - * @var int - * @see get_channels() - */ - var $channels; - - /** - * @var SimplePie_Copyright - * @see get_copyright() - */ - var $copyright; - - /** - * @var array - * @see get_credits() - */ - var $credits; - - /** - * @var string - * @see get_description() - */ - var $description; - - /** - * @var int - * @see get_duration() - */ - var $duration; - - /** - * @var string - * @see get_expression() - */ - var $expression; - - /** - * @var string - * @see get_framerate() - */ - var $framerate; - - /** - * @var string - * @see get_handler() - */ - var $handler; - - /** - * @var array - * @see get_hashes() - */ - var $hashes; - - /** - * @var string - * @see get_height() - */ - var $height; - - /** - * @deprecated - * @var null - */ - var $javascript; - - /** - * @var array - * @see get_keywords() - */ - var $keywords; - - /** - * @var string - * @see get_language() - */ - var $lang; - - /** - * @var string - * @see get_length() - */ - var $length; - - /** - * @var string - * @see get_link() - */ - var $link; - - /** - * @var string - * @see get_medium() - */ - var $medium; - - /** - * @var string - * @see get_player() - */ - var $player; - - /** - * @var array - * @see get_ratings() - */ - var $ratings; - - /** - * @var array - * @see get_restrictions() - */ - var $restrictions; - - /** - * @var string - * @see get_sampling_rate() - */ - var $samplingrate; - - /** - * @var array - * @see get_thumbnails() - */ - var $thumbnails; - - /** - * @var string - * @see get_title() - */ - var $title; - - /** - * @var string - * @see get_type() - */ - var $type; - - /** - * @var string - * @see get_width() - */ - var $width; - - /** - * Constructor, used to input the data - * - * For documentation on all the parameters, see the corresponding - * properties and their accessors - * - * @uses idna_convert If available, this will convert an IDN - */ - public function __construct($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null) - { - $this->bitrate = $bitrate; - $this->captions = $captions; - $this->categories = $categories; - $this->channels = $channels; - $this->copyright = $copyright; - $this->credits = $credits; - $this->description = $description; - $this->duration = $duration; - $this->expression = $expression; - $this->framerate = $framerate; - $this->hashes = $hashes; - $this->height = $height; - $this->keywords = $keywords; - $this->lang = $lang; - $this->length = $length; - $this->link = $link; - $this->medium = $medium; - $this->player = $player; - $this->ratings = $ratings; - $this->restrictions = $restrictions; - $this->samplingrate = $samplingrate; - $this->thumbnails = $thumbnails; - $this->title = $title; - $this->type = $type; - $this->width = $width; - - if (class_exists('idna_convert')) - { - $idn = new idna_convert(); - $parsed = SimplePie_Misc::parse_url($link); - $this->link = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']); - } - $this->handler = $this->get_handler(); // Needs to load last - } - - /** - * String-ified version - * - * @return string - */ - public function __toString() - { - // There is no $this->data here - return md5(serialize($this)); - } - - /** - * Get the bitrate - * - * @return string|null - */ - public function get_bitrate() - { - if ($this->bitrate !== null) - { - return $this->bitrate; - } - else - { - return null; - } - } - - /** - * Get a single caption - * - * @param int $key - * @return SimplePie_Caption|null - */ - public function get_caption($key = 0) - { - $captions = $this->get_captions(); - if (isset($captions[$key])) - { - return $captions[$key]; - } - else - { - return null; - } - } - - /** - * Get all captions - * - * @return array|null Array of {@see SimplePie_Caption} objects - */ - public function get_captions() - { - if ($this->captions !== null) - { - return $this->captions; - } - else - { - return null; - } - } - - /** - * Get a single category - * - * @param int $key - * @return SimplePie_Category|null - */ - public function get_category($key = 0) - { - $categories = $this->get_categories(); - if (isset($categories[$key])) - { - return $categories[$key]; - } - else - { - return null; - } - } - - /** - * Get all categories - * - * @return array|null Array of {@see SimplePie_Category} objects - */ - public function get_categories() - { - if ($this->categories !== null) - { - return $this->categories; - } - else - { - return null; - } - } - - /** - * Get the number of audio channels - * - * @return int|null - */ - public function get_channels() - { - if ($this->channels !== null) - { - return $this->channels; - } - else - { - return null; - } - } - - /** - * Get the copyright information - * - * @return SimplePie_Copyright|null - */ - public function get_copyright() - { - if ($this->copyright !== null) - { - return $this->copyright; - } - else - { - return null; - } - } - - /** - * Get a single credit - * - * @param int $key - * @return SimplePie_Credit|null - */ - public function get_credit($key = 0) - { - $credits = $this->get_credits(); - if (isset($credits[$key])) - { - return $credits[$key]; - } - else - { - return null; - } - } - - /** - * Get all credits - * - * @return array|null Array of {@see SimplePie_Credit} objects - */ - public function get_credits() - { - if ($this->credits !== null) - { - return $this->credits; - } - else - { - return null; - } - } - - /** - * Get the description of the enclosure - * - * @return string|null - */ - public function get_description() - { - if ($this->description !== null) - { - return $this->description; - } - else - { - return null; - } - } - - /** - * Get the duration of the enclosure - * - * @param bool $convert Convert seconds into hh:mm:ss - * @return string|int|null 'hh:mm:ss' string if `$convert` was specified, otherwise integer (or null if none found) - */ - public function get_duration($convert = false) - { - if ($this->duration !== null) - { - if ($convert) - { - $time = SimplePie_Misc::time_hms($this->duration); - return $time; - } - else - { - return $this->duration; - } - } - else - { - return null; - } - } - - /** - * Get the expression - * - * @return string Probably one of 'sample', 'full', 'nonstop', 'clip'. Defaults to 'full' - */ - public function get_expression() - { - if ($this->expression !== null) - { - return $this->expression; - } - else - { - return 'full'; - } - } - - /** - * Get the file extension - * - * @return string|null - */ - public function get_extension() - { - if ($this->link !== null) - { - $url = SimplePie_Misc::parse_url($this->link); - if ($url['path'] !== '') - { - return pathinfo($url['path'], PATHINFO_EXTENSION); - } - } - return null; - } - - /** - * Get the framerate (in frames-per-second) - * - * @return string|null - */ - public function get_framerate() - { - if ($this->framerate !== null) - { - return $this->framerate; - } - else - { - return null; - } - } - - /** - * Get the preferred handler - * - * @return string|null One of 'flash', 'fmedia', 'quicktime', 'wmedia', 'mp3' - */ - public function get_handler() - { - return $this->get_real_type(true); - } - - /** - * Get a single hash - * - * @link http://www.rssboard.org/media-rss#media-hash - * @param int $key - * @return string|null Hash as per `media:hash`, prefixed with "$algo:" - */ - public function get_hash($key = 0) - { - $hashes = $this->get_hashes(); - if (isset($hashes[$key])) - { - return $hashes[$key]; - } - else - { - return null; - } - } - - /** - * Get all credits - * - * @return array|null Array of strings, see {@see get_hash()} - */ - public function get_hashes() - { - if ($this->hashes !== null) - { - return $this->hashes; - } - else - { - return null; - } - } - - /** - * Get the height - * - * @return string|null - */ - public function get_height() - { - if ($this->height !== null) - { - return $this->height; - } - else - { - return null; - } - } - - /** - * Get the language - * - * @link http://tools.ietf.org/html/rfc3066 - * @return string|null Language code as per RFC 3066 - */ - public function get_language() - { - if ($this->lang !== null) - { - return $this->lang; - } - else - { - return null; - } - } - - /** - * Get a single keyword - * - * @param int $key - * @return string|null - */ - public function get_keyword($key = 0) - { - $keywords = $this->get_keywords(); - if (isset($keywords[$key])) - { - return $keywords[$key]; - } - else - { - return null; - } - } - - /** - * Get all keywords - * - * @return array|null Array of strings - */ - public function get_keywords() - { - if ($this->keywords !== null) - { - return $this->keywords; - } - else - { - return null; - } - } - - /** - * Get length - * - * @return float Length in bytes - */ - public function get_length() - { - if ($this->length !== null) - { - return $this->length; - } - else - { - return null; - } - } - - /** - * Get the URL - * - * @return string|null - */ - public function get_link() - { - if ($this->link !== null) - { - return urldecode($this->link); - } - else - { - return null; - } - } - - /** - * Get the medium - * - * @link http://www.rssboard.org/media-rss#media-content - * @return string|null Should be one of 'image', 'audio', 'video', 'document', 'executable' - */ - public function get_medium() - { - if ($this->medium !== null) - { - return $this->medium; - } - else - { - return null; - } - } - - /** - * Get the player URL - * - * Typically the same as {@see get_permalink()} - * @return string|null Player URL - */ - public function get_player() - { - if ($this->player !== null) - { - return $this->player; - } - else - { - return null; - } - } - - /** - * Get a single rating - * - * @param int $key - * @return SimplePie_Rating|null - */ - public function get_rating($key = 0) - { - $ratings = $this->get_ratings(); - if (isset($ratings[$key])) - { - return $ratings[$key]; - } - else - { - return null; - } - } - - /** - * Get all ratings - * - * @return array|null Array of {@see SimplePie_Rating} objects - */ - public function get_ratings() - { - if ($this->ratings !== null) - { - return $this->ratings; - } - else - { - return null; - } - } - - /** - * Get a single restriction - * - * @param int $key - * @return SimplePie_Restriction|null - */ - public function get_restriction($key = 0) - { - $restrictions = $this->get_restrictions(); - if (isset($restrictions[$key])) - { - return $restrictions[$key]; - } - else - { - return null; - } - } - - /** - * Get all restrictions - * - * @return array|null Array of {@see SimplePie_Restriction} objects - */ - public function get_restrictions() - { - if ($this->restrictions !== null) - { - return $this->restrictions; - } - else - { - return null; - } - } - - /** - * Get the sampling rate (in kHz) - * - * @return string|null - */ - public function get_sampling_rate() - { - if ($this->samplingrate !== null) - { - return $this->samplingrate; - } - else - { - return null; - } - } - - /** - * Get the file size (in MiB) - * - * @return float|null File size in mebibytes (1048 bytes) - */ - public function get_size() - { - $length = $this->get_length(); - if ($length !== null) - { - return round($length/1048576, 2); - } - else - { - return null; - } - } - - /** - * Get a single thumbnail - * - * @param int $key - * @return string|null Thumbnail URL - */ - public function get_thumbnail($key = 0) - { - $thumbnails = $this->get_thumbnails(); - if (isset($thumbnails[$key])) - { - return $thumbnails[$key]; - } - else - { - return null; - } - } - - /** - * Get all thumbnails - * - * @return array|null Array of thumbnail URLs - */ - public function get_thumbnails() - { - if ($this->thumbnails !== null) - { - return $this->thumbnails; - } - else - { - return null; - } - } - - /** - * Get the title - * - * @return string|null - */ - public function get_title() - { - if ($this->title !== null) - { - return $this->title; - } - else - { - return null; - } - } - - /** - * Get mimetype of the enclosure - * - * @see get_real_type() - * @return string|null MIME type - */ - public function get_type() - { - if ($this->type !== null) - { - return $this->type; - } - else - { - return null; - } - } - - /** - * Get the width - * - * @return string|null - */ - public function get_width() - { - if ($this->width !== null) - { - return $this->width; - } - else - { - return null; - } - } - - /** - * Embed the enclosure using `<embed>` - * - * @deprecated Use the second parameter to {@see embed} instead - * - * @param array|string $options See first paramter to {@see embed} - * @return string HTML string to output - */ - public function native_embed($options='') - { - return $this->embed($options, true); - } - - /** - * Embed the enclosure using Javascript - * - * `$options` is an array or comma-separated key:value string, with the - * following properties: - * - * - `alt` (string): Alternate content for when an end-user does not have - * the appropriate handler installed or when a file type is - * unsupported. Can be any text or HTML. Defaults to blank. - * - `altclass` (string): If a file type is unsupported, the end-user will - * see the alt text (above) linked directly to the content. That link - * will have this value as its class name. Defaults to blank. - * - `audio` (string): This is an image that should be used as a - * placeholder for audio files before they're loaded (QuickTime-only). - * Can be any relative or absolute URL. Defaults to blank. - * - `bgcolor` (string): The background color for the media, if not - * already transparent. Defaults to `#ffffff`. - * - `height` (integer): The height of the embedded media. Accepts any - * numeric pixel value (such as `360`) or `auto`. Defaults to `auto`, - * and it is recommended that you use this default. - * - `loop` (boolean): Do you want the media to loop when it's done? - * Defaults to `false`. - * - `mediaplayer` (string): The location of the included - * `mediaplayer.swf` file. This allows for the playback of Flash Video - * (`.flv`) files, and is the default handler for non-Odeo MP3's. - * Defaults to blank. - * - `video` (string): This is an image that should be used as a - * placeholder for video files before they're loaded (QuickTime-only). - * Can be any relative or absolute URL. Defaults to blank. - * - `width` (integer): The width of the embedded media. Accepts any - * numeric pixel value (such as `480`) or `auto`. Defaults to `auto`, - * and it is recommended that you use this default. - * - `widescreen` (boolean): Is the enclosure widescreen or standard? - * This applies only to video enclosures, and will automatically resize - * the content appropriately. Defaults to `false`, implying 4:3 mode. - * - * Note: Non-widescreen (4:3) mode with `width` and `height` set to `auto` - * will default to 480x360 video resolution. Widescreen (16:9) mode with - * `width` and `height` set to `auto` will default to 480x270 video resolution. - * - * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'. - * @param array|string $options Comma-separated key:value list, or array - * @param bool $native Use `<embed>` - * @return string HTML string to output - */ - public function embed($options = '', $native = false) - { - // Set up defaults - $audio = ''; - $video = ''; - $alt = ''; - $altclass = ''; - $loop = 'false'; - $width = 'auto'; - $height = 'auto'; - $bgcolor = '#ffffff'; - $mediaplayer = ''; - $widescreen = false; - $handler = $this->get_handler(); - $type = $this->get_real_type(); - - // Process options and reassign values as necessary - if (is_array($options)) - { - extract($options); - } - else - { - $options = explode(',', $options); - foreach($options as $option) - { - $opt = explode(':', $option, 2); - if (isset($opt[0], $opt[1])) - { - $opt[0] = trim($opt[0]); - $opt[1] = trim($opt[1]); - switch ($opt[0]) - { - case 'audio': - $audio = $opt[1]; - break; - - case 'video': - $video = $opt[1]; - break; - - case 'alt': - $alt = $opt[1]; - break; - - case 'altclass': - $altclass = $opt[1]; - break; - - case 'loop': - $loop = $opt[1]; - break; - - case 'width': - $width = $opt[1]; - break; - - case 'height': - $height = $opt[1]; - break; - - case 'bgcolor': - $bgcolor = $opt[1]; - break; - - case 'mediaplayer': - $mediaplayer = $opt[1]; - break; - - case 'widescreen': - $widescreen = $opt[1]; - break; - } - } - } - } - - $mime = explode('/', $type, 2); - $mime = $mime[0]; - - // Process values for 'auto' - if ($width === 'auto') - { - if ($mime === 'video') - { - if ($height === 'auto') - { - $width = 480; - } - elseif ($widescreen) - { - $width = round((intval($height)/9)*16); - } - else - { - $width = round((intval($height)/3)*4); - } - } - else - { - $width = '100%'; - } - } - - if ($height === 'auto') - { - if ($mime === 'audio') - { - $height = 0; - } - elseif ($mime === 'video') - { - if ($width === 'auto') - { - if ($widescreen) - { - $height = 270; - } - else - { - $height = 360; - } - } - elseif ($widescreen) - { - $height = round((intval($width)/16)*9); - } - else - { - $height = round((intval($width)/4)*3); - } - } - else - { - $height = 376; - } - } - elseif ($mime === 'audio') - { - $height = 0; - } - - // Set proper placeholder value - if ($mime === 'audio') - { - $placeholder = $audio; - } - elseif ($mime === 'video') - { - $placeholder = $video; - } - - $embed = ''; - - // Flash - if ($handler === 'flash') - { - if ($native) - { - $embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>"; - } - else - { - $embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>"; - } - } - - // Flash Media Player file types. - // Preferred handler for MP3 file types. - elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== '')) - { - $height += 20; - if ($native) - { - $embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>"; - } - else - { - $embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>"; - } - } - - // QuickTime 7 file types. Need to test with QuickTime 6. - // Only handle MP3's if the Flash Media Player is not present. - elseif ($handler === 'quicktime' || ($handler === 'mp3' && $mediaplayer === '')) - { - $height += 16; - if ($native) - { - if ($placeholder !== '') - { - $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>"; - } - else - { - $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>"; - } - } - else - { - $embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>"; - } - } - - // Windows Media - elseif ($handler === 'wmedia') - { - $height += 45; - if ($native) - { - $embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>"; - } - else - { - $embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>"; - } - } - - // Everything else - else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>'; - - return $embed; - } - - /** - * Get the real media type - * - * Often, feeds lie to us, necessitating a bit of deeper inspection. This - * converts types to their canonical representations based on the file - * extension - * - * @see get_type() - * @param bool $find_handler Internal use only, use {@see get_handler()} instead - * @return string MIME type - */ - public function get_real_type($find_handler = false) - { - // Mime-types by handler. - $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash - $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player - $types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime - $types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media - $types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3 - - if ($this->get_type() !== null) - { - $type = strtolower($this->type); - } - else - { - $type = null; - } - - // If we encounter an unsupported mime-type, check the file extension and guess intelligently. - if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3))) - { - switch (strtolower($this->get_extension())) - { - // Audio mime-types - case 'aac': - case 'adts': - $type = 'audio/acc'; - break; - - case 'aif': - case 'aifc': - case 'aiff': - case 'cdda': - $type = 'audio/aiff'; - break; - - case 'bwf': - $type = 'audio/wav'; - break; - - case 'kar': - case 'mid': - case 'midi': - case 'smf': - $type = 'audio/midi'; - break; - - case 'm4a': - $type = 'audio/x-m4a'; - break; - - case 'mp3': - case 'swa': - $type = 'audio/mp3'; - break; - - case 'wav': - $type = 'audio/wav'; - break; - - case 'wax': - $type = 'audio/x-ms-wax'; - break; - - case 'wma': - $type = 'audio/x-ms-wma'; - break; - - // Video mime-types - case '3gp': - case '3gpp': - $type = 'video/3gpp'; - break; - - case '3g2': - case '3gp2': - $type = 'video/3gpp2'; - break; - - case 'asf': - $type = 'video/x-ms-asf'; - break; - - case 'flv': - $type = 'video/x-flv'; - break; - - case 'm1a': - case 'm1s': - case 'm1v': - case 'm15': - case 'm75': - case 'mp2': - case 'mpa': - case 'mpeg': - case 'mpg': - case 'mpm': - case 'mpv': - $type = 'video/mpeg'; - break; - - case 'm4v': - $type = 'video/x-m4v'; - break; - - case 'mov': - case 'qt': - $type = 'video/quicktime'; - break; - - case 'mp4': - case 'mpg4': - $type = 'video/mp4'; - break; - - case 'sdv': - $type = 'video/sd-video'; - break; - - case 'wm': - $type = 'video/x-ms-wm'; - break; - - case 'wmv': - $type = 'video/x-ms-wmv'; - break; - - case 'wvx': - $type = 'video/x-ms-wvx'; - break; - - // Flash mime-types - case 'spl': - $type = 'application/futuresplash'; - break; - - case 'swf': - $type = 'application/x-shockwave-flash'; - break; - } - } - - if ($find_handler) - { - if (in_array($type, $types_flash)) - { - return 'flash'; - } - elseif (in_array($type, $types_fmedia)) - { - return 'fmedia'; - } - elseif (in_array($type, $types_quicktime)) - { - return 'quicktime'; - } - elseif (in_array($type, $types_wmedia)) - { - return 'wmedia'; - } - elseif (in_array($type, $types_mp3)) - { - return 'mp3'; - } - else - { - return null; - } - } - else - { - return $type; - } - } -} -
@@ -1,51 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * General SimplePie exception class - * - * @package SimplePie - */ -class SimplePie_Exception extends Exception -{ -}
@@ -1,306 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Used for fetching remote files and reading local files - * - * Supports HTTP 1.0 via cURL or fsockopen, with spotty HTTP 1.1 support - * - * This class can be overloaded with {@see SimplePie::set_file_class()} - * - * @package SimplePie - * @subpackage HTTP - * @todo Move to properly supporting RFC2616 (HTTP/1.1) - */ -class SimplePie_File -{ - var $url; - var $useragent; - var $success = true; - var $headers = array(); - var $body; - var $status_code; - var $redirects = 0; - var $error; - var $method = SIMPLEPIE_FILE_SOURCE_NONE; - var $permanent_url; - - public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false, $curl_options = array()) - { - if (class_exists('idna_convert')) - { - $idn = new idna_convert(); - $parsed = SimplePie_Misc::parse_url($url); - $url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']); - } - $this->url = $url; - $this->permanent_url = $url; - $this->useragent = $useragent; - if (preg_match('/^http(s)?:\/\//i', $url)) - { - if ($useragent === null) - { - $useragent = ini_get('user_agent'); - $this->useragent = $useragent; - } - if (!is_array($headers)) - { - $headers = array(); - } - if (!$force_fsockopen && function_exists('curl_exec')) - { - $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL; - $fp = curl_init(); - $headers2 = array(); - foreach ($headers as $key => $value) - { - $headers2[] = "$key: $value"; - } - if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>=')) - { - curl_setopt($fp, CURLOPT_ENCODING, ''); - } - curl_setopt($fp, CURLOPT_URL, $url); - curl_setopt($fp, CURLOPT_HEADER, 1); - curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($fp, CURLOPT_FAILONERROR, 1); - curl_setopt($fp, CURLOPT_TIMEOUT, $timeout); - curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout); - curl_setopt($fp, CURLOPT_REFERER, $url); - curl_setopt($fp, CURLOPT_USERAGENT, $useragent); - curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2); - if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>=')) - { - curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects); - } - foreach ($curl_options as $curl_param => $curl_value) { - curl_setopt($fp, $curl_param, $curl_value); - } - - $this->headers = curl_exec($fp); - if (curl_errno($fp) === 23 || curl_errno($fp) === 61) - { - curl_setopt($fp, CURLOPT_ENCODING, 'none'); - $this->headers = curl_exec($fp); - } - if (curl_errno($fp)) - { - $this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp); - $this->success = false; - } - else - { - // Use the updated url provided by curl_getinfo after any redirects. - if ($info = curl_getinfo($fp)) { - $this->url = $info['url']; - } - curl_close($fp); - $this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1); - $this->headers = array_pop($this->headers); - $parser = new SimplePie_HTTP_Parser($this->headers); - if ($parser->parse()) - { - $this->headers = $parser->headers; - $this->body = trim($parser->body); - $this->status_code = $parser->status_code; - if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) - { - $this->redirects++; - $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); - $previousStatusCode = $this->status_code; - $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); - $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; - return; - } - } - } - } - else - { - $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN; - $url_parts = parse_url($url); - $socket_host = $url_parts['host']; - if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https') - { - $socket_host = "ssl://$url_parts[host]"; - $url_parts['port'] = 443; - } - if (!isset($url_parts['port'])) - { - $url_parts['port'] = 80; - } - $fp = @fsockopen($socket_host, $url_parts['port'], $errno, $errstr, $timeout); - if (!$fp) - { - $this->error = 'fsockopen error: ' . $errstr; - $this->success = false; - } - else - { - stream_set_timeout($fp, $timeout); - if (isset($url_parts['path'])) - { - if (isset($url_parts['query'])) - { - $get = "$url_parts[path]?$url_parts[query]"; - } - else - { - $get = $url_parts['path']; - } - } - else - { - $get = '/'; - } - $out = "GET $get HTTP/1.1\r\n"; - $out .= "Host: $url_parts[host]\r\n"; - $out .= "User-Agent: $useragent\r\n"; - if (extension_loaded('zlib')) - { - $out .= "Accept-Encoding: x-gzip,gzip,deflate\r\n"; - } - - if (isset($url_parts['user']) && isset($url_parts['pass'])) - { - $out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n"; - } - foreach ($headers as $key => $value) - { - $out .= "$key: $value\r\n"; - } - $out .= "Connection: Close\r\n\r\n"; - fwrite($fp, $out); - - $info = stream_get_meta_data($fp); - - $this->headers = ''; - while (!$info['eof'] && !$info['timed_out']) - { - $this->headers .= fread($fp, 1160); - $info = stream_get_meta_data($fp); - } - if (!$info['timed_out']) - { - $parser = new SimplePie_HTTP_Parser($this->headers); - if ($parser->parse()) - { - $this->headers = $parser->headers; - $this->body = trim($parser->body); - $this->status_code = $parser->status_code; - if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) - { - $this->redirects++; - $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); - $previousStatusCode = $this->status_code; - $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); - $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; - return; - } - if (isset($this->headers['content-encoding'])) - { - // Hey, we act dumb elsewhere, so let's do that here too - switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20"))) - { - case 'gzip': - case 'x-gzip': - $decoder = new SimplePie_gzdecode($this->body); - if (!$decoder->parse()) - { - $this->error = 'Unable to decode HTTP "gzip" stream'; - $this->success = false; - } - else - { - $this->body = trim($decoder->data); - } - break; - - case 'deflate': - if (($decompressed = gzinflate($this->body)) !== false) - { - $this->body = $decompressed; - } - else if (($decompressed = gzuncompress($this->body)) !== false) - { - $this->body = $decompressed; - } - else if (function_exists('gzdecode') && ($decompressed = gzdecode($this->body)) !== false) - { - $this->body = $decompressed; - } - else - { - $this->error = 'Unable to decode HTTP "deflate" stream'; - $this->success = false; - } - break; - - default: - $this->error = 'Unknown content coding'; - $this->success = false; - } - } - } - } - else - { - $this->error = 'fsocket timed out'; - $this->success = false; - } - fclose($fp); - } - } - } - else - { - $this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS; - if (empty($url) || !($this->body = trim(file_get_contents($url)))) - { - $this->error = 'file_get_contents could not read the file'; - $this->success = false; - } - } - } -}
@@ -1,499 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - - -/** - * HTTP Response Parser - * - * @package SimplePie - * @subpackage HTTP - */ -class SimplePie_HTTP_Parser -{ - /** - * HTTP Version - * - * @var float - */ - public $http_version = 0.0; - - /** - * Status code - * - * @var int - */ - public $status_code = 0; - - /** - * Reason phrase - * - * @var string - */ - public $reason = ''; - - /** - * Key/value pairs of the headers - * - * @var array - */ - public $headers = array(); - - /** - * Body of the response - * - * @var string - */ - public $body = ''; - - /** - * Current state of the state machine - * - * @var string - */ - protected $state = 'http_version'; - - /** - * Input data - * - * @var string - */ - protected $data = ''; - - /** - * Input data length (to avoid calling strlen() everytime this is needed) - * - * @var int - */ - protected $data_length = 0; - - /** - * Current position of the pointer - * - * @var int - */ - protected $position = 0; - - /** - * Name of the hedaer currently being parsed - * - * @var string - */ - protected $name = ''; - - /** - * Value of the hedaer currently being parsed - * - * @var string - */ - protected $value = ''; - - /** - * Create an instance of the class with the input data - * - * @param string $data Input data - */ - public function __construct($data) - { - $this->data = $data; - $this->data_length = strlen($this->data); - } - - /** - * Parse the input data - * - * @return bool true on success, false on failure - */ - public function parse() - { - while ($this->state && $this->state !== 'emit' && $this->has_data()) - { - $state = $this->state; - $this->$state(); - } - $this->data = ''; - if ($this->state === 'emit' || $this->state === 'body') - { - return true; - } - else - { - $this->http_version = ''; - $this->status_code = ''; - $this->reason = ''; - $this->headers = array(); - $this->body = ''; - return false; - } - } - - /** - * Check whether there is data beyond the pointer - * - * @return bool true if there is further data, false if not - */ - protected function has_data() - { - return (bool) ($this->position < $this->data_length); - } - - /** - * See if the next character is LWS - * - * @return bool true if the next character is LWS, false if not - */ - protected function is_linear_whitespace() - { - return (bool) ($this->data[$this->position] === "\x09" - || $this->data[$this->position] === "\x20" - || ($this->data[$this->position] === "\x0A" - && isset($this->data[$this->position + 1]) - && ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20"))); - } - - /** - * Parse the HTTP version - */ - protected function http_version() - { - if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/') - { - $len = strspn($this->data, '0123456789.', 5); - $this->http_version = substr($this->data, 5, $len); - $this->position += 5 + $len; - if (substr_count($this->http_version, '.') <= 1) - { - $this->http_version = (float) $this->http_version; - $this->position += strspn($this->data, "\x09\x20", $this->position); - $this->state = 'status'; - } - else - { - $this->state = false; - } - } - else - { - $this->state = false; - } - } - - /** - * Parse the status code - */ - protected function status() - { - if ($len = strspn($this->data, '0123456789', $this->position)) - { - $this->status_code = (int) substr($this->data, $this->position, $len); - $this->position += $len; - $this->state = 'reason'; - } - else - { - $this->state = false; - } - } - - /** - * Parse the reason phrase - */ - protected function reason() - { - $len = strcspn($this->data, "\x0A", $this->position); - $this->reason = trim(substr($this->data, $this->position, $len), "\x09\x0D\x20"); - $this->position += $len + 1; - $this->state = 'new_line'; - } - - /** - * Deal with a new line, shifting data around as needed - */ - protected function new_line() - { - $this->value = trim($this->value, "\x0D\x20"); - if ($this->name !== '' && $this->value !== '') - { - $this->name = strtolower($this->name); - // We should only use the last Content-Type header. c.f. issue #1 - if (isset($this->headers[$this->name]) && $this->name !== 'content-type') - { - $this->headers[$this->name] .= ', ' . $this->value; - } - else - { - $this->headers[$this->name] = $this->value; - } - } - $this->name = ''; - $this->value = ''; - if (substr($this->data[$this->position], 0, 2) === "\x0D\x0A") - { - $this->position += 2; - $this->state = 'body'; - } - elseif ($this->data[$this->position] === "\x0A") - { - $this->position++; - $this->state = 'body'; - } - else - { - $this->state = 'name'; - } - } - - /** - * Parse a header name - */ - protected function name() - { - $len = strcspn($this->data, "\x0A:", $this->position); - if (isset($this->data[$this->position + $len])) - { - if ($this->data[$this->position + $len] === "\x0A") - { - $this->position += $len; - $this->state = 'new_line'; - } - else - { - $this->name = substr($this->data, $this->position, $len); - $this->position += $len + 1; - $this->state = 'value'; - } - } - else - { - $this->state = false; - } - } - - /** - * Parse LWS, replacing consecutive LWS characters with a single space - */ - protected function linear_whitespace() - { - do - { - if (substr($this->data, $this->position, 2) === "\x0D\x0A") - { - $this->position += 2; - } - elseif ($this->data[$this->position] === "\x0A") - { - $this->position++; - } - $this->position += strspn($this->data, "\x09\x20", $this->position); - } while ($this->has_data() && $this->is_linear_whitespace()); - $this->value .= "\x20"; - } - - /** - * See what state to move to while within non-quoted header values - */ - protected function value() - { - if ($this->is_linear_whitespace()) - { - $this->linear_whitespace(); - } - else - { - switch ($this->data[$this->position]) - { - case '"': - // Workaround for ETags: we have to include the quotes as - // part of the tag. - if (strtolower($this->name) === 'etag') - { - $this->value .= '"'; - $this->position++; - $this->state = 'value_char'; - break; - } - $this->position++; - $this->state = 'quote'; - break; - - case "\x0A": - $this->position++; - $this->state = 'new_line'; - break; - - default: - $this->state = 'value_char'; - break; - } - } - } - - /** - * Parse a header value while outside quotes - */ - protected function value_char() - { - $len = strcspn($this->data, "\x09\x20\x0A\"", $this->position); - $this->value .= substr($this->data, $this->position, $len); - $this->position += $len; - $this->state = 'value'; - } - - /** - * See what state to move to while within quoted header values - */ - protected function quote() - { - if ($this->is_linear_whitespace()) - { - $this->linear_whitespace(); - } - else - { - switch ($this->data[$this->position]) - { - case '"': - $this->position++; - $this->state = 'value'; - break; - - case "\x0A": - $this->position++; - $this->state = 'new_line'; - break; - - case '\\': - $this->position++; - $this->state = 'quote_escaped'; - break; - - default: - $this->state = 'quote_char'; - break; - } - } - } - - /** - * Parse a header value while within quotes - */ - protected function quote_char() - { - $len = strcspn($this->data, "\x09\x20\x0A\"\\", $this->position); - $this->value .= substr($this->data, $this->position, $len); - $this->position += $len; - $this->state = 'value'; - } - - /** - * Parse an escaped character within quotes - */ - protected function quote_escaped() - { - $this->value .= $this->data[$this->position]; - $this->position++; - $this->state = 'quote'; - } - - /** - * Parse the body - */ - protected function body() - { - $this->body = substr($this->data, $this->position); - if (!empty($this->headers['transfer-encoding'])) - { - unset($this->headers['transfer-encoding']); - $this->state = 'chunked'; - } - else - { - $this->state = 'emit'; - } - } - - /** - * Parsed a "Transfer-Encoding: chunked" body - */ - protected function chunked() - { - if (!preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', trim($this->body))) - { - $this->state = 'emit'; - return; - } - - $decoded = ''; - $encoded = $this->body; - - while (true) - { - $is_chunked = (bool) preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', $encoded, $matches ); - if (!$is_chunked) - { - // Looks like it's not chunked after all - $this->state = 'emit'; - return; - } - - $length = hexdec(trim($matches[1])); - if ($length === 0) - { - // Ignore trailer headers - $this->state = 'emit'; - $this->body = $decoded; - return; - } - - $chunk_length = strlen($matches[0]); - $decoded .= $part = substr($encoded, $chunk_length, $length); - $encoded = substr($encoded, $chunk_length + $length + 2); - - if (trim($encoded) === '0' || empty($encoded)) - { - $this->state = 'emit'; - $this->body = $decoded; - return; - } - } - } -}
@@ -1,1257 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * IRI parser/serialiser/normaliser - * - * @package SimplePie - * @subpackage HTTP - * @author Geoffrey Sneddon - * @author Steve Minutillo - * @author Ryan McCue - * @copyright 2007-2012 Geoffrey Sneddon, Steve Minutillo, Ryan McCue - * @license http://www.opensource.org/licenses/bsd-license.php - */ -class SimplePie_IRI -{ - /** - * Scheme - * - * @var string - */ - protected $scheme = null; - - /** - * User Information - * - * @var string - */ - protected $iuserinfo = null; - - /** - * ihost - * - * @var string - */ - protected $ihost = null; - - /** - * Port - * - * @var string - */ - protected $port = null; - - /** - * ipath - * - * @var string - */ - protected $ipath = ''; - - /** - * iquery - * - * @var string - */ - protected $iquery = null; - - /** - * ifragment - * - * @var string - */ - protected $ifragment = null; - - /** - * Normalization database - * - * Each key is the scheme, each value is an array with each key as the IRI - * part and value as the default value for that part. - */ - protected $normalization = array( - 'acap' => array( - 'port' => 674 - ), - 'dict' => array( - 'port' => 2628 - ), - 'file' => array( - 'ihost' => 'localhost' - ), - 'http' => array( - 'port' => 80, - 'ipath' => '/' - ), - 'https' => array( - 'port' => 443, - 'ipath' => '/' - ), - ); - - /** - * Return the entire IRI when you try and read the object as a string - * - * @return string - */ - public function __toString() - { - return $this->get_iri(); - } - - /** - * Overload __set() to provide access via properties - * - * @param string $name Property name - * @param mixed $value Property value - */ - public function __set($name, $value) - { - if (method_exists($this, 'set_' . $name)) - { - call_user_func(array($this, 'set_' . $name), $value); - } - elseif ( - $name === 'iauthority' - || $name === 'iuserinfo' - || $name === 'ihost' - || $name === 'ipath' - || $name === 'iquery' - || $name === 'ifragment' - ) - { - call_user_func(array($this, 'set_' . substr($name, 1)), $value); - } - } - - /** - * Overload __get() to provide access via properties - * - * @param string $name Property name - * @return mixed - */ - public function __get($name) - { - // isset() returns false for null, we don't want to do that - // Also why we use array_key_exists below instead of isset() - $props = get_object_vars($this); - - if ( - $name === 'iri' || - $name === 'uri' || - $name === 'iauthority' || - $name === 'authority' - ) - { - $return = $this->{"get_$name"}(); - } - elseif (array_key_exists($name, $props)) - { - $return = $this->$name; - } - // host -> ihost - elseif (($prop = 'i' . $name) && array_key_exists($prop, $props)) - { - $name = $prop; - $return = $this->$prop; - } - // ischeme -> scheme - elseif (($prop = substr($name, 1)) && array_key_exists($prop, $props)) - { - $name = $prop; - $return = $this->$prop; - } - else - { - trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE); - $return = null; - } - - if ($return === null && isset($this->normalization[$this->scheme][$name])) - { - return $this->normalization[$this->scheme][$name]; - } - else - { - return $return; - } - } - - /** - * Overload __isset() to provide access via properties - * - * @param string $name Property name - * @return bool - */ - public function __isset($name) - { - if (method_exists($this, 'get_' . $name) || isset($this->$name)) - { - return true; - } - else - { - return false; - } - } - - /** - * Overload __unset() to provide access via properties - * - * @param string $name Property name - */ - public function __unset($name) - { - if (method_exists($this, 'set_' . $name)) - { - call_user_func(array($this, 'set_' . $name), ''); - } - } - - /** - * Create a new IRI object, from a specified string - * - * @param string $iri - */ - public function __construct($iri = null) - { - $this->set_iri($iri); - } - - /** - * Clean up - */ - public function __destruct() { - $this->set_iri(null, true); - $this->set_path(null, true); - $this->set_authority(null, true); - } - - /** - * Create a new IRI object by resolving a relative IRI - * - * Returns false if $base is not absolute, otherwise an IRI. - * - * @param IRI|string $base (Absolute) Base IRI - * @param IRI|string $relative Relative IRI - * @return IRI|false - */ - public static function absolutize($base, $relative) - { - if (!($relative instanceof SimplePie_IRI)) - { - $relative = new SimplePie_IRI($relative); - } - if (!$relative->is_valid()) - { - return false; - } - elseif ($relative->scheme !== null) - { - return clone $relative; - } - else - { - if (!($base instanceof SimplePie_IRI)) - { - $base = new SimplePie_IRI($base); - } - if ($base->scheme !== null && $base->is_valid()) - { - if ($relative->get_iri() !== '') - { - if ($relative->iuserinfo !== null || $relative->ihost !== null || $relative->port !== null) - { - $target = clone $relative; - $target->scheme = $base->scheme; - } - else - { - $target = new SimplePie_IRI; - $target->scheme = $base->scheme; - $target->iuserinfo = $base->iuserinfo; - $target->ihost = $base->ihost; - $target->port = $base->port; - if ($relative->ipath !== '') - { - if ($relative->ipath[0] === '/') - { - $target->ipath = $relative->ipath; - } - elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') - { - $target->ipath = '/' . $relative->ipath; - } - elseif (($last_segment = strrpos($base->ipath, '/')) !== false) - { - $target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath; - } - else - { - $target->ipath = $relative->ipath; - } - $target->ipath = $target->remove_dot_segments($target->ipath); - $target->iquery = $relative->iquery; - } - else - { - $target->ipath = $base->ipath; - if ($relative->iquery !== null) - { - $target->iquery = $relative->iquery; - } - elseif ($base->iquery !== null) - { - $target->iquery = $base->iquery; - } - } - $target->ifragment = $relative->ifragment; - } - } - else - { - $target = clone $base; - $target->ifragment = null; - } - $target->scheme_normalization(); - return $target; - } - else - { - return false; - } - } - } - - /** - * Parse an IRI into scheme/authority/path/query/fragment segments - * - * @param string $iri - * @return array - */ - protected function parse_iri($iri) - { - $iri = trim($iri, "\x20\x09\x0A\x0C\x0D"); - if (preg_match('/^((?P<scheme>[^:\/?#]+):)?(\/\/(?P<authority>[^\/?#]*))?(?P<path>[^?#]*)(\?(?P<query>[^#]*))?(#(?P<fragment>.*))?$/', $iri, $match)) - { - if ($match[1] === '') - { - $match['scheme'] = null; - } - if (!isset($match[3]) || $match[3] === '') - { - $match['authority'] = null; - } - if (!isset($match[5])) - { - $match['path'] = ''; - } - if (!isset($match[6]) || $match[6] === '') - { - $match['query'] = null; - } - if (!isset($match[8]) || $match[8] === '') - { - $match['fragment'] = null; - } - return $match; - } - else - { - // This can occur when a paragraph is accidentally parsed as a URI - return false; - } - } - - /** - * Remove dot segments from a path - * - * @param string $input - * @return string - */ - protected function remove_dot_segments($input) - { - $output = ''; - while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') - { - // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise, - if (strpos($input, '../') === 0) - { - $input = substr($input, 3); - } - elseif (strpos($input, './') === 0) - { - $input = substr($input, 2); - } - // B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise, - elseif (strpos($input, '/./') === 0) - { - $input = substr($input, 2); - } - elseif ($input === '/.') - { - $input = '/'; - } - // C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise, - elseif (strpos($input, '/../') === 0) - { - $input = substr($input, 3); - $output = substr_replace($output, '', strrpos($output, '/')); - } - elseif ($input === '/..') - { - $input = '/'; - $output = substr_replace($output, '', strrpos($output, '/')); - } - // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise, - elseif ($input === '.' || $input === '..') - { - $input = ''; - } - // E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer - elseif (($pos = strpos($input, '/', 1)) !== false) - { - $output .= substr($input, 0, $pos); - $input = substr_replace($input, '', 0, $pos); - } - else - { - $output .= $input; - $input = ''; - } - } - return $output . $input; - } - - /** - * Replace invalid character with percent encoding - * - * @param string $string Input string - * @param string $extra_chars Valid characters not in iunreserved or - * iprivate (this is ASCII-only) - * @param bool $iprivate Allow iprivate - * @return string - */ - protected function replace_invalid_with_pct_encoding($string, $extra_chars, $iprivate = false) - { - // Normalize as many pct-encoded sections as possible - $string = preg_replace_callback('/(?:%[A-Fa-f0-9]{2})+/', array($this, 'remove_iunreserved_percent_encoded'), $string); - - // Replace invalid percent characters - $string = preg_replace('/%(?![A-Fa-f0-9]{2})/', '%25', $string); - - // Add unreserved and % to $extra_chars (the latter is safe because all - // pct-encoded sections are now valid). - $extra_chars .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~%'; - - // Now replace any bytes that aren't allowed with their pct-encoded versions - $position = 0; - $strlen = strlen($string); - while (($position += strspn($string, $extra_chars, $position)) < $strlen) - { - $value = ord($string[$position]); - - // Start position - $start = $position; - - // By default we are valid - $valid = true; - - // No one byte sequences are valid due to the while. - // Two byte sequence: - if (($value & 0xE0) === 0xC0) - { - $character = ($value & 0x1F) << 6; - $length = 2; - $remaining = 1; - } - // Three byte sequence: - elseif (($value & 0xF0) === 0xE0) - { - $character = ($value & 0x0F) << 12; - $length = 3; - $remaining = 2; - } - // Four byte sequence: - elseif (($value & 0xF8) === 0xF0) - { - $character = ($value & 0x07) << 18; - $length = 4; - $remaining = 3; - } - // Invalid byte: - else - { - $valid = false; - $length = 1; - $remaining = 0; - } - - if ($remaining) - { - if ($position + $length <= $strlen) - { - for ($position++; $remaining; $position++) - { - $value = ord($string[$position]); - - // Check that the byte is valid, then add it to the character: - if (($value & 0xC0) === 0x80) - { - $character |= ($value & 0x3F) << (--$remaining * 6); - } - // If it is invalid, count the sequence as invalid and reprocess the current byte: - else - { - $valid = false; - $position--; - break; - } - } - } - else - { - $position = $strlen - 1; - $valid = false; - } - } - - // Percent encode anything invalid or not in ucschar - if ( - // Invalid sequences - !$valid - // Non-shortest form sequences are invalid - || $length > 1 && $character <= 0x7F - || $length > 2 && $character <= 0x7FF - || $length > 3 && $character <= 0xFFFF - // Outside of range of ucschar codepoints - // Noncharacters - || ($character & 0xFFFE) === 0xFFFE - || $character >= 0xFDD0 && $character <= 0xFDEF - || ( - // Everything else not in ucschar - $character > 0xD7FF && $character < 0xF900 - || $character < 0xA0 - || $character > 0xEFFFD - ) - && ( - // Everything not in iprivate, if it applies - !$iprivate - || $character < 0xE000 - || $character > 0x10FFFD - ) - ) - { - // If we were a character, pretend we weren't, but rather an error. - if ($valid) - $position--; - - for ($j = $start; $j <= $position; $j++) - { - $string = substr_replace($string, sprintf('%%%02X', ord($string[$j])), $j, 1); - $j += 2; - $position += 2; - $strlen += 2; - } - } - } - - return $string; - } - - /** - * Callback function for preg_replace_callback. - * - * Removes sequences of percent encoded bytes that represent UTF-8 - * encoded characters in iunreserved - * - * @param array $match PCRE match - * @return string Replacement - */ - protected function remove_iunreserved_percent_encoded($match) - { - // As we just have valid percent encoded sequences we can just explode - // and ignore the first member of the returned array (an empty string). - $bytes = explode('%', $match[0]); - - // Initialize the new string (this is what will be returned) and that - // there are no bytes remaining in the current sequence (unsurprising - // at the first byte!). - $string = ''; - $remaining = 0; - - // Loop over each and every byte, and set $value to its value - for ($i = 1, $len = count($bytes); $i < $len; $i++) - { - $value = hexdec($bytes[$i]); - - // If we're the first byte of sequence: - if (!$remaining) - { - // Start position - $start = $i; - - // By default we are valid - $valid = true; - - // One byte sequence: - if ($value <= 0x7F) - { - $character = $value; - $length = 1; - } - // Two byte sequence: - elseif (($value & 0xE0) === 0xC0) - { - $character = ($value & 0x1F) << 6; - $length = 2; - $remaining = 1; - } - // Three byte sequence: - elseif (($value & 0xF0) === 0xE0) - { - $character = ($value & 0x0F) << 12; - $length = 3; - $remaining = 2; - } - // Four byte sequence: - elseif (($value & 0xF8) === 0xF0) - { - $character = ($value & 0x07) << 18; - $length = 4; - $remaining = 3; - } - // Invalid byte: - else - { - $valid = false; - $remaining = 0; - } - } - // Continuation byte: - else - { - // Check that the byte is valid, then add it to the character: - if (($value & 0xC0) === 0x80) - { - $remaining--; - $character |= ($value & 0x3F) << ($remaining * 6); - } - // If it is invalid, count the sequence as invalid and reprocess the current byte as the start of a sequence: - else - { - $valid = false; - $remaining = 0; - $i--; - } - } - - // If we've reached the end of the current byte sequence, append it to Unicode::$data - if (!$remaining) - { - // Percent encode anything invalid or not in iunreserved - if ( - // Invalid sequences - !$valid - // Non-shortest form sequences are invalid - || $length > 1 && $character <= 0x7F - || $length > 2 && $character <= 0x7FF - || $length > 3 && $character <= 0xFFFF - // Outside of range of iunreserved codepoints - || $character < 0x2D - || $character > 0xEFFFD - // Noncharacters - || ($character & 0xFFFE) === 0xFFFE - || $character >= 0xFDD0 && $character <= 0xFDEF - // Everything else not in iunreserved (this is all BMP) - || $character === 0x2F - || $character > 0x39 && $character < 0x41 - || $character > 0x5A && $character < 0x61 - || $character > 0x7A && $character < 0x7E - || $character > 0x7E && $character < 0xA0 - || $character > 0xD7FF && $character < 0xF900 - ) - { - for ($j = $start; $j <= $i; $j++) - { - $string .= '%' . strtoupper($bytes[$j]); - } - } - else - { - for ($j = $start; $j <= $i; $j++) - { - $string .= chr(hexdec($bytes[$j])); - } - } - } - } - - // If we have any bytes left over they are invalid (i.e., we are - // mid-way through a multi-byte sequence) - if ($remaining) - { - for ($j = $start; $j < $len; $j++) - { - $string .= '%' . strtoupper($bytes[$j]); - } - } - - return $string; - } - - protected function scheme_normalization() - { - if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo']) - { - $this->iuserinfo = null; - } - if (isset($this->normalization[$this->scheme]['ihost']) && $this->ihost === $this->normalization[$this->scheme]['ihost']) - { - $this->ihost = null; - } - if (isset($this->normalization[$this->scheme]['port']) && $this->port === $this->normalization[$this->scheme]['port']) - { - $this->port = null; - } - if (isset($this->normalization[$this->scheme]['ipath']) && $this->ipath === $this->normalization[$this->scheme]['ipath']) - { - $this->ipath = ''; - } - if (isset($this->normalization[$this->scheme]['iquery']) && $this->iquery === $this->normalization[$this->scheme]['iquery']) - { - $this->iquery = null; - } - if (isset($this->normalization[$this->scheme]['ifragment']) && $this->ifragment === $this->normalization[$this->scheme]['ifragment']) - { - $this->ifragment = null; - } - } - - /** - * Check if the object represents a valid IRI. This needs to be done on each - * call as some things change depending on another part of the IRI. - * - * @return bool - */ - public function is_valid() - { - if ($this->ipath === '') return true; - - $isauthority = $this->iuserinfo !== null || $this->ihost !== null || - $this->port !== null; - if ($isauthority && $this->ipath[0] === '/') return true; - - if (!$isauthority && (substr($this->ipath, 0, 2) === '//')) return false; - - // Relative urls cannot have a colon in the first path segment (and the - // slashes themselves are not included so skip the first character). - if (!$this->scheme && !$isauthority && - strpos($this->ipath, ':') !== false && - strpos($this->ipath, '/', 1) !== false && - strpos($this->ipath, ':') < strpos($this->ipath, '/', 1)) return false; - - return true; - } - - /** - * Set the entire IRI. Returns true on success, false on failure (if there - * are any invalid characters). - * - * @param string $iri - * @return bool - */ - public function set_iri($iri, $clear_cache = false) - { - static $cache; - if ($clear_cache) - { - $cache = null; - return; - } - if (!$cache) - { - $cache = array(); - } - - if ($iri === null) - { - return true; - } - elseif (isset($cache[$iri])) - { - list($this->scheme, - $this->iuserinfo, - $this->ihost, - $this->port, - $this->ipath, - $this->iquery, - $this->ifragment, - $return) = $cache[$iri]; - return $return; - } - else - { - $parsed = $this->parse_iri((string) $iri); - if (!$parsed) - { - return false; - } - - $return = $this->set_scheme($parsed['scheme']) - && $this->set_authority($parsed['authority']) - && $this->set_path($parsed['path']) - && $this->set_query($parsed['query']) - && $this->set_fragment($parsed['fragment']); - - $cache[$iri] = array($this->scheme, - $this->iuserinfo, - $this->ihost, - $this->port, - $this->ipath, - $this->iquery, - $this->ifragment, - $return); - return $return; - } - } - - /** - * Set the scheme. Returns true on success, false on failure (if there are - * any invalid characters). - * - * @param string $scheme - * @return bool - */ - public function set_scheme($scheme) - { - if ($scheme === null) - { - $this->scheme = null; - } - elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) - { - $this->scheme = null; - return false; - } - else - { - $this->scheme = strtolower($scheme); - } - return true; - } - - /** - * Set the authority. Returns true on success, false on failure (if there are - * any invalid characters). - * - * @param string $authority - * @return bool - */ - public function set_authority($authority, $clear_cache = false) - { - static $cache; - if ($clear_cache) - { - $cache = null; - return; - } - if (!$cache) - $cache = array(); - - if ($authority === null) - { - $this->iuserinfo = null; - $this->ihost = null; - $this->port = null; - return true; - } - elseif (isset($cache[$authority])) - { - list($this->iuserinfo, - $this->ihost, - $this->port, - $return) = $cache[$authority]; - - return $return; - } - else - { - $remaining = $authority; - if (($iuserinfo_end = strrpos($remaining, '@')) !== false) - { - $iuserinfo = substr($remaining, 0, $iuserinfo_end); - $remaining = substr($remaining, $iuserinfo_end + 1); - } - else - { - $iuserinfo = null; - } - if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false) - { - if (($port = substr($remaining, $port_start + 1)) === false) - { - $port = null; - } - $remaining = substr($remaining, 0, $port_start); - } - else - { - $port = null; - } - - $return = $this->set_userinfo($iuserinfo) && - $this->set_host($remaining) && - $this->set_port($port); - - $cache[$authority] = array($this->iuserinfo, - $this->ihost, - $this->port, - $return); - - return $return; - } - } - - /** - * Set the iuserinfo. - * - * @param string $iuserinfo - * @return bool - */ - public function set_userinfo($iuserinfo) - { - if ($iuserinfo === null) - { - $this->iuserinfo = null; - } - else - { - $this->iuserinfo = $this->replace_invalid_with_pct_encoding($iuserinfo, '!$&\'()*+,;=:'); - $this->scheme_normalization(); - } - - return true; - } - - /** - * Set the ihost. Returns true on success, false on failure (if there are - * any invalid characters). - * - * @param string $ihost - * @return bool - */ - public function set_host($ihost) - { - if ($ihost === null) - { - $this->ihost = null; - return true; - } - elseif (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']') - { - if (SimplePie_Net_IPv6::check_ipv6(substr($ihost, 1, -1))) - { - $this->ihost = '[' . SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)) . ']'; - } - else - { - $this->ihost = null; - return false; - } - } - else - { - $ihost = $this->replace_invalid_with_pct_encoding($ihost, '!$&\'()*+,;='); - - // Lowercase, but ignore pct-encoded sections (as they should - // remain uppercase). This must be done after the previous step - // as that can add unescaped characters. - $position = 0; - $strlen = strlen($ihost); - while (($position += strcspn($ihost, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ%', $position)) < $strlen) - { - if ($ihost[$position] === '%') - { - $position += 3; - } - else - { - $ihost[$position] = strtolower($ihost[$position]); - $position++; - } - } - - $this->ihost = $ihost; - } - - $this->scheme_normalization(); - - return true; - } - - /** - * Set the port. Returns true on success, false on failure (if there are - * any invalid characters). - * - * @param string $port - * @return bool - */ - public function set_port($port) - { - if ($port === null) - { - $this->port = null; - return true; - } - elseif (strspn($port, '0123456789') === strlen($port)) - { - $this->port = (int) $port; - $this->scheme_normalization(); - return true; - } - else - { - $this->port = null; - return false; - } - } - - /** - * Set the ipath. - * - * @param string $ipath - * @return bool - */ - public function set_path($ipath, $clear_cache = false) - { - static $cache; - if ($clear_cache) - { - $cache = null; - return; - } - if (!$cache) - { - $cache = array(); - } - - $ipath = (string) $ipath; - - if (isset($cache[$ipath])) - { - $this->ipath = $cache[$ipath][(int) ($this->scheme !== null)]; - } - else - { - $valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/'); - $removed = $this->remove_dot_segments($valid); - - $cache[$ipath] = array($valid, $removed); - $this->ipath = ($this->scheme !== null) ? $removed : $valid; - } - - $this->scheme_normalization(); - return true; - } - - /** - * Set the iquery. - * - * @param string $iquery - * @return bool - */ - public function set_query($iquery) - { - if ($iquery === null) - { - $this->iquery = null; - } - else - { - $this->iquery = $this->replace_invalid_with_pct_encoding($iquery, '!$&\'()*+,;=:@/?', true); - $this->scheme_normalization(); - } - return true; - } - - /** - * Set the ifragment. - * - * @param string $ifragment - * @return bool - */ - public function set_fragment($ifragment) - { - if ($ifragment === null) - { - $this->ifragment = null; - } - else - { - $this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?'); - $this->scheme_normalization(); - } - return true; - } - - /** - * Convert an IRI to a URI (or parts thereof) - * - * @return string - */ - public function to_uri($string) - { - static $non_ascii; - if (!$non_ascii) - { - $non_ascii = implode('', range("\x80", "\xFF")); - } - - $position = 0; - $strlen = strlen($string); - while (($position += strcspn($string, $non_ascii, $position)) < $strlen) - { - $string = substr_replace($string, sprintf('%%%02X', ord($string[$position])), $position, 1); - $position += 3; - $strlen += 2; - } - - return $string; - } - - /** - * Get the complete IRI - * - * @return string - */ - public function get_iri() - { - if (!$this->is_valid()) - { - return false; - } - - $iri = ''; - if ($this->scheme !== null) - { - $iri .= $this->scheme . ':'; - } - if (($iauthority = $this->get_iauthority()) !== null) - { - $iri .= '//' . $iauthority; - } - if ($this->ipath !== '') - { - $iri .= $this->ipath; - } - elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '') - { - $iri .= $this->normalization[$this->scheme]['ipath']; - } - if ($this->iquery !== null) - { - $iri .= '?' . $this->iquery; - } - if ($this->ifragment !== null) - { - $iri .= '#' . $this->ifragment; - } - - return $iri; - } - - /** - * Get the complete URI - * - * @return string - */ - public function get_uri() - { - return $this->to_uri($this->get_iri()); - } - - /** - * Get the complete iauthority - * - * @return string - */ - protected function get_iauthority() - { - if ($this->iuserinfo !== null || $this->ihost !== null || $this->port !== null) - { - $iauthority = ''; - if ($this->iuserinfo !== null) - { - $iauthority .= $this->iuserinfo . '@'; - } - if ($this->ihost !== null) - { - $iauthority .= $this->ihost; - } - if ($this->port !== null) - { - $iauthority .= ':' . $this->port; - } - return $iauthority; - } - else - { - return null; - } - } - - /** - * Get the complete authority - * - * @return string - */ - protected function get_authority() - { - $iauthority = $this->get_iauthority(); - if (is_string($iauthority)) - return $this->to_uri($iauthority); - else - return $iauthority; - } -}
@@ -1,2977 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - - -/** - * Manages all item-related data - * - * Used by {@see SimplePie::get_item()} and {@see SimplePie::get_items()} - * - * This class can be overloaded with {@see SimplePie::set_item_class()} - * - * @package SimplePie - * @subpackage API - */ -class SimplePie_Item -{ - /** - * Parent feed - * - * @access private - * @var SimplePie - */ - var $feed; - - /** - * Raw data - * - * @access private - * @var array - */ - var $data = array(); - - /** - * Registry object - * - * @see set_registry - * @var SimplePie_Registry - */ - protected $registry; - - /** - * Create a new item object - * - * This is usually used by {@see SimplePie::get_items} and - * {@see SimplePie::get_item}. Avoid creating this manually. - * - * @param SimplePie $feed Parent feed - * @param array $data Raw data - */ - public function __construct($feed, $data) - { - $this->feed = $feed; - $this->data = $data; - } - - /** - * Set the registry handler - * - * This is usually used by {@see SimplePie_Registry::create} - * - * @since 1.3 - * @param SimplePie_Registry $registry - */ - public function set_registry(SimplePie_Registry $registry) - { - $this->registry = $registry; - } - - /** - * Get a string representation of the item - * - * @return string - */ - public function __toString() - { - return md5(serialize($this->data)); - } - - /** - * Remove items that link back to this before destroying this object - */ - public function __destruct() - { - if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) - { - unset($this->feed); - } - } - - /** - * Get data for an item-level element - * - * This method allows you to get access to ANY element/attribute that is a - * sub-element of the item/entry tag. - * - * See {@see SimplePie::get_feed_tags()} for a description of the return value - * - * @since 1.0 - * @see http://simplepie.org/wiki/faq/supported_xml_namespaces - * @param string $namespace The URL of the XML namespace of the elements you're trying to access - * @param string $tag Tag name - * @return array - */ - public function get_item_tags($namespace, $tag) - { - if (isset($this->data['child'][$namespace][$tag])) - { - return $this->data['child'][$namespace][$tag]; - } - else - { - return null; - } - } - - /** - * Get the base URL value from the parent feed - * - * Uses `<xml:base>` - * - * @param array $element - * @return string - */ - public function get_base($element = array()) - { - return $this->feed->get_base($element); - } - - /** - * Sanitize feed data - * - * @access private - * @see SimplePie::sanitize() - * @param string $data Data to sanitize - * @param int $type One of the SIMPLEPIE_CONSTRUCT_* constants - * @param string $base Base URL to resolve URLs against - * @return string Sanitized data - */ - public function sanitize($data, $type, $base = '') - { - return $this->feed->sanitize($data, $type, $base); - } - - /** - * Get the parent feed - * - * Note: this may not work as you think for multifeeds! - * - * @link http://simplepie.org/faq/typical_multifeed_gotchas#missing_data_from_feed - * @since 1.0 - * @return SimplePie - */ - public function get_feed() - { - return $this->feed; - } - - /** - * Get the unique identifier for the item - * - * This is usually used when writing code to check for new items in a feed. - * - * Uses `<atom:id>`, `<guid>`, `<dc:identifier>` or the `about` attribute - * for RDF. If none of these are supplied (or `$hash` is true), creates an - * MD5 hash based on the permalink, title and content. - * - * @since Beta 2 - * @param boolean $hash Should we force using a hash instead of the supplied ID? - * @return string - */ - public function get_id($hash = false, $fn = '') - { - if (!$hash) - { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif (isset($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about'])) - { - return $this->sanitize($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about'], SIMPLEPIE_CONSTRUCT_TEXT); - } - } - if ($fn === '' || !is_callable($fn)) $fn = 'md5'; - return call_user_func($fn, - $this->get_permalink().$this->get_title().$this->get_content()); - } - - /** - * Get the title of the item - * - * Uses `<atom:title>`, `<title>` or `<dc:title>` - * - * @since Beta 2 (previously called `get_item_title` since 0.8) - * @return string|null - */ - public function get_title() - { - if (!isset($this->data['title'])) - { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) - { - $this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) - { - $this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) - { - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) - { - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) - { - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) - { - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) - { - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $this->data['title'] = null; - } - } - return $this->data['title']; - } - - /** - * Get the content for the item - * - * Prefers summaries over full content , but will return full content if a - * summary does not exist. - * - * To prefer full content instead, use {@see get_content} - * - * Uses `<atom:summary>`, `<description>`, `<dc:description>` or - * `<itunes:subtitle>` - * - * @since 0.8 - * @param boolean $description_only Should we avoid falling back to the content? - * @return string|null - */ - public function get_description($description_only = false) - { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML); - } - - elseif (!$description_only) - { - return $this->get_content(true); - } - else - { - return null; - } - } - - /** - * Get the content for the item - * - * Prefers full content over summaries, but will return a summary if full - * content does not exist. - * - * To prefer summaries instead, use {@see get_description} - * - * Uses `<atom:content>` or `<content:encoded>` (RSS 1.0 Content Module) - * - * @since 1.0 - * @param boolean $content_only Should we avoid falling back to the description? - * @return string|null - */ - public function get_content($content_only = false) - { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); - } - elseif (!$content_only) - { - return $this->get_description(true); - } - else - { - return null; - } - } - - /** - * Get the media:thumbnail of the item - * - * Uses `<media:thumbnail>` - * - * - * @return array|null - */ - public function get_thumbnail() - { - if (!isset($this->data['thumbnail'])) - { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail')) - { - $this->data['thumbnail'] = $return[0]['attribs']['']; - } - else - { - $this->data['thumbnail'] = null; - } - } - return $this->data['thumbnail']; - } - - /** - * Get a category for the item - * - * @since Beta 3 (previously called `get_categories()` since Beta 2) - * @param int $key The category that you want to return. Remember that arrays begin with 0, not 1 - * @return SimplePie_Category|null - */ - public function get_category($key = 0) - { - $categories = $this->get_categories(); - if (isset($categories[$key])) - { - return $categories[$key]; - } - else - { - return null; - } - } - - /** - * Get all categories for the item - * - * Uses `<atom:category>`, `<category>` or `<dc:subject>` - * - * @since Beta 3 - * @return SimplePie_Category[]|null List of {@see SimplePie_Category} objects - */ - public function get_categories() - { - $categories = array(); - - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) - { - $term = null; - $scheme = null; - $label = null; - if (isset($category['attribs']['']['term'])) - { - $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_HTML); - } - if (isset($category['attribs']['']['scheme'])) - { - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_HTML); - } - if (isset($category['attribs']['']['label'])) - { - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_HTML); - } - $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); - } - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) - { - // This is really the label, but keep this as the term also for BC. - // Label will also work on retrieving because that falls back to term. - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_HTML); - if (isset($category['attribs']['']['domain'])) - { - $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_HTML); - } - else - { - $scheme = null; - } - $categories[] = $this->registry->create('Category', array($term, $scheme, null)); - } - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) - { - $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null)); - } - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) - { - $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null)); - } - - if (!empty($categories)) - { - return array_unique($categories); - } - else - { - return null; - } - } - - /** - * Get an author for the item - * - * @since Beta 2 - * @param int $key The author that you want to return. Remember that arrays begin with 0, not 1 - * @return SimplePie_Author|null - */ - public function get_author($key = 0) - { - $authors = $this->get_authors(); - if (isset($authors[$key])) - { - return $authors[$key]; - } - else - { - return null; - } - } - - /** - * Get a contributor for the item - * - * @since 1.1 - * @param int $key The contrbutor that you want to return. Remember that arrays begin with 0, not 1 - * @return SimplePie_Author|null - */ - public function get_contributor($key = 0) - { - $contributors = $this->get_contributors(); - if (isset($contributors[$key])) - { - return $contributors[$key]; - } - else - { - return null; - } - } - - /** - * Get all contributors for the item - * - * Uses `<atom:contributor>` - * - * @since 1.1 - * @return array|null List of {@see SimplePie_Author} objects - */ - public function get_contributors() - { - $contributors = array(); - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) - { - $name = null; - $uri = null; - $email = null; - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) - { - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) - { - $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); - } - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) - { - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if ($name !== null || $email !== null || $uri !== null) - { - $contributors[] = $this->registry->create('Author', array($name, $uri, $email)); - } - } - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) - { - $name = null; - $url = null; - $email = null; - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) - { - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) - { - $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); - } - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) - { - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if ($name !== null || $email !== null || $url !== null) - { - $contributors[] = $this->registry->create('Author', array($name, $url, $email)); - } - } - - if (!empty($contributors)) - { - return array_unique($contributors); - } - else - { - return null; - } - } - - /** - * Get all authors for the item - * - * Uses `<atom:author>`, `<author>`, `<dc:creator>` or `<itunes:author>` - * - * @since Beta 2 - * @return array|null List of {@see SimplePie_Author} objects - */ - public function get_authors() - { - $authors = array(); - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) - { - $name = null; - $uri = null; - $email = null; - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) - { - $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML); - } - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) - { - $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); - } - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) - { - $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML); - } - if ($name !== null || $email !== null || $uri !== null) - { - $authors[] = $this->registry->create('Author', array($name, $uri, $email)); - } - } - if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) - { - $name = null; - $url = null; - $email = null; - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) - { - $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML); - } - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) - { - $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); - } - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) - { - $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML); - } - if ($name !== null || $email !== null || $url !== null) - { - $authors[] = $this->registry->create('Author', array($name, $url, $email)); - } - } - if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author')) - { - $authors[] = $this->registry->create('Author', array(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_HTML))); - } - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) - { - $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null)); - } - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) - { - $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null)); - } - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) - { - $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null)); - } - - if (!empty($authors)) - { - return array_unique($authors); - } - elseif (($source = $this->get_source()) && ($authors = $source->get_authors())) - { - return $authors; - } - elseif ($authors = $this->feed->get_authors()) - { - return $authors; - } - else - { - return null; - } - } - - /** - * Get the copyright info for the item - * - * Uses `<atom:rights>` or `<dc:rights>` - * - * @since 1.1 - * @return string - */ - public function get_copyright() - { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - return null; - } - } - - /** - * Get the posting date/time for the item - * - * Uses `<atom:published>`, `<atom:updated>`, `<atom:issued>`, - * `<atom:modified>`, `<pubDate>` or `<dc:date>` - * - * Note: obeys PHP's timezone setting. To get a UTC date/time, use - * {@see get_gmdate} - * - * @since Beta 2 (previously called `get_item_date` since 0.8) - * - * @param string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data) - * @return int|string|null - */ - public function get_date($date_format = 'j F Y, g:i a') - { - if (!isset($this->data['date'])) - { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published')) - { - $this->data['date']['raw'] = $return[0]['data']; - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate')) - { - $this->data['date']['raw'] = $return[0]['data']; - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date')) - { - $this->data['date']['raw'] = $return[0]['data']; - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date')) - { - $this->data['date']['raw'] = $return[0]['data']; - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated')) - { - $this->data['date']['raw'] = $return[0]['data']; - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued')) - { - $this->data['date']['raw'] = $return[0]['data']; - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created')) - { - $this->data['date']['raw'] = $return[0]['data']; - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified')) - { - $this->data['date']['raw'] = $return[0]['data']; - } - - if (!empty($this->data['date']['raw'])) - { - $parser = $this->registry->call('Parse_Date', 'get'); - $this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']); - } - else - { - $this->data['date'] = null; - } - } - if ($this->data['date']) - { - $date_format = (string) $date_format; - switch ($date_format) - { - case '': - return $this->sanitize($this->data['date']['raw'], SIMPLEPIE_CONSTRUCT_TEXT); - - case 'U': - return $this->data['date']['parsed']; - - default: - return date($date_format, $this->data['date']['parsed']); - } - } - else - { - return null; - } - } - - /** - * Get the update date/time for the item - * - * Uses `<atom:updated>` - * - * Note: obeys PHP's timezone setting. To get a UTC date/time, use - * {@see get_gmdate} - * - * @param string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data) - * @return int|string|null - */ - public function get_updated_date($date_format = 'j F Y, g:i a') - { - if (!isset($this->data['updated'])) - { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated')) - { - $this->data['updated']['raw'] = $return[0]['data']; - } - - if (!empty($this->data['updated']['raw'])) - { - $parser = $this->registry->call('Parse_Date', 'get'); - $this->data['updated']['parsed'] = $parser->parse($this->data['updated']['raw']); - } - else - { - $this->data['updated'] = null; - } - } - if ($this->data['updated']) - { - $date_format = (string) $date_format; - switch ($date_format) - { - case '': - return $this->sanitize($this->data['updated']['raw'], SIMPLEPIE_CONSTRUCT_TEXT); - - case 'U': - return $this->data['updated']['parsed']; - - default: - return date($date_format, $this->data['updated']['parsed']); - } - } - else - { - return null; - } - } - - /** - * Get the localized posting date/time for the item - * - * Returns the date formatted in the localized language. To display in - * languages other than the server's default, you need to change the locale - * with {@link http://php.net/setlocale setlocale()}. The available - * localizations depend on which ones are installed on your web server. - * - * @since 1.0 - * - * @param string $date_format Supports any PHP date format from {@see http://php.net/strftime} (empty for the raw data) - * @return int|string|null - */ - public function get_local_date($date_format = '%c') - { - if (!$date_format) - { - return $this->sanitize($this->get_date(''), SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif (($date = $this->get_date('U')) !== null && $date !== false) - { - return strftime($date_format, $date); - } - else - { - return null; - } - } - - /** - * Get the posting date/time for the item (UTC time) - * - * @see get_date - * @param string $date_format Supports any PHP date format from {@see http://php.net/date} - * @return int|string|null - */ - public function get_gmdate($date_format = 'j F Y, g:i a') - { - $date = $this->get_date('U'); - if ($date === null) - { - return null; - } - - return gmdate($date_format, $date); - } - - /** - * Get the update date/time for the item (UTC time) - * - * @see get_updated_date - * @param string $date_format Supports any PHP date format from {@see http://php.net/date} - * @return int|string|null - */ - public function get_updated_gmdate($date_format = 'j F Y, g:i a') - { - $date = $this->get_updated_date('U'); - if ($date === null) - { - return null; - } - - return gmdate($date_format, $date); - } - - /** - * Get the permalink for the item - * - * Returns the first link available with a relationship of "alternate". - * Identical to {@see get_link()} with key 0 - * - * @see get_link - * @since 0.8 - * @return string|null Permalink URL - */ - public function get_permalink() - { - $link = $this->get_link(); - $enclosure = $this->get_enclosure(0); - if ($link !== null) - { - return $link; - } - elseif ($enclosure !== null) - { - return $enclosure->get_link(); - } - else - { - return null; - } - } - - /** - * Get a single link for the item - * - * @since Beta 3 - * @param int $key The link that you want to return. Remember that arrays begin with 0, not 1 - * @param string $rel The relationship of the link to return - * @return string|null Link URL - */ - public function get_link($key = 0, $rel = 'alternate') - { - $links = $this->get_links($rel); - if ($links[$key] !== null) - { - return $links[$key]; - } - else - { - return null; - } - } - - /** - * Get all links for the item - * - * Uses `<atom:link>`, `<link>` or `<guid>` - * - * @since Beta 2 - * @param string $rel The relationship of links to return - * @return array|null Links found for the item (strings) - */ - public function get_links($rel = 'alternate') - { - if (!isset($this->data['links'])) - { - $this->data['links'] = array(); - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link) - { - if (isset($link['attribs']['']['href'])) - { - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); - - } - } - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link) - { - if (isset($link['attribs']['']['href'])) - { - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); - } - } - if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) - { - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); - } - if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) - { - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); - } - if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) - { - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); - } - if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) - { - if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true') - { - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); - } - } - - $keys = array_keys($this->data['links']); - foreach ($keys as $key) - { - if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key))) - { - if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) - { - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); - $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; - } - else - { - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; - } - } - elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) - { - $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; - } - $this->data['links'][$key] = array_unique($this->data['links'][$key]); - } - } - if (isset($this->data['links'][$rel])) - { - return $this->data['links'][$rel]; - } - else - { - return null; - } - } - - /** - * Get an enclosure from the item - * - * Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS. - * - * @since Beta 2 - * @todo Add ability to prefer one type of content over another (in a media group). - * @param int $key The enclosure that you want to return. Remember that arrays begin with 0, not 1 - * @return SimplePie_Enclosure|null - */ - public function get_enclosure($key = 0, $prefer = null) - { - $enclosures = $this->get_enclosures(); - if (isset($enclosures[$key])) - { - return $enclosures[$key]; - } - else - { - return null; - } - } - - /** - * Get all available enclosures (podcasts, etc.) - * - * Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS. - * - * At this point, we're pretty much assuming that all enclosures for an item - * are the same content. Anything else is too complicated to - * properly support. - * - * @since Beta 2 - * @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4). - * @todo If an element exists at a level, but its value is empty, we should fall back to the value from the parent (if it exists). - * @return SimplePie_Enclosure[]|null List of SimplePie_Enclosure items - */ - public function get_enclosures() - { - if (!isset($this->data['enclosures'])) - { - $this->data['enclosures'] = array(); - - // Elements - $captions_parent = null; - $categories_parent = null; - $copyrights_parent = null; - $credits_parent = null; - $description_parent = null; - $duration_parent = null; - $hashes_parent = null; - $keywords_parent = null; - $player_parent = null; - $ratings_parent = null; - $restrictions_parent = null; - $thumbnails_parent = null; - $title_parent = null; - - // Let's do the channel and item-level ones first, and just re-use them if we need to. - $parent = $this->get_feed(); - - // CAPTIONS - if ($captions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) - { - foreach ($captions as $caption) - { - $caption_type = null; - $caption_lang = null; - $caption_startTime = null; - $caption_endTime = null; - $caption_text = null; - if (isset($caption['attribs']['']['type'])) - { - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['lang'])) - { - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['start'])) - { - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['end'])) - { - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['data'])) - { - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $captions_parent[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text)); - } - } - elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) - { - foreach ($captions as $caption) - { - $caption_type = null; - $caption_lang = null; - $caption_startTime = null; - $caption_endTime = null; - $caption_text = null; - if (isset($caption['attribs']['']['type'])) - { - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['lang'])) - { - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['start'])) - { - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['end'])) - { - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['data'])) - { - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $captions_parent[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text)); - } - } - if (is_array($captions_parent)) - { - $captions_parent = array_values(array_unique($captions_parent)); - } - - // CATEGORIES - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category) - { - $term = null; - $scheme = null; - $label = null; - if (isset($category['data'])) - { - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($category['attribs']['']['scheme'])) - { - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $scheme = 'http://search.yahoo.com/mrss/category_schema'; - } - if (isset($category['attribs']['']['label'])) - { - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $categories_parent[] = $this->registry->create('Category', array($term, $scheme, $label)); - } - foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category) - { - $term = null; - $scheme = null; - $label = null; - if (isset($category['data'])) - { - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($category['attribs']['']['scheme'])) - { - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $scheme = 'http://search.yahoo.com/mrss/category_schema'; - } - if (isset($category['attribs']['']['label'])) - { - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $categories_parent[] = $this->registry->create('Category', array($term, $scheme, $label)); - } - foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'category') as $category) - { - $term = null; - $scheme = 'http://www.itunes.com/dtds/podcast-1.0.dtd'; - $label = null; - if (isset($category['attribs']['']['text'])) - { - $label = $this->sanitize($category['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $categories_parent[] = $this->registry->create('Category', array($term, $scheme, $label)); - - if (isset($category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'])) - { - foreach ((array) $category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'] as $subcategory) - { - if (isset($subcategory['attribs']['']['text'])) - { - $label = $this->sanitize($subcategory['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $categories_parent[] = $this->registry->create('Category', array($term, $scheme, $label)); - } - } - } - if (is_array($categories_parent)) - { - $categories_parent = array_values(array_unique($categories_parent)); - } - - // COPYRIGHT - if ($copyright = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright')) - { - $copyright_url = null; - $copyright_label = null; - if (isset($copyright[0]['attribs']['']['url'])) - { - $copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($copyright[0]['data'])) - { - $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $copyrights_parent = $this->registry->create('Copyright', array($copyright_url, $copyright_label)); - } - elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright')) - { - $copyright_url = null; - $copyright_label = null; - if (isset($copyright[0]['attribs']['']['url'])) - { - $copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($copyright[0]['data'])) - { - $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $copyrights_parent = $this->registry->create('Copyright', array($copyright_url, $copyright_label)); - } - - // CREDITS - if ($credits = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit')) - { - foreach ($credits as $credit) - { - $credit_role = null; - $credit_scheme = null; - $credit_name = null; - if (isset($credit['attribs']['']['role'])) - { - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($credit['attribs']['']['scheme'])) - { - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $credit_scheme = 'urn:ebu'; - } - if (isset($credit['data'])) - { - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $credits_parent[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name)); - } - } - elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit')) - { - foreach ($credits as $credit) - { - $credit_role = null; - $credit_scheme = null; - $credit_name = null; - if (isset($credit['attribs']['']['role'])) - { - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($credit['attribs']['']['scheme'])) - { - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $credit_scheme = 'urn:ebu'; - } - if (isset($credit['data'])) - { - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $credits_parent[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name)); - } - } - if (is_array($credits_parent)) - { - $credits_parent = array_values(array_unique($credits_parent)); - } - - // DESCRIPTION - if ($description_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description')) - { - if (isset($description_parent[0]['data'])) - { - $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - } - elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description')) - { - if (isset($description_parent[0]['data'])) - { - $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - } - - // DURATION - if ($duration_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'duration')) - { - $seconds = null; - $minutes = null; - $hours = null; - if (isset($duration_parent[0]['data'])) - { - $temp = explode(':', $this->sanitize($duration_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); - if (sizeof($temp) > 0) - { - $seconds = (int) array_pop($temp); - } - if (sizeof($temp) > 0) - { - $minutes = (int) array_pop($temp); - $seconds += $minutes * 60; - } - if (sizeof($temp) > 0) - { - $hours = (int) array_pop($temp); - $seconds += $hours * 3600; - } - unset($temp); - $duration_parent = $seconds; - } - } - - // HASHES - if ($hashes_iterator = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash')) - { - foreach ($hashes_iterator as $hash) - { - $value = null; - $algo = null; - if (isset($hash['data'])) - { - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($hash['attribs']['']['algo'])) - { - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $algo = 'md5'; - } - $hashes_parent[] = $algo.':'.$value; - } - } - elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash')) - { - foreach ($hashes_iterator as $hash) - { - $value = null; - $algo = null; - if (isset($hash['data'])) - { - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($hash['attribs']['']['algo'])) - { - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $algo = 'md5'; - } - $hashes_parent[] = $algo.':'.$value; - } - } - if (is_array($hashes_parent)) - { - $hashes_parent = array_values(array_unique($hashes_parent)); - } - - // KEYWORDS - if ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords')) - { - if (isset($keywords[0]['data'])) - { - $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); - foreach ($temp as $word) - { - $keywords_parent[] = trim($word); - } - } - unset($temp); - } - elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords')) - { - if (isset($keywords[0]['data'])) - { - $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); - foreach ($temp as $word) - { - $keywords_parent[] = trim($word); - } - } - unset($temp); - } - elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords')) - { - if (isset($keywords[0]['data'])) - { - $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); - foreach ($temp as $word) - { - $keywords_parent[] = trim($word); - } - } - unset($temp); - } - elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords')) - { - if (isset($keywords[0]['data'])) - { - $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); - foreach ($temp as $word) - { - $keywords_parent[] = trim($word); - } - } - unset($temp); - } - if (is_array($keywords_parent)) - { - $keywords_parent = array_values(array_unique($keywords_parent)); - } - - // PLAYER - if ($player_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player')) - { - if (isset($player_parent[0]['attribs']['']['url'])) - { - $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - } - elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player')) - { - if (isset($player_parent[0]['attribs']['']['url'])) - { - $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - } - - // RATINGS - if ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating')) - { - foreach ($ratings as $rating) - { - $rating_scheme = null; - $rating_value = null; - if (isset($rating['attribs']['']['scheme'])) - { - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $rating_scheme = 'urn:simple'; - } - if (isset($rating['data'])) - { - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value)); - } - } - elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) - { - foreach ($ratings as $rating) - { - $rating_scheme = 'urn:itunes'; - $rating_value = null; - if (isset($rating['data'])) - { - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value)); - } - } - elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating')) - { - foreach ($ratings as $rating) - { - $rating_scheme = null; - $rating_value = null; - if (isset($rating['attribs']['']['scheme'])) - { - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $rating_scheme = 'urn:simple'; - } - if (isset($rating['data'])) - { - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value)); - } - } - elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) - { - foreach ($ratings as $rating) - { - $rating_scheme = 'urn:itunes'; - $rating_value = null; - if (isset($rating['data'])) - { - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value)); - } - } - if (is_array($ratings_parent)) - { - $ratings_parent = array_values(array_unique($ratings_parent)); - } - - // RESTRICTIONS - if ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction')) - { - foreach ($restrictions as $restriction) - { - $restriction_relationship = null; - $restriction_type = null; - $restriction_value = null; - if (isset($restriction['attribs']['']['relationship'])) - { - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($restriction['attribs']['']['type'])) - { - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($restriction['data'])) - { - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value)); - } - } - elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) - { - foreach ($restrictions as $restriction) - { - $restriction_relationship = 'allow'; - $restriction_type = null; - $restriction_value = 'itunes'; - if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') - { - $restriction_relationship = 'deny'; - } - $restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value)); - } - } - elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction')) - { - foreach ($restrictions as $restriction) - { - $restriction_relationship = null; - $restriction_type = null; - $restriction_value = null; - if (isset($restriction['attribs']['']['relationship'])) - { - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($restriction['attribs']['']['type'])) - { - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($restriction['data'])) - { - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value)); - } - } - elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) - { - foreach ($restrictions as $restriction) - { - $restriction_relationship = 'allow'; - $restriction_type = null; - $restriction_value = 'itunes'; - if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') - { - $restriction_relationship = 'deny'; - } - $restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value)); - } - } - if (is_array($restrictions_parent)) - { - $restrictions_parent = array_values(array_unique($restrictions_parent)); - } - else - { - $restrictions_parent = array(new SimplePie_Restriction('allow', null, 'default')); - } - - // THUMBNAILS - if ($thumbnails = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail')) - { - foreach ($thumbnails as $thumbnail) - { - if (isset($thumbnail['attribs']['']['url'])) - { - $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - } - } - elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail')) - { - foreach ($thumbnails as $thumbnail) - { - if (isset($thumbnail['attribs']['']['url'])) - { - $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - } - } - - // TITLES - if ($title_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title')) - { - if (isset($title_parent[0]['data'])) - { - $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - } - elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title')) - { - if (isset($title_parent[0]['data'])) - { - $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - } - - // Clear the memory - unset($parent); - - // Attributes - $bitrate = null; - $channels = null; - $duration = null; - $expression = null; - $framerate = null; - $height = null; - $javascript = null; - $lang = null; - $length = null; - $medium = null; - $samplingrate = null; - $type = null; - $url = null; - $width = null; - - // Elements - $captions = null; - $categories = null; - $copyrights = null; - $credits = null; - $description = null; - $hashes = null; - $keywords = null; - $player = null; - $ratings = null; - $restrictions = null; - $thumbnails = null; - $title = null; - - // If we have media:group tags, loop through them. - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group) - { - if(isset($group['child']) && isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'])) - { - // If we have media:content tags, loop through them. - foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content) - { - if (isset($content['attribs']['']['url'])) - { - // Attributes - $bitrate = null; - $channels = null; - $duration = null; - $expression = null; - $framerate = null; - $height = null; - $javascript = null; - $lang = null; - $length = null; - $medium = null; - $samplingrate = null; - $type = null; - $url = null; - $width = null; - - // Elements - $captions = null; - $categories = null; - $copyrights = null; - $credits = null; - $description = null; - $hashes = null; - $keywords = null; - $player = null; - $ratings = null; - $restrictions = null; - $thumbnails = null; - $title = null; - - // Start checking the attributes of media:content - if (isset($content['attribs']['']['bitrate'])) - { - $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['channels'])) - { - $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['duration'])) - { - $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $duration = $duration_parent; - } - if (isset($content['attribs']['']['expression'])) - { - $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['framerate'])) - { - $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['height'])) - { - $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['lang'])) - { - $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['fileSize'])) - { - $length = ceil($content['attribs']['']['fileSize']); - } - if (isset($content['attribs']['']['medium'])) - { - $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['samplingrate'])) - { - $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['type'])) - { - $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['width'])) - { - $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - - // Checking the other optional media: elements. Priority: media:content, media:group, item, channel - - // CAPTIONS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) - { - $caption_type = null; - $caption_lang = null; - $caption_startTime = null; - $caption_endTime = null; - $caption_text = null; - if (isset($caption['attribs']['']['type'])) - { - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['lang'])) - { - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['start'])) - { - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['end'])) - { - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['data'])) - { - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $captions[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text)); - } - if (is_array($captions)) - { - $captions = array_values(array_unique($captions)); - } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) - { - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) - { - $caption_type = null; - $caption_lang = null; - $caption_startTime = null; - $caption_endTime = null; - $caption_text = null; - if (isset($caption['attribs']['']['type'])) - { - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['lang'])) - { - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['start'])) - { - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['end'])) - { - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['data'])) - { - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $captions[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text)); - } - if (is_array($captions)) - { - $captions = array_values(array_unique($captions)); - } - } - else - { - $captions = $captions_parent; - } - - // CATEGORIES - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) - { - foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) - { - $term = null; - $scheme = null; - $label = null; - if (isset($category['data'])) - { - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($category['attribs']['']['scheme'])) - { - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $scheme = 'http://search.yahoo.com/mrss/category_schema'; - } - if (isset($category['attribs']['']['label'])) - { - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); - } - } - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) - { - foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) - { - $term = null; - $scheme = null; - $label = null; - if (isset($category['data'])) - { - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($category['attribs']['']['scheme'])) - { - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $scheme = 'http://search.yahoo.com/mrss/category_schema'; - } - if (isset($category['attribs']['']['label'])) - { - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); - } - } - if (is_array($categories) && is_array($categories_parent)) - { - $categories = array_values(array_unique(array_merge($categories, $categories_parent))); - } - elseif (is_array($categories)) - { - $categories = array_values(array_unique($categories)); - } - elseif (is_array($categories_parent)) - { - $categories = array_values(array_unique($categories_parent)); - } - - // COPYRIGHTS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) - { - $copyright_url = null; - $copyright_label = null; - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) - { - $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) - { - $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label)); - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) - { - $copyright_url = null; - $copyright_label = null; - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) - { - $copyright_url = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) - { - $copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label)); - } - else - { - $copyrights = $copyrights_parent; - } - - // CREDITS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) - { - $credit_role = null; - $credit_scheme = null; - $credit_name = null; - if (isset($credit['attribs']['']['role'])) - { - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($credit['attribs']['']['scheme'])) - { - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $credit_scheme = 'urn:ebu'; - } - if (isset($credit['data'])) - { - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $credits[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name)); - } - if (is_array($credits)) - { - $credits = array_values(array_unique($credits)); - } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) - { - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) - { - $credit_role = null; - $credit_scheme = null; - $credit_name = null; - if (isset($credit['attribs']['']['role'])) - { - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($credit['attribs']['']['scheme'])) - { - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $credit_scheme = 'urn:ebu'; - } - if (isset($credit['data'])) - { - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $credits[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name)); - } - if (is_array($credits)) - { - $credits = array_values(array_unique($credits)); - } - } - else - { - $credits = $credits_parent; - } - - // DESCRIPTION - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) - { - $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) - { - $description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $description = $description_parent; - } - - // HASHES - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) - { - $value = null; - $algo = null; - if (isset($hash['data'])) - { - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($hash['attribs']['']['algo'])) - { - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $algo = 'md5'; - } - $hashes[] = $algo.':'.$value; - } - if (is_array($hashes)) - { - $hashes = array_values(array_unique($hashes)); - } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) - { - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) - { - $value = null; - $algo = null; - if (isset($hash['data'])) - { - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($hash['attribs']['']['algo'])) - { - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $algo = 'md5'; - } - $hashes[] = $algo.':'.$value; - } - if (is_array($hashes)) - { - $hashes = array_values(array_unique($hashes)); - } - } - else - { - $hashes = $hashes_parent; - } - - // KEYWORDS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) - { - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) - { - $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); - foreach ($temp as $word) - { - $keywords[] = trim($word); - } - unset($temp); - } - if (is_array($keywords)) - { - $keywords = array_values(array_unique($keywords)); - } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) - { - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) - { - $temp = explode(',', $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); - foreach ($temp as $word) - { - $keywords[] = trim($word); - } - unset($temp); - } - if (is_array($keywords)) - { - $keywords = array_values(array_unique($keywords)); - } - } - else - { - $keywords = $keywords_parent; - } - - // PLAYER - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) - { - $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) - { - $player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - else - { - $player = $player_parent; - } - - // RATINGS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) - { - $rating_scheme = null; - $rating_value = null; - if (isset($rating['attribs']['']['scheme'])) - { - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $rating_scheme = 'urn:simple'; - } - if (isset($rating['data'])) - { - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $ratings[] = $this->registry->create('Rating', array($rating_scheme, $rating_value)); - } - if (is_array($ratings)) - { - $ratings = array_values(array_unique($ratings)); - } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) - { - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) - { - $rating_scheme = null; - $rating_value = null; - if (isset($rating['attribs']['']['scheme'])) - { - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $rating_scheme = 'urn:simple'; - } - if (isset($rating['data'])) - { - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $ratings[] = $this->registry->create('Rating', array($rating_scheme, $rating_value)); - } - if (is_array($ratings)) - { - $ratings = array_values(array_unique($ratings)); - } - } - else - { - $ratings = $ratings_parent; - } - - // RESTRICTIONS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) - { - $restriction_relationship = null; - $restriction_type = null; - $restriction_value = null; - if (isset($restriction['attribs']['']['relationship'])) - { - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($restriction['attribs']['']['type'])) - { - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($restriction['data'])) - { - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $restrictions[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value)); - } - if (is_array($restrictions)) - { - $restrictions = array_values(array_unique($restrictions)); - } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) - { - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) - { - $restriction_relationship = null; - $restriction_type = null; - $restriction_value = null; - if (isset($restriction['attribs']['']['relationship'])) - { - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($restriction['attribs']['']['type'])) - { - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($restriction['data'])) - { - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $restrictions[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value)); - } - if (is_array($restrictions)) - { - $restrictions = array_values(array_unique($restrictions)); - } - } - else - { - $restrictions = $restrictions_parent; - } - - // THUMBNAILS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) - { - $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - if (is_array($thumbnails)) - { - $thumbnails = array_values(array_unique($thumbnails)); - } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) - { - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) - { - $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - if (is_array($thumbnails)) - { - $thumbnails = array_values(array_unique($thumbnails)); - } - } - else - { - $thumbnails = $thumbnails_parent; - } - - // TITLES - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) - { - $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) - { - $title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $title = $title_parent; - } - - $this->data['enclosures'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width)); - } - } - } - } - - // If we have standalone media:content tags, loop through them. - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'])) - { - foreach ((array) $this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content) - { - if (isset($content['attribs']['']['url']) || isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) - { - // Attributes - $bitrate = null; - $channels = null; - $duration = null; - $expression = null; - $framerate = null; - $height = null; - $javascript = null; - $lang = null; - $length = null; - $medium = null; - $samplingrate = null; - $type = null; - $url = null; - $width = null; - - // Elements - $captions = null; - $categories = null; - $copyrights = null; - $credits = null; - $description = null; - $hashes = null; - $keywords = null; - $player = null; - $ratings = null; - $restrictions = null; - $thumbnails = null; - $title = null; - - // Start checking the attributes of media:content - if (isset($content['attribs']['']['bitrate'])) - { - $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['channels'])) - { - $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['duration'])) - { - $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $duration = $duration_parent; - } - if (isset($content['attribs']['']['expression'])) - { - $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['framerate'])) - { - $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['height'])) - { - $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['lang'])) - { - $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['fileSize'])) - { - $length = ceil($content['attribs']['']['fileSize']); - } - if (isset($content['attribs']['']['medium'])) - { - $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['samplingrate'])) - { - $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['type'])) - { - $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['width'])) - { - $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['url'])) - { - $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - // Checking the other optional media: elements. Priority: media:content, media:group, item, channel - - // CAPTIONS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) - { - $caption_type = null; - $caption_lang = null; - $caption_startTime = null; - $caption_endTime = null; - $caption_text = null; - if (isset($caption['attribs']['']['type'])) - { - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['lang'])) - { - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['start'])) - { - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['end'])) - { - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['data'])) - { - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $captions[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text)); - } - if (is_array($captions)) - { - $captions = array_values(array_unique($captions)); - } - } - else - { - $captions = $captions_parent; - } - - // CATEGORIES - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) - { - foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) - { - $term = null; - $scheme = null; - $label = null; - if (isset($category['data'])) - { - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($category['attribs']['']['scheme'])) - { - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $scheme = 'http://search.yahoo.com/mrss/category_schema'; - } - if (isset($category['attribs']['']['label'])) - { - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); - } - } - if (is_array($categories) && is_array($categories_parent)) - { - $categories = array_values(array_unique(array_merge($categories, $categories_parent))); - } - elseif (is_array($categories)) - { - $categories = array_values(array_unique($categories)); - } - elseif (is_array($categories_parent)) - { - $categories = array_values(array_unique($categories_parent)); - } - else - { - $categories = null; - } - - // COPYRIGHTS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) - { - $copyright_url = null; - $copyright_label = null; - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) - { - $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) - { - $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label)); - } - else - { - $copyrights = $copyrights_parent; - } - - // CREDITS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) - { - $credit_role = null; - $credit_scheme = null; - $credit_name = null; - if (isset($credit['attribs']['']['role'])) - { - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($credit['attribs']['']['scheme'])) - { - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $credit_scheme = 'urn:ebu'; - } - if (isset($credit['data'])) - { - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $credits[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name)); - } - if (is_array($credits)) - { - $credits = array_values(array_unique($credits)); - } - } - else - { - $credits = $credits_parent; - } - - // DESCRIPTION - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) - { - $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $description = $description_parent; - } - - // HASHES - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) - { - $value = null; - $algo = null; - if (isset($hash['data'])) - { - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($hash['attribs']['']['algo'])) - { - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $algo = 'md5'; - } - $hashes[] = $algo.':'.$value; - } - if (is_array($hashes)) - { - $hashes = array_values(array_unique($hashes)); - } - } - else - { - $hashes = $hashes_parent; - } - - // KEYWORDS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) - { - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) - { - $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); - foreach ($temp as $word) - { - $keywords[] = trim($word); - } - unset($temp); - } - if (is_array($keywords)) - { - $keywords = array_values(array_unique($keywords)); - } - } - else - { - $keywords = $keywords_parent; - } - - // PLAYER - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) - { - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'])) { - $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - } - else - { - $player = $player_parent; - } - - // RATINGS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) - { - $rating_scheme = null; - $rating_value = null; - if (isset($rating['attribs']['']['scheme'])) - { - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $rating_scheme = 'urn:simple'; - } - if (isset($rating['data'])) - { - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $ratings[] = $this->registry->create('Rating', array($rating_scheme, $rating_value)); - } - if (is_array($ratings)) - { - $ratings = array_values(array_unique($ratings)); - } - } - else - { - $ratings = $ratings_parent; - } - - // RESTRICTIONS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) - { - $restriction_relationship = null; - $restriction_type = null; - $restriction_value = null; - if (isset($restriction['attribs']['']['relationship'])) - { - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($restriction['attribs']['']['type'])) - { - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($restriction['data'])) - { - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $restrictions[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value)); - } - if (is_array($restrictions)) - { - $restrictions = array_values(array_unique($restrictions)); - } - } - else - { - $restrictions = $restrictions_parent; - } - - // THUMBNAILS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) - { - if (isset($thumbnail['attribs']['']['url'])) { - $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - } - if (is_array($thumbnails)) - { - $thumbnails = array_values(array_unique($thumbnails)); - } - } - else - { - $thumbnails = $thumbnails_parent; - } - - // TITLES - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) - { - $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $title = $title_parent; - } - - $this->data['enclosures'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width)); - } - } - } - - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link) - { - if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') - { - // Attributes - $bitrate = null; - $channels = null; - $duration = null; - $expression = null; - $framerate = null; - $height = null; - $javascript = null; - $lang = null; - $length = null; - $medium = null; - $samplingrate = null; - $type = null; - $url = null; - $width = null; - - $url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); - if (isset($link['attribs']['']['type'])) - { - $type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($link['attribs']['']['length'])) - { - $length = ceil($link['attribs']['']['length']); - } - - // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $this->data['enclosures'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width)); - } - } - - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link) - { - if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') - { - // Attributes - $bitrate = null; - $channels = null; - $duration = null; - $expression = null; - $framerate = null; - $height = null; - $javascript = null; - $lang = null; - $length = null; - $medium = null; - $samplingrate = null; - $type = null; - $url = null; - $width = null; - - $url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); - if (isset($link['attribs']['']['type'])) - { - $type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($link['attribs']['']['length'])) - { - $length = ceil($link['attribs']['']['length']); - } - - // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $this->data['enclosures'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width)); - } - } - - if ($enclosure = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'enclosure')) - { - if (isset($enclosure[0]['attribs']['']['url'])) - { - // Attributes - $bitrate = null; - $channels = null; - $duration = null; - $expression = null; - $framerate = null; - $height = null; - $javascript = null; - $lang = null; - $length = null; - $medium = null; - $samplingrate = null; - $type = null; - $url = null; - $width = null; - - $url = $this->sanitize($enclosure[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($enclosure[0])); - if (isset($enclosure[0]['attribs']['']['type'])) - { - $type = $this->sanitize($enclosure[0]['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($enclosure[0]['attribs']['']['length'])) - { - $length = ceil($enclosure[0]['attribs']['']['length']); - } - - // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $this->data['enclosures'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width)); - } - } - - if (sizeof($this->data['enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width)) - { - // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $this->data['enclosures'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width)); - } - - $this->data['enclosures'] = array_values(array_unique($this->data['enclosures'])); - } - if (!empty($this->data['enclosures'])) - { - return $this->data['enclosures']; - } - else - { - return null; - } - } - - /** - * Get the latitude coordinates for the item - * - * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications - * - * Uses `<geo:lat>` or `<georss:point>` - * - * @since 1.0 - * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo - * @link http://www.georss.org/ GeoRSS - * @return string|null - */ - public function get_latitude() - { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) - { - return (float) $return[0]['data']; - } - elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) - { - return (float) $match[1]; - } - else - { - return null; - } - } - - /** - * Get the longitude coordinates for the item - * - * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications - * - * Uses `<geo:long>`, `<geo:lon>` or `<georss:point>` - * - * @since 1.0 - * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo - * @link http://www.georss.org/ GeoRSS - * @return string|null - */ - public function get_longitude() - { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) - { - return (float) $return[0]['data']; - } - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) - { - return (float) $return[0]['data']; - } - elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) - { - return (float) $match[2]; - } - else - { - return null; - } - } - - /** - * Get the `<atom:source>` for the item - * - * @since 1.1 - * @return SimplePie_Source|null - */ - public function get_source() - { - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source')) - { - return $this->registry->create('Source', array($this, $return[0])); - } - else - { - return null; - } - } -} -
@@ -1,429 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Used for feed auto-discovery - * - * - * This class can be overloaded with {@see SimplePie::set_locator_class()} - * - * @package SimplePie - */ -class SimplePie_Locator -{ - var $useragent; - var $timeout; - var $file; - var $local = array(); - var $elsewhere = array(); - var $cached_entities = array(); - var $http_base; - var $base; - var $base_location = 0; - var $checked_feeds = 0; - var $max_checked_feeds = 10; - protected $registry; - - public function __construct(SimplePie_File $file, $timeout = 10, $useragent = null, $max_checked_feeds = 10) - { - $this->file = $file; - $this->useragent = $useragent; - $this->timeout = $timeout; - $this->max_checked_feeds = $max_checked_feeds; - - if (class_exists('DOMDocument')) - { - $this->dom = new DOMDocument(); - - set_error_handler(array('SimplePie_Misc', 'silence_errors')); - $this->dom->loadHTML($this->file->body); - restore_error_handler(); - } - else - { - $this->dom = null; - } - } - - public function set_registry(SimplePie_Registry $registry) - { - $this->registry = $registry; - } - - public function find($type = SIMPLEPIE_LOCATOR_ALL, &$working) - { - if ($this->is_feed($this->file)) - { - return $this->file; - } - - if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) - { - $sniffer = $this->registry->create('Content_Type_Sniffer', array($this->file)); - if ($sniffer->get_type() !== 'text/html') - { - return null; - } - } - - if ($type & ~SIMPLEPIE_LOCATOR_NONE) - { - $this->get_base(); - } - - if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery()) - { - return $working[0]; - } - - if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links()) - { - if ($type & SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local)) - { - return $working[0]; - } - - if ($type & SIMPLEPIE_LOCATOR_LOCAL_BODY && $working = $this->body($this->local)) - { - return $working[0]; - } - - if ($type & SIMPLEPIE_LOCATOR_REMOTE_EXTENSION && $working = $this->extension($this->elsewhere)) - { - return $working[0]; - } - - if ($type & SIMPLEPIE_LOCATOR_REMOTE_BODY && $working = $this->body($this->elsewhere)) - { - return $working[0]; - } - } - return null; - } - - public function is_feed($file, $check_html = false) - { - if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) - { - $sniffer = $this->registry->create('Content_Type_Sniffer', array($file)); - $sniffed = $sniffer->get_type(); - $mime_types = array('application/rss+xml', 'application/rdf+xml', - 'text/rdf', 'application/atom+xml', 'text/xml', - 'application/xml', 'application/x-rss+xml'); - if ($check_html) - { - $mime_types[] = 'text/html'; - } - if (in_array($sniffed, $mime_types)) - { - return true; - } - else - { - return false; - } - } - elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL) - { - return true; - } - else - { - return false; - } - } - - public function get_base() - { - if ($this->dom === null) - { - throw new SimplePie_Exception('DOMDocument not found, unable to use locator'); - } - $this->http_base = $this->file->url; - $this->base = $this->http_base; - $elements = $this->dom->getElementsByTagName('base'); - foreach ($elements as $element) - { - if ($element->hasAttribute('href')) - { - $base = $this->registry->call('Misc', 'absolutize_url', array(trim($element->getAttribute('href')), $this->http_base)); - if ($base === false) - { - continue; - } - $this->base = $base; - $this->base_location = method_exists($element, 'getLineNo') ? $element->getLineNo() : 0; - break; - } - } - } - - public function autodiscovery() - { - $done = array(); - $feeds = array(); - $feeds = array_merge($feeds, $this->search_elements_by_tag('link', $done, $feeds)); - $feeds = array_merge($feeds, $this->search_elements_by_tag('a', $done, $feeds)); - $feeds = array_merge($feeds, $this->search_elements_by_tag('area', $done, $feeds)); - - if (!empty($feeds)) - { - return array_values($feeds); - } - else - { - return null; - } - } - - protected function search_elements_by_tag($name, &$done, $feeds) - { - if ($this->dom === null) - { - throw new SimplePie_Exception('DOMDocument not found, unable to use locator'); - } - - $links = $this->dom->getElementsByTagName($name); - foreach ($links as $link) - { - if ($this->checked_feeds === $this->max_checked_feeds) - { - break; - } - if ($link->hasAttribute('href') && $link->hasAttribute('rel')) - { - $rel = array_unique($this->registry->call('Misc', 'space_seperated_tokens', array(strtolower($link->getAttribute('rel'))))); - $line = method_exists($link, 'getLineNo') ? $link->getLineNo() : 1; - - if ($this->base_location < $line) - { - $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->base)); - } - else - { - $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base)); - } - if ($href === false) - { - continue; - } - - if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !in_array('stylesheet', $rel) && $link->hasAttribute('type') && in_array(strtolower($this->registry->call('Misc', 'parse_mime', array($link->getAttribute('type')))), array('text/html', 'application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href])) - { - $this->checked_feeds++; - $headers = array( - 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', - ); - $feed = $this->registry->create('File', array($href, $this->timeout, 5, $headers, $this->useragent)); - if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed, true)) - { - $feeds[$href] = $feed; - } - } - $done[] = $href; - } - } - - return $feeds; - } - - public function get_links() - { - if ($this->dom === null) - { - throw new SimplePie_Exception('DOMDocument not found, unable to use locator'); - } - - $links = $this->dom->getElementsByTagName('a'); - foreach ($links as $link) - { - if ($link->hasAttribute('href')) - { - $href = trim($link->getAttribute('href')); - $parsed = $this->registry->call('Misc', 'parse_url', array($href)); - if ($parsed['scheme'] === '' || preg_match('/^(https?|feed)?$/i', $parsed['scheme'])) - { - if (method_exists($link, 'getLineNo') && $this->base_location < $link->getLineNo()) - { - $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->base)); - } - else - { - $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base)); - } - if ($href === false) - { - continue; - } - - $current = $this->registry->call('Misc', 'parse_url', array($this->file->url)); - - if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority']) - { - $this->local[] = $href; - } - else - { - $this->elsewhere[] = $href; - } - } - } - } - $this->local = array_unique($this->local); - $this->elsewhere = array_unique($this->elsewhere); - if (!empty($this->local) || !empty($this->elsewhere)) - { - return true; - } - return null; - } - - public function get_rel_link($rel) - { - if ($this->dom === null) - { - throw new SimplePie_Exception('DOMDocument not found, unable to use '. - 'locator'); - } - if (!class_exists('DOMXpath')) - { - throw new SimplePie_Exception('DOMXpath not found, unable to use '. - 'get_rel_link'); - } - - $xpath = new DOMXpath($this->dom); - $query = '//a[@rel and @href] | //link[@rel and @href]'; - foreach ($xpath->query($query) as $link) - { - $href = trim($link->getAttribute('href')); - $parsed = $this->registry->call('Misc', 'parse_url', array($href)); - if ($parsed['scheme'] === '' || - preg_match('/^https?$/i', $parsed['scheme'])) - { - if (method_exists($link, 'getLineNo') && - $this->base_location < $link->getLineNo()) - { - $href = - $this->registry->call('Misc', 'absolutize_url', - array(trim($link->getAttribute('href')), - $this->base)); - } - else - { - $href = - $this->registry->call('Misc', 'absolutize_url', - array(trim($link->getAttribute('href')), - $this->http_base)); - } - if ($href === false) - { - return null; - } - $rel_values = explode(' ', strtolower($link->getAttribute('rel'))); - if (in_array($rel, $rel_values)) - { - return $href; - } - } - } - return null; - } - - public function extension(&$array) - { - foreach ($array as $key => $value) - { - if ($this->checked_feeds === $this->max_checked_feeds) - { - break; - } - if (in_array(strtolower(strrchr($value, '.')), array('.rss', '.rdf', '.atom', '.xml'))) - { - $this->checked_feeds++; - - $headers = array( - 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', - ); - $feed = $this->registry->create('File', array($value, $this->timeout, 5, $headers, $this->useragent)); - if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) - { - return array($feed); - } - else - { - unset($array[$key]); - } - } - } - return null; - } - - public function body(&$array) - { - foreach ($array as $key => $value) - { - if ($this->checked_feeds === $this->max_checked_feeds) - { - break; - } - if (preg_match('/(rss|rdf|atom|xml)/i', $value)) - { - $this->checked_feeds++; - $headers = array( - 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', - ); - $feed = $this->registry->create('File', array($value, $this->timeout, 5, null, $this->useragent)); - if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) - { - return array($feed); - } - else - { - unset($array[$key]); - } - } - } - return null; - } -} -
@@ -1,2263 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Miscellanous utilities - * - * @package SimplePie - */ -class SimplePie_Misc -{ - public static function time_hms($seconds) - { - $time = ''; - - $hours = floor($seconds / 3600); - $remainder = $seconds % 3600; - if ($hours > 0) - { - $time .= $hours.':'; - } - - $minutes = floor($remainder / 60); - $seconds = $remainder % 60; - if ($minutes < 10 && $hours > 0) - { - $minutes = '0' . $minutes; - } - if ($seconds < 10) - { - $seconds = '0' . $seconds; - } - - $time .= $minutes.':'; - $time .= $seconds; - - return $time; - } - - public static function absolutize_url($relative, $base) - { - $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative); - if ($iri === false) - { - return false; - } - return $iri->get_uri(); - } - - /** - * Get a HTML/XML element from a HTML string - * - * @deprecated Use DOMDocument instead (parsing HTML with regex is bad!) - * @param string $realname Element name (including namespace prefix if applicable) - * @param string $string HTML document - * @return array - */ - public static function get_element($realname, $string) - { - $return = array(); - $name = preg_quote($realname, '/'); - if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) - { - for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++) - { - $return[$i]['tag'] = $realname; - $return[$i]['full'] = $matches[$i][0][0]; - $return[$i]['offset'] = $matches[$i][0][1]; - if (strlen($matches[$i][3][0]) <= 2) - { - $return[$i]['self_closing'] = true; - } - else - { - $return[$i]['self_closing'] = false; - $return[$i]['content'] = $matches[$i][4][0]; - } - $return[$i]['attribs'] = array(); - if (isset($matches[$i][2][0]) && preg_match_all('/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*)(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"([^"]*)"|\'([^\']*)\'|([^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?/', ' ' . $matches[$i][2][0] . ' ', $attribs, PREG_SET_ORDER)) - { - for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++) - { - if (count($attribs[$j]) === 2) - { - $attribs[$j][2] = $attribs[$j][1]; - } - $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j])); - } - } - } - } - return $return; - } - - public static function element_implode($element) - { - $full = "<$element[tag]"; - foreach ($element['attribs'] as $key => $value) - { - $key = strtolower($key); - $full .= " $key=\"" . htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8') . '"'; - } - if ($element['self_closing']) - { - $full .= ' />'; - } - else - { - $full .= ">$element[content]</$element[tag]>"; - } - return $full; - } - - public static function error($message, $level, $file, $line) - { - if ((ini_get('error_reporting') & $level) > 0) - { - switch ($level) - { - case E_USER_ERROR: - $note = 'PHP Error'; - break; - case E_USER_WARNING: - $note = 'PHP Warning'; - break; - case E_USER_NOTICE: - $note = 'PHP Notice'; - break; - default: - $note = 'Unknown Error'; - break; - } - - $log_error = true; - if (!function_exists('error_log')) - { - $log_error = false; - } - - $log_file = @ini_get('error_log'); - if (!empty($log_file) && ('syslog' !== $log_file) && !@is_writable($log_file)) - { - $log_error = false; - } - - if ($log_error) - { - @error_log("$note: $message in $file on line $line", 0); - } - } - - return $message; - } - - public static function fix_protocol($url, $http = 1) - { - $url = SimplePie_Misc::normalize_url($url); - $parsed = SimplePie_Misc::parse_url($url); - if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https') - { - return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http); - } - - if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url)) - { - return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http); - } - - if ($http === 2 && $parsed['scheme'] !== '') - { - return "feed:$url"; - } - elseif ($http === 3 && strtolower($parsed['scheme']) === 'http') - { - return substr_replace($url, 'podcast', 0, 4); - } - elseif ($http === 4 && strtolower($parsed['scheme']) === 'http') - { - return substr_replace($url, 'itpc', 0, 4); - } - else - { - return $url; - } - } - - public static function array_merge_recursive($array1, $array2) - { - foreach ($array2 as $key => $value) - { - if (is_array($value)) - { - $array1[$key] = SimplePie_Misc::array_merge_recursive($array1[$key], $value); - } - else - { - $array1[$key] = $value; - } - } - - return $array1; - } - - public static function parse_url($url) - { - $iri = new SimplePie_IRI($url); - return array( - 'scheme' => (string) $iri->scheme, - 'authority' => (string) $iri->authority, - 'path' => (string) $iri->path, - 'query' => (string) $iri->query, - 'fragment' => (string) $iri->fragment - ); - } - - public static function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '') - { - $iri = new SimplePie_IRI(''); - $iri->scheme = $scheme; - $iri->authority = $authority; - $iri->path = $path; - $iri->query = $query; - $iri->fragment = $fragment; - return $iri->get_uri(); - } - - public static function normalize_url($url) - { - $iri = new SimplePie_IRI($url); - return $iri->get_uri(); - } - - public static function percent_encoding_normalization($match) - { - $integer = hexdec($match[1]); - if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E) - { - return chr($integer); - } - else - { - return strtoupper($match[0]); - } - } - - /** - * Converts a Windows-1252 encoded string to a UTF-8 encoded string - * - * @static - * @param string $string Windows-1252 encoded string - * @return string UTF-8 encoded string - */ - public static function windows_1252_to_utf8($string) - { - static $convert_table = array("\x80" => "\xE2\x82\xAC", "\x81" => "\xEF\xBF\xBD", "\x82" => "\xE2\x80\x9A", "\x83" => "\xC6\x92", "\x84" => "\xE2\x80\x9E", "\x85" => "\xE2\x80\xA6", "\x86" => "\xE2\x80\xA0", "\x87" => "\xE2\x80\xA1", "\x88" => "\xCB\x86", "\x89" => "\xE2\x80\xB0", "\x8A" => "\xC5\xA0", "\x8B" => "\xE2\x80\xB9", "\x8C" => "\xC5\x92", "\x8D" => "\xEF\xBF\xBD", "\x8E" => "\xC5\xBD", "\x8F" => "\xEF\xBF\xBD", "\x90" => "\xEF\xBF\xBD", "\x91" => "\xE2\x80\x98", "\x92" => "\xE2\x80\x99", "\x93" => "\xE2\x80\x9C", "\x94" => "\xE2\x80\x9D", "\x95" => "\xE2\x80\xA2", "\x96" => "\xE2\x80\x93", "\x97" => "\xE2\x80\x94", "\x98" => "\xCB\x9C", "\x99" => "\xE2\x84\xA2", "\x9A" => "\xC5\xA1", "\x9B" => "\xE2\x80\xBA", "\x9C" => "\xC5\x93", "\x9D" => "\xEF\xBF\xBD", "\x9E" => "\xC5\xBE", "\x9F" => "\xC5\xB8", "\xA0" => "\xC2\xA0", "\xA1" => "\xC2\xA1", "\xA2" => "\xC2\xA2", "\xA3" => "\xC2\xA3", "\xA4" => "\xC2\xA4", "\xA5" => "\xC2\xA5", "\xA6" => "\xC2\xA6", "\xA7" => "\xC2\xA7", "\xA8" => "\xC2\xA8", "\xA9" => "\xC2\xA9", "\xAA" => "\xC2\xAA", "\xAB" => "\xC2\xAB", "\xAC" => "\xC2\xAC", "\xAD" => "\xC2\xAD", "\xAE" => "\xC2\xAE", "\xAF" => "\xC2\xAF", "\xB0" => "\xC2\xB0", "\xB1" => "\xC2\xB1", "\xB2" => "\xC2\xB2", "\xB3" => "\xC2\xB3", "\xB4" => "\xC2\xB4", "\xB5" => "\xC2\xB5", "\xB6" => "\xC2\xB6", "\xB7" => "\xC2\xB7", "\xB8" => "\xC2\xB8", "\xB9" => "\xC2\xB9", "\xBA" => "\xC2\xBA", "\xBB" => "\xC2\xBB", "\xBC" => "\xC2\xBC", "\xBD" => "\xC2\xBD", "\xBE" => "\xC2\xBE", "\xBF" => "\xC2\xBF", "\xC0" => "\xC3\x80", "\xC1" => "\xC3\x81", "\xC2" => "\xC3\x82", "\xC3" => "\xC3\x83", "\xC4" => "\xC3\x84", "\xC5" => "\xC3\x85", "\xC6" => "\xC3\x86", "\xC7" => "\xC3\x87", "\xC8" => "\xC3\x88", "\xC9" => "\xC3\x89", "\xCA" => "\xC3\x8A", "\xCB" => "\xC3\x8B", "\xCC" => "\xC3\x8C", "\xCD" => "\xC3\x8D", "\xCE" => "\xC3\x8E", "\xCF" => "\xC3\x8F", "\xD0" => "\xC3\x90", "\xD1" => "\xC3\x91", "\xD2" => "\xC3\x92", "\xD3" => "\xC3\x93", "\xD4" => "\xC3\x94", "\xD5" => "\xC3\x95", "\xD6" => "\xC3\x96", "\xD7" => "\xC3\x97", "\xD8" => "\xC3\x98", "\xD9" => "\xC3\x99", "\xDA" => "\xC3\x9A", "\xDB" => "\xC3\x9B", "\xDC" => "\xC3\x9C", "\xDD" => "\xC3\x9D", "\xDE" => "\xC3\x9E", "\xDF" => "\xC3\x9F", "\xE0" => "\xC3\xA0", "\xE1" => "\xC3\xA1", "\xE2" => "\xC3\xA2", "\xE3" => "\xC3\xA3", "\xE4" => "\xC3\xA4", "\xE5" => "\xC3\xA5", "\xE6" => "\xC3\xA6", "\xE7" => "\xC3\xA7", "\xE8" => "\xC3\xA8", "\xE9" => "\xC3\xA9", "\xEA" => "\xC3\xAA", "\xEB" => "\xC3\xAB", "\xEC" => "\xC3\xAC", "\xED" => "\xC3\xAD", "\xEE" => "\xC3\xAE", "\xEF" => "\xC3\xAF", "\xF0" => "\xC3\xB0", "\xF1" => "\xC3\xB1", "\xF2" => "\xC3\xB2", "\xF3" => "\xC3\xB3", "\xF4" => "\xC3\xB4", "\xF5" => "\xC3\xB5", "\xF6" => "\xC3\xB6", "\xF7" => "\xC3\xB7", "\xF8" => "\xC3\xB8", "\xF9" => "\xC3\xB9", "\xFA" => "\xC3\xBA", "\xFB" => "\xC3\xBB", "\xFC" => "\xC3\xBC", "\xFD" => "\xC3\xBD", "\xFE" => "\xC3\xBE", "\xFF" => "\xC3\xBF"); - - return strtr($string, $convert_table); - } - - /** - * Change a string from one encoding to another - * - * @param string $data Raw data in $input encoding - * @param string $input Encoding of $data - * @param string $output Encoding you want - * @return string|boolean False if we can't convert it - */ - public static function change_encoding($data, $input, $output) - { - $input = SimplePie_Misc::encoding($input); - $output = SimplePie_Misc::encoding($output); - - // We fail to fail on non US-ASCII bytes - if ($input === 'US-ASCII') - { - static $non_ascii_octects = ''; - if (!$non_ascii_octects) - { - for ($i = 0x80; $i <= 0xFF; $i++) - { - $non_ascii_octects .= chr($i); - } - } - $data = substr($data, 0, strcspn($data, $non_ascii_octects)); - } - - // This is first, as behaviour of this is completely predictable - if ($input === 'windows-1252' && $output === 'UTF-8') - { - return SimplePie_Misc::windows_1252_to_utf8($data); - } - // This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported). - elseif (function_exists('mb_convert_encoding') && ($return = SimplePie_Misc::change_encoding_mbstring($data, $input, $output))) - { - return $return; - } - // This is last, as behaviour of this varies with OS userland and PHP version - elseif (function_exists('iconv') && ($return = SimplePie_Misc::change_encoding_iconv($data, $input, $output))) - { - return $return; - } - // If we can't do anything, just fail - else - { - return false; - } - } - - protected static function change_encoding_mbstring($data, $input, $output) - { - if ($input === 'windows-949') - { - $input = 'EUC-KR'; - } - if ($output === 'windows-949') - { - $output = 'EUC-KR'; - } - if ($input === 'Windows-31J') - { - $input = 'SJIS'; - } - if ($output === 'Windows-31J') - { - $output = 'SJIS'; - } - - // Check that the encoding is supported - if (@mb_convert_encoding("\x80", 'UTF-16BE', $input) === "\x00\x80") - { - return false; - } - if (!in_array($input, mb_list_encodings())) - { - return false; - } - - // Let's do some conversion - if ($return = @mb_convert_encoding($data, $output, $input)) - { - return $return; - } - - return false; - } - - protected static function change_encoding_iconv($data, $input, $output) - { - return @iconv($input, $output, $data); - } - - /** - * Normalize an encoding name - * - * This is automatically generated by create.php - * - * To generate it, run `php create.php` on the command line, and copy the - * output to replace this function. - * - * @param string $charset Character set to standardise - * @return string Standardised name - */ - public static function encoding($charset) - { - // Normalization from UTS #22 - switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset))) - { - case 'adobestandardencoding': - case 'csadobestandardencoding': - return 'Adobe-Standard-Encoding'; - - case 'adobesymbolencoding': - case 'cshppsmath': - return 'Adobe-Symbol-Encoding'; - - case 'ami1251': - case 'amiga1251': - return 'Amiga-1251'; - - case 'ansix31101983': - case 'csat5001983': - case 'csiso99naplps': - case 'isoir99': - case 'naplps': - return 'ANSI_X3.110-1983'; - - case 'arabic7': - case 'asmo449': - case 'csiso89asmo449': - case 'iso9036': - case 'isoir89': - return 'ASMO_449'; - - case 'big5': - case 'csbig5': - return 'Big5'; - - case 'big5hkscs': - return 'Big5-HKSCS'; - - case 'bocu1': - case 'csbocu1': - return 'BOCU-1'; - - case 'brf': - case 'csbrf': - return 'BRF'; - - case 'bs4730': - case 'csiso4unitedkingdom': - case 'gb': - case 'iso646gb': - case 'isoir4': - case 'uk': - return 'BS_4730'; - - case 'bsviewdata': - case 'csiso47bsviewdata': - case 'isoir47': - return 'BS_viewdata'; - - case 'cesu8': - case 'cscesu8': - return 'CESU-8'; - - case 'ca': - case 'csa71': - case 'csaz243419851': - case 'csiso121canadian1': - case 'iso646ca': - case 'isoir121': - return 'CSA_Z243.4-1985-1'; - - case 'csa72': - case 'csaz243419852': - case 'csiso122canadian2': - case 'iso646ca2': - case 'isoir122': - return 'CSA_Z243.4-1985-2'; - - case 'csaz24341985gr': - case 'csiso123csaz24341985gr': - case 'isoir123': - return 'CSA_Z243.4-1985-gr'; - - case 'csiso139csn369103': - case 'csn369103': - case 'isoir139': - return 'CSN_369103'; - - case 'csdecmcs': - case 'dec': - case 'decmcs': - return 'DEC-MCS'; - - case 'csiso21german': - case 'de': - case 'din66003': - case 'iso646de': - case 'isoir21': - return 'DIN_66003'; - - case 'csdkus': - case 'dkus': - return 'dk-us'; - - case 'csiso646danish': - case 'dk': - case 'ds2089': - case 'iso646dk': - return 'DS_2089'; - - case 'csibmebcdicatde': - case 'ebcdicatde': - return 'EBCDIC-AT-DE'; - - case 'csebcdicatdea': - case 'ebcdicatdea': - return 'EBCDIC-AT-DE-A'; - - case 'csebcdiccafr': - case 'ebcdiccafr': - return 'EBCDIC-CA-FR'; - - case 'csebcdicdkno': - case 'ebcdicdkno': - return 'EBCDIC-DK-NO'; - - case 'csebcdicdknoa': - case 'ebcdicdknoa': - return 'EBCDIC-DK-NO-A'; - - case 'csebcdices': - case 'ebcdices': - return 'EBCDIC-ES'; - - case 'csebcdicesa': - case 'ebcdicesa': - return 'EBCDIC-ES-A'; - - case 'csebcdicess': - case 'ebcdicess': - return 'EBCDIC-ES-S'; - - case 'csebcdicfise': - case 'ebcdicfise': - return 'EBCDIC-FI-SE'; - - case 'csebcdicfisea': - case 'ebcdicfisea': - return 'EBCDIC-FI-SE-A'; - - case 'csebcdicfr': - case 'ebcdicfr': - return 'EBCDIC-FR'; - - case 'csebcdicit': - case 'ebcdicit': - return 'EBCDIC-IT'; - - case 'csebcdicpt': - case 'ebcdicpt': - return 'EBCDIC-PT'; - - case 'csebcdicuk': - case 'ebcdicuk': - return 'EBCDIC-UK'; - - case 'csebcdicus': - case 'ebcdicus': - return 'EBCDIC-US'; - - case 'csiso111ecmacyrillic': - case 'ecmacyrillic': - case 'isoir111': - case 'koi8e': - return 'ECMA-cyrillic'; - - case 'csiso17spanish': - case 'es': - case 'iso646es': - case 'isoir17': - return 'ES'; - - case 'csiso85spanish2': - case 'es2': - case 'iso646es2': - case 'isoir85': - return 'ES2'; - - case 'cseucpkdfmtjapanese': - case 'eucjp': - case 'extendedunixcodepackedformatforjapanese': - return 'EUC-JP'; - - case 'cseucfixwidjapanese': - case 'extendedunixcodefixedwidthforjapanese': - return 'Extended_UNIX_Code_Fixed_Width_for_Japanese'; - - case 'gb18030': - return 'GB18030'; - - case 'chinese': - case 'cp936': - case 'csgb2312': - case 'csiso58gb231280': - case 'gb2312': - case 'gb231280': - case 'gbk': - case 'isoir58': - case 'ms936': - case 'windows936': - return 'GBK'; - - case 'cn': - case 'csiso57gb1988': - case 'gb198880': - case 'iso646cn': - case 'isoir57': - return 'GB_1988-80'; - - case 'csiso153gost1976874': - case 'gost1976874': - case 'isoir153': - case 'stsev35888': - return 'GOST_19768-74'; - - case 'csiso150': - case 'csiso150greekccitt': - case 'greekccitt': - case 'isoir150': - return 'greek-ccitt'; - - case 'csiso88greek7': - case 'greek7': - case 'isoir88': - return 'greek7'; - - case 'csiso18greek7old': - case 'greek7old': - case 'isoir18': - return 'greek7-old'; - - case 'cshpdesktop': - case 'hpdesktop': - return 'HP-DeskTop'; - - case 'cshplegal': - case 'hplegal': - return 'HP-Legal'; - - case 'cshpmath8': - case 'hpmath8': - return 'HP-Math8'; - - case 'cshppifont': - case 'hppifont': - return 'HP-Pi-font'; - - case 'cshproman8': - case 'hproman8': - case 'r8': - case 'roman8': - return 'hp-roman8'; - - case 'hzgb2312': - return 'HZ-GB-2312'; - - case 'csibmsymbols': - case 'ibmsymbols': - return 'IBM-Symbols'; - - case 'csibmthai': - case 'ibmthai': - return 'IBM-Thai'; - - case 'cp37': - case 'csibm37': - case 'ebcdiccpca': - case 'ebcdiccpnl': - case 'ebcdiccpus': - case 'ebcdiccpwt': - case 'ibm37': - return 'IBM037'; - - case 'cp38': - case 'csibm38': - case 'ebcdicint': - case 'ibm38': - return 'IBM038'; - - case 'cp273': - case 'csibm273': - case 'ibm273': - return 'IBM273'; - - case 'cp274': - case 'csibm274': - case 'ebcdicbe': - case 'ibm274': - return 'IBM274'; - - case 'cp275': - case 'csibm275': - case 'ebcdicbr': - case 'ibm275': - return 'IBM275'; - - case 'csibm277': - case 'ebcdiccpdk': - case 'ebcdiccpno': - case 'ibm277': - return 'IBM277'; - - case 'cp278': - case 'csibm278': - case 'ebcdiccpfi': - case 'ebcdiccpse': - case 'ibm278': - return 'IBM278'; - - case 'cp280': - case 'csibm280': - case 'ebcdiccpit': - case 'ibm280': - return 'IBM280'; - - case 'cp281': - case 'csibm281': - case 'ebcdicjpe': - case 'ibm281': - return 'IBM281'; - - case 'cp284': - case 'csibm284': - case 'ebcdiccpes': - case 'ibm284': - return 'IBM284'; - - case 'cp285': - case 'csibm285': - case 'ebcdiccpgb': - case 'ibm285': - return 'IBM285'; - - case 'cp290': - case 'csibm290': - case 'ebcdicjpkana': - case 'ibm290': - return 'IBM290'; - - case 'cp297': - case 'csibm297': - case 'ebcdiccpfr': - case 'ibm297': - return 'IBM297'; - - case 'cp420': - case 'csibm420': - case 'ebcdiccpar1': - case 'ibm420': - return 'IBM420'; - - case 'cp423': - case 'csibm423': - case 'ebcdiccpgr': - case 'ibm423': - return 'IBM423'; - - case 'cp424': - case 'csibm424': - case 'ebcdiccphe': - case 'ibm424': - return 'IBM424'; - - case '437': - case 'cp437': - case 'cspc8codepage437': - case 'ibm437': - return 'IBM437'; - - case 'cp500': - case 'csibm500': - case 'ebcdiccpbe': - case 'ebcdiccpch': - case 'ibm500': - return 'IBM500'; - - case 'cp775': - case 'cspc775baltic': - case 'ibm775': - return 'IBM775'; - - case '850': - case 'cp850': - case 'cspc850multilingual': - case 'ibm850': - return 'IBM850'; - - case '851': - case 'cp851': - case 'csibm851': - case 'ibm851': - return 'IBM851'; - - case '852': - case 'cp852': - case 'cspcp852': - case 'ibm852': - return 'IBM852'; - - case '855': - case 'cp855': - case 'csibm855': - case 'ibm855': - return 'IBM855'; - - case '857': - case 'cp857': - case 'csibm857': - case 'ibm857': - return 'IBM857'; - - case 'ccsid858': - case 'cp858': - case 'ibm858': - case 'pcmultilingual850euro': - return 'IBM00858'; - - case '860': - case 'cp860': - case 'csibm860': - case 'ibm860': - return 'IBM860'; - - case '861': - case 'cp861': - case 'cpis': - case 'csibm861': - case 'ibm861': - return 'IBM861'; - - case '862': - case 'cp862': - case 'cspc862latinhebrew': - case 'ibm862': - return 'IBM862'; - - case '863': - case 'cp863': - case 'csibm863': - case 'ibm863': - return 'IBM863'; - - case 'cp864': - case 'csibm864': - case 'ibm864': - return 'IBM864'; - - case '865': - case 'cp865': - case 'csibm865': - case 'ibm865': - return 'IBM865'; - - case '866': - case 'cp866': - case 'csibm866': - case 'ibm866': - return 'IBM866'; - - case 'cp868': - case 'cpar': - case 'csibm868': - case 'ibm868': - return 'IBM868'; - - case '869': - case 'cp869': - case 'cpgr': - case 'csibm869': - case 'ibm869': - return 'IBM869'; - - case 'cp870': - case 'csibm870': - case 'ebcdiccproece': - case 'ebcdiccpyu': - case 'ibm870': - return 'IBM870'; - - case 'cp871': - case 'csibm871': - case 'ebcdiccpis': - case 'ibm871': - return 'IBM871'; - - case 'cp880': - case 'csibm880': - case 'ebcdiccyrillic': - case 'ibm880': - return 'IBM880'; - - case 'cp891': - case 'csibm891': - case 'ibm891': - return 'IBM891'; - - case 'cp903': - case 'csibm903': - case 'ibm903': - return 'IBM903'; - - case '904': - case 'cp904': - case 'csibbm904': - case 'ibm904': - return 'IBM904'; - - case 'cp905': - case 'csibm905': - case 'ebcdiccptr': - case 'ibm905': - return 'IBM905'; - - case 'cp918': - case 'csibm918': - case 'ebcdiccpar2': - case 'ibm918': - return 'IBM918'; - - case 'ccsid924': - case 'cp924': - case 'ebcdiclatin9euro': - case 'ibm924': - return 'IBM00924'; - - case 'cp1026': - case 'csibm1026': - case 'ibm1026': - return 'IBM1026'; - - case 'ibm1047': - return 'IBM1047'; - - case 'ccsid1140': - case 'cp1140': - case 'ebcdicus37euro': - case 'ibm1140': - return 'IBM01140'; - - case 'ccsid1141': - case 'cp1141': - case 'ebcdicde273euro': - case 'ibm1141': - return 'IBM01141'; - - case 'ccsid1142': - case 'cp1142': - case 'ebcdicdk277euro': - case 'ebcdicno277euro': - case 'ibm1142': - return 'IBM01142'; - - case 'ccsid1143': - case 'cp1143': - case 'ebcdicfi278euro': - case 'ebcdicse278euro': - case 'ibm1143': - return 'IBM01143'; - - case 'ccsid1144': - case 'cp1144': - case 'ebcdicit280euro': - case 'ibm1144': - return 'IBM01144'; - - case 'ccsid1145': - case 'cp1145': - case 'ebcdices284euro': - case 'ibm1145': - return 'IBM01145'; - - case 'ccsid1146': - case 'cp1146': - case 'ebcdicgb285euro': - case 'ibm1146': - return 'IBM01146'; - - case 'ccsid1147': - case 'cp1147': - case 'ebcdicfr297euro': - case 'ibm1147': - return 'IBM01147'; - - case 'ccsid1148': - case 'cp1148': - case 'ebcdicinternational500euro': - case 'ibm1148': - return 'IBM01148'; - - case 'ccsid1149': - case 'cp1149': - case 'ebcdicis871euro': - case 'ibm1149': - return 'IBM01149'; - - case 'csiso143iecp271': - case 'iecp271': - case 'isoir143': - return 'IEC_P27-1'; - - case 'csiso49inis': - case 'inis': - case 'isoir49': - return 'INIS'; - - case 'csiso50inis8': - case 'inis8': - case 'isoir50': - return 'INIS-8'; - - case 'csiso51iniscyrillic': - case 'iniscyrillic': - case 'isoir51': - return 'INIS-cyrillic'; - - case 'csinvariant': - case 'invariant': - return 'INVARIANT'; - - case 'iso2022cn': - return 'ISO-2022-CN'; - - case 'iso2022cnext': - return 'ISO-2022-CN-EXT'; - - case 'csiso2022jp': - case 'iso2022jp': - return 'ISO-2022-JP'; - - case 'csiso2022jp2': - case 'iso2022jp2': - return 'ISO-2022-JP-2'; - - case 'csiso2022kr': - case 'iso2022kr': - return 'ISO-2022-KR'; - - case 'cswindows30latin1': - case 'iso88591windows30latin1': - return 'ISO-8859-1-Windows-3.0-Latin-1'; - - case 'cswindows31latin1': - case 'iso88591windows31latin1': - return 'ISO-8859-1-Windows-3.1-Latin-1'; - - case 'csisolatin2': - case 'iso88592': - case 'iso885921987': - case 'isoir101': - case 'l2': - case 'latin2': - return 'ISO-8859-2'; - - case 'cswindows31latin2': - case 'iso88592windowslatin2': - return 'ISO-8859-2-Windows-Latin-2'; - - case 'csisolatin3': - case 'iso88593': - case 'iso885931988': - case 'isoir109': - case 'l3': - case 'latin3': - return 'ISO-8859-3'; - - case 'csisolatin4': - case 'iso88594': - case 'iso885941988': - case 'isoir110': - case 'l4': - case 'latin4': - return 'ISO-8859-4'; - - case 'csisolatincyrillic': - case 'cyrillic': - case 'iso88595': - case 'iso885951988': - case 'isoir144': - return 'ISO-8859-5'; - - case 'arabic': - case 'asmo708': - case 'csisolatinarabic': - case 'ecma114': - case 'iso88596': - case 'iso885961987': - case 'isoir127': - return 'ISO-8859-6'; - - case 'csiso88596e': - case 'iso88596e': - return 'ISO-8859-6-E'; - - case 'csiso88596i': - case 'iso88596i': - return 'ISO-8859-6-I'; - - case 'csisolatingreek': - case 'ecma118': - case 'elot928': - case 'greek': - case 'greek8': - case 'iso88597': - case 'iso885971987': - case 'isoir126': - return 'ISO-8859-7'; - - case 'csisolatinhebrew': - case 'hebrew': - case 'iso88598': - case 'iso885981988': - case 'isoir138': - return 'ISO-8859-8'; - - case 'csiso88598e': - case 'iso88598e': - return 'ISO-8859-8-E'; - - case 'csiso88598i': - case 'iso88598i': - return 'ISO-8859-8-I'; - - case 'cswindows31latin5': - case 'iso88599windowslatin5': - return 'ISO-8859-9-Windows-Latin-5'; - - case 'csisolatin6': - case 'iso885910': - case 'iso8859101992': - case 'isoir157': - case 'l6': - case 'latin6': - return 'ISO-8859-10'; - - case 'iso885913': - return 'ISO-8859-13'; - - case 'iso885914': - case 'iso8859141998': - case 'isoceltic': - case 'isoir199': - case 'l8': - case 'latin8': - return 'ISO-8859-14'; - - case 'iso885915': - case 'latin9': - return 'ISO-8859-15'; - - case 'iso885916': - case 'iso8859162001': - case 'isoir226': - case 'l10': - case 'latin10': - return 'ISO-8859-16'; - - case 'iso10646j1': - return 'ISO-10646-J-1'; - - case 'csunicode': - case 'iso10646ucs2': - return 'ISO-10646-UCS-2'; - - case 'csucs4': - case 'iso10646ucs4': - return 'ISO-10646-UCS-4'; - - case 'csunicodeascii': - case 'iso10646ucsbasic': - return 'ISO-10646-UCS-Basic'; - - case 'csunicodelatin1': - case 'iso10646': - case 'iso10646unicodelatin1': - return 'ISO-10646-Unicode-Latin1'; - - case 'csiso10646utf1': - case 'iso10646utf1': - return 'ISO-10646-UTF-1'; - - case 'csiso115481': - case 'iso115481': - case 'isotr115481': - return 'ISO-11548-1'; - - case 'csiso90': - case 'isoir90': - return 'iso-ir-90'; - - case 'csunicodeibm1261': - case 'isounicodeibm1261': - return 'ISO-Unicode-IBM-1261'; - - case 'csunicodeibm1264': - case 'isounicodeibm1264': - return 'ISO-Unicode-IBM-1264'; - - case 'csunicodeibm1265': - case 'isounicodeibm1265': - return 'ISO-Unicode-IBM-1265'; - - case 'csunicodeibm1268': - case 'isounicodeibm1268': - return 'ISO-Unicode-IBM-1268'; - - case 'csunicodeibm1276': - case 'isounicodeibm1276': - return 'ISO-Unicode-IBM-1276'; - - case 'csiso646basic1983': - case 'iso646basic1983': - case 'ref': - return 'ISO_646.basic:1983'; - - case 'csiso2intlrefversion': - case 'irv': - case 'iso646irv1983': - case 'isoir2': - return 'ISO_646.irv:1983'; - - case 'csiso2033': - case 'e13b': - case 'iso20331983': - case 'isoir98': - return 'ISO_2033-1983'; - - case 'csiso5427cyrillic': - case 'iso5427': - case 'isoir37': - return 'ISO_5427'; - - case 'iso5427cyrillic1981': - case 'iso54271981': - case 'isoir54': - return 'ISO_5427:1981'; - - case 'csiso5428greek': - case 'iso54281980': - case 'isoir55': - return 'ISO_5428:1980'; - - case 'csiso6937add': - case 'iso6937225': - case 'isoir152': - return 'ISO_6937-2-25'; - - case 'csisotextcomm': - case 'iso69372add': - case 'isoir142': - return 'ISO_6937-2-add'; - - case 'csiso8859supp': - case 'iso8859supp': - case 'isoir154': - case 'latin125': - return 'ISO_8859-supp'; - - case 'csiso10367box': - case 'iso10367box': - case 'isoir155': - return 'ISO_10367-box'; - - case 'csiso15italian': - case 'iso646it': - case 'isoir15': - case 'it': - return 'IT'; - - case 'csiso13jisc6220jp': - case 'isoir13': - case 'jisc62201969': - case 'jisc62201969jp': - case 'katakana': - case 'x2017': - return 'JIS_C6220-1969-jp'; - - case 'csiso14jisc6220ro': - case 'iso646jp': - case 'isoir14': - case 'jisc62201969ro': - case 'jp': - return 'JIS_C6220-1969-ro'; - - case 'csiso42jisc62261978': - case 'isoir42': - case 'jisc62261978': - return 'JIS_C6226-1978'; - - case 'csiso87jisx208': - case 'isoir87': - case 'jisc62261983': - case 'jisx2081983': - case 'x208': - return 'JIS_C6226-1983'; - - case 'csiso91jisc62291984a': - case 'isoir91': - case 'jisc62291984a': - case 'jpocra': - return 'JIS_C6229-1984-a'; - - case 'csiso92jisc62991984b': - case 'iso646jpocrb': - case 'isoir92': - case 'jisc62291984b': - case 'jpocrb': - return 'JIS_C6229-1984-b'; - - case 'csiso93jis62291984badd': - case 'isoir93': - case 'jisc62291984badd': - case 'jpocrbadd': - return 'JIS_C6229-1984-b-add'; - - case 'csiso94jis62291984hand': - case 'isoir94': - case 'jisc62291984hand': - case 'jpocrhand': - return 'JIS_C6229-1984-hand'; - - case 'csiso95jis62291984handadd': - case 'isoir95': - case 'jisc62291984handadd': - case 'jpocrhandadd': - return 'JIS_C6229-1984-hand-add'; - - case 'csiso96jisc62291984kana': - case 'isoir96': - case 'jisc62291984kana': - return 'JIS_C6229-1984-kana'; - - case 'csjisencoding': - case 'jisencoding': - return 'JIS_Encoding'; - - case 'cshalfwidthkatakana': - case 'jisx201': - case 'x201': - return 'JIS_X0201'; - - case 'csiso159jisx2121990': - case 'isoir159': - case 'jisx2121990': - case 'x212': - return 'JIS_X0212-1990'; - - case 'csiso141jusib1002': - case 'iso646yu': - case 'isoir141': - case 'js': - case 'jusib1002': - case 'yu': - return 'JUS_I.B1.002'; - - case 'csiso147macedonian': - case 'isoir147': - case 'jusib1003mac': - case 'macedonian': - return 'JUS_I.B1.003-mac'; - - case 'csiso146serbian': - case 'isoir146': - case 'jusib1003serb': - case 'serbian': - return 'JUS_I.B1.003-serb'; - - case 'koi7switched': - return 'KOI7-switched'; - - case 'cskoi8r': - case 'koi8r': - return 'KOI8-R'; - - case 'koi8u': - return 'KOI8-U'; - - case 'csksc5636': - case 'iso646kr': - case 'ksc5636': - return 'KSC5636'; - - case 'cskz1048': - case 'kz1048': - case 'rk1048': - case 'strk10482002': - return 'KZ-1048'; - - case 'csiso19latingreek': - case 'isoir19': - case 'latingreek': - return 'latin-greek'; - - case 'csiso27latingreek1': - case 'isoir27': - case 'latingreek1': - return 'Latin-greek-1'; - - case 'csiso158lap': - case 'isoir158': - case 'lap': - case 'latinlap': - return 'latin-lap'; - - case 'csmacintosh': - case 'mac': - case 'macintosh': - return 'macintosh'; - - case 'csmicrosoftpublishing': - case 'microsoftpublishing': - return 'Microsoft-Publishing'; - - case 'csmnem': - case 'mnem': - return 'MNEM'; - - case 'csmnemonic': - case 'mnemonic': - return 'MNEMONIC'; - - case 'csiso86hungarian': - case 'hu': - case 'iso646hu': - case 'isoir86': - case 'msz77953': - return 'MSZ_7795.3'; - - case 'csnatsdano': - case 'isoir91': - case 'natsdano': - return 'NATS-DANO'; - - case 'csnatsdanoadd': - case 'isoir92': - case 'natsdanoadd': - return 'NATS-DANO-ADD'; - - case 'csnatssefi': - case 'isoir81': - case 'natssefi': - return 'NATS-SEFI'; - - case 'csnatssefiadd': - case 'isoir82': - case 'natssefiadd': - return 'NATS-SEFI-ADD'; - - case 'csiso151cuba': - case 'cuba': - case 'iso646cu': - case 'isoir151': - case 'ncnc1081': - return 'NC_NC00-10:81'; - - case 'csiso69french': - case 'fr': - case 'iso646fr': - case 'isoir69': - case 'nfz62010': - return 'NF_Z_62-010'; - - case 'csiso25french': - case 'iso646fr1': - case 'isoir25': - case 'nfz620101973': - return 'NF_Z_62-010_(1973)'; - - case 'csiso60danishnorwegian': - case 'csiso60norwegian1': - case 'iso646no': - case 'isoir60': - case 'no': - case 'ns45511': - return 'NS_4551-1'; - - case 'csiso61norwegian2': - case 'iso646no2': - case 'isoir61': - case 'no2': - case 'ns45512': - return 'NS_4551-2'; - - case 'osdebcdicdf3irv': - return 'OSD_EBCDIC_DF03_IRV'; - - case 'osdebcdicdf41': - return 'OSD_EBCDIC_DF04_1'; - - case 'osdebcdicdf415': - return 'OSD_EBCDIC_DF04_15'; - - case 'cspc8danishnorwegian': - case 'pc8danishnorwegian': - return 'PC8-Danish-Norwegian'; - - case 'cspc8turkish': - case 'pc8turkish': - return 'PC8-Turkish'; - - case 'csiso16portuguese': - case 'iso646pt': - case 'isoir16': - case 'pt': - return 'PT'; - - case 'csiso84portuguese2': - case 'iso646pt2': - case 'isoir84': - case 'pt2': - return 'PT2'; - - case 'cp154': - case 'csptcp154': - case 'cyrillicasian': - case 'pt154': - case 'ptcp154': - return 'PTCP154'; - - case 'scsu': - return 'SCSU'; - - case 'csiso10swedish': - case 'fi': - case 'iso646fi': - case 'iso646se': - case 'isoir10': - case 'se': - case 'sen850200b': - return 'SEN_850200_B'; - - case 'csiso11swedishfornames': - case 'iso646se2': - case 'isoir11': - case 'se2': - case 'sen850200c': - return 'SEN_850200_C'; - - case 'csiso102t617bit': - case 'isoir102': - case 't617bit': - return 'T.61-7bit'; - - case 'csiso103t618bit': - case 'isoir103': - case 't61': - case 't618bit': - return 'T.61-8bit'; - - case 'csiso128t101g2': - case 'isoir128': - case 't101g2': - return 'T.101-G2'; - - case 'cstscii': - case 'tscii': - return 'TSCII'; - - case 'csunicode11': - case 'unicode11': - return 'UNICODE-1-1'; - - case 'csunicode11utf7': - case 'unicode11utf7': - return 'UNICODE-1-1-UTF-7'; - - case 'csunknown8bit': - case 'unknown8bit': - return 'UNKNOWN-8BIT'; - - case 'ansix341968': - case 'ansix341986': - case 'ascii': - case 'cp367': - case 'csascii': - case 'ibm367': - case 'iso646irv1991': - case 'iso646us': - case 'isoir6': - case 'us': - case 'usascii': - return 'US-ASCII'; - - case 'csusdk': - case 'usdk': - return 'us-dk'; - - case 'utf7': - return 'UTF-7'; - - case 'utf8': - return 'UTF-8'; - - case 'utf16': - return 'UTF-16'; - - case 'utf16be': - return 'UTF-16BE'; - - case 'utf16le': - return 'UTF-16LE'; - - case 'utf32': - return 'UTF-32'; - - case 'utf32be': - return 'UTF-32BE'; - - case 'utf32le': - return 'UTF-32LE'; - - case 'csventurainternational': - case 'venturainternational': - return 'Ventura-International'; - - case 'csventuramath': - case 'venturamath': - return 'Ventura-Math'; - - case 'csventuraus': - case 'venturaus': - return 'Ventura-US'; - - case 'csiso70videotexsupp1': - case 'isoir70': - case 'videotexsuppl': - return 'videotex-suppl'; - - case 'csviqr': - case 'viqr': - return 'VIQR'; - - case 'csviscii': - case 'viscii': - return 'VISCII'; - - case 'csshiftjis': - case 'cswindows31j': - case 'mskanji': - case 'shiftjis': - case 'windows31j': - return 'Windows-31J'; - - case 'iso885911': - case 'tis620': - return 'windows-874'; - - case 'cseuckr': - case 'csksc56011987': - case 'euckr': - case 'isoir149': - case 'korean': - case 'ksc5601': - case 'ksc56011987': - case 'ksc56011989': - case 'windows949': - return 'windows-949'; - - case 'windows1250': - return 'windows-1250'; - - case 'windows1251': - return 'windows-1251'; - - case 'cp819': - case 'csisolatin1': - case 'ibm819': - case 'iso88591': - case 'iso885911987': - case 'isoir100': - case 'l1': - case 'latin1': - case 'windows1252': - return 'windows-1252'; - - case 'windows1253': - return 'windows-1253'; - - case 'csisolatin5': - case 'iso88599': - case 'iso885991989': - case 'isoir148': - case 'l5': - case 'latin5': - case 'windows1254': - return 'windows-1254'; - - case 'windows1255': - return 'windows-1255'; - - case 'windows1256': - return 'windows-1256'; - - case 'windows1257': - return 'windows-1257'; - - case 'windows1258': - return 'windows-1258'; - - default: - return $charset; - } - } - - public static function get_curl_version() - { - if (is_array($curl = curl_version())) - { - $curl = $curl['version']; - } - elseif (substr($curl, 0, 5) === 'curl/') - { - $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5)); - } - elseif (substr($curl, 0, 8) === 'libcurl/') - { - $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8)); - } - else - { - $curl = 0; - } - return $curl; - } - - /** - * Strip HTML comments - * - * @param string $data Data to strip comments from - * @return string Comment stripped string - */ - public static function strip_comments($data) - { - $output = ''; - while (($start = strpos($data, '<!--')) !== false) - { - $output .= substr($data, 0, $start); - if (($end = strpos($data, '-->', $start)) !== false) - { - $data = substr_replace($data, '', 0, $end + 3); - } - else - { - $data = ''; - } - } - return $output . $data; - } - - public static function parse_date($dt) - { - $parser = SimplePie_Parse_Date::get(); - return $parser->parse($dt); - } - - /** - * Decode HTML entities - * - * @deprecated Use DOMDocument instead - * @param string $data Input data - * @return string Output data - */ - public static function entities_decode($data) - { - $decoder = new SimplePie_Decode_HTML_Entities($data); - return $decoder->parse(); - } - - /** - * Remove RFC822 comments - * - * @param string $data Data to strip comments from - * @return string Comment stripped string - */ - public static function uncomment_rfc822($string) - { - $string = (string) $string; - $position = 0; - $length = strlen($string); - $depth = 0; - - $output = ''; - - while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) - { - $output .= substr($string, $position, $pos - $position); - $position = $pos + 1; - if ($string[$pos - 1] !== '\\') - { - $depth++; - while ($depth && $position < $length) - { - $position += strcspn($string, '()', $position); - if ($string[$position - 1] === '\\') - { - $position++; - continue; - } - elseif (isset($string[$position])) - { - switch ($string[$position]) - { - case '(': - $depth++; - break; - - case ')': - $depth--; - break; - } - $position++; - } - else - { - break; - } - } - } - else - { - $output .= '('; - } - } - $output .= substr($string, $position); - - return $output; - } - - public static function parse_mime($mime) - { - if (($pos = strpos($mime, ';')) === false) - { - return trim($mime); - } - else - { - return trim(substr($mime, 0, $pos)); - } - } - - public static function atom_03_construct_type($attribs) - { - if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64')) - { - $mode = SIMPLEPIE_CONSTRUCT_BASE64; - } - else - { - $mode = SIMPLEPIE_CONSTRUCT_NONE; - } - if (isset($attribs['']['type'])) - { - switch (strtolower(trim($attribs['']['type']))) - { - case 'text': - case 'text/plain': - return SIMPLEPIE_CONSTRUCT_TEXT | $mode; - - case 'html': - case 'text/html': - return SIMPLEPIE_CONSTRUCT_HTML | $mode; - - case 'xhtml': - case 'application/xhtml+xml': - return SIMPLEPIE_CONSTRUCT_XHTML | $mode; - - default: - return SIMPLEPIE_CONSTRUCT_NONE | $mode; - } - } - else - { - return SIMPLEPIE_CONSTRUCT_TEXT | $mode; - } - } - - public static function atom_10_construct_type($attribs) - { - if (isset($attribs['']['type'])) - { - switch (strtolower(trim($attribs['']['type']))) - { - case 'text': - return SIMPLEPIE_CONSTRUCT_TEXT; - - case 'html': - return SIMPLEPIE_CONSTRUCT_HTML; - - case 'xhtml': - return SIMPLEPIE_CONSTRUCT_XHTML; - - default: - return SIMPLEPIE_CONSTRUCT_NONE; - } - } - return SIMPLEPIE_CONSTRUCT_TEXT; - } - - public static function atom_10_content_construct_type($attribs) - { - if (isset($attribs['']['type'])) - { - $type = strtolower(trim($attribs['']['type'])); - switch ($type) - { - case 'text': - return SIMPLEPIE_CONSTRUCT_TEXT; - - case 'html': - return SIMPLEPIE_CONSTRUCT_HTML; - - case 'xhtml': - return SIMPLEPIE_CONSTRUCT_XHTML; - } - if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/') - { - return SIMPLEPIE_CONSTRUCT_NONE; - } - else - { - return SIMPLEPIE_CONSTRUCT_BASE64; - } - } - else - { - return SIMPLEPIE_CONSTRUCT_TEXT; - } - } - - public static function is_isegment_nz_nc($string) - { - return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string); - } - - public static function space_seperated_tokens($string) - { - $space_characters = "\x20\x09\x0A\x0B\x0C\x0D"; - $string_length = strlen($string); - - $position = strspn($string, $space_characters); - $tokens = array(); - - while ($position < $string_length) - { - $len = strcspn($string, $space_characters, $position); - $tokens[] = substr($string, $position, $len); - $position += $len; - $position += strspn($string, $space_characters, $position); - } - - return $tokens; - } - - /** - * Converts a unicode codepoint to a UTF-8 character - * - * @static - * @param int $codepoint Unicode codepoint - * @return string UTF-8 character - */ - public static function codepoint_to_utf8($codepoint) - { - $codepoint = (int) $codepoint; - if ($codepoint < 0) - { - return false; - } - else if ($codepoint <= 0x7f) - { - return chr($codepoint); - } - else if ($codepoint <= 0x7ff) - { - return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f)); - } - else if ($codepoint <= 0xffff) - { - return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); - } - else if ($codepoint <= 0x10ffff) - { - return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); - } - else - { - // U+FFFD REPLACEMENT CHARACTER - return "\xEF\xBF\xBD"; - } - } - - /** - * Similar to parse_str() - * - * Returns an associative array of name/value pairs, where the value is an - * array of values that have used the same name - * - * @static - * @param string $str The input string. - * @return array - */ - public static function parse_str($str) - { - $return = array(); - $str = explode('&', $str); - - foreach ($str as $section) - { - if (strpos($section, '=') !== false) - { - list($name, $value) = explode('=', $section, 2); - $return[urldecode($name)][] = urldecode($value); - } - else - { - $return[urldecode($section)][] = null; - } - } - - return $return; - } - - /** - * Detect XML encoding, as per XML 1.0 Appendix F.1 - * - * @todo Add support for EBCDIC - * @param string $data XML data - * @param SimplePie_Registry $registry Class registry - * @return array Possible encodings - */ - public static function xml_encoding($data, $registry) - { - // UTF-32 Big Endian BOM - if (substr($data, 0, 4) === "\x00\x00\xFE\xFF") - { - $encoding[] = 'UTF-32BE'; - } - // UTF-32 Little Endian BOM - elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00") - { - $encoding[] = 'UTF-32LE'; - } - // UTF-16 Big Endian BOM - elseif (substr($data, 0, 2) === "\xFE\xFF") - { - $encoding[] = 'UTF-16BE'; - } - // UTF-16 Little Endian BOM - elseif (substr($data, 0, 2) === "\xFF\xFE") - { - $encoding[] = 'UTF-16LE'; - } - // UTF-8 BOM - elseif (substr($data, 0, 3) === "\xEF\xBB\xBF") - { - $encoding[] = 'UTF-8'; - } - // UTF-32 Big Endian Without BOM - elseif (substr($data, 0, 20) === "\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C") - { - if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E")) - { - $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'))); - if ($parser->parse()) - { - $encoding[] = $parser->encoding; - } - } - $encoding[] = 'UTF-32BE'; - } - // UTF-32 Little Endian Without BOM - elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00") - { - if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00")) - { - $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'))); - if ($parser->parse()) - { - $encoding[] = $parser->encoding; - } - } - $encoding[] = 'UTF-32LE'; - } - // UTF-16 Big Endian Without BOM - elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C") - { - if ($pos = strpos($data, "\x00\x3F\x00\x3E")) - { - $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'))); - if ($parser->parse()) - { - $encoding[] = $parser->encoding; - } - } - $encoding[] = 'UTF-16BE'; - } - // UTF-16 Little Endian Without BOM - elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00") - { - if ($pos = strpos($data, "\x3F\x00\x3E\x00")) - { - $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'))); - if ($parser->parse()) - { - $encoding[] = $parser->encoding; - } - } - $encoding[] = 'UTF-16LE'; - } - // US-ASCII (or superset) - elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C") - { - if ($pos = strpos($data, "\x3F\x3E")) - { - $parser = $registry->create('XML_Declaration_Parser', array(substr($data, 5, $pos - 5))); - if ($parser->parse()) - { - $encoding[] = $parser->encoding; - } - } - $encoding[] = 'UTF-8'; - } - // Fallback to UTF-8 - else - { - $encoding[] = 'UTF-8'; - } - return $encoding; - } - - public static function output_javascript() - { - if (function_exists('ob_gzhandler')) - { - ob_start('ob_gzhandler'); - } - header('Content-type: text/javascript; charset: UTF-8'); - header('Cache-Control: must-revalidate'); - header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days - ?> -function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) { - if (placeholder != '') { - document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>'); - } - else { - document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" src="'+link+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="true" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>'); - } -} - -function embed_flash(bgcolor, width, height, link, loop, type) { - document.writeln('<embed src="'+link+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="'+type+'" quality="high" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" loop="'+loop+'"></embed>'); -} - -function embed_flv(width, height, link, placeholder, loop, player) { - document.writeln('<embed src="'+player+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="'+width+'" height="'+height+'" wmode="transparent" flashvars="file='+link+'&autostart=false&repeat='+loop+'&showdigits=true&showfsbutton=false"></embed>'); -} - -function embed_wmedia(width, height, link) { - document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>'); -} - <?php - } - - /** - * Get the SimplePie build timestamp - * - * Uses the git index if it exists, otherwise uses the modification time - * of the newest file. - */ - public static function get_build() - { - $root = dirname(dirname(__FILE__)); - if (file_exists($root . '/.git/index')) - { - return filemtime($root . '/.git/index'); - } - elseif (file_exists($root . '/SimplePie')) - { - $time = 0; - foreach (glob($root . '/SimplePie/*.php') as $file) - { - if (($mtime = filemtime($file)) > $time) - { - $time = $mtime; - } - } - return $time; - } - elseif (file_exists(dirname(__FILE__) . '/Core.php')) - { - return filemtime(dirname(__FILE__) . '/Core.php'); - } - else - { - return filemtime(__FILE__); - } - } - - /** - * Format debugging information - */ - public static function debug(&$sp) - { - $info = 'SimplePie ' . SIMPLEPIE_VERSION . ' Build ' . SIMPLEPIE_BUILD . "\n"; - $info .= 'PHP ' . PHP_VERSION . "\n"; - if ($sp->error() !== null) - { - $info .= 'Error occurred: ' . $sp->error() . "\n"; - } - else - { - $info .= "No error found.\n"; - } - $info .= "Extensions:\n"; - $extensions = array('pcre', 'curl', 'zlib', 'mbstring', 'iconv', 'xmlreader', 'xml'); - foreach ($extensions as $ext) - { - if (extension_loaded($ext)) - { - $info .= " $ext loaded\n"; - switch ($ext) - { - case 'pcre': - $info .= ' Version ' . PCRE_VERSION . "\n"; - break; - case 'curl': - $version = curl_version(); - $info .= ' Version ' . $version['version'] . "\n"; - break; - case 'mbstring': - $info .= ' Overloading: ' . mb_get_info('func_overload') . "\n"; - break; - case 'iconv': - $info .= ' Version ' . ICONV_VERSION . "\n"; - break; - case 'xml': - $info .= ' Version ' . LIBXML_DOTTED_VERSION . "\n"; - break; - } - } - else - { - $info .= " $ext not loaded\n"; - } - } - return $info; - } - - public static function silence_errors($num, $str) - { - // No-op - } -} -
@@ -1,275 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - - -/** - * Class to validate and to work with IPv6 addresses. - * - * @package SimplePie - * @subpackage HTTP - * @copyright 2003-2005 The PHP Group - * @license http://www.opensource.org/licenses/bsd-license.php - * @link http://pear.php.net/package/Net_IPv6 - * @author Alexander Merz <alexander.merz@web.de> - * @author elfrink at introweb dot nl - * @author Josh Peck <jmp at joshpeck dot org> - * @author Geoffrey Sneddon <geoffers@gmail.com> - */ -class SimplePie_Net_IPv6 -{ - /** - * Uncompresses an IPv6 address - * - * RFC 4291 allows you to compress concecutive zero pieces in an address to - * '::'. This method expects a valid IPv6 address and expands the '::' to - * the required number of zero pieces. - * - * Example: FF01::101 -> FF01:0:0:0:0:0:0:101 - * ::1 -> 0:0:0:0:0:0:0:1 - * - * @author Alexander Merz <alexander.merz@web.de> - * @author elfrink at introweb dot nl - * @author Josh Peck <jmp at joshpeck dot org> - * @copyright 2003-2005 The PHP Group - * @license http://www.opensource.org/licenses/bsd-license.php - * @param string $ip An IPv6 address - * @return string The uncompressed IPv6 address - */ - public static function uncompress($ip) - { - $c1 = -1; - $c2 = -1; - if (substr_count($ip, '::') === 1) - { - list($ip1, $ip2) = explode('::', $ip); - if ($ip1 === '') - { - $c1 = -1; - } - else - { - $c1 = substr_count($ip1, ':'); - } - if ($ip2 === '') - { - $c2 = -1; - } - else - { - $c2 = substr_count($ip2, ':'); - } - if (strpos($ip2, '.') !== false) - { - $c2++; - } - // :: - if ($c1 === -1 && $c2 === -1) - { - $ip = '0:0:0:0:0:0:0:0'; - } - // ::xxx - else if ($c1 === -1) - { - $fill = str_repeat('0:', 7 - $c2); - $ip = str_replace('::', $fill, $ip); - } - // xxx:: - else if ($c2 === -1) - { - $fill = str_repeat(':0', 7 - $c1); - $ip = str_replace('::', $fill, $ip); - } - // xxx::xxx - else - { - $fill = ':' . str_repeat('0:', 6 - $c2 - $c1); - $ip = str_replace('::', $fill, $ip); - } - } - return $ip; - } - - /** - * Compresses an IPv6 address - * - * RFC 4291 allows you to compress concecutive zero pieces in an address to - * '::'. This method expects a valid IPv6 address and compresses consecutive - * zero pieces to '::'. - * - * Example: FF01:0:0:0:0:0:0:101 -> FF01::101 - * 0:0:0:0:0:0:0:1 -> ::1 - * - * @see uncompress() - * @param string $ip An IPv6 address - * @return string The compressed IPv6 address - */ - public static function compress($ip) - { - // Prepare the IP to be compressed - $ip = self::uncompress($ip); - $ip_parts = self::split_v6_v4($ip); - - // Replace all leading zeros - $ip_parts[0] = preg_replace('/(^|:)0+([0-9])/', '\1\2', $ip_parts[0]); - - // Find bunches of zeros - if (preg_match_all('/(?:^|:)(?:0(?::|$))+/', $ip_parts[0], $matches, PREG_OFFSET_CAPTURE)) - { - $max = 0; - $pos = null; - foreach ($matches[0] as $match) - { - if (strlen($match[0]) > $max) - { - $max = strlen($match[0]); - $pos = $match[1]; - } - } - - $ip_parts[0] = substr_replace($ip_parts[0], '::', $pos, $max); - } - - if ($ip_parts[1] !== '') - { - return implode(':', $ip_parts); - } - else - { - return $ip_parts[0]; - } - } - - /** - * Splits an IPv6 address into the IPv6 and IPv4 representation parts - * - * RFC 4291 allows you to represent the last two parts of an IPv6 address - * using the standard IPv4 representation - * - * Example: 0:0:0:0:0:0:13.1.68.3 - * 0:0:0:0:0:FFFF:129.144.52.38 - * - * @param string $ip An IPv6 address - * @return array [0] contains the IPv6 represented part, and [1] the IPv4 represented part - */ - private static function split_v6_v4($ip) - { - if (strpos($ip, '.') !== false) - { - $pos = strrpos($ip, ':'); - $ipv6_part = substr($ip, 0, $pos); - $ipv4_part = substr($ip, $pos + 1); - return array($ipv6_part, $ipv4_part); - } - else - { - return array($ip, ''); - } - } - - /** - * Checks an IPv6 address - * - * Checks if the given IP is a valid IPv6 address - * - * @param string $ip An IPv6 address - * @return bool true if $ip is a valid IPv6 address - */ - public static function check_ipv6($ip) - { - $ip = self::uncompress($ip); - list($ipv6, $ipv4) = self::split_v6_v4($ip); - $ipv6 = explode(':', $ipv6); - $ipv4 = explode('.', $ipv4); - if (count($ipv6) === 8 && count($ipv4) === 1 || count($ipv6) === 6 && count($ipv4) === 4) - { - foreach ($ipv6 as $ipv6_part) - { - // The section can't be empty - if ($ipv6_part === '') - return false; - - // Nor can it be over four characters - if (strlen($ipv6_part) > 4) - return false; - - // Remove leading zeros (this is safe because of the above) - $ipv6_part = ltrim($ipv6_part, '0'); - if ($ipv6_part === '') - $ipv6_part = '0'; - - // Check the value is valid - $value = hexdec($ipv6_part); - if (dechex($value) !== strtolower($ipv6_part) || $value < 0 || $value > 0xFFFF) - return false; - } - if (count($ipv4) === 4) - { - foreach ($ipv4 as $ipv4_part) - { - $value = (int) $ipv4_part; - if ((string) $value !== $ipv4_part || $value < 0 || $value > 0xFF) - return false; - } - } - return true; - } - else - { - return false; - } - } - - /** - * Checks if the given IP is a valid IPv6 address - * - * @codeCoverageIgnore - * @deprecated Use {@see SimplePie_Net_IPv6::check_ipv6()} instead - * @see check_ipv6 - * @param string $ip An IPv6 address - * @return bool true if $ip is a valid IPv6 address - */ - public static function checkIPv6($ip) - { - return self::check_ipv6($ip); - } -}
@@ -1,983 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - - -/** - * Date Parser - * - * @package SimplePie - * @subpackage Parsing - */ -class SimplePie_Parse_Date -{ - /** - * Input data - * - * @access protected - * @var string - */ - var $date; - - /** - * List of days, calendar day name => ordinal day number in the week - * - * @access protected - * @var array - */ - var $day = array( - // English - 'mon' => 1, - 'monday' => 1, - 'tue' => 2, - 'tuesday' => 2, - 'wed' => 3, - 'wednesday' => 3, - 'thu' => 4, - 'thursday' => 4, - 'fri' => 5, - 'friday' => 5, - 'sat' => 6, - 'saturday' => 6, - 'sun' => 7, - 'sunday' => 7, - // Dutch - 'maandag' => 1, - 'dinsdag' => 2, - 'woensdag' => 3, - 'donderdag' => 4, - 'vrijdag' => 5, - 'zaterdag' => 6, - 'zondag' => 7, - // French - 'lundi' => 1, - 'mardi' => 2, - 'mercredi' => 3, - 'jeudi' => 4, - 'vendredi' => 5, - 'samedi' => 6, - 'dimanche' => 7, - // German - 'montag' => 1, - 'dienstag' => 2, - 'mittwoch' => 3, - 'donnerstag' => 4, - 'freitag' => 5, - 'samstag' => 6, - 'sonnabend' => 6, - 'sonntag' => 7, - // Italian - 'lunedì' => 1, - 'martedì' => 2, - 'mercoledì' => 3, - 'giovedì' => 4, - 'venerdì' => 5, - 'sabato' => 6, - 'domenica' => 7, - // Spanish - 'lunes' => 1, - 'martes' => 2, - 'miércoles' => 3, - 'jueves' => 4, - 'viernes' => 5, - 'sábado' => 6, - 'domingo' => 7, - // Finnish - 'maanantai' => 1, - 'tiistai' => 2, - 'keskiviikko' => 3, - 'torstai' => 4, - 'perjantai' => 5, - 'lauantai' => 6, - 'sunnuntai' => 7, - // Hungarian - 'hétfÅ‘' => 1, - 'kedd' => 2, - 'szerda' => 3, - 'csütörtok' => 4, - 'péntek' => 5, - 'szombat' => 6, - 'vasárnap' => 7, - // Greek - 'Δευ' => 1, - 'ΤÏι' => 2, - 'Τετ' => 3, - 'Πεμ' => 4, - 'ΠαÏ' => 5, - 'Σαβ' => 6, - 'ΚυÏ' => 7, - ); - - /** - * List of months, calendar month name => calendar month number - * - * @access protected - * @var array - */ - var $month = array( - // English - 'jan' => 1, - 'january' => 1, - 'feb' => 2, - 'february' => 2, - 'mar' => 3, - 'march' => 3, - 'apr' => 4, - 'april' => 4, - 'may' => 5, - // No long form of May - 'jun' => 6, - 'june' => 6, - 'jul' => 7, - 'july' => 7, - 'aug' => 8, - 'august' => 8, - 'sep' => 9, - 'september' => 9, - 'oct' => 10, - 'october' => 10, - 'nov' => 11, - 'november' => 11, - 'dec' => 12, - 'december' => 12, - // Dutch - 'januari' => 1, - 'februari' => 2, - 'maart' => 3, - 'april' => 4, - 'mei' => 5, - 'juni' => 6, - 'juli' => 7, - 'augustus' => 8, - 'september' => 9, - 'oktober' => 10, - 'november' => 11, - 'december' => 12, - // French - 'janvier' => 1, - 'février' => 2, - 'mars' => 3, - 'avril' => 4, - 'mai' => 5, - 'juin' => 6, - 'juillet' => 7, - 'août' => 8, - 'septembre' => 9, - 'octobre' => 10, - 'novembre' => 11, - 'décembre' => 12, - // German - 'januar' => 1, - 'februar' => 2, - 'märz' => 3, - 'april' => 4, - 'mai' => 5, - 'juni' => 6, - 'juli' => 7, - 'august' => 8, - 'september' => 9, - 'oktober' => 10, - 'november' => 11, - 'dezember' => 12, - // Italian - 'gennaio' => 1, - 'febbraio' => 2, - 'marzo' => 3, - 'aprile' => 4, - 'maggio' => 5, - 'giugno' => 6, - 'luglio' => 7, - 'agosto' => 8, - 'settembre' => 9, - 'ottobre' => 10, - 'novembre' => 11, - 'dicembre' => 12, - // Spanish - 'enero' => 1, - 'febrero' => 2, - 'marzo' => 3, - 'abril' => 4, - 'mayo' => 5, - 'junio' => 6, - 'julio' => 7, - 'agosto' => 8, - 'septiembre' => 9, - 'setiembre' => 9, - 'octubre' => 10, - 'noviembre' => 11, - 'diciembre' => 12, - // Finnish - 'tammikuu' => 1, - 'helmikuu' => 2, - 'maaliskuu' => 3, - 'huhtikuu' => 4, - 'toukokuu' => 5, - 'kesäkuu' => 6, - 'heinäkuu' => 7, - 'elokuu' => 8, - 'suuskuu' => 9, - 'lokakuu' => 10, - 'marras' => 11, - 'joulukuu' => 12, - // Hungarian - 'január' => 1, - 'február' => 2, - 'március' => 3, - 'április' => 4, - 'május' => 5, - 'június' => 6, - 'július' => 7, - 'augusztus' => 8, - 'szeptember' => 9, - 'október' => 10, - 'november' => 11, - 'december' => 12, - // Greek - 'Ιαν' => 1, - 'Φεβ' => 2, - 'Μάώ' => 3, - 'Μαώ' => 3, - 'ΑπÏ' => 4, - 'Μάι' => 5, - 'Μαϊ' => 5, - 'Μαι' => 5, - 'ΙοÏν' => 6, - 'Ιον' => 6, - 'ΙοÏλ' => 7, - 'Ιολ' => 7, - 'ΑÏγ' => 8, - 'Αυγ' => 8, - 'Σεπ' => 9, - 'Οκτ' => 10, - 'ÎοÎ' => 11, - 'Δεκ' => 12, - ); - - /** - * List of timezones, abbreviation => offset from UTC - * - * @access protected - * @var array - */ - var $timezone = array( - 'ACDT' => 37800, - 'ACIT' => 28800, - 'ACST' => 34200, - 'ACT' => -18000, - 'ACWDT' => 35100, - 'ACWST' => 31500, - 'AEDT' => 39600, - 'AEST' => 36000, - 'AFT' => 16200, - 'AKDT' => -28800, - 'AKST' => -32400, - 'AMDT' => 18000, - 'AMT' => -14400, - 'ANAST' => 46800, - 'ANAT' => 43200, - 'ART' => -10800, - 'AZOST' => -3600, - 'AZST' => 18000, - 'AZT' => 14400, - 'BIOT' => 21600, - 'BIT' => -43200, - 'BOT' => -14400, - 'BRST' => -7200, - 'BRT' => -10800, - 'BST' => 3600, - 'BTT' => 21600, - 'CAST' => 18000, - 'CAT' => 7200, - 'CCT' => 23400, - 'CDT' => -18000, - 'CEDT' => 7200, - 'CEST' => 7200, - 'CET' => 3600, - 'CGST' => -7200, - 'CGT' => -10800, - 'CHADT' => 49500, - 'CHAST' => 45900, - 'CIST' => -28800, - 'CKT' => -36000, - 'CLDT' => -10800, - 'CLST' => -14400, - 'COT' => -18000, - 'CST' => -21600, - 'CVT' => -3600, - 'CXT' => 25200, - 'DAVT' => 25200, - 'DTAT' => 36000, - 'EADT' => -18000, - 'EAST' => -21600, - 'EAT' => 10800, - 'ECT' => -18000, - 'EDT' => -14400, - 'EEST' => 10800, - 'EET' => 7200, - 'EGT' => -3600, - 'EKST' => 21600, - 'EST' => -18000, - 'FJT' => 43200, - 'FKDT' => -10800, - 'FKST' => -14400, - 'FNT' => -7200, - 'GALT' => -21600, - 'GEDT' => 14400, - 'GEST' => 10800, - 'GFT' => -10800, - 'GILT' => 43200, - 'GIT' => -32400, - 'GST' => 14400, - 'GST' => -7200, - 'GYT' => -14400, - 'HAA' => -10800, - 'HAC' => -18000, - 'HADT' => -32400, - 'HAE' => -14400, - 'HAP' => -25200, - 'HAR' => -21600, - 'HAST' => -36000, - 'HAT' => -9000, - 'HAY' => -28800, - 'HKST' => 28800, - 'HMT' => 18000, - 'HNA' => -14400, - 'HNC' => -21600, - 'HNE' => -18000, - 'HNP' => -28800, - 'HNR' => -25200, - 'HNT' => -12600, - 'HNY' => -32400, - 'IRDT' => 16200, - 'IRKST' => 32400, - 'IRKT' => 28800, - 'IRST' => 12600, - 'JFDT' => -10800, - 'JFST' => -14400, - 'JST' => 32400, - 'KGST' => 21600, - 'KGT' => 18000, - 'KOST' => 39600, - 'KOVST' => 28800, - 'KOVT' => 25200, - 'KRAST' => 28800, - 'KRAT' => 25200, - 'KST' => 32400, - 'LHDT' => 39600, - 'LHST' => 37800, - 'LINT' => 50400, - 'LKT' => 21600, - 'MAGST' => 43200, - 'MAGT' => 39600, - 'MAWT' => 21600, - 'MDT' => -21600, - 'MESZ' => 7200, - 'MEZ' => 3600, - 'MHT' => 43200, - 'MIT' => -34200, - 'MNST' => 32400, - 'MSDT' => 14400, - 'MSST' => 10800, - 'MST' => -25200, - 'MUT' => 14400, - 'MVT' => 18000, - 'MYT' => 28800, - 'NCT' => 39600, - 'NDT' => -9000, - 'NFT' => 41400, - 'NMIT' => 36000, - 'NOVST' => 25200, - 'NOVT' => 21600, - 'NPT' => 20700, - 'NRT' => 43200, - 'NST' => -12600, - 'NUT' => -39600, - 'NZDT' => 46800, - 'NZST' => 43200, - 'OMSST' => 25200, - 'OMST' => 21600, - 'PDT' => -25200, - 'PET' => -18000, - 'PETST' => 46800, - 'PETT' => 43200, - 'PGT' => 36000, - 'PHOT' => 46800, - 'PHT' => 28800, - 'PKT' => 18000, - 'PMDT' => -7200, - 'PMST' => -10800, - 'PONT' => 39600, - 'PST' => -28800, - 'PWT' => 32400, - 'PYST' => -10800, - 'PYT' => -14400, - 'RET' => 14400, - 'ROTT' => -10800, - 'SAMST' => 18000, - 'SAMT' => 14400, - 'SAST' => 7200, - 'SBT' => 39600, - 'SCDT' => 46800, - 'SCST' => 43200, - 'SCT' => 14400, - 'SEST' => 3600, - 'SGT' => 28800, - 'SIT' => 28800, - 'SRT' => -10800, - 'SST' => -39600, - 'SYST' => 10800, - 'SYT' => 7200, - 'TFT' => 18000, - 'THAT' => -36000, - 'TJT' => 18000, - 'TKT' => -36000, - 'TMT' => 18000, - 'TOT' => 46800, - 'TPT' => 32400, - 'TRUT' => 36000, - 'TVT' => 43200, - 'TWT' => 28800, - 'UYST' => -7200, - 'UYT' => -10800, - 'UZT' => 18000, - 'VET' => -14400, - 'VLAST' => 39600, - 'VLAT' => 36000, - 'VOST' => 21600, - 'VUT' => 39600, - 'WAST' => 7200, - 'WAT' => 3600, - 'WDT' => 32400, - 'WEST' => 3600, - 'WFT' => 43200, - 'WIB' => 25200, - 'WIT' => 32400, - 'WITA' => 28800, - 'WKST' => 18000, - 'WST' => 28800, - 'YAKST' => 36000, - 'YAKT' => 32400, - 'YAPT' => 36000, - 'YEKST' => 21600, - 'YEKT' => 18000, - ); - - /** - * Cached PCRE for SimplePie_Parse_Date::$day - * - * @access protected - * @var string - */ - var $day_pcre; - - /** - * Cached PCRE for SimplePie_Parse_Date::$month - * - * @access protected - * @var string - */ - var $month_pcre; - - /** - * Array of user-added callback methods - * - * @access private - * @var array - */ - var $built_in = array(); - - /** - * Array of user-added callback methods - * - * @access private - * @var array - */ - var $user = array(); - - /** - * Create new SimplePie_Parse_Date object, and set self::day_pcre, - * self::month_pcre, and self::built_in - * - * @access private - */ - public function __construct() - { - $this->day_pcre = '(' . implode(array_keys($this->day), '|') . ')'; - $this->month_pcre = '(' . implode(array_keys($this->month), '|') . ')'; - - static $cache; - if (!isset($cache[get_class($this)])) - { - $all_methods = get_class_methods($this); - - foreach ($all_methods as $method) - { - if (strtolower(substr($method, 0, 5)) === 'date_') - { - $cache[get_class($this)][] = $method; - } - } - } - - foreach ($cache[get_class($this)] as $method) - { - $this->built_in[] = $method; - } - } - - /** - * Get the object - * - * @access public - */ - public static function get() - { - static $object; - if (!$object) - { - $object = new SimplePie_Parse_Date; - } - return $object; - } - - /** - * Parse a date - * - * @final - * @access public - * @param string $date Date to parse - * @return int Timestamp corresponding to date string, or false on failure - */ - public function parse($date) - { - foreach ($this->user as $method) - { - if (($returned = call_user_func($method, $date)) !== false) - { - return $returned; - } - } - - foreach ($this->built_in as $method) - { - if (($returned = call_user_func(array($this, $method), $date)) !== false) - { - return $returned; - } - } - - return false; - } - - /** - * Add a callback method to parse a date - * - * @final - * @access public - * @param callback $callback - */ - public function add_callback($callback) - { - if (is_callable($callback)) - { - $this->user[] = $callback; - } - else - { - trigger_error('User-supplied function must be a valid callback', E_USER_WARNING); - } - } - - /** - * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as - * well as allowing any of upper or lower case "T", horizontal tabs, or - * spaces to be used as the time seperator (including more than one)) - * - * @access protected - * @return int Timestamp - */ - public function date_w3cdtf($date) - { - static $pcre; - if (!$pcre) - { - $year = '([0-9]{4})'; - $month = $day = $hour = $minute = $second = '([0-9]{2})'; - $decimal = '([0-9]*)'; - $zone = '(?:(Z)|([+\-])([0-9]{1,2}):?([0-9]{1,2}))'; - $pcre = '/^' . $year . '(?:-?' . $month . '(?:-?' . $day . '(?:[Tt\x09\x20]+' . $hour . '(?::?' . $minute . '(?::?' . $second . '(?:.' . $decimal . ')?)?)?' . $zone . ')?)?)?$/'; - } - if (preg_match($pcre, $date, $match)) - { - /* - Capturing subpatterns: - 1: Year - 2: Month - 3: Day - 4: Hour - 5: Minute - 6: Second - 7: Decimal fraction of a second - 8: Zulu - 9: Timezone ± - 10: Timezone hours - 11: Timezone minutes - */ - - // Fill in empty matches - for ($i = count($match); $i <= 3; $i++) - { - $match[$i] = '1'; - } - - for ($i = count($match); $i <= 7; $i++) - { - $match[$i] = '0'; - } - - // Numeric timezone - if (isset($match[9]) && $match[9] !== '') - { - $timezone = $match[10] * 3600; - $timezone += $match[11] * 60; - if ($match[9] === '-') - { - $timezone = 0 - $timezone; - } - } - else - { - $timezone = 0; - } - - // Convert the number of seconds to an integer, taking decimals into account - $second = round($match[6] + $match[7] / pow(10, strlen($match[7]))); - - return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone; - } - else - { - return false; - } - } - - /** - * Remove RFC822 comments - * - * @access protected - * @param string $data Data to strip comments from - * @return string Comment stripped string - */ - public function remove_rfc2822_comments($string) - { - $string = (string) $string; - $position = 0; - $length = strlen($string); - $depth = 0; - - $output = ''; - - while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) - { - $output .= substr($string, $position, $pos - $position); - $position = $pos + 1; - if ($pos === 0 || $string[$pos - 1] !== '\\') - { - $depth++; - while ($depth && $position < $length) - { - $position += strcspn($string, '()', $position); - if ($string[$position - 1] === '\\') - { - $position++; - continue; - } - elseif (isset($string[$position])) - { - switch ($string[$position]) - { - case '(': - $depth++; - break; - - case ')': - $depth--; - break; - } - $position++; - } - else - { - break; - } - } - } - else - { - $output .= '('; - } - } - $output .= substr($string, $position); - - return $output; - } - - /** - * Parse RFC2822's date format - * - * @access protected - * @return int Timestamp - */ - public function date_rfc2822($date) - { - static $pcre; - if (!$pcre) - { - $wsp = '[\x09\x20]'; - $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)'; - $optional_fws = $fws . '?'; - $day_name = $this->day_pcre; - $month = $this->month_pcre; - $day = '([0-9]{1,2})'; - $hour = $minute = $second = '([0-9]{2})'; - $year = '([0-9]{2,4})'; - $num_zone = '([+\-])([0-9]{2})([0-9]{2})'; - $character_zone = '([A-Z]{1,5})'; - $zone = '(?:' . $num_zone . '|' . $character_zone . ')'; - $pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i'; - } - if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match)) - { - /* - Capturing subpatterns: - 1: Day name - 2: Day - 3: Month - 4: Year - 5: Hour - 6: Minute - 7: Second - 8: Timezone ± - 9: Timezone hours - 10: Timezone minutes - 11: Alphabetic timezone - */ - - // Find the month number - $month = $this->month[strtolower($match[3])]; - - // Numeric timezone - if ($match[8] !== '') - { - $timezone = $match[9] * 3600; - $timezone += $match[10] * 60; - if ($match[8] === '-') - { - $timezone = 0 - $timezone; - } - } - // Character timezone - elseif (isset($this->timezone[strtoupper($match[11])])) - { - $timezone = $this->timezone[strtoupper($match[11])]; - } - // Assume everything else to be -0000 - else - { - $timezone = 0; - } - - // Deal with 2/3 digit years - if ($match[4] < 50) - { - $match[4] += 2000; - } - elseif ($match[4] < 1000) - { - $match[4] += 1900; - } - - // Second is optional, if it is empty set it to zero - if ($match[7] !== '') - { - $second = $match[7]; - } - else - { - $second = 0; - } - - return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone; - } - else - { - return false; - } - } - - /** - * Parse RFC850's date format - * - * @access protected - * @return int Timestamp - */ - public function date_rfc850($date) - { - static $pcre; - if (!$pcre) - { - $space = '[\x09\x20]+'; - $day_name = $this->day_pcre; - $month = $this->month_pcre; - $day = '([0-9]{1,2})'; - $year = $hour = $minute = $second = '([0-9]{2})'; - $zone = '([A-Z]{1,5})'; - $pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i'; - } - if (preg_match($pcre, $date, $match)) - { - /* - Capturing subpatterns: - 1: Day name - 2: Day - 3: Month - 4: Year - 5: Hour - 6: Minute - 7: Second - 8: Timezone - */ - - // Month - $month = $this->month[strtolower($match[3])]; - - // Character timezone - if (isset($this->timezone[strtoupper($match[8])])) - { - $timezone = $this->timezone[strtoupper($match[8])]; - } - // Assume everything else to be -0000 - else - { - $timezone = 0; - } - - // Deal with 2 digit year - if ($match[4] < 50) - { - $match[4] += 2000; - } - else - { - $match[4] += 1900; - } - - return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone; - } - else - { - return false; - } - } - - /** - * Parse C99's asctime()'s date format - * - * @access protected - * @return int Timestamp - */ - public function date_asctime($date) - { - static $pcre; - if (!$pcre) - { - $space = '[\x09\x20]+'; - $wday_name = $this->day_pcre; - $mon_name = $this->month_pcre; - $day = '([0-9]{1,2})'; - $hour = $sec = $min = '([0-9]{2})'; - $year = '([0-9]{4})'; - $terminator = '\x0A?\x00?'; - $pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i'; - } - if (preg_match($pcre, $date, $match)) - { - /* - Capturing subpatterns: - 1: Day name - 2: Month - 3: Day - 4: Hour - 5: Minute - 6: Second - 7: Year - */ - - $month = $this->month[strtolower($match[2])]; - return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]); - } - else - { - return false; - } - } - - /** - * Parse dates using strtotime() - * - * @access protected - * @return int Timestamp - */ - public function date_strtotime($date) - { - $strtotime = strtotime($date); - if ($strtotime === -1 || $strtotime === false) - { - return false; - } - else - { - return $strtotime; - } - } -} -
@@ -1,656 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Parses XML into something sane - * - * - * This class can be overloaded with {@see SimplePie::set_parser_class()} - * - * @package SimplePie - * @subpackage Parsing - */ -class SimplePie_Parser -{ - var $error_code; - var $error_string; - var $current_line; - var $current_column; - var $current_byte; - var $separator = ' '; - var $namespace = array(''); - var $element = array(''); - var $xml_base = array(''); - var $xml_base_explicit = array(false); - var $xml_lang = array(''); - var $data = array(); - var $datas = array(array()); - var $current_xhtml_construct = -1; - var $encoding; - protected $registry; - - public function set_registry(SimplePie_Registry $registry) - { - $this->registry = $registry; - } - - public function parse(&$data, $encoding, $url = '') - { - if (function_exists('Mf2\parse')) { - // Check for both h-feed and h-entry, as both a feed with no entries - // and a list of entries without an h-feed wrapper are both valid. - $position = 0; - while ($position = strpos($data, 'h-feed', $position)) { - $start = $position < 200 ? 0 : $position - 200; - $check = substr($data, $start, 400); - if (preg_match('/class="[^"]*h-feed/', $check)) { - return $this->parse_microformats($data, $url); - } - $position += 7; - } - $position = 0; - while ($position = strpos($data, 'h-entry', $position)) { - $start = $position < 200 ? 0 : $position - 200; - $check = substr($data, $start, 400); - if (preg_match('/class="[^"]*h-entry/', $check)) { - return $this->parse_microformats($data, $url); - } - $position += 7; - } - } - - // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character - if (strtoupper($encoding) === 'US-ASCII') - { - $this->encoding = 'UTF-8'; - } - else - { - $this->encoding = $encoding; - } - - // Strip BOM: - // UTF-32 Big Endian BOM - if (substr($data, 0, 4) === "\x00\x00\xFE\xFF") - { - $data = substr($data, 4); - } - // UTF-32 Little Endian BOM - elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00") - { - $data = substr($data, 4); - } - // UTF-16 Big Endian BOM - elseif (substr($data, 0, 2) === "\xFE\xFF") - { - $data = substr($data, 2); - } - // UTF-16 Little Endian BOM - elseif (substr($data, 0, 2) === "\xFF\xFE") - { - $data = substr($data, 2); - } - // UTF-8 BOM - elseif (substr($data, 0, 3) === "\xEF\xBB\xBF") - { - $data = substr($data, 3); - } - - if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false) - { - $declaration = $this->registry->create('XML_Declaration_Parser', array(substr($data, 5, $pos - 5))); - if ($declaration->parse()) - { - $data = substr($data, $pos + 2); - $data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' ."\n". $this->declare_html_entities() . $data; - } - else - { - $this->error_string = 'SimplePie bug! Please report this!'; - return false; - } - } - - $return = true; - - static $xml_is_sane = null; - if ($xml_is_sane === null) - { - $parser_check = xml_parser_create(); - xml_parse_into_struct($parser_check, '<foo>&</foo>', $values); - xml_parser_free($parser_check); - $xml_is_sane = isset($values[0]['value']); - } - - // Create the parser - if ($xml_is_sane) - { - $xml = xml_parser_create_ns($this->encoding, $this->separator); - xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1); - xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0); - xml_set_object($xml, $this); - xml_set_character_data_handler($xml, 'cdata'); - xml_set_element_handler($xml, 'tag_open', 'tag_close'); - - // Parse! - if (!xml_parse($xml, $data, true)) - { - $this->error_code = xml_get_error_code($xml); - $this->error_string = xml_error_string($this->error_code); - $return = false; - } - $this->current_line = xml_get_current_line_number($xml); - $this->current_column = xml_get_current_column_number($xml); - $this->current_byte = xml_get_current_byte_index($xml); - xml_parser_free($xml); - return $return; - } - else - { - libxml_clear_errors(); - $xml = new XMLReader(); - $xml->xml($data); - while (@$xml->read()) - { - switch ($xml->nodeType) - { - - case constant('XMLReader::END_ELEMENT'): - if ($xml->namespaceURI !== '') - { - $tagName = $xml->namespaceURI . $this->separator . $xml->localName; - } - else - { - $tagName = $xml->localName; - } - $this->tag_close(null, $tagName); - break; - case constant('XMLReader::ELEMENT'): - $empty = $xml->isEmptyElement; - if ($xml->namespaceURI !== '') - { - $tagName = $xml->namespaceURI . $this->separator . $xml->localName; - } - else - { - $tagName = $xml->localName; - } - $attributes = array(); - while ($xml->moveToNextAttribute()) - { - if ($xml->namespaceURI !== '') - { - $attrName = $xml->namespaceURI . $this->separator . $xml->localName; - } - else - { - $attrName = $xml->localName; - } - $attributes[$attrName] = $xml->value; - } - $this->tag_open(null, $tagName, $attributes); - if ($empty) - { - $this->tag_close(null, $tagName); - } - break; - case constant('XMLReader::TEXT'): - - case constant('XMLReader::CDATA'): - $this->cdata(null, $xml->value); - break; - } - } - if ($error = libxml_get_last_error()) - { - $this->error_code = $error->code; - $this->error_string = $error->message; - $this->current_line = $error->line; - $this->current_column = $error->column; - return false; - } - else - { - return true; - } - } - } - - public function get_error_code() - { - return $this->error_code; - } - - public function get_error_string() - { - return $this->error_string; - } - - public function get_current_line() - { - return $this->current_line; - } - - public function get_current_column() - { - return $this->current_column; - } - - public function get_current_byte() - { - return $this->current_byte; - } - - public function get_data() - { - return $this->data; - } - - public function tag_open($parser, $tag, $attributes) - { - list($this->namespace[], $this->element[]) = $this->split_ns($tag); - - $attribs = array(); - foreach ($attributes as $name => $value) - { - list($attrib_namespace, $attribute) = $this->split_ns($name); - $attribs[$attrib_namespace][$attribute] = $value; - } - - if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['base'])) - { - $base = $this->registry->call('Misc', 'absolutize_url', array($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base))); - if ($base !== false) - { - $this->xml_base[] = $base; - $this->xml_base_explicit[] = true; - } - } - else - { - $this->xml_base[] = end($this->xml_base); - $this->xml_base_explicit[] = end($this->xml_base_explicit); - } - - if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['lang'])) - { - $this->xml_lang[] = $attribs[SIMPLEPIE_NAMESPACE_XML]['lang']; - } - else - { - $this->xml_lang[] = end($this->xml_lang); - } - - if ($this->current_xhtml_construct >= 0) - { - $this->current_xhtml_construct++; - if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML) - { - $this->data['data'] .= '<' . end($this->element); - if (isset($attribs[''])) - { - foreach ($attribs[''] as $name => $value) - { - $this->data['data'] .= ' ' . $name . '="' . htmlspecialchars($value, ENT_COMPAT, $this->encoding) . '"'; - } - } - $this->data['data'] .= '>'; - } - } - else - { - $this->datas[] =& $this->data; - $this->data =& $this->data['child'][end($this->namespace)][end($this->element)][]; - $this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang)); - if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml') - || (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml') - || (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_20 && in_array(end($this->element), array('title'))) - || (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_090 && in_array(end($this->element), array('title'))) - || (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_10 && in_array(end($this->element), array('title')))) - { - $this->current_xhtml_construct = 0; - } - } - } - - public function cdata($parser, $cdata) - { - if ($this->current_xhtml_construct >= 0) - { - $this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding); - } - else - { - $this->data['data'] .= $cdata; - } - } - - public function tag_close($parser, $tag) - { - if ($this->current_xhtml_construct >= 0) - { - $this->current_xhtml_construct--; - if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param'))) - { - $this->data['data'] .= '</' . end($this->element) . '>'; - } - } - if ($this->current_xhtml_construct === -1) - { - $this->data =& $this->datas[count($this->datas) - 1]; - array_pop($this->datas); - } - - array_pop($this->element); - array_pop($this->namespace); - array_pop($this->xml_base); - array_pop($this->xml_base_explicit); - array_pop($this->xml_lang); - } - - public function split_ns($string) - { - static $cache = array(); - if (!isset($cache[$string])) - { - if ($pos = strpos($string, $this->separator)) - { - static $separator_length; - if (!$separator_length) - { - $separator_length = strlen($this->separator); - } - $namespace = substr($string, 0, $pos); - $local_name = substr($string, $pos + $separator_length); - if (strtolower($namespace) === SIMPLEPIE_NAMESPACE_ITUNES) - { - $namespace = SIMPLEPIE_NAMESPACE_ITUNES; - } - - // Normalize the Media RSS namespaces - if ($namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG || - $namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG2 || - $namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG3 || - $namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG4 || - $namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5 ) - { - $namespace = SIMPLEPIE_NAMESPACE_MEDIARSS; - } - $cache[$string] = array($namespace, $local_name); - } - else - { - $cache[$string] = array('', $string); - } - } - return $cache[$string]; - } - - private function parse_hcard($data, $category = false) { - $name = ''; - $link = ''; - // Check if h-card is set and pass that information on in the link. - if (isset($data['type']) && in_array('h-card', $data['type'])) { - if (isset($data['properties']['name'][0])) { - $name = $data['properties']['name'][0]; - } - if (isset($data['properties']['url'][0])) { - $link = $data['properties']['url'][0]; - if ($name === '') { - $name = $link; - } - else { - // can't have commas in categories. - $name = str_replace(',', '', $name); - } - $person_tag = $category ? '<span class="person-tag"></span>' : ''; - return '<a class="h-card" href="'.$link.'">'.$person_tag.$name.'</a>'; - } - } - return isset($data['value']) ? $data['value'] : ''; - } - - private function parse_microformats(&$data, $url) { - $feed_title = ''; - $feed_author = NULL; - $author_cache = array(); - $items = array(); - $entries = array(); - $mf = Mf2\parse($data, $url); - // First look for an h-feed. - $h_feed = array(); - foreach ($mf['items'] as $mf_item) { - if (in_array('h-feed', $mf_item['type'])) { - $h_feed = $mf_item; - break; - } - // Also look for an h-feed in the children of each top level item. - if (!isset($mf_item['children'][0]['type'])) continue; - if (in_array('h-feed', $mf_item['children'][0]['type'])) { - $h_feed = $mf_item['children'][0]; - // In this case the parent of the h-feed may be an h-card, so use it as - // the feed_author. - if (in_array('h-card', $mf_item['type'])) $feed_author = $mf_item; - break; - } - } - if (isset($h_feed['children'])) { - $entries = $h_feed['children']; - // Also set the feed title and store author from the h-feed if available. - if (isset($mf['items'][0]['properties']['name'][0])) { - $feed_title = $mf['items'][0]['properties']['name'][0]; - } - if (isset($mf['items'][0]['properties']['author'][0])) { - $feed_author = $mf['items'][0]['properties']['author'][0]; - } - } - else { - $entries = $mf['items']; - } - for ($i = 0; $i < count($entries); $i++) { - $entry = $entries[$i]; - if (in_array('h-entry', $entry['type'])) { - $item = array(); - $title = ''; - $description = ''; - if (isset($entry['properties']['url'][0])) { - $link = $entry['properties']['url'][0]; - if (isset($link['value'])) $link = $link['value']; - $item['link'] = array(array('data' => $link)); - } - if (isset($entry['properties']['uid'][0])) { - $guid = $entry['properties']['uid'][0]; - if (isset($guid['value'])) $guid = $guid['value']; - $item['guid'] = array(array('data' => $guid)); - } - if (isset($entry['properties']['name'][0])) { - $title = $entry['properties']['name'][0]; - if (isset($title['value'])) $title = $title['value']; - $item['title'] = array(array('data' => $title)); - } - if (isset($entry['properties']['author'][0]) || isset($feed_author)) { - // author is a special case, it can be plain text or an h-card array. - // If it's plain text it can also be a url that should be followed to - // get the actual h-card. - $author = isset($entry['properties']['author'][0]) ? - $entry['properties']['author'][0] : $feed_author; - if (!is_string($author)) { - $author = $this->parse_hcard($author); - } - else if (strpos($author, 'http') === 0) { - if (isset($author_cache[$author])) { - $author = $author_cache[$author]; - } - else { - $mf = Mf2\fetch($author); - foreach ($mf['items'] as $hcard) { - // Only interested in an h-card by itself in this case. - if (!in_array('h-card', $hcard['type'])) { - continue; - } - // It must have a url property matching what we fetched. - if (!isset($hcard['properties']['url']) || - !(in_array($author, $hcard['properties']['url']))) { - continue; - } - // Save parse_hcard the trouble of finding the correct url. - $hcard['properties']['url'][0] = $author; - // Cache this h-card for the next h-entry to check. - $author_cache[$author] = $this->parse_hcard($hcard); - $author = $author_cache[$author]; - break; - } - } - } - $item['author'] = array(array('data' => $author)); - } - if (isset($entry['properties']['photo'][0])) { - // If a photo is also in content, don't need to add it again here. - $content = ''; - if (isset($entry['properties']['content'][0]['html'])) { - $content = $entry['properties']['content'][0]['html']; - } - $photo_list = array(); - for ($j = 0; $j < count($entry['properties']['photo']); $j++) { - $photo = $entry['properties']['photo'][$j]; - if (strpos($content, $photo) === false) { - $photo_list[] = $photo; - } - } - // When there's more than one photo show the first and use a lightbox. - $count = count($photo_list); - if ($count > 1) { - $description = '<p>'; - for ($j = 0; $j < $count; $j++) { - $hidden = $j === 0 ? '' : 'class="hidden" '; - $description .= '<a href="'.$photo_list[$j].'" '.$hidden. - 'data-lightbox="image-set-'.$i.'">'. - '<img src="'.$photo_list[$j].'"></a>'; - } - $description .= '<br><b>'.$count.' photos</b></p>'; - } - else if ($count == 1) { - $description = '<p><img src="'.$photo_list[0].'"></p>'; - } - } - if (isset($entry['properties']['content'][0]['html'])) { - // e-content['value'] is the same as p-name when they are on the same - // element. Use this to replace title with a strip_tags version so - // that alt text from images is not included in the title. - if ($entry['properties']['content'][0]['value'] === $title) { - $title = strip_tags($entry['properties']['content'][0]['html']); - $item['title'] = array(array('data' => $title)); - } - $description .= $entry['properties']['content'][0]['html']; - if (isset($entry['properties']['in-reply-to'][0]['value'])) { - $in_reply_to = $entry['properties']['in-reply-to'][0]['value']; - $description .= '<p><span class="in-reply-to"></span> '. - '<a href="'.$in_reply_to.'">'.$in_reply_to.'</a><p>'; - } - $item['description'] = array(array('data' => $description)); - } - if (isset($entry['properties']['category'])) { - $category_csv = ''; - // Categories can also contain h-cards. - foreach ($entry['properties']['category'] as $category) { - if ($category_csv !== '') $category_csv .= ', '; - if (is_string($category)) { - // Can't have commas in categories. - $category_csv .= str_replace(',', '', $category); - } - else { - $category_csv .= $this->parse_hcard($category, true); - } - } - $item['category'] = array(array('data' => $category_csv)); - } - if (isset($entry['properties']['published'][0])) { - $timestamp = strtotime($entry['properties']['published'][0]); - $pub_date = date('F j Y g:ia', $timestamp).' GMT'; - $item['pubDate'] = array(array('data' => $pub_date)); - } - // The title and description are set to the empty string to represent - // a deleted item (which also makes it an invalid rss item). - if (isset($entry['properties']['deleted'][0])) { - $item['title'] = array(array('data' => '')); - $item['description'] = array(array('data' => '')); - } - $items[] = array('child' => array('' => $item)); - } - } - // Mimic RSS data format when storing microformats. - $link = array(array('data' => $url)); - $image = ''; - if (!is_string($feed_author) && - isset($feed_author['properties']['photo'][0])) { - $image = array(array('child' => array('' => array('url' => - array(array('data' => $feed_author['properties']['photo'][0])))))); - } - // Use the a name given for the h-feed, or get the title from the html. - if ($feed_title !== '') { - $feed_title = array(array('data' => htmlspecialchars($feed_title))); - } - else if ($position = strpos($data, '<title>')) { - $start = $position < 200 ? 0 : $position - 200; - $check = substr($data, $start, 400); - $matches = array(); - if (preg_match('/<title>(.+)<\/title>/', $check, $matches)) { - $feed_title = array(array('data' => htmlspecialchars($matches[1]))); - } - } - $channel = array('channel' => array(array('child' => array('' => - array('link' => $link, 'image' => $image, 'title' => $feed_title, - 'item' => $items))))); - $rss = array(array('attribs' => array('' => array('version' => '2.0')), - 'child' => array('' => $channel))); - $this->data = array('child' => array('' => array('rss' => $rss))); - return true; - } - - private function declare_html_entities() { - // This is required because the RSS specification says that entity-encoded - // html is allowed, but the xml specification says they must be declared. - return '<!DOCTYPE html [ <!ENTITY nbsp " "> <!ENTITY iexcl "¡"> <!ENTITY cent "¢"> <!ENTITY pound "£"> <!ENTITY curren "¤"> <!ENTITY yen "¥"> <!ENTITY brvbar "¦"> <!ENTITY sect "§"> <!ENTITY uml "¨"> <!ENTITY copy "©"> <!ENTITY ordf "ª"> <!ENTITY laquo "«"> <!ENTITY not "¬"> <!ENTITY shy "­"> <!ENTITY reg "®"> <!ENTITY macr "¯"> <!ENTITY deg "°"> <!ENTITY plusmn "±"> <!ENTITY sup2 "²"> <!ENTITY sup3 "³"> <!ENTITY acute "´"> <!ENTITY micro "µ"> <!ENTITY para "¶"> <!ENTITY middot "·"> <!ENTITY cedil "¸"> <!ENTITY sup1 "¹"> <!ENTITY ordm "º"> <!ENTITY raquo "»"> <!ENTITY frac14 "¼"> <!ENTITY frac12 "½"> <!ENTITY frac34 "¾"> <!ENTITY iquest "¿"> <!ENTITY Agrave "À"> <!ENTITY Aacute "Á"> <!ENTITY Acirc "Â"> <!ENTITY Atilde "Ã"> <!ENTITY Auml "Ä"> <!ENTITY Aring "Å"> <!ENTITY AElig "Æ"> <!ENTITY Ccedil "Ç"> <!ENTITY Egrave "È"> <!ENTITY Eacute "É"> <!ENTITY Ecirc "Ê"> <!ENTITY Euml "Ë"> <!ENTITY Igrave "Ì"> <!ENTITY Iacute "Í"> <!ENTITY Icirc "Î"> <!ENTITY Iuml "Ï"> <!ENTITY ETH "Ð"> <!ENTITY Ntilde "Ñ"> <!ENTITY Ograve "Ò"> <!ENTITY Oacute "Ó"> <!ENTITY Ocirc "Ô"> <!ENTITY Otilde "Õ"> <!ENTITY Ouml "Ö"> <!ENTITY times "×"> <!ENTITY Oslash "Ø"> <!ENTITY Ugrave "Ù"> <!ENTITY Uacute "Ú"> <!ENTITY Ucirc "Û"> <!ENTITY Uuml "Ü"> <!ENTITY Yacute "Ý"> <!ENTITY THORN "Þ"> <!ENTITY szlig "ß"> <!ENTITY agrave "à"> <!ENTITY aacute "á"> <!ENTITY acirc "â"> <!ENTITY atilde "ã"> <!ENTITY auml "ä"> <!ENTITY aring "å"> <!ENTITY aelig "æ"> <!ENTITY ccedil "ç"> <!ENTITY egrave "è"> <!ENTITY eacute "é"> <!ENTITY ecirc "ê"> <!ENTITY euml "ë"> <!ENTITY igrave "ì"> <!ENTITY iacute "í"> <!ENTITY icirc "î"> <!ENTITY iuml "ï"> <!ENTITY eth "ð"> <!ENTITY ntilde "ñ"> <!ENTITY ograve "ò"> <!ENTITY oacute "ó"> <!ENTITY ocirc "ô"> <!ENTITY otilde "õ"> <!ENTITY ouml "ö"> <!ENTITY divide "÷"> <!ENTITY oslash "ø"> <!ENTITY ugrave "ù"> <!ENTITY uacute "ú"> <!ENTITY ucirc "û"> <!ENTITY uuml "ü"> <!ENTITY yacute "ý"> <!ENTITY thorn "þ"> <!ENTITY yuml "ÿ"> <!ENTITY OElig "Œ"> <!ENTITY oelig "œ"> <!ENTITY Scaron "Š"> <!ENTITY scaron "š"> <!ENTITY Yuml "Ÿ"> <!ENTITY fnof "ƒ"> <!ENTITY circ "ˆ"> <!ENTITY tilde "˜"> <!ENTITY Alpha "Α"> <!ENTITY Beta "Β"> <!ENTITY Gamma "Γ"> <!ENTITY Epsilon "Ε"> <!ENTITY Zeta "Ζ"> <!ENTITY Eta "Η"> <!ENTITY Theta "Θ"> <!ENTITY Iota "Ι"> <!ENTITY Kappa "Κ"> <!ENTITY Lambda "Λ"> <!ENTITY Mu "Μ"> <!ENTITY Nu "Ν"> <!ENTITY Xi "Ξ"> <!ENTITY Omicron "Ο"> <!ENTITY Pi "Π"> <!ENTITY Rho "Ρ"> <!ENTITY Sigma "Σ"> <!ENTITY Tau "Τ"> <!ENTITY Upsilon "Υ"> <!ENTITY Phi "Φ"> <!ENTITY Chi "Χ"> <!ENTITY Psi "Ψ"> <!ENTITY Omega "Ω"> <!ENTITY alpha "α"> <!ENTITY beta "β"> <!ENTITY gamma "γ"> <!ENTITY delta "δ"> <!ENTITY epsilon "ε"> <!ENTITY zeta "ζ"> <!ENTITY eta "η"> <!ENTITY theta "θ"> <!ENTITY iota "ι"> <!ENTITY kappa "κ"> <!ENTITY lambda "λ"> <!ENTITY mu "μ"> <!ENTITY nu "ν"> <!ENTITY xi "ξ"> <!ENTITY omicron "ο"> <!ENTITY pi "π"> <!ENTITY rho "ρ"> <!ENTITY sigmaf "ς"> <!ENTITY sigma "σ"> <!ENTITY tau "τ"> <!ENTITY upsilon "υ"> <!ENTITY phi "φ"> <!ENTITY chi "χ"> <!ENTITY psi "ψ"> <!ENTITY omega "ω"> <!ENTITY thetasym "ϑ"> <!ENTITY upsih "ϒ"> <!ENTITY piv "ϖ"> <!ENTITY ensp " "> <!ENTITY emsp " "> <!ENTITY thinsp " "> <!ENTITY zwnj "‌"> <!ENTITY zwj "‍"> <!ENTITY lrm "‎"> <!ENTITY rlm "‏"> <!ENTITY ndash "–"> <!ENTITY mdash "—"> <!ENTITY lsquo "‘"> <!ENTITY rsquo "’"> <!ENTITY sbquo "‚"> <!ENTITY ldquo "“"> <!ENTITY rdquo "”"> <!ENTITY bdquo "„"> <!ENTITY dagger "†"> <!ENTITY Dagger "‡"> <!ENTITY bull "•"> <!ENTITY hellip "…"> <!ENTITY permil "‰"> <!ENTITY prime "′"> <!ENTITY Prime "″"> <!ENTITY lsaquo "‹"> <!ENTITY rsaquo "›"> <!ENTITY oline "‾"> <!ENTITY frasl "⁄"> <!ENTITY euro "€"> <!ENTITY image "ℑ"> <!ENTITY weierp "℘"> <!ENTITY real "ℜ"> <!ENTITY trade "™"> <!ENTITY alefsym "ℵ"> <!ENTITY larr "←"> <!ENTITY uarr "↑"> <!ENTITY rarr "→"> <!ENTITY darr "↓"> <!ENTITY harr "↔"> <!ENTITY crarr "↵"> <!ENTITY lArr "⇐"> <!ENTITY uArr "⇑"> <!ENTITY rArr "⇒"> <!ENTITY dArr "⇓"> <!ENTITY hArr "⇔"> <!ENTITY forall "∀"> <!ENTITY part "∂"> <!ENTITY exist "∃"> <!ENTITY empty "∅"> <!ENTITY nabla "∇"> <!ENTITY isin "∈"> <!ENTITY notin "∉"> <!ENTITY ni "∋"> <!ENTITY prod "∏"> <!ENTITY sum "∑"> <!ENTITY minus "−"> <!ENTITY lowast "∗"> <!ENTITY radic "√"> <!ENTITY prop "∝"> <!ENTITY infin "∞"> <!ENTITY ang "∠"> <!ENTITY and "∧"> <!ENTITY or "∨"> <!ENTITY cap "∩"> <!ENTITY cup "∪"> <!ENTITY int "∫"> <!ENTITY there4 "∴"> <!ENTITY sim "∼"> <!ENTITY cong "≅"> <!ENTITY asymp "≈"> <!ENTITY ne "≠"> <!ENTITY equiv "≡"> <!ENTITY le "≤"> <!ENTITY ge "≥"> <!ENTITY sub "⊂"> <!ENTITY sup "⊃"> <!ENTITY nsub "⊄"> <!ENTITY sube "⊆"> <!ENTITY supe "⊇"> <!ENTITY oplus "⊕"> <!ENTITY otimes "⊗"> <!ENTITY perp "⊥"> <!ENTITY sdot "⋅"> <!ENTITY lceil "⌈"> <!ENTITY rceil "⌉"> <!ENTITY lfloor "⌊"> <!ENTITY rfloor "⌋"> <!ENTITY lang "〈"> <!ENTITY rang "〉"> <!ENTITY loz "◊"> <!ENTITY spades "♠"> <!ENTITY clubs "♣"> <!ENTITY hearts "♥"> <!ENTITY diams "♦"> ]>'; - } -}
@@ -1,128 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Handles `<media:rating>` or `<itunes:explicit>` tags as defined in Media RSS and iTunes RSS respectively - * - * Used by {@see SimplePie_Enclosure::get_rating()} and {@see SimplePie_Enclosure::get_ratings()} - * - * This class can be overloaded with {@see SimplePie::set_rating_class()} - * - * @package SimplePie - * @subpackage API - */ -class SimplePie_Rating -{ - /** - * Rating scheme - * - * @var string - * @see get_scheme() - */ - var $scheme; - - /** - * Rating value - * - * @var string - * @see get_value() - */ - var $value; - - /** - * Constructor, used to input the data - * - * For documentation on all the parameters, see the corresponding - * properties and their accessors - */ - public function __construct($scheme = null, $value = null) - { - $this->scheme = $scheme; - $this->value = $value; - } - - /** - * String-ified version - * - * @return string - */ - public function __toString() - { - // There is no $this->data here - return md5(serialize($this)); - } - - /** - * Get the organizational scheme for the rating - * - * @return string|null - */ - public function get_scheme() - { - if ($this->scheme !== null) - { - return $this->scheme; - } - else - { - return null; - } - } - - /** - * Get the value of the rating - * - * @return string|null - */ - public function get_value() - { - if ($this->value !== null) - { - return $this->value; - } - else - { - return null; - } - } -}
@@ -1,224 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Handles creating objects and calling methods - * - * Access this via {@see SimplePie::get_registry()} - * - * @package SimplePie - */ -class SimplePie_Registry -{ - /** - * Default class mapping - * - * Overriding classes *must* subclass these. - * - * @var array - */ - protected $default = array( - 'Cache' => 'SimplePie_Cache', - 'Locator' => 'SimplePie_Locator', - 'Parser' => 'SimplePie_Parser', - 'File' => 'SimplePie_File', - 'Sanitize' => 'SimplePie_Sanitize', - 'Item' => 'SimplePie_Item', - 'Author' => 'SimplePie_Author', - 'Category' => 'SimplePie_Category', - 'Enclosure' => 'SimplePie_Enclosure', - 'Caption' => 'SimplePie_Caption', - 'Copyright' => 'SimplePie_Copyright', - 'Credit' => 'SimplePie_Credit', - 'Rating' => 'SimplePie_Rating', - 'Restriction' => 'SimplePie_Restriction', - 'Content_Type_Sniffer' => 'SimplePie_Content_Type_Sniffer', - 'Source' => 'SimplePie_Source', - 'Misc' => 'SimplePie_Misc', - 'XML_Declaration_Parser' => 'SimplePie_XML_Declaration_Parser', - 'Parse_Date' => 'SimplePie_Parse_Date', - ); - - /** - * Class mapping - * - * @see register() - * @var array - */ - protected $classes = array(); - - /** - * Legacy classes - * - * @see register() - * @var array - */ - protected $legacy = array(); - - /** - * Constructor - * - * No-op - */ - public function __construct() { } - - /** - * Register a class - * - * @param string $type See {@see $default} for names - * @param string $class Class name, must subclass the corresponding default - * @param bool $legacy Whether to enable legacy support for this class - * @return bool Successfulness - */ - public function register($type, $class, $legacy = false) - { - if (!@is_subclass_of($class, $this->default[$type])) - { - return false; - } - - $this->classes[$type] = $class; - - if ($legacy) - { - $this->legacy[] = $class; - } - - return true; - } - - /** - * Get the class registered for a type - * - * Where possible, use {@see create()} or {@see call()} instead - * - * @param string $type - * @return string|null - */ - public function get_class($type) - { - if (!empty($this->classes[$type])) - { - return $this->classes[$type]; - } - if (!empty($this->default[$type])) - { - return $this->default[$type]; - } - - return null; - } - - /** - * Create a new instance of a given type - * - * @param string $type - * @param array $parameters Parameters to pass to the constructor - * @return object Instance of class - */ - public function &create($type, $parameters = array()) - { - $class = $this->get_class($type); - - if (in_array($class, $this->legacy)) - { - switch ($type) - { - case 'locator': - // Legacy: file, timeout, useragent, file_class, max_checked_feeds, content_type_sniffer_class - // Specified: file, timeout, useragent, max_checked_feeds - $replacement = array($this->get_class('file'), $parameters[3], $this->get_class('content_type_sniffer')); - array_splice($parameters, 3, 1, $replacement); - break; - } - } - - if (!method_exists($class, '__construct')) - { - $instance = new $class; - } - else - { - $reflector = new ReflectionClass($class); - $instance = $reflector->newInstanceArgs($parameters); - } - - if (method_exists($instance, 'set_registry')) - { - $instance->set_registry($this); - } - return $instance; - } - - /** - * Call a static method for a type - * - * @param string $type - * @param string $method - * @param array $parameters - * @return mixed - */ - public function &call($type, $method, $parameters = array()) - { - $class = $this->get_class($type); - - if (in_array($class, $this->legacy)) - { - switch ($type) - { - case 'Cache': - // For backwards compatibility with old non-static - // Cache::create() methods - if ($method === 'get_handler') - { - $result = @call_user_func_array(array($class, 'create'), $parameters); - return $result; - } - break; - } - } - - $result = call_user_func_array(array($class, $method), $parameters); - return $result; - } -}
@@ -1,154 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Handles `<media:restriction>` as defined in Media RSS - * - * Used by {@see SimplePie_Enclosure::get_restriction()} and {@see SimplePie_Enclosure::get_restrictions()} - * - * This class can be overloaded with {@see SimplePie::set_restriction_class()} - * - * @package SimplePie - * @subpackage API - */ -class SimplePie_Restriction -{ - /** - * Relationship ('allow'/'deny') - * - * @var string - * @see get_relationship() - */ - var $relationship; - - /** - * Type of restriction - * - * @var string - * @see get_type() - */ - var $type; - - /** - * Restricted values - * - * @var string - * @see get_value() - */ - var $value; - - /** - * Constructor, used to input the data - * - * For documentation on all the parameters, see the corresponding - * properties and their accessors - */ - public function __construct($relationship = null, $type = null, $value = null) - { - $this->relationship = $relationship; - $this->type = $type; - $this->value = $value; - } - - /** - * String-ified version - * - * @return string - */ - public function __toString() - { - // There is no $this->data here - return md5(serialize($this)); - } - - /** - * Get the relationship - * - * @return string|null Either 'allow' or 'deny' - */ - public function get_relationship() - { - if ($this->relationship !== null) - { - return $this->relationship; - } - else - { - return null; - } - } - - /** - * Get the type - * - * @return string|null - */ - public function get_type() - { - if ($this->type !== null) - { - return $this->type; - } - else - { - return null; - } - } - - /** - * Get the list of restricted things - * - * @return string|null - */ - public function get_value() - { - if ($this->value !== null) - { - return $this->value; - } - else - { - return null; - } - } -}
@@ -1,589 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Used for data cleanup and post-processing - * - * - * This class can be overloaded with {@see SimplePie::set_sanitize_class()} - * - * @package SimplePie - * @todo Move to using an actual HTML parser (this will allow tags to be properly stripped, and to switch between HTML and XHTML), this will also make it easier to shorten a string while preserving HTML tags - */ -class SimplePie_Sanitize -{ - // Private vars - var $base; - - // Options - var $remove_div = true; - var $image_handler = ''; - var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); - var $encode_instead_of_strip = false; - var $strip_attributes = array('bgsound', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'); - var $add_attributes = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none')); - var $strip_comments = false; - var $output_encoding = 'UTF-8'; - var $enable_cache = true; - var $cache_location = './cache'; - var $cache_name_function = 'md5'; - var $timeout = 10; - var $useragent = ''; - var $force_fsockopen = false; - var $replace_url_attributes = null; - - public function __construct() - { - // Set defaults - $this->set_url_replacements(null); - } - - public function remove_div($enable = true) - { - $this->remove_div = (bool) $enable; - } - - public function set_image_handler($page = false) - { - if ($page) - { - $this->image_handler = (string) $page; - } - else - { - $this->image_handler = false; - } - } - - public function set_registry(SimplePie_Registry $registry) - { - $this->registry = $registry; - } - - public function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie_Cache') - { - if (isset($enable_cache)) - { - $this->enable_cache = (bool) $enable_cache; - } - - if ($cache_location) - { - $this->cache_location = (string) $cache_location; - } - - if ($cache_name_function) - { - $this->cache_name_function = (string) $cache_name_function; - } - } - - public function pass_file_data($file_class = 'SimplePie_File', $timeout = 10, $useragent = '', $force_fsockopen = false) - { - if ($timeout) - { - $this->timeout = (string) $timeout; - } - - if ($useragent) - { - $this->useragent = (string) $useragent; - } - - if ($force_fsockopen) - { - $this->force_fsockopen = (string) $force_fsockopen; - } - } - - public function strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style')) - { - if ($tags) - { - if (is_array($tags)) - { - $this->strip_htmltags = $tags; - } - else - { - $this->strip_htmltags = explode(',', $tags); - } - } - else - { - $this->strip_htmltags = false; - } - } - - public function encode_instead_of_strip($encode = false) - { - $this->encode_instead_of_strip = (bool) $encode; - } - - public function strip_attributes($attribs = array('bgsound', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc')) - { - if ($attribs) - { - if (is_array($attribs)) - { - $this->strip_attributes = $attribs; - } - else - { - $this->strip_attributes = explode(',', $attribs); - } - } - else - { - $this->strip_attributes = false; - } - } - - public function add_attributes($attribs = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none'))) - { - if ($attribs) - { - if (is_array($attribs)) - { - $this->add_attributes = $attribs; - } - else - { - $this->add_attributes = explode(',', $attribs); - } - } - else - { - $this->add_attributes = false; - } - } - - public function strip_comments($strip = false) - { - $this->strip_comments = (bool) $strip; - } - - public function set_output_encoding($encoding = 'UTF-8') - { - $this->output_encoding = (string) $encoding; - } - - /** - * Set element/attribute key/value pairs of HTML attributes - * containing URLs that need to be resolved relative to the feed - * - * Defaults to |a|@href, |area|@href, |blockquote|@cite, |del|@cite, - * |form|@action, |img|@longdesc, |img|@src, |input|@src, |ins|@cite, - * |q|@cite - * - * @since 1.0 - * @param array|null $element_attribute Element/attribute key/value pairs, null for default - */ - public function set_url_replacements($element_attribute = null) - { - if ($element_attribute === null) - { - $element_attribute = array( - 'a' => 'href', - 'area' => 'href', - 'blockquote' => 'cite', - 'del' => 'cite', - 'form' => 'action', - 'img' => array( - 'longdesc', - 'src' - ), - 'input' => 'src', - 'ins' => 'cite', - 'q' => 'cite' - ); - } - $this->replace_url_attributes = (array) $element_attribute; - } - - public function sanitize($data, $type, $base = '') - { - $data = trim($data); - if ($data !== '' || $type & SIMPLEPIE_CONSTRUCT_IRI) - { - if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML) - { - if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data)) - { - $type |= SIMPLEPIE_CONSTRUCT_HTML; - } - else - { - $type |= SIMPLEPIE_CONSTRUCT_TEXT; - } - } - - if ($type & SIMPLEPIE_CONSTRUCT_BASE64) - { - $data = base64_decode($data); - } - - if ($type & (SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML)) - { - - if (!class_exists('DOMDocument')) - { - throw new SimplePie_Exception('DOMDocument not found, unable to use sanitizer'); - } - $document = new DOMDocument(); - $document->encoding = 'UTF-8'; - - // See https://github.com/simplepie/simplepie/issues/334 - $unique_tag = '#'.uniqid().'#'; - $data = trim($unique_tag . $data . $unique_tag); - - $data = $this->preprocess($data, $type); - - set_error_handler(array('SimplePie_Misc', 'silence_errors')); - $document->loadHTML($data); - restore_error_handler(); - - $xpath = new DOMXPath($document); - - // Strip comments - if ($this->strip_comments) - { - $comments = $xpath->query('//comment()'); - - foreach ($comments as $comment) - { - $comment->parentNode->removeChild($comment); - } - } - - // Strip out HTML tags and attributes that might cause various security problems. - // Based on recommendations by Mark Pilgrim at: - // http://diveintomark.org/archives/2003/06/12/how_to_consume_rss_safely - if ($this->strip_htmltags) - { - foreach ($this->strip_htmltags as $tag) - { - $this->strip_tag($tag, $document, $xpath, $type); - } - } - - if ($this->strip_attributes) - { - foreach ($this->strip_attributes as $attrib) - { - $this->strip_attr($attrib, $xpath); - } - } - - if ($this->add_attributes) - { - foreach ($this->add_attributes as $tag => $valuePairs) - { - $this->add_attr($tag, $valuePairs, $document); - } - } - - // Replace relative URLs - $this->base = $base; - foreach ($this->replace_url_attributes as $element => $attributes) - { - $this->replace_urls($document, $element, $attributes); - } - - // If image handling (caching, etc.) is enabled, cache and rewrite all the image tags. - if (isset($this->image_handler) && ((string) $this->image_handler) !== '' && $this->enable_cache) - { - $images = $document->getElementsByTagName('img'); - foreach ($images as $img) - { - if ($img->hasAttribute('src')) - { - $image_url = call_user_func($this->cache_name_function, $img->getAttribute('src')); - $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, $image_url, 'spi')); - - if ($cache->load()) - { - $img->setAttribute('src', $this->image_handler . $image_url); - } - else - { - $file = $this->registry->create('File', array($img->getAttribute('src'), $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen)); - $headers = $file->headers; - - if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) - { - if ($cache->save(array('headers' => $file->headers, 'body' => $file->body))) - { - $img->setAttribute('src', $this->image_handler . $image_url); - } - else - { - trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); - } - } - } - } - } - } - - // Finally, convert to a HTML string - $data = trim($document->saveHTML()); - $result = explode($unique_tag, $data); - // The tags may not be found again if there was invalid markup. - $data = count($result) === 3 ? $result[1] : ''; - - if ($this->remove_div) - { - $data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '', $data); - $data = preg_replace('/<\/div>$/', '', $data); - } - else - { - $data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '<div>', $data); - } - } - - if ($type & SIMPLEPIE_CONSTRUCT_IRI) - { - $absolute = $this->registry->call('Misc', 'absolutize_url', array($data, $base)); - if ($absolute !== false) - { - $data = $absolute; - } - } - - if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI)) - { - $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8'); - } - - if ($this->output_encoding !== 'UTF-8') - { - $data = $this->registry->call('Misc', 'change_encoding', array($data, 'UTF-8', $this->output_encoding)); - } - } - return $data; - } - - protected function preprocess($html, $type) - { - $ret = ''; - $html = preg_replace('%</?(?:html|body)[^>]*?'.'>%is', '', $html); - if ($type & ~SIMPLEPIE_CONSTRUCT_XHTML) - { - // Atom XHTML constructs are wrapped with a div by default - // Note: No protection if $html contains a stray </div>! - $html = '<div>' . $html . '</div>'; - $ret .= '<!DOCTYPE html>'; - $content_type = 'text/html'; - } - else - { - $ret .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; - $content_type = 'application/xhtml+xml'; - } - - $ret .= '<html><head>'; - $ret .= '<meta http-equiv="Content-Type" content="' . $content_type . '; charset=utf-8" />'; - $ret .= '</head><body>' . $html . '</body></html>'; - return $ret; - } - - public function replace_urls($document, $tag, $attributes) - { - if (!is_array($attributes)) - { - $attributes = array($attributes); - } - - if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags)) - { - $elements = $document->getElementsByTagName($tag); - foreach ($elements as $element) - { - foreach ($attributes as $attribute) - { - if ($element->hasAttribute($attribute)) - { - $value = $this->registry->call('Misc', 'absolutize_url', array($element->getAttribute($attribute), $this->base)); - if ($value !== false) - { - $element->setAttribute($attribute, $value); - } - } - } - } - } - } - - public function do_strip_htmltags($match) - { - if ($this->encode_instead_of_strip) - { - if (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style'))) - { - $match[1] = htmlspecialchars($match[1], ENT_COMPAT, 'UTF-8'); - $match[2] = htmlspecialchars($match[2], ENT_COMPAT, 'UTF-8'); - return "<$match[1]$match[2]>$match[3]</$match[1]>"; - } - else - { - return htmlspecialchars($match[0], ENT_COMPAT, 'UTF-8'); - } - } - elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style'))) - { - return $match[4]; - } - else - { - return ''; - } - } - - protected function strip_tag($tag, $document, $xpath, $type) - { - $elements = $xpath->query('body//' . $tag); - if ($this->encode_instead_of_strip) - { - foreach ($elements as $element) - { - $fragment = $document->createDocumentFragment(); - - // For elements which aren't script or style, include the tag itself - if (!in_array($tag, array('script', 'style'))) - { - $text = '<' . $tag; - if ($element->hasAttributes()) - { - $attrs = array(); - foreach ($element->attributes as $name => $attr) - { - $value = $attr->value; - - // In XHTML, empty values should never exist, so we repeat the value - if (empty($value) && ($type & SIMPLEPIE_CONSTRUCT_XHTML)) - { - $value = $name; - } - // For HTML, empty is fine - elseif (empty($value) && ($type & SIMPLEPIE_CONSTRUCT_HTML)) - { - $attrs[] = $name; - continue; - } - - // Standard attribute text - $attrs[] = $name . '="' . $attr->value . '"'; - } - $text .= ' ' . implode(' ', $attrs); - } - $text .= '>'; - $fragment->appendChild(new DOMText($text)); - } - - $number = $element->childNodes->length; - for ($i = $number; $i > 0; $i--) - { - $child = $element->childNodes->item(0); - $fragment->appendChild($child); - } - - if (!in_array($tag, array('script', 'style'))) - { - $fragment->appendChild(new DOMText('</' . $tag . '>')); - } - - $element->parentNode->replaceChild($fragment, $element); - } - - return; - } - elseif (in_array($tag, array('script', 'style'))) - { - foreach ($elements as $element) - { - $element->parentNode->removeChild($element); - } - - return; - } - else - { - foreach ($elements as $element) - { - $fragment = $document->createDocumentFragment(); - $number = $element->childNodes->length; - for ($i = $number; $i > 0; $i--) - { - $child = $element->childNodes->item(0); - $fragment->appendChild($child); - } - - $element->parentNode->replaceChild($fragment, $element); - } - } - } - - protected function strip_attr($attrib, $xpath) - { - $elements = $xpath->query('//*[@' . $attrib . ']'); - - foreach ($elements as $element) - { - $element->removeAttribute($attrib); - } - } - - protected function add_attr($tag, $valuePairs, $document) - { - $elements = $document->getElementsByTagName($tag); - foreach ($elements as $element) - { - foreach ($valuePairs as $attrib => $value) - { - $element->setAttribute($attrib, $value); - } - } - } -}
@@ -1,610 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - -/** - * Handles `<atom:source>` - * - * Used by {@see SimplePie_Item::get_source()} - * - * This class can be overloaded with {@see SimplePie::set_source_class()} - * - * @package SimplePie - * @subpackage API - */ -class SimplePie_Source -{ - var $item; - var $data = array(); - protected $registry; - - public function __construct($item, $data) - { - $this->item = $item; - $this->data = $data; - } - - public function set_registry(SimplePie_Registry $registry) - { - $this->registry = $registry; - } - - public function __toString() - { - return md5(serialize($this->data)); - } - - public function get_source_tags($namespace, $tag) - { - if (isset($this->data['child'][$namespace][$tag])) - { - return $this->data['child'][$namespace][$tag]; - } - else - { - return null; - } - } - - public function get_base($element = array()) - { - return $this->item->get_base($element); - } - - public function sanitize($data, $type, $base = '') - { - return $this->item->sanitize($data, $type, $base); - } - - public function get_item() - { - return $this->item; - } - - public function get_title() - { - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - return null; - } - } - - public function get_category($key = 0) - { - $categories = $this->get_categories(); - if (isset($categories[$key])) - { - return $categories[$key]; - } - else - { - return null; - } - } - - public function get_categories() - { - $categories = array(); - - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) - { - $term = null; - $scheme = null; - $label = null; - if (isset($category['attribs']['']['term'])) - { - $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($category['attribs']['']['scheme'])) - { - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($category['attribs']['']['label'])) - { - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); - } - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) - { - // This is really the label, but keep this as the term also for BC. - // Label will also work on retrieving because that falls back to term. - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); - if (isset($category['attribs']['']['domain'])) - { - $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $scheme = null; - } - $categories[] = $this->registry->create('Category', array($term, $scheme, null)); - } - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) - { - $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); - } - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) - { - $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); - } - - if (!empty($categories)) - { - return array_unique($categories); - } - else - { - return null; - } - } - - public function get_author($key = 0) - { - $authors = $this->get_authors(); - if (isset($authors[$key])) - { - return $authors[$key]; - } - else - { - return null; - } - } - - public function get_authors() - { - $authors = array(); - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) - { - $name = null; - $uri = null; - $email = null; - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) - { - $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) - { - $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); - } - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) - { - $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if ($name !== null || $email !== null || $uri !== null) - { - $authors[] = $this->registry->create('Author', array($name, $uri, $email)); - } - } - if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) - { - $name = null; - $url = null; - $email = null; - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) - { - $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) - { - $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); - } - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) - { - $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if ($name !== null || $email !== null || $url !== null) - { - $authors[] = $this->registry->create('Author', array($name, $url, $email)); - } - } - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) - { - $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); - } - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) - { - $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); - } - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) - { - $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); - } - - if (!empty($authors)) - { - return array_unique($authors); - } - else - { - return null; - } - } - - public function get_contributor($key = 0) - { - $contributors = $this->get_contributors(); - if (isset($contributors[$key])) - { - return $contributors[$key]; - } - else - { - return null; - } - } - - public function get_contributors() - { - $contributors = array(); - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) - { - $name = null; - $uri = null; - $email = null; - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) - { - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) - { - $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0])); - } - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) - { - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if ($name !== null || $email !== null || $uri !== null) - { - $contributors[] = $this->registry->create('Author', array($name, $uri, $email)); - } - } - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) - { - $name = null; - $url = null; - $email = null; - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) - { - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) - { - $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0])); - } - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) - { - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if ($name !== null || $email !== null || $url !== null) - { - $contributors[] = $this->registry->create('Author', array($name, $url, $email)); - } - } - - if (!empty($contributors)) - { - return array_unique($contributors); - } - else - { - return null; - } - } - - public function get_link($key = 0, $rel = 'alternate') - { - $links = $this->get_links($rel); - if (isset($links[$key])) - { - return $links[$key]; - } - else - { - return null; - } - } - - /** - * Added for parity between the parent-level and the item/entry-level. - */ - public function get_permalink() - { - return $this->get_link(0); - } - - public function get_links($rel = 'alternate') - { - if (!isset($this->data['links'])) - { - $this->data['links'] = array(); - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) - { - foreach ($links as $link) - { - if (isset($link['attribs']['']['href'])) - { - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); - } - } - } - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link')) - { - foreach ($links as $link) - { - if (isset($link['attribs']['']['href'])) - { - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); - - } - } - } - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) - { - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); - } - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) - { - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); - } - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) - { - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); - } - - $keys = array_keys($this->data['links']); - foreach ($keys as $key) - { - if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key))) - { - if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) - { - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); - $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; - } - else - { - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; - } - } - elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) - { - $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; - } - $this->data['links'][$key] = array_unique($this->data['links'][$key]); - } - } - - if (isset($this->data['links'][$rel])) - { - return $this->data['links'][$rel]; - } - else - { - return null; - } - } - - public function get_description() - { - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); - } - else - { - return null; - } - } - - public function get_copyright() - { - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) - { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - return null; - } - } - - public function get_language() - { - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif (isset($this->data['xml_lang'])) - { - return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - return null; - } - } - - public function get_latitude() - { - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) - { - return (float) $return[0]['data']; - } - elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) - { - return (float) $match[1]; - } - else - { - return null; - } - } - - public function get_longitude() - { - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) - { - return (float) $return[0]['data']; - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) - { - return (float) $return[0]['data']; - } - elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) - { - return (float) $match[2]; - } - else - { - return null; - } - } - - public function get_image_url() - { - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) - { - return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); - } - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); - } - else - { - return null; - } - } -} -
@@ -1,361 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - - -/** - * Parses the XML Declaration - * - * @package SimplePie - * @subpackage Parsing - */ -class SimplePie_XML_Declaration_Parser -{ - /** - * XML Version - * - * @access public - * @var string - */ - var $version = '1.0'; - - /** - * Encoding - * - * @access public - * @var string - */ - var $encoding = 'UTF-8'; - - /** - * Standalone - * - * @access public - * @var bool - */ - var $standalone = false; - - /** - * Current state of the state machine - * - * @access private - * @var string - */ - var $state = 'before_version_name'; - - /** - * Input data - * - * @access private - * @var string - */ - var $data = ''; - - /** - * Input data length (to avoid calling strlen() everytime this is needed) - * - * @access private - * @var int - */ - var $data_length = 0; - - /** - * Current position of the pointer - * - * @var int - * @access private - */ - var $position = 0; - - /** - * Create an instance of the class with the input data - * - * @access public - * @param string $data Input data - */ - public function __construct($data) - { - $this->data = $data; - $this->data_length = strlen($this->data); - } - - /** - * Parse the input data - * - * @access public - * @return bool true on success, false on failure - */ - public function parse() - { - while ($this->state && $this->state !== 'emit' && $this->has_data()) - { - $state = $this->state; - $this->$state(); - } - $this->data = ''; - if ($this->state === 'emit') - { - return true; - } - else - { - $this->version = ''; - $this->encoding = ''; - $this->standalone = ''; - return false; - } - } - - /** - * Check whether there is data beyond the pointer - * - * @access private - * @return bool true if there is further data, false if not - */ - public function has_data() - { - return (bool) ($this->position < $this->data_length); - } - - /** - * Advance past any whitespace - * - * @return int Number of whitespace characters passed - */ - public function skip_whitespace() - { - $whitespace = strspn($this->data, "\x09\x0A\x0D\x20", $this->position); - $this->position += $whitespace; - return $whitespace; - } - - /** - * Read value - */ - public function get_value() - { - $quote = substr($this->data, $this->position, 1); - if ($quote === '"' || $quote === "'") - { - $this->position++; - $len = strcspn($this->data, $quote, $this->position); - if ($this->has_data()) - { - $value = substr($this->data, $this->position, $len); - $this->position += $len + 1; - return $value; - } - } - return false; - } - - public function before_version_name() - { - if ($this->skip_whitespace()) - { - $this->state = 'version_name'; - } - else - { - $this->state = false; - } - } - - public function version_name() - { - if (substr($this->data, $this->position, 7) === 'version') - { - $this->position += 7; - $this->skip_whitespace(); - $this->state = 'version_equals'; - } - else - { - $this->state = false; - } - } - - public function version_equals() - { - if (substr($this->data, $this->position, 1) === '=') - { - $this->position++; - $this->skip_whitespace(); - $this->state = 'version_value'; - } - else - { - $this->state = false; - } - } - - public function version_value() - { - if ($this->version = $this->get_value()) - { - $this->skip_whitespace(); - if ($this->has_data()) - { - $this->state = 'encoding_name'; - } - else - { - $this->state = 'emit'; - } - } - else - { - $this->state = false; - } - } - - public function encoding_name() - { - if (substr($this->data, $this->position, 8) === 'encoding') - { - $this->position += 8; - $this->skip_whitespace(); - $this->state = 'encoding_equals'; - } - else - { - $this->state = 'standalone_name'; - } - } - - public function encoding_equals() - { - if (substr($this->data, $this->position, 1) === '=') - { - $this->position++; - $this->skip_whitespace(); - $this->state = 'encoding_value'; - } - else - { - $this->state = false; - } - } - - public function encoding_value() - { - if ($this->encoding = $this->get_value()) - { - $this->skip_whitespace(); - if ($this->has_data()) - { - $this->state = 'standalone_name'; - } - else - { - $this->state = 'emit'; - } - } - else - { - $this->state = false; - } - } - - public function standalone_name() - { - if (substr($this->data, $this->position, 10) === 'standalone') - { - $this->position += 10; - $this->skip_whitespace(); - $this->state = 'standalone_equals'; - } - else - { - $this->state = false; - } - } - - public function standalone_equals() - { - if (substr($this->data, $this->position, 1) === '=') - { - $this->position++; - $this->skip_whitespace(); - $this->state = 'standalone_value'; - } - else - { - $this->state = false; - } - } - - public function standalone_value() - { - if ($standalone = $this->get_value()) - { - switch ($standalone) - { - case 'yes': - $this->standalone = true; - break; - - case 'no': - $this->standalone = false; - break; - - default: - $this->state = false; - return; - } - - $this->skip_whitespace(); - if ($this->has_data()) - { - $this->state = false; - } - else - { - $this->state = 'emit'; - } - } - else - { - $this->state = false; - } - } -}
@@ -1,370 +0,0 @@
-<?php -/** - * SimplePie - * - * A PHP-Based RSS and Atom Feed Framework. - * Takes the hard work out of managing a complete RSS/Atom solution. - * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of the SimplePie Team nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue - * @author Ryan Parman - * @author Geoffrey Sneddon - * @author Ryan McCue - * @link http://simplepie.org/ SimplePie - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - */ - - -/** - * Decode 'gzip' encoded HTTP data - * - * @package SimplePie - * @subpackage HTTP - * @link http://www.gzip.org/format.txt - */ -class SimplePie_gzdecode -{ - /** - * Compressed data - * - * @access private - * @var string - * @see gzdecode::$data - */ - var $compressed_data; - - /** - * Size of compressed data - * - * @access private - * @var int - */ - var $compressed_size; - - /** - * Minimum size of a valid gzip string - * - * @access private - * @var int - */ - var $min_compressed_size = 18; - - /** - * Current position of pointer - * - * @access private - * @var int - */ - var $position = 0; - - /** - * Flags (FLG) - * - * @access private - * @var int - */ - var $flags; - - /** - * Uncompressed data - * - * @access public - * @see gzdecode::$compressed_data - * @var string - */ - var $data; - - /** - * Modified time - * - * @access public - * @var int - */ - var $MTIME; - - /** - * Extra Flags - * - * @access public - * @var int - */ - var $XFL; - - /** - * Operating System - * - * @access public - * @var int - */ - var $OS; - - /** - * Subfield ID 1 - * - * @access public - * @see gzdecode::$extra_field - * @see gzdecode::$SI2 - * @var string - */ - var $SI1; - - /** - * Subfield ID 2 - * - * @access public - * @see gzdecode::$extra_field - * @see gzdecode::$SI1 - * @var string - */ - var $SI2; - - /** - * Extra field content - * - * @access public - * @see gzdecode::$SI1 - * @see gzdecode::$SI2 - * @var string - */ - var $extra_field; - - /** - * Original filename - * - * @access public - * @var string - */ - var $filename; - - /** - * Human readable comment - * - * @access public - * @var string - */ - var $comment; - - /** - * Don't allow anything to be set - * - * @param string $name - * @param mixed $value - */ - public function __set($name, $value) - { - trigger_error("Cannot write property $name", E_USER_ERROR); - } - - /** - * Set the compressed string and related properties - * - * @param string $data - */ - public function __construct($data) - { - $this->compressed_data = $data; - $this->compressed_size = strlen($data); - } - - /** - * Decode the GZIP stream - * - * @return bool Successfulness - */ - public function parse() - { - if ($this->compressed_size >= $this->min_compressed_size) - { - // Check ID1, ID2, and CM - if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08") - { - return false; - } - - // Get the FLG (FLaGs) - $this->flags = ord($this->compressed_data[3]); - - // FLG bits above (1 << 4) are reserved - if ($this->flags > 0x1F) - { - return false; - } - - // Advance the pointer after the above - $this->position += 4; - - // MTIME - $mtime = substr($this->compressed_data, $this->position, 4); - // Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness - if (current(unpack('S', "\x00\x01")) === 1) - { - $mtime = strrev($mtime); - } - $this->MTIME = current(unpack('l', $mtime)); - $this->position += 4; - - // Get the XFL (eXtra FLags) - $this->XFL = ord($this->compressed_data[$this->position++]); - - // Get the OS (Operating System) - $this->OS = ord($this->compressed_data[$this->position++]); - - // Parse the FEXTRA - if ($this->flags & 4) - { - // Read subfield IDs - $this->SI1 = $this->compressed_data[$this->position++]; - $this->SI2 = $this->compressed_data[$this->position++]; - - // SI2 set to zero is reserved for future use - if ($this->SI2 === "\x00") - { - return false; - } - - // Get the length of the extra field - $len = current(unpack('v', substr($this->compressed_data, $this->position, 2))); - $this->position += 2; - - // Check the length of the string is still valid - $this->min_compressed_size += $len + 4; - if ($this->compressed_size >= $this->min_compressed_size) - { - // Set the extra field to the given data - $this->extra_field = substr($this->compressed_data, $this->position, $len); - $this->position += $len; - } - else - { - return false; - } - } - - // Parse the FNAME - if ($this->flags & 8) - { - // Get the length of the filename - $len = strcspn($this->compressed_data, "\x00", $this->position); - - // Check the length of the string is still valid - $this->min_compressed_size += $len + 1; - if ($this->compressed_size >= $this->min_compressed_size) - { - // Set the original filename to the given string - $this->filename = substr($this->compressed_data, $this->position, $len); - $this->position += $len + 1; - } - else - { - return false; - } - } - - // Parse the FCOMMENT - if ($this->flags & 16) - { - // Get the length of the comment - $len = strcspn($this->compressed_data, "\x00", $this->position); - - // Check the length of the string is still valid - $this->min_compressed_size += $len + 1; - if ($this->compressed_size >= $this->min_compressed_size) - { - // Set the original comment to the given string - $this->comment = substr($this->compressed_data, $this->position, $len); - $this->position += $len + 1; - } - else - { - return false; - } - } - - // Parse the FHCRC - if ($this->flags & 2) - { - // Check the length of the string is still valid - $this->min_compressed_size += $len + 2; - if ($this->compressed_size >= $this->min_compressed_size) - { - // Read the CRC - $crc = current(unpack('v', substr($this->compressed_data, $this->position, 2))); - - // Check the CRC matches - if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc) - { - $this->position += 2; - } - else - { - return false; - } - } - else - { - return false; - } - } - - // Decompress the actual data - if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false) - { - return false; - } - else - { - $this->position = $this->compressed_size - 8; - } - - // Check CRC of data - $crc = current(unpack('V', substr($this->compressed_data, $this->position, 4))); - $this->position += 4; - /*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc)) - { - return false; - }*/ - - // Check ISIZE of data - $isize = current(unpack('V', substr($this->compressed_data, $this->position, 4))); - $this->position += 4; - if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize)) - { - return false; - } - - // Wow, against all odds, we've actually got a valid gzip string - return true; - } - else - { - return false; - } - } -}