Changeset 2295 for branches

Show
Ignore:
Timestamp:
12/12/10 20:35:39 (18 months ago)
Author:
petsagouris
Message:

[Branch 1.5] Implemented MySQLi over the old MySQL PHP extension. This is supposed to be somewhat faster.
Need to test the speed before and after, with DB_CACHE off.

Also made appropriate changes throughout the core classes.
Stripped down some 2000+ lines of code from SimplePie that had to do with caching to database.
removed a single line from an unused part of Inspekt/Inspekt.php that came out ugly after running the MySQL to MySQLi converter script found at  http://forge.mysql.com/wiki/Converting_to_MySQLi
Fixed init_database function in install/install_functions.php to use the Database class instead of the old EzSQL class. What a leftover! ...brought up memories!
Renamed the READ_ME.txt to README.txt :)

Location:
branches
Files:
7 modified
1 moved

Legend:

Unmodified
Added
Removed
  • branches/1.4/install/install_functions.php

    r2227 r2295  
    3737function init_database() 
    3838{ 
    39         $ezSQL = new ezSQL_mysql(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); 
    40         $ezSQL->query("SET NAMES 'utf8'"); 
    41          
    42         return $ezSQL; 
     39        return new Database(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); 
    4340} 
    4441     
  • branches/1.5/Hotaru.php

    r2288 r2295  
    104104 
    105105                        $this->csrf(FALSE);                         // set a csrfToken 
    106                         $this->db->setHotaru($this);                // pass $h object to EzSQL for error reporting 
    107106                } 
    108107        } 
  • branches/1.5/install/index.php

    r2268 r2295  
    2828 * @link      http://www.hotarucms.org/ 
    2929 */ 
    30  
    3130// start session: 
    3231session_start(); 
     
    3635 
    3736if (file_exists(SETTINGS)) { 
    38     include_once(SETTINGS); 
    39     $settings_file_exists = true; 
     37        include_once(SETTINGS); 
     38        $settings_file_exists = true; 
    4039} else { 
    41     $settings_file_exists = false; 
    42 } 
    43  
    44 if (!defined("SITEURL")) { define("SITEURL", BASEURL); } 
     40        $settings_file_exists = false; 
     41} 
     42 
     43if (!defined("SITEURL")) { 
     44        define("SITEURL", BASEURL); 
     45} 
    4546 
    4647// define path constants 
    4748$path_constants = array( 
    48     "BASE" => "/../", 
    49     "ADMIN" => "/../admin/", 
    50     "INSTALL" => "/", 
    51     "CACHE" => "/../cache/", 
    52     "LIBS" => "/../libs/", 
    53     "EXTENSIONS" => "/../libs/extensions/", 
    54     "FUNCTIONS" => "/../functions/", 
    55     "THEMES" => "/../content/themes/", 
    56     "PLUGINS" => "/../content/plugins/", 
    57     "ADMIN_THEMES" => "/../content/admin_themes/", 
    58     ); 
    59  
    60 foreach ( $path_constants as $key => $value ) { 
    61 if (!defined($key)) 
    62     define($key, dirname(__FILE__) . $value); 
     49        "BASE" => "/../", 
     50        "ADMIN" => "/../admin/", 
     51        "INSTALL" => "/", 
     52        "CACHE" => "/../cache/", 
     53        "LIBS" => "/../libs/", 
     54        "EXTENSIONS" => "/../libs/extensions/", 
     55        "FUNCTIONS" => "/../functions/", 
     56        "THEMES" => "/../content/themes/", 
     57        "PLUGINS" => "/../content/plugins/", 
     58        "ADMIN_THEMES" => "/../content/admin_themes/", 
     59); 
     60 
     61foreach ($path_constants as $key => $value) { 
     62        if (!defined($key)) 
     63                define($key, dirname(__FILE__).$value); 
    6364} 
    6465 
    6566require_once('install_tables.php'); 
    6667require_once('install_functions.php'); 
    67 require_once(BASE . 'Hotaru.php'); 
    68 require_once(EXTENSIONS . 'csrf/csrf_class.php'); // protection against CSRF attacks 
    69 require_once(EXTENSIONS . 'Inspekt/Inspekt.php'); // sanitation 
    70 require_once(LIBS . 'Database.php'); // database 
    71  
    72 $h  = new Hotaru('start'); // must come before language inclusion 
    73 require_once(INSTALL . 'install_language.php');    // language file for install 
     68require_once(BASE.'Hotaru.php'); 
     69require_once(EXTENSIONS.'csrf/csrf_class.php'); // protection against CSRF attacks 
     70require_once(EXTENSIONS.'Inspekt/Inspekt.php'); // sanitation 
     71require_once(LIBS.'Database.php'); // database 
     72 
     73$h = new Hotaru('start'); // must come before language inclusion 
     74require_once(INSTALL.'install_language.php');   // language file for install 
    7475 
    7576$version_number = $h->version; 
    7677$cage = init_inspekt_cage(); 
    7778 
    78 $step = $cage->get->getInt('step');        // Installation steps. 
    79 $action = $cage->get->getAlpha('action');    // Install or Upgrade. 
     79$step = $cage->get->getInt('step');             // Installation steps. 
     80$action = $cage->get->getAlpha('action');       // Install or Upgrade. 
    8081 
    8182switch ($step) { 
    8283        case 0: 
    83                 installation_welcome();    // "Welcome to Hotaru CMS. 
     84                installation_welcome();  // "Welcome to Hotaru CMS. 
    8485                break; 
    85         case 1:  
     86        case 1: 
    8687                if ($action == 'upgrade') { 
    8788                        database_upgrade(); 
    8889                } else { 
    8990                        // Remove any cookies set in a previous installation: 
    90                         setcookie("hotaru_user", "", time()-3600, "/"); 
    91                         setcookie("hotaru_key", "", time()-3600, "/"); 
    92                          
     91                        setcookie("hotaru_user", "", time() - 3600, "/"); 
     92                        setcookie("hotaru_key", "", time() - 3600, "/"); 
     93 
    9394                        // database setup (DB name, user, password, prefix...) 
    9495                        // use this direct call instead of $db = init_database() because db may not exist yet. We need to check and control the response 
    9596                        $db = new Database(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); 
    9697 
    97                         if ($cage->get->getAlpha('type') == 'manual') { database_setup_manual(); } else { database_setup(); } 
     98                        if ($cage->get->getAlpha('type') == 'manual') { 
     99                                database_setup_manual(); 
     100                        } else { 
     101                                database_setup(); 
     102                        } 
    98103                } 
    99104                break; 
    100         case 2:                 
     105        case 2: 
    101106                if ($action == 'upgrade') { 
    102                     database_upgrade(); 
     107                        database_upgrade(); 
    103108                } else { 
    104109                        $db = init_database(); 
    105                         database_creation();        // Creates the database tables 
     110                        database_creation();            // Creates the database tables 
    106111                } 
    107112                break; 
    108         case 3:  
     113        case 3: 
    109114                if ($action == 'upgrade') { 
    110115                        upgrade_plugins(); 
    111116                } else { 
    112117                        $db = init_database(); 
    113                         register_admin();           // Username and password for Admin user... 
     118                        register_admin();                  // Username and password for Admin user... 
    114119                } 
    115120                break; 
    116121        case 4: 
    117                 installation_complete();    // Delete "install" folder. Visit your site" 
     122                installation_complete();        // Delete "install" folder. Visit your site" 
    118123                break; 
    119124        default: 
    120125                // Anything other than step=1, 3 or 4 will return user to Step 0 
    121126                installation_welcome(); 
    122          
    123127} 
    124128 
    125129exit; 
    126  
    127130 
    128131/** 
     
    141144 
    142145        // Title 
    143         $header .= "<TITLE>" . $lang['install_title'] . "</TITLE>\n"; 
     146        $header .= "<TITLE>".$lang['install_title']."</TITLE>\n"; 
    144147        $header .= "<META HTTP-EQUIV='Content-Type' CONTENT='text'>\n"; 
    145148        $header .= "<link rel='stylesheet' type='text/css' href='reset-fonts-grids.css' type='text/css'>\n"; 
     
    152155        $header .= "<div id='hd' role='banner'>"; 
    153156        $header .= "<img align='left' src='../content/admin_themes/admin_default/images/hotaru.png' style='height:60px; width:60px;'>"; 
    154         $header .= "<h1>" . $lang['install_title'] . " v." . $version_number ."</h1></div>\n"; 
     157        $header .= "<h1>".$lang['install_title']." v.".$version_number."</h1></div>\n"; 
    155158        $header .= "<div id='bd' role='main'>\n"; 
    156159        $header .= "<div class='yui-g'>\n"; 
     
    158161        return $header; 
    159162} 
    160  
    161163 
    162164/** 
     
    170172 
    171173        $footer = "<div class='clear'></div>\n"; // clear floats 
    172  
    173174        // Footer content (a link to the forums) 
    174175        $footer .= "<div id='ft' role='contentinfo'>"; 
    175         $footer .= "<p>" . $lang['install_trouble'] . "</p>"; 
     176        $footer .= "<p>".$lang['install_trouble']."</p>"; 
    176177        $footer .= "</div>\n"; // close "ft" div 
    177178 
     
    186187} 
    187188 
    188  
    189189/** 
    190190 * Step 0 of installation - Welcome message 
     
    197197 
    198198        // Step title 
    199         echo "<h2>" . $lang['install_step0'] . "</h2>\n"; 
     199        echo "<h2>".$lang['install_step0']."</h2>\n"; 
    200200 
    201201        // Step content 
    202         echo "<div class='install_content'>" . $lang['install_step0_welcome'] . "</div>\n"; 
    203         echo "<div class='install_content'>" . $lang['install_step0_select'] . "</div>\n"; 
     202        echo "<div class='install_content'>".$lang['install_step0_welcome']."</div>\n"; 
     203        echo "<div class='install_content'>".$lang['install_step0_select']."</div>\n"; 
    204204 
    205205        // Splash image 
     
    207207 
    208208        // Step content 
    209         echo "<div class='center clearfix'>";    
    210         echo "<a class='select button floatright' href='index.php?step=1&action=upgrade'>" . $lang['install_upgrade'] . "</a>"; 
    211         echo "<a class='select button floatright' href='index.php?step=1&action=install'>" . $lang['install_new'] . "</a>"; 
     209        echo "<div class='center clearfix'>"; 
     210        echo "<a class='select button floatright' href='index.php?step=1&action=upgrade'>".$lang['install_upgrade']."</a>"; 
     211        echo "<a class='select button floatright' href='index.php?step=1&action=install'>".$lang['install_new']."</a>"; 
    212212        echo "</div>"; 
    213213 
     
    218218} 
    219219 
    220  
    221 /**Step 1 of installation 
     220/* * Step 1 of installation 
    222221 * 
    223222 */ 
    224 function database_setup() { 
     223 
     224function database_setup() 
     225{ 
    225226        global $lang;   //already included so Hotaru can't re-include it 
    226227        global $db; 
    227228        global $h; 
    228         global $cage; 
    229         global $settings_file_exists; 
     229        global $cage; 
     230        global $settings_file_exists; 
    230231 
    231232        //$h  = new Hotaru(); // overwrites current global with fully initialized Hotaru object 
     
    234235        if ($cage->post->KeyExists('updated')) { 
    235236 
    236             $error = 0; 
    237             // Test CSRF 
     237                $error = 0; 
     238                // Test CSRF 
    238239//          if (!$h->csrf('check', 'index')) { 
    239240//                  $h->messages[$lang['install_step3_csrf_error']] = 'red'; 
    240241//                  $error = 1; 
    241242//          } 
    242  
    243             // Test baseurl 
    244             $baseurl_name = $cage->post->testUri('baseurl'); 
    245             if (!$baseurl_name) { 
    246                     $h->messages[$lang['install_step1_baseurl_error']] = 'red'; 
    247                     $error = 1; 
    248             } 
    249  
    250             // Test dbname 
    251             $dbuser_name = $cage->post->testAlnumLines('dbuser'); 
    252             if (!$dbuser_name) { 
    253                     $h->messages[$lang['install_step1_dbuser_error']] = 'red'; 
    254                     $error = 1; 
    255             } 
    256  
    257             // Test dbpassword 
    258             $dbpassword_name = $cage->post->KeyExists('dbpassword'); 
    259             if (!$dbpassword_name) { 
    260                     $h->messages[$lang['install_step1_dbpassword_error']] = 'red'; 
    261                     $error = 1; 
    262             } 
    263  
    264             // Test dbname 
    265             $dbname_name = $cage->post->testAlnumLines('dbname'); 
    266             if (!$dbname_name) { 
    267                     $h->messages[$lang['install_step1_dbname_error']] = 'red'; 
    268                     $error = 1; 
    269             } 
    270  
    271             // Test dbprefix 
    272             $dbprefix_name = $cage->post->testAlnumLines('dbprefix'); 
    273             if (!$dbprefix_name) { 
    274                     $h->messages[$lang['install_step1_dbprefix_error']] = 'red'; 
    275                     $error = 1; 
    276             } 
    277  
    278             // Test dbhost 
    279             $dbhost_name = $cage->post->testAlpha('dbhost'); 
    280             if (!$dbhost_name) { 
    281                     $h->messages[$lang['install_step1_dbhost_error']] = 'red'; 
    282                     $error = 1; 
    283             } 
    284  
     243                // Test baseurl 
     244                $baseurl_name = $cage->post->testUri('baseurl'); 
     245                if (!$baseurl_name) { 
     246                        $h->messages[$lang['install_step1_baseurl_error']] = 'red'; 
     247                        $error = 1; 
     248                } 
     249 
     250                // Test dbname 
     251                $dbuser_name = $cage->post->testAlnumLines('dbuser'); 
     252                if (!$dbuser_name) { 
     253                        $h->messages[$lang['install_step1_dbuser_error']] = 'red'; 
     254                        $error = 1; 
     255                } 
     256 
     257                // Test dbpassword 
     258                $dbpassword_name = $cage->post->KeyExists('dbpassword'); 
     259                if (!$dbpassword_name) { 
     260                        $h->messages[$lang['install_step1_dbpassword_error']] = 'red'; 
     261                        $error = 1; 
     262                } 
     263 
     264                // Test dbname 
     265                $dbname_name = $cage->post->testAlnumLines('dbname'); 
     266                if (!$dbname_name) { 
     267                        $h->messages[$lang['install_step1_dbname_error']] = 'red'; 
     268                        $error = 1; 
     269                } 
     270 
     271                // Test dbprefix 
     272                $dbprefix_name = $cage->post->testAlnumLines('dbprefix'); 
     273                if (!$dbprefix_name) { 
     274                        $h->messages[$lang['install_step1_dbprefix_error']] = 'red'; 
     275                        $error = 1; 
     276                } 
     277 
     278                // Test dbhost 
     279                $dbhost_name = $cage->post->testAlpha('dbhost'); 
     280                if (!$dbhost_name) { 
     281                        $h->messages[$lang['install_step1_dbhost_error']] = 'red'; 
     282                        $error = 1; 
     283                } 
    285284        } else { 
    286             if ($settings_file_exists) { 
    287                 $dbuser_name = DB_USER; 
    288                 $dbname_name = DB_NAME; 
    289                 $dbpassword_name = DB_PASSWORD; 
    290                 $dbprefix_name = DB_PREFIX; 
    291                 $dbhost_name = DB_HOST; 
    292                 $baseurl_name = BASEURL; 
    293             } else { 
    294                 $dbuser_name = 'admin'; 
    295                 $dbname_name = 'hotaru'; 
    296                 $dbpassword_name = ''; 
    297                 $dbprefix_name = 'hotaru_'; 
    298                 $dbhost_name = 'localhost'; 
    299                 $baseurl_name = "http://"; // . $cage->server->sanitizeTags('HTTP_HOST') . "/"; 
    300             } 
     285                if ($settings_file_exists) { 
     286                        $dbuser_name = DB_USER; 
     287                        $dbname_name = DB_NAME; 
     288                        $dbpassword_name = DB_PASSWORD; 
     289                        $dbprefix_name = DB_PREFIX; 
     290                        $dbhost_name = DB_HOST; 
     291                        $baseurl_name = BASEURL; 
     292                } else { 
     293                        $dbuser_name = 'admin'; 
     294                        $dbname_name = 'hotaru'; 
     295                        $dbpassword_name = ''; 
     296                        $dbprefix_name = 'hotaru_'; 
     297                        $dbhost_name = 'localhost'; 
     298                        $baseurl_name = "http://"; // . $cage->server->sanitizeTags('HTTP_HOST') . "/"; 
     299                } 
    301300        } 
    302301 
     
    304303        if ($cage->post->getAlpha('updated') == 'true') { 
    305304                if (!$error) { 
    306                     // Try to write file to disk based on form inputs 
    307                     $fputs = create_new_settings_file($dbuser_name, $dbpassword_name, $dbname_name, $dbprefix_name, $dbhost_name, $baseurl_name); 
    308                     // if file written successfully then 
    309                     if ($fputs) { 
    310                         $h->messages[$lang['install_step1_update_file_writing_success']] = 'green';                                      
    311                         // if yes set warning message var 
    312                     } else { 
    313                         $h->messages[$lang['install_step1_update_file_writing_failure']] = 'red'; 
    314                     } 
    315                 } 
    316                 @chmod(SETTINGS,0644); 
     305                        // Try to write file to disk based on form inputs 
     306                        $fputs = create_new_settings_file($dbuser_name, $dbpassword_name, $dbname_name, $dbprefix_name, $dbhost_name, $baseurl_name); 
     307                        // if file written successfully then 
     308                        if ($fputs) { 
     309                                $h->messages[$lang['install_step1_update_file_writing_success']] = 'green'; 
     310                                // if yes set warning message var 
     311                        } else { 
     312                                $h->messages[$lang['install_step1_update_file_writing_failure']] = 'red'; 
     313                        } 
     314                } 
     315                @chmod(SETTINGS, 0644); 
    317316        } 
    318317 
    319318        // Check whether database and tables exist on this server 
    320319        $db->show_errors = false; 
    321         $database_exists = $db->connect($dbuser_name, $dbpassword_name, $dbname_name, $dbhost_name);     
     320        $database_exists = $db->connect($dbuser_name, $dbpassword_name, $dbname_name, $dbhost_name); 
    322321        if (!$database_exists) { 
    323             $h->messages[$lang['install_step1_no_db_exists_failure']] = 'red'; 
     322                $h->messages[$lang['install_step1_no_db_exists_failure']] = 'red'; 
    324323        } else { 
    325             $show_next = true;      
    326             $table_exists = $db->table_exists('miscdata');          
     324                $show_next = true; 
     325                $table_exists = $db->table_exists('miscdata'); 
    327326        } 
    328327 
    329328        // Try to write the /hotaru_settings.php file to disk 
    330329        // 
    331         @chmod(SETTINGS,0777); 
    332  
    333         $settings_file_writeable =  is_writeable(SETTINGS); 
     330        @chmod(SETTINGS, 0770); 
     331 
     332        $settings_file_writeable = is_writeable(SETTINGS); 
    334333 
    335334        if ($settings_file_writeable) { 
    336             global $lang; 
    337  
    338             echo html_header(); 
    339  
    340             $h->showMessages(); 
    341  
    342             // Step title 
    343             echo "<h2>" . $lang['install_step1'] . "</h2>\n"; 
    344  
    345             // Splash image 
    346             echo "<img align='center' src='../content/admin_themes/admin_default/images/create_db.png' style='float:left;'>"; 
    347  
    348             // Step content 
    349             echo "<div class='install_content clearfix'>" . $lang['install_step1_instructions_create_db'] . "</div>\n"; 
    350  
    351             //Manual creation link 
    352             echo "<div class='install_content clearfix' style='margin-left:54px;'>" . $lang['install_step1_instructions_manual_setup'] . "&nbsp;<a href='?step=1&action=install&type=manual'>" . $lang['install_step1_instructions_manual_setup_click'] . "</a>."; 
    353  
    354             // Registration form 
    355             echo "<form name='install_admin_reg_form' action='../install/index.php?step=1' method='post'>\n"; 
    356  
    357             echo "<br/><table>"; 
    358  
    359             // BASEURL 
    360             echo "<tr><td>" . $lang["install_step1_baseurl"] . "&nbsp; </td><td><input type='text' size=30 name='baseurl' value='" . $baseurl_name . "' />&nbsp;<small>" . $lang["install_step1_baseurl_explain"] . "</small></td></tr>\n"; 
    361  
    362             // DB_USER 
    363             echo "<tr><td>" . $lang["install_step1_dbuser"] . "&nbsp; </td><td><input type='text' size=30 name='dbuser' value='" . $dbuser_name . "' />&nbsp;<small>" . $lang["install_step1_dbuser_explain"] . "</small></td></tr>\n"; 
    364  
    365             // DB_PASSWORD 
    366             echo "<tr><td>" . $lang["install_step1_dbpassword"] . "&nbsp; </td><td><input type='password' size=30 name='dbpassword' value='" . $dbpassword_name . "' />&nbsp;<small>" . $lang["install_step1_dbpassword_explain"] . "</small></td></tr>\n"; 
    367  
    368             // DB_NAME 
    369             echo "<tr><td>" . $lang["install_step1_dbname"] . "&nbsp; </td><td><input type='text' size=30 name='dbname' value='" . $dbname_name . "' />&nbsp;<small>" . $lang["install_step1_dbname_explain"] . "</small></td></tr>\n"; 
    370  
    371             // DB_PREFIX 
    372             echo "<tr><td>" . $lang["install_step1_dbprefix"] . "&nbsp; </td><td><input type='text' size=30 name='dbprefix' value='" . $dbprefix_name . "' />&nbsp;<small>" . $lang["install_step1_dbprefix_explain"] . "</small></td></tr>\n"; 
    373  
    374             // DB_HOST 
    375             echo "<tr><td>" . $lang["install_step1_dbhost"] . "&nbsp; </td><td><input type='text' size=30 name='dbhost' value='" . $dbhost_name . "' />&nbsp;<small>" . $lang["install_step1_dbhost_explain"] . "</small></td></tr>\n"; 
    376  
    377  
    378             echo "<input type='hidden' name='csrf' value='" . $h->csrfToken . "' />\n"; 
    379             echo "<input type='hidden' name='step' value='2' />\n"; 
    380             echo "<input type='hidden' name='updated' value='true' />\n"; 
    381  
    382             // Update button 
    383             echo "<tr><td>&nbsp;</td><td style='text-align:right;'><input class='update button' class='button' type='submit' value='" . $lang['install_step3_form_update'] . "' /></td></tr>\n"; 
    384  
    385             echo "</table>"; 
    386             echo "</form>\n"; 
    387  
    388             if ($cage->post->getAlpha('updated') != 'true' && SETTINGS) { 
    389                 // Alert if Settings file already exists 
    390                 echo "<br/><img align='center' src='../content/admin_themes/admin_default/images/delete.png' style='float:left;'>"; 
    391                 echo $lang["install_step1_settings_file_already_exists"] . "</div><br/>"; 
    392             } 
    393  
    394             if (isset($table_exists) && ($table_exists)) { 
    395                 // Alert if database already exists 
    396                 echo "<br/><img align='center' src='../content/admin_themes/admin_default/images/delete.png' style='float:left;'>"; 
    397                 echo $lang["install_step1_settings_db_already_exists"] . "</div><br/>"; 
    398             } 
    399  
    400             // Previous/Next buttons 
    401             echo "<div class='back button''><a href='index.php?step=0'>" . $lang['install_back'] . "</a></div>\n"; 
    402              
    403             if ($show_next) { 
    404             // and if db was connected ok 
    405                     echo "<div class='next button''><a href='index.php?step=2'>" . $lang['install_next'] . "</a></div>\n"; 
    406             } else { 
    407                     // link disbaled 
    408                     echo "<div class='next button''>" . $lang['install_next'] . "</div>\n"; 
    409             } 
    410  
    411             echo html_footer(); 
    412  
     335                global $lang; 
     336 
     337                echo html_header(); 
     338 
     339                $h->showMessages(); 
     340 
     341                // Step title 
     342                echo "<h2>".$lang['install_step1']."</h2>\n"; 
     343 
     344                // Splash image 
     345                echo "<img align='center' src='../content/admin_themes/admin_default/images/create_db.png' style='float:left;'>"; 
     346 
     347                // Step content 
     348                echo "<div class='install_content clearfix'>".$lang['install_step1_instructions_create_db']."</div>\n"; 
     349 
     350                //Manual creation link 
     351                echo "<div class='install_content clearfix' style='margin-left:54px;'>".$lang['install_step1_instructions_manual_setup']."&nbsp;<a href='?step=1&action=install&type=manual'>".$lang['install_step1_instructions_manual_setup_click']."</a>."; 
     352 
     353                // Registration form 
     354                echo "<form name='install_admin_reg_form' action='../install/index.php?step=1' method='post'>\n"; 
     355 
     356                echo "<br/><table>"; 
     357 
     358                // BASEURL 
     359                echo "<tr><td>".$lang["install_step1_baseurl"]."&nbsp; </td><td><input type='text' size=30 name='baseurl' value='".$baseurl_name."' />&nbsp;<small>".$lang["install_step1_baseurl_explain"]."</small></td></tr>\n"; 
     360 
     361                // DB_USER 
     362                echo "<tr><td>".$lang["install_step1_dbuser"]."&nbsp; </td><td><input type='text' size=30 name='dbuser' value='".$dbuser_name."' />&nbsp;<small>".$lang["install_step1_dbuser_explain"]."</small></td></tr>\n"; 
     363 
     364                // DB_PASSWORD 
     365                echo "<tr><td>".$lang["install_step1_dbpassword"]."&nbsp; </td><td><input type='password' size=30 name='dbpassword' value='".$dbpassword_name."' />&nbsp;<small>".$lang["install_step1_dbpassword_explain"]."</small></td></tr>\n"; 
     366 
     367                // DB_NAME 
     368                echo "<tr><td>".$lang["install_step1_dbname"]."&nbsp; </td><td><input type='text' size=30 name='dbname' value='".$dbname_name."' />&nbsp;<small>".$lang["install_step1_dbname_explain"]."</small></td></tr>\n"; 
     369 
     370                // DB_PREFIX 
     371                echo "<tr><td>".$lang["install_step1_dbprefix"]."&nbsp; </td><td><input type='text' size=30 name='dbprefix' value='".$dbprefix_name."' />&nbsp;<small>".$lang["install_step1_dbprefix_explain"]."</small></td></tr>\n"; 
     372 
     373                // DB_HOST 
     374                echo "<tr><td>".$lang["install_step1_dbhost"]."&nbsp; </td><td><input type='text' size=30 name='dbhost' value='".$dbhost_name."' />&nbsp;<small>".$lang["install_step1_dbhost_explain"]."</small></td></tr>\n"; 
     375 
     376 
     377                echo "<input type='hidden' name='csrf' value='".$h->csrfToken."' />\n"; 
     378                echo "<input type='hidden' name='step' value='2' />\n"; 
     379                echo "<input type='hidden' name='updated' value='true' />\n"; 
     380 
     381                // Update button 
     382                echo "<tr><td>&nbsp;</td><td style='text-align:right;'><input class='update button' class='button' type='submit' value='".$lang['install_step3_form_update']."' /></td></tr>\n"; 
     383 
     384                echo "</table>"; 
     385                echo "</form>\n"; 
     386 
     387                if ($cage->post->getAlpha('updated') != 'true' && SETTINGS) { 
     388                        // Alert if Settings file already exists 
     389                        echo "<br/><img align='center' src='../content/admin_themes/admin_default/images/delete.png' style='float:left;'>"; 
     390                        echo $lang["install_step1_settings_file_already_exists"]."</div><br/>"; 
     391                } 
     392 
     393                if (isset($table_exists) && ($table_exists)) { 
     394                        // Alert if database already exists 
     395                        echo "<br/><img align='center' src='../content/admin_themes/admin_default/images/delete.png' style='float:left;'>"; 
     396                        echo $lang["install_step1_settings_db_already_exists"]."</div><br/>"; 
     397                } 
     398 
     399                // Previous/Next buttons 
     400                echo "<div class='back button''><a href='index.php?step=0'>".$lang['install_back']."</a></div>\n"; 
     401 
     402                if ($show_next) { 
     403                        // and if db was connected ok 
     404                        echo "<div class='next button''><a href='index.php?step=2'>".$lang['install_next']."</a></div>\n"; 
     405                } else { 
     406                        // link disbaled 
     407                        echo "<div class='next button''>".$lang['install_next']."</div>\n"; 
     408                } 
     409 
     410                echo html_footer(); 
    413411        } else { 
    414             @chmod(SETTINGS,0644); 
    415             database_setup_manual(); 
    416         } 
    417  
    418 } 
    419  
     412                @chmod(SETTINGS, 0644); 
     413                database_setup_manual(); 
     414        } 
     415} 
    420416 
    421417/** 
     
    429425 
    430426        // Step title 
    431         echo "<h2>" . $lang['install_step1'] . "</h2>\n"; 
     427        echo "<h2>".$lang['install_step1']."</h2>\n"; 
    432428 
    433429        // Step content 
    434         echo "<div class='install_content'>" . $lang['install_step1_instructions'] . ":</div>\n"; 
     430        echo "<div class='install_content'>".$lang['install_step1_instructions'].":</div>\n"; 
    435431 
    436432        echo "<ol class='install_content'>\n"; 
    437         echo "<li>" . $lang['install_step1_instructions1'] . "</li>\n"; 
    438         echo "<li>" . $lang['install_step1_instructions2'] . "</li>\n"; 
    439         echo "<li>" . $lang['install_step1_instructions3'] . "</li>\n"; 
    440         echo "<li>" . $lang['install_step1_instructions4'] . "</li>\n"; 
    441         echo "<li>" . $lang['install_step1_instructions5'] . "</li>\n"; 
     433        echo "<li>".$lang['install_step1_instructions1']."</li>\n"; 
     434        echo "<li>".$lang['install_step1_instructions2']."</li>\n"; 
     435        echo "<li>".$lang['install_step1_instructions3']."</li>\n"; 
     436        echo "<li>".$lang['install_step1_instructions4']."</li>\n"; 
     437        echo "<li>".$lang['install_step1_instructions5']."</li>\n"; 
    442438        echo "</ol>\n"; 
    443439 
    444440        // Warning message 
    445441        echo "<br/><img align='center' src='../content/admin_themes/admin_default/images/delete.png' style='float:left;'>"; 
    446         echo "<div class='install_content'><span style='color: red;'>" . $lang['install_step1_warning'] . "</span>: " . $lang['install_step1_warning_note'] . "</div><br/>\n"; 
     442        echo "<div class='install_content'><span style='color: red;'>".$lang['install_step1_warning']."</span>: ".$lang['install_step1_warning_note']."</div><br/>\n"; 
    447443 
    448444        // Previous/Next buttons 
    449         echo "<div class='back button''><a href='index.php?step=0'>" . $lang['install_back'] . "</a></div>\n"; 
    450         echo "<div class='next button''><a href='index.php?step=2'>" . $lang['install_next'] . "</a></div>\n"; 
     445        echo "<div class='back button''><a href='index.php?step=0'>".$lang['install_back']."</a></div>\n"; 
     446        echo "<div class='next button''><a href='index.php?step=2'>".$lang['install_next']."</a></div>\n"; 
    451447 
    452448        echo html_footer(); 
     
    459455{ 
    460456 
    461     if (file_exists(SETTINGS)) { 
    462         include_once('install-upgrade.php'); 
    463     } 
    464     else { 
    465         echo 'You need to have a "hotaru_settings.php" file to upgrade Hotaru.'; 
    466     } 
    467 } 
    468  
     457        if (file_exists(SETTINGS)) { 
     458                include_once('install-upgrade.php'); 
     459        } else { 
     460                echo 'You need to have a "hotaru_settings.php" file to upgrade Hotaru.'; 
     461        } 
     462} 
    469463 
    470464/** 
     
    476470        global $db; 
    477471        global $cage; 
    478         
    479         $delete = $cage->get->getAlpha('del');        // Confirm delete. 
     472 
     473        $delete = $cage->get->getAlpha('del');          // Confirm delete. 
    480474        $show_next = false; 
    481475 
    482476        echo html_header(); 
    483          
     477 
    484478        // Step title 
    485         echo "<h2>" . $lang['install_step2'] . "</h2>\n"; 
    486  
    487         $table_exists = $db->table_exists('miscdata');    
     479        echo "<h2>".$lang['install_step2']."</h2>\n"; 
     480 
     481        $table_exists = $db->table_exists('miscdata'); 
    488482        if ($table_exists && $delete != 'DELETE') { 
    489483                // Warning message 
    490484                echo "<br/><img align='center' src='../content/admin_themes/admin_default/images/delete.png' style='float:left;'>"; 
    491                 echo "<div class='install_content'><span style='color: red;'>" . $lang['install_step1_warning'] . "</span>: " . $lang['install_step2_existing_db'] . "</div>\n"; 
    492                 echo "<div class='install_content'>" . $lang['install_step2_existing_confirm'] . "</div>\n"; 
     485                echo "<div class='install_content'><span style='color: red;'>".$lang['install_step1_warning']."</span>: ".$lang['install_step2_existing_db']."</div>\n"; 
     486                echo "<div class='install_content'>".$lang['install_step2_existing_confirm']."</div>\n"; 
    493487 
    494488                // Confirm delete and continue install 
    495                  echo "<form name='install_admin_reg_form' action='index.php?step=2' method='get'>\n"; 
     489                echo "<form name='install_admin_reg_form' action='index.php?step=2' method='get'>\n"; 
    496490                echo "<div class='center clearfix'>&nbsp; <input type='text' size=10 name='del' value='' />"; 
    497                 echo "<input type='hidden' name='csrf' value='" . $h->csrfToken . "' />\n"; 
     491                echo "<input type='hidden' name='csrf' value='".$h->csrfToken."' />\n"; 
    498492                echo "<input type='hidden' name='step' value='2' />\n"; 
    499                      
    500                 echo "<input class='update button' class='button' type='submit' value='" . $lang['install_step2_form_delete_confirm'] . "' />"; 
     493 
     494                echo "<input class='update button' class='button' type='submit' value='".$lang['install_step2_form_delete_confirm']."' />"; 
    501495                echo "</div></form>\n"; 
    502496 
    503                 echo "<div class='install_content'>" . $lang['install_step2_existing_go_upgrade1']; 
    504                 echo "<a href='?step=1&action=upgrade'>" . $lang['install_step2_existing_go_upgrade2'] . "</a></div>\n"; 
    505         } 
    506         else {      
    507              
    508             $tables = array('blocked', 'categories', 'comments', 'friends', 'messaging', 'miscdata', 'plugins', 'pluginhooks', 'pluginsettings', 'posts', 'postmeta', 'postvotes', 'settings', 'tags', 'tempdata', 'tokens', 'users', 'usermeta', 'useractivity', 'widgets'); 
    509  
    510             // delete *all* tables in db: 
    511             $db->selectDB(DB_NAME); 
    512  
    513  
    514  
    515             // Used as test to check whether we have tables yet 
     497                echo "<div class='install_content'>".$lang['install_step2_existing_go_upgrade1']; 
     498                echo "<a href='?step=1&action=upgrade'>".$lang['install_step2_existing_go_upgrade2']."</a></div>\n"; 
     499        } else { 
     500 
     501                $tables = array('blocked', 'categories', 'comments', 'friends', 'messaging', 'miscdata', 'plugins', 'pluginhooks', 'pluginsettings', 'posts', 'postmeta', 'postvotes', 'settings', 'tags', 'tempdata', 'tokens', 'users', 'usermeta', 'useractivity', 'widgets'); 
     502 
     503                // delete *all* tables in db: 
     504                $db->selectDB(DB_NAME); 
     505 
     506 
     507 
     508                // Used as test to check whether we have tables yet 
    516509//          $sql = "SELECT * FROM `" . DB_PREFIX . "miscdata`"; 
    517510//          var_dump($db->get_results($sql)); die; 
    518511 
    519             if ($db->get_col("SHOW TABLES",0)) { 
    520                 echo  $lang['install_step2_checking_tables'];  
    521                 foreach ( $db->get_col("SHOW TABLES",0) as $table_name ) 
    522                 { 
    523                     print $table_name . ', '; 
    524                         drop_table($table_name); // table name 
    525                 } 
    526                 echo '<br /><br />' . $lang['install_step2_deleting_table'] . "'...<br /><br />\n"; 
    527             } else { 
    528                 echo $lang['install_step2_no_tables'] . "<br/><br />\n"; 
    529             } 
    530  
    531  
    532             $create_tables_problem = false; 
    533             //create tables 
    534             foreach ($tables as $table_name) { 
    535                     $error = ''; 
    536                     create_table($table_name); 
    537                     $error = mysql_error(); 
    538                     if ($error) { 
    539                         echo $error . ' '; 
    540                         $create_tables_problem = true; 
    541                     } 
    542             } 
    543  
    544             // Step content 
    545             if (!$create_tables_problem) { 
    546                 echo "<div class='install_content'>" . $lang['install_step2_success'] . "</div>\n"; 
    547             } else { 
    548                 echo "<div class='install_content'>" . $lang['install_step2_fail'] . "</div>\n"; 
    549             } 
    550  
    551             $show_next = true; 
     512                if ($db->get_col("SHOW TABLES", 0)) { 
     513                        echo $lang['install_step2_checking_tables']; 
     514                        foreach ($db->get_col("SHOW TABLES", 0) as $table_name) { 
     515                                print $table_name.', '; 
     516                                drop_table($table_name); // table name 
     517                        } 
     518                        echo '<br /><br />'.$lang['install_step2_deleting_table']."'...<br /><br />\n"; 
     519                } else { 
     520                        echo $lang['install_step2_no_tables']."<br/><br />\n"; 
     521                } 
     522 
     523 
     524                $create_tables_problem = false; 
     525                //create tables 
     526                foreach ($tables as $table_name) { 
     527                        $error = ''; 
     528                        create_table($table_name); 
     529                        // @todo: the code in the following // comment, was generated by the MySQLi converter. I haven't spent the time to get it working, nor tested it. 
     530                        $error = NULL; // ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); 
     531                        if ($error) { 
     532                                echo $error.' '; 
     533                                $create_tables_problem = true; 
     534                        } 
     535                } 
     536 
     537                // Step content 
     538                if (!$create_tables_problem) { 
     539                        echo "<div class='install_content'>".$lang['install_step2_success']."</div>\n"; 
     540                } else { 
     541                        echo "<div class='install_content'>".$lang['install_step2_fail']."</div>\n"; 
     542                } 
     543 
     544                $show_next = true; 
    552545        } 
    553546 
    554547        // Previous/Next buttons 
    555         echo "<div class='back button''><a href='index.php?step=1'>" . $lang['install_back'] . "</a></div>\n"; 
     548        echo "<div class='back button''><a href='index.php?step=1'>".$lang['install_back']."</a></div>\n"; 
    556549        if ($show_next) { 
    557550                // active "next" link 
    558                 echo "<div class='next button''><a href='index.php?step=3'>" . $lang['install_next'] . "</a></div>\n"; 
     551                echo "<div class='next button''><a href='index.php?step=3'>".$lang['install_next']."</a></div>\n"; 
    559552        } else { 
    560553                // link disbaled 
    561                 echo "<div class='next button''>" . $lang['install_next'] . "</div>\n"; 
     554                echo "<div class='next button''>".$lang['install_next']."</div>\n"; 
    562555        } 
    563556 
    564557        echo html_footer(); 
    565558} 
    566  
    567559 
    568560/** 
     
    576568        // Make sure that the cache folders have been created before we call $h for the first time 
    577569        // Since we have defined CACHE in install script, the normal Initialize script will think folders are already present 
    578         $dirs = array('debug_logs/' , 'db_cache/', 'css_js_cache/', 'html_cache/', 'rss_cache/', 'lang_cache/'); 
     570        $dirs = array('debug_logs/', 'db_cache/', 'css_js_cache/', 'html_cache/', 'rss_cache/', 'lang_cache/'); 
    579571 
    580572        foreach ($dirs as $dir) { 
    581             //print "checking where dir exists at " . CACHE . $dir . '<br/>'; 
    582             if (!is_dir(CACHE . $dir)) { 
    583                 //print "trying to create " . CACHE . $dir . '<br/>'; 
    584                 mkdir(CACHE . $dir); 
    585             } 
    586         } 
    587  
    588         $h  = new Hotaru(); // overwrites current global with fully initialized Hotaru object 
     573                //print "checking where dir exists at " . CACHE . $dir . '<br/>'; 
     574                if (!is_dir(CACHE.$dir)) { 
     575                        //print "trying to create " . CACHE . $dir . '<br/>'; 
     576                        mkdir(CACHE.$dir); 
     577                } 
     578        } 
     579 
     580        $h = new Hotaru(); // overwrites current global with fully initialized Hotaru object 
    589581 
    590582 
     
    592584 
    593585        // Step title 
    594         echo "<h2>" . $lang['install_step3'] . "</h2>\n"; 
     586        echo "<h2>".$lang['install_step3']."</h2>\n"; 
    595587 
    596588        // Step content 
    597         echo "<div class='install_content'>" . $lang['install_step3_instructions'] . ":<br /><br />\n"; 
     589        echo "<div class='install_content'>".$lang['install_step3_instructions'].":<br /><br />\n"; 
    598590 
    599591        $error = 0; 
    600         if ($h->cage->post->getInt('step') == 4) 
    601         { 
     592        if ($h->cage->post->getInt('step') == 4) { 
    602593                // Test CSRF 
    603594                if (!$h->csrf()) { 
     
    663654        if ($error == 0) { 
    664655 
    665                 $sql = "SELECT user_username FROM " . TABLE_USERS . " WHERE user_role = %s"; 
    666  
    667                 if (!$admin_name = $h->db->get_var($h->db->prepare($sql, 'admin'))) 
    668                 { 
     656                $sql = "SELECT user_username FROM ".TABLE_USERS." WHERE user_role = %s"; 
     657 
     658                if (!$admin_name = $h->db->get_var($h->db->prepare($sql, 'admin'))) { 
    669659                        // Insert default settings 
    670                         $sql = "INSERT INTO " . TABLE_USERS . " (user_username, user_role, user_date, user_password, user_email, user_permissions) VALUES (%s, %s, CURRENT_TIMESTAMP, %s, %s, %s)"; 
     660                        $sql = "INSERT INTO ".TABLE_USERS." (user_username, user_role, user_date, user_password, user_email, user_permissions) VALUES (%s, %s, CURRENT_TIMESTAMP, %s, %s, %s)"; 
    671661                        $h->db->query($h->db->prepare($sql, 'admin', 'admin', 'password', 'admin@example.com', serialize($h->currentUser->getDefaultPermissions($h, 'admin')))); 
    672662                        $user_name = 'admin'; 
    673663                        $user_email = 'admin@example.com'; 
    674664                        $user_password = 'password'; 
    675                 } 
    676                 else 
    677                 { 
     665                } else { 
    678666                        $user_info = $h->currentUser->getUser($h, 0, $admin_name); 
    679667                        // On returning to this page via back or next, the fields are empty at this point, so... 
    680                         if (!isset($user_name)) { $user_name = ""; } 
    681                         if (!isset($user_email)){ $user_email = ""; } 
    682                         if (!isset($user_password)) { $user_password = ""; } 
     668                        if (!isset($user_name)) { 
     669                                $user_name = ""; 
     670                        } 
     671                        if (!isset($user_email)) { 
     672                                $user_email = ""; 
     673                        } 
     674                        if (!isset($user_password)) { 
     675                                $user_password = ""; 
     676                        } 
    683677                        if (($user_name != "") && ($user_email != "") && ($user_password != "")) { 
    684678                                // There's been a change so update... 
    685                                 $sql = "UPDATE " . TABLE_USERS . " SET user_username = %s, user_role = %s, user_date = CURRENT_TIMESTAMP, user_password = %s, user_email = %s, user_email_valid = %d WHERE user_role = %s"; 
     679                                $sql = "UPDATE ".TABLE_USERS." SET user_username = %s, user_role = %s, user_date = CURRENT_TIMESTAMP, user_password = %s, user_email = %s, user_email_valid = %d WHERE user_role = %s"; 
    686680                                $h->db->query($h->db->prepare($sql, $user_name, 'admin', $user_password, $user_email, 1, 'admin')); 
    687681                                $next_button = true; 
     
    701695 
    702696        // Username 
    703         echo "<tr><td>" . $lang["install_step3_username"] . "&nbsp; </td><td><input type='text' size=30 name='username' value='" . $user_name . "' /></td></tr>\n"; 
     697        echo "<tr><td>".$lang["install_step3_username"]."&nbsp; </td><td><input type='text' size=30 name='username' value='".$user_name."' /></td></tr>\n"; 
    704698 
    705699        // Email 
    706         echo "<tr><td>" . $lang["install_step3_email"] . "&nbsp; </td><td><input type='text' size=30 name='email' value='" . $user_email . "' /></td></tr>\n"; 
     700        echo "<tr><td>".$lang["install_step3_email"]."&nbsp; </td><td><input type='text' size=30 name='email' value='".$user_email."' /></td></tr>\n"; 
    707701 
    708702        // Password 
    709         echo "<tr><td>" . $lang["install_step3_password"] . "&nbsp; </td><td><input type='password' size=30 name='password' value='' /></td></tr>\n"; 
     703        echo "<tr><td>".$lang["install_step3_password"]."&nbsp; </td><td><input type='password' size=30 name='password' value='' /></td></tr>\n"; 
    710704 
    711705        // Password verify 
    712         echo "<tr><td>" . $lang["install_step3_password_verify"] . "&nbsp; </td><td><input type='password' size=30 name='password2' value='' /></td></tr>\n"; 
    713  
    714         echo "<input type='hidden' name='csrf' value='" . $h->csrfToken . "' />\n"; 
     706        echo "<tr><td>".$lang["install_step3_password_verify"]."&nbsp; </td><td><input type='password' size=30 name='password2' value='' /></td></tr>\n"; 
     707 
     708        echo "<input type='hidden' name='csrf' value='".$h->csrfToken."' />\n"; 
    715709        echo "<input type='hidden' name='step' value='4' />\n"; 
    716710        echo "<input type='hidden' name='updated' value='true' />\n"; 
    717711 
    718712        // Update button 
    719         echo "<tr><td>&nbsp;</td><td style='text-align:right;'><input class='update button' class='button' type='submit' value='" . $lang['install_step3_form_update'] . "' /></td></tr>\n"; 
     713        echo "<tr><td>&nbsp;</td><td style='text-align:right;'><input class='update button' class='button' type='submit' value='".$lang['install_step3_form_update']."' /></td></tr>\n"; 
    720714 
    721715        echo "</table>"; 
     
    723717 
    724718        // Make note of password message 
    725         echo $lang["install_step3_make_note"] . "</div>\n"; 
     719        echo $lang["install_step3_make_note"]."</div>\n"; 
    726720 
    727721        // Previous/Next buttons 
    728         echo "<div class='back button''><a href='index.php?step=2'>" . $lang['install_back'] . "</a></div>\n"; 
     722        echo "<div class='back button''><a href='index.php?step=2'>".$lang['install_back']."</a></div>\n"; 
    729723        if ($h->cage->post->getAlpha('updated') == 'true' && isset($next_button)) { 
    730724                // active "next" link if user has been updated 
    731                 echo "<div class='next button''><a href='index.php?step=4'>" . $lang['install_next'] . "</a></div>\n"; 
     725                echo "<div class='next button''><a href='index.php?step=4'>".$lang['install_next']."</a></div>\n"; 
    732726        } else { 
    733727                // link disbaled until "update" button pressed 
    734                 echo "<div class='next button''>" . $lang['install_next'] . "</div>\n"; 
     728                echo "<div class='next button''>".$lang['install_next']."</div>\n"; 
    735729        } 
    736730 
     
    738732} 
    739733 
    740  
    741734/** 
    742735 * Step 4 of installation - shows completion. 
     
    745738{ 
    746739        global $lang; 
    747         global $cage;    
    748  
    749         $h  = new Hotaru(); // overwrites current global with fully initialized Hotaru object 
    750          
     740        global $cage; 
     741 
     742        $h = new Hotaru(); // overwrites current global with fully initialized Hotaru object 
     743 
    751744        $phpinfo = $cage->post->getAlpha('phpinfo'); 
    752745 
    753746        if (!$phpinfo) { 
    754             //send feedback report           
    755             $systeminfo = new SystemInfo(); 
    756             $systeminfo->hotaru_feedback($h); 
     747                //send feedback report 
     748                $systeminfo = new SystemInfo(); 
     749                $systeminfo->hotaru_feedback($h); 
    757750        } 
    758751 
     
    760753 
    761754        // Step title 
    762         echo "<h2>" . $lang['install_step4'] . "</h2>\n"; 
     755        echo "<h2>".$lang['install_step4']."</h2>\n"; 
    763756 
    764757        // Step content 
    765          
    766         echo "<div class='install_content'>" . $lang['install_step4_installation_complete'] . "</div>\n"; 
    767         echo "<div class='install_content'>" . $lang['install_step4_installation_delete'] . "</div>\n"; 
     758 
     759        echo "<div class='install_content'>".$lang['install_step4_installation_complete']."</div>\n"; 
     760        echo "<div class='install_content'>".$lang['install_step4_installation_delete']."</div>\n"; 
    768761 
    769762 
    770763        if ($phpinfo) { 
    771             echo '<br/>'; 
    772             $php_version = phpversion(); 
    773             $modules = get_loaded_extensions(); 
    774             $php_module_not_found = false; 
    775  
    776             $required = array('mysql'=>'http://php.net/manual/en/book.mysql.php', 
    777                                         'filter'=>'http://php.net/manual/en/book.filter.php', 
    778                                         'curl'=>'http://php.net/manual/en/book.curl.php', 
    779                                         'mbstring'=>'http://www.php.net/manual/en/book.mbstring.php'); 
    780                          
     764                echo '<br/>'; 
     765                $php_version = phpversion(); 
     766                $modules = get_loaded_extensions(); 
     767                $php_module_not_found = false; 
     768 
     769                $required = array('mysql' => 'http://php.net/manual/en/book.mysql.php', 
     770                        'filter' => 'http://php.net/manual/en/book.filter.php', 
     771                        'curl' => 'http://php.net/manual/en/book.curl.php', 
     772                        'mbstring' => 'http://www.php.net/manual/en/book.mbstring.php'); 
     773 
    781774                /* No longer required: 'bcmath' => 'http://php.net/manual/en/book.bc.php' */ 
    782775 
    783             foreach ($required as $module => $url) { 
    784                 if (!in_array($module, $modules)) { 
    785                     echo $h->showMessage($lang['install_step4_form_check_php_warning'] . '<a href="' . $url . '" target="_blank">' . $module . '</a><br/>','yellow'); 
    786                     $php_module_not_found = true; 
    787                 } 
    788             } 
    789             // check for correct version number of php 
    790             if (version_compare($php_version, '5.2.5', '<')) { echo $h->showMessage($lang['install_step4_form_check_php_version'], 'yellow'); } 
    791  
    792             // success of modules 
    793             if (!$php_module_not_found) { 
    794                 echo $h->showMessage($lang['install_step4_form_check_php_success'], 'green'); 
    795             } 
     776                foreach ($required as $module => $url) { 
     777                        if (!in_array($module, $modules)) { 
     778                                echo $h->showMessage($lang['install_step4_form_check_php_warning'].'<a href="'.$url.'" target="_blank">'.$module.'</a><br/>', 'yellow'); 
     779                                $php_module_not_found = true; 
     780                        } 
     781                } 
     782                // check for correct version number of php 
     783                if (version_compare($php_version, '5.2.5', '<')) { 
     784                        echo $h->showMessage($lang['install_step4_form_check_php_version'], 'yellow'); 
     785                } 
     786 
     787                // success of modules 
     788                if (!$php_module_not_found) { 
     789                        echo $h->showMessage($lang['install_step4_form_check_php_success'], 'green'); 
     790                } 
    796791        } else { 
    797             echo "<form name='install_admin_reg_form' action='index.php?step=4' method='post'>\n";           
    798             echo "<input type='hidden' name='phpinfo' value='true' />"; 
    799             echo "<input type='hidden' name='step' value='4' />"; 
    800             echo "<input class='update button' type='submit' value='" . $lang['install_step4_form_check_php'] . "' />"; 
    801             echo "</div></form>\n"; 
    802         } 
    803  
    804         echo "<br/><div class='install_content'>" . $lang['install_step4_installation_go_play'] . "</div><br/><br/>\n"; 
     792                echo "<form name='install_admin_reg_form' action='index.php?step=4' method='post'>\n"; 
     793                echo "<input type='hidden' name='phpinfo' value='true' />"; 
     794                echo "<input type='hidden' name='step' value='4' />"; 
     795                echo "<input class='update button' type='submit' value='".$lang['install_step4_form_check_php']."' />"; 
     796                echo "</div></form>\n"; 
     797        } 
     798 
     799        echo "<br/><div class='install_content'>".$lang['install_step4_installation_go_play']."</div><br/><br/>\n"; 
    805800 
    806801        // Previous/Next buttons 
    807         echo "<div class='back button''><a href='index.php?step=3'>" . $lang['install_back'] . "</a></div>\n"; 
    808         echo "<div class='next button''><a href='" . BASEURL . "admin_index.php'>" . $lang['install_home'] . "</a></div>\n"; 
     802        echo "<div class='back button''><a href='index.php?step=3'>".$lang['install_back']."</a></div>\n"; 
     803        echo "<div class='next button''><a href='".BASEURL."admin_index.php'>".$lang['install_home']."</a></div>\n"; 
    809804 
    810805        echo html_footer(); 
    811806} 
    812807 
    813  
    814808/** 
    815809 * create new settings file 
    816810 */ 
    817 function create_new_settings_file($dbuser_name, $dbpassword_name, $dbname_name, $dbprefix_name, $dbhost_name, $baseurl_name) { 
    818  
    819     ob_start(); 
    820  
    821    ?> 
    822  
    823  /* Configuration file for Hotaru CMS. */ 
    824  
    825 // Paths 
    826 define("BASEURL", '<?php echo $baseurl_name; ?>');    // e.g. http://www.mysite.com/    Needs trailing slash (/) 
    827  
    828 // Database details 
    829 define("DB_USER", '<?php echo $dbuser_name; ?>');                       // Add your own database details 
    830 define("DB_PASSWORD", '<?php echo $dbpassword_name; ?>'); 
    831 define("DB_NAME", '<?php echo $dbname_name; ?>'); 
    832 define("DB_HOST", '<?php echo $dbhost_name; ?>');                       // You probably won't need to change this 
    833  
    834 // You probably don't need to change these 
    835 define("DB_PREFIX", '<?php echo $dbprefix_name; ?>');                   // Database prefix, e.g. "hotaru_" 
    836 define("DB_LANG", 'en');                                // Database language, e.g. "en" 
    837 define("DB_ENGINE", 'MyISAM');                          // Database Engine, e.g. "MyISAM" 
    838 define('DB_CHARSET', 'utf8');                           // Database Character Set (UTF8 is Recommended), e.g. "utf8" 
    839 define("DB_COLLATE", 'utf8_unicode_ci');                // Database Collation (UTF8 is Recommended), e.g. "utf8_unicode_ci" 
    840  
    841 ?><?php  // leave this line squashed up here as we dont want any blank lines at the end of the hotaru_settings file 
    842    $page = "<?php" . ob_get_contents(); 
    843    ob_end_clean(); 
    844    //$page = str_replace("\n", "", $page); 
    845    $cwd = getcwd(); 
    846    $file = $cwd . "/../hotaru_settings.php"; 
    847    @chmod($file,0777); 
    848    $fw = fopen($file, "w"); 
    849    $fputs = fputs($fw,$page, strlen($page)); 
    850    @chmod($file,0644); 
    851    fclose($fw); 
    852  
    853    return $fputs; 
    854  
    855 } 
    856  
    857 function add_DBPREFIX($table) {    
    858     return DB_PREFIX . $table; 
    859 } 
     811function create_new_settings_file($dbuser_name, $dbpassword_name, $dbname_name, $dbprefix_name, $dbhost_name, $baseurl_name) 
     812{ 
     813 
     814        ob_start(); 
    860815?> 
     816 
     817        /* Configuration file for Hotaru CMS. */ 
     818 
     819        // Paths 
     820        define("BASEURL", '<?php echo $baseurl_name; ?>');    // e.g. http://www.mysite.com/    Needs trailing slash (/) 
     821 
     822        // Database details 
     823        define("DB_USER", '<?php echo $dbuser_name; ?>');                       // Add your own database details 
     824        define("DB_PASSWORD", '<?php echo $dbpassword_name; ?>'); 
     825        define("DB_NAME", '<?php echo $dbname_name; ?>'); 
     826        define("DB_HOST", '<?php echo $dbhost_name; ?>');                       // You probably won't need to change this 
     827 
     828        // You probably don't need to change these 
     829        define("DB_PREFIX", '<?php echo $dbprefix_name; ?>');                   // Database prefix, e.g. "hotaru_" 
     830        define("DB_LANG", 'en');                                // Database language, e.g. "en" 
     831        define("DB_ENGINE", 'MyISAM');                          // Database Engine, e.g. "MyISAM" 
     832        define('DB_CHARSET', 'utf8');                           // Database Character Set (UTF8 is Recommended), e.g. "utf8" 
     833        define("DB_COLLATE", 'utf8_unicode_ci');                // Database Collation (UTF8 is Recommended), e.g. "utf8_unicode_ci" 
     834 
     835        ?><?php 
     836        // leave this line squashed up here as we dont want any blank lines at the end of the hotaru_settings file 
     837        $page = "<?php".ob_get_contents(); 
     838        ob_end_clean(); 
     839        //$page = str_replace("\n", "", $page); 
     840        $cwd = getcwd(); 
     841        $file = $cwd."/../hotaru_settings.php"; 
     842        @chmod($file, 0777); 
     843        $fw = fopen($file, "w"); 
     844        $fputs = fputs($fw, $page, strlen($page)); 
     845        @chmod($file, 0644); 
     846        fclose($fw); 
     847 
     848        return $fputs; 
     849} 
     850 
     851function add_DBPREFIX($table) 
     852{ 
     853        return DB_PREFIX.$table; 
     854} 
     855?> 
  • branches/1.5/libs/AdminPages.php

    r2292 r2295  
    389389                } 
    390390 
    391                 $h->db->selectDB(DB_NAME); 
    392  
    393391                if (!$h->db->get_col("SHOW TABLES", 0)) { 
    394392                        return $db_tables; 
  • branches/1.5/libs/Database.php

    r2292 r2295  
    66 * PHP version 5 
    77 * 
    8  * LICENSE: Hotaru CMS is free software: you can redistribute it and/or  
    9  * modify it under the terms of the GNU General Public License as  
    10  * published by the Free Software Foundation, either version 3 of  
    11  * the License, or (at your option) any later version.  
     8 * LICENSE: Hotaru CMS is free software: you can redistribute it and/or 
     9 * modify it under the terms of the GNU General Public License as 
     10 * published by the Free Software Foundation, either version 3 of 
     11 * the License, or (at your option) any later version. 
    1212 * 
    13  * Hotaru CMS is distributed in the hope that it will be useful, but WITHOUT  
    14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or  
    15  * FITNESS FOR A PARTICULAR PURPOSE.  
     13 * Hotaru CMS is distributed in the hope that it will be useful, but WITHOUT 
     14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
     15 * FITNESS FOR A PARTICULAR PURPOSE. 
    1616 * 
    17  * You should have received a copy of the GNU General Public License along  
     17 * You should have received a copy of the GNU General Public License along 
    1818 * with Hotaru CMS. If not, see http://www.gnu.org/licenses/. 
    19  *  
     19 * 
    2020 * @category  Content Management System 
    2121 * @package   HotaruCMS 
     
    2525 * @link      http://www.hotarucms.org/ 
    2626 */ 
    27 class Database { 
    28  
    29         public $h; 
     27class Database 
     28{ 
     29 
    3030        public $dbh; 
    3131        public $dbuser = false; 
     
    3636        public $cache_timeout = 24; // hours 
    3737        public $cache_queries = false; 
    38         public $cache_inserts= false; 
    3938        public $use_disk_cache; 
    40         public $func_call; 
    4139        public $last_result = array(); 
    4240        public $last_error; 
    4341        public $last_query; 
    44         public $from_disk_cache; 
    45         public $captured_errors = array(); 
     42        private $from_disk_cache; 
    4643        public $num_queries = 0; 
    4744        public $num_rows = 0; 
    48         public $queries = array(); 
    4945        public $result; 
    5046        public $rows_affected; 
    5147        public $col_info = array(); 
    52         public $show_errors = true; 
    53         private $error_str = array( 
    54         1 => 'Require $dbuser and $dbpassword to connect to a database server', 
    55         2 => 'Error establishing mySQL database connection. Correct user/password? Correct hostname? Database server running?', 
    56         3 => 'Require $dbname to select a database', 
    57         4 => 'mySQL database connection is not active', 
    58         5 => 'Unexpected error while trying to select database' 
    59         ); 
    60  
    61         public function __construct($dbuser='', $dbpassword='', $dbname='', $dbhost='localhost') 
    62         { 
    63                 $this->dbuser = $dbuser; 
    64                 $this->dbpassword = $dbpassword; 
     48 
     49        public function __construct($user, $pass, $dbname, $host='127.0.0.1') 
     50        { 
     51                $this->dbuser = $user; 
     52                $this->dbpassword = $pass; 
    6553                $this->dbname = $dbname; 
    66                 $this->dbhost = $dbhost; 
     54                $this->dbhost = $host; 
    6755        } 
    6856 
     
    7664         * @return boolean 
    7765         */ 
    78         public function connect($dbuser='', $dbpassword='', $dbhost='localhost') 
    79         { 
    80                 // Must have a user and a password 
    81                 if (!$dbuser) { 
    82                         $this->register_error($this->error_str[1].' in '.__FILE__.' on line '.__LINE__); 
    83                         if ($this->show_errors) { 
    84                                 trigger_error($this->error_str[1], E_USER_WARNING); 
    85                         } 
     66        public function connect() 
     67        { 
     68                $this->dbh = new mysqli($this->dbhost, $this->dbuser, $this->dbpassword, $this->dbname); 
     69 
     70                if (mysqli_connect_error ()) { 
     71                        trigger_error('Connect Error ('.mysqli_connect_errno().') '.mysqli_connect_error(), E_USER_ERROR); 
    8672                        return FALSE; 
    8773                } 
    8874 
    89                 // Try to establish the server database handle 
    90                 if (!$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true)) { 
    91                         $this->register_error($this->error_str[2].' in '.__FILE__.' on line '.__LINE__); 
    92                         if ($this->show_errors) { 
    93                                 trigger_error($this->error_str[2], E_USER_WARNING); 
    94                         } 
     75                if (!$this->dbh->set_charset('utf8')) { 
     76                        trigger_error('Error setting character set to "utf8"'); 
    9577                        return FALSE; 
    9678                } 
    9779 
    98                 $this->dbuser = $dbuser; 
    99                 $this->dbpassword = $dbpassword; 
    100                 $this->dbhost = $dbhost; 
    10180                return TRUE; 
    10281        } 
     
    10685         * 
    10786         * @param string $query 
    108          * @return mixed  
     87         * @return mixed 
    10988         */ 
    11089        public function query($query = '') 
     
    11594 
    11695                // Flush cached values.. 
    117                 $this->flush(); 
     96                $this->last_result = array(); 
     97                $this->col_info = null; 
     98                $this->last_query = null; 
     99                $this->from_disk_cache = false; 
    118100 
    119101                // For reg expressions 
    120102                $query = trim($query); 
    121  
    122                 // Log how the function was called 
    123                 $this->func_call = "\$db->query(\"$query\")"; 
    124103 
    125104                // Keep track of the last query for debug.. 
     
    134113                // but rarely returns anything! 
    135114                // Use core file cache function 
    136                 if ($cache = $this->get_cache($query)) { 
     115                $cache = $this->get_cache($query); 
     116                if ($cache) { 
    137117                        return $cache; 
    138118                } 
     
    142122 
    143123                // If there is no existing database connection then try to connect 
    144                 if (!isset($this->dbh) || !$this->dbh) { 
    145                         $this->connect($this->dbuser, $this->dbpassword, $this->dbhost); 
    146                         $this->selectDB($this->dbname); 
     124                if (!($this->dbh instanceof mysqli)) { 
     125                        $this->connect(); 
    147126                } 
    148127 
    149128                // Perform the query via std mysql_query function.. 
    150                 $this->result = @mysql_query($query, $this->dbh); 
    151  
    152                 if (defined('SAVEQUERIES') && SAVEQUERIES) { // Borrowed from Wordpress 
    153                         $this->queries[] = array($query, $this->timer_stop(), $this->get_caller()); 
    154                 } 
    155  
     129                $this->result = mysqli_query($this->dbh, $query); 
    156130                // If there is an error then take note of it.. 
    157                 if ($str = @mysql_error($this->dbh)) { 
    158                         if (defined('DEBUG') && (DEBUG == 'true')) { 
    159                                 $subject = SITE_NAME." Database Error"; 
    160                                 $body = SITE_NAME." Database Error\r\n\r\n"; 
    161                                 $body .= "Date: ".date('d M Y H:i:s')." (timezone: ".date_default_timezone_get().")\r\n\r\n"; 
    162                                 $body .= "SQL query:\r\n"; 
    163                                 $body .= $query."\r\n\r\n"; 
    164                                 $body .= "PHP error log:\r\n"; 
    165                                 $body .= $str."\r\n\r\n"; 
    166  
    167                                 if (isset($this->h)) { 
    168                                         $body .= "Current User: ".$this->h->currentUser->name." (id: ".$this->h->currentUser->id.")\r\n"; 
    169                                         $body .= "User Role: ".$this->h->currentUser->role."\r\n"; 
    170                                         $body .= "Page Name: ".$this->h->pageName."\r\n"; 
    171                                         $body .= "Sub Page: ".$this->h->subPage."\r\n"; 
    172                                         $body .= "Plugin: ".$this->h->plugin->folder."\r\n\r\n"; 
    173                                 } 
    174  
    175                                 $body .= "If you need help, visit the forums at http://hotarucms.org\r\n"; 
    176                                 EmailFunctions::email( SITE_NAME.' <'.SITE_EMAIL.'>', $subject, $body, SITE_NAME.' <'.SITE_EMAIL.'>'); 
    177                         } 
    178  
    179                         $is_insert = true; 
    180                         $this->register_error($str); 
    181                         if ($this->show_errors) { 
    182                                 trigger_error($str, E_USER_WARNING); 
    183                         } 
    184                         return false; 
     131                if ($this->result === FALSE) { 
     132                        trigger_error('Query error ('.$this->dbh->errno.') '.$this->dbh->error, E_USER_WARNING); 
     133                        return FALSE; 
    185134                } 
    186135 
     
    188137                $is_insert = false; 
    189138                if (preg_match("/^(insert|delete|update|replace)\s+/i", $query)) { 
    190                         $this->rows_affected = @mysql_affected_rows(); 
     139                        $this->rows_affected = $this->dbh->affected_rows; 
    191140 
    192141                        // Take note of the insert_id 
    193142                        if (preg_match("/^(insert|replace)\s+/i", $query)) { 
    194                                 $this->insert_id = @mysql_insert_id($this->dbh); 
     143                                $this->insert_id = $this->dbh->insert_id; 
    195144                        } 
    196145 
    197146                        // Return number fo rows affected 
    198147                        $return_val = $this->rows_affected; 
    199                 } 
    200                 // Query was a select 
    201                 else { 
    202  
    203                         // Take note of column info 
    204                         $i = 0; 
    205                         if (is_resource($this->result)) { 
    206                                 while ($i < @mysql_num_fields($this->result)) { 
    207                                         $this->col_info[$i] = @mysql_fetch_field($this->result); 
    208                                         $i++; 
     148                } else { // Query was a select 
     149                        // Store Query Results 
     150                        if ($this->result instanceof mysqli_result) { 
     151                                while ($row = $this->result->fetch_object()) { 
     152                                        // Store relults as an objects within main array 
     153                                        $this->last_result[] = $row; 
    209154                                } 
    210                         } 
    211  
    212                         // Store Query Results 
    213                         $num_rows = 0; 
    214                         if (is_resource($this->result)) { 
    215                                 while ($row = @mysql_fetch_object($this->result)) { 
    216                                         // Store relults as an objects within main array 
    217                                         $this->last_result[$num_rows] = $row; 
    218                                         $num_rows++; 
    219                                 } 
    220                         } 
    221  
    222                         if (is_resource($this->result)) { 
    223                                 @mysql_free_result($this->result); 
    224                         } 
    225  
    226                         // Log number of rows the query returned 
    227                         $this->num_rows = $num_rows; 
    228  
    229                         // Return number of rows selected 
    230                         $return_val = $this->num_rows; 
     155 
     156                                // Store and return the number of rows the query returned 
     157                                $return_val = $this->num_rows = $this->result->num_rows; 
     158 
     159                                $this->result->free(); 
     160                        } 
    231161                } 
    232162 
     
    247177        public function escape($str = '') 
    248178        { 
    249                 return mysql_escape_string(stripslashes($str)); 
     179                return mysqli_real_escape_string($this->dbh, $str); 
    250180        } 
    251181 
     
    256186         * @return mixed Sanitized query string or NULL 
    257187         */ 
    258         public function prepare($args=null) 
    259         { 
    260  
    261                 if (is_null($args)) 
    262                         return; 
     188        public function prepare() 
     189        { 
     190 
     191                if (func_num_args() === 0) { 
     192                        return NULL; 
     193                } 
    263194 
    264195                $args = func_get_args(); 
     
    272203                $query = array_shift($args); 
    273204 
    274                 // in case someone mistakenly already singlequoted it 
    275                 $query = str_replace("'%s'", '%s', $query); 
    276  
    277                 $query = str_replace('"%s"', '%s', $query); // doublequote unquoting 
    278  
    279                 $query = str_replace('%s', "'%s'", $query); // quote the strings 
     205                // In case someone mistakenly already singlequoted it, remove the single quotes, 
     206                // next remove the double quotes, next singlequote %s occurences 
     207                $query = str_replace('%s', "'%s'", str_replace('"%s"', '%s', str_replace("'%s'", '%s', $query))); // quote the strings 
    280208 
    281209                foreach ($args as $i => $arg) { 
    282                         $args[$i] = $this->escape($arg); 
    283                 } 
    284  
    285                 return @vsprintf($query, $args); 
     210                        $args[$i] = $this->dbh->escape_string($arg); 
     211                } 
     212 
     213                // Assign the values to their placeholders in the query. 
     214                $query = vsprintf($query, $args); 
     215 
     216                return $query; 
    286217        } 
    287218 
     
    294225         * @return mixed 
    295226         */ 
    296         public function get_var($query=null, $col=0, $row=0) 
    297         { 
    298  
    299                 // Log how the function was called 
    300                 $this->func_call = "\$db->get_var(\"$query\",$col,$row)"; 
    301  
     227        public function get_var($query = NULL, $col = 0, $row = 0) 
     228        { 
    302229                // If there is a query then perform it if not then use cached results.. 
    303230                if ($query) { 
     
    306233 
    307234                // Extract var out of cached results based col,row vals 
    308                 if ($this->last_result[$row]) { 
    309                         unset($this->last_result['CLASSNAME']); 
     235                if (isset($this->last_result[$row])) { 
    310236                        $values = array_values(get_object_vars($this->last_result[$row])); 
    311237                } 
    312238 
    313239                // If there is a value return it else return null 
    314                 return (isset($values[$col]) && $values[$col] !== '') ? $values[$col] : null; 
     240                return (isset($values[$col]) && $values[$col] !== '') ? $values[$col] : NULL; 
    315241        } 
    316242 
     
    323249         * @return mixed 
    324250         */ 
    325         public function get_row($query=null, $output='OBJECT', $row=0) 
    326         { 
    327  
    328                 // Log how the function was called 
    329                 $this->func_call = "\$db->get_row(\"$query\",$output,$row)"; 
     251        public function get_row($query = NULL, $output = 'OBJECT', $row = 0) 
     252        { 
    330253 
    331254                // If there is a query then perform it if not then use cached results.. 
     
    336259                // If the output is an object then return object using the row offset.. 
    337260                if ($output == 'OBJECT') { 
    338                         return $this->last_result[$row] ? $this->last_result[$row] : null; 
     261                        return isset($this->last_result[$row]) ? $this->last_result[$row] : null; 
    339262                } 
    340263                // If the output is an associative array then return row as such.. 
     
    359282         * @return array 
    360283         */ 
    361         public function get_col($query=null, $col=0) 
     284        public function get_col($query = NULL, $col = 0) 
    362285        { 
    363286                $ret = array(); 
     
    384307         * @return mixed 
    385308         */ 
    386         public function get_results($query=null, $output = 'OBJECT') 
    387         { 
    388  
    389                 // Log how the function was called 
    390                 $this->func_call = "\$db->get_results(\"$query\", $output)"; 
     309        public function get_results($query = NULL, $output = 'OBJECT') 
     310        { 
    391311 
    392312                // If there is a query then perform it if not then use cached results.. 
     
    420340 
    421341        /** 
    422          * Connect to a database. 
    423          * 
    424          * @param string $dbname 
    425          * @return boolean 
    426          */ 
    427         public function selectDB($dbname='') 
    428         { 
    429                 $return_val = false; 
    430  
    431                 // Must have a database name 
    432                 if (!$dbname) { 
    433                         $this->register_error($this->error_str[3].' in '.__FILE__.' on line '.__LINE__); 
    434                         if ($this->show_errors) { 
    435                                 trigger_error($this->error_str[3], E_USER_WARNING); 
    436                         } 
    437                 } 
    438  
    439                 // Must have an active database connection 
    440                 else if (!$this->dbh) { 
    441                         $this->register_error($this->error_str[4].' in '.__FILE__.' on line '.__LINE__); 
    442                         if ($this->show_errors) { 
    443                                 trigger_error($this->error_str[4], E_USER_WARNING); 
    444                         } 
    445                 } 
    446  
    447                 // Try to connect to the database 
    448                 else if (!@mysql_select_db($dbname, $this->dbh)) { 
    449                         // Try to get error supplied by mysql if not use our own 
    450                         if (!$str = @mysql_error($this->dbh)) { 
    451                                 $str = $this->error_str[5]; 
    452                         } 
    453  
    454                         $this->register_error($str.' in '.__FILE__.' on line '.__LINE__); 
    455                         if ($this->show_errors) { 
    456                                 trigger_error($str, E_USER_WARNING); 
    457                         } 
    458                 } else { 
    459                         $this->dbname = $dbname; 
    460                         $return_val = true; 
    461                 } 
    462  
    463                 return $return_val; 
    464         } 
    465  
    466         /** 
    467          * Set the global Hotaru object 
    468          * 
    469          * @param Hotaru $h The Hotaru instance 
    470          */ 
    471         public function setHotaru($h) 
    472         { 
    473                 $this->h = $h; 
    474         } 
    475  
    476  
    477         /** 
    478342         * Check if table exists 
    479343         * 
    480          * @param string $table2check 
     344         * @param string $table_name 
    481345         * @return bool 
    482346         * 
    483347         * Notes: This is a custom function for Hotaru CMS 
    484348         */ 
    485         public function table_exists($table2check) 
     349        public function table_exists($table_name) 
    486350        { 
    487351                $tables = $this->get_col("SHOW TABLES", 0); 
    488                 return (bool) in_array(DB_PREFIX.$table2check, $tables); 
    489         } 
    490  
    491         /** 
    492          * Check if table empty 
    493          * 
    494          * @param string $table2check 
    495          * @return bool 
    496          * 
    497          * Notes: This is a custom function for Hotaru CMS 
    498          */ 
    499         public function table_empty($table2check) 
    500         { 
    501                 $rowcount = $this->get_var($this->prepare("SELECT COUNT(*) FROM ".DB_PREFIX.$table2check)); 
    502                 return (!(bool) ($rowcount && $rowcount > 0)); 
     352                return (bool) in_array(DB_PREFIX.$table_name, $tables); 
    503353        } 
    504354 
     
    506356         * Check if table column exists 
    507357         * 
    508          * @param string $table2check 
     358         * @param string $table_name 
    509359         * @param string $column 
    510360         * @return bool 
     
    512362         * Notes: This is a custom function for Hotaru CMS 
    513363         */ 
    514         public function column_exists($table2check, $column) 
    515         { 
    516                 $sql = "SHOW COLUMNS FROM ".DB_PREFIX.$table2check; 
     364        public function column_exists($table_name, $column) 
     365        { 
     366                $sql = "SHOW COLUMNS FROM ".DB_PREFIX.$table_name; 
    517367                foreach ($this->get_col($sql, 0) as $column_name) { 
    518368                        if ($column_name == $column) { 
     
    524374        } 
    525375 
    526  
    527376        /** 
    528377         * Store a result to the cache 
     
    535384 
    536385                // disk caching of queries 
    537                 if ($this->use_disk_cache && ( $this->cache_queries && !$is_insert ) || ( $this->cache_inserts && $is_insert )) { 
     386                if ($this->use_disk_cache && ( $this->cache_queries && !$is_insert )) { 
    538387                        if (!is_dir($this->cache_dir)) { 
    539                                 $this->register_error("Could not open cache dir: $this->cache_dir"); 
    540                                 if ($this->show_errors) { 
    541                                         trigger_error('Could not open cache dir: '.$this->cache_dir, E_USER_WARNING); 
    542                                 } 
    543                         } else { 
    544  
    545                                 // Cache all result values 
    546                                 $result_cache = array( 
    547                                         'col_info' => $this->col_info, 
    548                                         'last_result' => $this->last_result, 
    549                                         'num_rows' => $this->num_rows, 
    550                                         'return_value' => ($this->num_rows == 0) ? 'empty' : $this->num_rows, 
    551                                 ); 
    552  
    553                                 error_log('<?php die(); ?>'.serialize($result_cache), 3, $this->cache_dir.'/'.md5($query).'.php'); 
    554                         } 
     388                                trigger_error('Could not open cache dir: '.$this->cache_dir, E_USER_WARNING); 
     389                                return FALSE; 
     390                        } 
     391 
     392                        // Cache all result values 
     393                        $result_cache = array( 
     394                                'last_result' => $this->last_result, 
     395                                'num_rows' => $this->num_rows, 
     396                                'return_value' => ($this->num_rows == 0) ? 'empty' : $this->num_rows, 
     397                        ); 
     398                        error_log('<?php die(); ?>'.serialize($result_cache), 3, $this->cache_dir.'/'.md5($query).'.php'); 
    555399                } 
    556400        } 
     
    577421                                $result_cache = unserialize(file_get_contents($cache_file, NULL, NULL, 15)); 
    578422 
    579                                 $this->col_info = $result_cache['col_info']; 
    580423                                $this->last_result = $result_cache['last_result']; 
    581424                                $this->num_rows = $result_cache['num_rows']; 
     
    588431        } 
    589432 
    590         /** 
    591          * Print SQL/DB error - over-ridden by specific DB class 
    592          * 
    593          * @param string $err_str 
    594          */ 
    595         private function register_error($err_str) 
    596         { 
    597                 // Keep track of last error 
    598                 $this->last_error = $err_str; 
    599  
    600                 // Capture all errors to an error array no matter what happens 
    601                 $this->captured_errors[] = array ( 
    602                         'error_str' => $err_str, 
    603                         'query' => $this->last_query 
    604                 ); 
    605         } 
    606  
    607         /** 
    608          * Kill cached query results 
    609          */ 
    610         private function flush() 
    611         { 
    612                 // Get rid of these 
    613                 $this->last_result = null; 
    614                 $this->col_info = null; 
    615                 $this->last_query = null; 
    616                 $this->from_disk_cache = false; 
    617         } 
    618  
    619         /** 
    620          * Fill Database Object 
    621          * 
    622          * @param array $select - associative array of select terms 
    623          * @param string $table - full table name including prefix 
    624          * @param array $where - associative array of where terms, e.g. array('id = %d' = 5, 'name = %s' = 'tony') 
    625          * @param string $orderby - e.g. "post_date DESC" 
    626          * @param string $limit - e.g. "10" or "5, 10" 
    627          * @param bool $cache - cache results 
    628          * @param bool $query_only - return just the query, not the results? 
    629          */ 
    630         private function fillObject($select = array(), $table = '', $where = array(), $orderby = '', $limit = '', $cache = FALSE, $query_only = FALSE) 
    631         { 
    632                 if ($select) { 
    633                         $this->select = $select; 
    634                 } 
    635                 if ($table) { 
    636                         $this->table = $table; 
    637                 } 
    638                 if ($where) { 
    639                         $this->where = $where; 
    640                 } 
    641                 if ($orderby) { 
    642                         $this->orderby = $orderby; 
    643                 } 
    644                 if ($limit) { 
    645                         $this->limit = $limit; 
    646                 } 
    647                 if ($cache) { 
    648                         $this->cache = true; 
    649                 } else { 
    650                         $this->cache = false; 
    651                 } 
    652                 if ($query_only) { 
    653                         $this->query_only = true; 
    654                 } else { 
    655                         $this->query_only = false; 
    656                 } 
    657         } 
    658433} 
  • branches/1.5/libs/extensions/Inspekt/Inspekt.php

    r2258 r2295  
    11881188            //no explicit func to check if the connection is live, but if it's not $conn would be false 
    11891189            if (isset($conn) && is_resource($conn)) { 
    1190                 return mysql_real_escape_string($value, $conn); 
    1191             } else { 
    1192                 return mysql_real_escape_string($value); 
     1190                return mysqli_real_escape_string( $conn, $value); 
    11931191            } 
    11941192        } 
  • branches/1.5/libs/extensions/SimplePie/simplepie.php

    r2175 r2295  
    4343 * @todo phpDoc comments 
    4444 */ 
    45  
    4645/** 
    4746 * SimplePie Name 
     
    6968 * @see SimplePie::set_useragent() 
    7069 */ 
    71 define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed Parser; ' . SIMPLEPIE_URL . '; Allow like Gecko) Build/' . SIMPLEPIE_BUILD); 
     70define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME.'/'.SIMPLEPIE_VERSION.' (Feed Parser; '.SIMPLEPIE_URL.'; Allow like Gecko) Build/'.SIMPLEPIE_BUILD); 
    7271 
    7372/** 
    7473 * SimplePie Linkback 
    7574 */ 
    76 define('SIMPLEPIE_LINKBACK', '<a href="' . SIMPLEPIE_URL . '" title="' . SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . '">' . SIMPLEPIE_NAME . '</a>'); 
     75define('SIMPLEPIE_LINKBACK', '<a href="'.SIMPLEPIE_URL.'" title="'.SIMPLEPIE_NAME.' '.SIMPLEPIE_VERSION.'">'.SIMPLEPIE_NAME.'</a>'); 
    7776 
    7877/** 
     
    396395class SimplePie 
    397396{ 
     397 
    398398        /** 
    399399         * @var array Raw data 
     
    401401         */ 
    402402        var $data = array(); 
    403  
    404403        /** 
    405404         * @var mixed Error string 
     
    407406         */ 
    408407        var $error; 
    409  
    410408        /** 
    411409         * @var object Instance of SimplePie_Sanitize (or other class) 
     
    414412         */ 
    415413        var $sanitize; 
    416  
    417414        /** 
    418415         * @var string SimplePie Useragent 
     
    421418         */ 
    422419        var $useragent = SIMPLEPIE_USERAGENT; 
    423  
    424420        /** 
    425421         * @var string Feed URL 
     
    428424         */ 
    429425        var $feed_url; 
    430  
    431426        /** 
    432427         * @var object Instance of SimplePie_File to use as a feed 
     
    435430         */ 
    436431        var $file; 
    437  
    438432        /** 
    439433         * @var string Raw feed data 
     
    442436         */ 
    443437        var $raw_data; 
    444  
    445438        /** 
    446439         * @var int Timeout for fetching remote files 
     
    449442         */ 
    450443        var $timeout = 10; 
    451  
    452444        /** 
    453445         * @var bool Forces fsockopen() to be used for remote files instead 
     
    457449         */ 
    458450        var $force_fsockopen = false; 
    459  
    460451        /** 
    461452         * @var bool Force the given data/URL to be treated as a feed no matter what 
     
    465456         */ 
    466457        var $force_feed = false; 
    467  
    468458        /** 
    469459         * @var bool Enable/Disable XML dump 
     
    472462         */ 
    473463        var $xml_dump = false; 
    474  
    475464        /** 
    476465         * @var bool Enable/Disable Caching 
     
    479468         */ 
    480469        var $cache = true; 
    481  
    482470        /** 
    483471         * @var int Cache duration (in seconds) 
     
    486474         */ 
    487475        var $cache_duration = 3600; 
    488  
    489476        /** 
    490477         * @var int Auto-discovery cache duration (in seconds) 
     
    493480         */ 
    494481        var $autodiscovery_cache_duration = 604800; // 7 Days. 
    495  
    496482        /** 
    497483         * @var string Cache location (relative to executing script) 
     
    500486         */ 
    501487        var $cache_location = './cache'; 
    502  
    503488        /** 
    504489         * @var string Function that creates the cache filename 
     
    507492         */ 
    508493        var $cache_name_function = 'md5'; 
    509  
    510494        /** 
    511495         * @var bool Reorder feed by date descending 
     
    514498         */ 
    515499        var $order_by_date = true; 
    516  
    517500        /** 
    518501         * @var mixed Force input encoding to be set to the follow value 
     
    522505         */ 
    523506        var $input_encoding = false; 
    524  
    525507        /** 
    526508         * @var int Feed Autodiscovery Level 
     
    529511         */ 
    530512        var $autodiscovery = SIMPLEPIE_LOCATOR_ALL; 
    531  
    532513        /** 
    533514         * @var string Class used for caching feeds 
     
    536517         */ 
    537518        var $cache_class = 'SimplePie_Cache'; 
    538  
    539519        /** 
    540520         * @var string Class used for locating feeds 
     
    543523         */ 
    544524        var $locator_class = 'SimplePie_Locator'; 
    545  
    546525        /** 
    547526         * @var string Class used for parsing feeds 
     
    550529         */ 
    551530        var $parser_class = 'SimplePie_Parser'; 
    552  
    553531        /** 
    554532         * @var string Class used for fetching feeds 
     
    557535         */ 
    558536        var $file_class = 'SimplePie_File'; 
    559  
    560537        /** 
    561538         * @var string Class used for items 
     
    564541         */ 
    565542        var $item_class = 'SimplePie_Item'; 
    566  
    567543        /** 
    568544         * @var string Class used for authors 
     
    571547         */ 
    572548        var $author_class = 'SimplePie_Author'; 
    573  
    574549        /** 
    575550         * @var string Class used for categories 
     
    578553         */ 
    579554        var $category_class = 'SimplePie_Category'; 
    580  
    581555        /** 
    582556         * @var string Class used for enclosures 
     
    585559         */ 
    586560        var $enclosure_class = 'SimplePie_Enclosure'; 
    587  
    588561        /** 
    589562         * @var string Class used for Media RSS <media:text> captions 
     
    592565         */ 
    593566        var $caption_class = 'SimplePie_Caption'; 
    594  
    595567        /** 
    596568         * @var string Class used for Media RSS <media:copyright> 
     
    599571         */ 
    600572        var $copyright_class = 'SimplePie_Copyright'; 
    601  
    602573        /** 
    603574         * @var string Class used for Media RSS <media:credit> 
     
    606577         */ 
    607578        var $credit_class = 'SimplePie_Credit'; 
    608  
    609579        /** 
    610580         * @var string Class used for Media RSS <media:rating> 
     
    613583         */ 
    614584        var $rating_class = 'SimplePie_Rating'; 
    615  
    616585        /** 
    617586         * @var string Class used for Media RSS <media:restriction> 
     
    620589         */ 
    621590        var $restriction_class = 'SimplePie_Restriction'; 
    622  
    623591        /** 
    624592         * @var string Class used for content-type sniffing 
     
    627595         */ 
    628596        var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer'; 
    629  
    630597        /** 
    631598         * @var string Class used for item sources. 
     
    634601         */ 
    635602        var $source_class = 'SimplePie_Source'; 
    636  
    637603        /** 
    638604         * @var mixed Set javascript query string parameter (false, or 
     
    642608         */ 
    643609        var $javascript = 'js'; 
    644  
    645610        /** 
    646611         * @var int Maximum number of feeds to check with autodiscovery 
     
    649614         */ 
    650615        var $max_checked_feeds = 10; 
    651  
    652616        /** 
    653617         * @var array All the feeds found during the autodiscovery process 
     
    656620         */ 
    657621        var $all_discovered_feeds = array(); 
    658  
    659622        /** 
    660623         * @var string Web-accessible path to the handler_favicon.php file. 
     
    663626         */ 
    664627        var $favicon_handler = ''; 
    665  
    666628        /** 
    667629         * @var string Web-accessible path to the handler_image.php file. 
     
    670632         */ 
    671633        var $image_handler = ''; 
    672  
    673634        /** 
    674635         * @var array Stores the URLs when multiple feeds are being initialized. 
     
    677638         */ 
    678639        var $multifeed_url = array(); 
    679  
    680640        /** 
    681641         * @var array Stores SimplePie objects when multiple feeds initialized. 
     
    683643         */ 
    684644        var $multifeed_objects = array(); 
    685  
    686645        /** 
    687646         * @var array Stores the get_object_vars() array for use with multifeeds. 
     
    690649         */ 
    691650        var $config_settings = null; 
    692  
    693651        /** 
    694652         * @var integer Stores the number of items to return per-feed with multifeeds. 
     
    697655         */ 
    698656        var $item_limit = 0; 
    699  
    700657        /** 
    701658         * @var array Stores the default attributes to be stripped by strip_attributes(). 
     
    704661         */ 
    705662        var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'); 
    706  
    707663        /** 
    708664         * @var array Stores the default tags to be stripped by strip_htmltags(). 
     
    739695 
    740696                // Set options if they're passed to the constructor 
    741                 if ($cache_location !== null) 
    742                 { 
     697                if ($cache_location !== null) { 
    743698                        $this->set_cache_location($cache_location); 
    744699                } 
    745700 
    746                 if ($cache_duration !== null) 
    747                 { 
     701                if ($cache_duration !== null) { 
    748702                        $this->set_cache_duration($cache_duration); 
    749703                } 
    750704 
    751705                // Only init the script if we're passed a feed URL 
    752                 if ($feed_url !== null) 
    753                 { 
     706                if ($feed_url !== null) { 
    754707                        $this->set_feed_url($feed_url); 
    755708                        $this->init(); 
     
    770723        function __destruct() 
    771724        { 
    772                 if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) 
    773                 { 
    774                         if (!empty($this->data['items'])) 
    775                         { 
    776                                 foreach ($this->data['items'] as $item) 
    777                                 { 
     725                if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) { 
     726                        if (!empty($this->data['items'])) { 
     727                                foreach ($this->data['items'] as $item) { 
    778728                                        $item->__destruct(); 
    779729                                } 
    780730                                unset($item, $this->data['items']); 
    781731                        } 
    782                         if (!empty($this->data['ordered_items'])) 
    783                         { 
    784                                 foreach ($this->data['ordered_items'] as $item) 
    785                                 { 
     732                        if (!empty($this->data['ordered_items'])) { 
     733                                foreach ($this->data['ordered_items'] as $item) { 
    786734                                        $item->__destruct(); 
    787735                                } 
     
    822770        function set_feed_url($url) 
    823771        { 
    824                 if (is_array($url)) 
    825                 { 
     772                if (is_array($url)) { 
    826773                        $this->multifeed_url = array(); 
    827                         foreach ($url as $value) 
    828                         { 
     774                        foreach ($url as $value) { 
    829775                                $this->multifeed_url[] = SimplePie_Misc::fix_protocol($value, 1); 
    830776                        } 
    831                 } 
    832                 else 
    833                 { 
     777                } else { 
    834778                        $this->feed_url = SimplePie_Misc::fix_protocol($url, 1); 
    835779                } 
     
    845789        function set_file(&$file) 
    846790        { 
    847                 if (is_a($file, 'SimplePie_File')) 
    848                 { 
     791                if (is_a($file, 'SimplePie_File')) { 
    849792                        $this->feed_url = $file->url; 
    850                         $this->file =& $file; 
     793                        $this->file = & $file; 
    851794                        return true; 
    852795                } 
     
    988931        function set_input_encoding($encoding = false) 
    989932        { 
    990                 if ($encoding) 
    991                 { 
     933                if ($encoding) { 
    992934                        $this->input_encoding = (string) $encoding; 
    993                 } 
    994                 else 
    995                 { 
     935                } else { 
    996936                        $this->input_encoding = false; 
    997937                } 
     
    1028968        function set_cache_class($class = 'SimplePie_Cache') 
    1029969        { 
    1030                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Cache')) 
    1031                 { 
     970                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Cache')) { 
    1032971                        $this->cache_class = $class; 
    1033972                        return true; 
     
    1047986        function set_locator_class($class = 'SimplePie_Locator') 
    1048987        { 
    1049                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Locator')) 
    1050                 { 
     988                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Locator')) { 
    1051989                        $this->locator_class = $class; 
    1052990                        return true; 
     
    10661004        function set_parser_class($class = 'SimplePie_Parser') 
    10671005        { 
    1068                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Parser')) 
    1069                 { 
     1006                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Parser')) { 
    10701007                        $this->parser_class = $class; 
    10711008                        return true; 
     
    10851022        function set_file_class($class = 'SimplePie_File') 
    10861023        { 
    1087                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_File')) 
    1088                 { 
     1024                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_File')) { 
    10891025                        $this->file_class = $class; 
    10901026                        return true; 
     
    11041040        function set_sanitize_class($class = 'SimplePie_Sanitize') 
    11051041        { 
    1106                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Sanitize')) 
    1107                 { 
     1042                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Sanitize')) { 
    11081043                        $this->sanitize = new $class; 
    11091044                        return true; 
     
    11231058        function set_item_class($class = 'SimplePie_Item') 
    11241059        { 
    1125                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Item')) 
    1126                 { 
     1060                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Item')) { 
    11271061                        $this->item_class = $class; 
    11281062                        return true; 
     
    11421076        function set_author_class($class = 'SimplePie_Author') 
    11431077        { 
    1144                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Author')) 
    1145                 { 
     1078                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Author')) { 
    11461079                        $this->author_class = $class; 
    11471080                        return true; 
     
    11611094        function set_category_class($class = 'SimplePie_Category') 
    11621095        { 
    1163                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Category')) 
    1164                 { 
     1096                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Category')) { 
    11651097                        $this->category_class = $class; 
    11661098                        return true; 
     
    11801112        function set_enclosure_class($class = 'SimplePie_Enclosure') 
    11811113        { 
    1182                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Enclosure')) 
    1183                 { 
     1114                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Enclosure')) { 
    11841115                        $this->enclosure_class = $class; 
    11851116                        return true; 
     
    11991130        function set_caption_class($class = 'SimplePie_Caption') 
    12001131        { 
    1201                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Caption')) 
    1202                 { 
     1132                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Caption')) { 
    12031133                        $this->caption_class = $class; 
    12041134                        return true; 
     
    12181148        function set_copyright_class($class = 'SimplePie_Copyright') 
    12191149        { 
    1220                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Copyright')) 
    1221                 { 
     1150                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Copyright')) { 
    12221151                        $this->copyright_class = $class; 
    12231152                        return true; 
     
    12371166        function set_credit_class($class = 'SimplePie_Credit') 
    12381167        { 
    1239                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Credit')) 
    1240                 { 
     1168                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Credit')) { 
    12411169                        $this->credit_class = $class; 
    12421170                        return true; 
     
    12561184        function set_rating_class($class = 'SimplePie_Rating') 
    12571185        { 
    1258                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Rating')) 
    1259                 { 
     1186                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Rating')) { 
    12601187                        $this->rating_class = $class; 
    12611188                        return true; 
     
    12751202        function set_restriction_class($class = 'SimplePie_Restriction') 
    12761203        { 
    1277                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Restriction')) 
    1278                 { 
     1204                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Restriction')) { 
    12791205                        $this->restriction_class = $class; 
    12801206                        return true; 
     
    12941220        function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer') 
    12951221        { 
    1296                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Content_Type_Sniffer')) 
    1297                 { 
     1222                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Content_Type_Sniffer')) { 
    12981223                        $this->content_type_sniffer_class = $class; 
    12991224                        return true; 
     
    13131238        function set_source_class($class = 'SimplePie_Source') 
    13141239        { 
    1315                 if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Source')) 
    1316                 { 
     1240                if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Source')) { 
    13171241                        $this->source_class = $class; 
    13181242                        return true; 
     
    13401264        function set_cache_name_function($function = 'md5') 
    13411265        { 
    1342                 if (is_callable($function)) 
    1343                 { 
     1266                if (is_callable($function)) { 
    13441267                        $this->cache_name_function = $function; 
    13451268                } 
     
    13541277        function set_javascript($get = 'js') 
    13551278        { 
    1356                 if ($get) 
    1357                 { 
     1279                if ($get) { 
    13581280                        $this->javascript = (string) $get; 
    1359                 } 
    1360                 else 
    1361                 { 
     1281                } else { 
    13621282                        $this->javascript = false; 
    13631283                } 
     
    13731293        function set_stupidly_fast($set = false) 
    13741294        { 
    1375                 if ($set) 
    1376                 { 
     1295                if ($set) { 
    13771296                        $this->enable_order_by_date(false); 
    13781297                        $this->remove_div(false); 
     
    14021321        function strip_htmltags($tags = '', $encode = null) 
    14031322        { 
    1404                 if ($tags === '') 
    1405                 { 
     1323                if ($tags === '') { 
    14061324                        $tags = $this->strip_htmltags; 
    14071325                } 
    14081326                $this->sanitize->strip_htmltags($tags); 
    1409                 if ($encode !== null) 
    1410                 { 
     1327                if ($encode !== null) { 
    14111328                        $this->sanitize->encode_instead_of_strip($tags); 
    14121329                } 
     
    14201337        function strip_attributes($attribs = '') 
    14211338        { 
    1422                 if ($attribs === '') 
    1423                 { 
     1339                if ($attribs === '') { 
    14241340                        $attribs = $this->strip_attributes; 
    14251341                } 
     
    14591375        function set_favicon_handler($page = false, $qs = 'i') 
    14601376        { 
    1461                 if ($page !== false) 
    1462                 { 
    1463                         $this->favicon_handler = $page . '?' . $qs . '='; 
    1464                 } 
    1465                 else 
    1466                 { 
     1377                if ($page !== false) { 
     1378                        $this->favicon_handler = $page.'?'.$qs.'='; 
     1379                } else { 
    14671380                        $this->favicon_handler = ''; 
    14681381                } 
     
    14781391        function set_image_handler($page = false, $qs = 'i') 
    14791392        { 
    1480                 if ($page !== false) 
    1481                 { 
    1482                         $this->sanitize->set_image_handler($page . '?' . $qs . '='); 
    1483                 } 
    1484                 else 
    1485                 { 
     1393                if ($page !== false) { 
     1394                        $this->sanitize->set_image_handler($page.'?'.$qs.'='); 
     1395                } else { 
    14861396                        $this->image_handler = ''; 
    14871397                } 
     
    15021412        { 
    15031413                // Check absolute bare minimum requirements. 
    1504                 if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.3.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre')) 
    1505                 { 
     1414                if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.3.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre')) { 
    15061415                        return false; 
    15071416                } 
    15081417                // 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. 
    1509                 elseif (!extension_loaded('xmlreader')) 
    1510                 { 
     1418                elseif (!extension_loaded('xmlreader')) { 
    15111419                        static $xml_is_sane = null; 
    1512                         if ($xml_is_sane === null) 
    1513                         { 
     1420                        if ($xml_is_sane === null) { 
    15141421                                $parser_check = xml_parser_create(); 
    15151422                                xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values); 
     
    15171424                                $xml_is_sane = isset($values[0]['value']); 
    15181425                        } 
    1519                         if (!$xml_is_sane) 
    1520                         { 
     1426                        if (!$xml_is_sane) { 
    15211427                                return false; 
    15221428                        } 
    15231429                } 
    15241430 
    1525                 if (isset($_GET[$this->javascript])) 
    1526                 { 
     1431                if (isset($_GET[$this->javascript])) { 
    15271432                        SimplePie_Misc::output_javascript(); 
    15281433                        exit; 
     
    15331438                $this->sanitize->pass_file_data($this->file_class, $this->timeout, $this->useragent, $this->force_fsockopen); 
    15341439 
    1535                 if ($this->feed_url !== null || $this->raw_data !== null) 
    1536                 { 
     1440                if ($this->feed_url !== null || $this->raw_data !== null) { 
    15371441                        $this->data = array(); 
    15381442                        $this->multifeed_objects = array(); 
    15391443                        $cache = false; 
    15401444 
    1541                         if ($this->feed_url !== null) 
    1542                         { 
     1445                        if ($this->feed_url !== null) { 
    15431446                                $parsed_feed_url = SimplePie_Misc::parse_url($this->feed_url); 
    15441447                                // Decide whether to enable caching 
    1545                                 if ($this->cache && $parsed_feed_url['scheme'] !== '') 
    1546                                 { 
     1448                                if ($this->cache && $parsed_feed_url['scheme'] !== '') { 
    15471449                                        $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc'); 
    15481450                                } 
    15491451                                // If it's enabled and we don't want an XML dump, use the cache 
    1550                                 if ($cache && !$this->xml_dump) 
    1551                                 { 
     1452                                if ($cache && !$this->xml_dump) { 
    15521453                                        // Load the Cache 
    15531454                                        $this->data = $cache->load(); 
    1554                                         if (!empty($this->data)) 
    1555                                         { 
     1455                                        if (!empty($this->data)) { 
    15561456                                                // If the cache is for an outdated build of SimplePie 
    1557                                                 if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD) 
    1558                                                 { 
     1457                                                if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD) { 
    15591458                                                        $cache->unlink(); 
    15601459                                                        $this->data = array(); 
    15611460                                                } 
    15621461                                                // If we've hit a collision just rerun it with caching disabled 
    1563                                                 elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url) 
    1564                                                 { 
     1462                                                elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url) { 
    15651463                                                        $cache = false; 
    15661464                                                        $this->data = array(); 
    15671465                                                } 
    15681466                                                // If we've got a non feed_url stored (if the page isn't actually a feed, or is a redirect) use that URL. 
    1569                                                 elseif (isset($this->data['feed_url'])) 
    1570                                                 { 
     1467                                                elseif (isset($this->data['feed_url'])) { 
    15711468                                                        // If the autodiscovery cache is still valid use it. 
    1572                                                         if ($cache->mtime() + $this->autodiscovery_cache_duration > time()) 
    1573                                                         { 
     1469                                                        if ($cache->mtime() + $this->autodiscovery_cache_duration > time()) { 
    15741470                                                                // Do not need to do feed autodiscovery yet. 
    1575                                                                 if ($this->data['feed_url'] === $this->data['url']) 
    1576                                                                 { 
     1471                                                                if ($this->data['feed_url'] === $this->data['url']) { 
    15771472                                                                        $cache->unlink(); 
    15781473                                                                        $this->data = array(); 
    1579                                                                 } 
    1580                                                                 else 
    1581                                                                 { 
     1474                                                                } else { 
    15821475                                                                        $this->set_feed_url($this->data['feed_url']); 
    15831476                                                                        return $this->init(); 
     
    15861479                                                } 
    15871480                                                // Check if the cache has been updated 
    1588                                                 elseif ($cache->mtime() + $this->cache_duration < time()) 
    1589                                                 { 
     1481                                                elseif ($cache->mtime() + $this->cache_duration < time()) { 
    15901482                                                        // If we have last-modified and/or etag set 
    1591                                                         if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) 
    1592                                                         { 
     1483                                                        if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) { 
    15931484                                                                $headers = array(); 
    1594                                                                 if (isset($this->data['headers']['last-modified'])) 
    1595                                                                 { 
     1485                                                                if (isset($this->data['headers']['last-modified'])) { 
    15961486                                                                        $headers['if-modified-since'] = $this->data['headers']['last-modified']; 
    15971487                                                                } 
    1598                                                                 if (isset($this->data['headers']['etag'])) 
    1599                                                                 { 
    1600                                                                         $headers['if-none-match'] = '"' . $this->data['headers']['etag'] . '"'; 
     1488                                                                if (isset($this->data['headers']['etag'])) { 
     1489                                                                        $headers['if-none-match'] = '"'.$this->data['headers']['etag'].'"'; 
    16011490                                                                } 
    1602                                                                 $file = new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen); 
    1603                                                                 if ($file->success) 
    1604                                                                 { 
    1605                                                                         if ($file->status_code === 304) 
    1606                                                                         { 
     1491                                                                $file = new $this->file_class($this->feed_url, $this->timeout / 10, 5, $headers, $this->useragent, $this->force_fsockopen); 
     1492                                                                if ($file->success) { 
     1493                                                                        if ($file->status_code === 304) { 
    16071494                                                                                $cache->touch(); 
    16081495                                                                                return true; 
    1609                                                                         } 
    1610                                                                         else 
    1611                                                                         { 
     1496                                                                        } else { 
    16121497                                                                                $headers = $file->headers; 
    16131498                                                                        } 
    1614                                                                 } 
    1615                                                                 else 
    1616                                                                 { 
     1499                                                                } else { 
    16171500                                                                        unset($file); 
    16181501                                                                } 
     
    16201503                                                } 
    16211504                                                // If the cache is still valid, just return true 
    1622                                                 else 
    1623                                                 { 
     1505                                                else { 
    16241506                                                        return true; 
    16251507                                                } 
    16261508                                        } 
    16271509                                        // If the cache is empty, delete it 
    1628                                         else 
    1629                                         { 
     1510                                        else { 
    16301511                                                $cache->unlink(); 
    16311512                                                $this->data = array(); 
     
    16331514                                } 
    16341515                                // 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. 
    1635                                 if (!isset($file)) 
    1636                                 { 
    1637                                         if (is_a($this->file, 'SimplePie_File') && $this->file->url === $this->feed_url) 
    1638                                         { 
    1639                                                 $file =& $this->file; 
    1640                                         } 
    1641                                         else 
    1642                                         { 
     1516                                if (!isset($file)) { 
     1517                                        if (is_a($this->file, 'SimplePie_File') && $this->file->url === $this->feed_url) { 
     1518                                                $file = & $this->file; 
     1519                                        } else { 
    16431520                                                $file = new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen); 
    16441521                                        } 
    16451522                                } 
    16461523                                // If the file connection has an error, set SimplePie::error to that and quit 
    1647                                 if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) 
    1648                                 { 
     1524                                if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) { 
    16491525                                        $this->error = $file->error; 
    1650                                         if (!empty($this->data)) 
    1651                                         { 
     1526                                        if (!empty($this->data)) { 
    16521527                                                return true; 
    1653                                         } 
    1654                                         else 
    1655                                         { 
     1528                                        } else { 
    16561529                                                return false; 
    16571530                                        } 
    16581531                                } 
    16591532 
    1660                                 if (!$this->force_feed) 
    1661                                 { 
     1533                                if (!$this->force_feed) { 
    16621534                                        // Check if the supplied URL is a feed, if it isn't, look for it. 
    16631535                                        $locate = new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class); 
    1664                                         if (!$locate->is_feed($file)) 
    1665                                         { 
     1536                                        if (!$locate->is_feed($file)) { 
    16661537                                                // We need to unset this so that if SimplePie::set_file() has been called that object is untouched 
    16671538                                                unset($file); 
    1668                                                 if ($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds)) 
    1669                                                 { 
    1670                                                         if ($cache) 
    1671                                                         { 
     1539                                                if ($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds)) { 
     1540                                                        if ($cache) { 
    16721541                                                                $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD); 
    1673                                                                 if (!$cache->save($this)) 
    1674                                                                 { 
     1542                                                                if (!$cache->save($this)) { 
    16751543                                                                        trigger_error("$this->cache_location is not writeable", E_USER_WARNING); 
    16761544                                                                } 
     
    16781546                                                        } 
    16791547                                                        $this->feed_url = $file->url; 
    1680                                                 } 
    1681                                                 else 
    1682                                                 { 
     1548                                                } else { 
    16831549                                                        $this->error = "A feed could not be found at $this->feed_url"; 
    16841550                                                        SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); 
     
    16931559                                $sniffer = new $this->content_type_sniffer_class($file); 
    16941560                                $sniffed = $sniffer->get_type(); 
    1695                         } 
    1696                         else 
    1697                         { 
     1561                        } else { 
    16981562                                $data = $this->raw_data; 
    16991563                        } 
     
    17031567 
    17041568                        // First check to see if input has been overridden. 
    1705                         if ($this->input_encoding !== false) 
    1706                         { 
     1569                        if ($this->input_encoding !== false) { 
    17071570                                $encodings[] = $this->input_encoding; 
    17081571                        } 
     
    17121575 
    17131576                        // RFC 3023 (only applies to sniffed content) 
    1714                         if (isset($sniffed)) 
    1715                         { 
    1716                                 if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml') 
    1717                                 { 
    1718                                         if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) 
    1719                                         { 
     1577                        if (isset($sniffed)) { 
     1578                                if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml') { 
     1579                                        if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) { 
    17201580                                                $encodings[] = strtoupper($charset[1]); 
    17211581                                        } 
    17221582                                        $encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data)); 
    17231583                                        $encodings[] = 'UTF-8'; 
    1724                                 } 
    1725                                 elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml') 
    1726                                 { 
    1727                                         if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) 
    1728                                         { 
     1584                                } elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml') { 
     1585                                        if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) { 
    17291586                                                $encodings[] = $charset[1]; 
    17301587                                        } 
     
    17321589                                } 
    17331590                                // Text MIME-type default 
    1734                                 elseif (substr($sniffed, 0, 5) === 'text/') 
    1735                                 { 
     1591                                elseif (substr($sniffed, 0, 5) === 'text/') { 
    17361592                                        $encodings[] = 'US-ASCII'; 
    17371593                                } 
     
    17471603 
    17481604                        // If we want the XML, just output that with the most likely encoding and quit 
    1749                         if ($this->xml_dump) 
    1750                         { 
    1751                                 header('Content-type: text/xml; charset=' . $encodings[0]); 
     1605                        if ($this->xml_dump) { 
     1606                                header('Content-type: text/xml; charset='.$encodings[0]); 
    17521607                                echo $data; 
    17531608                                exit; 
     
    17551610 
    17561611                        // Loop through each possible encoding, till we return something, or run out of possibilities 
    1757                         foreach ($encodings as $encoding) 
    1758                         { 
     1612                        foreach ($encodings as $encoding) { 
    17591613                                // Change the encoding to UTF-8 (as we always use UTF-8 internally) 
    1760                                 if ($utf8_data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8')) 
    1761                                 { 
     1614                                if ($utf8_data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8')) { 
    17621615                                        // Create new parser 
    17631616                                        $parser = new $this->parser_class(); 
    17641617 
    17651618                                        // If it's parsed fine 
    1766                                         if ($parser->parse($utf8_data, 'UTF-8')) 
    1767                                         { 
     1619                                        if ($parser->parse($utf8_data, 'UTF-8')) { 
    17681620                                                $this->data = $parser->get_data(); 
    1769                                                 if ($this->get_type() & ~SIMPLEPIE_TYPE_NONE) 
    1770                                                 { 
    1771                                                         if (isset($headers)) 
    1772                                                         { 
     1621                                                if ($this->get_type() & ~SIMPLEPIE_TYPE_NONE) { 
     1622                                                        if (isset($headers)) { 
    17731623                                                                $this->data['headers'] = $headers; 
    17741624                                                        } 
     
    17761626 
    17771627                                                        // Cache the file if caching is enabled 
    1778                                                         if ($cache && !$cache->save($this)) 
    1779                                                         { 
     1628                                                        if ($cache && !$cache->save($this)) { 
    17801629                                                                trigger_error("$cache->name is not writeable", E_USER_WARNING); 
    17811630                                                        } 
    17821631                                                        return true; 
    1783                                                 } 
    1784                                                 else 
    1785                                                 { 
     1632                                                } else { 
    17861633                                                        $this->error = "A feed could not be found at $this->feed_url"; 
    17871634                                                        SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); 
     
    17911638                                } 
    17921639                        } 
    1793                         if(isset($parser)) 
    1794                         { 
     1640                        if (isset($parser)) { 
    17951641                                // We have an error, just set SimplePie_Misc::error to it and quit 
    17961642                                $this->error = sprintf('XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column()); 
    1797                         } 
    1798                         else 
    1799                         { 
     1643                        } else { 
    18001644                                $this->error = 'The data could not be converted to UTF-8'; 
    18011645                        } 
    18021646                        SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); 
    18031647                        return false; 
    1804                 } 
    1805                 elseif (!empty($this->multifeed_url)) 
    1806                 { 
     1648                } elseif (!empty($this->multifeed_url)) { 
    18071649                        $i = 0; 
    18081650                        $success = 0; 
    18091651                        $this->multifeed_objects = array(); 
    1810                         foreach ($this->multifeed_url as $url) 
    1811                         { 
    1812                                 if (SIMPLEPIE_PHP5) 
    1813                                 { 
     1652                        foreach ($this->multifeed_url as $url) { 
     1653                                if (SIMPLEPIE_PHP5) { 
    18141654                                        // This keyword needs to defy coding standards for PHP4 compatibility 
    18151655                                        $this->multifeed_objects[$i] = clone($this); 
    1816                                 } 
    1817                                 else 
    1818                                 { 
     1656                                } else { 
    18191657                                        $this->multifeed_objects[$i] = $this; 
    18201658                                } 
     
    18241662                        } 
    18251663                        return (bool) $success; 
    1826                 } 
    1827                 else 
    1828                 { 
     1664                } else { 
    18291665                        return false; 
    18301666                } 
     
    18491685        function handle_content_type($mime = 'text/html') 
    18501686        { 
    1851                 if (!headers_sent()) 
    1852                 { 
     1687                if (!headers_sent()) { 
    18531688                        $header = "Content-type: $mime;"; 
    1854                         if ($this->get_encoding()) 
    1855                         { 
    1856                                 $header .= ' charset=' . $this->get_encoding(); 
    1857                         } 
    1858                         else 
    1859                         { 
     1689                        if ($this->get_encoding()) { 
     1690                                $header .= ' charset='.$this->get_encoding(); 
     1691                        } else { 
    18601692                                $header .= ' charset=UTF-8'; 
    18611693                        } 
     
    18661698        function get_type() 
    18671699        { 
    1868                 if (!isset($this->data['type'])) 
    1869                 { 
     1700                if (!isset($this->data['type'])) { 
    18701701                        $this->data['type'] = SIMPLEPIE_TYPE_ALL; 
    1871                         if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'])) 
    1872                         { 
     1702                        if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'])) { 
    18731703                                $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10; 
    1874                         } 
    1875                         elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'])) 
    1876                         { 
     1704                        } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'])) { 
    18771705                                $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03; 
    1878                         } 
    1879                         elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'])) 
    1880                         { 
     1706                        } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'])) { 
    18811707                                if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel']) 
    1882                                 || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image']) 
    1883                                 || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']) 
    1884                                 || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput'])) 
    1885                                 { 
     1708                                                || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image']) 
     1709                                                || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']) 
     1710                                                || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput'])) { 
    18861711                                        $this->data['type'] &= SIMPLEPIE_TYPE_RSS_10; 
    18871712                                } 
    18881713                                if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['channel']) 
    1889                                 || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image']) 
    1890                                 || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']) 
    1891                                 || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput'])) 
    1892                                 { 
     1714                                                || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image']) 
     1715                                                || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']) 
     1716                                                || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput'])) { 
    18931717                                        $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090; 
    18941718                                } 
    1895                         } 
    1896                         elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'])) 
    1897                         { 
     1719                        } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'])) { 
    18981720                                $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL; 
    1899                                 if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) 
    1900                                 { 
    1901                                         switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) 
    1902                                         { 
     1721                                if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) { 
     1722                                        switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) { 
    19031723                                                case '0.91': 
    19041724                                                        $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091; 
    1905                                                         if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) 
    1906                                                         { 
    1907                                                                 switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) 
    1908                                                                 { 
     1725                                                        if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) { 
     1726                                                                switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) { 
    19091727                                                                        case '0': 
    19101728                                                                                $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE; 
     
    19351753                                        } 
    19361754                                } 
    1937                         } 
    1938                         else 
    1939                         { 
     1755                        } else { 
    19401756                                $this->data['type'] = SIMPLEPIE_TYPE_NONE; 
    19411757                        } 
     
    19531769        function get_favicon() 
    19541770        { 
    1955                 if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) 
    1956                 { 
     1771                if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) { 
    19571772                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); 
    1958                 } 
    1959                 elseif (($url = $this->get_link()) !== null && preg_match('/^http(s)?:\/\//i', $url)) 
    1960                 { 
     1773                } elseif (($url = $this->get_link()) !== null && preg_match('/^http(s)?:\/\//i', $url)) { 
    19611774                        $favicon = SimplePie_Misc::absolutize_url('/favicon.ico', $url); 
    19621775 
    1963                         if ($this->cache && $this->favicon_handler) 
    1964                         { 
     1776                        if ($this->cache && $this->favicon_handler) { 
    19651777                                $favicon_filename = call_user_func($this->cache_name_function, $favicon); 
    19661778                                $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $favicon_filename, 'spi'); 
    19671779 
    1968                                 if ($cache->load()) 
    1969                                 { 
    1970                                         return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI); 
    1971                                 } 
    1972                                 else 
    1973                                 { 
     1780                                if ($cache->load()) { 
     1781                                        return $this->sanitize($this->favicon_handler.$favicon_filename, SIMPLEPIE_CONSTRUCT_IRI); 
     1782                                } else { 
    19741783                                        $file = new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen); 
    19751784 
    1976                                         if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0) 
    1977                                         { 
     1785                                        if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0) { 
    19781786                                                $sniffer = new $this->content_type_sniffer_class($file); 
    1979                                                 if (substr($sniffer->get_type(), 0, 6) === 'image/') 
    1980                                                 { 
    1981                                                         if ($cache->save(array('headers' => $file->headers, 'body' => $file->body))) 
    1982                                                         { 
    1983                                                                 return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI); 
    1984                                                         } 
    1985                                                         else 
    1986                                                         { 
     1787                                                if (substr($sniffer->get_type(), 0, 6) === 'image/') { 
     1788                                                        if ($cache->save(array('headers' => $file->headers, 'body' => $file->body))) { 
     1789                                                                return $this->sanitize($this->favicon_handler.$favicon_filename, SIMPLEPIE_CONSTRUCT_IRI); 
     1790                                                        } else { 
    19871791                                                                trigger_error("$cache->name is not writeable", E_USER_WARNING); 
    19881792                                                                return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI); 
     
    19901794                                                } 
    19911795                                                // not an image 
    1992                                                 else 
    1993                                                 { 
     1796                                                else { 
    19941797                                                        return false; 
    19951798                                                } 
    19961799                                        } 
    19971800                                } 
    1998                         } 
    1999                         else 
    2000                         { 
     1801                        } else { 
    20011802                                return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI); 
    20021803                        } 
     
    20121813        function subscribe_url() 
    20131814        { 
    2014                 if ($this->feed_url !== null) 
    2015                 { 
     1815                if ($this->feed_url !== null) { 
    20161816                        return $this->sanitize($this->feed_url, SIMPLEPIE_CONSTRUCT_IRI); 
    2017                 } 
    2018                 else 
    2019                 { 
     1817                } else { 
    20201818                        return null; 
    20211819                } 
     
    20241822        function subscribe_feed() 
    20251823        { 
    2026                 if ($this->feed_url !== null) 
    2027                 { 
     1824                if ($this->feed_url !== null) { 
    20281825                        return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI); 
    2029                 } 
    2030                 else 
    2031                 { 
     1826                } else { 
    20321827                        return null; 
    20331828                } 
     
    20361831        function subscribe_outlook() 
    20371832        { 
    2038                 if ($this->feed_url !== null) 
    2039                 { 
    2040                         return $this->sanitize('outlook' . SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI); 
    2041                 } 
    2042                 else 
    2043                 { 
     1833                if ($this->feed_url !== null) { 
     1834                        return $this->sanitize('outlook'.SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI); 
     1835                } else { 
    20441836                        return null; 
    20451837                } 
     
    20481840        function subscribe_podcast() 
    20491841        { 
    2050                 if ($this->feed_url !== null) 
    2051                 { 
     1842                if ($this->feed_url !== null) { 
    20521843                        return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 3), SIMPLEPIE_CONSTRUCT_IRI); 
    2053                 } 
    2054                 else 
    2055                 { 
     1844                } else { 
    20561845                        return null; 
    20571846                } 
     
    20601849        function subscribe_itunes() 
    20611850        { 
    2062                 if ($this->feed_url !== null) 
    2063                 { 
     1851                if ($this->feed_url !== null) { 
    20641852                        return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 4), SIMPLEPIE_CONSTRUCT_IRI); 
    2065                 } 
    2066                 else 
    2067                 { 
     1853                } else { 
    20681854                        return null; 
    20691855                } 
     
    20811867        function subscribe_service($feed_url, $site_url = null) 
    20821868        { 
    2083                 if ($this->subscribe_url()) 
    2084                 { 
    2085                         $return = $feed_url . rawurlencode($this->feed_url); 
    2086                         if ($site_url !== null && $this->get_link() !== null) 
    2087                         { 
    2088                                 $return .= $site_url . rawurlencode($this->get_link()); 
     1869                if ($this->subscribe_url()) { 
     1870                        $return = $feed_url.rawurlencode($this->feed_url); 
     1871                        if ($site_url !== null && $this->get_link() !== null) { 
     1872                                $return .= $site_url.rawurlencode($this->get_link()); 
    20891873                        } 
    20901874                        return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI); 
    2091                 } 
    2092                 else 
    2093                 { 
     1875                } else { 
    20941876                        return null; 
    20951877                } 
     
    21741956        { 
    21751957                $type = $this->get_type(); 
    2176                 if ($type & SIMPLEPIE_TYPE_ATOM_10) 
    2177                 { 
    2178                         if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag])) 
    2179                         { 
     1958                if ($type & SIMPLEPIE_TYPE_ATOM_10) { 
     1959                        if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag])) { 
    21801960                                return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag]; 
    21811961                        } 
    21821962                } 
    2183                 if ($type & SIMPLEPIE_TYPE_ATOM_03) 
    2184                 { 
    2185                         if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag])) 
    2186                         { 
     1963                if ($type & SIMPLEPIE_TYPE_ATOM_03) { 
     1964                        if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag])) { 
    21871965                                return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag]; 
    21881966                        } 
    21891967                } 
    2190                 if ($type & SIMPLEPIE_TYPE_RSS_RDF) 
    2191                 { 
    2192                         if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag])) 
    2193                         { 
     1968                if ($type & SIMPLEPIE_TYPE_RSS_RDF) { 
     1969                        if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag])) { 
    21941970                                return $this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag]; 
    21951971                        } 
    21961972                } 
    2197                 if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) 
    2198                 { 
    2199                         if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag])) 
    2200                         { 
     1973                if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) { 
     1974                        if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag])) { 
    22011975                                return $this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]; 
    22021976                        } 
     
    22081982        { 
    22091983                $type = $this->get_type(); 
    2210                 if ($type & SIMPLEPIE_TYPE_ATOM_ALL) 
    2211                 { 
    2212                         if ($return = $this->get_feed_tags($namespace, $tag)) 
    2213                         { 
     1984                if ($type & SIMPLEPIE_TYPE_ATOM_ALL) { 
     1985                        if ($return = $this->get_feed_tags($namespace, $tag)) { 
    22141986                                return $return; 
    22151987                        } 
    22161988                } 
    2217                 if ($type & SIMPLEPIE_TYPE_RSS_10) 
    2218                 { 
    2219                         if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'channel')) 
    2220                         { 
    2221                                 if (isset($channel[0]['child'][$namespace][$tag])) 
    2222                                 { 
     1989                if ($type & SIMPLEPIE_TYPE_RSS_10) { 
     1990                        if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'channel')) { 
     1991                                if (isset($channel[0]['child'][$namespace][$tag])) { 
    22231992                                        return $channel[0]['child'][$namespace][$tag]; 
    22241993                                } 
    22251994                        } 
    22261995                } 
    2227                 if ($type & SIMPLEPIE_TYPE_RSS_090) 
    2228                 { 
    2229                         if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'channel')) 
    2230                         { 
    2231                                 if (isset($channel[0]['child'][$namespace][$tag])) 
    2232                                 { 
     1996                if ($type & SIMPLEPIE_TYPE_RSS_090) { 
     1997                        if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'channel')) { 
     1998                                if (isset($channel[0]['child'][$namespace][$tag])) { 
    22331999                                        return $channel[0]['child'][$namespace][$tag]; 
    22342000                                } 
    22352001                        } 
    22362002                } 
    2237                 if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) 
    2238                 { 
    2239                         if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel')) 
    2240                         { 
    2241                                 if (isset($channel[0]['child'][$namespace][$tag])) 
    2242                                 { 
     2003                if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) { 
     2004                        if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel')) { 
     2005                                if (isset($channel[0]['child'][$namespace][$tag])) { 
    22432006                                        return $channel[0]['child'][$namespace][$tag]; 
    22442007                                } 
     
    22512014        { 
    22522015                $type = $this->get_type(); 
    2253                 if ($type & SIMPLEPIE_TYPE_RSS_10) 
    2254                 { 
    2255                         if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'image')) 
    2256                         { 
    2257                                 if (isset($image[0]['child'][$namespace][$tag])) 
    2258                                 { 
     2016                if ($type & SIMPLEPIE_TYPE_RSS_10) { 
     2017                        if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'image')) { 
     2018                                if (isset($image[0]['child'][$namespace][$tag])) { 
    22592019                                        return $image[0]['child'][$namespace][$tag]; 
    22602020                                } 
    22612021                        } 
    22622022                } 
    2263                 if ($type & SIMPLEPIE_TYPE_RSS_090) 
    2264                 { 
    2265                         if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'image')) 
    2266                         { 
    2267                                 if (isset($image[0]['child'][$namespace][$tag])) 
    2268                                 { 
     2023                if ($type & SIMPLEPIE_TYPE_RSS_090) { 
     2024                        if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'image')) { 
     2025                                if (isset($image[0]['child'][$namespace][$tag])) { 
    22692026                                        return $image[0]['child'][$namespace][$tag]; 
    22702027                                } 
    22712028                        } 
    22722029                } 
    2273                 if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) 
    2274                 { 
    2275                         if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image')) 
    2276                         { 
    2277                                 if (isset($image[0]['child'][$namespace][$tag])) 
    2278                                 { 
     2030                if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) { 
     2031                        if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image')) { 
     2032                                if (isset($image[0]['child'][$namespace][$tag])) { 
    22792033                                        return $image[0]['child'][$namespace][$tag]; 
    22802034                                } 
     
    22862040        function get_base($element = array()) 
    22872041        { 
    2288                 if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base'])) 
    2289                 { 
     2042                if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base'])) { 
    22902043                        return $element['xml_base']; 
    2291                 } 
    2292                 elseif ($this->get_link() !== null) 
    2293                 { 
     2044                } elseif ($this->get_link() !== null) { 
    22942045                        return $this->get_link(); 
    2295                 } 
    2296                 else 
    2297                 { 
     2046                } else { 
    22982047                        return $this->subscribe_url(); 
    22992048                } 
     
    23072056        function get_title() 
    23082057        { 
    2309                 if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) 
    2310                 { 
     2058                if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) { 
    23112059                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    2312                 } 
    2313                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) 
    2314                 { 
     2060                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) { 
    23152061                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    2316                 } 
    2317                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) 
    2318                 { 
     2062                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) { 
    23192063                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    2320                 } 
    2321                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) 
    2322                 { 
     2064                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) { 
    23232065                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    2324                 } 
    2325                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) 
    2326                 { 
     2066                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) { 
    23272067                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    2328                 } 
    2329                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) 
    2330                 { 
     2068                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) { 
    23312069                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2332                 } 
    2333                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) 
    2334                 { 
     2070                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) { 
    23352071                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2336                 } 
    2337                 else 
    2338                 { 
     2072                } else { 
    23392073                        return null; 
    23402074                } 
     
    23442078        { 
    23452079                $categories = $this->get_categories(); 
    2346                 if (isset($categories[$key])) 
    2347                 { 
     2080                if (isset($categories[$key])) { 
    23482081                        return $categories[$key]; 
    2349                 } 
    2350                 else 
    2351                 { 
     2082                } else { 
    23522083                        return null; 
    23532084                } 
     
    23582089                $categories = array(); 
    23592090 
    2360                 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) 
    2361                 { 
     2091                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) { 
    23622092                        $term = null; 
    23632093                        $scheme = null; 
    23642094                        $label = null; 
    2365                         if (isset($category['attribs']['']['term'])) 
    2366                         { 
     2095                        if (isset($category['attribs']['']['term'])) { 
    23672096                                $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); 
    23682097                        } 
    2369                         if (isset($category['attribs']['']['scheme'])) 
    2370                         { 
     2098                        if (isset($category['attribs']['']['scheme'])) { 
    23712099                                $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    23722100                        } 
    2373                         if (isset($category['attribs']['']['label'])) 
    2374                         { 
     2101                        if (isset($category['attribs']['']['label'])) { 
    23752102                                $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); 
    23762103                        } 
    23772104                        $categories[] = new $this->category_class($term, $scheme, $label); 
    23782105                } 
    2379                 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) 
    2380                 { 
     2106                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) { 
    23812107                        // This is really the label, but keep this as the term also for BC. 
    23822108                        // Label will also work on retrieving because that falls back to term. 
    23832109                        $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2384                         if (isset($category['attribs']['']['domain'])) 
    2385                         { 
     2110                        if (isset($category['attribs']['']['domain'])) { 
    23862111                                $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2387                         } 
    2388                         else 
    2389                         { 
     2112                        } else { 
    23902113                                $scheme = null; 
    23912114                        } 
    23922115                        $categories[] = new $this->category_class($term, $scheme, null); 
    23932116                } 
    2394                 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) 
    2395                 { 
     2117                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) { 
    23962118                        $categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    23972119                } 
    2398                 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) 
    2399                 { 
     2120                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) { 
    24002121                        $categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    24012122                } 
    24022123 
    2403                 if (!empty($categories)) 
    2404                 { 
     2124                if (!empty($categories)) { 
    24052125                        return SimplePie_Misc::array_unique($categories); 
    2406                 } 
    2407                 else 
    2408                 { 
     2126                } else { 
    24092127                        return null; 
    24102128                } 
     
    24142132        { 
    24152133                $authors = $this->get_authors(); 
    2416                 if (isset($authors[$key])) 
    2417                 { 
     2134                if (isset($authors[$key])) { 
    24182135                        return $authors[$key]; 
    2419                 } 
    2420                 else 
    2421                 { 
     2136                } else { 
    24222137                        return null; 
    24232138                } 
     
    24272142        { 
    24282143                $authors = array(); 
    2429                 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) 
    2430                 { 
     2144                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) { 
    24312145                        $name = null; 
    24322146                        $uri = null; 
    24332147                        $email = null; 
    2434                         if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) 
    2435                         { 
     2148                        if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { 
    24362149                                $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    24372150                        } 
    2438                         if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) 
    2439                         { 
     2151                        if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { 
    24402152                                $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])); 
    24412153                        } 
    2442                         if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) 
    2443                         { 
     2154                        if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { 
    24442155                                $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    24452156                        } 
    2446                         if ($name !== null || $email !== null || $uri !== null) 
    2447                         { 
     2157                        if ($name !== null || $email !== null || $uri !== null) { 
    24482158                                $authors[] = new $this->author_class($name, $uri, $email); 
    24492159                        } 
    24502160                } 
    2451                 if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) 
    2452                 { 
     2161                if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) { 
    24532162                        $name = null; 
    24542163                        $url = null; 
    24552164                        $email = null; 
    2456                         if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) 
    2457                         { 
     2165                        if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { 
    24582166                                $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    24592167                        } 
    2460                         if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) 
    2461                         { 
     2168                        if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { 
    24622169                                $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])); 
    24632170                        } 
    2464                         if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) 
    2465                         { 
     2171                        if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { 
    24662172                                $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    24672173                        } 
    2468                         if ($name !== null || $email !== null || $url !== null) 
    2469                         { 
     2174                        if ($name !== null || $email !== null || $url !== null) { 
    24702175                                $authors[] = new $this->author_class($name, $url, $email); 
    24712176                        } 
    24722177                } 
    2473                 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) 
    2474                 { 
     2178                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) { 
    24752179                        $authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    24762180                } 
    2477                 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) 
    2478                 { 
     2181                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) { 
    24792182                        $authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    24802183                } 
    2481                 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) 
    2482                 { 
     2184                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) { 
    24832185                        $authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    24842186                } 
    24852187 
    2486                 if (!empty($authors)) 
    2487                 { 
     2188                if (!empty($authors)) { 
    24882189                        return SimplePie_Misc::array_unique($authors); 
    2489                 } 
    2490                 else 
    2491                 { 
     2190                } else { 
    24922191                        return null; 
    24932192                } 
     
    24972196        { 
    24982197                $contributors = $this->get_contributors(); 
    2499                 if (isset($contributors[$key])) 
    2500                 { 
     2198                if (isset($contributors[$key])) { 
    25012199                        return $contributors[$key]; 
    2502                 } 
    2503                 else 
    2504                 { 
     2200                } else { 
    25052201                        return null; 
    25062202                } 
     
    25102206        { 
    25112207                $contributors = array(); 
    2512                 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) 
    2513                 { 
     2208                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) { 
    25142209                        $name = null; 
    25152210                        $uri = null; 
    25162211                        $email = null; 
    2517                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) 
    2518                         { 
     2212                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { 
    25192213                                $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    25202214                        } 
    2521                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) 
    2522                         { 
     2215                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { 
    25232216                                $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])); 
    25242217                        } 
    2525                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) 
    2526                         { 
     2218                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { 
    25272219                                $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    25282220                        } 
    2529                         if ($name !== null || $email !== null || $uri !== null) 
    2530                         { 
     2221                        if ($name !== null || $email !== null || $uri !== null) { 
    25312222                                $contributors[] = new $this->author_class($name, $uri, $email); 
    25322223                        } 
    25332224                } 
    2534                 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) 
    2535                 { 
     2225                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) { 
    25362226                        $name = null; 
    25372227                        $url = null; 
    25382228                        $email = null; 
    2539                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) 
    2540                         { 
     2229                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { 
    25412230                                $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    25422231                        } 
    2543                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) 
    2544                         { 
     2232                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { 
    25452233                                $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])); 
    25462234                        } 
    2547                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) 
    2548                         { 
     2235                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { 
    25492236                                $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    25502237                        } 
    2551                         if ($name !== null || $email !== null || $url !== null) 
    2552                         { 
     2238                        if ($name !== null || $email !== null || $url !== null) { 
    25532239                                $contributors[] = new $this->author_class($name, $url, $email); 
    25542240                        } 
    25552241                } 
    25562242 
    2557                 if (!empty($contributors)) 
    2558                 { 
     2243                if (!empty($contributors)) { 
    25592244                        return SimplePie_Misc::array_unique($contributors); 
    2560                 } 
    2561                 else 
    2562                 { 
     2245                } else { 
    25632246                        return null; 
    25642247                } 
     
    25682251        { 
    25692252                $links = $this->get_links($rel); 
    2570                 if (isset($links[$key])) 
    2571                 { 
     2253                if (isset($links[$key])) { 
    25722254                        return $links[$key]; 
    2573                 } 
    2574                 else 
    2575                 { 
     2255                } else { 
    25762256                        return null; 
    25772257                } 
     
    25882268        function get_links($rel = 'alternate') 
    25892269        { 
    2590                 if (!isset($this->data['links'])) 
    2591                 { 
     2270                if (!isset($this->data['links'])) { 
    25922271                        $this->data['links'] = array(); 
    2593                         if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) 
    2594                         { 
    2595                                 foreach ($links as $link) 
    2596                                 { 
    2597                                         if (isset($link['attribs']['']['href'])) 
    2598                                         { 
     2272                        if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) { 
     2273                                foreach ($links as $link) { 
     2274                                        if (isset($link['attribs']['']['href'])) { 
    25992275                                                $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; 
    26002276                                                $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); 
     
    26022278                                } 
    26032279                        } 
    2604                         if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link')) 
    2605                         { 
    2606                                 foreach ($links as $link) 
    2607                                 { 
    2608                                         if (isset($link['attribs']['']['href'])) 
    2609                                         { 
     2280                        if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link')) { 
     2281                                foreach ($links as $link) { 
     2282                                        if (isset($link['attribs']['']['href'])) { 
    26102283                                                $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; 
    26112284                                                $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); 
    2612  
    26132285                                        } 
    26142286                                } 
    26152287                        } 
    2616                         if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) 
    2617                         { 
     2288                        if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) { 
    26182289                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); 
    26192290                        } 
    2620                         if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) 
    2621                         { 
     2291                        if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) { 
    26222292                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); 
    26232293                        } 
    2624                         if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) 
    2625                         { 
     2294                        if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) { 
    26262295                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); 
    26272296                        } 
    26282297 
    26292298                        $keys = array_keys($this->data['links']); 
    2630                         foreach ($keys as $key) 
    2631                         { 
    2632                                 if (SimplePie_Misc::is_isegment_nz_nc($key)) 
    2633                                 { 
    2634                                         if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) 
    2635                                         { 
    2636                                                 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); 
    2637                                                 $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; 
     2299                        foreach ($keys as $key) { 
     2300                                if (SimplePie_Misc::is_isegment_nz_nc($key)) { 
     2301                                        if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key])) { 
     2302                                                $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]); 
     2303                                                $this->data['links'][$key] = & $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]; 
     2304                                        } else { 
     2305                                                $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = & $this->data['links'][$key]; 
    26382306                                        } 
    2639                                         else 
    2640                                         { 
    2641                                                 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; 
    2642                                         } 
    2643                                 } 
    2644                                 elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) 
    2645                                 { 
    2646                                         $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; 
     2307                                } elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) { 
     2308                                        $this->data['links'][substr($key, 41)] = & $this->data['links'][$key]; 
    26472309                                } 
    26482310                                $this->data['links'][$key] = array_unique($this->data['links'][$key]); 
     
    26502312                } 
    26512313 
    2652                 if (isset($this->data['links'][$rel])) 
    2653                 { 
     2314                if (isset($this->data['links'][$rel])) { 
    26542315                        return $this->data['links'][$rel]; 
    2655                 } 
    2656                 else 
    2657                 { 
     2316                } else { 
    26582317                        return null; 
    26592318                } 
     
    26672326        function get_description() 
    26682327        { 
    2669                 if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) 
    2670                 { 
     2328                if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) { 
    26712329                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    2672                 } 
    2673                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) 
    2674                 { 
     2330                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) { 
    26752331                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    2676                 } 
    2677                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) 
    2678                 { 
     2332                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) { 
    26792333                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    2680                 } 
    2681                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) 
    2682                 { 
     2334                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) { 
    26832335                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    2684                 } 
    2685                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) 
    2686                 { 
     2336                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) { 
    26872337                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); 
    2688                 } 
    2689                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) 
    2690                 { 
     2338                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) { 
    26912339                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2692                 } 
    2693                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) 
    2694                 { 
     2340                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) { 
    26952341                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2696                 } 
    2697                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) 
    2698                 { 
     2342                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) { 
    26992343                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); 
    2700                 } 
    2701                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) 
    2702                 { 
     2344                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) { 
    27032345                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); 
    2704                 } 
    2705                 else 
    2706                 { 
     2346                } else { 
    27072347                        return null; 
    27082348                } 
     
    27112351        function get_copyright() 
    27122352        { 
    2713                 if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) 
    2714                 { 
     2353                if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) { 
    27152354                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    2716                 } 
    2717                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) 
    2718                 { 
     2355                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) { 
    27192356                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    2720                 } 
    2721                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) 
    2722                 { 
     2357                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) { 
    27232358                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2724                 } 
    2725                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) 
    2726                 { 
     2359                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) { 
    27272360                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2728                 } 
    2729                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) 
    2730                 { 
     2361                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) { 
    27312362                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2732                 } 
    2733                 else 
    2734                 { 
     2363                } else { 
    27352364                        return null; 
    27362365                } 
     
    27392368        function get_language() 
    27402369        { 
    2741                 if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) 
    2742                 { 
     2370                if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) { 
    27432371                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2744                 } 
    2745                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) 
    2746                 { 
     2372                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) { 
    27472373                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2748                 } 
    2749                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) 
    2750                 { 
     2374                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) { 
    27512375                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2752                 } 
    2753                 elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'])) 
    2754                 { 
     2376                } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'])) { 
    27552377                        return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2756                 } 
    2757                 elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'])) 
    2758                 { 
     2378                } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'])) { 
    27592379                        return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2760                 } 
    2761                 elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'])) 
    2762                 { 
     2380                } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'])) { 
    27632381                        return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2764                 } 
    2765                 elseif (isset($this->data['headers']['content-language'])) 
    2766                 { 
     2382                } elseif (isset($this->data['headers']['content-language'])) { 
    27672383                        return $this->sanitize($this->data['headers']['content-language'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2768                 } 
    2769                 else 
    2770                 { 
     2384                } else { 
    27712385                        return null; 
    27722386                } 
     
    27752389        function get_latitude() 
    27762390        { 
    2777                 if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) 
    2778                 { 
     2391                if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) { 
    27792392                        return (float) $return[0]['data']; 
    2780                 } 
    2781                 elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) 
    2782                 { 
     2393                } elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) { 
    27832394                        return (float) $match[1]; 
    2784                 } 
    2785                 else 
    2786                 { 
     2395                } else { 
    27872396                        return null; 
    27882397                } 
     
    27912400        function get_longitude() 
    27922401        { 
    2793                 if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) 
    2794                 { 
     2402                if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) { 
    27952403                        return (float) $return[0]['data']; 
    2796                 } 
    2797                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) 
    2798                 { 
     2404                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) { 
    27992405                        return (float) $return[0]['data']; 
    2800                 } 
    2801                 elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) 
    2802                 { 
     2406                } elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) { 
    28032407                        return (float) $match[2]; 
    2804                 } 
    2805                 else 
    2806                 { 
     2408                } else { 
    28072409                        return null; 
    28082410                } 
     
    28112413        function get_image_title() 
    28122414        { 
    2813                 if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) 
    2814                 { 
     2415                if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) { 
    28152416                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2816                 } 
    2817                 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) 
    2818                 { 
     2417                } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) { 
    28192418                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2820                 } 
    2821                 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) 
    2822                 { 
     2419                } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) { 
    28232420                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2824                 } 
    2825                 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) 
    2826                 { 
     2421                } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) { 
    28272422                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2828                 } 
    2829                 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) 
    2830                 { 
     2423                } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) { 
    28312424                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    2832                 } 
    2833                 else 
    2834                 { 
     2425                } else { 
    28352426                        return null; 
    28362427                } 
     
    28392430        function get_image_url() 
    28402431        { 
    2841                 if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) 
    2842                 { 
     2432                if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) { 
    28432433                        return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI); 
    2844                 } 
    2845                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) 
    2846                 { 
     2434                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) { 
    28472435                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); 
    2848                 } 
    2849                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) 
    2850                 { 
     2436                } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) { 
    28512437                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); 
    2852                 } 
    2853                 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url')) 
    2854                 { 
     2438                } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url')) { 
    28552439                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); 
    2856                 } 
    2857                 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url')) 
    2858                 { 
     2440                } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url')) { 
    28592441                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); 
    2860                 } 
    2861                 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) 
    2862                 { 
     2442                } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) { 
    28632443                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); 
    2864                 } 
    2865                 else 
    2866                 { 
     2444                } else { 
    28672445                        return null; 
    28682446                } 
     
    28712449        function get_image_link() 
    28722450        { 
    2873                 if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) 
    2874                 { 
     2451                if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) { 
    28752452                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); 
    2876                 } 
    2877                 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) 
    2878                 { 
     2453                } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) { 
    28792454                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); 
    2880                 } 
    2881                 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) 
    2882                 { 
     2455                } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) { 
    28832456                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); 
    2884                 } 
    2885                 else 
    2886                 { 
     2457                } else { 
    28872458                        return null; 
    28882459                } 
     
    28912462        function get_image_width() 
    28922463        { 
    2893                 if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width')) 
    2894                 { 
     2464                if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width')) { 
    28952465                        return round($return[0]['data']); 
    2896                 } 
    2897                 elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) 
    2898                 { 
     2466                } elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) { 
    28992467                        return 88.0; 
    2900                 } 
    2901                 else 
    2902                 { 
     2468                } else { 
    29032469                        return null; 
    29042470                } 
     
    29072473        function get_image_height() 
    29082474        { 
    2909                 if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height')) 
    2910                 { 
     2475                if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height')) { 
    29112476                        return round($return[0]['data']); 
    2912                 } 
    2913                 elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) 
    2914                 { 
     2477                } elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) { 
    29152478                        return 31.0; 
    2916                 } 
    2917                 else 
    2918                 { 
     2479                } else { 
    29192480                        return null; 
    29202481                } 
     
    29252486                $max = (int) $max; 
    29262487                $qty = count($this->get_items()); 
    2927                 if ($max === 0) 
    2928                 { 
     2488                if ($max === 0) { 
    29292489                        return $qty; 
    2930                 } 
    2931                 else 
    2932                 { 
     2490                } else { 
    29332491                        return ($qty > $max) ? $max : $qty; 
    29342492                } 
     
    29382496        { 
    29392497                $items = $this->get_items(); 
    2940                 if (isset($items[$key])) 
    2941                 { 
     2498                if (isset($items[$key])) { 
    29422499                        return $items[$key]; 
    2943                 } 
    2944                 else 
    2945                 { 
     2500                } else { 
    29462501                        return null; 
    29472502                } 
     
    29502505        function get_items($start = 0, $end = 0) 
    29512506        { 
    2952                 if (!isset($this->data['items'])) 
    2953                 { 
    2954                         if (!empty($this->multifeed_objects)) 
    2955                         { 
     2507                if (!isset($this->data['items'])) { 
     2508                        if (!empty($this->multifeed_objects)) { 
    29562509                                $this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit); 
    2957                         } 
    2958                         else 
    2959                         { 
     2510                        } else { 
    29602511                                $this->data['items'] = array(); 
    2961                                 if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry')) 
    2962                                 { 
     2512                                if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry')) { 
    29632513                                        $keys = array_keys($items); 
    2964                                         foreach ($keys as $key) 
    2965                                         { 
     2514                                        foreach ($keys as $key) { 
    29662515                                                $this->data['items'][] = new $this->item_class($this, $items[$key]); 
    29672516                                        } 
    29682517                                } 
    2969                                 if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry')) 
    2970                                 { 
     2518                                if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry')) { 
    29712519                                        $keys = array_keys($items); 
    2972                                         foreach ($keys as $key) 
    2973                                         { 
     2520                                        foreach ($keys as $key) { 
    29742521                                                $this->data['items'][] = new $this->item_class($this, $items[$key]); 
    29752522                                        } 
    29762523                                } 
    2977                                 if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item')) 
    2978                                 { 
     2524                                if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item')) { 
    29792525                                        $keys = array_keys($items); 
    2980                                         foreach ($keys as $key) 
    2981                                         { 
     2526                                        foreach ($keys as $key) { 
    29822527                                                $this->data['items'][] = new $this->item_class($this, $items[$key]); 
    29832528                                        } 
    29842529                                } 
    2985                                 if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item')) 
    2986                                 { 
     2530                                if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item')) { 
    29872531                                        $keys = array_keys($items); 
    2988                                         foreach ($keys as $key) 
    2989                                         { 
     2532                                        foreach ($keys as $key) { 
    29902533                                                $this->data['items'][] = new $this->item_class($this, $items[$key]); 
    29912534                                        } 
    29922535                                } 
    2993                                 if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item')) 
    2994                                 { 
     2536                                if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item')) { 
    29952537                                        $keys = array_keys($items); 
    2996                                         foreach ($keys as $key) 
    2997                                         { 
     2538                                        foreach ($keys as $key) { 
    29982539                                                $this->data['items'][] = new $this->item_class($this, $items[$key]); 
    29992540                                        } 
     
    30022543                } 
    30032544 
    3004                 if (!empty($this->data['items'])) 
    3005                 { 
     2545                if (!empty($this->data['items'])) { 
    30062546                        // If we want to order it by date, check if all items have a date, and then sort it 
    3007                         if ($this->order_by_date && empty($this->multifeed_objects)) 
    3008                         { 
    3009                                 if (!isset($this->data['ordered_items'])) 
    3010                                 { 
     2547                        if ($this->order_by_date && empty($this->multifeed_objects)) { 
     2548                                if (!isset($this->data['ordered_items'])) { 
    30112549                                        $do_sort = true; 
    3012                                         foreach ($this->data['items'] as $item) 
    3013                                         { 
    3014                                                 if (!$item->get_date('U')) 
    3015                                                 { 
     2550                                        foreach ($this->data['items'] as $item) { 
     2551                                                if (!$item->get_date('U')) { 
    30162552                                                        $do_sort = false; 
    30172553                                                        break; 
     
    30202556                                        $item = null; 
    30212557                                        $this->data['ordered_items'] = $this->data['items']; 
    3022                                         if ($do_sort) 
    3023                                         { 
     2558                                        if ($do_sort) { 
    30242559                                                usort($this->data['ordered_items'], array(&$this, 'sort_items')); 
    30252560                                        } 
    30262561                                } 
    30272562                                $items = $this->data['ordered_items']; 
    3028                         } 
    3029                         else 
    3030                         { 
     2563                        } else { 
    30312564                                $items = $this->data['items']; 
    30322565                        } 
    30332566 
    30342567                        // Slice the data as desired 
    3035                         if ($end === 0) 
    3036                         { 
     2568                        if ($end === 0) { 
    30372569                                return array_slice($items, $start); 
    3038                         } 
    3039                         else 
    3040                         { 
     2570                        } else { 
    30412571                                return array_slice($items, $start, $end); 
    30422572                        } 
    3043                 } 
    3044                 else 
    3045                 { 
     2573                } else { 
    30462574                        return array(); 
    30472575                } 
     
    30612589        function merge_items($urls, $start = 0, $end = 0, $limit = 0) 
    30622590        { 
    3063                 if (is_array($urls) && sizeof($urls) > 0) 
    3064                 { 
     2591                if (is_array($urls) && sizeof($urls) > 0) { 
    30652592                        $items = array(); 
    3066                         foreach ($urls as $arg) 
    3067                         { 
    3068                                 if (is_a($arg, 'SimplePie')) 
    3069                                 { 
     2593                        foreach ($urls as $arg) { 
     2594                                if (is_a($arg, 'SimplePie')) { 
    30702595                                        $items = array_merge($items, $arg->get_items(0, $limit)); 
    3071                                 } 
    3072                                 else 
    3073                                 { 
     2596                                } else { 
    30742597                                        trigger_error('Arguments must be SimplePie objects', E_USER_WARNING); 
    30752598                                } 
     
    30772600 
    30782601                        $do_sort = true; 
    3079                         foreach ($items as $item) 
    3080                         { 
    3081                                 if (!$item->get_date('U')) 
    3082                                 { 
     2602                        foreach ($items as $item) { 
     2603                                if (!$item->get_date('U')) { 
    30832604                                        $do_sort = false; 
    30842605                                        break; 
     
    30862607                        } 
    30872608                        $item = null; 
    3088                         if ($do_sort) 
    3089                         { 
     2609                        if ($do_sort) { 
    30902610                                usort($items, array('SimplePie', 'sort_items')); 
    30912611                        } 
    30922612 
    3093                         if ($end === 0) 
    3094                         { 
     2613                        if ($end === 0) { 
    30952614                                return array_slice($items, $start); 
    3096                         } 
    3097                         else 
    3098                         { 
     2615                        } else { 
    30992616                                return array_slice($items, $start, $end); 
    31002617                        } 
    3101                 } 
    3102                 else 
    3103                 { 
     2618                } else { 
    31042619                        trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING); 
    31052620                        return array(); 
    31062621                } 
    31072622        } 
     2623 
    31082624} 
    31092625 
    31102626class SimplePie_Item 
    31112627{ 
     2628 
    31122629        var $feed; 
    31132630        var $data = array(); 
     
    31292646        function __destruct() 
    31302647        { 
    3131                 if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) 
    3132                 { 
     2648                if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) { 
    31332649                        unset($this->feed); 
    31342650                } 
     
    31372653        function get_item_tags($namespace, $tag) 
    31382654        { 
    3139                 if (isset($this->data['child'][$namespace][$tag])) 
    3140                 { 
     2655                if (isset($this->data['child'][$namespace][$tag])) { 
    31412656                        return $this->data['child'][$namespace][$tag]; 
    3142                 } 
    3143                 else 
    3144                 { 
     2657                } else { 
    31452658                        return null; 
    31462659                } 
     
    31642677        function get_id($hash = false) 
    31652678        { 
    3166                 if (!$hash) 
    3167                 { 
    3168                         if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id')) 
    3169                         { 
     2679                if (!$hash) { 
     2680                        if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id')) { 
    31702681                                return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3171                         } 
    3172                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id')) 
    3173                         { 
     2682                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id')) { 
    31742683                                return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3175                         } 
    3176                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) 
    3177                         { 
     2684                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) { 
    31782685                                return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3179                         } 
    3180                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier')) 
    3181                         { 
     2686                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier')) { 
    31822687                                return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3183                         } 
    3184                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier')) 
    3185                         { 
     2688                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier')) { 
    31862689                                return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3187                         } 
    3188                         elseif (($return = $this->get_permalink()) !== null) 
    3189                         { 
     2690                        } elseif (($return = $this->get_permalink()) !== null) { 
    31902691                                return $return; 
    3191                         } 
    3192                         elseif (($return = $this->get_title()) !== null) 
    3193                         { 
     2692                        } elseif (($return = $this->get_title()) !== null) { 
    31942693                                return $return; 
    31952694                        } 
    31962695                } 
    3197                 if ($this->get_permalink() !== null || $this->get_title() !== null) 
    3198                 { 
    3199                         return md5($this->get_permalink() . $this->get_title()); 
    3200                 } 
    3201                 else 
    3202                 { 
     2696                if ($this->get_permalink() !== null || $this->get_title() !== null) { 
     2697                        return md5($this->get_permalink().$this->get_title()); 
     2698                } else { 
    32032699                        return md5(serialize($this->data)); 
    32042700                } 
     
    32072703        function get_title() 
    32082704        { 
    3209                 if (!isset($this->data['title'])) 
    3210                 { 
    3211                         if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) 
    3212                         { 
     2705                if (!isset($this->data['title'])) { 
     2706                        if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) { 
    32132707                                $this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    3214                         } 
    3215                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) 
    3216                         { 
     2708                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) { 
    32172709                                $this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    3218                         } 
    3219                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) 
    3220                         { 
     2710                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) { 
    32212711                                $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    3222                         } 
    3223                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) 
    3224                         { 
     2712                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) { 
    32252713                                $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    3226                         } 
    3227                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) 
    3228                         { 
     2714                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) { 
    32292715                                $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    3230                         } 
    3231                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) 
    3232                         { 
     2716                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) { 
    32332717                                $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3234                         } 
    3235                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) 
    3236                         { 
     2718                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) { 
    32372719                                $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3238                         } 
    3239                         else 
    3240                         { 
     2720                        } else { 
    32412721                                $this->data['title'] = null; 
    32422722                        } 
     
    32472727        function get_description($description_only = false) 
    32482728        { 
    3249                 if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary')) 
    3250                 { 
     2729                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary')) { 
    32512730                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    3252                 } 
    3253                 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) 
    3254                 { 
     2731                } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) { 
    32552732                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    3256                 } 
    3257                 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) 
    3258                 { 
     2733                } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) { 
    32592734                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    3260                 } 
    3261                 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) 
    3262                 { 
     2735                } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) { 
    32632736                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); 
    3264                 } 
    3265                 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) 
    3266                 { 
     2737                } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) { 
    32672738                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3268                 } 
    3269                 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) 
    3270                 { 
     2739                } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) { 
    32712740                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3272                 } 
    3273                 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) 
    3274                 { 
     2741                } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) { 
    32752742                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); 
    3276                 } 
    3277                 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) 
    3278                 { 
     2743                } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) { 
    32792744                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3280                 } 
    3281                 elseif (!$description_only) 
    3282                 { 
     2745                } elseif (!$description_only) { 
    32832746                        return $this->get_content(true); 
    3284                 } 
    3285                 else 
    3286                 { 
     2747                } else { 
    32872748                        return null; 
    32882749                } 
     
    32912752        function get_content($content_only = false) 
    32922753        { 
    3293                 if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) 
    3294                 { 
     2754                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) { 
    32952755                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_content_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    3296                 } 
    3297                 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) 
    3298                 { 
     2756                } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) { 
    32992757                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    3300                 } 
    3301                 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) 
    3302                 { 
     2758                } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) { 
    33032759                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); 
    3304                 } 
    3305                 elseif (!$content_only) 
    3306                 { 
     2760                } elseif (!$content_only) { 
    33072761                        return $this->get_description(true); 
    3308                 } 
    3309                 else 
    3310                 { 
     2762                } else { 
    33112763                        return null; 
    33122764                } 
     
    33162768        { 
    33172769                $categories = $this->get_categories(); 
    3318                 if (isset($categories[$key])) 
    3319                 { 
     2770                if (isset($categories[$key])) { 
    33202771                        return $categories[$key]; 
    3321                 } 
    3322                 else 
    3323                 { 
     2772                } else { 
    33242773                        return null; 
    33252774                } 
     
    33302779                $categories = array(); 
    33312780 
    3332                 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) 
    3333                 { 
     2781                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) { 
    33342782                        $term = null; 
    33352783                        $scheme = null; 
    33362784                        $label = null; 
    3337                         if (isset($category['attribs']['']['term'])) 
    3338                         { 
     2785                        if (isset($category['attribs']['']['term'])) { 
    33392786                                $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); 
    33402787                        } 
    3341                         if (isset($category['attribs']['']['scheme'])) 
    3342                         { 
     2788                        if (isset($category['attribs']['']['scheme'])) { 
    33432789                                $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    33442790                        } 
    3345                         if (isset($category['attribs']['']['label'])) 
    3346                         { 
     2791                        if (isset($category['attribs']['']['label'])) { 
    33472792                                $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); 
    33482793                        } 
    33492794                        $categories[] = new $this->feed->category_class($term, $scheme, $label); 
    33502795                } 
    3351                 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) 
    3352                 { 
     2796                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) { 
    33532797                        // This is really the label, but keep this as the term also for BC. 
    33542798                        // Label will also work on retrieving because that falls back to term. 
    33552799                        $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3356                         if (isset($category['attribs']['']['domain'])) 
    3357                         { 
     2800                        if (isset($category['attribs']['']['domain'])) { 
    33582801                                $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3359                         } 
    3360                         else 
    3361                         { 
     2802                        } else { 
    33622803                                $scheme = null; 
    33632804                        } 
    33642805                        $categories[] = new $this->feed->category_class($term, $scheme, null); 
    33652806                } 
    3366                 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) 
    3367                 { 
     2807                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) { 
    33682808                        $categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    33692809                } 
    3370                 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) 
    3371                 { 
     2810                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) { 
    33722811                        $categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    33732812                } 
    33742813 
    3375                 if (!empty($categories)) 
    3376                 { 
     2814                if (!empty($categories)) { 
    33772815                        return SimplePie_Misc::array_unique($categories); 
    3378                 } 
    3379                 else 
    3380                 { 
     2816                } else { 
    33812817                        return null; 
    33822818                } 
     
    33862822        { 
    33872823                $authors = $this->get_authors(); 
    3388                 if (isset($authors[$key])) 
    3389                 { 
     2824                if (isset($authors[$key])) { 
    33902825                        return $authors[$key]; 
    3391                 } 
    3392                 else 
    3393                 { 
     2826                } else { 
    33942827                        return null; 
    33952828                } 
     
    33992832        { 
    34002833                $contributors = $this->get_contributors(); 
    3401                 if (isset($contributors[$key])) 
    3402                 { 
     2834                if (isset($contributors[$key])) { 
    34032835                        return $contributors[$key]; 
    3404                 } 
    3405                 else 
    3406                 { 
     2836                } else { 
    34072837                        return null; 
    34082838                } 
     
    34122842        { 
    34132843                $contributors = array(); 
    3414                 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) 
    3415                 { 
     2844                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) { 
    34162845                        $name = null; 
    34172846                        $uri = null; 
    34182847                        $email = null; 
    3419                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) 
    3420                         { 
     2848                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { 
    34212849                                $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    34222850                        } 
    3423                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) 
    3424                         { 
     2851                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { 
    34252852                                $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])); 
    34262853                        } 
    3427                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) 
    3428                         { 
     2854                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { 
    34292855                                $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    34302856                        } 
    3431                         if ($name !== null || $email !== null || $uri !== null) 
    3432                         { 
     2857                        if ($name !== null || $email !== null || $uri !== null) { 
    34332858                                $contributors[] = new $this->feed->author_class($name, $uri, $email); 
    34342859                        } 
    34352860                } 
    3436                 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) 
    3437                 { 
     2861                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) { 
    34382862                        $name = null; 
    34392863                        $url = null; 
    34402864                        $email = null; 
    3441                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) 
    3442                         { 
     2865                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { 
    34432866                                $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    34442867                        } 
    3445                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) 
    3446                         { 
     2868                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { 
    34472869                                $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])); 
    34482870                        } 
    3449                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) 
    3450                         { 
     2871                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { 
    34512872                                $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    34522873                        } 
    3453                         if ($name !== null || $email !== null || $url !== null) 
    3454                         { 
     2874                        if ($name !== null || $email !== null || $url !== null) { 
    34552875                                $contributors[] = new $this->feed->author_class($name, $url, $email); 
    34562876                        } 
    34572877                } 
    34582878 
    3459                 if (!empty($contributors)) 
    3460                 { 
     2879                if (!empty($contributors)) { 
    34612880                        return SimplePie_Misc::array_unique($contributors); 
    3462                 } 
    3463                 else 
    3464                 { 
     2881                } else { 
    34652882                        return null; 
    34662883                } 
     
    34702887        { 
    34712888                $authors = array(); 
    3472                 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) 
    3473                 { 
     2889                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) { 
    34742890                        $name = null; 
    34752891                        $uri = null; 
    34762892                        $email = null; 
    3477                         if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) 
    3478                         { 
     2893                        if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { 
    34792894                                $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    34802895                        } 
    3481                         if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) 
    3482                         { 
     2896                        if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { 
    34832897                                $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])); 
    34842898                        } 
    3485                         if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) 
    3486                         { 
     2899                        if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { 
    34872900                                $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    34882901                        } 
    3489                         if ($name !== null || $email !== null || $uri !== null) 
    3490                         { 
     2902                        if ($name !== null || $email !== null || $uri !== null) { 
    34912903                                $authors[] = new $this->feed->author_class($name, $uri, $email); 
    34922904                        } 
    34932905                } 
    3494                 if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) 
    3495                 { 
     2906                if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) { 
    34962907                        $name = null; 
    34972908                        $url = null; 
    34982909                        $email = null; 
    3499                         if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) 
    3500                         { 
     2910                        if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { 
    35012911                                $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    35022912                        } 
    3503                         if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) 
    3504                         { 
     2913                        if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { 
    35052914                                $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])); 
    35062915                        } 
    3507                         if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) 
    3508                         { 
     2916                        if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { 
    35092917                                $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    35102918                        } 
    3511                         if ($name !== null || $email !== null || $url !== null) 
    3512                         { 
     2919                        if ($name !== null || $email !== null || $url !== null) { 
    35132920                                $authors[] = new $this->feed->author_class($name, $url, $email); 
    35142921                        } 
    35152922                } 
    3516                 if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author')) 
    3517                 { 
     2923                if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author')) { 
    35182924                        $authors[] = new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); 
    35192925                } 
    3520                 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) 
    3521                 { 
     2926                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) { 
    35222927                        $authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    35232928                } 
    3524                 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) 
    3525                 { 
     2929                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) { 
    35262930                        $authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    35272931                } 
    3528                 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) 
    3529                 { 
     2932                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) { 
    35302933                        $authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    35312934                } 
    35322935 
    3533                 if (!empty($authors)) 
    3534                 { 
     2936                if (!empty($authors)) { 
    35352937                        return SimplePie_Misc::array_unique($authors); 
    3536                 } 
    3537                 elseif (($source = $this->get_source()) && ($authors = $source->get_authors())) 
    3538                 { 
     2938                } elseif (($source = $this->get_source()) && ($authors = $source->get_authors())) { 
    35392939                        return $authors; 
    3540                 } 
    3541                 elseif ($authors = $this->feed->get_authors()) 
    3542                 { 
     2940                } elseif ($authors = $this->feed->get_authors()) { 
    35432941                        return $authors; 
    3544                 } 
    3545                 else 
    3546                 { 
     2942                } else { 
    35472943                        return null; 
    35482944                } 
     
    35512947        function get_copyright() 
    35522948        { 
    3553                 if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) 
    3554                 { 
     2949                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) { 
    35552950                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    3556                 } 
    3557                 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) 
    3558                 { 
     2951                } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) { 
    35592952                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3560                 } 
    3561                 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) 
    3562                 { 
     2953                } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) { 
    35632954                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3564                 } 
    3565                 else 
    3566                 { 
     2955                } else { 
    35672956                        return null; 
    35682957                } 
     
    35712960        function get_date($date_format = 'j F Y, g:i a') 
    35722961        { 
    3573                 if (!isset($this->data['date'])) 
    3574                 { 
    3575                         if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published')) 
    3576                         { 
     2962                if (!isset($this->data['date'])) { 
     2963                        if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published')) { 
    35772964                                $this->data['date']['raw'] = $return[0]['data']; 
    3578                         } 
    3579                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated')) 
    3580                         { 
     2965                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated')) { 
    35812966                                $this->data['date']['raw'] = $return[0]['data']; 
    3582                         } 
    3583                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued')) 
    3584                         { 
     2967                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued')) { 
    35852968                                $this->data['date']['raw'] = $return[0]['data']; 
    3586                         } 
    3587                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created')) 
    3588                         { 
     2969                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created')) { 
    35892970                                $this->data['date']['raw'] = $return[0]['data']; 
    3590                         } 
    3591                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified')) 
    3592                         { 
     2971                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified')) { 
    35932972                                $this->data['date']['raw'] = $return[0]['data']; 
    3594                         } 
    3595                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate')) 
    3596                         { 
     2973                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate')) { 
    35972974                                $this->data['date']['raw'] = $return[0]['data']; 
    3598                         } 
    3599                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date')) 
    3600                         { 
     2975                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date')) { 
    36012976                                $this->data['date']['raw'] = $return[0]['data']; 
    3602                         } 
    3603                         elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date')) 
    3604                         { 
     2977                        } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date')) { 
    36052978                                $this->data['date']['raw'] = $return[0]['data']; 
    36062979                        } 
    36072980 
    3608                         if (!empty($this->data['date']['raw'])) 
    3609                         { 
     2981                        if (!empty($this->data['date']['raw'])) { 
    36102982                                $parser = SimplePie_Parse_Date::get(); 
    36112983                                $this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']); 
    3612                         } 
    3613                         else 
    3614                         { 
     2984                        } else { 
    36152985                                $this->data['date'] = null; 
    36162986                        } 
    36172987                } 
    3618                 if ($this->data['date']) 
    3619                 { 
     2988                if ($this->data['date']) { 
    36202989                        $date_format = (string) $date_format; 
    3621                         switch ($date_format) 
    3622                         { 
     2990                        switch ($date_format) { 
    36232991                                case '': 
    36242992                                        return $this->sanitize($this->data['date']['raw'], SIMPLEPIE_CONSTRUCT_TEXT); 
     
    36302998                                        return date($date_format, $this->data['date']['parsed']); 
    36312999                        } 
    3632                 } 
    3633                 else 
    3634                 { 
     3000                } else { 
    36353001                        return null; 
    36363002                } 
     
    36393005        function get_local_date($date_format = '%c') 
    36403006        { 
    3641                 if (!$date_format) 
    3642                 { 
     3007                if (!$date_format) { 
    36433008                        return $this->sanitize($this->get_date(''), SIMPLEPIE_CONSTRUCT_TEXT); 
    3644                 } 
    3645                 elseif (($date = $this->get_date('U')) !== null) 
    3646                 { 
     3009                } elseif (($date = $this->get_date('U')) !== null) { 
    36473010                        return strftime($date_format, $date); 
    3648                 } 
    3649                 else 
    3650                 { 
     3011                } else { 
    36513012                        return null; 
    36523013                } 
     
    36573018                $link = $this->get_link(); 
    36583019                $enclosure = $this->get_enclosure(0); 
    3659                 if ($link !== null) 
    3660                 { 
     3020                if ($link !== null) { 
    36613021                        return $link; 
    3662                 } 
    3663                 elseif ($enclosure !== null) 
    3664                 { 
     3022                } elseif ($enclosure !== null) { 
    36653023                        return $enclosure->get_link(); 
    3666                 } 
    3667                 else 
    3668                 { 
     3024                } else { 
    36693025                        return null; 
    36703026                } 
     
    36743030        { 
    36753031                $links = $this->get_links($rel); 
    3676                 if ($links[$key] !== null) 
    3677                 { 
     3032                if ($links[$key] !== null) { 
    36783033                        return $links[$key]; 
    3679                 } 
    3680                 else 
    3681                 { 
     3034                } else { 
    36823035                        return null; 
    36833036                } 
     
    36863039        function get_links($rel = 'alternate') 
    36873040        { 
    3688                 if (!isset($this->data['links'])) 
    3689                 { 
     3041                if (!isset($this->data['links'])) { 
    36903042                        $this->data['links'] = array(); 
    3691                         foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link) 
    3692                         { 
    3693                                 if (isset($link['attribs']['']['href'])) 
    3694                                 { 
     3043                        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link) { 
     3044                                if (isset($link['attribs']['']['href'])) { 
    36953045                                        $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; 
    36963046                                        $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); 
    3697  
    3698                                 } 
    3699                         } 
    3700                         foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link) 
    3701                         { 
    3702                                 if (isset($link['attribs']['']['href'])) 
    3703                                 { 
     3047                                } 
     3048                        } 
     3049                        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link) { 
     3050                                if (isset($link['attribs']['']['href'])) { 
    37043051                                        $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; 
    37053052                                        $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); 
    37063053                                } 
    37073054                        } 
    3708                         if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) 
    3709                         { 
     3055                        if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) { 
    37103056                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); 
    37113057                        } 
    3712                         if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) 
    3713                         { 
     3058                        if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) { 
    37143059                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); 
    37153060                        } 
    3716                         if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) 
    3717                         { 
     3061                        if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) { 
    37183062                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); 
    37193063                        } 
    3720                         if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) 
    3721                         { 
    3722                                 if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true') 
    3723                                 { 
     3064                        if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) { 
     3065                                if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true') { 
    37243066                                        $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); 
    37253067                                } 
     
    37273069 
    37283070                        $keys = array_keys($this->data['links']); 
    3729                         foreach ($keys as $key) 
    3730                         { 
    3731                                 if (SimplePie_Misc::is_isegment_nz_nc($key)) 
    3732                                 { 
    3733                                         if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) 
    3734                                         { 
    3735                                                 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); 
    3736                                                 $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; 
     3071                        foreach ($keys as $key) { 
     3072                                if (SimplePie_Misc::is_isegment_nz_nc($key)) { 
     3073                                        if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key])) { 
     3074                                                $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]); 
     3075                                                $this->data['links'][$key] = & $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]; 
     3076                                        } else { 
     3077                                                $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = & $this->data['links'][$key]; 
    37373078                                        } 
    3738                                         else 
    3739                                         { 
    3740                                                 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; 
    3741                                         } 
    3742                                 } 
    3743                                 elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) 
    3744                                 { 
    3745                                         $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; 
     3079                                } elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) { 
     3080                                        $this->data['links'][substr($key, 41)] = & $this->data['links'][$key]; 
    37463081                                } 
    37473082                                $this->data['links'][$key] = array_unique($this->data['links'][$key]); 
    37483083                        } 
    37493084                } 
    3750                 if (isset($this->data['links'][$rel])) 
    3751                 { 
     3085                if (isset($this->data['links'][$rel])) { 
    37523086                        return $this->data['links'][$rel]; 
    3753                 } 
    3754                 else 
    3755                 { 
     3087                } else { 
    37563088                        return null; 
    37573089                } 
     
    37643096        { 
    37653097                $enclosures = $this->get_enclosures(); 
    3766                 if (isset($enclosures[$key])) 
    3767                 { 
     3098                if (isset($enclosures[$key])) { 
    37683099                        return $enclosures[$key]; 
    3769                 } 
    3770                 else 
    3771                 { 
     3100                } else { 
    37723101                        return null; 
    37733102                } 
     
    37863115        function get_enclosures() 
    37873116        { 
    3788                 if (!isset($this->data['enclosures'])) 
    3789                 { 
     3117                if (!isset($this->data['enclosures'])) { 
    37903118                        $this->data['enclosures'] = array(); 
    37913119 
     
    38093137 
    38103138                        // CAPTIONS 
    3811                         if ($captions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) 
    3812                         { 
    3813                                 foreach ($captions as $caption) 
    3814                                 { 
     3139                        if ($captions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) { 
     3140                                foreach ($captions as $caption) { 
    38153141                                        $caption_type = null; 
    38163142                                        $caption_lang = null; 
     
    38183144                                        $caption_endTime = null; 
    38193145                                        $caption_text = null; 
    3820                                         if (isset($caption['attribs']['']['type'])) 
    3821                                         { 
     3146                                        if (isset($caption['attribs']['']['type'])) { 
    38223147                                                $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    38233148                                        } 
    3824                                         if (isset($caption['attribs']['']['lang'])) 
    3825                                         { 
     3149                                        if (isset($caption['attribs']['']['lang'])) { 
    38263150                                                $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); 
    38273151                                        } 
    3828                                         if (isset($caption['attribs']['']['start'])) 
    3829                                         { 
     3152                                        if (isset($caption['attribs']['']['start'])) { 
    38303153                                                $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); 
    38313154                                        } 
    3832                                         if (isset($caption['attribs']['']['end'])) 
    3833                                         { 
     3155                                        if (isset($caption['attribs']['']['end'])) { 
    38343156                                                $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); 
    38353157                                        } 
    3836                                         if (isset($caption['data'])) 
    3837                                         { 
     3158                                        if (isset($caption['data'])) { 
    38383159                                                $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    38393160                                        } 
    38403161                                        $captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); 
    38413162                                } 
    3842                         } 
    3843                         elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) 
    3844                         { 
    3845                                 foreach ($captions as $caption) 
    3846                                 { 
     3163                        } elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) { 
     3164                                foreach ($captions as $caption) { 
    38473165                                        $caption_type = null; 
    38483166                                        $caption_lang = null; 
     
    38503168                                        $caption_endTime = null; 
    38513169                                        $caption_text = null; 
    3852                                         if (isset($caption['attribs']['']['type'])) 
    3853                                         { 
     3170                                        if (isset($caption['attribs']['']['type'])) { 
    38543171                                                $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    38553172                                        } 
    3856                                         if (isset($caption['attribs']['']['lang'])) 
    3857                                         { 
     3173                                        if (isset($caption['attribs']['']['lang'])) { 
    38583174                                                $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); 
    38593175                                        } 
    3860                                         if (isset($caption['attribs']['']['start'])) 
    3861                                         { 
     3176                                        if (isset($caption['attribs']['']['start'])) { 
    38623177                                                $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); 
    38633178                                        } 
    3864                                         if (isset($caption['attribs']['']['end'])) 
    3865                                         { 
     3179                                        if (isset($caption['attribs']['']['end'])) { 
    38663180                                                $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); 
    38673181                                        } 
    3868                                         if (isset($caption['data'])) 
    3869                                         { 
     3182                                        if (isset($caption['data'])) { 
    38703183                                                $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    38713184                                        } 
     
    38733186                                } 
    38743187                        } 
    3875                         if (is_array($captions_parent)) 
    3876                         { 
     3188                        if (is_array($captions_parent)) { 
    38773189                                $captions_parent = array_values(SimplePie_Misc::array_unique($captions_parent)); 
    38783190                        } 
    38793191 
    38803192                        // CATEGORIES 
    3881                         foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category) 
    3882                         { 
     3193                        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category) { 
    38833194                                $term = null; 
    38843195                                $scheme = null; 
    38853196                                $label = null; 
    3886                                 if (isset($category['data'])) 
    3887                                 { 
     3197                                if (isset($category['data'])) { 
    38883198                                        $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    38893199                                } 
    3890                                 if (isset($category['attribs']['']['scheme'])) 
    3891                                 { 
     3200                                if (isset($category['attribs']['']['scheme'])) { 
    38923201                                        $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3893                                 } 
    3894                                 else 
    3895                                 { 
     3202                                } else { 
    38963203                                        $scheme = 'http://search.yahoo.com/mrss/category_schema'; 
    38973204                                } 
    3898                                 if (isset($category['attribs']['']['label'])) 
    3899                                 { 
     3205                                if (isset($category['attribs']['']['label'])) { 
    39003206                                        $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); 
    39013207                                } 
    39023208                                $categories_parent[] = new $this->feed->category_class($term, $scheme, $label); 
    39033209                        } 
    3904                         foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category) 
    3905                         { 
     3210                        foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category) { 
    39063211                                $term = null; 
    39073212                                $scheme = null; 
    39083213                                $label = null; 
    3909                                 if (isset($category['data'])) 
    3910                                 { 
     3214                                if (isset($category['data'])) { 
    39113215                                        $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    39123216                                } 
    3913                                 if (isset($category['attribs']['']['scheme'])) 
    3914                                 { 
     3217                                if (isset($category['attribs']['']['scheme'])) { 
    39153218                                        $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    3916                                 } 
    3917                                 else 
    3918                                 { 
     3219                                } else { 
    39193220                                        $scheme = 'http://search.yahoo.com/mrss/category_schema'; 
    39203221                                } 
    3921                                 if (isset($category['attribs']['']['label'])) 
    3922                                 { 
     3222                                if (isset($category['attribs']['']['label'])) { 
    39233223                                        $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); 
    39243224                                } 
    39253225                                $categories_parent[] = new $this->feed->category_class($term, $scheme, $label); 
    39263226                        } 
    3927                         foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'category') as $category) 
    3928                         { 
     3227                        foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'category') as $category) { 
    39293228                                $term = null; 
    39303229                                $scheme = 'http://www.itunes.com/dtds/podcast-1.0.dtd'; 
    39313230                                $label = null; 
    3932                                 if (isset($category['attribs']['']['text'])) 
    3933                                 { 
     3231                                if (isset($category['attribs']['']['text'])) { 
    39343232                                        $label = $this->sanitize($category['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT); 
    39353233                                } 
    39363234                                $categories_parent[] = new $this->feed->category_class($term, $scheme, $label); 
    39373235 
    3938                                 if (isset($category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'])) 
    3939                                 { 
    3940                                         foreach ((array) $category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'] as $subcategory) 
    3941                                         { 
    3942                                                 if (isset($subcategory['attribs']['']['text'])) 
    3943                                                 { 
     3236                                if (isset($category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'])) { 
     3237                                        foreach ((array) $category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'] as $subcategory) { 
     3238                                                if (isset($subcategory['attribs']['']['text'])) { 
    39443239                                                        $label = $this->sanitize($subcategory['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT); 
    39453240                                                } 
     
    39483243                                } 
    39493244                        } 
    3950                         if (is_array($categories_parent)) 
    3951                         { 
     3245                        if (is_array($categories_parent)) { 
    39523246                                $categories_parent = array_values(SimplePie_Misc::array_unique($categories_parent)); 
    39533247                        } 
    39543248 
    39553249                        // COPYRIGHT 
    3956                         if ($copyright = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright')) 
    3957                         { 
     3250                        if ($copyright = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright')) { 
    39583251                                $copyright_url = null; 
    39593252                                $copyright_label = null; 
    3960                                 if (isset($copyright[0]['attribs']['']['url'])) 
    3961                                 { 
     3253                                if (isset($copyright[0]['attribs']['']['url'])) { 
    39623254                                        $copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); 
    39633255                                } 
    3964                                 if (isset($copyright[0]['data'])) 
    3965                                 { 
     3256                                if (isset($copyright[0]['data'])) { 
    39663257                                        $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    39673258                                } 
    39683259                                $copyrights_parent = new $this->feed->copyright_class($copyright_url, $copyright_label); 
    3969                         } 
    3970                         elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright')) 
    3971                         { 
     3260                        } elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright')) { 
    39723261                                $copyright_url = null; 
    39733262                                $copyright_label = null; 
    3974                                 if (isset($copyright[0]['attribs']['']['url'])) 
    3975                                 { 
     3263                                if (isset($copyright[0]['attribs']['']['url'])) { 
    39763264                                        $copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); 
    39773265                                } 
    3978                                 if (isset($copyright[0]['data'])) 
    3979                                 { 
     3266                                if (isset($copyright[0]['data'])) { 
    39803267                                        $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    39813268                                } 
     
    39843271 
    39853272                        // CREDITS 
    3986                         if ($credits = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit')) 
    3987                         { 
    3988                                 foreach ($credits as $credit) 
    3989                                 { 
     3273                        if ($credits = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit')) { 
     3274                                foreach ($credits as $credit) { 
    39903275                                        $credit_role = null; 
    39913276                                        $credit_scheme = null; 
    39923277                                        $credit_name = null; 
    3993                                         if (isset($credit['attribs']['']['role'])) 
    3994                                         { 
     3278                                        if (isset($credit['attribs']['']['role'])) { 
    39953279                                                $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); 
    39963280                                        } 
    3997                                         if (isset($credit['attribs']['']['scheme'])) 
    3998                                         { 
     3281                                        if (isset($credit['attribs']['']['scheme'])) { 
    39993282                                                $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4000                                         } 
    4001                                         else 
    4002                                         { 
     3283                                        } else { 
    40033284                                                $credit_scheme = 'urn:ebu'; 
    40043285                                        } 
    4005                                         if (isset($credit['data'])) 
    4006                                         { 
     3286                                        if (isset($credit['data'])) { 
    40073287                                                $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    40083288                                        } 
    40093289                                        $credits_parent[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); 
    40103290                                } 
    4011                         } 
    4012                         elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit')) 
    4013                         { 
    4014                                 foreach ($credits as $credit) 
    4015                                 { 
     3291                        } elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit')) { 
     3292                                foreach ($credits as $credit) { 
    40163293                                        $credit_role = null; 
    40173294                                        $credit_scheme = null; 
    40183295                                        $credit_name = null; 
    4019                                         if (isset($credit['attribs']['']['role'])) 
    4020                                         { 
     3296                                        if (isset($credit['attribs']['']['role'])) { 
    40213297                                                $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); 
    40223298                                        } 
    4023                                         if (isset($credit['attribs']['']['scheme'])) 
    4024                                         { 
     3299                                        if (isset($credit['attribs']['']['scheme'])) { 
    40253300                                                $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4026                                         } 
    4027                                         else 
    4028                                         { 
     3301                                        } else { 
    40293302                                                $credit_scheme = 'urn:ebu'; 
    40303303                                        } 
    4031                                         if (isset($credit['data'])) 
    4032                                         { 
     3304                                        if (isset($credit['data'])) { 
    40333305                                                $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    40343306                                        } 
     
    40363308                                } 
    40373309                        } 
    4038                         if (is_array($credits_parent)) 
    4039                         { 
     3310                        if (is_array($credits_parent)) { 
    40403311                                $credits_parent = array_values(SimplePie_Misc::array_unique($credits_parent)); 
    40413312                        } 
    40423313 
    40433314                        // DESCRIPTION 
    4044                         if ($description_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description')) 
    4045                         { 
    4046                                 if (isset($description_parent[0]['data'])) 
    4047                                 { 
     3315                        if ($description_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description')) { 
     3316                                if (isset($description_parent[0]['data'])) { 
    40483317                                        $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    40493318                                } 
    4050                         } 
    4051                         elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description')) 
    4052                         { 
    4053                                 if (isset($description_parent[0]['data'])) 
    4054                                 { 
     3319                        } elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description')) { 
     3320                                if (isset($description_parent[0]['data'])) { 
    40553321                                        $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    40563322                                } 
     
    40583324 
    40593325                        // DURATION 
    4060                         if ($duration_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'duration')) 
    4061                         { 
     3326                        if ($duration_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'duration')) { 
    40623327                                $seconds = null; 
    40633328                                $minutes = null; 
    40643329                                $hours = null; 
    4065                                 if (isset($duration_parent[0]['data'])) 
    4066                                 { 
     3330                                if (isset($duration_parent[0]['data'])) { 
    40673331                                        $temp = explode(':', $this->sanitize($duration_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); 
    4068                                         if (sizeof($temp) > 0) 
    4069                                         { 
     3332                                        if (sizeof($temp) > 0) { 
    40703333                                                (int) $seconds = array_pop($temp); 
    40713334                                        } 
    4072                                         if (sizeof($temp) > 0) 
    4073                                         { 
     3335                                        if (sizeof($temp) > 0) { 
    40743336                                                (int) $minutes = array_pop($temp); 
    40753337                                                $seconds += $minutes * 60; 
    40763338                                        } 
    4077                                         if (sizeof($temp) > 0) 
    4078                                         { 
     3339                                        if (sizeof($temp) > 0) { 
    40793340                                                (int) $hours = array_pop($temp); 
    40803341                                                $seconds += $hours * 3600; 
     
    40863347 
    40873348                        // HASHES 
    4088                         if ($hashes_iterator = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash')) 
    4089                         { 
    4090                                 foreach ($hashes_iterator as $hash) 
    4091                                 { 
     3349                        if ($hashes_iterator = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash')) { 
     3350                                foreach ($hashes_iterator as $hash) { 
    40923351                                        $value = null; 
    40933352                                        $algo = null; 
    4094                                         if (isset($hash['data'])) 
    4095                                         { 
     3353                                        if (isset($hash['data'])) { 
    40963354                                                $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    40973355                                        } 
    4098                                         if (isset($hash['attribs']['']['algo'])) 
    4099                                         { 
     3356                                        if (isset($hash['attribs']['']['algo'])) { 
    41003357                                                $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4101                                         } 
    4102                                         else 
    4103                                         { 
     3358                                        } else { 
    41043359                                                $algo = 'md5'; 
    41053360                                        } 
    41063361                                        $hashes_parent[] = $algo.':'.$value; 
    41073362                                } 
    4108                         } 
    4109                         elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash')) 
    4110                         { 
    4111                                 foreach ($hashes_iterator as $hash) 
    4112                                 { 
     3363                        } elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash')) { 
     3364                                foreach ($hashes_iterator as $hash) { 
    41133365                                        $value = null; 
    41143366                                        $algo = null; 
    4115                                         if (isset($hash['data'])) 
    4116                                         { 
     3367                                        if (isset($hash['data'])) { 
    41173368                                                $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    41183369                                        } 
    4119                                         if (isset($hash['attribs']['']['algo'])) 
    4120                                         { 
     3370                                        if (isset($hash['attribs']['']['algo'])) { 
    41213371                                                $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4122                                         } 
    4123                                         else 
    4124                                         { 
     3372                                        } else { 
    41253373                                                $algo = 'md5'; 
    41263374                                        } 
     
    41283376                                } 
    41293377                        } 
    4130                         if (is_array($hashes_parent)) 
    4131                         { 
     3378                        if (is_array($hashes_parent)) { 
    41323379                                $hashes_parent = array_values(SimplePie_Misc::array_unique($hashes_parent)); 
    41333380                        } 
    41343381 
    41353382                        // KEYWORDS 
    4136                         if ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords')) 
    4137                         { 
    4138                                 if (isset($keywords[0]['data'])) 
    4139                                 { 
     3383                        if ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords')) { 
     3384                                if (isset($keywords[0]['data'])) { 
    41403385                                        $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); 
    4141                                         foreach ($temp as $word) 
    4142                                         { 
     3386                                        foreach ($temp as $word) { 
    41433387                                                $keywords_parent[] = trim($word); 
    41443388                                        } 
    41453389                                } 
    41463390                                unset($temp); 
    4147                         } 
    4148                         elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords')) 
    4149                         { 
    4150                                 if (isset($keywords[0]['data'])) 
    4151                                 { 
     3391                        } elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords')) { 
     3392                                if (isset($keywords[0]['data'])) { 
    41523393                                        $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); 
    4153                                         foreach ($temp as $word) 
    4154                                         { 
     3394                                        foreach ($temp as $word) { 
    41553395                                                $keywords_parent[] = trim($word); 
    41563396                                        } 
    41573397                                } 
    41583398                                unset($temp); 
    4159                         } 
    4160                         elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords')) 
    4161                         { 
    4162                                 if (isset($keywords[0]['data'])) 
    4163                                 { 
     3399                        } elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords')) { 
     3400                                if (isset($keywords[0]['data'])) { 
    41643401                                        $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); 
    4165                                         foreach ($temp as $word) 
    4166                                         { 
     3402                                        foreach ($temp as $word) { 
    41673403                                                $keywords_parent[] = trim($word); 
    41683404                                        } 
    41693405                                } 
    41703406                                unset($temp); 
    4171                         } 
    4172                         elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords')) 
    4173                         { 
    4174                                 if (isset($keywords[0]['data'])) 
    4175                                 { 
     3407                        } elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords')) { 
     3408                                if (isset($keywords[0]['data'])) { 
    41763409                                        $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); 
    4177                                         foreach ($temp as $word) 
    4178                                         { 
     3410                                        foreach ($temp as $word) { 
    41793411                                                $keywords_parent[] = trim($word); 
    41803412                                        } 
     
    41823414                                unset($temp); 
    41833415                        } 
    4184                         if (is_array($keywords_parent)) 
    4185                         { 
     3416                        if (is_array($keywords_parent)) { 
    41863417                                $keywords_parent = array_values(SimplePie_Misc::array_unique($keywords_parent)); 
    41873418                        } 
    41883419 
    41893420                        // PLAYER 
    4190                         if ($player_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player')) 
    4191                         { 
    4192                                 if (isset($player_parent[0]['attribs']['']['url'])) 
    4193                                 { 
     3421                        if ($player_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player')) { 
     3422                                if (isset($player_parent[0]['attribs']['']['url'])) { 
    41943423                                        $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); 
    41953424                                } 
    4196                         } 
    4197                         elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player')) 
    4198                         { 
    4199                                 if (isset($player_parent[0]['attribs']['']['url'])) 
    4200                                 { 
     3425                        } elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player')) { 
     3426                                if (isset($player_parent[0]['attribs']['']['url'])) { 
    42013427                                        $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); 
    42023428                                } 
     
    42043430 
    42053431                        // RATINGS 
    4206                         if ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating')) 
    4207                         { 
    4208                                 foreach ($ratings as $rating) 
    4209                                 { 
     3432                        if ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating')) { 
     3433                                foreach ($ratings as $rating) { 
    42103434                                        $rating_scheme = null; 
    42113435                                        $rating_value = null; 
    4212                                         if (isset($rating['attribs']['']['scheme'])) 
    4213                                         { 
     3436                                        if (isset($rating['attribs']['']['scheme'])) { 
    42143437                                                $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4215                                         } 
    4216                                         else 
    4217                                         { 
     3438                                        } else { 
    42183439                                                $rating_scheme = 'urn:simple'; 
    42193440                                        } 
    4220                                         if (isset($rating['data'])) 
    4221                                         { 
     3441                                        if (isset($rating['data'])) { 
    42223442                                                $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    42233443                                        } 
    42243444                                        $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value); 
    42253445                                } 
    4226                         } 
    4227                         elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) 
    4228                         { 
    4229                                 foreach ($ratings as $rating) 
    4230                                 { 
     3446                        } elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) { 
     3447                                foreach ($ratings as $rating) { 
    42313448                                        $rating_scheme = 'urn:itunes'; 
    42323449                                        $rating_value = null; 
    4233                                         if (isset($rating['data'])) 
    4234                                         { 
     3450                                        if (isset($rating['data'])) { 
    42353451                                                $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    42363452                                        } 
    42373453                                        $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value); 
    42383454                                } 
    4239                         } 
    4240                         elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating')) 
    4241                         { 
    4242                                 foreach ($ratings as $rating) 
    4243                                 { 
     3455                        } elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating')) { 
     3456                                foreach ($ratings as $rating) { 
    42443457                                        $rating_scheme = null; 
    42453458                                        $rating_value = null; 
    4246                                         if (isset($rating['attribs']['']['scheme'])) 
    4247                                         { 
     3459                                        if (isset($rating['attribs']['']['scheme'])) { 
    42483460                                                $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4249                                         } 
    4250                                         else 
    4251                                         { 
     3461                                        } else { 
    42523462                                                $rating_scheme = 'urn:simple'; 
    42533463                                        } 
    4254                                         if (isset($rating['data'])) 
    4255                                         { 
     3464                                        if (isset($rating['data'])) { 
    42563465                                                $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    42573466                                        } 
    42583467                                        $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value); 
    42593468                                } 
    4260                         } 
    4261                         elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) 
    4262                         { 
    4263                                 foreach ($ratings as $rating) 
    4264                                 { 
     3469                        } elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) { 
     3470                                foreach ($ratings as $rating) { 
    42653471                                        $rating_scheme = 'urn:itunes'; 
    42663472                                        $rating_value = null; 
    4267                                         if (isset($rating['data'])) 
    4268                                         { 
     3473                                        if (isset($rating['data'])) { 
    42693474                                                $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    42703475                                        } 
     
    42723477                                } 
    42733478                        } 
    4274                         if (is_array($ratings_parent)) 
    4275                         { 
     3479                        if (is_array($ratings_parent)) { 
    42763480                                $ratings_parent = array_values(SimplePie_Misc::array_unique($ratings_parent)); 
    42773481                        } 
    42783482 
    42793483                        // RESTRICTIONS 
    4280                         if ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction')) 
    4281                         { 
    4282                                 foreach ($restrictions as $restriction) 
    4283                                 { 
     3484                        if ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction')) { 
     3485                                foreach ($restrictions as $restriction) { 
    42843486                                        $restriction_relationship = null; 
    42853487                                        $restriction_type = null; 
    42863488                                        $restriction_value = null; 
    4287                                         if (isset($restriction['attribs']['']['relationship'])) 
    4288                                         { 
     3489                                        if (isset($restriction['attribs']['']['relationship'])) { 
    42893490                                                $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); 
    42903491                                        } 
    4291                                         if (isset($restriction['attribs']['']['type'])) 
    4292                                         { 
     3492                                        if (isset($restriction['attribs']['']['type'])) { 
    42933493                                                $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    42943494                                        } 
    4295                                         if (isset($restriction['data'])) 
    4296                                         { 
     3495                                        if (isset($restriction['data'])) { 
    42973496                                                $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    42983497                                        } 
    42993498                                        $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); 
    43003499                                } 
    4301                         } 
    4302                         elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) 
    4303                         { 
    4304                                 foreach ($restrictions as $restriction) 
    4305                                 { 
     3500                        } elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) { 
     3501                                foreach ($restrictions as $restriction) { 
    43063502                                        $restriction_relationship = 'allow'; 
    43073503                                        $restriction_type = null; 
    43083504                                        $restriction_value = 'itunes'; 
    4309                                         if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') 
    4310                                         { 
     3505                                        if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') { 
    43113506                                                $restriction_relationship = 'deny'; 
    43123507                                        } 
    43133508                                        $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); 
    43143509                                } 
    4315                         } 
    4316                         elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction')) 
    4317                         { 
    4318                                 foreach ($restrictions as $restriction) 
    4319                                 { 
     3510                        } elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction')) { 
     3511                                foreach ($restrictions as $restriction) { 
    43203512                                        $restriction_relationship = null; 
    43213513                                        $restriction_type = null; 
    43223514                                        $restriction_value = null; 
    4323                                         if (isset($restriction['attribs']['']['relationship'])) 
    4324                                         { 
     3515                                        if (isset($restriction['attribs']['']['relationship'])) { 
    43253516                                                $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); 
    43263517                                        } 
    4327                                         if (isset($restriction['attribs']['']['type'])) 
    4328                                         { 
     3518                                        if (isset($restriction['attribs']['']['type'])) { 
    43293519                                                $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    43303520                                        } 
    4331                                         if (isset($restriction['data'])) 
    4332                                         { 
     3521                                        if (isset($restriction['data'])) { 
    43333522                                                $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    43343523                                        } 
    43353524                                        $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); 
    43363525                                } 
    4337                         } 
    4338                         elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) 
    4339                         { 
    4340                                 foreach ($restrictions as $restriction) 
    4341                                 { 
     3526                        } elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) { 
     3527                                foreach ($restrictions as $restriction) { 
    43423528                                        $restriction_relationship = 'allow'; 
    43433529                                        $restriction_type = null; 
    43443530                                        $restriction_value = 'itunes'; 
    4345                                         if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') 
    4346                                         { 
     3531                                        if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') { 
    43473532                                                $restriction_relationship = 'deny'; 
    43483533                                        } 
     
    43503535                                } 
    43513536                        } 
    4352                         if (is_array($restrictions_parent)) 
    4353                         { 
     3537                        if (is_array($restrictions_parent)) { 
    43543538                                $restrictions_parent = array_values(SimplePie_Misc::array_unique($restrictions_parent)); 
    43553539                        } 
    43563540 
    43573541                        // THUMBNAILS 
    4358                         if ($thumbnails = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail')) 
    4359                         { 
    4360                                 foreach ($thumbnails as $thumbnail) 
    4361                                 { 
    4362                                         if (isset($thumbnail['attribs']['']['url'])) 
    4363                                         { 
     3542                        if ($thumbnails = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail')) { 
     3543                                foreach ($thumbnails as $thumbnail) { 
     3544                                        if (isset($thumbnail['attribs']['']['url'])) { 
    43643545                                                $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); 
    43653546                                        } 
    43663547                                } 
    4367                         } 
    4368                         elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail')) 
    4369                         { 
    4370                                 foreach ($thumbnails as $thumbnail) 
    4371                                 { 
    4372                                         if (isset($thumbnail['attribs']['']['url'])) 
    4373                                         { 
     3548                        } elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail')) { 
     3549                                foreach ($thumbnails as $thumbnail) { 
     3550                                        if (isset($thumbnail['attribs']['']['url'])) { 
    43743551                                                $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); 
    43753552                                        } 
     
    43783555 
    43793556                        // TITLES 
    4380                         if ($title_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title')) 
    4381                         { 
    4382                                 if (isset($title_parent[0]['data'])) 
    4383                                 { 
     3557                        if ($title_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title')) { 
     3558                                if (isset($title_parent[0]['data'])) { 
    43843559                                        $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    43853560                                } 
    4386                         } 
    4387                         elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title')) 
    4388                         { 
    4389                                 if (isset($title_parent[0]['data'])) 
    4390                                 { 
     3561                        } elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title')) { 
     3562                                if (isset($title_parent[0]['data'])) { 
    43913563                                        $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    43923564                                } 
     
    44273599 
    44283600                        // If we have media:group tags, loop through them. 
    4429                         foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group) 
    4430                         { 
     3601                        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group) { 
    44313602                                // If we have media:content tags, loop through them. 
    4432                                 foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content) 
    4433                                 { 
    4434                                         if (isset($content['attribs']['']['url'])) 
    4435                                         { 
     3603                                foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content) { 
     3604                                        if (isset($content['attribs']['']['url'])) { 
    44363605                                                // Attributes 
    44373606                                                $bitrate = null; 
     
    44653634 
    44663635                                                // Start checking the attributes of media:content 
    4467                                                 if (isset($content['attribs']['']['bitrate'])) 
    4468                                                 { 
     3636                                                if (isset($content['attribs']['']['bitrate'])) { 
    44693637                                                        $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT); 
    44703638                                                } 
    4471                                                 if (isset($content['attribs']['']['channels'])) 
    4472                                                 { 
     3639                                                if (isset($content['attribs']['']['channels'])) { 
    44733640                                                        $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT); 
    44743641                                                } 
    4475                                                 if (isset($content['attribs']['']['duration'])) 
    4476                                                 { 
     3642                                                if (isset($content['attribs']['']['duration'])) { 
    44773643                                                        $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4478                                                 } 
    4479                                                 else 
    4480                                                 { 
     3644                                                } else { 
    44813645                                                        $duration = $duration_parent; 
    44823646                                                } 
    4483                                                 if (isset($content['attribs']['']['expression'])) 
    4484                                                 { 
     3647                                                if (isset($content['attribs']['']['expression'])) { 
    44853648                                                        $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT); 
    44863649                                                } 
    4487                                                 if (isset($content['attribs']['']['framerate'])) 
    4488                                                 { 
     3650                                                if (isset($content['attribs']['']['framerate'])) { 
    44893651                                                        $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT); 
    44903652                                                } 
    4491                                                 if (isset($content['attribs']['']['height'])) 
    4492                                                 { 
     3653                                                if (isset($content['attribs']['']['height'])) { 
    44933654                                                        $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT); 
    44943655                                                } 
    4495                                                 if (isset($content['attribs']['']['lang'])) 
    4496                                                 { 
     3656                                                if (isset($content['attribs']['']['lang'])) { 
    44973657                                                        $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); 
    44983658                                                } 
    4499                                                 if (isset($content['attribs']['']['fileSize'])) 
    4500                                                 { 
     3659                                                if (isset($content['attribs']['']['fileSize'])) { 
    45013660                                                        $length = ceil($content['attribs']['']['fileSize']); 
    45023661                                                } 
    4503                                                 if (isset($content['attribs']['']['medium'])) 
    4504                                                 { 
     3662                                                if (isset($content['attribs']['']['medium'])) { 
    45053663                                                        $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45063664                                                } 
    4507                                                 if (isset($content['attribs']['']['samplingrate'])) 
    4508                                                 { 
     3665                                                if (isset($content['attribs']['']['samplingrate'])) { 
    45093666                                                        $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45103667                                                } 
    4511                                                 if (isset($content['attribs']['']['type'])) 
    4512                                                 { 
     3668                                                if (isset($content['attribs']['']['type'])) { 
    45133669                                                        $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45143670                                                } 
    4515                                                 if (isset($content['attribs']['']['width'])) 
    4516                                                 { 
     3671                                                if (isset($content['attribs']['']['width'])) { 
    45173672                                                        $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45183673                                                } 
     
    45203675 
    45213676                                                // Checking the other optional media: elements. Priority: media:content, media:group, item, channel 
    4522  
    45233677                                                // CAPTIONS 
    4524                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) 
    4525                                                 { 
    4526                                                         foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) 
    4527                                                         { 
     3678                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) { 
     3679                                                        foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) { 
    45283680                                                                $caption_type = null; 
    45293681                                                                $caption_lang = null; 
     
    45313683                                                                $caption_endTime = null; 
    45323684                                                                $caption_text = null; 
    4533                                                                 if (isset($caption['attribs']['']['type'])) 
    4534                                                                 { 
     3685                                                                if (isset($caption['attribs']['']['type'])) { 
    45353686                                                                        $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45363687                                                                } 
    4537                                                                 if (isset($caption['attribs']['']['lang'])) 
    4538                                                                 { 
     3688                                                                if (isset($caption['attribs']['']['lang'])) { 
    45393689                                                                        $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45403690                                                                } 
    4541                                                                 if (isset($caption['attribs']['']['start'])) 
    4542                                                                 { 
     3691                                                                if (isset($caption['attribs']['']['start'])) { 
    45433692                                                                        $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45443693                                                                } 
    4545                                                                 if (isset($caption['attribs']['']['end'])) 
    4546                                                                 { 
     3694                                                                if (isset($caption['attribs']['']['end'])) { 
    45473695                                                                        $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45483696                                                                } 
    4549                                                                 if (isset($caption['data'])) 
    4550                                                                 { 
     3697                                                                if (isset($caption['data'])) { 
    45513698                                                                        $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45523699                                                                } 
    45533700                                                                $captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); 
    45543701                                                        } 
    4555                                                         if (is_array($captions)) 
    4556                                                         { 
     3702                                                        if (is_array($captions)) { 
    45573703                                                                $captions = array_values(SimplePie_Misc::array_unique($captions)); 
    45583704                                                        } 
    4559                                                 } 
    4560                                                 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) 
    4561                                                 { 
    4562                                                         foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) 
    4563                                                         { 
     3705                                                } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) { 
     3706                                                        foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) { 
    45643707                                                                $caption_type = null; 
    45653708                                                                $caption_lang = null; 
     
    45673710                                                                $caption_endTime = null; 
    45683711                                                                $caption_text = null; 
    4569                                                                 if (isset($caption['attribs']['']['type'])) 
    4570                                                                 { 
     3712                                                                if (isset($caption['attribs']['']['type'])) { 
    45713713                                                                        $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45723714                                                                } 
    4573                                                                 if (isset($caption['attribs']['']['lang'])) 
    4574                                                                 { 
     3715                                                                if (isset($caption['attribs']['']['lang'])) { 
    45753716                                                                        $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45763717                                                                } 
    4577                                                                 if (isset($caption['attribs']['']['start'])) 
    4578                                                                 { 
     3718                                                                if (isset($caption['attribs']['']['start'])) { 
    45793719                                                                        $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45803720                                                                } 
    4581                                                                 if (isset($caption['attribs']['']['end'])) 
    4582                                                                 { 
     3721                                                                if (isset($caption['attribs']['']['end'])) { 
    45833722                                                                        $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45843723                                                                } 
    4585                                                                 if (isset($caption['data'])) 
    4586                                                                 { 
     3724                                                                if (isset($caption['data'])) { 
    45873725                                                                        $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    45883726                                                                } 
    45893727                                                                $captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); 
    45903728                                                        } 
    4591                                                         if (is_array($captions)) 
    4592                                                         { 
     3729                                                        if (is_array($captions)) { 
    45933730                                                                $captions = array_values(SimplePie_Misc::array_unique($captions)); 
    45943731                                                        } 
    4595                                                 } 
    4596                                                 else 
    4597                                                 { 
     3732                                                } else { 
    45983733                                                        $captions = $captions_parent; 
    45993734                                                } 
    46003735 
    46013736                                                // CATEGORIES 
    4602                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) 
    4603                                                 { 
    4604                                                         foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) 
    4605                                                         { 
     3737                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) { 
     3738                                                        foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) { 
    46063739                                                                $term = null; 
    46073740                                                                $scheme = null; 
    46083741                                                                $label = null; 
    4609                                                                 if (isset($category['data'])) 
    4610                                                                 { 
     3742                                                                if (isset($category['data'])) { 
    46113743                                                                        $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    46123744                                                                } 
    4613                                                                 if (isset($category['attribs']['']['scheme'])) 
    4614                                                                 { 
     3745                                                                if (isset($category['attribs']['']['scheme'])) { 
    46153746                                                                        $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4616                                                                 } 
    4617                                                                 else 
    4618                                                                 { 
     3747                                                                } else { 
    46193748                                                                        $scheme = 'http://search.yahoo.com/mrss/category_schema'; 
    46203749                                                                } 
    4621                                                                 if (isset($category['attribs']['']['label'])) 
    4622                                                                 { 
     3750                                                                if (isset($category['attribs']['']['label'])) { 
    46233751                                                                        $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); 
    46243752                                                                } 
     
    46263754                                                        } 
    46273755                                                } 
    4628                                                 if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) 
    4629                                                 { 
    4630                                                         foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) 
    4631                                                         { 
     3756                                                if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) { 
     3757                                                        foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) { 
    46323758                                                                $term = null; 
    46333759                                                                $scheme = null; 
    46343760                                                                $label = null; 
    4635                                                                 if (isset($category['data'])) 
    4636                                                                 { 
     3761                                                                if (isset($category['data'])) { 
    46373762                                                                        $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    46383763                                                                } 
    4639                                                                 if (isset($category['attribs']['']['scheme'])) 
    4640                                                                 { 
     3764                                                                if (isset($category['attribs']['']['scheme'])) { 
    46413765                                                                        $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4642                                                                 } 
    4643                                                                 else 
    4644                                                                 { 
     3766                                                                } else { 
    46453767                                                                        $scheme = 'http://search.yahoo.com/mrss/category_schema'; 
    46463768                                                                } 
    4647                                                                 if (isset($category['attribs']['']['label'])) 
    4648                                                                 { 
     3769                                                                if (isset($category['attribs']['']['label'])) { 
    46493770                                                                        $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); 
    46503771                                                                } 
     
    46523773                                                        } 
    46533774                                                } 
    4654                                                 if (is_array($categories) && is_array($categories_parent)) 
    4655                                                 { 
     3775                                                if (is_array($categories) && is_array($categories_parent)) { 
    46563776                                                        $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent))); 
    4657                                                 } 
    4658                                                 elseif (is_array($categories)) 
    4659                                                 { 
     3777                                                } elseif (is_array($categories)) { 
    46603778                                                        $categories = array_values(SimplePie_Misc::array_unique($categories)); 
    4661                                                 } 
    4662                                                 elseif (is_array($categories_parent)) 
    4663                                                 { 
     3779                                                } elseif (is_array($categories_parent)) { 
    46643780                                                        $categories = array_values(SimplePie_Misc::array_unique($categories_parent)); 
    46653781                                                } 
    46663782 
    46673783                                                // COPYRIGHTS 
    4668                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) 
    4669                                                 { 
     3784                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) { 
    46703785                                                        $copyright_url = null; 
    46713786                                                        $copyright_label = null; 
    4672                                                         if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) 
    4673                                                         { 
     3787                                                        if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) { 
    46743788                                                                $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); 
    46753789                                                        } 
    4676                                                         if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) 
    4677                                                         { 
     3790                                                        if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) { 
    46783791                                                                $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    46793792                                                        } 
    46803793                                                        $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label); 
    4681                                                 } 
    4682                                                 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) 
    4683                                                 { 
     3794                                                } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) { 
    46843795                                                        $copyright_url = null; 
    46853796                                                        $copyright_label = null; 
    4686                                                         if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) 
    4687                                                         { 
     3797                                                        if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) { 
    46883798                                                                $copyright_url = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); 
    46893799                                                        } 
    4690                                                         if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) 
    4691                                                         { 
     3800                                                        if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) { 
    46923801                                                                $copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    46933802                                                        } 
    46943803                                                        $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label); 
    4695                                                 } 
    4696                                                 else 
    4697                                                 { 
     3804                                                } else { 
    46983805                                                        $copyrights = $copyrights_parent; 
    46993806                                                } 
    47003807 
    47013808                                                // CREDITS 
    4702                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) 
    4703                                                 { 
    4704                                                         foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) 
    4705                                                         { 
     3809                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) { 
     3810                                                        foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) { 
    47063811                                                                $credit_role = null; 
    47073812                                                                $credit_scheme = null; 
    47083813                                                                $credit_name = null; 
    4709                                                                 if (isset($credit['attribs']['']['role'])) 
    4710                                                                 { 
     3814                                                                if (isset($credit['attribs']['']['role'])) { 
    47113815                                                                        $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); 
    47123816                                                                } 
    4713                                                                 if (isset($credit['attribs']['']['scheme'])) 
    4714                                                                 { 
     3817                                                                if (isset($credit['attribs']['']['scheme'])) { 
    47153818                                                                        $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4716                                                                 } 
    4717                                                                 else 
    4718                                                                 { 
     3819                                                                } else { 
    47193820                                                                        $credit_scheme = 'urn:ebu'; 
    47203821                                                                } 
    4721                                                                 if (isset($credit['data'])) 
    4722                                                                 { 
     3822                                                                if (isset($credit['data'])) { 
    47233823                                                                        $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    47243824                                                                } 
    47253825                                                                $credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); 
    47263826                                                        } 
    4727                                                         if (is_array($credits)) 
    4728                                                         { 
     3827                                                        if (is_array($credits)) { 
    47293828                                                                $credits = array_values(SimplePie_Misc::array_unique($credits)); 
    47303829                                                        } 
    4731                                                 } 
    4732                                                 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) 
    4733                                                 { 
    4734                                                         foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) 
    4735                                                         { 
     3830                                                } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) { 
     3831                                                        foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) { 
    47363832                                                                $credit_role = null; 
    47373833                                                                $credit_scheme = null; 
    47383834                                                                $credit_name = null; 
    4739                                                                 if (isset($credit['attribs']['']['role'])) 
    4740                                                                 { 
     3835                                                                if (isset($credit['attribs']['']['role'])) { 
    47413836                                                                        $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); 
    47423837                                                                } 
    4743                                                                 if (isset($credit['attribs']['']['scheme'])) 
    4744                                                                 { 
     3838                                                                if (isset($credit['attribs']['']['scheme'])) { 
    47453839                                                                        $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4746                                                                 } 
    4747                                                                 else 
    4748                                                                 { 
     3840                                                                } else { 
    47493841                                                                        $credit_scheme = 'urn:ebu'; 
    47503842                                                                } 
    4751                                                                 if (isset($credit['data'])) 
    4752                                                                 { 
     3843                                                                if (isset($credit['data'])) { 
    47533844                                                                        $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    47543845                                                                } 
    47553846                                                                $credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); 
    47563847                                                        } 
    4757                                                         if (is_array($credits)) 
    4758                                                         { 
     3848                                                        if (is_array($credits)) { 
    47593849                                                                $credits = array_values(SimplePie_Misc::array_unique($credits)); 
    47603850                                                        } 
    4761                                                 } 
    4762                                                 else 
    4763                                                 { 
     3851                                                } else { 
    47643852                                                        $credits = $credits_parent; 
    47653853                                                } 
    47663854 
    47673855                                                // DESCRIPTION 
    4768                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) 
    4769                                                 { 
     3856                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) { 
    47703857                                                        $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4771                                                 } 
    4772                                                 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) 
    4773                                                 { 
     3858                                                } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) { 
    47743859                                                        $description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4775                                                 } 
    4776                                                 else 
    4777                                                 { 
     3860                                                } else { 
    47783861                                                        $description = $description_parent; 
    47793862                                                } 
    47803863 
    47813864                                                // HASHES 
    4782                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) 
    4783                                                 { 
    4784                                                         foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) 
    4785                                                         { 
     3865                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) { 
     3866                                                        foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) { 
    47863867                                                                $value = null; 
    47873868                                                                $algo = null; 
    4788                                                                 if (isset($hash['data'])) 
    4789                                                                 { 
     3869                                                                if (isset($hash['data'])) { 
    47903870                                                                        $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    47913871                                                                } 
    4792                                                                 if (isset($hash['attribs']['']['algo'])) 
    4793                                                                 { 
     3872                                                                if (isset($hash['attribs']['']['algo'])) { 
    47943873                                                                        $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4795                                                                 } 
    4796                                                                 else 
    4797                                                                 { 
     3874                                                                } else { 
    47983875                                                                        $algo = 'md5'; 
    47993876                                                                } 
    48003877                                                                $hashes[] = $algo.':'.$value; 
    48013878                                                        } 
    4802                                                         if (is_array($hashes)) 
    4803                                                         { 
     3879                                                        if (is_array($hashes)) { 
    48043880                                                                $hashes = array_values(SimplePie_Misc::array_unique($hashes)); 
    48053881                                                        } 
    4806                                                 } 
    4807                                                 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) 
    4808                                                 { 
    4809                                                         foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) 
    4810                                                         { 
     3882                                                } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) { 
     3883                                                        foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) { 
    48113884                                                                $value = null; 
    48123885                                                                $algo = null; 
    4813                                                                 if (isset($hash['data'])) 
    4814                                                                 { 
     3886                                                                if (isset($hash['data'])) { 
    48153887                                                                        $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    48163888                                                                } 
    4817                                                                 if (isset($hash['attribs']['']['algo'])) 
    4818                                                                 { 
     3889                                                                if (isset($hash['attribs']['']['algo'])) { 
    48193890                                                                        $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4820                                                                 } 
    4821                                                                 else 
    4822                                                                 { 
     3891                                                                } else { 
    48233892                                                                        $algo = 'md5'; 
    48243893                                                                } 
    48253894                                                                $hashes[] = $algo.':'.$value; 
    48263895                                                        } 
    4827                                                         if (is_array($hashes)) 
    4828                                                         { 
     3896                                                        if (is_array($hashes)) { 
    48293897                                                                $hashes = array_values(SimplePie_Misc::array_unique($hashes)); 
    48303898                                                        } 
    4831                                                 } 
    4832                                                 else 
    4833                                                 { 
     3899                                                } else { 
    48343900                                                        $hashes = $hashes_parent; 
    48353901                                                } 
    48363902 
    48373903                                                // KEYWORDS 
    4838                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) 
    4839                                                 { 
    4840                                                         if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) 
    4841                                                         { 
     3904                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) { 
     3905                                                        if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) { 
    48423906                                                                $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); 
    4843                                                                 foreach ($temp as $word) 
    4844                                                                 { 
     3907                                                                foreach ($temp as $word) { 
    48453908                                                                        $keywords[] = trim($word); 
    48463909                                                                } 
    48473910                                                                unset($temp); 
    48483911                                                        } 
    4849                                                         if (is_array($keywords)) 
    4850                                                         { 
     3912                                                        if (is_array($keywords)) { 
    48513913                                                                $keywords = array_values(SimplePie_Misc::array_unique($keywords)); 
    48523914                                                        } 
    4853                                                 } 
    4854                                                 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) 
    4855                                                 { 
    4856                                                         if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) 
    4857                                                         { 
     3915                                                } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) { 
     3916                                                        if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) { 
    48583917                                                                $temp = explode(',', $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); 
    4859                                                                 foreach ($temp as $word) 
    4860                                                                 { 
     3918                                                                foreach ($temp as $word) { 
    48613919                                                                        $keywords[] = trim($word); 
    48623920                                                                } 
    48633921                                                                unset($temp); 
    48643922                                                        } 
    4865                                                         if (is_array($keywords)) 
    4866                                                         { 
     3923                                                        if (is_array($keywords)) { 
    48673924                                                                $keywords = array_values(SimplePie_Misc::array_unique($keywords)); 
    48683925                                                        } 
    4869                                                 } 
    4870                                                 else 
    4871                                                 { 
     3926                                                } else { 
    48723927                                                        $keywords = $keywords_parent; 
    48733928                                                } 
    48743929 
    48753930                                                // PLAYER 
    4876                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) 
    4877                                                 { 
     3931                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) { 
    48783932                                                        $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); 
    4879                                                 } 
    4880                                                 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) 
    4881                                                 { 
     3933                                                } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) { 
    48823934                                                        $player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); 
    4883                                                 } 
    4884                                                 else 
    4885                                                 { 
     3935                                                } else { 
    48863936                                                        $player = $player_parent; 
    48873937                                                } 
    48883938 
    48893939                                                // RATINGS 
    4890                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) 
    4891                                                 { 
    4892                                                         foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) 
    4893                                                         { 
     3940                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) { 
     3941                                                        foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) { 
    48943942                                                                $rating_scheme = null; 
    48953943                                                                $rating_value = null; 
    4896                                                                 if (isset($rating['attribs']['']['scheme'])) 
    4897                                                                 { 
     3944                                                                if (isset($rating['attribs']['']['scheme'])) { 
    48983945                                                                        $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4899                                                                 } 
    4900                                                                 else 
    4901                                                                 { 
     3946                                                                } else { 
    49023947                                                                        $rating_scheme = 'urn:simple'; 
    49033948                                                                } 
    4904                                                                 if (isset($rating['data'])) 
    4905                                                                 { 
     3949                                                                if (isset($rating['data'])) { 
    49063950                                                                        $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    49073951                                                                } 
    49083952                                                                $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value); 
    49093953                                                        } 
    4910                                                         if (is_array($ratings)) 
    4911                                                         { 
     3954                                                        if (is_array($ratings)) { 
    49123955                                                                $ratings = array_values(SimplePie_Misc::array_unique($ratings)); 
    49133956                                                        } 
    4914                                                 } 
    4915                                                 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) 
    4916                                                 { 
    4917                                                         foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) 
    4918                                                         { 
     3957                                                } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) { 
     3958                                                        foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) { 
    49193959                                                                $rating_scheme = null; 
    49203960                                                                $rating_value = null; 
    4921                                                                 if (isset($rating['attribs']['']['scheme'])) 
    4922                                                                 { 
     3961                                                                if (isset($rating['attribs']['']['scheme'])) { 
    49233962                                                                        $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    4924                                                                 } 
    4925                                                                 else 
    4926                                                                 { 
     3963                                                                } else { 
    49273964                                                                        $rating_scheme = 'urn:simple'; 
    49283965                                                                } 
    4929                                                                 if (isset($rating['data'])) 
    4930                                                                 { 
     3966                                                                if (isset($rating['data'])) { 
    49313967                                                                        $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    49323968                                                                } 
    49333969                                                                $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value); 
    49343970                                                        } 
    4935                                                         if (is_array($ratings)) 
    4936                                                         { 
     3971                                                        if (is_array($ratings)) { 
    49373972                                                                $ratings = array_values(SimplePie_Misc::array_unique($ratings)); 
    49383973                                                        } 
    4939                                                 } 
    4940                                                 else 
    4941                                                 { 
     3974                                                } else { 
    49423975                                                        $ratings = $ratings_parent; 
    49433976                                                } 
    49443977 
    49453978                                                // RESTRICTIONS 
    4946                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) 
    4947                                                 { 
    4948                                                         foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) 
    4949                                                         { 
     3979                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) { 
     3980                                                        foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) { 
    49503981                                                                $restriction_relationship = null; 
    49513982                                                                $restriction_type = null; 
    49523983                                                                $restriction_value = null; 
    4953                                                                 if (isset($restriction['attribs']['']['relationship'])) 
    4954                                                                 { 
     3984                                                                if (isset($restriction['attribs']['']['relationship'])) { 
    49553985                                                                        $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); 
    49563986                                                                } 
    4957                                                                 if (isset($restriction['attribs']['']['type'])) 
    4958                                                                 { 
     3987                                                                if (isset($restriction['attribs']['']['type'])) { 
    49593988                                                                        $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    49603989                                                                } 
    4961                                                                 if (isset($restriction['data'])) 
    4962                                                                 { 
     3990                                                                if (isset($restriction['data'])) { 
    49633991                                                                        $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    49643992                                                                } 
    49653993                                                                $restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); 
    49663994                                                        } 
    4967                                                         if (is_array($restrictions)) 
    4968                                                         { 
     3995                                                        if (is_array($restrictions)) { 
    49693996                                                                $restrictions = array_values(SimplePie_Misc::array_unique($restrictions)); 
    49703997                                                        } 
    4971                                                 } 
    4972                                                 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) 
    4973                                                 { 
    4974                                                         foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) 
    4975                                                         { 
     3998                                                } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) { 
     3999                                                        foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) { 
    49764000                                                                $restriction_relationship = null; 
    49774001                                                                $restriction_type = null; 
    49784002                                                                $restriction_value = null; 
    4979                                                                 if (isset($restriction['attribs']['']['relationship'])) 
    4980                                                                 { 
     4003                                                                if (isset($restriction['attribs']['']['relationship'])) { 
    49814004                                                                        $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); 
    49824005                                                                } 
    4983                                                                 if (isset($restriction['attribs']['']['type'])) 
    4984                                                                 { 
     4006                                                                if (isset($restriction['attribs']['']['type'])) { 
    49854007                                                                        $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    49864008                                                                } 
    4987                                                                 if (isset($restriction['data'])) 
    4988                                                                 { 
     4009                                                                if (isset($restriction['data'])) { 
    49894010                                                                        $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    49904011                                                                } 
    49914012                                                                $restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); 
    49924013                                                        } 
    4993                                                         if (is_array($restrictions)) 
    4994                                                         { 
     4014                                                        if (is_array($restrictions)) { 
    49954015                                                                $restrictions = array_values(SimplePie_Misc::array_unique($restrictions)); 
    49964016                                                        } 
    4997                                                 } 
    4998                                                 else 
    4999                                                 { 
     4017                                                } else { 
    50004018                                                        $restrictions = $restrictions_parent; 
    50014019                                                } 
    50024020 
    50034021                                                // THUMBNAILS 
    5004                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) 
    5005                                                 { 
    5006                                                         foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) 
    5007                                                         { 
     4022                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) { 
     4023                                                        foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) { 
    50084024                                                                $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); 
    50094025                                                        } 
    5010                                                         if (is_array($thumbnails)) 
    5011                                                         { 
     4026                                                        if (is_array($thumbnails)) { 
    50124027                                                                $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails)); 
    50134028                                                        } 
    5014                                                 } 
    5015                                                 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) 
    5016                                                 { 
    5017                                                         foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) 
    5018                                                         { 
     4029                                                } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) { 
     4030                                                        foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) { 
    50194031                                                                $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); 
    50204032                                                        } 
    5021                                                         if (is_array($thumbnails)) 
    5022                                                         { 
     4033                                                        if (is_array($thumbnails)) { 
    50234034                                                                $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails)); 
    50244035                                                        } 
    5025                                                 } 
    5026                                                 else 
    5027                                                 { 
     4036                                                } else { 
    50284037                                                        $thumbnails = $thumbnails_parent; 
    50294038                                                } 
    50304039 
    50314040                                                // TITLES 
    5032                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) 
    5033                                                 { 
     4041                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) { 
    50344042                                                        $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5035                                                 } 
    5036                                                 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) 
    5037                                                 { 
     4043                                                } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) { 
    50384044                                                        $title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5039                                                 } 
    5040                                                 else 
    5041                                                 { 
     4045                                                } else { 
    50424046                                                        $title = $title_parent; 
    50434047                                                } 
     
    50494053 
    50504054                        // If we have standalone media:content tags, loop through them. 
    5051                         if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'])) 
    5052                         { 
    5053                                 foreach ((array) $this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content) 
    5054                                 { 
    5055                                         if (isset($content['attribs']['']['url'])) 
    5056                                         { 
     4055                        if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'])) { 
     4056                                foreach ((array) $this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content) { 
     4057                                        if (isset($content['attribs']['']['url'])) { 
    50574058                                                // Attributes 
    50584059                                                $bitrate = null; 
     
    50864087 
    50874088                                                // Start checking the attributes of media:content 
    5088                                                 if (isset($content['attribs']['']['bitrate'])) 
    5089                                                 { 
     4089                                                if (isset($content['attribs']['']['bitrate'])) { 
    50904090                                                        $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT); 
    50914091                                                } 
    5092                                                 if (isset($content['attribs']['']['channels'])) 
    5093                                                 { 
     4092                                                if (isset($content['attribs']['']['channels'])) { 
    50944093                                                        $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT); 
    50954094                                                } 
    5096                                                 if (isset($content['attribs']['']['duration'])) 
    5097                                                 { 
     4095                                                if (isset($content['attribs']['']['duration'])) { 
    50984096                                                        $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5099                                                 } 
    5100                                                 else 
    5101                                                 { 
     4097                                                } else { 
    51024098                                                        $duration = $duration_parent; 
    51034099                                                } 
    5104                                                 if (isset($content['attribs']['']['expression'])) 
    5105                                                 { 
     4100                                                if (isset($content['attribs']['']['expression'])) { 
    51064101                                                        $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51074102                                                } 
    5108                                                 if (isset($content['attribs']['']['framerate'])) 
    5109                                                 { 
     4103                                                if (isset($content['attribs']['']['framerate'])) { 
    51104104                                                        $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51114105                                                } 
    5112                                                 if (isset($content['attribs']['']['height'])) 
    5113                                                 { 
     4106                                                if (isset($content['attribs']['']['height'])) { 
    51144107                                                        $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51154108                                                } 
    5116                                                 if (isset($content['attribs']['']['lang'])) 
    5117                                                 { 
     4109                                                if (isset($content['attribs']['']['lang'])) { 
    51184110                                                        $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51194111                                                } 
    5120                                                 if (isset($content['attribs']['']['fileSize'])) 
    5121                                                 { 
     4112                                                if (isset($content['attribs']['']['fileSize'])) { 
    51224113                                                        $length = ceil($content['attribs']['']['fileSize']); 
    51234114                                                } 
    5124                                                 if (isset($content['attribs']['']['medium'])) 
    5125                                                 { 
     4115                                                if (isset($content['attribs']['']['medium'])) { 
    51264116                                                        $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51274117                                                } 
    5128                                                 if (isset($content['attribs']['']['samplingrate'])) 
    5129                                                 { 
     4118                                                if (isset($content['attribs']['']['samplingrate'])) { 
    51304119                                                        $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51314120                                                } 
    5132                                                 if (isset($content['attribs']['']['type'])) 
    5133                                                 { 
     4121                                                if (isset($content['attribs']['']['type'])) { 
    51344122                                                        $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51354123                                                } 
    5136                                                 if (isset($content['attribs']['']['width'])) 
    5137                                                 { 
     4124                                                if (isset($content['attribs']['']['width'])) { 
    51384125                                                        $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51394126                                                } 
     
    51414128 
    51424129                                                // Checking the other optional media: elements. Priority: media:content, media:group, item, channel 
    5143  
    51444130                                                // CAPTIONS 
    5145                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) 
    5146                                                 { 
    5147                                                         foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) 
    5148                                                         { 
     4131                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) { 
     4132                                                        foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) { 
    51494133                                                                $caption_type = null; 
    51504134                                                                $caption_lang = null; 
     
    51524136                                                                $caption_endTime = null; 
    51534137                                                                $caption_text = null; 
    5154                                                                 if (isset($caption['attribs']['']['type'])) 
    5155                                                                 { 
     4138                                                                if (isset($caption['attribs']['']['type'])) { 
    51564139                                                                        $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51574140                                                                } 
    5158                                                                 if (isset($caption['attribs']['']['lang'])) 
    5159                                                                 { 
     4141                                                                if (isset($caption['attribs']['']['lang'])) { 
    51604142                                                                        $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51614143                                                                } 
    5162                                                                 if (isset($caption['attribs']['']['start'])) 
    5163                                                                 { 
     4144                                                                if (isset($caption['attribs']['']['start'])) { 
    51644145                                                                        $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51654146                                                                } 
    5166                                                                 if (isset($caption['attribs']['']['end'])) 
    5167                                                                 { 
     4147                                                                if (isset($caption['attribs']['']['end'])) { 
    51684148                                                                        $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51694149                                                                } 
    5170                                                                 if (isset($caption['data'])) 
    5171                                                                 { 
     4150                                                                if (isset($caption['data'])) { 
    51724151                                                                        $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51734152                                                                } 
    51744153                                                                $captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); 
    51754154                                                        } 
    5176                                                         if (is_array($captions)) 
    5177                                                         { 
     4155                                                        if (is_array($captions)) { 
    51784156                                                                $captions = array_values(SimplePie_Misc::array_unique($captions)); 
    51794157                                                        } 
    5180                                                 } 
    5181                                                 else 
    5182                                                 { 
     4158                                                } else { 
    51834159                                                        $captions = $captions_parent; 
    51844160                                                } 
    51854161 
    51864162                                                // CATEGORIES 
    5187                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) 
    5188                                                 { 
    5189                                                         foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) 
    5190                                                         { 
     4163                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) { 
     4164                                                        foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) { 
    51914165                                                                $term = null; 
    51924166                                                                $scheme = null; 
    51934167                                                                $label = null; 
    5194                                                                 if (isset($category['data'])) 
    5195                                                                 { 
     4168                                                                if (isset($category['data'])) { 
    51964169                                                                        $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    51974170                                                                } 
    5198                                                                 if (isset($category['attribs']['']['scheme'])) 
    5199                                                                 { 
     4171                                                                if (isset($category['attribs']['']['scheme'])) { 
    52004172                                                                        $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5201                                                                 } 
    5202                                                                 else 
    5203                                                                 { 
     4173                                                                } else { 
    52044174                                                                        $scheme = 'http://search.yahoo.com/mrss/category_schema'; 
    52054175                                                                } 
    5206                                                                 if (isset($category['attribs']['']['label'])) 
    5207                                                                 { 
     4176                                                                if (isset($category['attribs']['']['label'])) { 
    52084177                                                                        $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); 
    52094178                                                                } 
     
    52114180                                                        } 
    52124181                                                } 
    5213                                                 if (is_array($categories) && is_array($categories_parent)) 
    5214                                                 { 
     4182                                                if (is_array($categories) && is_array($categories_parent)) { 
    52154183                                                        $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent))); 
    5216                                                 } 
    5217                                                 elseif (is_array($categories)) 
    5218                                                 { 
     4184                                                } elseif (is_array($categories)) { 
    52194185                                                        $categories = array_values(SimplePie_Misc::array_unique($categories)); 
    5220                                                 } 
    5221                                                 elseif (is_array($categories_parent)) 
    5222                                                 { 
     4186                                                } elseif (is_array($categories_parent)) { 
    52234187                                                        $categories = array_values(SimplePie_Misc::array_unique($categories_parent)); 
    5224                                                 } 
    5225                                                 else 
    5226                                                 { 
     4188                                                } else { 
    52274189                                                        $categories = null; 
    52284190                                                } 
    52294191 
    52304192                                                // COPYRIGHTS 
    5231                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) 
    5232                                                 { 
     4193                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) { 
    52334194                                                        $copyright_url = null; 
    52344195                                                        $copyright_label = null; 
    5235                                                         if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) 
    5236                                                         { 
     4196                                                        if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) { 
    52374197                                                                $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); 
    52384198                                                        } 
    5239                                                         if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) 
    5240                                                         { 
     4199                                                        if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) { 
    52414200                                                                $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    52424201                                                        } 
    52434202                                                        $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label); 
    5244                                                 } 
    5245                                                 else 
    5246                                                 { 
     4203                                                } else { 
    52474204                                                        $copyrights = $copyrights_parent; 
    52484205                                                } 
    52494206 
    52504207                                                // CREDITS 
    5251                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) 
    5252                                                 { 
    5253                                                         foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) 
    5254                                                         { 
     4208                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) { 
     4209                                                        foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) { 
    52554210                                                                $credit_role = null; 
    52564211                                                                $credit_scheme = null; 
    52574212                                                                $credit_name = null; 
    5258                                                                 if (isset($credit['attribs']['']['role'])) 
    5259                                                                 { 
     4213                                                                if (isset($credit['attribs']['']['role'])) { 
    52604214                                                                        $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); 
    52614215                                                                } 
    5262                                                                 if (isset($credit['attribs']['']['scheme'])) 
    5263                                                                 { 
     4216                                                                if (isset($credit['attribs']['']['scheme'])) { 
    52644217                                                                        $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5265                                                                 } 
    5266                                                                 else 
    5267                                                                 { 
     4218                                                                } else { 
    52684219                                                                        $credit_scheme = 'urn:ebu'; 
    52694220                                                                } 
    5270                                                                 if (isset($credit['data'])) 
    5271                                                                 { 
     4221                                                                if (isset($credit['data'])) { 
    52724222                                                                        $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    52734223                                                                } 
    52744224                                                                $credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); 
    52754225                                                        } 
    5276                                                         if (is_array($credits)) 
    5277                                                         { 
     4226                                                        if (is_array($credits)) { 
    52784227                                                                $credits = array_values(SimplePie_Misc::array_unique($credits)); 
    52794228                                                        } 
    5280                                                 } 
    5281                                                 else 
    5282                                                 { 
     4229                                                } else { 
    52834230                                                        $credits = $credits_parent; 
    52844231                                                } 
    52854232 
    52864233                                                // DESCRIPTION 
    5287                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) 
    5288                                                 { 
     4234                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) { 
    52894235                                                        $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5290                                                 } 
    5291                                                 else 
    5292                                                 { 
     4236                                                } else { 
    52934237                                                        $description = $description_parent; 
    52944238                                                } 
    52954239 
    52964240                                                // HASHES 
    5297                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) 
    5298                                                 { 
    5299                                                         foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) 
    5300                                                         { 
     4241                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) { 
     4242                                                        foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) { 
    53014243                                                                $value = null; 
    53024244                                                                $algo = null; 
    5303                                                                 if (isset($hash['data'])) 
    5304                                                                 { 
     4245                                                                if (isset($hash['data'])) { 
    53054246                                                                        $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    53064247                                                                } 
    5307                                                                 if (isset($hash['attribs']['']['algo'])) 
    5308                                                                 { 
     4248                                                                if (isset($hash['attribs']['']['algo'])) { 
    53094249                                                                        $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5310                                                                 } 
    5311                                                                 else 
    5312                                                                 { 
     4250                                                                } else { 
    53134251                                                                        $algo = 'md5'; 
    53144252                                                                } 
    53154253                                                                $hashes[] = $algo.':'.$value; 
    53164254                                                        } 
    5317                                                         if (is_array($hashes)) 
    5318                                                         { 
     4255                                                        if (is_array($hashes)) { 
    53194256                                                                $hashes = array_values(SimplePie_Misc::array_unique($hashes)); 
    53204257                                                        } 
    5321                                                 } 
    5322                                                 else 
    5323                                                 { 
     4258                                                } else { 
    53244259                                                        $hashes = $hashes_parent; 
    53254260                                                } 
    53264261 
    53274262                                                // KEYWORDS 
    5328                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) 
    5329                                                 { 
    5330                                                         if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) 
    5331                                                         { 
     4263                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) { 
     4264                                                        if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) { 
    53324265                                                                $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); 
    5333                                                                 foreach ($temp as $word) 
    5334                                                                 { 
     4266                                                                foreach ($temp as $word) { 
    53354267                                                                        $keywords[] = trim($word); 
    53364268                                                                } 
    53374269                                                                unset($temp); 
    53384270                                                        } 
    5339                                                         if (is_array($keywords)) 
    5340                                                         { 
     4271                                                        if (is_array($keywords)) { 
    53414272                                                                $keywords = array_values(SimplePie_Misc::array_unique($keywords)); 
    53424273                                                        } 
    5343                                                 } 
    5344                                                 else 
    5345                                                 { 
     4274                                                } else { 
    53464275                                                        $keywords = $keywords_parent; 
    53474276                                                } 
    53484277 
    53494278                                                // PLAYER 
    5350                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) 
    5351                                                 { 
     4279                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) { 
    53524280                                                        $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); 
    5353                                                 } 
    5354                                                 else 
    5355                                                 { 
     4281                                                } else { 
    53564282                                                        $player = $player_parent; 
    53574283                                                } 
    53584284 
    53594285                                                // RATINGS 
    5360                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) 
    5361                                                 { 
    5362                                                         foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) 
    5363                                                         { 
     4286                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) { 
     4287                                                        foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) { 
    53644288                                                                $rating_scheme = null; 
    53654289                                                                $rating_value = null; 
    5366                                                                 if (isset($rating['attribs']['']['scheme'])) 
    5367                                                                 { 
     4290                                                                if (isset($rating['attribs']['']['scheme'])) { 
    53684291                                                                        $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5369                                                                 } 
    5370                                                                 else 
    5371                                                                 { 
     4292                                                                } else { 
    53724293                                                                        $rating_scheme = 'urn:simple'; 
    53734294                                                                } 
    5374                                                                 if (isset($rating['data'])) 
    5375                                                                 { 
     4295                                                                if (isset($rating['data'])) { 
    53764296                                                                        $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    53774297                                                                } 
    53784298                                                                $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value); 
    53794299                                                        } 
    5380                                                         if (is_array($ratings)) 
    5381                                                         { 
     4300                                                        if (is_array($ratings)) { 
    53824301                                                                $ratings = array_values(SimplePie_Misc::array_unique($ratings)); 
    53834302                                                        } 
    5384                                                 } 
    5385                                                 else 
    5386                                                 { 
     4303                                                } else { 
    53874304                                                        $ratings = $ratings_parent; 
    53884305                                                } 
    53894306 
    53904307                                                // RESTRICTIONS 
    5391                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) 
    5392                                                 { 
    5393                                                         foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) 
    5394                                                         { 
     4308                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) { 
     4309                                                        foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) { 
    53954310                                                                $restriction_relationship = null; 
    53964311                                                                $restriction_type = null; 
    53974312                                                                $restriction_value = null; 
    5398                                                                 if (isset($restriction['attribs']['']['relationship'])) 
    5399                                                                 { 
     4313                                                                if (isset($restriction['attribs']['']['relationship'])) { 
    54004314                                                                        $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); 
    54014315                                                                } 
    5402                                                                 if (isset($restriction['attribs']['']['type'])) 
    5403                                                                 { 
     4316                                                                if (isset($restriction['attribs']['']['type'])) { 
    54044317                                                                        $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    54054318                                                                } 
    5406                                                                 if (isset($restriction['data'])) 
    5407                                                                 { 
     4319                                                                if (isset($restriction['data'])) { 
    54084320                                                                        $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    54094321                                                                } 
    54104322                                                                $restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); 
    54114323                                                        } 
    5412                                                         if (is_array($restrictions)) 
    5413                                                         { 
     4324                                                        if (is_array($restrictions)) { 
    54144325                                                                $restrictions = array_values(SimplePie_Misc::array_unique($restrictions)); 
    54154326                                                        } 
    5416                                                 } 
    5417                                                 else 
    5418                                                 { 
     4327                                                } else { 
    54194328                                                        $restrictions = $restrictions_parent; 
    54204329                                                } 
    54214330 
    54224331                                                // THUMBNAILS 
    5423                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) 
    5424                                                 { 
    5425                                                         foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) 
    5426                                                         { 
     4332                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) { 
     4333                                                        foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) { 
    54274334                                                                $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); 
    54284335                                                        } 
    5429                                                         if (is_array($thumbnails)) 
    5430                                                         { 
     4336                                                        if (is_array($thumbnails)) { 
    54314337                                                                $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails)); 
    54324338                                                        } 
    5433                                                 } 
    5434                                                 else 
    5435                                                 { 
     4339                                                } else { 
    54364340                                                        $thumbnails = $thumbnails_parent; 
    54374341                                                } 
    54384342 
    54394343                                                // TITLES 
    5440                                                 if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) 
    5441                                                 { 
     4344                                                if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) { 
    54424345                                                        $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5443                                                 } 
    5444                                                 else 
    5445                                                 { 
     4346                                                } else { 
    54464347                                                        $title = $title_parent; 
    54474348                                                } 
     
    54524353                        } 
    54534354 
    5454                         foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link) 
    5455                         { 
    5456                                 if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') 
    5457                                 { 
     4355                        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link) { 
     4356                                if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') { 
    54584357                                        // Attributes 
    54594358                                        $bitrate = null; 
     
    54734372 
    54744373                                        $url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); 
    5475                                         if (isset($link['attribs']['']['type'])) 
    5476                                         { 
     4374                                        if (isset($link['attribs']['']['type'])) { 
    54774375                                                $type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    54784376                                        } 
    5479                                         if (isset($link['attribs']['']['length'])) 
    5480                                         { 
     4377                                        if (isset($link['attribs']['']['length'])) { 
    54814378                                                $length = ceil($link['attribs']['']['length']); 
    54824379                                        } 
     
    54874384                        } 
    54884385 
    5489                         foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link) 
    5490                         { 
    5491                                 if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') 
    5492                                 { 
     4386                        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link) { 
     4387                                if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') { 
    54934388                                        // Attributes 
    54944389                                        $bitrate = null; 
     
    55084403 
    55094404                                        $url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); 
    5510                                         if (isset($link['attribs']['']['type'])) 
    5511                                         { 
     4405                                        if (isset($link['attribs']['']['type'])) { 
    55124406                                                $type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    55134407                                        } 
    5514                                         if (isset($link['attribs']['']['length'])) 
    5515                                         { 
     4408                                        if (isset($link['attribs']['']['length'])) { 
    55164409                                                $length = ceil($link['attribs']['']['length']); 
    55174410                                        } 
     
    55224415                        } 
    55234416 
    5524                         if ($enclosure = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'enclosure')) 
    5525                         { 
    5526                                 if (isset($enclosure[0]['attribs']['']['url'])) 
    5527                                 { 
     4417                        if ($enclosure = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'enclosure')) { 
     4418                                if (isset($enclosure[0]['attribs']['']['url'])) { 
    55284419                                        // Attributes 
    55294420                                        $bitrate = null; 
     
    55434434 
    55444435                                        $url = $this->sanitize($enclosure[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($enclosure[0])); 
    5545                                         if (isset($enclosure[0]['attribs']['']['type'])) 
    5546                                         { 
     4436                                        if (isset($enclosure[0]['attribs']['']['type'])) { 
    55474437                                                $type = $this->sanitize($enclosure[0]['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); 
    55484438                                        } 
    5549                                         if (isset($enclosure[0]['attribs']['']['length'])) 
    5550                                         { 
     4439                                        if (isset($enclosure[0]['attribs']['']['length'])) { 
    55514440                                                $length = ceil($enclosure[0]['attribs']['']['length']); 
    55524441                                        } 
     
    55574446                        } 
    55584447 
    5559                         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)) 
    5560                         { 
     4448                        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)) { 
    55614449                                // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor 
    55624450                                $this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $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); 
     
    55654453                        $this->data['enclosures'] = array_values(SimplePie_Misc::array_unique($this->data['enclosures'])); 
    55664454                } 
    5567                 if (!empty($this->data['enclosures'])) 
    5568                 { 
     4455                if (!empty($this->data['enclosures'])) { 
    55694456                        return $this->data['enclosures']; 
    5570                 } 
    5571                 else 
    5572                 { 
     4457                } else { 
    55734458                        return null; 
    55744459                } 
     
    55774462        function get_latitude() 
    55784463        { 
    5579                 if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) 
    5580                 { 
     4464                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) { 
    55814465                        return (float) $return[0]['data']; 
    5582                 } 
    5583                 elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) 
    5584                 { 
     4466                } elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) { 
    55854467                        return (float) $match[1]; 
    5586                 } 
    5587                 else 
    5588                 { 
     4468                } else { 
    55894469                        return null; 
    55904470                } 
     
    55934473        function get_longitude() 
    55944474        { 
    5595                 if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) 
    5596                 { 
     4475                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) { 
    55974476                        return (float) $return[0]['data']; 
    5598                 } 
    5599                 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) 
    5600                 { 
     4477                } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) { 
    56014478                        return (float) $return[0]['data']; 
    5602                 } 
    5603                 elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) 
    5604                 { 
     4479                } elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) { 
    56054480                        return (float) $match[2]; 
    5606                 } 
    5607                 else 
    5608                 { 
     4481                } else { 
    56094482                        return null; 
    56104483                } 
     
    56134486        function get_source() 
    56144487        { 
    5615                 if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source')) 
    5616                 { 
     4488                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source')) { 
    56174489                        return new $this->feed->source_class($this, $return[0]); 
    5618                 } 
    5619                 else 
    5620                 { 
     4490                } else { 
    56214491                        return null; 
    56224492                } 
     
    56344504        function add_to_service($item_url, $title_url = null, $summary_url = null) 
    56354505        { 
    5636                 if ($this->get_permalink() !== null) 
    5637                 { 
    5638                         $return = $item_url . rawurlencode($this->get_permalink()); 
    5639                         if ($title_url !== null && $this->get_title() !== null) 
    5640                         { 
    5641                                 $return .= $title_url . rawurlencode($this->get_title()); 
    5642                         } 
    5643                         if ($summary_url !== null && $this->get_description() !== null) 
    5644                         { 
    5645                                 $return .= $summary_url . rawurlencode($this->get_description()); 
     4506                if ($this->get_permalink() !== null) { 
     4507                        $return = $item_url.rawurlencode($this->get_permalink()); 
     4508                        if ($title_url !== null && $this->get_title() !== null) { 
     4509                                $return .= $title_url.rawurlencode($this->get_title()); 
     4510                        } 
     4511                        if ($summary_url !== null && $this->get_description() !== null) { 
     4512                                $return .= $summary_url.rawurlencode($this->get_description()); 
    56464513                        } 
    56474514                        return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI); 
    5648                 } 
    5649                 else 
    5650                 { 
     4515                } else { 
    56514516                        return null; 
    56524517                } 
     
    57224587                return $this->add_to_service('http://www.technorati.com/search/'); 
    57234588        } 
     4589 
    57244590} 
    57254591 
    57264592class SimplePie_Source 
    57274593{ 
     4594 
    57284595        var $item; 
    57294596        var $data = array(); 
     
    57424609        function get_source_tags($namespace, $tag) 
    57434610        { 
    5744                 if (isset($this->data['child'][$namespace][$tag])) 
    5745                 { 
     4611                if (isset($this->data['child'][$namespace][$tag])) { 
    57464612                        return $this->data['child'][$namespace][$tag]; 
    5747                 } 
    5748                 else 
    5749                 { 
     4613                } else { 
    57504614                        return null; 
    57514615                } 
     
    57694633        function get_title() 
    57704634        { 
    5771                 if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) 
    5772                 { 
     4635                if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) { 
    57734636                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    5774                 } 
    5775                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) 
    5776                 { 
     4637                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) { 
    57774638                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    5778                 } 
    5779                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) 
    5780                 { 
     4639                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) { 
    57814640                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    5782                 } 
    5783                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) 
    5784                 { 
     4641                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) { 
    57854642                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    5786                 } 
    5787                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) 
    5788                 { 
     4643                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) { 
    57894644                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    5790                 } 
    5791                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) 
    5792                 { 
     4645                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) { 
    57934646                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5794                 } 
    5795                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) 
    5796                 { 
     4647                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) { 
    57974648                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5798                 } 
    5799                 else 
    5800                 { 
     4649                } else { 
    58014650                        return null; 
    58024651                } 
     
    58064655        { 
    58074656                $categories = $this->get_categories(); 
    5808                 if (isset($categories[$key])) 
    5809                 { 
     4657                if (isset($categories[$key])) { 
    58104658                        return $categories[$key]; 
    5811                 } 
    5812                 else 
    5813                 { 
     4659                } else { 
    58144660                        return null; 
    58154661                } 
     
    58204666                $categories = array(); 
    58214667 
    5822                 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) 
    5823                 { 
     4668                foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) { 
    58244669                        $term = null; 
    58254670                        $scheme = null; 
    58264671                        $label = null; 
    5827                         if (isset($category['attribs']['']['term'])) 
    5828                         { 
     4672                        if (isset($category['attribs']['']['term'])) { 
    58294673                                $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); 
    58304674                        } 
    5831                         if (isset($category['attribs']['']['scheme'])) 
    5832                         { 
     4675                        if (isset($category['attribs']['']['scheme'])) { 
    58334676                                $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); 
    58344677                        } 
    5835                         if (isset($category['attribs']['']['label'])) 
    5836                         { 
     4678                        if (isset($category['attribs']['']['label'])) { 
    58374679                                $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); 
    58384680                        } 
    58394681                        $categories[] = new $this->item->feed->category_class($term, $scheme, $label); 
    58404682                } 
    5841                 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) 
    5842                 { 
     4683                foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) { 
    58434684                        // This is really the label, but keep this as the term also for BC. 
    58444685                        // Label will also work on retrieving because that falls back to term. 
    58454686                        $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5846                         if (isset($category['attribs']['']['domain'])) 
    5847                         { 
     4687                        if (isset($category['attribs']['']['domain'])) { 
    58484688                                $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); 
    5849                         } 
    5850                         else 
    5851                         { 
     4689                        } else { 
    58524690                                $scheme = null; 
    58534691                        } 
    58544692                        $categories[] = new $this->item->feed->category_class($term, $scheme, null); 
    58554693                } 
    5856                 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) 
    5857                 { 
     4694                foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) { 
    58584695                        $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    58594696                } 
    5860                 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) 
    5861                 { 
     4697                foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) { 
    58624698                        $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    58634699                } 
    58644700 
    5865                 if (!empty($categories)) 
    5866                 { 
     4701                if (!empty($categories)) { 
    58674702                        return SimplePie_Misc::array_unique($categories); 
    5868                 } 
    5869                 else 
    5870                 { 
     4703                } else { 
    58714704                        return null; 
    58724705                } 
     
    58764709        { 
    58774710                $authors = $this->get_authors(); 
    5878                 if (isset($authors[$key])) 
    5879                 { 
     4711                if (isset($authors[$key])) { 
    58804712                        return $authors[$key]; 
    5881                 } 
    5882                 else 
    5883                 { 
     4713                } else { 
    58844714                        return null; 
    58854715                } 
     
    58894719        { 
    58904720                $authors = array(); 
    5891                 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) 
    5892                 { 
     4721                foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) { 
    58934722                        $name = null; 
    58944723                        $uri = null; 
    58954724                        $email = null; 
    5896                         if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) 
    5897                         { 
     4725                        if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { 
    58984726                                $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    58994727                        } 
    5900                         if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) 
    5901                         { 
     4728                        if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { 
    59024729                                $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])); 
    59034730                        } 
    5904                         if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) 
    5905                         { 
     4731                        if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { 
    59064732                                $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    59074733                        } 
    5908                         if ($name !== null || $email !== null || $uri !== null) 
    5909                         { 
     4734                        if ($name !== null || $email !== null || $uri !== null) { 
    59104735                                $authors[] = new $this->item->feed->author_class($name, $uri, $email); 
    59114736                        } 
    59124737                } 
    5913                 if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) 
    5914                 { 
     4738                if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) { 
    59154739                        $name = null; 
    59164740                        $url = null; 
    59174741                        $email = null; 
    5918                         if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) 
    5919                         { 
     4742                        if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { 
    59204743                                $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    59214744                        } 
    5922                         if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) 
    5923                         { 
     4745                        if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { 
    59244746                                $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])); 
    59254747                        } 
    5926                         if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) 
    5927                         { 
     4748                        if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { 
    59284749                                $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    59294750                        } 
    5930                         if ($name !== null || $email !== null || $url !== null) 
    5931                         { 
     4751                        if ($name !== null || $email !== null || $url !== null) { 
    59324752                                $authors[] = new $this->item->feed->author_class($name, $url, $email); 
    59334753                        } 
    59344754                } 
    5935                 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) 
    5936                 { 
     4755                foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) { 
    59374756                        $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    59384757                } 
    5939                 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) 
    5940                 { 
     4758                foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) { 
    59414759                        $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    59424760                } 
    5943                 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) 
    5944                 { 
     4761                foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) { 
    59454762                        $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); 
    59464763                } 
    59474764 
    5948                 if (!empty($authors)) 
    5949                 { 
     4765                if (!empty($authors)) { 
    59504766                        return SimplePie_Misc::array_unique($authors); 
    5951                 } 
    5952                 else 
    5953                 { 
     4767                } else { 
    59544768                        return null; 
    59554769                } 
     
    59594773        { 
    59604774                $contributors = $this->get_contributors(); 
    5961                 if (isset($contributors[$key])) 
    5962                 { 
     4775                if (isset($contributors[$key])) { 
    59634776                        return $contributors[$key]; 
    5964                 } 
    5965                 else 
    5966                 { 
     4777                } else { 
    59674778                        return null; 
    59684779                } 
     
    59724783        { 
    59734784                $contributors = array(); 
    5974                 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) 
    5975                 { 
     4785                foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) { 
    59764786                        $name = null; 
    59774787                        $uri = null; 
    59784788                        $email = null; 
    5979                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) 
    5980                         { 
     4789                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) { 
    59814790                                $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    59824791                        } 
    5983                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) 
    5984                         { 
     4792                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) { 
    59854793                                $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])); 
    59864794                        } 
    5987                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) 
    5988                         { 
     4795                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'])) { 
    59894796                                $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    59904797                        } 
    5991                         if ($name !== null || $email !== null || $uri !== null) 
    5992                         { 
     4798                        if ($name !== null || $email !== null || $uri !== null) { 
    59934799                                $contributors[] = new $this->item->feed->author_class($name, $uri, $email); 
    59944800                        } 
    59954801                } 
    5996                 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) 
    5997                 { 
     4802                foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) { 
    59984803                        $name = null; 
    59994804                        $url = null; 
    60004805                        $email = null; 
    6001                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) 
    6002                         { 
     4806                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'])) { 
    60034807                                $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    60044808                        } 
    6005                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) 
    6006                         { 
     4809                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'])) { 
    60074810                                $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])); 
    60084811                        } 
    6009                         if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) 
    6010                         { 
     4812                        if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'])) { 
    60114813                                $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    60124814                        } 
    6013                         if ($name !== null || $email !== null || $url !== null) 
    6014                         { 
     4815                        if ($name !== null || $email !== null || $url !== null) { 
    60154816                                $contributors[] = new $this->item->feed->author_class($name, $url, $email); 
    60164817                        } 
    60174818                } 
    60184819 
    6019                 if (!empty($contributors)) 
    6020                 { 
     4820                if (!empty($contributors)) { 
    60214821                        return SimplePie_Misc::array_unique($contributors); 
    6022                 } 
    6023                 else 
    6024                 { 
     4822                } else { 
    60254823                        return null; 
    60264824                } 
     
    60304828        { 
    60314829                $links = $this->get_links($rel); 
    6032                 if (isset($links[$key])) 
    6033                 { 
     4830                if (isset($links[$key])) { 
    60344831                        return $links[$key]; 
    6035                 } 
    6036                 else 
    6037                 { 
     4832                } else { 
    60384833                        return null; 
    60394834                } 
     
    60504845        function get_links($rel = 'alternate') 
    60514846        { 
    6052                 if (!isset($this->data['links'])) 
    6053                 { 
     4847                if (!isset($this->data['links'])) { 
    60544848                        $this->data['links'] = array(); 
    6055                         if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) 
    6056                         { 
    6057                                 foreach ($links as $link) 
    6058                                 { 
    6059                                         if (isset($link['attribs']['']['href'])) 
    6060                                         { 
     4849                        if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link')) { 
     4850                                foreach ($links as $link) { 
     4851                                        if (isset($link['attribs']['']['href'])) { 
    60614852                                                $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; 
    60624853                                                $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); 
     
    60644855                                } 
    60654856                        } 
    6066                         if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link')) 
    6067                         { 
    6068                                 foreach ($links as $link) 
    6069                                 { 
    6070                                         if (isset($link['attribs']['']['href'])) 
    6071                                         { 
     4857                        if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link')) { 
     4858                                foreach ($links as $link) { 
     4859                                        if (isset($link['attribs']['']['href'])) { 
    60724860                                                $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate'; 
    60734861                                                $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link)); 
    6074  
    60754862                                        } 
    60764863                                } 
    60774864                        } 
    6078                         if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) 
    6079                         { 
     4865                        if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) { 
    60804866                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); 
    60814867                        } 
    6082                         if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) 
    6083                         { 
     4868                        if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) { 
    60844869                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); 
    60854870                        } 
    6086                         if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) 
    6087                         { 
     4871                        if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) { 
    60884872                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); 
    60894873                        } 
    60904874 
    60914875                        $keys = array_keys($this->data['links']); 
    6092                         foreach ($keys as $key) 
    6093                         { 
    6094                                 if (SimplePie_Misc::is_isegment_nz_nc($key)) 
    6095                                 { 
    6096                                         if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) 
    6097                                         { 
    6098                                                 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); 
    6099                                                 $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; 
     4876                        foreach ($keys as $key) { 
     4877                                if (SimplePie_Misc::is_isegment_nz_nc($key)) { 
     4878                                        if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key])) { 
     4879                                                $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]); 
     4880                                                $this->data['links'][$key] = & $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]; 
     4881                                        } else { 
     4882                                                $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = & $this->data['links'][$key]; 
    61004883                                        } 
    6101                                         else 
    6102                                         { 
    6103                                                 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; 
    6104                                         } 
    6105                                 } 
    6106                                 elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) 
    6107                                 { 
    6108                                         $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; 
     4884                                } elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) { 
     4885                                        $this->data['links'][substr($key, 41)] = & $this->data['links'][$key]; 
    61094886                                } 
    61104887                                $this->data['links'][$key] = array_unique($this->data['links'][$key]); 
     
    61124889                } 
    61134890 
    6114                 if (isset($this->data['links'][$rel])) 
    6115                 { 
     4891                if (isset($this->data['links'][$rel])) { 
    61164892                        return $this->data['links'][$rel]; 
    6117                 } 
    6118                 else 
    6119                 { 
     4893                } else { 
    61204894                        return null; 
    61214895                } 
     
    61244898        function get_description() 
    61254899        { 
    6126                 if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) 
    6127                 { 
     4900                if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) { 
    61284901                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    6129                 } 
    6130                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) 
    6131                 { 
     4902                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) { 
    61324903                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    6133                 } 
    6134                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) 
    6135                 { 
     4904                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) { 
    61364905                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    6137                 } 
    6138                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) 
    6139                 { 
     4906                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) { 
    61404907                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    6141                 } 
    6142                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) 
    6143                 { 
     4908                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) { 
    61444909                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); 
    6145                 } 
    6146                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) 
    6147                 { 
     4910                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) { 
    61484911                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    6149                 } 
    6150                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) 
    6151                 { 
     4912                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) { 
    61524913                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    6153                 } 
    6154                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) 
    6155                 { 
     4914                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) { 
    61564915                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); 
    6157                 } 
    6158                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) 
    6159                 { 
     4916                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) { 
    61604917                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); 
    6161                 } 
    6162                 else 
    6163                 { 
     4918                } else { 
    61644919                        return null; 
    61654920                } 
     
    61684923        function get_copyright() 
    61694924        { 
    6170                 if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) 
    6171                 { 
     4925                if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) { 
    61724926                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    6173                 } 
    6174                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) 
    6175                 { 
     4927                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) { 
    61764928                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); 
    6177                 } 
    6178                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) 
    6179                 { 
     4929                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) { 
    61804930                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    6181                 } 
    6182                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) 
    6183                 { 
     4931                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) { 
    61844932                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    6185                 } 
    6186                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) 
    6187                 { 
     4933                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) { 
    61884934                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    6189                 } 
    6190                 else 
    6191                 { 
     4935                } else { 
    61924936                        return null; 
    61934937                } 
     
    61964940        function get_language() 
    61974941        { 
    6198                 if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) 
    6199                 { 
     4942                if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) { 
    62004943                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    6201                 } 
    6202                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) 
    6203                 { 
     4944                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) { 
    62044945                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    6205                 } 
    6206                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) 
    6207                 { 
     4946                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) { 
    62084947                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); 
    6209                 } 
    6210                 elseif (isset($this->data['xml_lang'])) 
    6211                 { 
     4948                } elseif (isset($this->data['xml_lang'])) { 
    62124949                        return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); 
    6213                 } 
    6214                 else 
    6215                 { 
     4950                } else { 
    62164951                        return null; 
    62174952                } 
     
    62204955        function get_latitude() 
    62214956        { 
    6222                 if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) 
    6223                 { 
     4957                if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) { 
    62244958                        return (float) $return[0]['data']; 
    6225                 } 
    6226                 elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) 
    6227                 { 
     4959                } elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) { 
    62284960                        return (float) $match[1]; 
    6229                 } 
    6230                 else 
    6231                 { 
     4961                } else { 
    62324962                        return null; 
    62334963                } 
     
    62364966        function get_longitude() 
    62374967        { 
    6238                 if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) 
    6239                 { 
     4968                if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) { 
    62404969                        return (float) $return[0]['data']; 
    6241                 } 
    6242                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) 
    6243                 { 
     4970                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) { 
    62444971                        return (float) $return[0]['data']; 
    6245                 } 
    6246                 elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) 
    6247                 { 
     4972                } elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) { 
    62484973                        return (float) $match[2]; 
    6249                 } 
    6250                 else 
    6251                 { 
     4974                } else { 
    62524975                        return null; 
    62534976                } 
     
    62564979        function get_image_url() 
    62574980        { 
    6258                 if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) 
    6259                 { 
     4981                if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) { 
    62604982                        return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI); 
    6261                 } 
    6262                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) 
    6263                 { 
     4983                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) { 
    62644984                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); 
    6265                 } 
    6266                 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) 
    6267                 { 
     4985                } elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) { 
    62684986                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); 
    6269                 } 
    6270                 else 
    6271                 { 
     4987                } else { 
    62724988                        return null; 
    62734989                } 
    62744990        } 
     4991 
    62754992} 
    62764993 
    62774994class SimplePie_Author 
    62784995{ 
     4996 
    62794997        var $name; 
    62804998        var $link; 
     
    62975015        function get_name() 
    62985016        { 
    6299                 if ($this->name !== null) 
    6300                 { 
     5017                if ($this->name !== null) { 
    63015018                        return $this->name; 
    6302                 } 
    6303                 else 
    6304                 { 
     5019                } else { 
    63055020                        return null; 
    63065021                } 
     
    63095024        function get_link() 
    63105025        { 
    6311                 if ($this->link !== null) 
    6312                 { 
     5026                if ($this->link !== null) { 
    63135027                        return $this->link; 
    6314                 } 
    6315                 else 
    6316                 { 
     5028                } else { 
    63175029                        return null; 
    63185030                } 
     
    63215033        function get_email() 
    63225034        { 
    6323                 if ($this->email !== null) 
    6324                 { 
     5035                if ($this->email !== null) { 
    63255036                        return $this->email; 
    6326                 } 
    6327                 else 
    6328                 { 
     5037                } else { 
    63295038                        return null; 
    63305039                } 
    63315040        } 
     5041 
    63325042} 
    63335043 
    63345044class SimplePie_Category 
    63355045{ 
     5046 
    63365047        var $term; 
    63375048        var $scheme; 
     
    63545065        function get_term() 
    63555066        { 
    6356                 if ($this->term !== null) 
    6357                 { 
     5067                if ($this->term !== null) { 
    63585068                        return $this->term; 
    6359                 } 
    6360                 else 
    6361                 { 
     5069                } else { 
    63625070                        return null; 
    63635071                } 
     
    63665074        function get_scheme() 
    63675075        { 
    6368                 if ($this->scheme !== null) 
    6369                 { 
     5076                if ($this->scheme !== null) { 
    63705077                        return $this->scheme; 
    6371                 } 
    6372                 else 
    6373                 { 
     5078                } else { 
    63745079                        return null; 
    63755080                } 
     
    63785083        function get_label() 
    63795084        { 
    6380                 if ($this->label !== null) 
    6381                 { 
     5085                if ($this->label !== null) { 
    63825086                        return $this->label; 
    6383                 } 
    6384                 else 
    6385                 { 
     5087                } else { 
    63865088                        return $this->get_term(); 
    63875089                } 
    63885090        } 
     5091 
    63895092} 
    63905093 
    63915094class SimplePie_Enclosure 
    63925095{ 
     5096 
    63935097        var $bitrate; 
    63945098        var $captions; 
     
    64485152                $this->type = $type; 
    64495153                $this->width = $width; 
    6450                 if (class_exists('idna_convert')) 
    6451                 { 
     5154                if (class_exists('idna_convert')) { 
    64525155                        $idn = new idna_convert; 
    64535156                        $parsed = SimplePie_Misc::parse_url($link); 
     
    64655168        function get_bitrate() 
    64665169        { 
    6467                 if ($this->bitrate !== null) 
    6468                 { 
     5170                if ($this->bitrate !== null) { 
    64695171                        return $this->bitrate; 
    6470                 } 
    6471                 else 
    6472                 { 
     5172                } else { 
    64735173                        return null; 
    64745174                } 
     
    64785178        { 
    64795179                $captions = $this->get_captions(); 
    6480                 if (isset($captions[$key])) 
    6481                 { 
     5180                if (isset($captions[$key])) { 
    64825181                        return $captions[$key]; 
    6483                 } 
    6484                 else 
    6485                 { 
     5182                } else { 
    64865183                        return null; 
    64875184                } 
     
    64905187        function get_captions() 
    64915188        { 
    6492                 if ($this->captions !== null) 
    6493                 { 
     5189                if ($this->captions !== null) { 
    64945190                        return $this->captions; 
    6495                 } 
    6496                 else 
    6497                 { 
     5191                } else { 
    64985192                        return null; 
    64995193                } 
     
    65035197        { 
    65045198                $categories = $this->get_categories(); 
    6505                 if (isset($categories[$key])) 
    6506                 { 
     5199                if (isset($categories[$key])) { 
    65075200                        return $categories[$key]; 
    6508                 } 
    6509                 else 
    6510                 { 
     5201                } else { 
    65115202                        return null; 
    65125203                } 
     
    65155206        function get_categories() 
    65165207        { 
    6517                 if ($this->categories !== null) 
    6518                 { 
     5208                if ($this->categories !== null) { 
    65195209                        return $this->categories; 
    6520                 } 
    6521                 else 
    6522                 { 
     5210                } else { 
    65235211                        return null; 
    65245212                } 
     
    65275215        function get_channels() 
    65285216        { 
    6529                 if ($this->channels !== null) 
    6530                 { 
     5217                if ($this->channels !== null) { 
    65315218                        return $this->channels; 
    6532                 } 
    6533                 else 
    6534                 { 
     5219                } else { 
    65355220                        return null; 
    65365221                } 
     
    65395224        function get_copyright() 
    65405225        { 
    6541                 if ($this->copyright !== null) 
    6542                 { 
     5226                if ($this->copyright !== null) { 
    65435227                        return $this->copyright; 
    6544                 } 
    6545                 else 
    6546                 { 
     5228                } else { 
    65475229                        return null; 
    65485230                } 
     
    65525234        { 
    65535235                $credits = $this->get_credits(); 
    6554                 if (isset($credits[$key])) 
    6555                 { 
     5236                if (isset($credits[$key])) { 
    65565237                        return $credits[$key]; 
    6557                 } 
    6558                 else 
    6559                 { 
     5238                } else { 
    65605239                        return null; 
    65615240                } 
     
    65645243        function get_credits() 
    65655244        { 
    6566                 if ($this->credits !== null) 
    6567                 { 
     5245                if ($this->credits !== null) { 
    65685246                        return $this->credits; 
    6569                 } 
    6570                 else 
    6571                 { 
     5247                } else { 
    65725248                        return null; 
    65735249                } 
     
    65765252        function get_description() 
    65775253        { 
    6578                 if ($this->description !== null) 
    6579                 { 
     5254                if ($this->description !== null) { 
    65805255                        return $this->description; 
    6581                 } 
    6582                 else 
    6583                 { 
     5256                } else { 
    65845257                        return null; 
    65855258                } 
     
    65885261        function get_duration($convert = false) 
    65895262        { 
    6590                 if ($this->duration !== null) 
    6591                 { 
    6592                         if ($convert) 
    6593                         { 
     5263                if ($this->duration !== null) { 
     5264                        if ($convert) { 
    65945265                                $time = SimplePie_Misc::time_hms($this->duration); 
    65955266                                return $time; 
    6596                         } 
    6597                         else 
    6598                         { 
     5267                        } else { 
    65995268                                return $this->duration; 
    66005269                        } 
    6601                 } 
    6602                 else 
    6603                 { 
     5270                } else { 
    66045271                        return null; 
    66055272                } 
     
    66085275        function get_expression() 
    66095276        { 
    6610                 if ($this->expression !== null) 
    6611                 { 
     5277                if ($this->expression !== null) { 
    66125278                        return $this->expression; 
    6613                 } 
    6614                 else 
    6615                 { 
     5279                } else { 
    66165280                        return 'full'; 
    66175281                } 
     
    66205284        function get_extension() 
    66215285        { 
    6622                 if ($this->link !== null) 
    6623                 { 
     5286                if ($this->link !== null) { 
    66245287                        $url = SimplePie_Misc::parse_url($this->link); 
    6625                         if ($url['path'] !== '') 
    6626                         { 
     5288                        if ($url['path'] !== '') { 
    66275289                                return pathinfo($url['path'], PATHINFO_EXTENSION); 
    66285290                        } 
     
    66335295        function get_framerate() 
    66345296        { 
    6635                 if ($this->framerate !== null) 
    6636                 { 
     5297                if ($this->framerate !== null) { 
    66375298                        return $this->framerate; 
    6638                 } 
    6639                 else 
    6640                 { 
     5299                } else { 
    66415300                        return null; 
    66425301                } 
     
    66515310        { 
    66525311                $hashes = $this->get_hashes(); 
    6653                 if (isset($hashes[$key])) 
    6654                 { 
     5312                if (isset($hashes[$key])) { 
    66555313                        return $hashes[$key]; 
    6656                 } 
    6657                 else 
    6658                 { 
     5314                } else { 
    66595315                        return null; 
    66605316                } 
     
    66635319        function get_hashes() 
    66645320        { 
    6665                 if ($this->hashes !== null) 
    6666                 { 
     5321                if ($this->hashes !== null) { 
    66675322                        return $this->hashes; 
    6668                 } 
    6669                 else 
    6670                 { 
     5323                } else { 
    66715324                        return null; 
    66725325                } 
     
    66755328        function get_height() 
    66765329        { 
    6677                 if ($this->height !== null) 
    6678                 { 
     5330                if ($this->height !== null) { 
    66795331                        return $this->height; 
    6680                 } 
    6681                 else 
    6682                 { 
     5332                } else { 
    66835333                        return null; 
    66845334                } 
     
    66875337        function get_language() 
    66885338        { 
    6689                 if ($this->lang !== null) 
    6690                 { 
     5339                if ($this->lang !== null) { 
    66915340                        return $this->lang; 
    6692                 } 
    6693                 else 
    6694                 { 
     5341                } else { 
    66955342                        return null; 
    66965343                } 
     
    67005347        { 
    67015348                $keywords = $this->get_keywords(); 
    6702                 if (isset($keywords[$key])) 
    6703                 { 
     5349                if (isset($keywords[$key])) { 
    67045350                        return $keywords[$key]; 
    6705                 } 
    6706                 else 
    6707                 { 
     5351                } else { 
    67085352                        return null; 
    67095353                } 
     
    67125356        function get_keywords() 
    67135357        { 
    6714                 if ($this->keywords !== null) 
    6715                 { 
     5358                if ($this->keywords !== null) { 
    67165359                        return $this->keywords; 
    6717                 } 
    6718                 else 
    6719                 { 
     5360                } else { 
    67205361                        return null; 
    67215362                } 
     
    67245365        function get_length() 
    67255366        { 
    6726                 if ($this->length !== null) 
    6727                 { 
     5367                if ($this->length !== null) { 
    67285368                        return $this->length; 
    6729                 } 
    6730                 else 
    6731                 { 
     5369                } else { 
    67325370                        return null; 
    67335371                } 
     
    67365374        function get_link() 
    67375375        { 
    6738                 if ($this->link !== null) 
    6739                 { 
     5376                if ($this->link !== null) { 
    67405377                        return urldecode($this->link); 
    6741                 } 
    6742                 else 
    6743                 { 
     5378                } else { 
    67445379                        return null; 
    67455380                } 
     
    67485383        function get_medium() 
    67495384        { 
    6750                 if ($this->medium !== null) 
    6751                 { 
     5385                if ($this->medium !== null) { 
    67525386                        return $this->medium; 
    6753                 } 
    6754                 else 
    6755                 { 
     5387                } else { 
    67565388                        return null; 
    67575389                } 
     
    67605392        function get_player() 
    67615393        { 
    6762                 if ($this->player !== null) 
    6763                 { 
     5394                if ($this->player !== null) { 
    67645395                        return $this->player; 
    6765                 } 
    6766                 else 
    6767                 { 
     5396                } else { 
    67685397                        return null; 
    67695398                } 
     
    67735402        { 
    67745403                $ratings = $this->get_ratings(); 
    6775                 if (isset($ratings[$key])) 
    6776                 { 
     5404                if (isset($ratings[$key])) { 
    67775405                        return $ratings[$key]; 
    6778                 } 
    6779                 else 
    6780                 { 
     5406                } else { 
    67815407                        return null; 
    67825408                } 
     
    67855411        function get_ratings() 
    67865412        { 
    6787                 if ($this->ratings !== null) 
    6788                 { 
     5413                if ($this->ratings !== null) { 
    67895414                        return $this->ratings; 
    6790                 } 
    6791                 else 
    6792                 { 
     5415                } else { 
    67935416                        return null; 
    67945417                } 
     
    67985421        { 
    67995422                $restrictions = $this->get_restrictions(); 
    6800                 if (isset($restrictions[$key])) 
    6801                 { 
     5423                if (isset($restrictions[$key])) { 
    68025424                        return $restrictions[$key]; 
    6803                 } 
    6804                 else 
    6805                 { 
     5425                } else { 
    68065426                        return null; 
    68075427                } 
     
    68105430        function get_restrictions() 
    68115431        { 
    6812                 if ($this->restrictions !== null) 
    6813                 { 
     5432                if ($this->restrictions !== null) { 
    68145433                        return $this->restrictions; 
    6815                 } 
    6816                 else 
    6817                 { 
     5434                } else { 
    68185435                        return null; 
    68195436                } 
     
    68225439        function get_sampling_rate() 
    68235440        { 
    6824                 if ($this->samplingrate !== null) 
    6825                 { 
     5441                if ($this->samplingrate !== null) { 
    68265442                        return $this->samplingrate; 
    6827                 } 
    6828                 else 
    6829                 { 
     5443                } else { 
    68305444                        return null; 
    68315445                } 
     
    68355449        { 
    68365450                $length = $this->get_length(); 
    6837                 if ($length !== null) 
    6838                 { 
    6839                         return round($length/1048576, 2); 
    6840                 } 
    6841                 else 
    6842                 { 
     5451                if ($length !== null) { 
     5452                        return round($length / 1048576, 2); 
     5453                } else { 
    68435454                        return null; 
    68445455                } 
     
    68485459        { 
    68495460                $thumbnails = $this->get_thumbnails(); 
    6850                 if (isset($thumbnails[$key])) 
    6851                 { 
     5461                if (isset($thumbnails[$key])) { 
    68525462                        return $thumbnails[$key]; 
    6853                 } 
    6854                 else 
    6855                 { 
     5463                } else { 
    68565464                        return null; 
    68575465                } 
     
    68605468        function get_thumbnails() 
    68615469        { 
    6862                 if ($this->thumbnails !== null) 
    6863                 { 
     5470                if ($this->thumbnails !== null) { 
    68645471                        return $this->thumbnails; 
    6865                 } 
    6866                 else 
    6867                 { 
     5472                } else { 
    68685473                        return null; 
    68695474                } 
     
    68725477        function get_title() 
    68735478        { 
    6874                 if ($this->title !== null) 
    6875                 { 
     5479                if ($this->title !== null) { 
    68765480                        return $this->title; 
    6877                 } 
    6878                 else 
    6879                 { 
     5481                } else { 
    68805482                        return null; 
    68815483                } 
     
    68845486        function get_type() 
    68855487        { 
    6886                 if ($this->type !== null) 
    6887                 { 
     5488                if ($this->type !== null) { 
    68885489                        return $this->type; 
    6889                 } 
    6890                 else 
    6891                 { 
     5490                } else { 
    68925491                        return null; 
    68935492                } 
     
    68965495        function get_width() 
    68975496        { 
    6898                 if ($this->width !== null) 
    6899                 { 
     5497                if ($this->width !== null) { 
    69005498                        return $this->width; 
    6901                 } 
    6902                 else 
    6903                 { 
     5499                } else { 
    69045500                        return null; 
    69055501                } 
     
    69315527 
    69325528                // Process options and reassign values as necessary 
    6933                 if (is_array($options)) 
    6934                 { 
     5529                if (is_array($options)) { 
    69355530                        extract($options); 
    6936                 } 
    6937                 else 
    6938                 { 
     5531                } else { 
    69395532                        $options = explode(',', $options); 
    6940                         foreach($options as $option) 
    6941                         { 
     5533                        foreach ($options as $option) { 
    69425534                                $opt = explode(':', $option, 2); 
    6943                                 if (isset($opt[0], $opt[1])) 
    6944                                 { 
     5535                                if (isset($opt[0], $opt[1])) { 
    69455536                                        $opt[0] = trim($opt[0]); 
    69465537                                        $opt[1] = trim($opt[1]); 
    6947                                         switch ($opt[0]) 
    6948                                         { 
     5538                                        switch ($opt[0]) { 
    69495539                                                case 'audio': 
    69505540                                                        $audio = $opt[1]; 
     
    69955585 
    69965586                // Process values for 'auto' 
    6997                 if ($width === 'auto') 
    6998                 { 
    6999                         if ($mime === 'video') 
    7000                         { 
    7001                                 if ($height === 'auto') 
    7002                                 { 
     5587                if ($width === 'auto') { 
     5588                        if ($mime === 'video') { 
     5589                                if ($height === 'auto') { 
    70035590                                        $width = 480; 
    7004                                 } 
    7005                                 elseif ($widescreen) 
    7006                                 { 
    7007                                         $width = round((intval($height)/9)*16); 
    7008                                 } 
    7009                                 else 
    7010                                 { 
    7011                                         $width = round((intval($height)/3)*4); 
    7012                                 } 
    7013                         } 
    7014                         else 
    7015                         { 
     5591                                } elseif ($widescreen) { 
     5592                                        $width = round((intval($height) / 9) * 16); 
     5593                                } else { 
     5594                                        $width = round((intval($height) / 3) * 4); 
     5595                                } 
     5596                        } else { 
    70165597                                $width = '100%'; 
    70175598                        } 
    70185599                } 
    70195600 
    7020                 if ($height === 'auto') 
    7021                 { 
    7022                         if ($mime === 'audio') 
    7023                         { 
     5601                if ($height === 'auto') { 
     5602                        if ($mime === 'audio') { 
    70245603                                $height = 0; 
    7025                         } 
    7026                         elseif ($mime === 'video') 
    7027                         { 
    7028                                 if ($width === 'auto') 
    7029                                 { 
    7030                                         if ($widescreen) 
    7031                                         { 
     5604                        } elseif ($mime === 'video') { 
     5605                                if ($width === 'auto') { 
     5606                                        if ($widescreen) { 
    70325607                                                $height = 270; 
    7033                                         } 
    7034                                         else 
    7035                                         { 
     5608                                        } else { 
    70365609                                                $height = 360; 
    70375610                                        } 
    7038                                 } 
    7039                                 elseif ($widescreen) 
    7040                                 { 
    7041                                         $height = round((intval($width)/16)*9); 
    7042                                 } 
    7043                                 else 
    7044                                 { 
    7045                                         $height = round((intval($width)/4)*3); 
    7046                                 } 
    7047                         } 
    7048                         else 
    7049                         { 
     5611                                } elseif ($widescreen) { 
     5612                                        $height = round((intval($width) / 16) * 9); 
     5613                                } else { 
     5614                                        $height = round((intval($width) / 4) * 3); 
     5615                                } 
     5616                        } else { 
    70505617                                $height = 376; 
    70515618                        } 
    7052                 } 
    7053                 elseif ($mime === 'audio') 
    7054                 { 
     5619                } elseif ($mime === 'audio') { 
    70555620                        $height = 0; 
    70565621                } 
    70575622 
    70585623                // Set proper placeholder value 
    7059                 if ($mime === 'audio') 
    7060                 { 
     5624                if ($mime === 'audio') { 
    70615625                        $placeholder = $audio; 
    7062                 } 
    7063                 elseif ($mime === 'video') 
    7064                 { 
     5626                } elseif ($mime === 'video') { 
    70655627                        $placeholder = $video; 
    70665628                } 
     
    70695631 
    70705632                // Make sure the JS library is included 
    7071                 if (!$native) 
    7072                 { 
     5633                if (!$native) { 
    70735634                        static $javascript_outputted = null; 
    7074                         if (!$javascript_outputted && $this->javascript) 
    7075                         { 
    7076                                 $embed .= '<script type="text/javascript" src="?' . htmlspecialchars($this->javascript) . '"></script>'; 
     5635                        if (!$javascript_outputted && $this->javascript) { 
     5636                                $embed .= '<script type="text/javascript" src="?'.htmlspecialchars($this->javascript).'"></script>'; 
    70775637                                $javascript_outputted = true; 
    70785638                        } 
     
    70805640 
    70815641                // Odeo Feed MP3's 
    7082                 if ($handler === 'odeo') 
    7083                 { 
    7084                         if ($native) 
    7085                         { 
    7086                                 $embed .= '<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://adobe.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url=' . $this->get_link() . '"></embed>'; 
    7087                         } 
    7088                         else 
    7089                         { 
    7090                                 $embed .= '<script type="text/javascript">embed_odeo("' . $this->get_link() . '");</script>'; 
     5642                if ($handler === 'odeo') { 
     5643                        if ($native) { 
     5644                                $embed .= '<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://adobe.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='.$this->get_link().'"></embed>'; 
     5645                        } else { 
     5646                                $embed .= '<script type="text/javascript">embed_odeo("'.$this->get_link().'");</script>'; 
    70915647                        } 
    70925648                } 
    70935649 
    70945650                // Flash 
    7095                 elseif ($handler === 'flash') 
    7096                 { 
    7097                         if ($native) 
    7098                         { 
    7099                                 $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>"; 
    7100                         } 
    7101                         else 
    7102                         { 
    7103                                 $embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>"; 
     5651                elseif ($handler === 'flash') { 
     5652                        if ($native) { 
     5653                                $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>"; 
     5654                        } else { 
     5655                                $embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '".$this->get_link()."', '$loop', '$type');</script>"; 
    71045656                        } 
    71055657                } 
     
    71075659                // Flash Media Player file types. 
    71085660                // Preferred handler for MP3 file types. 
    7109                 elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== '')) 
    7110                 { 
     5661                elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== '')) { 
    71115662                        $height += 20; 
    7112                         if ($native) 
    7113                         { 
    7114                                 $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>"; 
    7115                         } 
    7116                         else 
    7117                         { 
    7118                                 $embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>"; 
     5663                        if ($native) { 
     5664                                $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>"; 
     5665                        } else { 
     5666                                $embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '".rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension())."', '$placeholder', '$loop', '$mediaplayer');</script>"; 
    71195667                        } 
    71205668                } 
     
    71225670                // QuickTime 7 file types.  Need to test with QuickTime 6. 
    71235671                // Only handle MP3's if the Flash Media Player is not present. 
    7124                 elseif ($handler === 'quicktime' || ($handler === 'mp3' && $mediaplayer === '')) 
    7125                 { 
     5672                elseif ($handler === 'quicktime' || ($handler === 'mp3' && $mediaplayer === '')) { 
    71265673                        $height += 16; 
    7127                         if ($native) 
    7128                         { 
    7129                                 if ($placeholder !== '') 
    7130                                 { 
    7131                                         $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>"; 
    7132                                 } 
    7133                                 else 
    7134                                 { 
    7135                                         $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>"; 
    7136                                 } 
    7137                         } 
    7138                         else 
    7139                         { 
    7140                                 $embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>"; 
     5674                        if ($native) { 
     5675                                if ($placeholder !== '') { 
     5676                                        $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>"; 
     5677                                } else { 
     5678                                        $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>"; 
     5679                                } 
     5680                        } else { 
     5681                                $embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '".$this->get_link()."', '$placeholder', '$loop');</script>"; 
    71415682                        } 
    71425683                } 
    71435684 
    71445685                // Windows Media 
    7145                 elseif ($handler === 'wmedia') 
    7146                 { 
     5686                elseif ($handler === 'wmedia') { 
    71475687                        $height += 45; 
    7148                         if ($native) 
    7149                         { 
    7150                                 $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>"; 
    7151                         } 
    7152                         else 
    7153                         { 
    7154                                 $embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>"; 
     5688                        if ($native) { 
     5689                                $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>"; 
     5690                        } else { 
     5691                                $embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '".$this->get_link()."');</script>"; 
    71555692                        } 
    71565693                } 
    71575694 
    71585695                // Everything else 
    7159                 else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>'; 
     5696                else 
     5697                        $embed .= '<a href="'.$this->get_link().'" class="'.$altclass.'">'.$alt.'</a>'; 
    71605698 
    71615699                return $embed; 
     
    71655703        { 
    71665704                // If it's Odeo, let's get it out of the way. 
    7167                 if (substr(strtolower($this->get_link()), 0, 15) === 'http://odeo.com') 
    7168                 { 
     5705                if (substr(strtolower($this->get_link()), 0, 15) === 'http://odeo.com') { 
    71695706                        return 'odeo'; 
    71705707                } 
     
    71725709                // Mime-types by handler. 
    71735710                $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash 
    7174                 $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player 
     5711                $types_fmedia = array('video/flv', 'video/x-flv', 'flv-application/octet-stream'); // Flash Media Player 
    71755712                $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 
    71765713                $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 
    71775714                $types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3 
    71785715 
    7179                 if ($this->get_type() !== null) 
    7180                 { 
     5716                if ($this->get_type() !== null) { 
    71815717                        $type = strtolower($this->type); 
    7182                 } 
    7183                 else 
    7184                 { 
     5718                } else { 
    71855719                        $type = null; 
    71865720                } 
    71875721 
    71885722                // If we encounter an unsupported mime-type, check the file extension and guess intelligently. 
    7189                 if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3))) 
    7190                 { 
    7191                         switch (strtolower($this->get_extension())) 
    7192                         { 
     5723                if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3))) { 
     5724                        switch (strtolower($this->get_extension())) { 
    71935725                                // Audio mime-types 
    71945726                                case 'aac': 
     
    73105842                } 
    73115843 
    7312                 if ($find_handler) 
    7313                 { 
    7314                         if (in_array($type, $types_flash)) 
    7315                         { 
     5844                if ($find_handler) { 
     5845                        if (in_array($type, $types_flash)) { 
    73165846                                return 'flash'; 
    7317                         } 
    7318                         elseif (in_array($type, $types_fmedia)) 
    7319                         { 
     5847                        } elseif (in_array($type, $types_fmedia)) { 
    73205848                                return 'fmedia'; 
    7321                         } 
    7322                         elseif (in_array($type, $types_quicktime)) 
    7323                         { 
     5849                        } elseif (in_array($type, $types_quicktime)) { 
    73245850                                return 'quicktime'; 
    7325                         } 
    7326                         elseif (in_array($type, $types_wmedia)) 
    7327                         { 
     5851                        } elseif (in_array($type, $types_wmedia)) { 
    73285852                                return 'wmedia'; 
    7329                         } 
    7330                         elseif (in_array($type, $types_mp3)) 
    7331                         { 
     5853                        } elseif (in_array($type, $types_mp3)) { 
    73325854                                return 'mp3'; 
    7333                         } 
    7334                         else 
    7335                         { 
     5855                        } else { 
    73365856                                return null; 
    73375857                        } 
    7338                 } 
    7339                 else 
    7340                 { 
     5858                } else { 
    73415859                        return $type; 
    73425860                } 
    73435861        } 
     5862 
    73445863} 
    73455864 
    73465865class SimplePie_Caption 
    73475866{ 
     5867 
    73485868        var $type; 
    73495869        var $lang; 
     
    73705890        function get_endtime() 
    73715891        { 
    7372                 if ($this->endTime !== null) 
    7373                 { 
     5892                if ($this->endTime !== null) { 
    73745893                        return $this->endTime; 
    7375                 } 
    7376                 else 
    7377                 { 
     5894                } else { 
    73785895                        return null; 
    73795896                } 
     
    73825899        function get_language() 
    73835900        { 
    7384                 if ($this->lang !== null) 
    7385                 { 
     5901                if ($this->lang !== null) { 
    73865902                        return $this->lang; 
    7387                 } 
    7388                 else 
    7389                 { 
     5903                } else { 
    73905904                        return null; 
    73915905                } 
     
    73945908        function get_starttime() 
    73955909        { 
    7396                 if ($this->startTime !== null) 
    7397                 { 
     5910                if ($this->startTime !== null) { 
    73985911                        return $this->startTime; 
    7399                 } 
    7400                 else 
    7401                 { 
     5912                } else { 
    74025913                        return null; 
    74035914                } 
     
    74065917        function get_text() 
    74075918        { 
    7408                 if ($this->text !== null) 
    7409                 { 
     5919                if ($this->text !== null) { 
    74105920                        return $this->text; 
    7411                 } 
    7412                 else 
    7413                 { 
     5921                } else { 
    74145922                        return null; 
    74155923                } 
     
    74185926        function get_type() 
    74195927        { 
    7420                 if ($this->type !== null) 
    7421                 { 
     5928                if ($this->type !== null) { 
    74225929                        return $this->type; 
    7423                 } 
    7424                 else 
    7425                 { 
     5930                } else { 
    74265931                        return null; 
    74275932                } 
    74285933        } 
     5934 
    74295935} 
    74305936 
    74315937class SimplePie_Credit 
    74325938{ 
     5939 
    74335940        var $role; 
    74345941        var $scheme; 
     
    74515958        function get_role() 
    74525959        { 
    7453                 if ($this->role !== null) 
    7454                 { 
     5960                if ($this->role !== null) { 
    74555961                        return $this->role; 
    7456                 } 
    7457                 else 
    7458                 { 
     5962                } else { 
    74595963                        return null; 
    74605964                } 
     
    74635967        function get_scheme() 
    74645968        { 
    7465                 if ($this->scheme !== null) 
    7466                 { 
     5969                if ($this->scheme !== null) { 
    74675970                        return $this->scheme; 
    7468                 } 
    7469                 else 
    7470                 { 
     5971                } else { 
    74715972                        return null; 
    74725973                } 
     
    74755976        function get_name() 
    74765977        { 
    7477                 if ($this->name !== null) 
    7478                 { 
     5978                if ($this->name !== null) { 
    74795979                        return $this->name; 
    7480                 } 
    7481                 else 
    7482                 { 
     5980                } else { 
    74835981                        return null; 
    74845982                } 
    74855983        } 
     5984 
    74865985} 
    74875986 
    74885987class SimplePie_Copyright 
    74895988{ 
     5989 
    74905990        var $url; 
    74915991        var $label; 
     
    75066006        function get_url() 
    75076007        { 
    7508                 if ($this->url !== null) 
    7509                 { 
     6008                if ($this->url !== null) { 
    75106009                        return $this->url; 
    7511                 } 
    7512                 else 
    7513                 { 
     6010                } else { 
    75146011                        return null; 
    75156012                } 
     
    75186015        function get_attribution() 
    75196016        { 
    7520                 if ($this->label !== null) 
    7521                 { 
     6017                if ($this->label !== null) { 
    75226018                        return $this->label; 
    7523                 } 
    7524                 else 
    7525                 { 
     6019                } else { 
    75266020                        return null; 
    75276021                } 
    75286022        } 
     6023 
    75296024} 
    75306025 
    75316026class SimplePie_Rating 
    75326027{ 
     6028 
    75336029        var $scheme; 
    75346030        var $value; 
     
    75496045        function get_scheme() 
    75506046        { 
    7551                 if ($this->scheme !== null) 
    7552                 { 
     6047                if ($this->scheme !== null) { 
    75536048                        return $this->scheme; 
    7554                 } 
    7555                 else 
    7556                 { 
     6049                } else { 
    75576050                        return null; 
    75586051                } 
     
    75616054        function get_value() 
    75626055        { 
    7563                 if ($this->value !== null) 
    7564                 { 
     6056                if ($this->value !== null) { 
    75656057                        return $this->value; 
    7566                 } 
    7567                 else 
    7568                 { 
     6058                } else { 
    75696059                        return null; 
    75706060                } 
    75716061        } 
     6062 
    75726063} 
    75736064 
    75746065class SimplePie_Restriction 
    75756066{ 
     6067 
    75766068        var $relationship; 
    75776069        var $type; 
     
    75946086        function get_relationship() 
    75956087        { 
    7596                 if ($this->relationship !== null) 
    7597                 { 
     6088                if ($this->relationship !== null) { 
    75986089                        return $this->relationship; 
    7599                 } 
    7600                 else 
    7601                 { 
     6090                } else { 
    76026091                        return null; 
    76036092                } 
     
    76066095        function get_type() 
    76076096        { 
    7608                 if ($this->type !== null) 
    7609                 { 
     6097                if ($this->type !== null) { 
    76106098                        return $this->type; 
    7611                 } 
    7612                 else 
    7613                 { 
     6099                } else { 
    76146100                        return null; 
    76156101                } 
     
    76186104        function get_value() 
    76196105        { 
    7620                 if ($this->value !== null) 
    7621                 { 
     6106                if ($this->value !== null) { 
    76226107                        return $this->value; 
    7623                 } 
    7624                 else 
    7625                 { 
     6108                } else { 
    76266109                        return null; 
    76276110                } 
    76286111        } 
     6112 
    76296113} 
    76306114 
     
    76346118class SimplePie_File 
    76356119{ 
     6120 
    76366121        var $url; 
    76376122        var $useragent; 
     
    76466131        function SimplePie_File($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) 
    76476132        { 
    7648                 if (class_exists('idna_convert')) 
    7649                 { 
     6133                if (class_exists('idna_convert')) { 
    76506134                        $idn = new idna_convert; 
    76516135                        $parsed = SimplePie_Misc::parse_url($url); 
     
    76546138                $this->url = $url; 
    76556139                $this->useragent = $useragent; 
    7656                 if (preg_match('/^http(s)?:\/\//i', $url)) 
    7657                 { 
    7658                         if ($useragent === null) 
    7659                         { 
     6140                if (preg_match('/^http(s)?:\/\//i', $url)) { 
     6141                        if ($useragent === null) { 
    76606142                                $useragent = ini_get('user_agent'); 
    76616143                                $this->useragent = $useragent; 
    76626144                        } 
    7663                         if (!is_array($headers)) 
    7664                         { 
     6145                        if (!is_array($headers)) { 
    76656146                                $headers = array(); 
    76666147                        } 
    7667                         if (!$force_fsockopen && function_exists('curl_exec')) 
    7668                         { 
     6148                        if (!$force_fsockopen && function_exists('curl_exec')) { 
    76696149                                $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL; 
    76706150                                $fp = curl_init(); 
    76716151                                $headers2 = array(); 
    7672                                 foreach ($headers as $key => $value) 
    7673                                 { 
     6152                                foreach ($headers as $key => $value) { 
    76746153                                        $headers2[] = "$key: $value"; 
    76756154                                } 
    7676                                 if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>=')) 
    7677                                 { 
     6155                                if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>=')) { 
    76786156                                        curl_setopt($fp, CURLOPT_ENCODING, ''); 
    76796157                                } 
     
    76866164                                curl_setopt($fp, CURLOPT_USERAGENT, $useragent); 
    76876165                                curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2); 
    7688                                 if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>=')) 
    7689                                 { 
     6166                                if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>=')) { 
    76906167                                        curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1); 
    76916168                                        curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects); 
     
    76936170 
    76946171                                $this->headers = curl_exec($fp); 
    7695                                 if (curl_errno($fp) === 23 || curl_errno($fp) === 61) 
    7696                                 { 
     6172                                if (curl_errno($fp) === 23 || curl_errno($fp) === 61) { 
    76976173                                        curl_setopt($fp, CURLOPT_ENCODING, 'none'); 
    76986174                                        $this->headers = curl_exec($fp); 
    76996175                                } 
    7700                                 if (curl_errno($fp)) 
    7701                                 { 
    7702                                         $this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp); 
     6176                                if (curl_errno($fp)) { 
     6177                                        $this->error = 'cURL error '.curl_errno($fp).': '.curl_error($fp); 
    77036178                                        $this->success = false; 
    7704                                 } 
    7705                                 else 
    7706                                 { 
     6179                                } else { 
    77076180                                        $info = curl_getinfo($fp); 
    77086181                                        curl_close($fp); 
     
    77106183                                        $this->headers = array_pop($this->headers); 
    77116184                                        $parser = new SimplePie_HTTP_Parser($this->headers); 
    7712                                         if ($parser->parse()) 
    7713                                         { 
     6185                                        if ($parser->parse()) { 
    77146186                                                $this->headers = $parser->headers; 
    77156187                                                $this->body = $parser->body; 
    77166188                                                $this->status_code = $parser->status_code; 
    7717                                                 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) 
    7718                                                 { 
     6189                                                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) { 
    77196190                                                        $this->redirects++; 
    77206191                                                        $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); 
     
    77236194                                        } 
    77246195                                } 
    7725                         } 
    7726                         else 
    7727                         { 
     6196                        } else { 
    77286197                                $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN; 
    77296198                                $url_parts = parse_url($url); 
    7730                                 if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https') 
    7731                                 { 
     6199                                if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https') { 
    77326200                                        $url_parts['host'] = "ssl://$url_parts[host]"; 
    77336201                                        $url_parts['port'] = 443; 
    77346202                                } 
    7735                                 if (!isset($url_parts['port'])) 
    7736                                 { 
     6203                                if (!isset($url_parts['port'])) { 
    77376204                                        $url_parts['port'] = 80; 
    77386205                                } 
    77396206                                $fp = @fsockopen($url_parts['host'], $url_parts['port'], $errno, $errstr, $timeout); 
    7740                                 if (!$fp) 
    7741                                 { 
    7742                                         $this->error = 'fsockopen error: ' . $errstr; 
     6207                                if (!$fp) { 
     6208                                        $this->error = 'fsockopen error: '.$errstr; 
    77436209                                        $this->success = false; 
    7744                                 } 
    7745                                 else 
    7746                                 { 
     6210                                } else { 
    77476211                                        stream_set_timeout($fp, $timeout); 
    7748                                         if (isset($url_parts['path'])) 
    7749                                         { 
    7750                                                 if (isset($url_parts['query'])) 
    7751                                                 { 
     6212                                        if (isset($url_parts['path'])) { 
     6213                                                if (isset($url_parts['query'])) { 
    77526214                                                        $get = "$url_parts[path]?$url_parts[query]"; 
    7753                                                 } 
    7754                                                 else 
    7755                                                 { 
     6215                                                } else { 
    77566216                                                        $get = $url_parts['path']; 
    77576217                                                } 
    7758                                         } 
    7759                                         else 
    7760                                         { 
     6218                                        } else { 
    77616219                                                $get = '/'; 
    77626220                                        } 
     
    77646222                                        $out .= "Host: $url_parts[host]\r\n"; 
    77656223                                        $out .= "User-Agent: $useragent\r\n"; 
    7766                                         if (extension_loaded('zlib')) 
    7767                                         { 
     6224                                        if (extension_loaded('zlib')) { 
    77686225                                                $out .= "Accept-Encoding: x-gzip,gzip,deflate\r\n"; 
    77696226                                        } 
    77706227 
    7771                                         if (isset($url_parts['user']) && isset($url_parts['pass'])) 
    7772                                         { 
    7773                                                 $out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n"; 
     6228                                        if (isset($url_parts['user']) && isset($url_parts['pass'])) { 
     6229                                                $out .= "Authorization: Basic ".base64_encode("$url_parts[user]:$url_parts[pass]")."\r\n"; 
    77746230                                        } 
    7775                                         foreach ($headers as $key => $value) 
    7776                                         { 
     6231                                        foreach ($headers as $key => $value) { 
    77776232                                                $out .= "$key: $value\r\n"; 
    77786233                                        } 
     
    77836238 
    77846239                                        $this->headers = ''; 
    7785                                         while (!$info['eof'] && !$info['timed_out']) 
    7786                                         { 
     6240                                        while (!$info['eof'] && !$info['timed_out']) { 
    77876241                                                $this->headers .= fread($fp, 1160); 
    77886242                                                $info = stream_get_meta_data($fp); 
    77896243                                        } 
    7790                                         if (!$info['timed_out']) 
    7791                                         { 
     6244                                        if (!$info['timed_out']) { 
    77926245                                                $parser = new SimplePie_HTTP_Parser($this->headers); 
    7793                                                 if ($parser->parse()) 
    7794                                                 { 
     6246                                                if ($parser->parse()) { 
    77956247                                                        $this->headers = $parser->headers; 
    77966248                                                        $this->body = $parser->body; 
    77976249                                                        $this->status_code = $parser->status_code; 
    7798                                                         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) 
    7799                                                         { 
     6250                                                        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) { 
    78006251                                                                $this->redirects++; 
    78016252                                                                $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); 
    78026253                                                                return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); 
    78036254                                                        } 
    7804                                                         if (isset($this->headers['content-encoding'])) 
    7805                                                         { 
     6255                                                        if (isset($this->headers['content-encoding'])) { 
    78066256                                                                // Hey, we act dumb elsewhere, so let's do that here too 
    7807                                                                 switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20"))) 
    7808                                                                 { 
     6257                                                                switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20"))) { 
    78096258                                                                        case 'gzip': 
    78106259                                                                        case 'x-gzip': 
    78116260                                                                                $decoder = new SimplePie_gzdecode($this->body); 
    7812                                                                                 if (!$decoder->parse()) 
    7813                                                                                 { 
     6261                                                                                if (!$decoder->parse()) { 
    78146262                                                                                        $this->error = 'Unable to decode HTTP "gzip" stream'; 
    78156263                                                                                        $this->success = false; 
    7816                                                                                 } 
    7817                                                                                 else 
    7818                                                                                 { 
     6264                                                                                } else { 
    78196265                                                                                        $this->body = $decoder->data; 
    78206266                                                                                } 
     
    78226268 
    78236269                                                                        case 'deflate': 
    7824                                                                                 if (($body = gzuncompress($this->body)) === false) 
    7825                                                                                 { 
    7826                                                                                         if (($body = gzinflate($this->body)) === false) 
    7827                                                                                         { 
     6270                                                                                if (($body = gzuncompress($this->body)) === false) { 
     6271                                                                                        if (($body = gzinflate($this->body)) === false) { 
    78286272                                                                                                $this->error = 'Unable to decode HTTP "deflate" stream'; 
    78296273                                                                                                $this->success = false; 
     
    78396283                                                        } 
    78406284                                                } 
    7841                                         } 
    7842                                         else 
    7843                                         { 
     6285                                        } else { 
    78446286                                                $this->error = 'fsocket timed out'; 
    78456287                                                $this->success = false; 
     
    78486290                                } 
    78496291                        } 
    7850                 } 
    7851                 else 
    7852                 { 
     6292                } else { 
    78536293                        $this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS; 
    7854                         if (!$this->body = file_get_contents($url)) 
    7855                         { 
     6294                        if (!$this->body = file_get_contents($url)) { 
    78566295                                $this->error = 'file_get_contents could not read the file'; 
    78576296                                $this->success = false; 
     
    78596298                } 
    78606299        } 
     6300 
    78616301} 
    78626302 
     
    78686308class SimplePie_HTTP_Parser 
    78696309{ 
     6310 
    78706311        /** 
    78716312         * HTTP Version 
     
    78756316         */ 
    78766317        var $http_version = 0.0; 
    7877  
    78786318        /** 
    78796319         * Status code 
     
    78836323         */ 
    78846324        var $status_code = 0; 
    7885  
    78866325        /** 
    78876326         * Reason phrase 
     
    78916330         */ 
    78926331        var $reason = ''; 
    7893  
    78946332        /** 
    78956333         * Key/value pairs of the headers 
     
    78996337         */ 
    79006338        var $headers = array(); 
    7901  
    79026339        /** 
    79036340         * Body of the response 
     
    79076344         */ 
    79086345        var $body = ''; 
    7909  
    79106346        /** 
    79116347         * Current state of the state machine 
     
    79156351         */ 
    79166352        var $state = 'http_version'; 
    7917  
    79186353        /** 
    79196354         * Input data 
     
    79236358         */ 
    79246359        var $data = ''; 
    7925  
    79266360        /** 
    79276361         * Input data length (to avoid calling strlen() everytime this is needed) 
     
    79316365         */ 
    79326366        var $data_length = 0; 
    7933  
    79346367        /** 
    79356368         * Current position of the pointer 
     
    79396372         */ 
    79406373        var $position = 0; 
    7941  
    79426374        /** 
    79436375         * Name of the hedaer currently being parsed 
     
    79476379         */ 
    79486380        var $name = ''; 
    7949  
    79506381        /** 
    79516382         * Value of the hedaer currently being parsed 
     
    79766407        function parse() 
    79776408        { 
    7978                 while ($this->state && $this->state !== 'emit' && $this->has_data()) 
    7979                 { 
     6409                while ($this->state && $this->state !== 'emit' && $this->has_data()) { 
    79806410                        $state = $this->state; 
    79816411                        $this->$state(); 
    79826412                } 
    79836413                $this->data = ''; 
    7984                 if ($this->state === 'emit' || $this->state === 'body') 
    7985                 { 
     6414                if ($this->state === 'emit' || $this->state === 'body') { 
    79866415                        return true; 
    7987                 } 
    7988                 else 
    7989                 { 
     6416                } else { 
    79906417                        $this->http_version = ''; 
    79916418                        $this->status_code = ''; 
     
    80176444        { 
    80186445                return (bool) ($this->data[$this->position] === "\x09" 
    8019                         || $this->data[$this->position] === "\x20" 
    8020                         || ($this->data[$this->position] === "\x0A" 
    8021                                 && isset($this->data[$this->position + 1]) 
    8022                                 && ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20"))); 
     6446                || $this->data[$this->position] === "\x20" 
     6447                || ($this->data[$this->position] === "\x0A" 
     6448                && isset($this->data[$this->position + 1]) 
     6449                && ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20"))); 
    80236450        } 
    80246451 
     
    80306457        function http_version() 
    80316458        { 
    8032                 if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/') 
    8033                 { 
     6459                if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/') { 
    80346460                        $len = strspn($this->data, '0123456789.', 5); 
    80356461                        $this->http_version = substr($this->data, 5, $len); 
    80366462                        $this->position += 5 + $len; 
    8037                         if (substr_count($this->http_version, '.') <= 1) 
    8038                         { 
     6463                        if (substr_count($this->http_version, '.') <= 1) { 
    80396464                                $this->http_version = (float) $this->http_version; 
    80406465                                $this->position += strspn($this->data, "\x09\x20", $this->position); 
    80416466                                $this->state = 'status'; 
    8042                         } 
    8043                         else 
    8044                         { 
     6467                        } else { 
    80456468                                $this->state = false; 
    80466469                        } 
    8047                 } 
    8048                 else 
    8049                 { 
     6470                } else { 
    80506471                        $this->state = false; 
    80516472                } 
     
    80596480        function status() 
    80606481        { 
    8061                 if ($len = strspn($this->data, '0123456789', $this->position)) 
    8062                 { 
     6482                if ($len = strspn($this->data, '0123456789', $this->position)) { 
    80636483                        $this->status_code = (int) substr($this->data, $this->position, $len); 
    80646484                        $this->position += $len; 
    80656485                        $this->state = 'reason'; 
    8066                 } 
    8067                 else 
    8068                 { 
     6486                } else { 
    80696487                        $this->state = false; 
    80706488                } 
     
    80926510        { 
    80936511                $this->value = trim($this->value, "\x0D\x20"); 
    8094                 if ($this->name !== '' && $this->value !== '') 
    8095                 { 
     6512                if ($this->name !== '' && $this->value !== '') { 
    80966513                        $this->name = strtolower($this->name); 
    8097                         if (isset($this->headers[$this->name])) 
    8098                         { 
    8099                                 $this->headers[$this->name] .= ', ' . $this->value; 
    8100                         } 
    8101                         else 
    8102                         { 
     6514                        if (isset($this->headers[$this->name])) { 
     6515                                $this->headers[$this->name] .= ', '.$this->value; 
     6516                        } else { 
    81036517                                $this->headers[$this->name] = $this->value; 
    81046518                        } 
     
    81066520                $this->name = ''; 
    81076521                $this->value = ''; 
    8108                 if (substr($this->data[$this->position], 0, 2) === "\x0D\x0A") 
    8109                 { 
     6522                if (substr($this->data[$this->position], 0, 2) === "\x0D\x0A") { 
    81106523                        $this->position += 2; 
    81116524                        $this->state = 'body'; 
    8112                 } 
    8113                 elseif ($this->data[$this->position] === "\x0A") 
    8114                 { 
     6525                } elseif ($this->data[$this->position] === "\x0A") { 
    81156526                        $this->position++; 
    81166527                        $this->state = 'body'; 
    8117                 } 
    8118                 else 
    8119                 { 
     6528                } else { 
    81206529                        $this->state = 'name'; 
    81216530                } 
     
    81306539        { 
    81316540                $len = strcspn($this->data, "\x0A:", $this->position); 
    8132                 if (isset($this->data[$this->position + $len])) 
    8133                 { 
    8134                         if ($this->data[$this->position + $len] === "\x0A") 
    8135                         { 
     6541                if (isset($this->data[$this->position + $len])) { 
     6542                        if ($this->data[$this->position + $len] === "\x0A") { 
    81366543                                $this->position += $len; 
    81376544                                $this->state = 'new_line'; 
    8138                         } 
    8139                         else 
    8140                         { 
     6545                        } else { 
    81416546                                $this->name = substr($this->data, $this->position, $len); 
    81426547                                $this->position += $len + 1; 
    81436548                                $this->state = 'value'; 
    81446549                        } 
    8145                 } 
    8146                 else 
    8147                 { 
     6550                } else { 
    81486551                        $this->state = false; 
    81496552                } 
     
    81576560        function linear_whitespace() 
    81586561        { 
    8159                 do 
    8160                 { 
    8161                         if (substr($this->data, $this->position, 2) === "\x0D\x0A") 
    8162                         { 
     6562                do { 
     6563                        if (substr($this->data, $this->position, 2) === "\x0D\x0A") { 
    81636564                                $this->position += 2; 
    8164                         } 
    8165                         elseif ($this->data[$this->position] === "\x0A") 
    8166                         { 
     6565                        } elseif ($this->data[$this->position] === "\x0A") { 
    81676566                                $this->position++; 
    81686567                        } 
     
    81796578        function value() 
    81806579        { 
    8181                 if ($this->is_linear_whitespace()) 
    8182                 { 
     6580                if ($this->is_linear_whitespace()) { 
    81836581                        $this->linear_whitespace(); 
    8184                 } 
    8185                 else 
    8186                 { 
    8187                         switch ($this->data[$this->position]) 
    8188                         { 
     6582                } else { 
     6583                        switch ($this->data[$this->position]) { 
    81896584                                case '"': 
    81906585                                        $this->position++; 
     
    82246619        function quote() 
    82256620        { 
    8226                 if ($this->is_linear_whitespace()) 
    8227                 { 
     6621                if ($this->is_linear_whitespace()) { 
    82286622                        $this->linear_whitespace(); 
    8229                 } 
    8230                 else 
    8231                 { 
    8232                         switch ($this->data[$this->position]) 
    8233                         { 
     6623                } else { 
     6624                        switch ($this->data[$this->position]) { 
    82346625                                case '"': 
    82356626                                        $this->position++; 
     
    82896680                $this->state = 'emit'; 
    82906681        } 
     6682 
    82916683} 
    82926684 
     
    82986690class SimplePie_gzdecode 
    82996691{ 
     6692 
    83006693        /** 
    83016694         * Compressed data 
     
    83056698         */ 
    83066699        var $compressed_data; 
    8307  
    83086700        /** 
    83096701         * Size of compressed data 
     
    83126704         */ 
    83136705        var $compressed_size; 
    8314  
    83156706        /** 
    83166707         * Minimum size of a valid gzip string 
     
    83196710         */ 
    83206711        var $min_compressed_size = 18; 
    8321  
    83226712        /** 
    83236713         * Current position of pointer 
     
    83266716         */ 
    83276717        var $position = 0; 
    8328  
    83296718        /** 
    83306719         * Flags (FLG) 
     
    83336722         */ 
    83346723        var $flags; 
    8335  
    83366724        /** 
    83376725         * Uncompressed data 
     
    83416729         */ 
    83426730        var $data; 
    8343  
    83446731        /** 
    83456732         * Modified time 
     
    83486735         */ 
    83496736        var $MTIME; 
    8350  
    83516737        /** 
    83526738         * Extra Flags 
     
    83556741         */ 
    83566742        var $XFL; 
    8357  
    83586743        /** 
    83596744         * Operating System 
     
    83626747         */ 
    83636748        var $OS; 
    8364  
    83656749        /** 
    83666750         * Subfield ID 1 
     
    83716755         */ 
    83726756        var $SI1; 
    8373  
    83746757        /** 
    83756758         * Subfield ID 2 
     
    83806763         */ 
    83816764        var $SI2; 
    8382  
    83836765        /** 
    83846766         * Extra field content 
     
    83896771         */ 
    83906772        var $extra_field; 
    8391  
    83926773        /** 
    83936774         * Original filename 
     
    83966777         */ 
    83976778        var $filename; 
    8398  
    83996779        /** 
    84006780         * Human readable comment 
     
    84326812        function parse() 
    84336813        { 
    8434                 if ($this->compressed_size >= $this->min_compressed_size) 
    8435                 { 
     6814                if ($this->compressed_size >= $this->min_compressed_size) { 
    84366815                        // Check ID1, ID2, and CM 
    8437                         if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08") 
    8438                         { 
     6816                        if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08") { 
    84396817                                return false; 
    84406818                        } 
     
    84446822 
    84456823                        // FLG bits above (1 << 4) are reserved 
    8446                         if ($this->flags > 0x1F) 
    8447                         { 
     6824                        if ($this->flags > 0x1F) { 
    84486825                                return false; 
    84496826                        } 
     
    84556832                        $mtime = substr($this->compressed_data, $this->position, 4); 
    84566833                        // Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness 
    8457                         if (current(unpack('S', "\x00\x01")) === 1) 
    8458                         { 
     6834                        if (current(unpack('S', "\x00\x01")) === 1) { 
    84596835                                $mtime = strrev($mtime); 
    84606836                        } 
     
    84696845 
    84706846                        // Parse the FEXTRA 
    8471                         if ($this->flags & 4) 
    8472                         { 
     6847                        if ($this->flags & 4) { 
    84736848                                // Read subfield IDs 
    84746849                                $this->SI1 = $this->compressed_data[$this->position++]; 
     
    84766851 
    84776852                                // SI2 set to zero is reserved for future use 
    8478                                 if ($this->SI2 === "\x00") 
    8479                                 { 
     6853                                if ($this->SI2 === "\x00") { 
    84806854                                        return false; 
    84816855                                } 
     
    84876861                                // Check the length of the string is still valid 
    84886862                                $this->min_compressed_size += $len + 4; 
    8489                                 if ($this->compressed_size >= $this->min_compressed_size) 
    8490                                 { 
     6863                                if ($this->compressed_size >= $this->min_compressed_size) { 
    84916864                                        // Set the extra field to the given data 
    84926865                                        $this->extra_field = substr($this->compressed_data, $this->position, $len); 
    84936866                                        $this->position += $len; 
    8494                                 } 
    8495                                 else 
    8496                                 { 
     6867                                } else { 
    84976868                                        return false; 
    84986869                                } 
     
    85006871 
    85016872                        // Parse the FNAME 
    8502                         if ($this->flags & 8) 
    8503                         { 
     6873                        if ($this->flags & 8) { 
    85046874                                // Get the length of the filename 
    85056875                                $len = strcspn($this->compressed_data, "\x00", $this->position); 
     
    85076877                                // Check the length of the string is still valid 
    85086878                                $this->min_compressed_size += $len + 1; 
    8509                                 if ($this->compressed_size >= $this->min_compressed_size) 
    8510                                 { 
     6879                                if ($this->compressed_size >= $this->min_compressed_size) { 
    85116880                                        // Set the original filename to the given string 
    85126881                                        $this->filename = substr($this->compressed_data, $this->position, $len); 
    85136882                                        $this->position += $len + 1; 
    8514                                 } 
    8515                                 else 
    8516                                 { 
     6883                                } else { 
    85176884                                        return false; 
    85186885                                } 
     
    85206887 
    85216888                        // Parse the FCOMMENT 
    8522                         if ($this->flags & 16) 
    8523                         { 
     6889                        if ($this->flags & 16) { 
    85246890                                // Get the length of the comment 
    85256891                                $len = strcspn($this->compressed_data, "\x00", $this->position); 
     
    85276893                                // Check the length of the string is still valid 
    85286894                                $this->min_compressed_size += $len + 1; 
    8529                                 if ($this->compressed_size >= $this->min_compressed_size) 
    8530                                 { 
     6895                                if ($this->compressed_size >= $this->min_compressed_size) { 
    85316896                                        // Set the original comment to the given string 
    85326897                                        $this->comment = substr($this->compressed_data, $this->position, $len); 
    85336898                                        $this->position += $len + 1; 
    8534                                 } 
    8535                                 else 
    8536                                 { 
     6899                                } else { 
    85376900                                        return false; 
    85386901                                } 
     
    85406903 
    85416904                        // Parse the FHCRC 
    8542                         if ($this->flags & 2) 
    8543                         { 
     6905                        if ($this->flags & 2) { 
    85446906                                // Check the length of the string is still valid 
    85456907                                $this->min_compressed_size += $len + 2; 
    8546                                 if ($this->compressed_size >= $this->min_compressed_size) 
    8547                                 { 
     6908                                if ($this->compressed_size >= $this->min_compressed_size) { 
    85486909                                        // Read the CRC 
    85496910                                        $crc = current(unpack('v', substr($this->compressed_data, $this->position, 2))); 
    85506911 
    85516912                                        // Check the CRC matches 
    8552                                         if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc) 
    8553                                         { 
     6913                                        if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc) { 
    85546914                                                $this->position += 2; 
    8555                                         } 
    8556                                         else 
    8557                                         { 
     6915                                        } else { 
    85586916                                                return false; 
    85596917                                        } 
    8560                                 } 
    8561                                 else 
    8562                                 { 
     6918                                } else { 
    85636919                                        return false; 
    85646920                                } 
     
    85666922 
    85676923                        // Decompress the actual data 
    8568                         if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false) 
    8569                         { 
     6924                        if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false) { 
    85706925                                return false; 
    8571                         } 
    8572                         else 
    8573                         { 
     6926                        } else { 
    85746927                                $this->position = $this->compressed_size - 8; 
    85756928                        } 
     
    85786931                        $crc = current(unpack('V', substr($this->compressed_data, $this->position, 4))); 
    85796932                        $this->position += 4; 
    8580                         /*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc)) 
    8581                         { 
    8582                                 return false; 
    8583                         }*/ 
     6933                        /* if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc)) 
     6934                          { 
     6935                          return false; 
     6936                          } */ 
    85846937 
    85856938                        // Check ISIZE of data 
    85866939                        $isize = current(unpack('V', substr($this->compressed_data, $this->position, 4))); 
    85876940                        $this->position += 4; 
    8588                         if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize)) 
    8589                         { 
     6941                        if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize)) { 
    85906942                                return false; 
    85916943                        } 
     
    85936945                        // Wow, against all odds, we've actually got a valid gzip string 
    85946946                        return true; 
    8595                 } 
    8596                 else 
    8597                 { 
     6947                } else { 
    85986948                        return false; 
    85996949                } 
    86006950        } 
     6951 
    86016952} 
    86026953 
    86036954class SimplePie_Cache 
    86046955{ 
     6956 
    86056957        /** 
    86066958         * Don't call the constructor. Please. 
     
    86226974        { 
    86236975                $location_iri = new SimplePie_IRI($location); 
    8624                 switch ($location_iri->get_scheme()) 
    8625                 { 
     6976                switch ($location_iri->get_scheme()) { 
    86266977                        case 'mysql': 
    8627                                 if (extension_loaded('mysql')) 
    8628                                 { 
     6978                                if (extension_loaded('mysql')) { 
    86296979                                        return new SimplePie_Cache_MySQL($location_iri, $filename, $extension); 
    86306980                                } 
     
    86356985                } 
    86366986        } 
     6987 
    86376988} 
    86386989 
    86396990class SimplePie_Cache_File 
    86406991{ 
     6992 
    86416993        var $location; 
    86426994        var $filename; 
     
    86547006        function save($data) 
    86557007        { 
    8656                 if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location)) 
    8657                 { 
    8658                         if (is_a($data, 'SimplePie')) 
    8659                         { 
     7008                if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location)) { 
     7009                        if (is_a($data, 'SimplePie')) { 
    86607010                                $data = $data->data; 
    86617011                        } 
     
    86637013                        $data = serialize($data); 
    86647014 
    8665                         if (function_exists('file_put_contents')) 
    8666                         { 
     7015                        if (function_exists('file_put_contents')) { 
    86677016                                return (bool) file_put_contents($this->name, $data); 
    8668                         } 
    8669                         else 
    8670                         { 
     7017                        } else { 
    86717018                                $fp = fopen($this->name, 'wb'); 
    8672                                 if ($fp) 
    8673                                 { 
     7019                                if ($fp) { 
    86747020                                        fwrite($fp, $data); 
    86757021                                        fclose($fp); 
     
    86837029        function load() 
    86847030        { 
    8685                 if (file_exists($this->name) && is_readable($this->name)) 
    8686                 { 
     7031                if (file_exists($this->name) && is_readable($this->name)) { 
    86877032                        return unserialize(file_get_contents($this->name)); 
    86887033                } 
     
    86927037        function mtime() 
    86937038        { 
    8694                 if (file_exists($this->name)) 
    8695                 { 
     7039                if (file_exists($this->name)) { 
    86967040                        return filemtime($this->name); 
    86977041                } 
     
    87017045        function touch() 
    87027046        { 
    8703                 if (file_exists($this->name)) 
    8704                 { 
     7047                if (file_exists($this->name)) { 
    87057048                        return touch($this->name); 
    87067049                } 
     
    87107053        function unlink() 
    87117054        { 
    8712                 if (file_exists($this->name)) 
    8713                 { 
     7055                if (file_exists($this->name)) { 
    87147056                        return unlink($this->name); 
    87157057                } 
    87167058                return false; 
    87177059        } 
    8718 } 
    8719  
    8720 class SimplePie_Cache_DB 
    8721 { 
    8722         function prepare_simplepie_object_for_cache($data) 
    8723         { 
    8724                 $items = $data->get_items(); 
    8725                 $items_by_id = array(); 
    8726  
    8727                 if (!empty($items)) 
    8728                 { 
    8729                         foreach ($items as $item) 
    8730                         { 
    8731                                 $items_by_id[$item->get_id()] = $item; 
    8732                         } 
    8733  
    8734                         if (count($items_by_id) !== count($items)) 
    8735                         { 
    8736                                 $items_by_id = array(); 
    8737                                 foreach ($items as $item) 
    8738                                 { 
    8739                                         $items_by_id[$item->get_id(true)] = $item; 
    8740                                 } 
    8741                         } 
    8742  
    8743                         if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) 
    8744                         { 
    8745                                 $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; 
    8746                         } 
    8747                         elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) 
    8748                         { 
    8749                                 $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; 
    8750                         } 
    8751                         elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) 
    8752                         { 
    8753                                 $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; 
    8754                         } 
    8755                         elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0])) 
    8756                         { 
    8757                                 $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]; 
    8758                         } 
    8759                         else 
    8760                         { 
    8761                                 $channel = null; 
    8762                         } 
    8763  
    8764                         if ($channel !== null) 
    8765                         { 
    8766                                 if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'])) 
    8767                                 { 
    8768                                         unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry']); 
    8769                                 } 
    8770                                 if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry'])) 
    8771                                 { 
    8772                                         unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry']); 
    8773                                 } 
    8774                                 if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])) 
    8775                                 { 
    8776                                         unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']); 
    8777                                 } 
    8778                                 if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])) 
    8779                                 { 
    8780                                         unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']); 
    8781                                 } 
    8782                                 if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item'])) 
    8783                                 { 
    8784                                         unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item']); 
    8785                                 } 
    8786                         } 
    8787                         if (isset($data->data['items'])) 
    8788                         { 
    8789                                 unset($data->data['items']); 
    8790                         } 
    8791                         if (isset($data->data['ordered_items'])) 
    8792                         { 
    8793                                 unset($data->data['ordered_items']); 
    8794                         } 
    8795                 } 
    8796                 return array(serialize($data->data), $items_by_id); 
    8797         } 
    8798 } 
    8799  
    8800 class SimplePie_Cache_MySQL extends SimplePie_Cache_DB 
    8801 { 
    8802         var $mysql; 
    8803         var $options; 
    8804         var $id; 
    8805  
    8806         function SimplePie_Cache_MySQL($mysql_location, $name, $extension) 
    8807         { 
    8808                 $host = $mysql_location->get_host(); 
    8809                 if (SimplePie_Misc::stripos($host, 'unix(') === 0 && substr($host, -1) === ')') 
    8810                 { 
    8811                         $server = ':' . substr($host, 5, -1); 
    8812                 } 
    8813                 else 
    8814                 { 
    8815                         $server = $host; 
    8816                         if ($mysql_location->get_port() !== null) 
    8817                         { 
    8818                                 $server .= ':' . $mysql_location->get_port(); 
    8819                         } 
    8820                 } 
    8821  
    8822                 if (strpos($mysql_location->get_userinfo(), ':') !== false) 
    8823                 { 
    8824                         list($username, $password) = explode(':', $mysql_location->get_userinfo(), 2); 
    8825                 } 
    8826                 else 
    8827                 { 
    8828                         $username = $mysql_location->get_userinfo(); 
    8829                         $password = null; 
    8830                 } 
    8831  
    8832                 if ($this->mysql = mysql_connect($server, $username, $password)) 
    8833                 { 
    8834                         $this->id = $name . $extension; 
    8835                         $this->options = SimplePie_Misc::parse_str($mysql_location->get_query()); 
    8836                         if (!isset($this->options['prefix'][0])) 
    8837                         { 
    8838                                 $this->options['prefix'][0] = ''; 
    8839                         } 
    8840  
    8841                         if (mysql_select_db(ltrim($mysql_location->get_path(), '/')) 
    8842                                 && mysql_query('SET NAMES utf8') 
    8843                                 && ($query = mysql_unbuffered_query('SHOW TABLES'))) 
    8844                         { 
    8845                                 $db = array(); 
    8846                                 while ($row = mysql_fetch_row($query)) 
    8847                                 { 
    8848                                         $db[] = $row[0]; 
    8849                                 } 
    8850  
    8851                                 if (!in_array($this->options['prefix'][0] . 'cache_data', $db)) 
    8852                                 { 
    8853                                         if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . '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)))')) 
    8854                                         { 
    8855                                                 $this->mysql = null; 
    8856                                         } 
    8857                                 } 
    8858  
    8859                                 if (!in_array($this->options['prefix'][0] . 'items', $db)) 
    8860                                 { 
    8861                                         if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` TEXT CHARACTER SET utf8 NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))')) 
    8862                                         { 
    8863                                                 $this->mysql = null; 
    8864                                         } 
    8865                                 } 
    8866                         } 
    8867                         else 
    8868                         { 
    8869                                 $this->mysql = null; 
    8870                         } 
    8871                 } 
    8872         } 
    8873  
    8874         function save($data) 
    8875         { 
    8876                 if ($this->mysql) 
    8877                 { 
    8878                         $feed_id = "'" . mysql_real_escape_string($this->id) . "'"; 
    8879  
    8880                         if (is_a($data, 'SimplePie')) 
    8881                         { 
    8882                                 if (SIMPLEPIE_PHP5) 
    8883                                 { 
    8884                                         // This keyword needs to defy coding standards for PHP4 compatibility 
    8885                                         $data = clone($data); 
    8886                                 } 
    8887  
    8888                                 $prepared = $this->prepare_simplepie_object_for_cache($data); 
    8889  
    8890                                 if ($query = mysql_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this->mysql)) 
    8891                                 { 
    8892                                         if (mysql_num_rows($query)) 
    8893                                         { 
    8894                                                 $items = count($prepared[1]); 
    8895                                                 if ($items) 
    8896                                                 { 
    8897                                                         $sql = 'UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `items` = ' . $items . ', `data` = \'' . mysql_real_escape_string($prepared[0]) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id; 
    8898                                                 } 
    8899                                                 else 
    8900                                                 { 
    8901                                                         $sql = 'UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `data` = \'' . mysql_real_escape_string($prepared[0]) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id; 
    8902                                                 } 
    8903  
    8904                                                 if (!mysql_query($sql, $this->mysql)) 
    8905                                                 { 
    8906                                                         return false; 
    8907                                                 } 
    8908                                         } 
    8909                                         elseif (!mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(' . $feed_id . ', ' . count($prepared[1]) . ', \'' . mysql_real_escape_string($prepared[0]) . '\', ' . time() . ')', $this->mysql)) 
    8910                                         { 
    8911                                                 return false; 
    8912                                         } 
    8913  
    8914                                         $ids = array_keys($prepared[1]); 
    8915                                         if (!empty($ids)) 
    8916                                         { 
    8917                                                 foreach ($ids as $id) 
    8918                                                 { 
    8919                                                         $database_ids[] = mysql_real_escape_string($id); 
    8920                                                 } 
    8921  
    8922                                                 if ($query = mysql_unbuffered_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'items` WHERE `id` = \'' . implode('\' OR `id` = \'', $database_ids) . '\' AND `feed_id` = ' . $feed_id, $this->mysql)) 
    8923                                                 { 
    8924                                                         $existing_ids = array(); 
    8925                                                         while ($row = mysql_fetch_row($query)) 
    8926                                                         { 
    8927                                                                 $existing_ids[] = $row[0]; 
    8928                                                         } 
    8929  
    8930                                                         $new_ids = array_diff($ids, $existing_ids); 
    8931  
    8932                                                         foreach ($new_ids as $new_id) 
    8933                                                         { 
    8934                                                                 if (!($date = $prepared[1][$new_id]->get_date('U'))) 
    8935                                                                 { 
    8936                                                                         $date = time(); 
    8937                                                                 } 
    8938  
    8939                                                                 if (!mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'items` (`feed_id`, `id`, `data`, `posted`) VALUES(' . $feed_id . ', \'' . mysql_real_escape_string($new_id) . '\', \'' . mysql_real_escape_string(serialize($prepared[1][$new_id]->data)) . '\', ' . $date . ')', $this->mysql)) 
    8940                                                                 { 
    8941                                                                         return false; 
    8942                                                                 } 
    8943                                                         } 
    8944                                                         return true; 
    8945                                                 } 
    8946                                         } 
    8947                                         else 
    8948                                         { 
    8949                                                 return true; 
    8950                                         } 
    8951                                 } 
    8952                         } 
    8953                         elseif ($query = mysql_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this->mysql)) 
    8954                         { 
    8955                                 if (mysql_num_rows($query)) 
    8956                                 { 
    8957                                         if (mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `items` = 0, `data` = \'' . mysql_real_escape_string(serialize($data)) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id, $this->mysql)) 
    8958                                         { 
    8959                                                 return true; 
    8960                                         } 
    8961                                 } 
    8962                                 elseif (mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(\'' . mysql_real_escape_string($this->id) . '\', 0, \'' . mysql_real_escape_string(serialize($data)) . '\', ' . time() . ')', $this->mysql)) 
    8963                                 { 
    8964                                         return true; 
    8965                                 } 
    8966                         } 
    8967                 } 
    8968                 return false; 
    8969         } 
    8970  
    8971         function load() 
    8972         { 
    8973                 if ($this->mysql && ($query = mysql_query('SELECT `items`, `data` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query))) 
    8974                 { 
    8975                         $data = unserialize($row[1]); 
    8976  
    8977                         if (isset($this->options['items'][0])) 
    8978                         { 
    8979                                 $items = (int) $this->options['items'][0]; 
    8980                         } 
    8981                         else 
    8982                         { 
    8983                                 $items = (int) $row[0]; 
    8984                         } 
    8985  
    8986                         if ($items !== 0) 
    8987                         { 
    8988                                 if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) 
    8989                                 { 
    8990                                         $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; 
    8991                                 } 
    8992                                 elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) 
    8993                                 { 
    8994                                         $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; 
    8995                                 } 
    8996                                 elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) 
    8997                                 { 
    8998                                         $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; 
    8999                                 } 
    9000                                 elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0])) 
    9001                                 { 
    9002                                         $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]; 
    9003                                 } 
    9004                                 else 
    9005                                 { 
    9006                                         $feed = null; 
    9007                                 } 
    9008  
    9009                                 if ($feed !== null) 
    9010                                 { 
    9011                                         $sql = 'SELECT `data` FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . '\' ORDER BY `posted` DESC'; 
    9012                                         if ($items > 0) 
    9013                                         { 
    9014                                                 $sql .= ' LIMIT ' . $items; 
    9015                                         } 
    9016  
    9017                                         if ($query = mysql_unbuffered_query($sql, $this->mysql)) 
    9018                                         { 
    9019                                                 while ($row = mysql_fetch_row($query)) 
    9020                                                 { 
    9021                                                         $feed['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'][] = unserialize($row[0]); 
    9022                                                 } 
    9023                                         } 
    9024                                         else 
    9025                                         { 
    9026                                                 return false; 
    9027                                         } 
    9028                                 } 
    9029                         } 
    9030                         return $data; 
    9031                 } 
    9032                 return false; 
    9033         } 
    9034  
    9035         function mtime() 
    9036         { 
    9037                 if ($this->mysql && ($query = mysql_query('SELECT `mtime` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query))) 
    9038                 { 
    9039                         return $row[0]; 
    9040                 } 
    9041                 else 
    9042                 { 
    9043                         return false; 
    9044                 } 
    9045         } 
    9046  
    9047         function touch() 
    9048         { 
    9049                 if ($this->mysql && ($query = mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `mtime` = ' . time() . ' WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && mysql_affected_rows($this->mysql)) 
    9050                 { 
    9051                         return true; 
    9052                 } 
    9053                 else 
    9054                 { 
    9055                         return false; 
    9056                 } 
    9057         } 
    9058  
    9059         function unlink() 
    9060         { 
    9061                 if ($this->mysql && ($query = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($query2 = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql))) 
    9062                 { 
    9063                         return true; 
    9064                 } 
    9065                 else 
    9066                 { 
    9067                         return false; 
    9068                 } 
    9069         } 
     7060 
    90707061} 
    90717062 
    90727063class SimplePie_Misc 
    90737064{ 
     7065 
    90747066        function time_hms($seconds) 
    90757067        { 
     
    90787070                $hours = floor($seconds / 3600); 
    90797071                $remainder = $seconds % 3600; 
    9080                 if ($hours > 0) 
    9081                 { 
     7072                if ($hours > 0) { 
    90827073                        $time .= $hours.':'; 
    90837074                } 
     
    90857076                $minutes = floor($remainder / 60); 
    90867077                $seconds = $remainder % 60; 
    9087                 if ($minutes < 10 && $hours > 0) 
    9088                 { 
    9089                         $minutes = '0' . $minutes; 
    9090                 } 
    9091                 if ($seconds < 10) 
    9092                 { 
    9093                         $seconds = '0' . $seconds; 
     7078                if ($minutes < 10 && $hours > 0) { 
     7079                        $minutes = '0'.$minutes; 
     7080                } 
     7081                if ($seconds < 10) { 
     7082                        $seconds = '0'.$seconds; 
    90947083                } 
    90957084 
     
    91097098        { 
    91107099                $output = ''; 
    9111                 while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') 
    9112                 { 
     7100                while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') { 
    91137101                        // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise, 
    9114                         if (strpos($input, '../') === 0) 
    9115                         { 
     7102                        if (strpos($input, '../') === 0) { 
    91167103                                $input = substr($input, 3); 
    9117                         } 
    9118                         elseif (strpos($input, './') === 0) 
    9119                         { 
     7104                        } elseif (strpos($input, './') === 0) { 
    91207105                                $input = substr($input, 2); 
    91217106                        } 
    91227107                        // 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, 
    9123                         elseif (strpos($input, '/./') === 0) 
    9124                         { 
     7108                        elseif (strpos($input, '/./') === 0) { 
    91257109                                $input = substr_replace($input, '/', 0, 3); 
    9126                         } 
    9127                         elseif ($input === '/.') 
    9128                         { 
     7110                        } elseif ($input === '/.') { 
    91297111                                $input = '/'; 
    91307112                        } 
    91317113                        // 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, 
    9132                         elseif (strpos($input, '/../') === 0) 
    9133                         { 
     7114                        elseif (strpos($input, '/../') === 0) { 
    91347115                                $input = substr_replace($input, '/', 0, 4); 
    91357116                                $output = substr_replace($output, '', strrpos($output, '/')); 
    9136                         } 
    9137                         elseif ($input === '/..') 
    9138                         { 
     7117                        } elseif ($input === '/..') { 
    91397118                                $input = '/'; 
    91407119                                $output = substr_replace($output, '', strrpos($output, '/')); 
    91417120                        } 
    91427121                        // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise, 
    9143                         elseif ($input === '.' || $input === '..') 
    9144                         { 
     7122                        elseif ($input === '.' || $input === '..') { 
    91457123                                $input = ''; 
    91467124                        } 
    91477125                        // 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 
    9148                         elseif (($pos = strpos($input, '/', 1)) !== false) 
    9149                         { 
     7126                        elseif (($pos = strpos($input, '/', 1)) !== false) { 
    91507127                                $output .= substr($input, 0, $pos); 
    91517128                                $input = substr_replace($input, '', 0, $pos); 
    9152                         } 
    9153                         else 
    9154                         { 
     7129                        } else { 
    91557130                                $output .= $input; 
    91567131                                $input = ''; 
    91577132                        } 
    91587133                } 
    9159                 return $output . $input; 
     7134                return $output.$input; 
    91607135        } 
    91617136 
     
    91647139                $return = array(); 
    91657140                $name = preg_quote($realname, '/'); 
    9166                 if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) 
    9167                 { 
    9168                         for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++) 
    9169                         { 
     7141                if (preg_match_all("/<($name)".SIMPLEPIE_PCRE_HTML_ATTRIBUTE."(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { 
     7142                        for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++) { 
    91707143                                $return[$i]['tag'] = $realname; 
    91717144                                $return[$i]['full'] = $matches[$i][0][0]; 
    91727145                                $return[$i]['offset'] = $matches[$i][0][1]; 
    9173                                 if (strlen($matches[$i][3][0]) <= 2) 
    9174                                 { 
     7146                                if (strlen($matches[$i][3][0]) <= 2) { 
    91757147                                        $return[$i]['self_closing'] = true; 
    9176                                 } 
    9177                                 else 
    9178                                 { 
     7148                                } else { 
    91797149                                        $return[$i]['self_closing'] = false; 
    91807150                                        $return[$i]['content'] = $matches[$i][4][0]; 
    91817151                                } 
    91827152                                $return[$i]['attribs'] = array(); 
    9183                                 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)) 
    9184                                 { 
    9185                                         for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++) 
    9186                                         { 
    9187                                                 if (count($attribs[$j]) === 2) 
    9188                                                 { 
     7153                                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)) { 
     7154                                        for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++) { 
     7155                                                if (count($attribs[$j]) === 2) { 
    91897156                                                        $attribs[$j][2] = $attribs[$j][1]; 
    91907157                                                } 
     
    92007167        { 
    92017168                $full = "<$element[tag]"; 
    9202                 foreach ($element['attribs'] as $key => $value) 
    9203                 { 
     7169                foreach ($element['attribs'] as $key => $value) { 
    92047170                        $key = strtolower($key); 
    9205                         $full .= " $key=\"" . htmlspecialchars($value['data']) . '"'; 
    9206                 } 
    9207                 if ($element['self_closing']) 
    9208                 { 
     7171                        $full .= " $key=\"".htmlspecialchars($value['data']).'"'; 
     7172                } 
     7173                if ($element['self_closing']) { 
    92097174                        $full .= ' />'; 
    9210                 } 
    9211                 else 
    9212                 { 
     7175                } else { 
    92137176                        $full .= ">$element[content]</$element[tag]>"; 
    92147177                } 
     
    92187181        function error($message, $level, $file, $line) 
    92197182        { 
    9220                 if ((ini_get('error_reporting') & $level) > 0) 
    9221                 { 
    9222                         switch ($level) 
    9223                         { 
     7183                if ((ini_get('error_reporting') & $level) > 0) { 
     7184                        switch ($level) { 
    92247185                                case E_USER_ERROR: 
    92257186                                        $note = 'PHP Error'; 
     
    92667227                $cache = call_user_func(array($cache_class, 'create'), $cache_location, $identifier_url, $cache_extension); 
    92677228 
    9268                 if ($file = $cache->load()) 
    9269                 { 
    9270                         if (isset($file['headers']['content-type'])) 
    9271                         { 
    9272                                 header('Content-type:' . $file['headers']['content-type']); 
    9273                         } 
    9274                         else 
    9275                         { 
     7229                if ($file = $cache->load()) { 
     7230                        if (isset($file['headers']['content-type'])) { 
     7231                                header('Content-type:'.$file['headers']['content-type']); 
     7232                        } else { 
    92767233                                header('Content-type: application/octet-stream'); 
    92777234                        } 
    9278                         header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days 
     7235                        header('Expires: '.gmdate('D, d M Y H:i:s', time() + 604800).' GMT'); // 7 days 
    92797236                        echo $file['body']; 
    92807237                        exit; 
    92817238                } 
    92827239 
    9283                 die('Cached file for ' . $identifier_url . ' cannot be found.'); 
     7240                die('Cached file for '.$identifier_url.' cannot be found.'); 
    92847241        } 
    92857242 
     
    92887245                $url = SimplePie_Misc::normalize_url($url); 
    92897246                $parsed = SimplePie_Misc::parse_url($url); 
    9290                 if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https') 
    9291                 { 
     7247                if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https') { 
    92927248                        return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http); 
    92937249                } 
    92947250 
    9295                 if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url)) 
    9296                 { 
     7251                if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url)) { 
    92977252                        return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http); 
    92987253                } 
    92997254 
    9300                 if ($http === 2 && $parsed['scheme'] !== '') 
    9301                 { 
     7255                if ($http === 2 && $parsed['scheme'] !== '') { 
    93027256                        return "feed:$url"; 
    9303                 } 
    9304                 elseif ($http === 3 && strtolower($parsed['scheme']) === 'http') 
    9305                 { 
     7257                } elseif ($http === 3 && strtolower($parsed['scheme']) === 'http') { 
    93067258                        return substr_replace($url, 'podcast', 0, 4); 
    9307                 } 
    9308                 elseif ($http === 4 && strtolower($parsed['scheme']) === 'http') 
    9309                 { 
     7259                } elseif ($http === 4 && strtolower($parsed['scheme']) === 'http') { 
    93107260                        return substr_replace($url, 'itpc', 0, 4); 
    9311                 } 
    9312                 else 
    9313                 { 
     7261                } else { 
    93147262                        return $url; 
    93157263                } 
     
    93487296        { 
    93497297                $integer = hexdec($match[1]); 
    9350                 if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E) 
    9351                 { 
     7298                if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E) { 
    93527299                        return chr($integer); 
    9353                 } 
    9354                 else 
    9355                 { 
     7300                } else { 
    93567301                        return strtoupper($match[0]); 
    93577302                } 
     
    93717316        function utf8_bad_replace($str) 
    93727317        { 
    9373                 if (function_exists('iconv') && ($return = @iconv('UTF-8', 'UTF-8//IGNORE', $str))) 
    9374                 { 
     7318                if (function_exists('iconv') && ($return = @iconv('UTF-8', 'UTF-8//IGNORE', $str))) { 
    93757319                        return $return; 
    9376                 } 
    9377                 elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($str, 'UTF-8', 'UTF-8'))) 
    9378                 { 
     7320                } elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($str, 'UTF-8', 'UTF-8'))) { 
    93797321                        return $return; 
    9380                 } 
    9381                 elseif (preg_match_all('/(?:[\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})+/', $str, $matches)) 
    9382                 { 
     7322                } elseif (preg_match_all('/(?:[\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})+/', $str, $matches)) { 
    93837323                        return implode("\xEF\xBF\xBD", $matches[0]); 
    9384                 } 
    9385                 elseif ($str !== '') 
    9386                 { 
     7324                } elseif ($str !== '') { 
    93877325                        return "\xEF\xBF\xBD"; 
    9388                 } 
    9389                 else 
    9390                 { 
     7326                } else { 
    93917327                        return ''; 
    93927328                } 
     
    94147350 
    94157351                // We fail to fail on non US-ASCII bytes 
    9416                 if ($input === 'US-ASCII') 
    9417                 { 
     7352                if ($input === 'US-ASCII') { 
    94187353                        static $non_ascii_octects = ''; 
    9419                         if (!$non_ascii_octects) 
    9420                         { 
    9421                                 for ($i = 0x80; $i <= 0xFF; $i++) 
    9422                                 { 
     7354                        if (!$non_ascii_octects) { 
     7355                                for ($i = 0x80; $i <= 0xFF; $i++) { 
    94237356                                        $non_ascii_octects .= chr($i); 
    94247357                                } 
     
    94287361 
    94297362                // This is first, as behaviour of this is completely predictable 
    9430                 if ($input === 'Windows-1252' && $output === 'UTF-8') 
    9431                 { 
     7363                if ($input === 'Windows-1252' && $output === 'UTF-8') { 
    94327364                        return SimplePie_Misc::windows_1252_to_utf8($data); 
    94337365                } 
    94347366                // This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported). 
    9435                 elseif (function_exists('mb_convert_encoding') && @mb_convert_encoding("\x80", 'UTF-16BE', $input) !== "\x00\x80" && ($return = @mb_convert_encoding($data, $output, $input))) 
    9436                 { 
     7367                elseif (function_exists('mb_convert_encoding') && @mb_convert_encoding("\x80", 'UTF-16BE', $input) !== "\x00\x80" && ($return = @mb_convert_encoding($data, $output, $input))) { 
    94377368                        return $return; 
    94387369                } 
    94397370                // This is last, as behaviour of this varies with OS userland and PHP version 
    9440                 elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data))) 
    9441                 { 
     7371                elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data))) { 
    94427372                        return $return; 
    94437373                } 
    94447374                // If we can't do anything, just fail 
    9445                 else 
    9446                 { 
     7375                else { 
    94477376                        return false; 
    94487377                } 
     
    94527381        { 
    94537382                // Normalization from UTS #22 
    9454                 switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset))) 
    9455                 { 
     7383                switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset))) { 
    94567384                        case 'adobestandardencoding': 
    94577385                        case 'csadobestandardencoding': 
     
    107678695        function get_curl_version() 
    107688696        { 
    10769                 if (is_array($curl = curl_version())) 
    10770                 { 
     8697                if (is_array($curl = curl_version())) { 
    107718698                        $curl = $curl['version']; 
    10772                 } 
    10773                 elseif (substr($curl, 0, 5) === 'curl/') 
    10774                 { 
     8699                } elseif (substr($curl, 0, 5) === 'curl/') { 
    107758700                        $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5)); 
    10776                 } 
    10777                 elseif (substr($curl, 0, 8) === 'libcurl/') 
    10778                 { 
     8701                } elseif (substr($curl, 0, 8) === 'libcurl/') { 
    107798702                        $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8)); 
    10780                 } 
    10781                 else 
    10782                 { 
     8703                } else { 
    107838704                        $curl = 0; 
    107848705                } 
     
    107888709        function is_subclass_of($class1, $class2) 
    107898710        { 
    10790                 if (func_num_args() !== 2) 
    10791                 { 
     8711                if (func_num_args() !== 2) { 
    107928712                        trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING); 
    10793                 } 
    10794                 elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1)) 
    10795                 { 
     8713                } elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1)) { 
    107968714                        return is_subclass_of($class1, $class2); 
    10797                 } 
    10798                 elseif (is_string($class1) && is_string($class2)) 
    10799                 { 
    10800                         if (class_exists($class1)) 
    10801                         { 
    10802                                 if (class_exists($class2)) 
    10803                                 { 
     8715                } elseif (is_string($class1) && is_string($class2)) { 
     8716                        if (class_exists($class1)) { 
     8717                                if (class_exists($class2)) { 
    108048718                                        $class2 = strtolower($class2); 
    10805                                         while ($class1 = strtolower(get_parent_class($class1))) 
    10806                                         { 
    10807                                                 if ($class1 === $class2) 
    10808                                                 { 
     8719                                        while ($class1 = strtolower(get_parent_class($class1))) { 
     8720                                                if ($class1 === $class2) { 
    108098721                                                        return true; 
    108108722                                                } 
    108118723                                        } 
    108128724                                } 
    10813                         } 
    10814                         else 
    10815                         { 
     8725                        } else { 
    108168726                                trigger_error('Unknown class passed as parameter', E_USER_WARNNG); 
    108178727                        } 
     
    108308740        { 
    108318741                $output = ''; 
    10832                 while (($start = strpos($data, '<!--')) !== false) 
    10833                 { 
     8742                while (($start = strpos($data, '<!--')) !== false) { 
    108348743                        $output .= substr($data, 0, $start); 
    10835                         if (($end = strpos($data, '-->', $start)) !== false) 
    10836                         { 
     8744                        if (($end = strpos($data, '-->', $start)) !== false) { 
    108378745                                $data = substr_replace($data, '', 0, $end + 3); 
    10838                         } 
    10839                         else 
    10840                         { 
     8746                        } else { 
    108418747                                $data = ''; 
    108428748                        } 
    108438749                } 
    10844                 return $output . $data; 
     8750                return $output.$data; 
    108458751        } 
    108468752 
     
    108818787                $output = ''; 
    108828788 
    10883                 while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) 
    10884                 { 
     8789                while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) { 
    108858790                        $output .= substr($string, $position, $pos - $position); 
    108868791                        $position = $pos + 1; 
    10887                         if ($string[$pos - 1] !== '\\') 
    10888                         { 
     8792                        if ($string[$pos - 1] !== '\\') { 
    108898793                                $depth++; 
    10890                                 while ($depth && $position < $length) 
    10891                                 { 
     8794                                while ($depth && $position < $length) { 
    108928795                                        $position += strcspn($string, '()', $position); 
    10893                                         if ($string[$position - 1] === '\\') 
    10894                                         { 
     8796                                        if ($string[$position - 1] === '\\') { 
    108958797                                                $position++; 
    108968798                                                continue; 
    10897                                         } 
    10898                                         elseif (isset($string[$position])) 
    10899                                         { 
    10900                                                 switch ($string[$position]) 
    10901                                                 { 
     8799                                        } elseif (isset($string[$position])) { 
     8800                                                switch ($string[$position]) { 
    109028801                                                        case '(': 
    109038802                                                                $depth++; 
     
    109098808                                                } 
    109108809                                                $position++; 
    10911                                         } 
    10912                                         else 
    10913                                         { 
     8810                                        } else { 
    109148811                                                break; 
    109158812                                        } 
    109168813                                } 
    10917                         } 
    10918                         else 
    10919                         { 
     8814                        } else { 
    109208815                                $output .= '('; 
    109218816                        } 
     
    109288823        function parse_mime($mime) 
    109298824        { 
    10930                 if (($pos = strpos($mime, ';')) === false) 
    10931                 { 
     8825                if (($pos = strpos($mime, ';')) === false) { 
    109328826                        return trim($mime); 
    10933                 } 
    10934                 else 
    10935                 { 
     8827                } else { 
    109368828                        return trim(substr($mime, 0, $pos)); 
    109378829                } 
     
    109408832        function htmlspecialchars_decode($string, $quote_style) 
    109418833        { 
    10942                 if (function_exists('htmlspecialchars_decode')) 
    10943                 { 
     8834                if (function_exists('htmlspecialchars_decode')) { 
    109448835                        return htmlspecialchars_decode($string, $quote_style); 
    10945                 } 
    10946                 else 
    10947                 { 
     8836                } else { 
    109488837                        return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style))); 
    109498838                } 
     
    109528841        function atom_03_construct_type($attribs) 
    109538842        { 
    10954                 if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64')) 
    10955                 { 
     8843                if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64')) { 
    109568844                        $mode = SIMPLEPIE_CONSTRUCT_BASE64; 
    10957                 } 
    10958                 else 
    10959                 { 
     8845                } else { 
    109608846                        $mode = SIMPLEPIE_CONSTRUCT_NONE; 
    109618847                } 
    10962                 if (isset($attribs['']['type'])) 
    10963                 { 
    10964                         switch (strtolower(trim($attribs['']['type']))) 
    10965                         { 
     8848                if (isset($attribs['']['type'])) { 
     8849                        switch (strtolower(trim($attribs['']['type']))) { 
    109668850                                case 'text': 
    109678851                                case 'text/plain': 
     
    109798863                                        return SIMPLEPIE_CONSTRUCT_NONE | $mode; 
    109808864                        } 
    10981                 } 
    10982                 else 
    10983                 { 
     8865                } else { 
    109848866                        return SIMPLEPIE_CONSTRUCT_TEXT | $mode; 
    109858867                } 
     
    109888870        function atom_10_construct_type($attribs) 
    109898871        { 
    10990                 if (isset($attribs['']['type'])) 
    10991                 { 
    10992                         switch (strtolower(trim($attribs['']['type']))) 
    10993                         { 
     8872                if (isset($attribs['']['type'])) { 
     8873                        switch (strtolower(trim($attribs['']['type']))) { 
    109948874                                case 'text': 
    109958875                                        return SIMPLEPIE_CONSTRUCT_TEXT; 
     
    110108890        function atom_10_content_construct_type($attribs) 
    110118891        { 
    11012                 if (isset($attribs['']['type'])) 
    11013                 { 
     8892                if (isset($attribs['']['type'])) { 
    110148893                        $type = strtolower(trim($attribs['']['type'])); 
    11015                         switch ($type) 
    11016                         { 
     8894                        switch ($type) { 
    110178895                                case 'text': 
    110188896                                        return SIMPLEPIE_CONSTRUCT_TEXT; 
     
    110248902                                        return SIMPLEPIE_CONSTRUCT_XHTML; 
    110258903                        } 
    11026                         if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/') 
    11027                         { 
     8904                        if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/') { 
    110288905                                return SIMPLEPIE_CONSTRUCT_NONE; 
    11029                         } 
    11030                         else 
    11031                         { 
     8906                        } else { 
    110328907                                return SIMPLEPIE_CONSTRUCT_BASE64; 
    110338908                        } 
    11034                 } 
    11035                 else 
    11036                 { 
     8909                } else { 
    110378910                        return SIMPLEPIE_CONSTRUCT_TEXT; 
    110388911                } 
     
    110528925                $tokens = array(); 
    110538926 
    11054                 while ($position < $string_length) 
    11055                 { 
     8927                while ($position < $string_length) { 
    110568928                        $len = strcspn($string, $space_characters, $position); 
    110578929                        $tokens[] = substr($string, $position, $len); 
     
    110658937        function array_unique($array) 
    110668938        { 
    11067                 if (version_compare(PHP_VERSION, '5.2', '>=')) 
    11068                 { 
     8939                if (version_compare(PHP_VERSION, '5.2', '>=')) { 
    110698940                        return array_unique($array); 
    11070                 } 
    11071                 else 
    11072                 { 
     8941                } else { 
    110738942                        $array = (array) $array; 
    110748943                        $new_array = array(); 
    110758944                        $new_array_strings = array(); 
    11076                         foreach ($array as $key => $value) 
    11077                         { 
    11078                                 if (is_object($value)) 
    11079                                 { 
    11080                                         if (method_exists($value, '__toString')) 
    11081                                         { 
     8945                        foreach ($array as $key => $value) { 
     8946                                if (is_object($value)) { 
     8947                                        if (method_exists($value, '__toString')) { 
    110828948                                                $cmp = $value->__toString(); 
     8949                                        } else { 
     8950                                                trigger_error('Object of class '.get_class($value).' could not be converted to string', E_USER_ERROR); 
    110838951                                        } 
    11084                                         else 
    11085                                         { 
    11086                                                 trigger_error('Object of class ' . get_class($value) . ' could not be converted to string', E_USER_ERROR); 
    11087                                         } 
    11088                                 } 
    11089                                 elseif (is_array($value)) 
    11090                                 { 
     8952                                } elseif (is_array($value)) { 
    110918953                                        $cmp = (string) reset($value); 
    11092                                 } 
    11093                                 else 
    11094                                 { 
     8954                                } else { 
    110958955                                        $cmp = (string) $value; 
    110968956                                } 
    11097                                 if (!in_array($cmp, $new_array_strings)) 
    11098                                 { 
     8957                                if (!in_array($cmp, $new_array_strings)) { 
    110998958                                        $new_array[$key] = $value; 
    111008959                                        $new_array_strings[] = $cmp; 
     
    111168975        { 
    111178976                $codepoint = (int) $codepoint; 
    11118                 if ($codepoint < 0) 
    11119                 { 
     8977                if ($codepoint < 0) { 
    111208978                        return false; 
    11121                 } 
    11122                 else if ($codepoint <= 0x7f) 
    11123                 { 
     8979                } else if ($codepoint <= 0x7f) { 
    111248980                        return chr($codepoint); 
    11125                 } 
    11126                 else if ($codepoint <= 0x7ff) 
    11127                 { 
    11128                         return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f)); 
    11129                 } 
    11130                 else if ($codepoint <= 0xffff) 
    11131                 { 
    11132                         return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); 
    11133                 } 
    11134                 else if ($codepoint <= 0x10ffff) 
    11135                 { 
    11136                         return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); 
    11137                 } 
    11138                 else 
    11139                 { 
     8981                } else if ($codepoint <= 0x7ff) { 
     8982                        return chr(0xc0 | ($codepoint >> 6)).chr(0x80 | ($codepoint & 0x3f)); 
     8983                } else if ($codepoint <= 0xffff) { 
     8984                        return chr(0xe0 | ($codepoint >> 12)).chr(0x80 | (($codepoint >> 6) & 0x3f)).chr(0x80 | ($codepoint & 0x3f)); 
     8985                } else if ($codepoint <= 0x10ffff) { 
     8986                        return chr(0xf0 | ($codepoint >> 18)).chr(0x80 | (($codepoint >> 12) & 0x3f)).chr(0x80 | (($codepoint >> 6) & 0x3f)).chr(0x80 | ($codepoint & 0x3f)); 
     8987                } else { 
    111408988                        // U+FFFD REPLACEMENT CHARACTER 
    111418989                        return "\xEF\xBF\xBD"; 
     
    111629010        function stripos($haystack, $needle, $offset = 0) 
    111639011        { 
    11164                 if (function_exists('stripos')) 
    11165                 { 
     9012                if (function_exists('stripos')) { 
    111669013                        return stripos($haystack, $needle, $offset); 
    11167                 } 
    11168                 else 
    11169                 { 
    11170                         if (is_string($needle)) 
    11171                         { 
     9014                } else { 
     9015                        if (is_string($needle)) { 
    111729016                                $needle = strtolower($needle); 
    11173                         } 
    11174                         elseif (is_int($needle) || is_bool($needle) || is_double($needle)) 
    11175                         { 
     9017                        } elseif (is_int($needle) || is_bool($needle) || is_double($needle)) { 
    111769018                                $needle = strtolower(chr($needle)); 
    11177                         } 
    11178                         else 
    11179                         { 
     9019                        } else { 
    111809020                                trigger_error('needle is not a string or an integer', E_USER_WARNING); 
    111819021                                return false; 
     
    112029042                $str = explode('&', $str); 
    112039043 
    11204                 foreach ($str as $section) 
    11205                 { 
    11206                         if (strpos($section, '=') !== false) 
    11207                         { 
     9044                foreach ($str as $section) { 
     9045                        if (strpos($section, '=') !== false) { 
    112089046                                list($name, $value) = explode('=', $section, 2); 
    112099047                                $return[urldecode($name)][] = urldecode($value); 
    11210                         } 
    11211                         else 
    11212                         { 
     9048                        } else { 
    112139049                                $return[urldecode($section)][] = null; 
    112149050                        } 
     
    112289064        { 
    112299065                // UTF-32 Big Endian BOM 
    11230                 if (substr($data, 0, 4) === "\x00\x00\xFE\xFF") 
    11231                 { 
     9066                if (substr($data, 0, 4) === "\x00\x00\xFE\xFF") { 
    112329067                        $encoding[] = 'UTF-32BE'; 
    112339068                } 
    112349069                // UTF-32 Little Endian BOM 
    11235                 elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00") 
    11236                 { 
     9070                elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00") { 
    112379071                        $encoding[] = 'UTF-32LE'; 
    112389072                } 
    112399073                // UTF-16 Big Endian BOM 
    11240                 elseif (substr($data, 0, 2) === "\xFE\xFF") 
    11241                 { 
     9074                elseif (substr($data, 0, 2) === "\xFE\xFF") { 
    112429075                        $encoding[] = 'UTF-16BE'; 
    112439076                } 
    112449077                // UTF-16 Little Endian BOM 
    11245                 elseif (substr($data, 0, 2) === "\xFF\xFE") 
    11246                 { 
     9078                elseif (substr($data, 0, 2) === "\xFF\xFE") { 
    112479079                        $encoding[] = 'UTF-16LE'; 
    112489080                } 
    112499081                // UTF-8 BOM 
    11250                 elseif (substr($data, 0, 3) === "\xEF\xBB\xBF") 
    11251                 { 
     9082                elseif (substr($data, 0, 3) === "\xEF\xBB\xBF") { 
    112529083                        $encoding[] = 'UTF-8'; 
    112539084                } 
    112549085                // UTF-32 Big Endian Without BOM 
    11255                 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") 
    11256                 { 
    11257                         if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E")) 
    11258                         { 
     9086                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") { 
     9087                        if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E")) { 
    112599088                                $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8')); 
    11260                                 if ($parser->parse()) 
    11261                                 { 
     9089                                if ($parser->parse()) { 
    112629090                                        $encoding[] = $parser->encoding; 
    112639091                                } 
     
    112669094                } 
    112679095                // UTF-32 Little Endian Without BOM 
    11268                 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") 
    11269                 { 
    11270                         if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00")) 
    11271                         { 
     9096                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") { 
     9097                        if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00")) { 
    112729098                                $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8')); 
    11273                                 if ($parser->parse()) 
    11274                                 { 
     9099                                if ($parser->parse()) { 
    112759100                                        $encoding[] = $parser->encoding; 
    112769101                                } 
     
    112799104                } 
    112809105                // UTF-16 Big Endian Without BOM 
    11281                 elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C") 
    11282                 { 
    11283                         if ($pos = strpos($data, "\x00\x3F\x00\x3E")) 
    11284                         { 
     9106                elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C") { 
     9107                        if ($pos = strpos($data, "\x00\x3F\x00\x3E")) { 
    112859108                                $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8')); 
    11286                                 if ($parser->parse()) 
    11287                                 { 
     9109                                if ($parser->parse()) { 
    112889110                                        $encoding[] = $parser->encoding; 
    112899111                                } 
     
    112929114                } 
    112939115                // UTF-16 Little Endian Without BOM 
    11294                 elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00") 
    11295                 { 
    11296                         if ($pos = strpos($data, "\x3F\x00\x3E\x00")) 
    11297                         { 
     9116                elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00") { 
     9117                        if ($pos = strpos($data, "\x3F\x00\x3E\x00")) { 
    112989118                                $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8')); 
    11299                                 if ($parser->parse()) 
    11300                                 { 
     9119                                if ($parser->parse()) { 
    113019120                                        $encoding[] = $parser->encoding; 
    113029121                                } 
     
    113059124                } 
    113069125                // US-ASCII (or superset) 
    11307                 elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C") 
    11308                 { 
    11309                         if ($pos = strpos($data, "\x3F\x3E")) 
    11310                         { 
     9126                elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C") { 
     9127                        if ($pos = strpos($data, "\x3F\x3E")) { 
    113119128                                $parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5)); 
    11312                                 if ($parser->parse()) 
    11313                                 { 
     9129                                if ($parser->parse()) { 
    113149130                                        $encoding[] = $parser->encoding; 
    113159131                                } 
     
    113189134                } 
    113199135                // Fallback to UTF-8 
    11320                 else 
    11321                 { 
     9136                else { 
    113229137                        $encoding[] = 'UTF-8'; 
    113239138                } 
     
    113279142        function output_javascript() 
    113289143        { 
    11329                 if (function_exists('ob_gzhandler')) 
    11330                 { 
     9144                if (function_exists('ob_gzhandler')) { 
    113319145                        ob_start('ob_gzhandler'); 
    113329146                } 
    113339147                header('Content-type: text/javascript; charset: UTF-8'); 
    113349148                header('Cache-Control: must-revalidate'); 
    11335                 header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days 
    11336                 ?> 
    11337 function embed_odeo(link) { 
    11338         document.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>'); 
    11339 } 
    11340  
    11341 function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) { 
    11342         if (placeholder != '') { 
    11343                 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>'); 
    11344         } 
    11345         else { 
    11346                 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>'); 
    11347         } 
    11348 } 
    11349  
    11350 function embed_flash(bgcolor, width, height, link, loop, type) { 
    11351         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>'); 
    11352 } 
    11353  
    11354 function embed_flv(width, height, link, placeholder, loop, player) { 
    11355         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>'); 
    11356 } 
    11357  
    11358 function embed_wmedia(width, height, link) { 
    11359         document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>'); 
    11360 } 
    11361                 <?php 
    11362         } 
     9149                header('Expires: '.gmdate('D, d M Y H:i:s', time() + 604800).' GMT'); // 7 days 
     9150?> 
     9151                function embed_odeo(link) { 
     9152                        document.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>'); 
     9153                } 
     9154 
     9155                function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) { 
     9156                        if (placeholder != '') { 
     9157                                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>'); 
     9158                        } 
     9159                        else { 
     9160                                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>'); 
     9161                        } 
     9162                } 
     9163 
     9164                function embed_flash(bgcolor, width, height, link, loop, type) { 
     9165                        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>'); 
     9166                } 
     9167 
     9168                function embed_flv(width, height, link, placeholder, loop, player) { 
     9169                        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>'); 
     9170                } 
     9171 
     9172                function embed_wmedia(width, height, link) { 
     9173                        document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>'); 
     9174                } 
     9175<?php 
     9176        } 
     9177 
    113639178} 
    113649179 
     
    113729187class SimplePie_Decode_HTML_Entities 
    113739188{ 
     9189 
    113749190        /** 
    113759191         * Data to be parsed 
     
    113799195         */ 
    113809196        var $data = ''; 
    11381  
    113829197        /** 
    113839198         * Currently consumed bytes 
     
    113879202         */ 
    113889203        var $consumed = ''; 
    11389  
    113909204        /** 
    113919205         * Position of the current byte being parsed 
     
    114159229        function parse() 
    114169230        { 
    11417                 while (($this->position = strpos($this->data, '&', $this->position)) !== false) 
    11418                 { 
     9231                while (($this->position = strpos($this->data, '&', $this->position)) !== false) { 
    114199232                        $this->consume(); 
    114209233                        $this->entity(); 
     
    114329245        function consume() 
    114339246        { 
    11434                 if (isset($this->data[$this->position])) 
    11435                 { 
     9247                if (isset($this->data[$this->position])) { 
    114369248                        $this->consumed .= $this->data[$this->position]; 
    114379249                        return $this->data[$this->position++]; 
    11438                 } 
    11439                 else 
    11440                 { 
     9250                } else { 
    114419251                        return false; 
    114429252                } 
     
    114529262        function consume_range($chars) 
    114539263        { 
    11454                 if ($len = strspn($this->data, $chars, $this->position)) 
    11455                 { 
     9264                if ($len = strspn($this->data, $chars, $this->position)) { 
    114569265                        $data = substr($this->data, $this->position, $len); 
    114579266                        $this->consumed .= $data; 
    114589267                        $this->position += $len; 
    114599268                        return $data; 
    11460                 } 
    11461                 else 
    11462                 { 
     9269                } else { 
    114639270                        return false; 
    114649271                } 
     
    114839290        function entity() 
    114849291        { 
    11485                 switch ($this->consume()) 
    11486                 { 
     9292                switch ($this->consume()) { 
    114879293                        case "\x09": 
    114889294                        case "\x0A": 
     
    114979303 
    114989304                        case "\x23": 
    11499                                 switch ($this->consume()) 
    11500                                 { 
     9305                                switch ($this->consume()) { 
    115019306                                        case "\x78": 
    115029307                                        case "\x58": 
     
    115129317                                } 
    115139318 
    11514                                 if ($codepoint = $this->consume_range($range)) 
    11515                                 { 
     9319                                if ($codepoint = $this->consume_range($range)) { 
    115169320                                        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"); 
    115179321 
    11518                                         if ($hex) 
    11519                                         { 
     9322                                        if ($hex) { 
    115209323                                                $codepoint = hexdec($codepoint); 
    11521                                         } 
    11522                                         else 
    11523                                         { 
     9324                                        } else { 
    115249325                                                $codepoint = intval($codepoint); 
    115259326                                        } 
    115269327 
    11527                                         if (isset($windows_1252_specials[$codepoint])) 
    11528                                         { 
     9328                                        if (isset($windows_1252_specials[$codepoint])) { 
    115299329                                                $replacement = $windows_1252_specials[$codepoint]; 
    11530                                         } 
    11531                                         else 
    11532                                         { 
     9330                                        } else { 
    115339331                                                $replacement = SimplePie_Misc::codepoint_to_utf8($codepoint); 
    115349332                                        } 
    115359333 
    11536                                         if (!in_array($this->consume(), array(';', false), true)) 
    11537                                         { 
     9334                                        if (!in_array($this->consume(), array(';', false), true)) { 
    115389335                                                $this->unconsume(); 
    115399336                                        } 
     
    115489345                                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"); 
    115499346 
    11550                                 for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++) 
    11551                                 { 
     9347                                for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++) { 
    115529348                                        $consumed = substr($this->consumed, 1); 
    11553                                         if (isset($entities[$consumed])) 
    11554                                         { 
     9349                                        if (isset($entities[$consumed])) { 
    115559350                                                $match = $consumed; 
    115569351                                        } 
    115579352                                } 
    115589353 
    11559                                 if ($match !== null) 
    11560                                 { 
    11561                                         $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1); 
     9354                                if ($match !== null) { 
     9355                                        $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1); 
    115629356                                        $this->position += strlen($entities[$match]) - strlen($consumed) - 1; 
    115639357                                } 
     
    115659359                } 
    115669360        } 
     9361 
    115679362} 
    115689363 
     
    115749369class SimplePie_IRI 
    115759370{ 
     9371 
    115769372        /** 
    115779373         * Scheme 
     
    115819377         */ 
    115829378        var $scheme; 
    11583  
    115849379        /** 
    115859380         * User Information 
     
    115899384         */ 
    115909385        var $userinfo; 
    11591  
    115929386        /** 
    115939387         * Host 
     
    115979391         */ 
    115989392        var $host; 
    11599  
    116009393        /** 
    116019394         * Port 
     
    116059398         */ 
    116069399        var $port; 
    11607  
    116089400        /** 
    116099401         * Path 
     
    116139405         */ 
    116149406        var $path; 
    11615  
    116169407        /** 
    116179408         * Query 
     
    116219412         */ 
    116229413        var $query; 
    11623  
    116249414        /** 
    116259415         * Fragment 
     
    116299419         */ 
    116309420        var $fragment; 
    11631  
    116329421        /** 
    116339422         * Whether the object represents a valid IRI 
     
    116599448        { 
    116609449                $iri = (string) $iri; 
    11661                 if ($iri !== '') 
    11662                 { 
     9450                if ($iri !== '') { 
    116639451                        $parsed = $this->parse_iri($iri); 
    116649452                        $this->set_scheme($parsed['scheme']); 
     
    116829470        { 
    116839471                $relative = (string) $relative; 
    11684                 if ($relative !== '') 
    11685                 { 
     9472                if ($relative !== '') { 
    116869473                        $relative = new SimplePie_IRI($relative); 
    11687                         if ($relative->get_scheme() !== null) 
    11688                         { 
     9474                        if ($relative->get_scheme() !== null) { 
    116899475                                $target = $relative; 
    11690                         } 
    11691                         elseif ($base->get_iri() !== null) 
    11692                         { 
    11693                                 if ($relative->get_authority() !== null) 
    11694                                 { 
     9476                        } elseif ($base->get_iri() !== null) { 
     9477                                if ($relative->get_authority() !== null) { 
    116959478                                        $target = $relative; 
    116969479                                        $target->set_scheme($base->get_scheme()); 
    11697                                 } 
    11698                                 else 
    11699                                 { 
     9480                                } else { 
    117009481                                        $target = new SimplePie_IRI(''); 
    117019482                                        $target->set_scheme($base->get_scheme()); 
     
    117039484                                        $target->set_host($base->get_host()); 
    117049485                                        $target->set_port($base->get_port()); 
    11705                                         if ($relative->get_path() !== null) 
    11706                                         { 
    11707                                                 if (strpos($relative->get_path(), '/') === 0) 
    11708                                                 { 
     9486                                        if ($relative->get_path() !== null) { 
     9487                                                if (strpos($relative->get_path(), '/') === 0) { 
    117099488                                                        $target->set_path($relative->get_path()); 
    11710                                                 } 
    11711                                                 elseif (($base->get_userinfo() !== null || $base->get_host() !== null || $base->get_port() !== null) && $base->get_path() === null) 
    11712                                                 { 
    11713                                                         $target->set_path('/' . $relative->get_path()); 
    11714                                                 } 
    11715                                                 elseif (($last_segment = strrpos($base->get_path(), '/')) !== false) 
    11716                                                 { 
    11717                                                         $target->set_path(substr($base->get_path(), 0, $last_segment + 1) . $relative->get_path()); 
    11718                                                 } 
    11719                                                 else 
    11720                                                 { 
     9489                                                } elseif (($base->get_userinfo() !== null || $base->get_host() !== null || $base->get_port() !== null) && $base->get_path() === null) { 
     9490                                                        $target->set_path('/'.$relative->get_path()); 
     9491                                                } elseif (($last_segment = strrpos($base->get_path(), '/')) !== false) { 
     9492                                                        $target->set_path(substr($base->get_path(), 0, $last_segment + 1).$relative->get_path()); 
     9493                                                } else { 
    117219494                                                        $target->set_path($relative->get_path()); 
    117229495                                                } 
    117239496                                                $target->set_query($relative->get_query()); 
    11724                                         } 
    11725                                         else 
    11726                                         { 
     9497                                        } else { 
    117279498                                                $target->set_path($base->get_path()); 
    11728                                                 if ($relative->get_query() !== null) 
    11729                                                 { 
     9499                                                if ($relative->get_query() !== null) { 
    117309500                                                        $target->set_query($relative->get_query()); 
    11731                                                 } 
    11732                                                 elseif ($base->get_query() !== null) 
    11733                                                 { 
     9501                                                } elseif ($base->get_query() !== null) { 
    117349502                                                        $target->set_query($base->get_query()); 
    117359503                                                } 
     
    117379505                                } 
    117389506                                $target->set_fragment($relative->get_fragment()); 
    11739                         } 
    11740                         else 
    11741                         { 
     9507                        } else { 
    117429508                                // No base URL, just return the relative URL 
    117439509                                $target = $relative; 
    117449510                        } 
    11745                 } 
    11746                 else 
    11747                 { 
     9511                } else { 
    117489512                        $target = $base; 
    117499513                } 
     
    117619525        { 
    117629526                preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $iri, $match); 
    11763                 for ($i = count($match); $i <= 9; $i++) 
    11764                 { 
     9527                for ($i = count($match); $i <= 9; $i++) { 
    117659528                        $match[$i] = ''; 
    117669529                } 
     
    117789541        { 
    117799542                $output = ''; 
    11780                 while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') 
    11781                 { 
     9543                while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') { 
    117829544                        // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise, 
    11783                         if (strpos($input, '../') === 0) 
    11784                         { 
     9545                        if (strpos($input, '../') === 0) { 
    117859546                                $input = substr($input, 3); 
    11786                         } 
    11787                         elseif (strpos($input, './') === 0) 
    11788                         { 
     9547                        } elseif (strpos($input, './') === 0) { 
    117899548                                $input = substr($input, 2); 
    117909549                        } 
    117919550                        // 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, 
    11792                         elseif (strpos($input, '/./') === 0) 
    11793                         { 
     9551                        elseif (strpos($input, '/./') === 0) { 
    117949552                                $input = substr_replace($input, '/', 0, 3); 
    11795                         } 
    11796                         elseif ($input === '/.') 
    11797                         { 
     9553                        } elseif ($input === '/.') { 
    117989554                                $input = '/'; 
    117999555                        } 
    118009556                        // 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, 
    11801                         elseif (strpos($input, '/../') === 0) 
    11802                         { 
     9557                        elseif (strpos($input, '/../') === 0) { 
    118039558                                $input = substr_replace($input, '/', 0, 4); 
    118049559                                $output = substr_replace($output, '', strrpos($output, '/')); 
    11805                         } 
    11806                         elseif ($input === '/..') 
    11807                         { 
     9560                        } elseif ($input === '/..') { 
    118089561                                $input = '/'; 
    118099562                                $output = substr_replace($output, '', strrpos($output, '/')); 
    118109563                        } 
    118119564                        // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise, 
    11812                         elseif ($input === '.' || $input === '..') 
    11813                         { 
     9565                        elseif ($input === '.' || $input === '..') { 
    118149566                                $input = ''; 
    118159567                        } 
    118169568                        // 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 
    11817                         elseif (($pos = strpos($input, '/', 1)) !== false) 
    11818                         { 
     9569                        elseif (($pos = strpos($input, '/', 1)) !== false) { 
    118199570                                $output .= substr($input, 0, $pos); 
    118209571                                $input = substr_replace($input, '', 0, $pos); 
    11821                         } 
    11822                         else 
    11823                         { 
     9572                        } else { 
    118249573                                $output .= $input; 
    118259574                                $input = ''; 
    118269575                        } 
    118279576                } 
    11828                 return $output . $input; 
     9577                return $output.$input; 
    118299578        } 
    118309579 
     
    118419590        { 
    118429591                // Normalise case 
    11843                 if ($case & SIMPLEPIE_LOWERCASE) 
    11844                 { 
     9592                if ($case & SIMPLEPIE_LOWERCASE) { 
    118459593                        $string = strtolower($string); 
    11846                 } 
    11847                 elseif ($case & SIMPLEPIE_UPPERCASE) 
    11848                 { 
     9594                } elseif ($case & SIMPLEPIE_UPPERCASE) { 
    118499595                        $string = strtoupper($string); 
    118509596                } 
     
    118559601 
    118569602                // Loop as long as we have invalid characters, advancing the position to the next invalid character 
    11857                 while (($position += strspn($string, $valid_chars, $position)) < $strlen) 
    11858                 { 
     9603                while (($position += strspn($string, $valid_chars, $position)) < $strlen) { 
    118599604                        // If we have a % character 
    11860                         if ($string[$position] === '%') 
    11861                         { 
     9605                        if ($string[$position] === '%') { 
    118629606                                // If we have a pct-encoded section 
    11863                                 if ($position + 2 < $strlen && strspn($string, '0123456789ABCDEFabcdef', $position + 1, 2) === 2) 
    11864                                 { 
     9607                                if ($position + 2 < $strlen && strspn($string, '0123456789ABCDEFabcdef', $position + 1, 2) === 2) { 
    118659608                                        // Get the the represented character 
    118669609                                        $chr = chr(hexdec(substr($string, $position + 1, 2))); 
    118679610 
    118689611                                        // If the character is valid, replace the pct-encoded with the actual character while normalising case 
    11869                                         if (strpos($valid_chars, $chr) !== false) 
    11870                                         { 
    11871                                                 if ($case & SIMPLEPIE_LOWERCASE) 
    11872                                                 { 
     9612                                        if (strpos($valid_chars, $chr) !== false) { 
     9613                                                if ($case & SIMPLEPIE_LOWERCASE) { 
    118739614                                                        $chr = strtolower($chr); 
    11874                                                 } 
    11875                                                 elseif ($case & SIMPLEPIE_UPPERCASE) 
    11876                                                 { 
     9615                                                } elseif ($case & SIMPLEPIE_UPPERCASE) { 
    118779616                                                        $chr = strtoupper($chr); 
    118789617                                                } 
     
    118839622 
    118849623                                        // Otherwise just normalise the pct-encoded to uppercase 
    11885                                         else 
    11886                                         { 
     9624                                        else { 
    118879625                                                $string = substr_replace($string, strtoupper(substr($string, $position + 1, 2)), $position + 1, 2); 
    118889626                                                $position += 3; 
     
    118909628                                } 
    118919629                                // If we don't have a pct-encoded section, just replace the % with its own esccaped form 
    11892                                 else 
    11893                                 { 
     9630                                else { 
    118949631                                        $string = substr_replace($string, '%25', $position, 1); 
    118959632                                        $strlen += 2; 
     
    118989635                        } 
    118999636                        // If we have an invalid character, change into its pct-encoded form 
    11900                         else 
    11901                         { 
     9637                        else { 
    119029638                                $replacement = sprintf("%%%02X", ord($string[$position])); 
    119039639                                $string = str_replace($string[$position], $replacement, $string); 
     
    119299665        function set_scheme($scheme) 
    119309666        { 
    11931                 if ($scheme === null || $scheme === '') 
    11932                 { 
     9667                if ($scheme === null || $scheme === '') { 
    119339668                        $this->scheme = null; 
    11934                 } 
    11935                 else 
    11936                 { 
     9669                } else { 
    119379670                        $len = strlen($scheme); 
    11938                         switch (true) 
    11939                         { 
     9671                        switch (true) { 
    119409672                                case $len > 1: 
    11941                                         if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1)) 
    11942                                         { 
     9673                                        if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1)) { 
    119439674                                                $this->scheme = null; 
    119449675                                                $this->valid[__FUNCTION__] = false; 
     
    119479678 
    119489679                                case $len > 0: 
    11949                                         if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1)) 
    11950                                         { 
     9680                                        if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1)) { 
    119519681                                                $this->scheme = null; 
    119529682                                                $this->valid[__FUNCTION__] = false; 
     
    119709700        function set_authority($authority) 
    119719701        { 
    11972                 if (($userinfo_end = strrpos($authority, '@')) !== false) 
    11973                 { 
     9702                if (($userinfo_end = strrpos($authority, '@')) !== false) { 
    119749703                        $userinfo = substr($authority, 0, $userinfo_end); 
    119759704                        $authority = substr($authority, $userinfo_end + 1); 
    11976                 } 
    11977                 else 
    11978                 { 
     9705                } else { 
    119799706                        $userinfo = null; 
    119809707                } 
    119819708 
    11982                 if (($port_start = strpos($authority, ':')) !== false) 
    11983                 { 
     9709                if (($port_start = strpos($authority, ':')) !== false) { 
    119849710                        $port = substr($authority, $port_start + 1); 
    119859711                        $authority = substr($authority, 0, $port_start); 
    11986                 } 
    11987                 else 
    11988                 { 
     9712                } else { 
    119899713                        $port = null; 
    119909714                } 
     
    120029726        function set_userinfo($userinfo) 
    120039727        { 
    12004                 if ($userinfo === null || $userinfo === '') 
    12005                 { 
     9728                if ($userinfo === null || $userinfo === '') { 
    120069729                        $this->userinfo = null; 
    12007                 } 
    12008                 else 
    12009                 { 
     9730                } else { 
    120109731                        $this->userinfo = $this->replace_invalid_with_pct_encoding($userinfo, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:'); 
    120119732                } 
     
    120249745        function set_host($host) 
    120259746        { 
    12026                 if ($host === null || $host === '') 
    12027                 { 
     9747                if ($host === null || $host === '') { 
    120289748                        $this->host = null; 
    120299749                        $this->valid[__FUNCTION__] = true; 
    120309750                        return true; 
    12031                 } 
    12032                 elseif ($host[0] === '[' && substr($host, -1) === ']') 
    12033                 { 
    12034                         if (Net_IPv6::checkIPv6(substr($host, 1, -1))) 
    12035                         { 
     9751                } elseif ($host[0] === '[' && substr($host, -1) === ']') { 
     9752                        if (Net_IPv6::checkIPv6(substr($host, 1, -1))) { 
    120369753                                $this->host = $host; 
    120379754                                $this->valid[__FUNCTION__] = true; 
    120389755                                return true; 
    12039                         } 
    12040                         else 
    12041                         { 
     9756                        } else { 
    120429757                                $this->host = null; 
    120439758                                $this->valid[__FUNCTION__] = false; 
    120449759                                return false; 
    120459760                        } 
    12046                 } 
    12047                 else 
    12048                 { 
     9761                } else { 
    120499762                        $this->host = $this->replace_invalid_with_pct_encoding($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=', SIMPLEPIE_LOWERCASE); 
    120509763                        $this->valid[__FUNCTION__] = true; 
     
    120639776        function set_port($port) 
    120649777        { 
    12065                 if ($port === null || $port === '') 
    12066                 { 
     9778                if ($port === null || $port === '') { 
    120679779                        $this->port = null; 
    120689780                        $this->valid[__FUNCTION__] = true; 
    120699781                        return true; 
    12070                 } 
    12071                 elseif (strspn($port, '0123456789') === strlen($port)) 
    12072                 { 
     9782                } elseif (strspn($port, '0123456789') === strlen($port)) { 
    120739783                        $this->port = (int) $port; 
    120749784                        $this->valid[__FUNCTION__] = true; 
    120759785                        return true; 
    12076                 } 
    12077                 else 
    12078                 { 
     9786                } else { 
    120799787                        $this->port = null; 
    120809788                        $this->valid[__FUNCTION__] = false; 
     
    120929800        function set_path($path) 
    120939801        { 
    12094                 if ($path === null || $path === '') 
    12095                 { 
     9802                if ($path === null || $path === '') { 
    120969803                        $this->path = null; 
    120979804                        $this->valid[__FUNCTION__] = true; 
    120989805                        return true; 
    12099                 } 
    12100                 elseif (substr($path, 0, 2) === '//' && $this->userinfo === null && $this->host === null && $this->port === null) 
    12101                 { 
     9806                } elseif (substr($path, 0, 2) === '//' && $this->userinfo === null && $this->host === null && $this->port === null) { 
    121029807                        $this->path = null; 
    121039808                        $this->valid[__FUNCTION__] = false; 
    121049809                        return false; 
    12105                 } 
    12106                 else 
    12107                 { 
     9810                } else { 
    121089811                        $this->path = $this->replace_invalid_with_pct_encoding($path, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=@/'); 
    12109                         if ($this->scheme !== null) 
    12110                         { 
     9812                        if ($this->scheme !== null) { 
    121119813                                $this->path = $this->remove_dot_segments($this->path); 
    121129814                        } 
     
    121259827        function set_query($query) 
    121269828        { 
    12127                 if ($query === null || $query === '') 
    12128                 { 
     9829                if ($query === null || $query === '') { 
    121299830                        $this->query = null; 
    12130                 } 
    12131                 else 
    12132                 { 
     9831                } else { 
    121339832                        $this->query = $this->replace_invalid_with_pct_encoding($query, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?'); 
    121349833                } 
     
    121469845        function set_fragment($fragment) 
    121479846        { 
    12148                 if ($fragment === null || $fragment === '') 
    12149                 { 
     9847                if ($fragment === null || $fragment === '') { 
    121509848                        $this->fragment = null; 
    12151                 } 
    12152                 else 
    12153                 { 
     9849                } else { 
    121549850                        $this->fragment = $this->replace_invalid_with_pct_encoding($fragment, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?'); 
    121559851                } 
     
    121679863        { 
    121689864                $iri = ''; 
    12169                 if ($this->scheme !== null) 
    12170                 { 
    12171                         $iri .= $this->scheme . ':'; 
    12172                 } 
    12173                 if (($authority = $this->get_authority()) !== null) 
    12174                 { 
    12175                         $iri .= '//' . $authority; 
    12176                 } 
    12177                 if ($this->path !== null) 
    12178                 { 
     9865                if ($this->scheme !== null) { 
     9866                        $iri .= $this->scheme.':'; 
     9867                } 
     9868                if (($authority = $this->get_authority()) !== null) { 
     9869                        $iri .= '//'.$authority; 
     9870                } 
     9871                if ($this->path !== null) { 
    121799872                        $iri .= $this->path; 
    121809873                } 
    12181                 if ($this->query !== null) 
    12182                 { 
    12183                         $iri .= '?' . $this->query; 
    12184                 } 
    12185                 if ($this->fragment !== null) 
    12186                 { 
    12187                         $iri .= '#' . $this->fragment; 
    12188                 } 
    12189  
    12190                 if ($iri !== '') 
    12191                 { 
     9874                if ($this->query !== null) { 
     9875                        $iri .= '?'.$this->query; 
     9876                } 
     9877                if ($this->fragment !== null) { 
     9878                        $iri .= '#'.$this->fragment; 
     9879                } 
     9880 
     9881                if ($iri !== '') { 
    121929882                        return $iri; 
    12193                 } 
    12194                 else 
    12195                 { 
     9883                } else { 
    121969884                        return null; 
    121979885                } 
     
    122189906        { 
    122199907                $authority = ''; 
    12220                 if ($this->userinfo !== null) 
    12221                 { 
    12222                         $authority .= $this->userinfo . '@'; 
    12223                 } 
    12224                 if ($this->host !== null) 
    12225                 { 
     9908                if ($this->userinfo !== null) { 
     9909                        $authority .= $this->userinfo.'@'; 
     9910                } 
     9911                if ($this->host !== null) { 
    122269912                        $authority .= $this->host; 
    122279913                } 
    12228                 if ($this->port !== null) 
    12229                 { 
    12230                         $authority .= ':' . $this->port; 
    12231                 } 
    12232  
    12233                 if ($authority !== '') 
    12234                 { 
     9914                if ($this->port !== null) { 
     9915                        $authority .= ':'.$this->port; 
     9916                } 
     9917 
     9918                if ($authority !== '') { 
    122359919                        return $authority; 
    12236                 } 
    12237                 else 
    12238                 { 
     9920                } else { 
    122399921                        return null; 
    122409922                } 
     
    123069988                return $this->fragment; 
    123079989        } 
    12308 } 
    12309  
    12310 /** 
    12311  * Class to validate and to work with IPv6 addresses. 
    12312  * 
    12313  * @package SimplePie 
    12314  * @copyright 2003-2005 The PHP Group 
    12315  * @license http://www.opensource.org/licenses/bsd-license.php 
    12316  * @link http://pear.php.net/package/Net_IPv6 
    12317  * @author Alexander Merz <alexander.merz@web.de> 
    12318  * @author elfrink at introweb dot nl 
    12319  * @author Josh Peck <jmp at joshpeck dot org> 
    12320  * @author Geoffrey Sneddon <geoffers@gmail.com> 
    12321  */ 
    12322 class SimplePie_Net_IPv6 
    12323 { 
    12324         /** 
    12325          * Removes a possible existing netmask specification of an IP address. 
    12326          * 
    12327          * @param string $ip the (compressed) IP as Hex representation 
    12328          * @return string the IP the without netmask 
    12329          * @since 1.1.0 
    12330          * @access public 
    12331          * @static 
    12332          */ 
    12333         function removeNetmaskSpec($ip) 
    12334         { 
    12335                 if (strpos($ip, '/') !== false) 
    12336                 { 
    12337                         list($addr, $nm) = explode('/', $ip); 
    12338                 } 
    12339                 else 
    12340                 { 
    12341                         $addr = $ip; 
    12342                 } 
    12343                 return $addr; 
    12344         } 
    12345  
    12346         /** 
    12347          * Uncompresses an IPv6 address 
    12348          * 
    12349          * RFC 2373 allows you to compress zeros in an address to '::'. This 
    12350          * function expects an valid IPv6 address and expands the '::' to 
    12351          * the required zeros. 
    12352          * 
    12353          * Example:      FF01::101      ->      FF01:0:0:0:0:0:0:101 
    12354          *                       ::1            ->      0:0:0:0:0:0:0:1 
    12355          * 
    12356          * @access public 
    12357          * @static 
    12358          * @param string $ip a valid IPv6-address (hex format) 
    12359          * @return string the uncompressed IPv6-address (hex format) 
    12360          */ 
    12361         function Uncompress($ip) 
    12362         { 
    12363                 $uip = SimplePie_Net_IPv6::removeNetmaskSpec($ip); 
    12364                 $c1 = -1; 
    12365                 $c2 = -1; 
    12366                 if (strpos($ip, '::') !== false) 
    12367                 { 
    12368                         list($ip1, $ip2) = explode('::', $ip); 
    12369                         if ($ip1 === '') 
    12370                         { 
    12371                                 $c1 = -1; 
    12372                         } 
    12373                         else 
    12374                         { 
    12375                                 $pos = 0; 
    12376                                 if (($pos = substr_count($ip1, ':')) > 0) 
    12377                                 { 
    12378                                         $c1 = $pos; 
    12379                                 } 
    12380                                 else 
    12381                                 { 
    12382                                         $c1 = 0; 
    12383                                 } 
    12384                         } 
    12385                         if ($ip2 === '') 
    12386                         { 
    12387                                 $c2 = -1; 
    12388                         } 
    12389                         else 
    12390                         { 
    12391                                 $pos = 0; 
    12392                                 if (($pos = substr_count($ip2, ':')) > 0) 
    12393                                 { 
    12394                                         $c2 = $pos; 
    12395                                 } 
    12396                                 else 
    12397                                 { 
    12398                                         $c2 = 0; 
    12399                                 } 
    12400                         } 
    12401                         if (strstr($ip2, '.')) 
    12402                         { 
    12403                                 $c2++; 
    12404                         } 
    12405                         // :: 
    12406                         if ($c1 === -1 && $c2 === -1) 
    12407                         { 
    12408                                 $uip = '0:0:0:0:0:0:0:0'; 
    12409                         } 
    12410                         // ::xxx 
    12411                         else if ($c1 === -1) 
    12412                         { 
    12413                                 $fill = str_repeat('0:', 7 - $c2); 
    12414                                 $uip =  str_replace('::', $fill, $uip); 
    12415                         } 
    12416                         // xxx:: 
    12417                         else if ($c2 === -1) 
    12418                         { 
    12419                                 $fill = str_repeat(':0', 7 - $c1); 
    12420                                 $uip =  str_replace('::', $fill, $uip); 
    12421                         } 
    12422                         // xxx::xxx 
    12423                         else 
    12424                         { 
    12425                                 $fill = str_repeat(':0:', 6 - $c2 - $c1); 
    12426                                 $uip =  str_replace('::', $fill, $uip); 
    12427                                 $uip =  str_replace('::', ':', $uip); 
    12428                         } 
    12429                 } 
    12430                 return $uip; 
    12431         } 
    12432  
    12433         /** 
    12434          * Splits an IPv6 address into the IPv6 and a possible IPv4 part 
    12435          * 
    12436          * RFC 2373 allows you to note the last two parts of an IPv6 address as 
    12437          * an IPv4 compatible address 
    12438          * 
    12439          * Example:      0:0:0:0:0:0:13.1.68.3 
    12440          *                       0:0:0:0:0:FFFF:129.144.52.38 
    12441          * 
    12442          * @access public 
    12443          * @static 
    12444          * @param string $ip a valid IPv6-address (hex format) 
    12445          * @return array [0] contains the IPv6 part, [1] the IPv4 part (hex format) 
    12446          */ 
    12447         function SplitV64($ip) 
    12448         { 
    12449                 $ip = SimplePie_Net_IPv6::Uncompress($ip); 
    12450                 if (strstr($ip, '.')) 
    12451                 { 
    12452                         $pos = strrpos($ip, ':'); 
    12453                         $ip[$pos] = '_'; 
    12454                         $ipPart = explode('_', $ip); 
    12455                         return $ipPart; 
    12456                 } 
    12457                 else 
    12458                 { 
    12459                         return array($ip, ''); 
    12460                 } 
    12461         } 
    12462  
    12463         /** 
    12464          * Checks an IPv6 address 
    12465          * 
    12466          * Checks if the given IP is IPv6-compatible 
    12467          * 
    12468          * @access public 
    12469          * @static 
    12470          * @param string $ip a valid IPv6-address 
    12471          * @return bool true if $ip is an IPv6 address 
    12472          */ 
    12473         function checkIPv6($ip) 
    12474         { 
    12475                 $ipPart = SimplePie_Net_IPv6::SplitV64($ip); 
    12476                 $count = 0; 
    12477                 if (!empty($ipPart[0])) 
    12478                 { 
    12479                         $ipv6 = explode(':', $ipPart[0]); 
    12480                         for ($i = 0; $i < count($ipv6); $i++) 
    12481                         { 
    12482                                 $dec = hexdec($ipv6[$i]); 
    12483                                 $hex = strtoupper(preg_replace('/^[0]{1,3}(.*[0-9a-fA-F])$/', '\\1', $ipv6[$i])); 
    12484                                 if ($ipv6[$i] >= 0 && $dec <= 65535 && $hex === strtoupper(dechex($dec))) 
    12485                                 { 
    12486                                         $count++; 
    12487                                 } 
    12488                         } 
    12489                         if ($count === 8) 
    12490                         { 
    12491                                 return true; 
    12492                         } 
    12493                         elseif ($count === 6 && !empty($ipPart[1])) 
    12494                         { 
    12495                                 $ipv4 = explode('.', $ipPart[1]); 
    12496                                 $count = 0; 
    12497                                 foreach ($ipv4 as $ipv4_part) 
    12498                                 { 
    12499                                         if ($ipv4_part >= 0 && $ipv4_part <= 255 && preg_match('/^\d{1,3}$/', $ipv4_part)) 
    12500                                         { 
    12501                                                 $count++; 
    12502                                         } 
    12503                                 } 
    12504                                 if ($count === 4) 
    12505                                 { 
    12506                                         return true; 
    12507                                 } 
    12508                         } 
    12509                         else 
    12510                         { 
    12511                                 return false; 
    12512                         } 
    12513  
    12514                 } 
    12515                 else 
    12516                 { 
    12517                         return false; 
    12518                 } 
    12519         } 
     9990 
    125209991} 
    125219992 
     
    125279998class SimplePie_Parse_Date 
    125289999{ 
     10000 
    1252910001        /** 
    1253010002         * Input data 
     
    1253410006         */ 
    1253510007        var $date; 
    12536  
    1253710008        /** 
    1253810009         * List of days, calendar day name => ordinal day number in the week 
     
    1262310094                'Κυρ' => 7, 
    1262410095        ); 
    12625  
    1262610096        /** 
    1262710097         * List of months, calendar month name => calendar month number 
     
    1276810238                'Δεκ' => 12, 
    1276910239        ); 
    12770  
    1277110240        /** 
    1277210241         * List of timezones, abbreviation => offset from UTC 
     
    1297610445                'YEKT' => 18000, 
    1297710446        ); 
    12978  
    1297910447        /** 
    1298010448         * Cached PCRE for SimplePie_Parse_Date::$day 
     
    1298410452         */ 
    1298510453        var $day_pcre; 
    12986  
    1298710454        /** 
    1298810455         * Cached PCRE for SimplePie_Parse_Date::$month 
     
    1299210459         */ 
    1299310460        var $month_pcre; 
    12994  
    1299510461        /** 
    1299610462         * Array of user-added callback methods 
     
    1300010466         */ 
    1300110467        var $built_in = array(); 
    13002  
    1300310468        /** 
    1300410469         * Array of user-added callback methods 
     
    1301710482        function SimplePie_Parse_Date() 
    1301810483        { 
    13019                 $this->day_pcre = '(' . implode(array_keys($this->day), '|') . ')'; 
    13020                 $this->month_pcre = '(' . implode(array_keys($this->month), '|') . ')'; 
     10484                $this->day_pcre = '('.implode(array_keys($this->day), '|').')'; 
     10485                $this->month_pcre = '('.implode(array_keys($this->month), '|').')'; 
    1302110486 
    1302210487                static $cache; 
    13023                 if (!isset($cache[get_class($this)])) 
    13024                 { 
     10488                if (!isset($cache[get_class($this)])) { 
    1302510489                        $all_methods = get_class_methods($this); 
    1302610490 
    13027                         foreach ($all_methods as $method) 
    13028                         { 
    13029                                 if (strtolower(substr($method, 0, 5)) === 'date_') 
    13030                                 { 
     10491                        foreach ($all_methods as $method) { 
     10492                                if (strtolower(substr($method, 0, 5)) === 'date_') { 
    1303110493                                        $cache[get_class($this)][] = $method; 
    1303210494                                } 
     
    1303410496                } 
    1303510497 
    13036                 foreach ($cache[get_class($this)] as $method) 
    13037                 { 
     10498                foreach ($cache[get_class($this)] as $method) { 
    1303810499                        $this->built_in[] = $method; 
    1303910500                } 
     
    1304810509        { 
    1304910510                static $object; 
    13050                 if (!$object) 
    13051                 { 
     10511                if (!$object) { 
    1305210512                        $object = new SimplePie_Parse_Date; 
    1305310513                } 
     
    1306510525        function parse($date) 
    1306610526        { 
    13067                 foreach ($this->user as $method) 
    13068                 { 
    13069                         if (($returned = call_user_func($method, $date)) !== false) 
    13070                         { 
     10527                foreach ($this->user as $method) { 
     10528                        if (($returned = call_user_func($method, $date)) !== false) { 
    1307110529                                return $returned; 
    1307210530                        } 
    1307310531                } 
    1307410532 
    13075                 foreach ($this->built_in as $method) 
    13076                 { 
    13077                         if (($returned = call_user_func(array(&$this, $method), $date)) !== false) 
    13078                         { 
     10533                foreach ($this->built_in as $method) { 
     10534                        if (($returned = call_user_func(array(&$this, $method), $date)) !== false) { 
    1307910535                                return $returned; 
    1308010536                        } 
     
    1309310549        function add_callback($callback) 
    1309410550        { 
    13095                 if (is_callable($callback)) 
    13096                 { 
     10551                if (is_callable($callback)) { 
    1309710552                        $this->user[] = $callback; 
    13098                 } 
    13099                 else 
    13100                 { 
     10553                } else { 
    1310110554                        trigger_error('User-supplied function must be a valid callback', E_USER_WARNING); 
    1310210555                } 
     
    1311410567        { 
    1311510568                static $pcre; 
    13116                 if (!$pcre) 
    13117                 { 
     10569                if (!$pcre) { 
    1311810570                        $year = '([0-9]{4})'; 
    1311910571                        $month = $day = $hour = $minute = $second = '([0-9]{2})'; 
    1312010572                        $decimal = '([0-9]*)'; 
    1312110573                        $zone = '(?:(Z)|([+\-])([0-9]{1,2}):?([0-9]{1,2}))'; 
    13122                         $pcre = '/^' . $year . '(?:-?' . $month . '(?:-?' . $day . '(?:[Tt\x09\x20]+' . $hour . '(?::?' . $minute . '(?::?' . $second . '(?:.' . $decimal . ')?)?)?' . $zone . ')?)?)?$/'; 
    13123                 } 
    13124                 if (preg_match($pcre, $date, $match)) 
    13125                 { 
     10574                        $pcre = '/^'.$year.'(?:-?'.$month.'(?:-?'.$day.'(?:[Tt\x09\x20]+'.$hour.'(?::?'.$minute.'(?::?'.$second.'(?:.'.$decimal.')?)?)?'.$zone.')?)?)?$/'; 
     10575                } 
     10576                if (preg_match($pcre, $date, $match)) { 
    1312610577                        /* 
    13127                         Capturing subpatterns: 
    13128                         1: Year 
    13129                         2: Month 
    13130                         3: Day 
    13131                         4: Hour 
    13132                         5: Minute 
    13133                         6: Second 
    13134                         7: Decimal fraction of a second 
    13135                         8: Zulu 
    13136                         9: Timezone ± 
    13137                         10: Timezone hours 
    13138                         11: Timezone minutes 
    13139                         */ 
     10578                          Capturing subpatterns: 
     10579                          1: Year 
     10580                          2: Month 
     10581                          3: Day 
     10582                          4: Hour 
     10583                          5: Minute 
     10584                          6: Second 
     10585                          7: Decimal fraction of a second 
     10586                          8: Zulu 
     10587                          9: Timezone ± 
     10588                          10: Timezone hours 
     10589                          11: Timezone minutes 
     10590                         */ 
    1314010591 
    1314110592                        // Fill in empty matches 
    13142                         for ($i = count($match); $i <= 3; $i++) 
    13143                         { 
     10593                        for ($i = count($match); $i <= 3; $i++) { 
    1314410594                                $match[$i] = '1'; 
    1314510595                        } 
    1314610596 
    13147                         for ($i = count($match); $i <= 7; $i++) 
    13148                         { 
     10597                        for ($i = count($match); $i <= 7; $i++) { 
    1314910598                                $match[$i] = '0'; 
    1315010599                        } 
    1315110600 
    1315210601                        // Numeric timezone 
    13153                         if (isset($match[9]) && $match[9] !== '') 
    13154                         { 
     10602                        if (isset($match[9]) && $match[9] !== '') { 
    1315510603                                $timezone = $match[10] * 3600; 
    1315610604                                $timezone += $match[11] * 60; 
    13157                                 if ($match[9] === '-') 
    13158                                 { 
     10605                                if ($match[9] === '-') { 
    1315910606                                        $timezone = 0 - $timezone; 
    1316010607                                } 
    13161                         } 
    13162                         else 
    13163                         { 
     10608                        } else { 
    1316410609                                $timezone = 0; 
    1316510610                        } 
     
    1316910614 
    1317010615                        return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone; 
    13171                 } 
    13172                 else 
    13173                 { 
     10616                } else { 
    1317410617                        return false; 
    1317510618                } 
     
    1319210635                $output = ''; 
    1319310636 
    13194                 while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) 
    13195                 { 
     10637                while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) { 
    1319610638                        $output .= substr($string, $position, $pos - $position); 
    1319710639                        $position = $pos + 1; 
    13198                         if ($string[$pos - 1] !== '\\') 
    13199                         { 
     10640                        if ($string[$pos - 1] !== '\\') { 
    1320010641                                $depth++; 
    13201                                 while ($depth && $position < $length) 
    13202                                 { 
     10642                                while ($depth && $position < $length) { 
    1320310643                                        $position += strcspn($string, '()', $position); 
    13204                                         if ($string[$position - 1] === '\\') 
    13205                                         { 
     10644                                        if ($string[$position - 1] === '\\') { 
    1320610645                                                $position++; 
    1320710646                                                continue; 
    13208                                         } 
    13209                                         elseif (isset($string[$position])) 
    13210                                         { 
    13211                                                 switch ($string[$position]) 
    13212                                                 { 
     10647                                        } elseif (isset($string[$position])) { 
     10648                                                switch ($string[$position]) { 
    1321310649                                                        case '(': 
    1321410650                                                                $depth++; 
     
    1322010656                                                } 
    1322110657                                                $position++; 
    13222                                         } 
    13223                                         else 
    13224                                         { 
     10658                                        } else { 
    1322510659                                                break; 
    1322610660                                        } 
    1322710661                                } 
    13228                         } 
    13229                         else 
    13230                         { 
     10662                        } else { 
    1323110663                                $output .= '('; 
    1323210664                        } 
     
    1324610678        { 
    1324710679                static $pcre; 
    13248                 if (!$pcre) 
    13249                 { 
     10680                if (!$pcre) { 
    1325010681                        $wsp = '[\x09\x20]'; 
    13251                         $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)'; 
    13252                         $optional_fws = $fws . '?'; 
     10682                        $fws = '(?:'.$wsp.'+|'.$wsp.'*(?:\x0D\x0A'.$wsp.'+)+)'; 
     10683                        $optional_fws = $fws.'?'; 
    1325310684                        $day_name = $this->day_pcre; 
    1325410685                        $month = $this->month_pcre; 
     
    1325810689                        $num_zone = '([+\-])([0-9]{2})([0-9]{2})'; 
    1325910690                        $character_zone = '([A-Z]{1,5})'; 
    13260                         $zone = '(?:' . $num_zone . '|' . $character_zone . ')'; 
    13261                         $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'; 
    13262                 } 
    13263                 if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match)) 
    13264                 { 
     10691                        $zone = '(?:'.$num_zone.'|'.$character_zone.')'; 
     10692                        $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'; 
     10693                } 
     10694                if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match)) { 
    1326510695                        /* 
    13266                         Capturing subpatterns: 
    13267                         1: Day name 
    13268                         2: Day 
    13269                         3: Month 
    13270                         4: Year 
    13271                         5: Hour 
    13272                         6: Minute 
    13273                         7: Second 
    13274                         8: Timezone ± 
    13275                         9: Timezone hours 
    13276                         10: Timezone minutes 
    13277                         11: Alphabetic timezone 
    13278                         */ 
     10696                          Capturing subpatterns: 
     10697                          1: Day name 
     10698                          2: Day 
     10699                          3: Month 
     10700                          4: Year 
     10701                          5: Hour 
     10702                          6: Minute 
     10703                          7: Second 
     10704                          8: Timezone ± 
     10705                          9: Timezone hours 
     10706                          10: Timezone minutes 
     10707                          11: Alphabetic timezone 
     10708                         */ 
    1327910709 
    1328010710                        // Find the month number 
     
    1328210712 
    1328310713                        // Numeric timezone 
    13284                         if ($match[8] !== '') 
    13285                         { 
     10714                        if ($match[8] !== '') { 
    1328610715                                $timezone = $match[9] * 3600; 
    1328710716                                $timezone += $match[10] * 60; 
    13288                                 if ($match[8] === '-') 
    13289                                 { 
     10717                                if ($match[8] === '-') { 
    1329010718                                        $timezone = 0 - $timezone; 
    1329110719                                } 
    1329210720                        } 
    1329310721                        // Character timezone 
    13294                         elseif (isset($this->timezone[strtoupper($match[11])])) 
    13295                         { 
     10722                        elseif (isset($this->timezone[strtoupper($match[11])])) { 
    1329610723                                $timezone = $this->timezone[strtoupper($match[11])]; 
    1329710724                        } 
    1329810725                        // Assume everything else to be -0000 
    13299                         else 
    13300                         { 
     10726                        else { 
    1330110727                                $timezone = 0; 
    1330210728                        } 
    1330310729 
    1330410730                        // Deal with 2/3 digit years 
    13305                         if ($match[4] < 50) 
    13306                         { 
     10731                        if ($match[4] < 50) { 
    1330710732                                $match[4] += 2000; 
    13308                         } 
    13309                         elseif ($match[4] < 1000) 
    13310                         { 
     10733                        } elseif ($match[4] < 1000) { 
    1331110734                                $match[4] += 1900; 
    1331210735                        } 
    1331310736 
    1331410737                        // Second is optional, if it is empty set it to zero 
    13315                         if ($match[7] !== '') 
    13316                         { 
     10738                        if ($match[7] !== '') { 
    1331710739                                $second = $match[7]; 
    13318                         } 
    13319                         else 
    13320                         { 
     10740                        } else { 
    1332110741                                $second = 0; 
    1332210742                        } 
    1332310743 
    1332410744                        return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone; 
    13325                 } 
    13326                 else 
    13327                 { 
     10745                } else { 
    1332810746                        return false; 
    1332910747                } 
     
    1333910757        { 
    1334010758                static $pcre; 
    13341                 if (!$pcre) 
    13342                 { 
     10759                if (!$pcre) { 
    1334310760                        $space = '[\x09\x20]+'; 
    1334410761                        $day_name = $this->day_pcre; 
     
    1334710764                        $year = $hour = $minute = $second = '([0-9]{2})'; 
    1334810765                        $zone = '([A-Z]{1,5})'; 
    13349                         $pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i'; 
    13350                 } 
    13351                 if (preg_match($pcre, $date, $match)) 
    13352                 { 
     10766                        $pcre = '/^'.$day_name.','.$space.$day.'-'.$month.'-'.$year.$space.$hour.':'.$minute.':'.$second.$space.$zone.'$/i'; 
     10767                } 
     10768                if (preg_match($pcre, $date, $match)) { 
    1335310769                        /* 
    13354                         Capturing subpatterns: 
    13355                         1: Day name 
    13356                         2: Day 
    13357                         3: Month 
    13358                         4: Year 
    13359                         5: Hour 
    13360                         6: Minute 
    13361                         7: Second 
    13362                         8: Timezone 
    13363                         */ 
     10770                          Capturing subpatterns: 
     10771                          1: Day name 
     10772                          2: Day 
     10773                          3: Month 
     10774                          4: Year 
     10775                          5: Hour 
     10776                          6: Minute 
     10777                          7: Second 
     10778                          8: Timezone 
     10779                         */ 
    1336410780 
    1336510781                        // Month 
     
    1336710783 
    1336810784                        // Character timezone 
    13369                         if (isset($this->timezone[strtoupper($match[8])])) 
    13370                         { 
     10785                        if (isset($this->timezone[strtoupper($match[8])])) { 
    1337110786                                $timezone = $this->timezone[strtoupper($match[8])]; 
    1337210787                        } 
    1337310788                        // Assume everything else to be -0000 
    13374                         else 
    13375                         { 
     10789                        else { 
    1337610790                                $timezone = 0; 
    1337710791                        } 
    1337810792 
    1337910793                        // Deal with 2 digit year 
    13380                         if ($match[4] < 50) 
    13381                         { 
     10794                        if ($match[4] < 50) { 
    1338210795                                $match[4] += 2000; 
    13383                         } 
    13384                         else 
    13385                         { 
     10796                        } else { 
    1338610797                                $match[4] += 1900; 
    1338710798                        } 
    1338810799 
    1338910800                        return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone; 
    13390                 } 
    13391                 else 
    13392                 { 
     10801                } else { 
    1339310802                        return false; 
    1339410803                } 
     
    1340410813        { 
    1340510814                static $pcre; 
    13406                 if (!$pcre) 
    13407                 { 
     10815                if (!$pcre) { 
    1340810816                        $space = '[\x09\x20]+'; 
    1340910817                        $wday_name = $this->day_pcre; 
     
    1341310821                        $year = '([0-9]{4})'; 
    1341410822                        $terminator = '\x0A?\x00?'; 
    13415                         $pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i'; 
    13416                 } 
    13417                 if (preg_match($pcre, $date, $match)) 
    13418                 { 
     10823                        $pcre = '/^'.$wday_name.$space.$mon_name.$space.$day.$space.$hour.':'.$min.':'.$sec.$space.$year.$terminator.'$/i'; 
     10824                } 
     10825                if (preg_match($pcre, $date, $match)) { 
    1341910826                        /* 
    13420                         Capturing subpatterns: 
    13421                         1: Day name 
    13422                         2: Month 
    13423                         3: Day 
    13424                         4: Hour 
    13425                         5: Minute 
    13426                         6: Second 
    13427                         7: Year 
    13428                         */ 
     10827                          Capturing subpatterns: 
     10828                          1: Day name 
     10829                          2: Month 
     10830                          3: Day 
     10831                          4: Hour 
     10832                          5: Minute 
     10833                          6: Second 
     10834                          7: Year 
     10835                         */ 
    1342910836 
    1343010837                        $month = $this->month[strtolower($match[2])]; 
    1343110838                        return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]); 
    13432                 } 
    13433                 else 
    13434                 { 
     10839                } else { 
    1343510840                        return false; 
    1343610841                } 
     
    1344610851        { 
    1344710852                $strtotime = strtotime($date); 
    13448                 if ($strtotime === -1 || $strtotime === false) 
    13449                 { 
     10853                if ($strtotime === -1 || $strtotime === false) { 
    1345010854                        return false; 
    13451                 } 
    13452                 else 
    13453                 { 
     10855                } else { 
    1345410856                        return $strtotime; 
    1345510857                } 
    1345610858        } 
     10859 
    1345710860} 
    1345810861 
     
    1346410867class SimplePie_Content_Type_Sniffer 
    1346510868{ 
     10869 
    1346610870        /** 
    1346710871         * File object 
     
    1349110895        function get_type() 
    1349210896        { 
    13493                 if (isset($this->file->headers['content-type'])) 
    13494                 { 
     10897                if (isset($this->file->headers['content-type'])) { 
    1349510898                        if (!isset($this->file->headers['content-encoding']) 
    13496                                 && ($this->file->headers['content-type'] === 'text/plain' 
     10899                                        && ($this->file->headers['content-type'] === 'text/plain' 
    1349710900                                        || $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1' 
    13498                                         || $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1')) 
    13499                         { 
     10901                                        || $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1')) { 
    1350010902                                return $this->text_or_binary(); 
    1350110903                        } 
    1350210904 
    13503                         if (($pos = strpos($this->file->headers['content-type'], ';')) !== false) 
    13504                         { 
     10905                        if (($pos = strpos($this->file->headers['content-type'], ';')) !== false) { 
    1350510906                                $official = substr($this->file->headers['content-type'], 0, $pos); 
    13506                         } 
    13507                         else 
    13508                         { 
     10907                        } else { 
    1350910908                                $official = $this->file->headers['content-type']; 
    1351010909                        } 
     
    1351210911 
    1351310912                        if ($official === 'unknown/unknown' 
    13514                                 || $official === 'application/unknown') 
    13515                         { 
     10913                                        || $official === 'application/unknown') { 
    1351610914                                return $this->unknown(); 
    13517                         } 
    13518                         elseif (substr($official, -4) === '+xml' 
    13519                                 || $official === 'text/xml' 
    13520                                 || $official === 'application/xml') 
    13521                         { 
     10915                        } elseif (substr($official, -4) === '+xml' 
     10916                                        || $official === 'text/xml' 
     10917                                        || $official === 'application/xml') { 
    1352210918                                return $official; 
    13523                         } 
    13524                         elseif (substr($official, 0, 6) === 'image/') 
    13525                         { 
    13526                                 if ($return = $this->image()) 
    13527                                 { 
     10919                        } elseif (substr($official, 0, 6) === 'image/') { 
     10920                                if ($return = $this->image()) { 
    1352810921                                        return $return; 
    13529                                 } 
    13530                                 else 
    13531                                 { 
     10922                                } else { 
    1353210923                                        return $official; 
    1353310924                                } 
    13534                         } 
    13535                         elseif ($official === 'text/html') 
    13536                         { 
     10925                        } elseif ($official === 'text/html') { 
    1353710926                                return $this->feed_or_html(); 
    13538                         } 
    13539                         else 
    13540                         { 
     10927                        } else { 
    1354110928                                return $official; 
    1354210929                        } 
    13543                 } 
    13544                 else 
    13545                 { 
     10930                } else { 
    1354610931                        return $this->unknown(); 
    1354710932                } 
     
    1355710942        { 
    1355810943                if (substr($this->file->body, 0, 2) === "\xFE\xFF" 
    13559                         || substr($this->file->body, 0, 2) === "\xFF\xFE" 
    13560                         || substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF" 
    13561                         || substr($this->file->body, 0, 3) === "\xEF\xBB\xBF") 
    13562                 { 
     10944                                || substr($this->file->body, 0, 2) === "\xFF\xFE" 
     10945                                || substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF" 
     10946                                || substr($this->file->body, 0, 3) === "\xEF\xBB\xBF") { 
    1356310947                        return 'text/plain'; 
    13564                 } 
    13565                 elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body)) 
    13566                 { 
     10948                } elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body)) { 
    1356710949                        return 'application/octect-stream'; 
    13568                 } 
    13569                 else 
    13570                 { 
     10950                } else { 
    1357110951                        return 'text/plain'; 
    1357210952                } 
     
    1358310963                $ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20"); 
    1358410964                if (strtolower(substr($this->file->body, $ws, 14)) === '<!doctype html' 
    13585                         || strtolower(substr($this->file->body, $ws, 5)) === '<html' 
    13586                         || strtolower(substr($this->file->body, $ws, 7)) === '<script') 
    13587                 { 
     10965                                || strtolower(substr($this->file->body, $ws, 5)) === '<html' 
     10966                                || strtolower(substr($this->file->body, $ws, 7)) === '<script') { 
    1358810967                        return 'text/html'; 
    13589                 } 
    13590                 elseif (substr($this->file->body, 0, 5) === '%PDF-') 
    13591                 { 
     10968                } elseif (substr($this->file->body, 0, 5) === '%PDF-') { 
    1359210969                        return 'application/pdf'; 
    13593                 } 
    13594                 elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-') 
    13595                 { 
     10970                } elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-') { 
    1359610971                        return 'application/postscript'; 
    13597                 } 
    13598                 elseif (substr($this->file->body, 0, 6) === 'GIF87a' 
    13599                         || substr($this->file->body, 0, 6) === 'GIF89a') 
    13600                 { 
     10972                } elseif (substr($this->file->body, 0, 6) === 'GIF87a' 
     10973                                || substr($this->file->body, 0, 6) === 'GIF89a') { 
    1360110974                        return 'image/gif'; 
    13602                 } 
    13603                 elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") 
    13604                 { 
     10975                } elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") { 
    1360510976                        return 'image/png'; 
    13606                 } 
    13607                 elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") 
    13608                 { 
     10977                } elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") { 
    1360910978                        return 'image/jpeg'; 
    13610                 } 
    13611                 elseif (substr($this->file->body, 0, 2) === "\x42\x4D") 
    13612                 { 
     10979                } elseif (substr($this->file->body, 0, 2) === "\x42\x4D") { 
    1361310980                        return 'image/bmp'; 
    13614                 } 
    13615                 else 
    13616                 { 
     10981                } else { 
    1361710982                        return $this->text_or_binary(); 
    1361810983                } 
     
    1362810993        { 
    1362910994                if (substr($this->file->body, 0, 6) === 'GIF87a' 
    13630                         || substr($this->file->body, 0, 6) === 'GIF89a') 
    13631                 { 
     10995                                || substr($this->file->body, 0, 6) === 'GIF89a') { 
    1363210996                        return 'image/gif'; 
    13633                 } 
    13634                 elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") 
    13635                 { 
     10997                } elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") { 
    1363610998                        return 'image/png'; 
    13637                 } 
    13638                 elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") 
    13639                 { 
     10999                } elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") { 
    1364011000                        return 'image/jpeg'; 
    13641                 } 
    13642                 elseif (substr($this->file->body, 0, 2) === "\x42\x4D") 
    13643                 { 
     11001                } elseif (substr($this->file->body, 0, 2) === "\x42\x4D") { 
    1364411002                        return 'image/bmp'; 
    13645                 } 
    13646                 else 
    13647                 { 
     11003                } else { 
    1364811004                        return false; 
    1364911005                } 
     
    1366111017                $pos = strspn($this->file->body, "\x09\x0A\x0D\x20"); 
    1366211018 
    13663                 while ($pos < $len) 
    13664                 { 
    13665                         switch ($this->file->body[$pos]) 
    13666                         { 
     11019                while ($pos < $len) { 
     11020                        switch ($this->file->body[$pos]) { 
    1366711021                                case "\x09": 
    1366811022                                case "\x0A": 
     
    1368011034                        } 
    1368111035 
    13682                         if (substr($this->file->body, $pos, 3) === '!--') 
    13683                         { 
     11036                        if (substr($this->file->body, $pos, 3) === '!--') { 
    1368411037                                $pos += 3; 
    13685                                 if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false) 
    13686                                 { 
     11038                                if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false) { 
    1368711039                                        $pos += 3; 
    13688                                 } 
    13689                                 else 
    13690                                 { 
     11040                                } else { 
    1369111041                                        return 'text/html'; 
    1369211042                                } 
    13693                         } 
    13694                         elseif (substr($this->file->body, $pos, 1) === '!') 
    13695                         { 
    13696                                 if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false) 
    13697                                 { 
     11043                        } elseif (substr($this->file->body, $pos, 1) === '!') { 
     11044                                if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false) { 
    1369811045                                        $pos++; 
    13699                                 } 
    13700                                 else 
    13701                                 { 
     11046                                } else { 
    1370211047                                        return 'text/html'; 
    1370311048                                } 
    13704                         } 
    13705                         elseif (substr($this->file->body, $pos, 1) === '?') 
    13706                         { 
    13707                                 if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false) 
    13708                                 { 
     11049                        } elseif (substr($this->file->body, $pos, 1) === '?') { 
     11050                                if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false) { 
    1370911051                                        $pos += 2; 
    13710                                 } 
    13711                                 else 
    13712                                 { 
     11052                                } else { 
    1371311053                                        return 'text/html'; 
    1371411054                                } 
    13715                         } 
    13716                         elseif (substr($this->file->body, $pos, 3) === 'rss' 
    13717                                 || substr($this->file->body, $pos, 7) === 'rdf:RDF') 
    13718                         { 
     11055                        } elseif (substr($this->file->body, $pos, 3) === 'rss' 
     11056                                        || substr($this->file->body, $pos, 7) === 'rdf:RDF') { 
    1371911057                                return 'application/rss+xml'; 
    13720                         } 
    13721                         elseif (substr($this->file->body, $pos, 4) === 'feed') 
    13722                         { 
     11058                        } elseif (substr($this->file->body, $pos, 4) === 'feed') { 
    1372311059                                return 'application/atom+xml'; 
    13724                         } 
    13725                         else 
    13726                         { 
     11060                        } else { 
    1372711061                                return 'text/html'; 
    1372811062                        } 
     
    1373111065                return 'text/html'; 
    1373211066        } 
     11067 
    1373311068} 
    1373411069 
     
    1374011075class SimplePie_XML_Declaration_Parser 
    1374111076{ 
     11077 
    1374211078        /** 
    1374311079         * XML Version 
     
    1374711083         */ 
    1374811084        var $version = '1.0'; 
    13749  
    1375011085        /** 
    1375111086         * Encoding 
     
    1375511090         */ 
    1375611091        var $encoding = 'UTF-8'; 
    13757  
    1375811092        /** 
    1375911093         * Standalone 
     
    1376311097         */ 
    1376411098        var $standalone = false; 
    13765  
    1376611099        /** 
    1376711100         * Current state of the state machine 
     
    1377111104         */ 
    1377211105        var $state = 'before_version_name'; 
    13773  
    1377411106        /** 
    1377511107         * Input data 
     
    1377911111         */ 
    1378011112        var $data = ''; 
    13781  
    1378211113        /** 
    1378311114         * Input data length (to avoid calling strlen() everytime this is needed) 
     
    1378711118         */ 
    1378811119        var $data_length = 0; 
    13789  
    1379011120        /** 
    1379111121         * Current position of the pointer 
     
    1381611146        function parse() 
    1381711147        { 
    13818                 while ($this->state && $this->state !== 'emit' && $this->has_data()) 
    13819                 { 
     11148                while ($this->state && $this->state !== 'emit' && $this->has_data()) { 
    1382011149                        $state = $this->state; 
    1382111150                        $this->$state(); 
    1382211151                } 
    1382311152                $this->data = ''; 
    13824                 if ($this->state === 'emit') 
    13825                 { 
     11153                if ($this->state === 'emit') { 
    1382611154                        return true; 
    13827                 } 
    13828                 else 
    13829                 { 
     11155                } else { 
    1383011156                        $this->version = ''; 
    1383111157                        $this->encoding = ''; 
     
    1386411190        { 
    1386511191                $quote = substr($this->data, $this->position, 1); 
    13866                 if ($quote === '"' || $quote === "'") 
    13867                 { 
     11192                if ($quote === '"' || $quote === "'") { 
    1386811193                        $this->position++; 
    1386911194                        $len = strcspn($this->data, $quote, $this->position); 
    13870                         if ($this->has_data()) 
    13871                         { 
     11195                        if ($this->has_data()) { 
    1387211196                                $value = substr($this->data, $this->position, $len); 
    1387311197                                $this->position += $len + 1; 
     
    1388011204        function before_version_name() 
    1388111205        { 
    13882                 if ($this->skip_whitespace()) 
    13883                 { 
     11206                if ($this->skip_whitespace()) { 
    1388411207                        $this->state = 'version_name'; 
    13885                 } 
    13886                 else 
    13887                 { 
     11208                } else { 
    1388811209                        $this->state = false; 
    1388911210                } 
     
    1389211213        function version_name() 
    1389311214        { 
    13894                 if (substr($this->data, $this->position, 7) === 'version') 
    13895                 { 
     11215                if (substr($this->data, $this->position, 7) === 'version') { 
    1389611216                        $this->position += 7; 
    1389711217                        $this->skip_whitespace(); 
    1389811218                        $this->state = 'version_equals'; 
    13899                 } 
    13900                 else 
    13901                 { 
     11219                } else { 
    1390211220                        $this->state = false; 
    1390311221                } 
     
    1390611224        function version_equals() 
    1390711225        { 
    13908                 if (substr($this->data, $this->position, 1) === '=') 
    13909                 { 
     11226                if (substr($this->data, $this->position, 1) === '=') { 
    1391011227                        $this->position++; 
    1391111228                        $this->skip_whitespace(); 
    1391211229                        $this->state = 'version_value'; 
    13913                 } 
    13914                 else 
    13915                 { 
     11230                } else { 
    1391611231                        $this->state = false; 
    1391711232                } 
     
    1392011235        function version_value() 
    1392111236        { 
    13922                 if ($this->version = $this->get_value()) 
    13923                 { 
     11237                if ($this->version = $this->get_value()) { 
    1392411238                        $this->skip_whitespace(); 
    13925                         if ($this->has_data()) 
    13926                         { 
     11239                        if ($this->has_data()) { 
    1392711240                                $this->state = 'encoding_name'; 
    13928                         } 
    13929                         else 
    13930                         { 
     11241                        } else { 
    1393111242                                $this->state = 'emit'; 
    1393211243                        } 
    13933                 } 
    13934                 else 
    13935                 { 
     11244                } else { 
    1393611245                        $this->state = 'standalone_name'; 
    1393711246                } 
     
    1394011249        function encoding_name() 
    1394111250        { 
    13942                 if (substr($this->data, $this->position, 8) === 'encoding') 
    13943                 { 
     11251                if (substr($this->data, $this->position, 8) === 'encoding') { 
    1394411252                        $this->position += 8; 
    1394511253                        $this->skip_whitespace(); 
    1394611254                        $this->state = 'encoding_equals'; 
    13947                 } 
    13948                 else 
    13949                 { 
     11255                } else { 
    1395011256                        $this->state = false; 
    1395111257                } 
     
    1395411260        function encoding_equals() 
    1395511261        { 
    13956                 if (substr($this->data, $this->position, 1) === '=') 
    13957                 { 
     11262                if (substr($this->data, $this->position, 1) === '=') { 
    1395811263                        $this->position++; 
    1395911264                        $this->skip_whitespace(); 
    1396011265                        $this->state = 'encoding_value'; 
    13961                 } 
    13962                 else 
    13963                 { 
     11266                } else { 
    1396411267                        $this->state = false; 
    1396511268                } 
     
    1396811271        function encoding_value() 
    1396911272        { 
    13970                 if ($this->encoding = $this->get_value()) 
    13971                 { 
     11273                if ($this->encoding = $this->get_value()) { 
    1397211274                        $this->skip_whitespace(); 
    13973                         if ($this->has_data()) 
    13974                         { 
     11275                        if ($this->has_data()) { 
    1397511276                                $this->state = 'standalone_name'; 
    13976                         } 
    13977                         else 
    13978                         { 
     11277                        } else { 
    1397911278                                $this->state = 'emit'; 
    1398011279                        } 
    13981                 } 
    13982                 else 
    13983                 { 
     11280                } else { 
    1398411281                        $this->state = false; 
    1398511282                } 
     
    1398811285        function standalone_name() 
    1398911286        { 
    13990                 if (substr($this->data, $this->position, 10) === 'standalone') 
    13991                 { 
     11287                if (substr($this->data, $this->position, 10) === 'standalone') { 
    1399211288                        $this->position += 10; 
    1399311289                        $this->skip_whitespace(); 
    1399411290                        $this->state = 'standalone_equals'; 
    13995                 } 
    13996                 else 
    13997                 { 
     11291                } else { 
    1399811292                        $this->state = false; 
    1399911293                } 
     
    1400211296        function standalone_equals() 
    1400311297        { 
    14004                 if (substr($this->data, $this->position, 1) === '=') 
    14005                 { 
     11298                if (substr($this->data, $this->position, 1) === '=') { 
    1400611299                        $this->position++; 
    1400711300                        $this->skip_whitespace(); 
    1400811301                        $this->state = 'standalone_value'; 
    14009                 } 
    14010                 else 
    14011                 { 
     11302                } else { 
    1401211303                        $this->state = false; 
    1401311304                } 
     
    1401611307        function standalone_value() 
    1401711308        { 
    14018                 if ($standalone = $this->get_value()) 
    14019                 { 
    14020                         switch ($standalone) 
    14021                         { 
     11309                if ($standalone = $this->get_value()) { 
     11310                        switch ($standalone) { 
    1402211311                                case 'yes': 
    1402311312                                        $this->standalone = true; 
     
    1403411323 
    1403511324                        $this->skip_whitespace(); 
    14036                         if ($this->has_data()) 
    14037                         { 
     11325                        if ($this->has_data()) { 
    1403811326                                $this->state = false; 
    14039                         } 
    14040                         else 
    14041                         { 
     11327                        } else { 
    1404211328                                $this->state = 'emit'; 
    1404311329                        } 
    14044                 } 
    14045                 else 
    14046                 { 
     11330                } else { 
    1404711331                        $this->state = false; 
    1404811332                } 
    1404911333        } 
     11334 
    1405011335} 
    1405111336 
    1405211337class SimplePie_Locator 
    1405311338{ 
     11339 
    1405411340        var $useragent; 
    1405511341        var $timeout; 
     
    1406811354        function SimplePie_Locator(&$file, $timeout = 10, $useragent = null, $file_class = 'SimplePie_File', $max_checked_feeds = 10, $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer') 
    1406911355        { 
    14070                 $this->file =& $file; 
     11356                $this->file = & $file; 
    1407111357                $this->file_class = $file_class; 
    1407211358                $this->useragent = $useragent; 
     
    1407811364        function find($type = SIMPLEPIE_LOCATOR_ALL, &$working) 
    1407911365        { 
    14080                 if ($this->is_feed($this->file)) 
    14081                 { 
     11366                if ($this->is_feed($this->file)) { 
    1408211367                        return $this->file; 
    1408311368                } 
    1408411369 
    14085                 if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) 
    14086                 { 
     11370                if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) { 
    1408711371                        $sniffer = new $this->content_type_sniffer_class($this->file); 
    14088                         if ($sniffer->get_type() !== 'text/html') 
    14089                         { 
     11372                        if ($sniffer->get_type() !== 'text/html') { 
    1409011373                                return null; 
    1409111374                        } 
    1409211375                } 
    1409311376 
    14094                 if ($type & ~SIMPLEPIE_LOCATOR_NONE) 
    14095                 { 
     11377                if ($type & ~SIMPLEPIE_LOCATOR_NONE) { 
    1409611378                        $this->get_base(); 
    1409711379                } 
    1409811380 
    14099                 if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery()) 
    14100                 { 
     11381                if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery()) { 
    1410111382                        return $working[0]; 
    1410211383                } 
    1410311384 
    14104                 if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links()) 
    14105                 { 
    14106                         if ($type & SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local)) 
    14107                         { 
     11385                if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links()) { 
     11386                        if ($type & SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local)) { 
    1410811387                                return $working; 
    1410911388                        } 
    1411011389 
    14111                         if ($type & SIMPLEPIE_LOCATOR_LOCAL_BODY && $working = $this->body($this->local)) 
    14112                         { 
     11390                        if ($type & SIMPLEPIE_LOCATOR_LOCAL_BODY && $working = $this->body($this->local)) { 
    1411311391                                return $working; 
    1411411392                        } 
    1411511393 
    14116                         if ($type & SIMPLEPIE_LOCATOR_REMOTE_EXTENSION && $working = $this->extension($this->elsewhere)) 
    14117                         { 
     11394                        if ($type & SIMPLEPIE_LOCATOR_REMOTE_EXTENSION && $working = $this->extension($this->elsewhere)) { 
    1411811395                                return $working; 
    1411911396                        } 
    1412011397 
    14121                         if ($type & SIMPLEPIE_LOCATOR_REMOTE_BODY && $working = $this->body($this->elsewhere)) 
    14122                         { 
     11398                        if ($type & SIMPLEPIE_LOCATOR_REMOTE_BODY && $working = $this->body($this->elsewhere)) { 
    1412311399                                return $working; 
    1412411400                        } 
     
    1412911405        function is_feed(&$file) 
    1413011406        { 
    14131                 if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) 
    14132                 { 
     11407                if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) { 
    1413311408                        $sniffer = new $this->content_type_sniffer_class($file); 
    1413411409                        $sniffed = $sniffer->get_type(); 
    14135                         if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml'))) 
    14136                         { 
     11410                        if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml'))) { 
    1413711411                                return true; 
    14138                         } 
    14139                         else 
    14140                         { 
     11412                        } else { 
    1414111413                                return false; 
    1414211414                        } 
    14143                 } 
    14144                 elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL) 
    14145                 { 
     11415                } elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL) { 
    1414611416                        return true; 
    14147                 } 
    14148                 else 
    14149                 { 
     11417                } else { 
    1415011418                        return false; 
    1415111419                } 
     
    1415711425                $this->base = $this->http_base; 
    1415811426                $elements = SimplePie_Misc::get_element('base', $this->file->body); 
    14159                 foreach ($elements as $element) 
    14160                 { 
    14161                         if ($element['attribs']['href']['data'] !== '') 
    14162                         { 
     11427                foreach ($elements as $element) { 
     11428                        if ($element['attribs']['href']['data'] !== '') { 
    1416311429                                $this->base = SimplePie_Misc::absolutize_url(trim($element['attribs']['href']['data']), $this->http_base); 
    1416411430                                $this->base_location = $element['offset']; 
     
    1417311439                $done = array(); 
    1417411440                $feeds = array(); 
    14175                 foreach ($links as $link) 
    14176                 { 
    14177                         if ($this->checked_feeds === $this->max_checked_feeds) 
    14178                         { 
     11441                foreach ($links as $link) { 
     11442                        if ($this->checked_feeds === $this->max_checked_feeds) { 
    1417911443                                break; 
    1418011444                        } 
    14181                         if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data'])) 
    14182                         { 
     11445                        if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data'])) { 
    1418311446                                $rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link['attribs']['rel']['data']))); 
    1418411447 
    14185                                 if ($this->base_location < $link['offset']) 
    14186                                 { 
     11448                                if ($this->base_location < $link['offset']) { 
    1418711449                                        $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base); 
    14188                                 } 
    14189                                 else 
    14190                                 { 
     11450                                } else { 
    1419111451                                        $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base); 
    1419211452                                } 
    1419311453 
    14194                                 if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href])) 
    14195                                 { 
     11454                                if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href])) { 
    1419611455                                        $this->checked_feeds++; 
    1419711456                                        $feed = new $this->file_class($href, $this->timeout, 5, null, $this->useragent); 
    14198                                         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)) 
    14199                                         { 
     11457                                        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)) { 
    1420011458                                                $feeds[$href] = $feed; 
    1420111459                                        } 
     
    1420511463                } 
    1420611464 
    14207                 if (!empty($feeds)) 
    14208                 { 
     11465                if (!empty($feeds)) { 
    1420911466                        return array_values($feeds); 
    14210                 } 
    14211                 else { 
     11467                } else { 
    1421211468                        return null; 
    1421311469                } 
     
    1421711473        { 
    1421811474                $links = SimplePie_Misc::get_element('a', $this->file->body); 
    14219                 foreach ($links as $link) 
    14220                 { 
    14221                         if (isset($link['attribs']['href']['data'])) 
    14222                         { 
     11475                foreach ($links as $link) { 
     11476                        if (isset($link['attribs']['href']['data'])) { 
    1422311477                                $href = trim($link['attribs']['href']['data']); 
    1422411478                                $parsed = SimplePie_Misc::parse_url($href); 
    14225                                 if ($parsed['scheme'] === '' || preg_match('/^(http(s)|feed)?$/i', $parsed['scheme'])) 
    14226                                 { 
    14227                                         if ($this->base_location < $link['offset']) 
    14228                                         { 
     11479                                if ($parsed['scheme'] === '' || preg_match('/^(http(s)|feed)?$/i', $parsed['scheme'])) { 
     11480                                        if ($this->base_location < $link['offset']) { 
    1422911481                                                $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base); 
    14230                                         } 
    14231                                         else 
    14232                                         { 
     11482                                        } else { 
    1423311483                                                $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base); 
    1423411484                                        } 
     
    1423611486                                        $current = SimplePie_Misc::parse_url($this->file->url); 
    1423711487 
    14238                                         if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority']) 
    14239                                         { 
     11488                                        if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority']) { 
    1424011489                                                $this->local[] = $href; 
    14241                                         } 
    14242                                         else 
    14243                                         { 
     11490                                        } else { 
    1424411491                                                $this->elsewhere[] = $href; 
    1424511492                                        } 
     
    1424911496                $this->local = array_unique($this->local); 
    1425011497                $this->elsewhere = array_unique($this->elsewhere); 
    14251                 if (!empty($this->local) || !empty($this->elsewhere)) 
    14252                 { 
     11498                if (!empty($this->local) || !empty($this->elsewhere)) { 
    1425311499                        return true; 
    1425411500                } 
     
    1425811504        function extension(&$array) 
    1425911505        { 
    14260                 foreach ($array as $key => $value) 
    14261                 { 
    14262                         if ($this->checked_feeds === $this->max_checked_feeds) 
    14263                         { 
     11506                foreach ($array as $key => $value) { 
     11507                        if ($this->checked_feeds === $this->max_checked_feeds) { 
    1426411508                                break; 
    1426511509                        } 
    14266                         if (in_array(strtolower(strrchr($value, '.')), array('.rss', '.rdf', '.atom', '.xml'))) 
    14267                         { 
     11510                        if (in_array(strtolower(strrchr($value, '.')), array('.rss', '.rdf', '.atom', '.xml'))) { 
    1426811511                                $this->checked_feeds++; 
    1426911512                                $feed = new $this->file_class($value, $this->timeout, 5, null, $this->useragent); 
    14270                                 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)) 
    14271                                 { 
     11513                                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)) { 
    1427211514                                        return $feed; 
    14273                                 } 
    14274                                 else 
    14275                                 { 
     11515                                } else { 
    1427611516                                        unset($array[$key]); 
    1427711517                                } 
     
    1428311523        function body(&$array) 
    1428411524        { 
    14285                 foreach ($array as $key => $value) 
    14286                 { 
    14287                         if ($this->checked_feeds === $this->max_checked_feeds) 
    14288                         { 
     11525                foreach ($array as $key => $value) { 
     11526                        if ($this->checked_feeds === $this->max_checked_feeds) { 
    1428911527                                break; 
    1429011528                        } 
    14291                         if (preg_match('/(rss|rdf|atom|xml)/i', $value)) 
    14292                         { 
     11529                        if (preg_match('/(rss|rdf|atom|xml)/i', $value)) { 
    1429311530                                $this->checked_feeds++; 
    1429411531                                $feed = new $this->file_class($value, $this->timeout, 5, null, $this->useragent); 
    14295                                 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)) 
    14296                                 { 
     11532                                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)) { 
    1429711533                                        return $feed; 
    14298                                 } 
    14299                                 else 
    14300                                 { 
     11534                                } else { 
    1430111535                                        unset($array[$key]); 
    1430211536                                } 
     
    1430511539                return null; 
    1430611540        } 
     11541 
    1430711542} 
    1430811543 
    1430911544class SimplePie_Parser 
    1431011545{ 
     11546 
    1431111547        var $error_code; 
    1431211548        var $error_string; 
     
    1432811564        { 
    1432911565                // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character 
    14330                 if (strtoupper($encoding) === 'US-ASCII') 
    14331                 { 
     11566                if (strtoupper($encoding) === 'US-ASCII') { 
    1433211567                        $this->encoding = 'UTF-8'; 
    14333                 } 
    14334                 else 
    14335                 { 
     11568                } else { 
    1433611569                        $this->encoding = $encoding; 
    1433711570                } 
     
    1433911572                // Strip BOM: 
    1434011573                // UTF-32 Big Endian BOM 
    14341                 if (substr($data, 0, 4) === "\x00\x00\xFE\xFF") 
    14342                 { 
     11574                if (substr($data, 0, 4) === "\x00\x00\xFE\xFF") { 
    1434311575                        $data = substr($data, 4); 
    1434411576                } 
    1434511577                // UTF-32 Little Endian BOM 
    14346                 elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00") 
    14347                 { 
     11578                elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00") { 
    1434811579                        $data = substr($data, 4); 
    1434911580                } 
    1435011581                // UTF-16 Big Endian BOM 
    14351                 elseif (substr($data, 0, 2) === "\xFE\xFF") 
    14352                 { 
     11582                elseif (substr($data, 0, 2) === "\xFE\xFF") { 
    1435311583                        $data = substr($data, 2); 
    1435411584                } 
    1435511585                // UTF-16 Little Endian BOM 
    14356                 elseif (substr($data, 0, 2) === "\xFF\xFE") 
    14357                 { 
     11586                elseif (substr($data, 0, 2) === "\xFF\xFE") { 
    1435811587                        $data = substr($data, 2); 
    1435911588                } 
    1436011589                // UTF-8 BOM 
    14361                 elseif (substr($data, 0, 3) === "\xEF\xBB\xBF") 
    14362                 { 
     11590                elseif (substr($data, 0, 3) === "\xEF\xBB\xBF") { 
    1436311591                        $data = substr($data, 3); 
    1436411592                } 
    1436511593 
    14366                 if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false) 
    14367                 { 
     11594                if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false) { 
    1436811595                        $declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5)); 
    14369                         if ($declaration->parse()) 
    14370                         { 
     11596                        if ($declaration->parse()) { 
    1437111597                                $data = substr($data, $pos + 2); 
    14372                                 $data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data; 
    14373                         } 
    14374                         else 
    14375                         { 
     11598                                $data = '<?xml version="'.$declaration->version.'" encoding="'.$encoding.'" standalone="'.(($declaration->standalone) ? 'yes' : 'no').'"?>'.$data; 
     11599                        } else { 
    1437611600                                $this->error_string = 'SimplePie bug! Please report this!'; 
    1437711601                                return false; 
     
    1438211606 
    1438311607                static $xml_is_sane = null; 
    14384                 if ($xml_is_sane === null) 
    14385                 { 
     11608                if ($xml_is_sane === null) { 
    1438611609                        $parser_check = xml_parser_create(); 
    1438711610                        xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values); 
     
    1439111614 
    1439211615                // Create the parser 
    14393                 if ($xml_is_sane) 
    14394                 { 
     11616                if ($xml_is_sane) { 
    1439511617                        $xml = xml_parser_create_ns($this->encoding, $this->separator); 
    1439611618                        xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1); 
     
    1440111623 
    1440211624                        // Parse! 
    14403                         if (!xml_parse($xml, $data, true)) 
    14404                         { 
     11625                        if (!xml_parse($xml, $data, true)) { 
    1440511626                                $this->error_code = xml_get_error_code($xml); 
    1440611627                                $this->error_string = xml_error_string($this->error_code); 
     
    1441211633                        xml_parser_free($xml); 
    1441311634                        return $return; 
    14414                 } 
    14415                 else 
    14416                 { 
     11635                } else { 
    1441711636                        libxml_clear_errors(); 
    1441811637                        $xml = new XMLReader(); 
    1441911638                        $xml->xml($data); 
    14420                         while (@$xml->read()) 
    14421                         { 
    14422                                 switch ($xml->nodeType) 
    14423                                 { 
     11639                        while (@$xml->read()) { 
     11640                                switch ($xml->nodeType) { 
    1442411641 
    1442511642                                        case constant('XMLReader::END_ELEMENT'): 
    14426                                                 if ($xml->namespaceURI !== '') 
    14427                                                 { 
     11643                                                if ($xml->namespaceURI !== '') { 
    1442811644                                                        $tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}"; 
    14429                                                 } 
    14430                                                 else 
    14431                                                 { 
     11645                                                } else { 
    1443211646                                                        $tagName = $xml->localName; 
    1443311647                                                } 
     
    1443611650                                        case constant('XMLReader::ELEMENT'): 
    1443711651                                                $empty = $xml->isEmptyElement; 
    14438                                                 if ($xml->namespaceURI !== '') 
    14439                                                 { 
     11652                                                if ($xml->namespaceURI !== '') { 
    1444011653                                                        $tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}"; 
    14441                                                 } 
    14442                                                 else 
    14443                                                 { 
     11654                                                } else { 
    1444411655                                                        $tagName = $xml->localName; 
    1444511656                                                } 
    1444611657                                                $attributes = array(); 
    14447                                                 while ($xml->moveToNextAttribute()) 
    14448                                                 { 
    14449                                                         if ($xml->namespaceURI !== '') 
    14450                                                         { 
     11658                                                while ($xml->moveToNextAttribute()) { 
     11659                                                        if ($xml->namespaceURI !== '') { 
    1445111660                                                                $attrName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}"; 
    14452                                                         } 
    14453                                                         else 
    14454                                                         { 
     11661                                                        } else { 
    1445511662                                                                $attrName = $xml->localName; 
    1445611663                                                        } 
     
    1445811665                                                } 
    1445911666                                                $this->tag_open(null, $tagName, $attributes); 
    14460                                                 if ($empty) 
    14461                                                 { 
     11667                                                if ($empty) { 
    1446211668                                                        $this->tag_close(null, $tagName); 
    1446311669                                                } 
     
    1447011676                                } 
    1447111677                        } 
    14472                         if ($error = libxml_get_last_error()) 
    14473                         { 
     11678                        if ($error = libxml_get_last_error()) { 
    1447411679                                $this->error_code = $error->code; 
    1447511680                                $this->error_string = $error->message; 
     
    1447711682                                $this->current_column = $error->column; 
    1447811683                                return false; 
    14479                         } 
    14480                         else 
    14481                         { 
     11684                        } else { 
    1448211685                                return true; 
    1448311686                        } 
     
    1452011723 
    1452111724                $attribs = array(); 
    14522                 foreach ($attributes as $name => $value) 
    14523                 { 
     11725                foreach ($attributes as $name => $value) { 
    1452411726                        list($attrib_namespace, $attribute) = $this->split_ns($name); 
    1452511727                        $attribs[$attrib_namespace][$attribute] = $value; 
    1452611728                } 
    1452711729 
    14528                 if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['base'])) 
    14529                 { 
     11730                if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['base'])) { 
    1453011731                        $this->xml_base[] = SimplePie_Misc::absolutize_url($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base)); 
    1453111732                        $this->xml_base_explicit[] = true; 
    14532                 } 
    14533                 else 
    14534                 { 
     11733                } else { 
    1453511734                        $this->xml_base[] = end($this->xml_base); 
    1453611735                        $this->xml_base_explicit[] = end($this->xml_base_explicit); 
    1453711736                } 
    1453811737 
    14539                 if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['lang'])) 
    14540                 { 
     11738                if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['lang'])) { 
    1454111739                        $this->xml_lang[] = $attribs[SIMPLEPIE_NAMESPACE_XML]['lang']; 
    14542                 } 
    14543                 else 
    14544                 { 
     11740                } else { 
    1454511741                        $this->xml_lang[] = end($this->xml_lang); 
    1454611742                } 
    1454711743 
    14548                 if ($this->current_xhtml_construct >= 0) 
    14549                 { 
     11744                if ($this->current_xhtml_construct >= 0) { 
    1455011745                        $this->current_xhtml_construct++; 
    14551                         if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML) 
    14552                         { 
    14553                                 $this->data['data'] .= '<' . end($this->element); 
    14554                                 if (isset($attribs[''])) 
    14555                                 { 
    14556                                         foreach ($attribs[''] as $name => $value) 
    14557                                         { 
    14558                                                 $this->data['data'] .= ' ' . $name . '="' . htmlspecialchars($value, ENT_COMPAT, $this->encoding) . '"'; 
     11746                        if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML) { 
     11747                                $this->data['data'] .= '<'.end($this->element); 
     11748                                if (isset($attribs[''])) { 
     11749                                        foreach ($attribs[''] as $name => $value) { 
     11750                                                $this->data['data'] .= ' '.$name.'="'.htmlspecialchars($value, ENT_COMPAT, $this->encoding).'"'; 
    1455911751                                        } 
    1456011752                                } 
    1456111753                                $this->data['data'] .= '>'; 
    1456211754                        } 
    14563                 } 
    14564                 else 
    14565                 { 
    14566                         $this->datas[] =& $this->data; 
    14567                         $this->data =& $this->data['child'][end($this->namespace)][end($this->element)][]; 
     11755                } else { 
     11756                        $this->datas[] = & $this->data; 
     11757                        $this->data = & $this->data['child'][end($this->namespace)][end($this->element)][]; 
    1456811758                        $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)); 
    1456911759                        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') 
    14570                         || (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')) 
    14571                         { 
     11760                                        || (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')) { 
    1457211761                                $this->current_xhtml_construct = 0; 
    1457311762                        } 
     
    1457711766        function cdata($parser, $cdata) 
    1457811767        { 
    14579                 if ($this->current_xhtml_construct >= 0) 
    14580                 { 
     11768                if ($this->current_xhtml_construct >= 0) { 
    1458111769                        $this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding); 
    14582                 } 
    14583                 else 
    14584                 { 
     11770                } else { 
    1458511771                        $this->data['data'] .= $cdata; 
    1458611772                } 
     
    1458911775        function tag_close($parser, $tag) 
    1459011776        { 
    14591                 if ($this->current_xhtml_construct >= 0) 
    14592                 { 
     11777                if ($this->current_xhtml_construct >= 0) { 
    1459311778                        $this->current_xhtml_construct--; 
    14594                         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'))) 
    14595                         { 
    14596                                 $this->data['data'] .= '</' . end($this->element) . '>'; 
    14597                         } 
    14598                 } 
    14599                 if ($this->current_xhtml_construct === -1) 
    14600                 { 
    14601                         $this->data =& $this->datas[count($this->datas) - 1]; 
     11779                        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'))) { 
     11780                                $this->data['data'] .= '</'.end($this->element).'>'; 
     11781                        } 
     11782                } 
     11783                if ($this->current_xhtml_construct === -1) { 
     11784                        $this->data = & $this->datas[count($this->datas) - 1]; 
    1460211785                        array_pop($this->datas); 
    1460311786                } 
     
    1461311796        { 
    1461411797                static $cache = array(); 
    14615                 if (!isset($cache[$string])) 
    14616                 { 
    14617                         if ($pos = strpos($string, $this->separator)) 
    14618                         { 
     11798                if (!isset($cache[$string])) { 
     11799                        if ($pos = strpos($string, $this->separator)) { 
    1461911800                                static $separator_length; 
    14620                                 if (!$separator_length) 
    14621                                 { 
     11801                                if (!$separator_length) { 
    1462211802                                        $separator_length = strlen($this->separator); 
    1462311803                                } 
    1462411804                                $namespace = substr($string, 0, $pos); 
    1462511805                                $local_name = substr($string, $pos + $separator_length); 
    14626                                 if (strtolower($namespace) === SIMPLEPIE_NAMESPACE_ITUNES) 
    14627                                 { 
     11806                                if (strtolower($namespace) === SIMPLEPIE_NAMESPACE_ITUNES) { 
    1462811807                                        $namespace = SIMPLEPIE_NAMESPACE_ITUNES; 
    1462911808                                } 
    1463011809 
    1463111810                                // Normalize the Media RSS namespaces 
    14632                                 if ($namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG) 
    14633                                 { 
     11811                                if ($namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG) { 
    1463411812                                        $namespace = SIMPLEPIE_NAMESPACE_MEDIARSS; 
    1463511813                                } 
    1463611814                                $cache[$string] = array($namespace, $local_name); 
    14637                         } 
    14638                         else 
    14639                         { 
     11815                        } else { 
    1464011816                                $cache[$string] = array('', $string); 
    1464111817                        } 
     
    1464311819                return $cache[$string]; 
    1464411820        } 
     11821 
    1464511822} 
    1464611823 
     
    1465011827class SimplePie_Sanitize 
    1465111828{ 
     11829 
    1465211830        // Private vars 
    1465311831        var $base; 
    14654  
    1465511832        // Options 
    1465611833        var $remove_div = true; 
     
    1466911846        var $useragent = ''; 
    1467011847        var $force_fsockopen = false; 
    14671  
    1467211848        var $replace_url_attributes = array( 
    1467311849                'a' => 'href', 
     
    1468911865        function set_image_handler($page = false) 
    1469011866        { 
    14691                 if ($page) 
    14692                 { 
     11867                if ($page) { 
    1469311868                        $this->image_handler = (string) $page; 
    14694                 } 
    14695                 else 
    14696                 { 
     11869                } else { 
    1469711870                        $this->image_handler = false; 
    1469811871                } 
     
    1470111874        function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie_Cache') 
    1470211875        { 
    14703                 if (isset($enable_cache)) 
    14704                 { 
     11876                if (isset($enable_cache)) { 
    1470511877                        $this->enable_cache = (bool) $enable_cache; 
    1470611878                } 
    1470711879 
    14708                 if ($cache_location) 
    14709                 { 
     11880                if ($cache_location) { 
    1471011881                        $this->cache_location = (string) $cache_location; 
    1471111882                } 
    1471211883 
    14713                 if ($cache_name_function) 
    14714                 { 
     11884                if ($cache_name_function) { 
    1471511885                        $this->cache_name_function = (string) $cache_name_function; 
    1471611886                } 
    1471711887 
    14718                 if ($cache_class) 
    14719                 { 
     11888                if ($cache_class) { 
    1472011889                        $this->cache_class = (string) $cache_class; 
    1472111890                } 
     
    1472411893        function pass_file_data($file_class = 'SimplePie_File', $timeout = 10, $useragent = '', $force_fsockopen = false) 
    1472511894        { 
    14726                 if ($file_class) 
    14727                 { 
     11895                if ($file_class) { 
    1472811896                        $this->file_class = (string) $file_class; 
    1472911897                } 
    1473011898 
    14731                 if ($timeout) 
    14732                 { 
     11899                if ($timeout) { 
    1473311900                        $this->timeout = (string) $timeout; 
    1473411901                } 
    1473511902 
    14736                 if ($useragent) 
    14737                 { 
     11903                if ($useragent) { 
    1473811904                        $this->useragent = (string) $useragent; 
    1473911905                } 
    1474011906 
    14741                 if ($force_fsockopen) 
    14742                 { 
     11907                if ($force_fsockopen) { 
    1474311908                        $this->force_fsockopen = (string) $force_fsockopen; 
    1474411909                } 
     
    1474711912        function strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style')) 
    1474811913        { 
    14749                 if ($tags) 
    14750                 { 
    14751                         if (is_array($tags)) 
    14752                         { 
     11914                if ($tags) { 
     11915                        if (is_array($tags)) { 
    1475311916                                $this->strip_htmltags = $tags; 
    14754                         } 
    14755                         else 
    14756                         { 
     11917                        } else { 
    1475711918                                $this->strip_htmltags = explode(',', $tags); 
    1475811919                        } 
    14759                 } 
    14760                 else 
    14761                 { 
     11920                } else { 
    1476211921                        $this->strip_htmltags = false; 
    1476311922                } 
     
    1477111930        function strip_attributes($attribs = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc')) 
    1477211931        { 
    14773                 if ($attribs) 
    14774                 { 
    14775                         if (is_array($attribs)) 
    14776                         { 
     11932                if ($attribs) { 
     11933                        if (is_array($attribs)) { 
    1477711934                                $this->strip_attributes = $attribs; 
    14778                         } 
    14779                         else 
    14780                         { 
     11935                        } else { 
    1478111936                                $this->strip_attributes = explode(',', $attribs); 
    1478211937                        } 
    14783                 } 
    14784                 else 
    14785                 { 
     11938                } else { 
    1478611939                        $this->strip_attributes = false; 
    1478711940                } 
     
    1481411967        { 
    1481511968                $data = trim($data); 
    14816                 if ($data !== '' || $type & SIMPLEPIE_CONSTRUCT_IRI) 
    14817                 { 
    14818                         if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML) 
    14819                         { 
    14820                                 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)) 
    14821                                 { 
     11969                if ($data !== '' || $type & SIMPLEPIE_CONSTRUCT_IRI) { 
     11970                        if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML) { 
     11971                                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)) { 
    1482211972                                        $type |= SIMPLEPIE_CONSTRUCT_HTML; 
    14823                                 } 
    14824                                 else 
    14825                                 { 
     11973                                } else { 
    1482611974                                        $type |= SIMPLEPIE_CONSTRUCT_TEXT; 
    1482711975                                } 
    1482811976                        } 
    1482911977 
    14830                         if ($type & SIMPLEPIE_CONSTRUCT_BASE64) 
    14831                         { 
     11978                        if ($type & SIMPLEPIE_CONSTRUCT_BASE64) { 
    1483211979                                $data = base64_decode($data); 
    1483311980                        } 
    1483411981 
    14835                         if ($type & SIMPLEPIE_CONSTRUCT_XHTML) 
    14836                         { 
    14837                                 if ($this->remove_div) 
    14838                                 { 
    14839                                         $data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '', $data); 
     11982                        if ($type & SIMPLEPIE_CONSTRUCT_XHTML) { 
     11983                                if ($this->remove_div) { 
     11984                                        $data = preg_replace('/^<div'.SIMPLEPIE_PCRE_XML_ATTRIBUTE.'>/', '', $data); 
    1484011985                                        $data = preg_replace('/<\/div>$/', '', $data); 
    14841                                 } 
    14842                                 else 
    14843                                 { 
    14844                                         $data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '<div>', $data); 
    14845                                 } 
    14846                         } 
    14847  
    14848                         if ($type & (SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML)) 
    14849                         { 
     11986                                } else { 
     11987                                        $data = preg_replace('/^<div'.SIMPLEPIE_PCRE_XML_ATTRIBUTE.'>/', '<div>', $data); 
     11988                                } 
     11989                        } 
     11990 
     11991                        if ($type & (SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML)) { 
    1485011992                                // Strip comments 
    14851                                 if ($this->strip_comments) 
    14852                                 { 
     11993                                if ($this->strip_comments) { 
    1485311994                                        $data = SimplePie_Misc::strip_comments($data); 
    1485411995                                } 
     
    1485711998                                // Based on recommendations by Mark Pilgrim at: 
    1485811999                                // http://diveintomark.org/archives/2003/06/12/how_to_consume_rss_safely 
    14859                                 if ($this->strip_htmltags) 
    14860                                 { 
    14861                                         foreach ($this->strip_htmltags as $tag) 
    14862                                         { 
    14863                                                 $pcre = "/<($tag)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$tag" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>|(\/)?>)/siU'; 
    14864                                                 while (preg_match($pcre, $data)) 
    14865                                                 { 
     12000                                if ($this->strip_htmltags) { 
     12001                                        foreach ($this->strip_htmltags as $tag) { 
     12002                                                $pcre = "/<($tag)".SIMPLEPIE_PCRE_HTML_ATTRIBUTE."(>(.*)<\/$tag".SIMPLEPIE_PCRE_HTML_ATTRIBUTE.'>|(\/)?>)/siU'; 
     12003                                                while (preg_match($pcre, $data)) { 
    1486612004                                                        $data = preg_replace_callback($pcre, array(&$this, 'do_strip_htmltags'), $data); 
    1486712005                                                } 
     
    1486912007                                } 
    1487012008 
    14871                                 if ($this->strip_attributes) 
    14872                                 { 
    14873                                         foreach ($this->strip_attributes as $attrib) 
    14874                                         { 
    14875                                                 $data = preg_replace('/(<[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*)' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . trim($attrib) . '(?:\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>/', '\1\2\3>', $data); 
     12009                                if ($this->strip_attributes) { 
     12010                                        foreach ($this->strip_attributes as $attrib) { 
     12011                                                $data = preg_replace('/(<[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*)'.SIMPLEPIE_PCRE_HTML_ATTRIBUTE.trim($attrib).'(?:\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?'.SIMPLEPIE_PCRE_HTML_ATTRIBUTE.'>/', '\1\2\3>', $data); 
    1487612012                                        } 
    1487712013                                } 
     
    1487912015                                // Replace relative URLs 
    1488012016                                $this->base = $base; 
    14881                                 foreach ($this->replace_url_attributes as $element => $attributes) 
    14882                                 { 
     12017                                foreach ($this->replace_url_attributes as $element => $attributes) { 
    1488312018                                        $data = $this->replace_urls($data, $element, $attributes); 
    1488412019                                } 
    1488512020 
    1488612021                                // If image handling (caching, etc.) is enabled, cache and rewrite all the image tags. 
    14887                                 if (isset($this->image_handler) && ((string) $this->image_handler) !== '' && $this->enable_cache) 
    14888                                 { 
     12022                                if (isset($this->image_handler) && ((string) $this->image_handler) !== '' && $this->enable_cache) { 
    1488912023                                        $images = SimplePie_Misc::get_element('img', $data); 
    14890                                         foreach ($images as $img) 
    14891                                         { 
    14892                                                 if (isset($img['attribs']['src']['data'])) 
    14893                                                 { 
     12024                                        foreach ($images as $img) { 
     12025                                                if (isset($img['attribs']['src']['data'])) { 
    1489412026                                                        $image_url = call_user_func($this->cache_name_function, $img['attribs']['src']['data']); 
    1489512027                                                        $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $image_url, 'spi'); 
    1489612028 
    14897                                                         if ($cache->load()) 
    14898                                                         { 
    14899                                                                 $img['attribs']['src']['data'] = $this->image_handler . $image_url; 
     12029                                                        if ($cache->load()) { 
     12030                                                                $img['attribs']['src']['data'] = $this->image_handler.$image_url; 
    1490012031                                                                $data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data); 
    14901                                                         } 
    14902                                                         else 
    14903                                                         { 
     12032                                                        } else { 
    1490412033                                                                $file = new $this->file_class($img['attribs']['src']['data'], $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen); 
    1490512034                                                                $headers = $file->headers; 
    1490612035 
    14907                                                                 if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) 
    14908                                                                 { 
    14909                                                                         if ($cache->save(array('headers' => $file->headers, 'body' => $file->body))) 
    14910                                                                         { 
    14911                                                                                 $img['attribs']['src']['data'] = $this->image_handler . $image_url; 
     12036                                                                if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) { 
     12037                                                                        if ($cache->save(array('headers' => $file->headers, 'body' => $file->body))) { 
     12038                                                                                $img['attribs']['src']['data'] = $this->image_handler.$image_url; 
    1491212039                                                                                $data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data); 
    14913                                                                         } 
    14914                                                                         else 
    14915                                                                         { 
     12040                                                                        } else { 
    1491612041                                                                                trigger_error("$this->cache_location is not writeable", E_USER_WARNING); 
    1491712042                                                                        } 
     
    1492612051                        } 
    1492712052 
    14928                         if ($type & SIMPLEPIE_CONSTRUCT_IRI) 
    14929                         { 
     12053                        if ($type & SIMPLEPIE_CONSTRUCT_IRI) { 
    1493012054                                $data = SimplePie_Misc::absolutize_url($data, $base); 
    1493112055                        } 
    1493212056 
    14933                         if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI)) 
    14934                         { 
     12057                        if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI)) { 
    1493512058                                $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8'); 
    1493612059                        } 
    1493712060 
    14938                         if ($this->output_encoding !== 'UTF-8') 
    14939                         { 
     12061                        if ($this->output_encoding !== 'UTF-8') { 
    1494012062                                $data = SimplePie_Misc::change_encoding($data, 'UTF-8', $this->output_encoding); 
    1494112063                        } 
     
    1494612068        function replace_urls($data, $tag, $attributes) 
    1494712069        { 
    14948                 if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags)) 
    14949                 { 
     12070                if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags)) { 
    1495012071                        $elements = SimplePie_Misc::get_element($tag, $data); 
    14951                         foreach ($elements as $element) 
    14952                         { 
    14953                                 if (is_array($attributes)) 
    14954                                 { 
    14955                                         foreach ($attributes as $attribute) 
    14956                                         { 
    14957                                                 if (isset($element['attribs'][$attribute]['data'])) 
    14958                                                 { 
     12072                        foreach ($elements as $element) { 
     12073                                if (is_array($attributes)) { 
     12074                                        foreach ($attributes as $attribute) { 
     12075                                                if (isset($element['attribs'][$attribute]['data'])) { 
    1495912076                                                        $element['attribs'][$attribute]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attribute]['data'], $this->base); 
    1496012077                                                        $new_element = SimplePie_Misc::element_implode($element); 
     
    1496312080                                                } 
    1496412081                                        } 
    14965                                 } 
    14966                                 elseif (isset($element['attribs'][$attributes]['data'])) 
    14967                                 { 
     12082                                } elseif (isset($element['attribs'][$attributes]['data'])) { 
    1496812083                                        $element['attribs'][$attributes]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attributes]['data'], $this->base); 
    1496912084                                        $data = str_replace($element['full'], SimplePie_Misc::element_implode($element), $data); 
     
    1497612091        function do_strip_htmltags($match) 
    1497712092        { 
    14978                 if ($this->encode_instead_of_strip) 
    14979                 { 
    14980                         if (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style'))) 
    14981                         { 
     12093                if ($this->encode_instead_of_strip) { 
     12094                        if (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style'))) { 
    1498212095                                $match[1] = htmlspecialchars($match[1], ENT_COMPAT, 'UTF-8'); 
    1498312096                                $match[2] = htmlspecialchars($match[2], ENT_COMPAT, 'UTF-8'); 
    1498412097                                return "&lt;$match[1]$match[2]&gt;$match[3]&lt;/$match[1]&gt;"; 
    14985                         } 
    14986                         else 
    14987                         { 
     12098                        } else { 
    1498812099                                return htmlspecialchars($match[0], ENT_COMPAT, 'UTF-8'); 
    1498912100                        } 
    14990                 } 
    14991                 elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style'))) 
    14992                 { 
     12101                } elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style'))) { 
    1499312102                        return $match[4]; 
    14994                 } 
    14995                 else 
    14996                 { 
     12103                } else { 
    1499712104                        return ''; 
    1499812105                } 
    1499912106        } 
     12107 
    1500012108} 
    15001  
    15002 ?>