| @@ -42,23 +42,26 @@ | ||
| 42 | 42 | * @param mixed $site |
| 43 | 43 | * @param mixed $path |
| 44 | 44 | * @return CJT_Framework_Wordpress_Feed |
| 45 | 45 | */ |
| 46 | - public function __construct($site, $path, $fields) { | |
| 47 | - # Initialize. | |
| 46 | + public function __construct($site, $path, $fields) | |
| 47 | + { | |
| 48 | + | |
| 48 | 49 | $this->site =& $site; |
| 49 | 50 | $this->path =& $path; |
| 50 | 51 | $this->fields = $fields; |
| 52 | + | |
| 51 | 53 | # Request server => get raw XML feed |
| 52 | - $feed = wp_remote_get("http://{$this->site}/{$this->path}"); | |
| 54 | + $feed = wp_remote_get( "http://{$this->site}/{$this->path}" ); | |
| 55 | + | |
| 53 | 56 | # Getting XML content |
| 54 | - $xmlContent = ((gettype($feed) !== 'WP_Error') && ($feed['response']['code'] == 200)) ? | |
| 55 | - wp_remote_retrieve_body($feed) : | |
| 57 | + $xmlContent = ( is_array( $feed ) && ( $feed[ 'response' ][ 'code' ] == 200 ) ) ? | |
| 58 | + wp_remote_retrieve_body( $feed ) : | |
| 56 | 59 | '<cjterrorrequest> |
| 57 | 60 | <channel cjt_error="true"> |
| 58 | 61 | <item> |
| 59 | - <title>ERROR</title> | |
| 60 | - <description>ERROR</description> | |
| 62 | + <title>ERROR !!!</title> | |
| 63 | + <description>ERROR Fetching data from CJT Server</description> | |
| 61 | 64 | <link>http://css-javascript-toolbox.com/</link> |
| 62 | 65 | </item> |
| 63 | 66 | </channel> |
| 64 | 67 | </cjterrorrequest>'; |