summaryrefslogtreecommitdiffstats
path: root/system/libraries/Trackback.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Trackback.php')
-rw-r--r--system/libraries/Trackback.php43
1 files changed, 24 insertions, 19 deletions
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, '<error>0</error>') === FALSE)
{
- $message = preg_match('/<message>(.*?)<\/message>/is', $this->response, $match) ? trim($match[1]) : 'An unknown error was encountered';
+ $message = preg_match('/<message>(.*?)<\/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;
}