From f4a4bd8fac188ebc9cda822ffc811c218fd92b45 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Thu, 20 Oct 2011 12:18:42 -0500 Subject: adding new license file (OSL 3.0) and updating readme to ReST added notice of license to all source files. OSL to all except the few files we ship inside of the application folder, those are AFL. Updated license in user guide. incrementing next dev version to 3.0 due to licensing change --- system/libraries/Trackback.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index b0a767822..e903ea7d0 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -4,10 +4,22 @@ * * An open source application development framework for PHP 5.1.6 or newer * + * NOTICE OF LICENSE + * + * Licensed under the Open Software License version 3.0 + * + * This source file is subject to the Open Software License (OSL 3.0) that is + * bundled with this package in the files license.txt / license.rst. It is + * also available through the world wide web at this URL: + * http://opensource.org/licenses/OSL-3.0 + * If you did not receive a copy of the license and are unable to obtain it + * through the world wide web, please send an email to + * licensing@ellislab.com so we can send you a copy immediately. + * * @package CodeIgniter - * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. - * @license http://codeigniter.com/user_guide/license.html + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 * @filesource @@ -23,7 +35,7 @@ * @package CodeIgniter * @subpackage Libraries * @category Trackbacks - * @author ExpressionEngine Dev Team + * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/libraries/trackback.html */ class CI_Trackback { -- cgit v1.2.3-24-g4f1b From 4eea9895e8ced75a1099c56215c09773de94b92c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 19 Dec 2011 12:05:41 +0200 Subject: Add method visibility declarations and optimize display_errors() method in Image_lib, Trackback and Upload libraries --- system/libraries/Trackback.php | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index e903ea7d0..3fa55ca20 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -66,7 +66,7 @@ class CI_Trackback { * @param array * @return bool */ - function send($tb_data) + public function send($tb_data) { if ( ! is_array($tb_data)) { @@ -147,7 +147,7 @@ class CI_Trackback { * @access public * @return bool */ - function receive() + public function receive() { foreach (array('url', 'title', 'blog_name', 'excerpt') as $val) { @@ -190,7 +190,7 @@ class CI_Trackback { * @param string * @return void */ - function send_error($message = 'Incomplete Information') + public function send_error($message = 'Incomplete Information') { echo "\n\n1\n".$message."\n"; exit; @@ -207,7 +207,7 @@ class CI_Trackback { * @access public * @return void */ - function send_success() + public function send_success() { echo "\n\n0\n"; exit; @@ -222,7 +222,7 @@ class CI_Trackback { * @param string * @return string */ - function data($item) + public function data($item) { return ( ! isset($this->data[$item])) ? '' : $this->data[$item]; } @@ -240,7 +240,7 @@ class CI_Trackback { * @param string * @return bool */ - function process($url, $data) + public function process($url, $data) { $target = parse_url($url); @@ -309,7 +309,7 @@ class CI_Trackback { * @param string * @return string */ - function extract_urls($urls) + public function extract_urls($urls) { // Remove the pesky white space and replace with a comma. $urls = preg_replace("/\s*(\S+)\s*/", "\\1,", $urls); @@ -345,7 +345,7 @@ class CI_Trackback { * @param string * @return string */ - function validate_url($url) + public function validate_url($url) { $url = trim($url); @@ -364,7 +364,7 @@ class CI_Trackback { * @param string * @return string */ - function get_id($url) + public function get_id($url) { $tb_id = ""; @@ -413,7 +413,7 @@ class CI_Trackback { * @param string * @return string */ - function convert_xml($str) + public function convert_xml($str) { $temp = '__TEMP_AMPERSANDS__'; @@ -443,7 +443,7 @@ class CI_Trackback { * @param string * @return string */ - function limit_characters($str, $n = 500, $end_char = '…') + public function limit_characters($str, $n = 500, $end_char = '…') { if (strlen($str) < $n) { @@ -480,7 +480,7 @@ class CI_Trackback { * @param string * @return string */ - function convert_ascii($str) + public function convert_ascii($str) { $count = 1; $out = ''; @@ -526,7 +526,7 @@ class CI_Trackback { * @param string * @return void */ - function set_error($msg) + public function set_error($msg) { log_message('error', $msg); $this->error_msg[] = $msg; @@ -542,19 +542,13 @@ class CI_Trackback { * @param string * @return string */ - function display_errors($open = '

', $close = '

') + public function display_errors($open = '

', $close = '

') { - $str = ''; - foreach ($this->error_msg as $val) - { - $str .= $open.$val.$close; - } - - return $str; + return (count($this->error_msg) > 0) ? $open . implode($close . $open, $this->error_msg) . $close : ''; } } // END Trackback Class /* End of file Trackback.php */ -/* Location: ./system/libraries/Trackback.php */ \ No newline at end of file +/* Location: ./system/libraries/Trackback.php */ -- cgit v1.2.3-24-g4f1b From 3a45957a30ff908445b2772efac8fdb65b64e6cd Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 21 Dec 2011 11:23:11 +0200 Subject: Also replace old-style 'var' with 'public' --- system/libraries/Trackback.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 3fa55ca20..1e5928314 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -40,12 +40,12 @@ */ class CI_Trackback { - var $time_format = 'local'; - var $charset = 'UTF-8'; - var $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => ''); - var $convert_ascii = TRUE; - var $response = ''; - var $error_msg = array(); + public $time_format = 'local'; + public $charset = 'UTF-8'; + public $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => ''); + public $convert_ascii = TRUE; + public $response = ''; + public $error_msg = array(); /** * Constructor -- cgit v1.2.3-24-g4f1b From d9cfa7bd39bfc88c09f88e63883fc3e8341d7f9d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 25 Dec 2011 16:32:59 +0200 Subject: Improve the Trackback library --- system/libraries/Trackback.php | 49 +++++++++++++----------------------------- 1 file changed, 15 insertions(+), 34 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 1e5928314..4302634cc 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -1,4 +1,4 @@ -convert_ascii == TRUE) + if ($this->convert_ascii == TRUE && in_array($item, array('excerpt', 'title', 'blog_name'))) { - if ($item == 'excerpt') - { - $$item = $this->convert_ascii($$item); - } - elseif ($item == 'title') - { - $$item = $this->convert_ascii($$item); - } - elseif ($item == 'blog_name') - { - $$item = $this->convert_ascii($$item); - } + $$item = $this->convert_ascii($$item); } } @@ -280,15 +269,9 @@ class CI_Trackback { @fclose($fp); - if (stristr($this->response, '0') === FALSE) + if (stripos($this->response, '0') === FALSE) { - $message = 'An unknown error was encountered'; - - if (preg_match("/(.*?)<\/message>/is", $this->response, $match)) - { - $message = trim($match['1']); - } - + $message = (preg_match('/(.*?)<\/message>/is', $this->response, $match)) ? trim($match[1]) : 'An unknown error was encountered'; $this->set_error($message); return FALSE; } @@ -318,7 +301,7 @@ class CI_Trackback { $urls = str_replace(",,", ",", $urls); // Remove any comma that might be at the end - if (substr($urls, -1) == ",") + if (substr($urls, -1) === ',') { $urls = substr($urls, 0, -1); } @@ -349,9 +332,9 @@ class CI_Trackback { { $url = trim($url); - if (substr($url, 0, 4) != "http") + if (strpos($url, 'http') !== 0) { - $url = "http://".$url; + $url = 'http://'.$url; } } @@ -417,15 +400,13 @@ class CI_Trackback { { $temp = '__TEMP_AMPERSANDS__'; - $str = preg_replace("/&#(\d+);/", "$temp\\1;", $str); - $str = preg_replace("/&(\w+);/", "$temp\\1;", $str); + $str = preg_replace(array('/&#(\d+);/', '/&(\w+);/'), "$temp\\1;", $str); $str = str_replace(array("&","<",">","\"", "'", "-"), array("&", "<", ">", """, "'", "-"), $str); - $str = preg_replace("/$temp(\d+);/","&#\\1;",$str); - $str = preg_replace("/$temp(\w+);/","&\\1;", $str); + $str = preg_replace(array("/$temp(\d+);/", "/$temp(\w+);/"), array('&#\\1;', '&\\1;'), $str); return $str; } @@ -457,13 +438,13 @@ class CI_Trackback { return $str; } - $out = ""; + $out = ''; foreach (explode(' ', trim($str)) as $val) { $out .= $val.' '; if (strlen($out) >= $n) { - return trim($out).$end_char; + return rtrim($out).$end_char; } } } @@ -496,16 +477,16 @@ class CI_Trackback { } else { - if (count($temp) == 0) + if (count($temp) === 0) { $count = ($ordinal < 224) ? 2 : 3; } $temp[] = $ordinal; - if (count($temp) == $count) + if (count($temp) === $count) { - $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64); + $number = ($count == 3) ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64) : (($temp[0] % 32) * 64) + ($temp[1] % 64); $out .= '&#'.$number.';'; $count = 1; -- cgit v1.2.3-24-g4f1b From cdf0c01f65f0b024fedc474a988957ed45a771e7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 27 Dec 2011 02:44:33 +0200 Subject: Remove access lines from method descriptions --- system/libraries/Trackback.php | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 4302634cc..b5e68507f 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -47,11 +47,6 @@ class CI_Trackback { public $response = ''; public $error_msg = array(); - /** - * Constructor - * - * @access public - */ public function __construct() { log_message('debug', "Trackback Class Initialized"); @@ -62,7 +57,6 @@ class CI_Trackback { /** * Send Trackback * - * @access public * @param array * @return bool */ @@ -133,7 +127,6 @@ class CI_Trackback { * If the data is valid it is set to the $this->data array * so that it can be inserted into a database. * - * @access public * @return bool */ public function receive() @@ -175,7 +168,6 @@ class CI_Trackback { * sends the "incomplete information" error, as that's * the most common one. * - * @access public * @param string * @return void */ @@ -193,7 +185,6 @@ class CI_Trackback { * This should be called when a trackback has been * successfully received and inserted. * - * @access public * @return void */ public function send_success() @@ -207,7 +198,6 @@ class CI_Trackback { /** * Fetch a particular item * - * @access public * @param string * @return string */ @@ -224,7 +214,6 @@ class CI_Trackback { * Opens a socket connection and passes the data to * the server. Returns TRUE on success, FALSE on failure * - * @access public * @param string * @param string * @return bool @@ -288,7 +277,6 @@ class CI_Trackback { * It takes a string of URLs (separated by comma or * space) and puts each URL into an array * - * @access public * @param string * @return string */ @@ -324,7 +312,6 @@ class CI_Trackback { * * Simply adds "http://" if missing * - * @access public * @param string * @return string */ @@ -343,7 +330,6 @@ class CI_Trackback { /** * Find the Trackback URL's ID * - * @access public * @param string * @return string */ @@ -392,7 +378,6 @@ class CI_Trackback { /** * Convert Reserved XML characters to Entities * - * @access public * @param string * @return string */ @@ -418,7 +403,6 @@ class CI_Trackback { * * Limits the string based on the character count. Will preserve complete words. * - * @access public * @param string * @param integer * @param string @@ -457,7 +441,6 @@ class CI_Trackback { * Converts Hight ascii text and MS Word special chars * to character entities * - * @access public * @param string * @return string */ @@ -503,7 +486,6 @@ class CI_Trackback { /** * Set error message * - * @access public * @param string * @return void */ @@ -518,7 +500,6 @@ class CI_Trackback { /** * Show error messages * - * @access public * @param string * @param string * @return string -- cgit v1.2.3-24-g4f1b From 0defe5d33ee2633f377a109519ca818becc60f64 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Sun, 1 Jan 2012 18:46:41 -0600 Subject: Updating copyright date to 2012 --- system/libraries/Trackback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index b5e68507f..79a009133 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From 07c1ac830b4e98aa40f48baef3dd05fb68c0a836 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 9 Mar 2012 17:03:37 +0000 Subject: Bumped CodeIgniter's PHP requirement to 5.2.4. Yes I know PHP 5.4 just came out, and yes I know PHP 5.3 has lovely features, but there are plenty of corporate systems running on CodeIgniter and PHP 5.3 still is not widely supported enough. CodeIgniter is great for distributed applications, and this is the highest we can reasonably go without breaking support. PHP 5.3 will most likely happen in another year or so. Fingers crossed on that one anyway... --- system/libraries/Trackback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 79a009133..3bea5f9b8 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE * -- cgit v1.2.3-24-g4f1b From 5b9fd2deb29968fd5f7b039868d95ce9c1392de5 Mon Sep 17 00:00:00 2001 From: tiyowan Date: Mon, 12 Mar 2012 20:26:59 +0400 Subject: Replace function_exists() checks with MB_ENABLED constant --- system/libraries/Trackback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 3bea5f9b8..be1de6f3f 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -141,7 +141,7 @@ class CI_Trackback { $this->data['charset'] = ( ! isset($_POST['charset'])) ? 'auto' : strtoupper(trim($_POST['charset'])); - if ($val != 'url' && function_exists('mb_convert_encoding')) + if ($val != 'url' && MB_ENABLED === TRUE) { $_POST[$val] = mb_convert_encoding($_POST[$val], $this->charset, $this->data['charset']); } -- cgit v1.2.3-24-g4f1b From 426faa94502218f110e5391e32aba795fa75b1e8 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 3 Apr 2012 19:03:58 +0300 Subject: Fix an issue in CI_Trackback::validate_url() and do some cleanup and optimizations in the library --- system/libraries/Trackback.php | 100 +++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 58 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index be1de6f3f..6761f63a5 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Trackback Class * @@ -49,7 +47,7 @@ class CI_Trackback { public function __construct() { - log_message('debug', "Trackback Class Initialized"); + log_message('debug', 'Trackback Class Initialized'); } // -------------------------------------------------------------------- @@ -97,9 +95,10 @@ class CI_Trackback { } // Build the Trackback data string - $charset = ( ! isset($tb_data['charset'])) ? $this->charset : $tb_data['charset']; + $charset = isset($tb_data['charset']) ? $tb_data['charset'] : $this->charset; - $data = "url=".rawurlencode($url)."&title=".rawurlencode($title)."&blog_name=".rawurlencode($blog_name)."&excerpt=".rawurlencode($excerpt)."&charset=".rawurlencode($charset); + $data = 'url='.rawurlencode($url).'&title='.rawurlencode($title).'&blog_name='.rawurlencode($blog_name) + .'&excerpt='.rawurlencode($excerpt).'&charset='.rawurlencode($charset); // Send Trackback(s) $return = TRUE; @@ -139,7 +138,7 @@ class CI_Trackback { return FALSE; } - $this->data['charset'] = ( ! isset($_POST['charset'])) ? 'auto' : strtoupper(trim($_POST['charset'])); + $this->data['charset'] = isset($_POST['charset']) ? strtoupper(trim($_POST['charset'])) : 'auto'; if ($val != 'url' && MB_ENABLED === TRUE) { @@ -164,7 +163,7 @@ class CI_Trackback { /** * Send Trackback Error Message * - * Allows custom errors to be set. By default it + * Allows custom errors to be set. By default it * sends the "incomplete information" error, as that's * the most common one. * @@ -173,7 +172,7 @@ class CI_Trackback { */ public function send_error($message = 'Incomplete Information') { - echo "\n\n1\n".$message."\n"; + echo '\n\n1\n".$message."\n"; exit; } @@ -189,7 +188,7 @@ class CI_Trackback { */ public function send_success() { - echo "\n\n0\n"; + echo '\n\n0\n"; exit; } @@ -203,7 +202,7 @@ class CI_Trackback { */ public function data($item) { - return ( ! isset($this->data[$item])) ? '' : $this->data[$item]; + return isset($this->data[$item]) ? $this->data[$item] : ''; } // -------------------------------------------------------------------- @@ -212,7 +211,7 @@ class CI_Trackback { * Process Trackback * * Opens a socket connection and passes the data to - * the server. Returns TRUE on success, FALSE on failure + * the server. Returns TRUE on success, FALSE on failure * * @param string * @param string @@ -230,37 +229,36 @@ class CI_Trackback { } // Build the path - $ppath = ( ! isset($target['path'])) ? $url : $target['path']; + $ppath = isset($target['path']) ? $target['path'] : $url; - $path = (isset($target['query']) && $target['query'] != "") ? $ppath.'?'.$target['query'] : $ppath; + $path = empty($target['query']) ? $ppath : $ppath.'?'.$target['query']; // Add the Trackback ID to the data string if ($id = $this->get_id($url)) { - $data = "tb_id=".$id."&".$data; + $data = 'tb_id='.$id.'&'.$data; } // Transfer the data - fputs ($fp, "POST " . $path . " HTTP/1.0\r\n" ); - fputs ($fp, "Host: " . $target['host'] . "\r\n" ); - fputs ($fp, "Content-type: application/x-www-form-urlencoded\r\n" ); - fputs ($fp, "Content-length: " . strlen($data) . "\r\n" ); - fputs ($fp, "Connection: close\r\n\r\n" ); - fputs ($fp, $data); + fputs($fp, 'POST '.$path." HTTP/1.0\r\n"); + fputs($fp, 'Host: '.$target['host']."\r\n"); + fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); + fputs($fp, 'Content-length: '.strlen($data)."\r\n"); + fputs($fp, "Connection: close\r\n\r\n"); + fputs($fp, $data); // Was it successful? - $this->response = ""; + $this->response = ''; while ( ! feof($fp)) { $this->response .= fgets($fp, 128); } @fclose($fp); - if (stripos($this->response, '0') === FALSE) { - $message = (preg_match('/(.*?)<\/message>/is', $this->response, $match)) ? trim($match[1]) : 'An unknown error was encountered'; + $message = preg_match('/(.*?)<\/message>/is', $this->response, $match) ? trim($match[1]) : 'An unknown error was encountered'; $this->set_error($message); return FALSE; } @@ -282,11 +280,8 @@ class CI_Trackback { */ public function extract_urls($urls) { - // Remove the pesky white space and replace with a comma. - $urls = preg_replace("/\s*(\S+)\s*/", "\\1,", $urls); - - // If they use commas get rid of the doubles. - $urls = str_replace(",,", ",", $urls); + // Remove the pesky white space and replace with a comma, then replace doubles. + $urls = str_replace(',,', ',', preg_replace('/\s*(\S+)\s*/', '\\1,', $urls)); // Remove any comma that might be at the end if (substr($urls, -1) === ',') @@ -294,11 +289,8 @@ class CI_Trackback { $urls = substr($urls, 0, -1); } - // Break into an array via commas - $urls = preg_split('/[,]/', $urls); - - // Removes duplicates - $urls = array_unique($urls); + // Break into an array via commas and remove duplicates + $urls = array_unique(preg_split('/[,]/', $urls)); array_walk($urls, array($this, 'validate_url')); @@ -313,9 +305,9 @@ class CI_Trackback { * Simply adds "http://" if missing * * @param string - * @return string + * @return void */ - public function validate_url($url) + public function validate_url(&$url) { $url = trim($url); @@ -335,7 +327,7 @@ class CI_Trackback { */ public function get_id($url) { - $tb_id = ""; + $tb_id = ''; if (strpos($url, '?') !== FALSE) { @@ -359,18 +351,11 @@ class CI_Trackback { if ( ! is_numeric($tb_id)) { - $tb_id = $tb_array[count($tb_array)-2]; + $tb_id = $tb_array[count($tb_array)-2]; } } - if ( ! preg_match ("/^([0-9]+)$/", $tb_id)) - { - return FALSE; - } - else - { - return $tb_id; - } + return preg_match('/^[0-9]+$/', $tb_id) ? $tb_id : FALSE; } // -------------------------------------------------------------------- @@ -385,15 +370,13 @@ class CI_Trackback { { $temp = '__TEMP_AMPERSANDS__'; - $str = preg_replace(array('/&#(\d+);/', '/&(\w+);/'), "$temp\\1;", $str); - - $str = str_replace(array("&","<",">","\"", "'", "-"), - array("&", "<", ">", """, "'", "-"), - $str); + $str = preg_replace(array('/&#(\d+);/', '/&(\w+);/'), $temp.'\\1;', $str); - $str = preg_replace(array("/$temp(\d+);/", "/$temp(\w+);/"), array('&#\\1;', '&\\1;'), $str); + $str = str_replace(array('&', '<', '>', '"', "'", '-'), + array('&', '<', '>', '"', ''', '-'), + $str); - return $str; + return preg_replace(array('/'.$temp.'(\d+);/', '/'.$temp.'(\w+);/'), array('&#\\1;', '&\\1;'), $str); } // -------------------------------------------------------------------- @@ -404,7 +387,7 @@ class CI_Trackback { * Limits the string based on the character count. Will preserve complete words. * * @param string - * @param integer + * @param int * @param string * @return string */ @@ -415,7 +398,7 @@ class CI_Trackback { return $str; } - $str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str)); + $str = preg_replace('/\s+/', ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str)); if (strlen($str) <= $n) { @@ -469,7 +452,9 @@ class CI_Trackback { if (count($temp) === $count) { - $number = ($count == 3) ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64) : (($temp[0] % 32) * 64) + ($temp[1] % 64); + $number = ($count === 3) + ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64) + : (($temp[0] % 32) * 64) + ($temp[1] % 64); $out .= '&#'.$number.';'; $count = 1; @@ -506,11 +491,10 @@ class CI_Trackback { */ public function display_errors($open = '

', $close = '

') { - return (count($this->error_msg) > 0) ? $open . implode($close . $open, $this->error_msg) . $close : ''; + return (count($this->error_msg) > 0) ? $open.implode($close.$open, $this->error_msg).$close : ''; } } -// END Trackback Class /* End of file Trackback.php */ -/* Location: ./system/libraries/Trackback.php */ +/* Location: ./system/libraries/Trackback.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From d261b1e89c3d4d5191036d5a5660ef6764e593a0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:12:16 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/libraries --- system/libraries/Trackback.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 6761f63a5..0da85a022 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -88,7 +88,7 @@ class CI_Trackback { } // Convert High ASCII Characters - if ($this->convert_ascii == TRUE && in_array($item, array('excerpt', 'title', 'blog_name'))) + if ($this->convert_ascii === TRUE && in_array($item, array('excerpt', 'title', 'blog_name'))) { $$item = $this->convert_ascii($$item); } @@ -106,7 +106,7 @@ class CI_Trackback { { foreach ($ping_url as $url) { - if ($this->process($url, $data) == FALSE) + if ($this->process($url, $data) === FALSE) { $return = FALSE; } @@ -132,7 +132,7 @@ class CI_Trackback { { foreach (array('url', 'title', 'blog_name', 'excerpt') as $val) { - if ( ! isset($_POST[$val]) OR $_POST[$val] == '') + if ( ! isset($_POST[$val]) OR $_POST[$val] === '') { $this->set_error('The following required POST variable is missing: '.$val); return FALSE; @@ -140,14 +140,14 @@ class CI_Trackback { $this->data['charset'] = isset($_POST['charset']) ? strtoupper(trim($_POST['charset'])) : 'auto'; - if ($val != 'url' && MB_ENABLED === TRUE) + if ($val !== 'url' && MB_ENABLED === TRUE) { $_POST[$val] = mb_convert_encoding($_POST[$val], $this->charset, $this->data['charset']); } - $_POST[$val] = ($val != 'url') ? $this->convert_xml(strip_tags($_POST[$val])) : strip_tags($_POST[$val]); + $_POST[$val] = ($val !== 'url') ? $this->convert_xml(strip_tags($_POST[$val])) : strip_tags($_POST[$val]); - if ($val == 'excerpt') + if ($val === 'excerpt') { $_POST['excerpt'] = $this->limit_characters($_POST['excerpt']); } -- cgit v1.2.3-24-g4f1b From 5036c9caabb12f90b9533d7fb417610e02a652ff Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 4 Jun 2012 15:34:56 +0300 Subject: Revert/optimize some changes from 773ccc318f2769c9b7579630569b5d8ba47b114b and d261b1e89c3d4d5191036d5a5660ef6764e593a0 --- system/libraries/Trackback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 0da85a022..9a680dc2a 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -132,7 +132,7 @@ class CI_Trackback { { foreach (array('url', 'title', 'blog_name', 'excerpt') as $val) { - if ( ! isset($_POST[$val]) OR $_POST[$val] === '') + if (empty($_POST[$val])) { $this->set_error('The following required POST variable is missing: '.$val); return FALSE; -- cgit v1.2.3-24-g4f1b From 5fd3ae8d33a4f5d3159b86683b9a670e973a63f5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 24 Oct 2012 14:55:35 +0300 Subject: [ci skip] style and phpdoc-related changes (rel #1295) --- system/libraries/Trackback.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 9a680dc2a..7bd7cba04 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -45,6 +45,11 @@ class CI_Trackback { public $response = ''; public $error_msg = array(); + /** + * Constructor + * + * @return void + */ public function __construct() { log_message('debug', 'Trackback Class Initialized'); -- cgit v1.2.3-24-g4f1b From c5536aac5752054f7f76e448d58b86407d8f574e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Nov 2012 17:33:58 +0200 Subject: Manually apply PR #1594 (fixing phpdoc page-level generation/warnings) Also partially fixes issue #1295, fixes inconsistencies in some page-level docblocks and adds include checks in language files. --- system/libraries/Trackback.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 7bd7cba04..ac74f3632 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -1,4 +1,4 @@ - Date: Thu, 1 Nov 2012 23:33:14 +0200 Subject: [ci skip] DocBlocks for Pagination, Session, Trackback, Jquery libraries Partially fixes issue #1295 --- system/libraries/Trackback.php | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index ac74f3632..c923a6220 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -39,12 +39,45 @@ defined('BASEPATH') OR exit('No direct script access allowed'); */ class CI_Trackback { - public $time_format = 'local'; + /** + * Character set + * + * @var string + */ public $charset = 'UTF-8'; - public $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => ''); + + /** + * Trackback data + * + * @var array + */ + public $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => ''); + + /** + * Convert ASCII flag + * + * Whether to convert high-ASCII and MS Word + * characters to HTML entities. + * + * @var bool + */ public $convert_ascii = TRUE; - public $response = ''; - public $error_msg = array(); + + /** + * Response + * + * @var string + */ + public $response = ''; + + /** + * Error messages list + * + * @var string[] + */ + public $error_msg = array(); + + // -------------------------------------------------------------------- /** * Constructor -- cgit v1.2.3-24-g4f1b From 7a7ad782b2f125622509a77c5a6f94ad4ae0f93c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 12 Nov 2012 17:21:01 +0200 Subject: Some micro-optimizations --- system/libraries/Trackback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index c923a6220..d30350340 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -394,7 +394,7 @@ class CI_Trackback { } } - return preg_match('/^[0-9]+$/', $tb_id) ? $tb_id : FALSE; + return ctype_digit((string) $tb_id) ? $tb_id : FALSE; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 80500afbd188600212ca913a7bac073009feac73 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 1 Jan 2013 08:16:53 +0200 Subject: [ci skip] Happy new year --- system/libraries/Trackback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index d30350340..2fb737d6b 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From 5b5401a78403fce9a32acd912686b5e6cdba15b7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 10 Jan 2013 17:38:08 +0200 Subject: A tiny improvement --- system/libraries/Trackback.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 2fb737d6b..ecc7129e3 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -268,9 +268,8 @@ class CI_Trackback { } // Build the path - $ppath = isset($target['path']) ? $target['path'] : $url; - - $path = empty($target['query']) ? $ppath : $ppath.'?'.$target['query']; + $path = isset($target['path']) ? $target['path'] : $url; + empty($target['query']) OR $path .= '?'.$target['query']; // Add the Trackback ID to the data string if ($id = $this->get_id($url)) -- cgit v1.2.3-24-g4f1b From 353f9834adf3f44c6c7a0f924089bb2b43360404 Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Thu, 24 Jan 2013 17:09:10 -0700 Subject: Updated all cases of exit() to return a valid code Specific codes are as follows, but can easily be changed if a different order/breakdown makes more sense: - 0: Success; everything executed as planned - 1: Configuration Error; something is wrong with/in the configuration file(s) - 2: Class Not Found; what it says - 3: Driver Method Unsupported; the method you're trying to use on a Driver doesn't exist - 4: File Not Found; 404 error - 5: Database Error; something is broken in the database somewhere - 6: Invalid Input; the user attempted to submit a request with invlaid characters in 1+ key names 7 through 26 are reserved for future use - 27: Generic Error; generated by show_error() when the status code is >= 100 28 through 127 are errors generated by user applications, normally by using show_error() with a status code below 100 128 through 254 should not be used by applications, as they are reserved by system-level functions - 255: PHP Fatal Error; automatically generated by PHP for fatal errors, and therefore not allowed for our use Status codes below 100 are shifted up by 28 to place them in the user error range. It may make more sense to have these codes left alone and instead shift the CI errors into the 101 through 127 space, but that's not what I opted for here. It would probably also be a good idea to replace the hard-coded numbers with constants or some such, but I was in a bit of a hurry when I made these changes, so I didn't look around for the best place to do this. With proper guidance, I could easily amend this commit with another that uses such constant values. Signed-off-by: Daniel Hunsaker --- system/libraries/Trackback.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index ecc7129e3..cc93b2e30 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -212,7 +212,7 @@ class CI_Trackback { public function send_error($message = 'Incomplete Information') { echo '\n\n1\n".$message."\n"; - exit; + exit(0); } // -------------------------------------------------------------------- @@ -228,7 +228,7 @@ class CI_Trackback { public function send_success() { echo '\n\n0\n"; - exit; + exit(0); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 3b5b7f48848d098c6190781f8790a1b0dcb0217c Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Fri, 22 Feb 2013 19:17:56 -0700 Subject: Updated exit codes as constant values Re-allocated exit status codes according to three references, which follow: BSD sysexits.h:http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits GNU recomendations:http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html Bash scripting:http://tldp.org/LDP/abs/html/exitcodes.html The GNU recommendations stem from and expand upon the standard C/C++ library (stdlibc) definitions, while also suggesting some best-practice conventions which happen to prevent exit status code collisions with bash, and probably other shells. The re-allocated codes are now mapped to constant values, set in *application/config/constants.php*, and used throughout the CodeIgniter core. They would additionally be used in *index.php*, but the constants file hasn't been loaded at that point, so the integer values are used instead, and a comment follows each such use with amplifying information on why that particular value was selected. Finally, the errors documentation has been updated accordingly. Signed-off-by: Daniel Hunsaker --- system/libraries/Trackback.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index cc93b2e30..ea8017efd 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -212,7 +212,7 @@ class CI_Trackback { public function send_error($message = 'Incomplete Information') { echo '\n\n1\n".$message."\n"; - exit(0); + exit(EXIT_SUCCESS); } // -------------------------------------------------------------------- @@ -228,7 +228,7 @@ class CI_Trackback { public function send_success() { echo '\n\n0\n"; - exit(0); + exit(EXIT_SUCCESS); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From b2ac67a3a766ac18f5041eff7a5cbeef7437a184 Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Mon, 4 Mar 2013 02:31:26 -0700 Subject: Oops, missed a few places where EXIT_SUCCESS was being used. Signed-off-by: Daniel Hunsaker --- system/libraries/Trackback.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index ea8017efd..ecc7129e3 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -212,7 +212,7 @@ class CI_Trackback { public function send_error($message = 'Incomplete Information') { echo '\n\n1\n".$message."\n"; - exit(EXIT_SUCCESS); + exit; } // -------------------------------------------------------------------- @@ -228,7 +228,7 @@ class CI_Trackback { public function send_success() { echo '\n\n0\n"; - exit(EXIT_SUCCESS); + exit; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 8626e93d5b4362c86a58933dda9206ac8810476d Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Mon, 4 Mar 2013 05:14:22 -0700 Subject: Reverting changes to functions that have no business being used in CLI apps to begin with Signed-off-by: Daniel Hunsaker --- system/libraries/Trackback.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index ecc7129e3..5a45be8dd 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -211,8 +211,7 @@ class CI_Trackback { */ public function send_error($message = 'Incomplete Information') { - echo '\n\n1\n".$message."\n"; - exit; + exit('\n\n1\n".$message."\n"); } // -------------------------------------------------------------------- @@ -227,8 +226,7 @@ class CI_Trackback { */ public function send_success() { - echo '\n\n0\n"; - exit; + exit('\n\n0\n"); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 871754af60251993d640981e107d2def5f2db396 Mon Sep 17 00:00:00 2001 From: darwinel Date: Tue, 11 Feb 2014 17:34:57 +0100 Subject: 2013 > 2014 Update copyright notices from 2013 to 2014. And update one calendar example in user_guide from year 2013/2014 to 2014/2015. --- system/libraries/Trackback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 5a45be8dd..7bcb2aa21 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From be1496d1a8618ef186047468009c7e3e0640183b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 11 Feb 2014 22:48:45 +0200 Subject: Utf8/iconv/mbstring-related changes --- system/libraries/Trackback.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 7bcb2aa21..9fa4a8edb 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -181,7 +181,14 @@ class CI_Trackback { if ($val !== 'url' && MB_ENABLED === TRUE) { - $_POST[$val] = mb_convert_encoding($_POST[$val], $this->charset, $this->data['charset']); + if (MB_ENABLED === TRUE) + { + $_POST[$val] = mb_convert_encoding($_POST[$val], $this->charset, $this->data['charset']); + } + elseif (ICONV_ENABLED === TRUE) + { + $_POST[$val] = @iconv($this->data['charset'], $this->charset.'//IGNORE', $_POST[$val]); + } } $_POST[$val] = ($val !== 'url') ? $this->convert_xml(strip_tags($_POST[$val])) : strip_tags($_POST[$val]); -- cgit v1.2.3-24-g4f1b From 9a0e0c76b64d2a401d7ae32d1e53aaca30c7d959 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 9 Apr 2014 15:10:27 +0300 Subject: Minor changes in FV, Trackback --- system/libraries/Trackback.php | 43 +++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 9fa4a8edb..e22361e1f 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -44,14 +44,20 @@ class CI_Trackback { * * @var string */ - public $charset = 'UTF-8'; + public $charset = 'UTF-8'; /** * Trackback data * * @var array */ - public $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => ''); + public $data = array( + 'url' => '', + 'title' => '', + 'excerpt' => '', + 'blog_name' => '', + 'charset' => '' + ); /** * Convert ASCII flag @@ -61,21 +67,21 @@ class CI_Trackback { * * @var bool */ - public $convert_ascii = TRUE; + public $convert_ascii = TRUE; /** * Response * * @var string */ - public $response = ''; + public $response = ''; /** * Error messages list * * @var string[] */ - public $error_msg = array(); + public $error_msg = array(); // -------------------------------------------------------------------- @@ -116,18 +122,22 @@ class CI_Trackback { switch ($item) { - case 'ping_url' : $$item = $this->extract_urls($tb_data[$item]); + case 'ping_url': + $$item = $this->extract_urls($tb_data[$item]); break; - case 'excerpt' : $$item = $this->limit_characters($this->convert_xml(strip_tags(stripslashes($tb_data[$item])))); + case 'excerpt': + $$item = $this->limit_characters($this->convert_xml(strip_tags(stripslashes($tb_data[$item])))); break; - case 'url' : $$item = str_replace('-', '-', $this->convert_xml(strip_tags(stripslashes($tb_data[$item])))); + case 'url': + $$item = str_replace('-', '-', $this->convert_xml(strip_tags(stripslashes($tb_data[$item])))); break; - default : $$item = $this->convert_xml(strip_tags(stripslashes($tb_data[$item]))); + default: + $$item = $this->convert_xml(strip_tags(stripslashes($tb_data[$item]))); break; } // Convert High ASCII Characters - if ($this->convert_ascii === TRUE && in_array($item, array('excerpt', 'title', 'blog_name'))) + if ($this->convert_ascii === TRUE && in_array($item, array('excerpt', 'title', 'blog_name'), TRUE)) { $$item = $this->convert_ascii($$item); } @@ -301,7 +311,9 @@ class CI_Trackback { if (stripos($this->response, '0') === FALSE) { - $message = preg_match('/(.*?)<\/message>/is', $this->response, $match) ? trim($match[1]) : 'An unknown error was encountered'; + $message = preg_match('/(.*?)<\/message>/is', $this->response, $match) + ? trim($match[1]) + : 'An unknown error was encountered'; $this->set_error($message); return FALSE; } @@ -326,17 +338,10 @@ class CI_Trackback { // Remove the pesky white space and replace with a comma, then replace doubles. $urls = str_replace(',,', ',', preg_replace('/\s*(\S+)\s*/', '\\1,', $urls)); - // Remove any comma that might be at the end - if (substr($urls, -1) === ',') - { - $urls = substr($urls, 0, -1); - } - // Break into an array via commas and remove duplicates - $urls = array_unique(preg_split('/[,]/', $urls)); + $urls = array_unique(preg_split('/[,]/', rtrim($urls, ','))); array_walk($urls, array($this, 'validate_url')); - return $urls; } -- cgit v1.2.3-24-g4f1b From bdb96ca1b1dbfc1791172fd169d7751cbc4d7d55 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 28 Oct 2014 00:13:31 +0200 Subject: [ci skip] Switch to MIT license; close #3293 --- system/libraries/Trackback.php | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index e22361e1f..2bca15de7 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -4,24 +4,35 @@ * * An open source application development framework for PHP 5.2.4 or newer * - * NOTICE OF LICENSE + * This content is released under the MIT License (MIT) * - * Licensed under the Open Software License version 3.0 + * Copyright (c) 2014, British Columbia Institute of Technology * - * This source file is subject to the Open Software License (OSL 3.0) that is - * bundled with this package in the files license.txt / license.rst. It is - * also available through the world wide web at this URL: - * http://opensource.org/licenses/OSL-3.0 - * If you did not receive a copy of the license and are unable to obtain it - * through the world wide web, please send an email to - * licensing@ellislab.com so we can send you a copy immediately. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * @package CodeIgniter - * @author EllisLab Dev Team + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @package CodeIgniter + * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - * @link http://codeigniter.com - * @since Version 1.0 + * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link http://codeigniter.com + * @since Version 1.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); -- cgit v1.2.3-24-g4f1b From fe9309d22c1b088f5363954d6dac013c8c955894 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 9 Jan 2015 17:48:58 +0200 Subject: Bulk (mostly documentation) update - Remove PHP version from license notices - Bump year number in copyright notices - Recommend PHP 5.4 or newer to be used - Tell Travis-CI to test on PHP 5.3.0 instead of the latest 5.3 version Related: #3450 --- system/libraries/Trackback.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 2bca15de7..3284923fd 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -2,11 +2,11 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.2.4 or newer + * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014, British Columbia Institute of Technology + * Copyright (c) 2014 - 2015, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From 90726b8c769ea75aec34814ddfa91655d488e6c3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Jan 2015 12:39:22 +0200 Subject: [ci skip] Change some log messages' level 'Class Loaded' type of messages flood log files when log_threshold is set to 2 (debug). They're now logged as 'info' level. This is manually applying PR #1528, which was created to do the same thing, but became outdated. --- system/libraries/Trackback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 3284923fd..9992fb417 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -103,7 +103,7 @@ class CI_Trackback { */ public function __construct() { - log_message('debug', 'Trackback Class Initialized'); + log_message('info', 'Trackback Class Initialized'); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 4cbe463b4c442e0e2dae2f43565e77f7ac5ecb86 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Wed, 21 Jan 2015 22:56:22 +0100 Subject: Remove closing blocks at end of PHP files --- system/libraries/Trackback.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 9992fb417..23bdbbd58 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -554,6 +554,3 @@ class CI_Trackback { } } - -/* End of file Trackback.php */ -/* Location: ./system/libraries/Trackback.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 125ef4751080a2118cb203357d77687699e3eb25 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:33:00 +0200 Subject: [ci skip] Bump year to 2016 --- system/libraries/Trackback.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 23bdbbd58..944672e62 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2015, British Columbia Institute of Technology + * Copyright (c) 2014 - 2016, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From bd202c91b0e9cf0a8c93bcaa71df9574f5909346 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:50:18 +0200 Subject: [ci skip] Update codeigniter.com links to https --- system/libraries/Trackback.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 944672e62..7488a809b 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -31,7 +31,7 @@ * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com + * @link https://codeigniter.com * @since Version 1.0.0 * @filesource */ @@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Libraries * @category Trackbacks * @author EllisLab Dev Team - * @link http://codeigniter.com/user_guide/libraries/trackback.html + * @link https://codeigniter.com/user_guide/libraries/trackback.html */ class CI_Trackback { -- cgit v1.2.3-24-g4f1b From 1924e879b165fb119847a49a7a5eab2f28295fa2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:55:34 +0200 Subject: [ci skip] Update ellislab.com links to https too --- system/libraries/Trackback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 7488a809b..a9b256464 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -28,7 +28,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com -- cgit v1.2.3-24-g4f1b From e33c82d62e5a56b2fe46096420de838eb74553e8 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 10 Aug 2016 15:18:31 +0300 Subject: Merge pull request #4758 from butane/uri_scheme_case URI schemes are not case-sensitive --- system/libraries/Trackback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index a9b256464..7222c00c2 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -370,7 +370,7 @@ class CI_Trackback { { $url = trim($url); - if (strpos($url, 'http') !== 0) + if (stripos($url, 'http') !== 0) { $url = 'http://'.$url; } -- cgit v1.2.3-24-g4f1b From da60e9bc66ec90970fbd2dfd08b0a6e66b9f5f5f Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Sat, 31 Dec 2016 08:46:18 -0800 Subject: Update copyright data to 2017 --- system/libraries/Trackback.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Trackback.php') diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 7222c00c2..55e9a0ee6 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b