');
$description = force_balance_tags(''.trim($description).'
', true);
$description = $description == '' ? '...
':str_replace(array('"', '”'), '"', $description);
$post_date = self::rssPubDateToTime( (string)$item->pubDate );
return Arlima_ListFactory::createArticleDataArray(array(
'url' => (string)$item->link,
'image_options' => $img_options,
'text' => $description,
'title' => (string)$item->title,
'publish_date' => $post_date,
'html_title' => ''.( (string)$item->title ).'
'
));
}
/**
* @param string $pubDate
* @return int
*/
private static function rssPubDateToTime($pubDate) {
return strtotime($pubDate) + (get_option( 'gmt_offset' ) * 3600);
}
/**
* @param string $src
* @return array
*/
private function generateArticleImageOptions($src) {
return array(
'url' => $src,
'html' => '
',
'image_class' => 'attachment',
'image_size' => 'large',
'attach_id' => 0
);
}
/**
* @param SimpleXMLElement|stdClass $enc
* @return bool
*/
private function isEnlcosureValidImage($enc) {
$attr = $enc->attributes();
return isset($attr->type) && in_array(strtolower($attr->type), array('image/jpg', 'image/jpeg', 'image/gif', 'image/png'));
}
/**
* @static
* @return string
*/
private static function getLastJSONErrorMessage() {
switch (json_last_error()) {
case JSON_ERROR_NONE:
return ' - No errors';
break;
case JSON_ERROR_DEPTH:
return ' - Maximum stack depth exceeded';
break;
case JSON_ERROR_STATE_MISMATCH:
return ' - Underflow or the modes mismatch';
break;
case JSON_ERROR_CTRL_CHAR:
return ' - Unexpected control character found';
break;
case JSON_ERROR_SYNTAX:
return ' - Syntax error, malformed JSON';
break;
case JSON_ERROR_UTF8:
return ' - Malformed UTF-8 characters, possibly incorrectly encoded';
break;
default:
return ' - Unknown error';
break;
}
}
/**
* Helper function that displays info and remove button
* for an imported list
* @param string $url
* @param string $name
*/
public static function displayImportedList($url, $name) {
?>