@@ -53,8 +53,11 @@ discard block |
||
| 53 | 53 | <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" /> |
| 54 | 54 | <link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link( '', 'atom' ); ?>" /> |
| 55 | 55 | <id><?php echo get_search_comments_feed_link( '', 'atom' ); ?></id> |
| 56 | -<?php else : ?> |
|
| 57 | - <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php bloginfo_rss( 'url' ); ?>" /> |
|
| 56 | +<?php else { |
|
| 57 | + : ?> |
|
| 58 | + <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); |
|
| 59 | +} |
|
| 60 | +?>" href="<?php bloginfo_rss( 'url' ); ?>" /> |
|
| 58 | 61 | <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss( 'comments_atom_url' ); ?>" /> |
| 59 | 62 | <id><?php bloginfo_rss( 'comments_atom_url' ); ?></id> |
| 60 | 63 | <?php endif; ?> |
@@ -104,8 +107,11 @@ discard block |
||
| 104 | 107 | |
| 105 | 108 | <?php if ( post_password_required( $comment_post ) ) : ?> |
| 106 | 109 | <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content> |
| 107 | - <?php else : ?> |
|
| 108 | - <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content> |
|
| 110 | + <?php else { |
|
| 111 | + : ?> |
|
| 112 | + <content type="html" xml:base="<?php comment_link(); |
|
| 113 | +} |
|
| 114 | +?>"><![CDATA[<?php comment_text(); ?>]]></content> |
|
| 109 | 115 | <?php endif; // End if post_password_required(). ?> |
| 110 | 116 | |
| 111 | 117 | <?php |
@@ -114,8 +120,10 @@ discard block |
||
| 114 | 120 | ?> |
| 115 | 121 | <thr:in-reply-to ref="<?php the_guid(); ?>" href="<?php the_permalink_rss(); ?>" type="<?php bloginfo_rss( 'html_type' ); ?>" /> |
| 116 | 122 | <?php |
| 117 | - else : // This comment is in reply to another comment. |
|
| 123 | + else { |
|
| 124 | + : // This comment is in reply to another comment. |
|
| 118 | 125 | $parent_comment = get_comment( $comment->comment_parent ); |
| 126 | + } |
|
| 119 | 127 | /* |
| 120 | 128 | * The rel attribute below and the id tag above should be GUIDs, |
| 121 | 129 | * but WP doesn't create them for comments (unlike posts). |
@@ -99,8 +99,11 @@ |
||
| 99 | 99 | <?php if ( post_password_required( $comment_post ) ) : ?> |
| 100 | 100 | <description><?php echo ent2ncr( __( 'Protected Comments: Please enter your password to view comments.' ) ); ?></description> |
| 101 | 101 | <content:encoded><![CDATA[<?php echo get_the_password_form(); ?>]]></content:encoded> |
| 102 | - <?php else : ?> |
|
| 103 | - <description><![CDATA[<?php comment_text_rss(); ?>]]></description> |
|
| 102 | + <?php else { |
|
| 103 | + : ?> |
|
| 104 | + <description><![CDATA[<?php comment_text_rss(); |
|
| 105 | +} |
|
| 106 | +?>]]></description> |
|
| 104 | 107 | <content:encoded><![CDATA[<?php comment_text(); ?>]]></content:encoded> |
| 105 | 108 | <?php endif; // End if post_password_required(). ?> |
| 106 | 109 | |
@@ -22,8 +22,9 @@ discard block |
||
| 22 | 22 | * @since 3.5.0 |
| 23 | 23 | */ |
| 24 | 24 | function wp_simplepie_autoload( $class ) { |
| 25 | - if ( 0 !== strpos( $class, 'SimplePie_' ) ) |
|
| 26 | - return; |
|
| 25 | + if ( 0 !== strpos( $class, 'SimplePie_' ) ) { |
|
| 26 | + return; |
|
| 27 | + } |
|
| 27 | 28 | |
| 28 | 29 | $file = ABSPATH . WPINC . '/' . str_replace( '_', '/', $class ) . '.php'; |
| 29 | 30 | include $file; |
@@ -807,8 +808,7 @@ discard block |
||
| 807 | 808 | { |
| 808 | 809 | $this->multifeed_url[] = $this->registry->call('Misc', 'fix_protocol', array($value, 1)); |
| 809 | 810 | } |
| 810 | - } |
|
| 811 | - else |
|
| 811 | + } else |
|
| 812 | 812 | { |
| 813 | 813 | $this->feed_url = $this->registry->call('Misc', 'fix_protocol', array($url, 1)); |
| 814 | 814 | $this->permanent_url = $this->feed_url; |
@@ -1006,8 +1006,7 @@ discard block |
||
| 1006 | 1006 | if ($encoding) |
| 1007 | 1007 | { |
| 1008 | 1008 | $this->input_encoding = (string) $encoding; |
| 1009 | - } |
|
| 1010 | - else |
|
| 1009 | + } else |
|
| 1011 | 1010 | { |
| 1012 | 1011 | $this->input_encoding = false; |
| 1013 | 1012 | } |
@@ -1348,8 +1347,7 @@ discard block |
||
| 1348 | 1347 | if ($page !== false) |
| 1349 | 1348 | { |
| 1350 | 1349 | $this->sanitize->set_image_handler($page . '?' . $qs . '='); |
| 1351 | - } |
|
| 1352 | - else |
|
| 1350 | + } else |
|
| 1353 | 1351 | { |
| 1354 | 1352 | $this->image_handler = ''; |
| 1355 | 1353 | } |
@@ -1443,8 +1441,7 @@ discard block |
||
| 1443 | 1441 | $i++; |
| 1444 | 1442 | } |
| 1445 | 1443 | return (bool) $success; |
| 1446 | - } |
|
| 1447 | - elseif ($this->feed_url === null && $this->raw_data === null) |
|
| 1444 | + } elseif ($this->feed_url === null && $this->raw_data === null) |
|
| 1448 | 1445 | { |
| 1449 | 1446 | return false; |
| 1450 | 1447 | } |
@@ -1470,8 +1467,7 @@ discard block |
||
| 1470 | 1467 | if (($fetched = $this->fetch_data($cache)) === true) |
| 1471 | 1468 | { |
| 1472 | 1469 | return true; |
| 1473 | - } |
|
| 1474 | - elseif ($fetched === false) { |
|
| 1470 | + } elseif ($fetched === false) { |
|
| 1475 | 1471 | return false; |
| 1476 | 1472 | } |
| 1477 | 1473 | |
@@ -1508,8 +1504,7 @@ discard block |
||
| 1508 | 1504 | } |
| 1509 | 1505 | $encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry))); |
| 1510 | 1506 | $encodings[] = 'UTF-8'; |
| 1511 | - } |
|
| 1512 | - elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml') |
|
| 1507 | + } elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml') |
|
| 1513 | 1508 | { |
| 1514 | 1509 | if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) |
| 1515 | 1510 | { |
@@ -1573,8 +1568,7 @@ discard block |
||
| 1573 | 1568 | // We have an error, just set SimplePie_Misc::error to it and quit |
| 1574 | 1569 | $this->error = $this->feed_url; |
| 1575 | 1570 | $this->error .= sprintf(' is invalid XML, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column()); |
| 1576 | - } |
|
| 1577 | - else |
|
| 1571 | + } else |
|
| 1578 | 1572 | { |
| 1579 | 1573 | $this->error = 'The data could not be converted to UTF-8.'; |
| 1580 | 1574 | if (!extension_loaded('mbstring') && !extension_loaded('iconv') && !class_exists('\UConverter')) { |
@@ -1678,8 +1672,7 @@ discard block |
||
| 1678 | 1672 | $cache->touch(); |
| 1679 | 1673 | return true; |
| 1680 | 1674 | } |
| 1681 | - } |
|
| 1682 | - else |
|
| 1675 | + } else |
|
| 1683 | 1676 | { |
| 1684 | 1677 | $this->check_modified = false; |
| 1685 | 1678 | if($this->force_cache_fallback) |
@@ -1712,8 +1705,7 @@ discard block |
||
| 1712 | 1705 | if ($this->file instanceof SimplePie_File && $this->file->url === $this->feed_url) |
| 1713 | 1706 | { |
| 1714 | 1707 | $file =& $this->file; |
| 1715 | - } |
|
| 1716 | - else |
|
| 1708 | + } else |
|
| 1717 | 1709 | { |
| 1718 | 1710 | $headers = array( |
| 1719 | 1711 | 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', |
@@ -1769,14 +1761,12 @@ discard block |
||
| 1769 | 1761 | if (isset($this->all_discovered_feeds)) { |
| 1770 | 1762 | $this->all_discovered_feeds[] = $file; |
| 1771 | 1763 | } |
| 1772 | - } |
|
| 1773 | - else |
|
| 1764 | + } else |
|
| 1774 | 1765 | { |
| 1775 | 1766 | if ($discovered) |
| 1776 | 1767 | { |
| 1777 | 1768 | $file = $discovered; |
| 1778 | - } |
|
| 1779 | - else |
|
| 1769 | + } else |
|
| 1780 | 1770 | { |
| 1781 | 1771 | // We need to unset this so that if SimplePie::set_file() has |
| 1782 | 1772 | // been called that object is untouched |
@@ -1786,8 +1776,7 @@ discard block |
||
| 1786 | 1776 | return false; |
| 1787 | 1777 | } |
| 1788 | 1778 | } |
| 1789 | - } |
|
| 1790 | - catch (SimplePie_Exception $e) |
|
| 1779 | + } catch (SimplePie_Exception $e) |
|
| 1791 | 1780 | { |
| 1792 | 1781 | // We need to unset this so that if SimplePie::set_file() has been called that object is untouched |
| 1793 | 1782 | unset($file); |
@@ -1890,8 +1879,7 @@ discard block |
||
| 1890 | 1879 | if ($this->get_encoding()) |
| 1891 | 1880 | { |
| 1892 | 1881 | $header .= ' charset=' . $this->get_encoding(); |
| 1893 | - } |
|
| 1894 | - else |
|
| 1882 | + } else |
|
| 1895 | 1883 | { |
| 1896 | 1884 | $header .= ' charset=UTF-8'; |
| 1897 | 1885 | } |
@@ -1933,12 +1921,10 @@ discard block |
||
| 1933 | 1921 | if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'])) |
| 1934 | 1922 | { |
| 1935 | 1923 | $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10; |
| 1936 | - } |
|
| 1937 | - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'])) |
|
| 1924 | + } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'])) |
|
| 1938 | 1925 | { |
| 1939 | 1926 | $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03; |
| 1940 | - } |
|
| 1941 | - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'])) |
|
| 1927 | + } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'])) |
|
| 1942 | 1928 | { |
| 1943 | 1929 | if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel']) |
| 1944 | 1930 | || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image']) |
@@ -1954,8 +1940,7 @@ discard block |
||
| 1954 | 1940 | { |
| 1955 | 1941 | $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090; |
| 1956 | 1942 | } |
| 1957 | - } |
|
| 1958 | - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'])) |
|
| 1943 | + } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'])) |
|
| 1959 | 1944 | { |
| 1960 | 1945 | $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL; |
| 1961 | 1946 | if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) |
@@ -1996,8 +1981,7 @@ discard block |
||
| 1996 | 1981 | break; |
| 1997 | 1982 | } |
| 1998 | 1983 | } |
| 1999 | - } |
|
| 2000 | - else |
|
| 1984 | + } else |
|
| 2001 | 1985 | { |
| 2002 | 1986 | $this->data['type'] = SIMPLEPIE_TYPE_NONE; |
| 2003 | 1987 | } |
@@ -2035,8 +2019,7 @@ discard block |
||
| 2035 | 2019 | $this->sanitize($this->permanent_url, |
| 2036 | 2020 | SIMPLEPIE_CONSTRUCT_IRI)); |
| 2037 | 2021 | } |
| 2038 | - } |
|
| 2039 | - else |
|
| 2022 | + } else |
|
| 2040 | 2023 | { |
| 2041 | 2024 | if ($this->feed_url !== null) |
| 2042 | 2025 | { |
@@ -2237,8 +2220,7 @@ discard block |
||
| 2237 | 2220 | if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base'])) |
| 2238 | 2221 | { |
| 2239 | 2222 | return $element['xml_base']; |
| 2240 | - } |
|
| 2241 | - elseif ($this->get_link() !== null) |
|
| 2223 | + } elseif ($this->get_link() !== null) |
|
| 2242 | 2224 | { |
| 2243 | 2225 | return $this->get_link(); |
| 2244 | 2226 | } |
@@ -2261,8 +2243,7 @@ discard block |
||
| 2261 | 2243 | try |
| 2262 | 2244 | { |
| 2263 | 2245 | return $this->sanitize->sanitize($data, $type, $base); |
| 2264 | - } |
|
| 2265 | - catch (SimplePie_Exception $e) |
|
| 2246 | + } catch (SimplePie_Exception $e) |
|
| 2266 | 2247 | { |
| 2267 | 2248 | if (!$this->enable_exceptions) |
| 2268 | 2249 | { |
@@ -2288,28 +2269,22 @@ discard block |
||
| 2288 | 2269 | if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) |
| 2289 | 2270 | { |
| 2290 | 2271 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
| 2291 | - } |
|
| 2292 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) |
|
| 2272 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) |
|
| 2293 | 2273 | { |
| 2294 | 2274 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
| 2295 | - } |
|
| 2296 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) |
|
| 2275 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) |
|
| 2297 | 2276 | { |
| 2298 | 2277 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
| 2299 | - } |
|
| 2300 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
|
| 2278 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
|
| 2301 | 2279 | { |
| 2302 | 2280 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
| 2303 | - } |
|
| 2304 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) |
|
| 2281 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) |
|
| 2305 | 2282 | { |
| 2306 | 2283 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
| 2307 | - } |
|
| 2308 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
|
| 2284 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
|
| 2309 | 2285 | { |
| 2310 | 2286 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2311 | - } |
|
| 2312 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) |
|
| 2287 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) |
|
| 2313 | 2288 | { |
| 2314 | 2289 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2315 | 2290 | } |
@@ -2374,8 +2349,7 @@ discard block |
||
| 2374 | 2349 | if (isset($category['attribs']['']['domain'])) |
| 2375 | 2350 | { |
| 2376 | 2351 | $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2377 | - } |
|
| 2378 | - else |
|
| 2352 | + } else |
|
| 2379 | 2353 | { |
| 2380 | 2354 | $scheme = null; |
| 2381 | 2355 | } |
@@ -2668,13 +2642,11 @@ discard block |
||
| 2668 | 2642 | { |
| 2669 | 2643 | $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); |
| 2670 | 2644 | $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; |
| 2671 | - } |
|
| 2672 | - else |
|
| 2645 | + } else |
|
| 2673 | 2646 | { |
| 2674 | 2647 | $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; |
| 2675 | 2648 | } |
| 2676 | - } |
|
| 2677 | - elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
|
| 2649 | + } elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
|
| 2678 | 2650 | { |
| 2679 | 2651 | $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; |
| 2680 | 2652 | } |
@@ -2721,36 +2693,28 @@ discard block |
||
| 2721 | 2693 | if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) |
| 2722 | 2694 | { |
| 2723 | 2695 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
| 2724 | - } |
|
| 2725 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) |
|
| 2696 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline')) |
|
| 2726 | 2697 | { |
| 2727 | 2698 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
| 2728 | - } |
|
| 2729 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) |
|
| 2699 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) |
|
| 2730 | 2700 | { |
| 2731 | 2701 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
| 2732 | - } |
|
| 2733 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) |
|
| 2702 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) |
|
| 2734 | 2703 | { |
| 2735 | 2704 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
| 2736 | - } |
|
| 2737 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) |
|
| 2705 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) |
|
| 2738 | 2706 | { |
| 2739 | 2707 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); |
| 2740 | - } |
|
| 2741 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) |
|
| 2708 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) |
|
| 2742 | 2709 | { |
| 2743 | 2710 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2744 | - } |
|
| 2745 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) |
|
| 2711 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) |
|
| 2746 | 2712 | { |
| 2747 | 2713 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2748 | - } |
|
| 2749 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) |
|
| 2714 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) |
|
| 2750 | 2715 | { |
| 2751 | 2716 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); |
| 2752 | - } |
|
| 2753 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) |
|
| 2717 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) |
|
| 2754 | 2718 | { |
| 2755 | 2719 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); |
| 2756 | 2720 | } |
@@ -2771,20 +2735,16 @@ discard block |
||
| 2771 | 2735 | if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) |
| 2772 | 2736 | { |
| 2773 | 2737 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
| 2774 | - } |
|
| 2775 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) |
|
| 2738 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) |
|
| 2776 | 2739 | { |
| 2777 | 2740 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
| 2778 | - } |
|
| 2779 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) |
|
| 2741 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) |
|
| 2780 | 2742 | { |
| 2781 | 2743 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2782 | - } |
|
| 2783 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) |
|
| 2744 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) |
|
| 2784 | 2745 | { |
| 2785 | 2746 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2786 | - } |
|
| 2787 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) |
|
| 2747 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) |
|
| 2788 | 2748 | { |
| 2789 | 2749 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2790 | 2750 | } |
@@ -2805,28 +2765,22 @@ discard block |
||
| 2805 | 2765 | if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) |
| 2806 | 2766 | { |
| 2807 | 2767 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2808 | - } |
|
| 2809 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) |
|
| 2768 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) |
|
| 2810 | 2769 | { |
| 2811 | 2770 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2812 | - } |
|
| 2813 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) |
|
| 2771 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language')) |
|
| 2814 | 2772 | { |
| 2815 | 2773 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2816 | - } |
|
| 2817 | - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'])) |
|
| 2774 | + } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'])) |
|
| 2818 | 2775 | { |
| 2819 | 2776 | return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2820 | - } |
|
| 2821 | - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'])) |
|
| 2777 | + } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'])) |
|
| 2822 | 2778 | { |
| 2823 | 2779 | return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2824 | - } |
|
| 2825 | - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'])) |
|
| 2780 | + } elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'])) |
|
| 2826 | 2781 | { |
| 2827 | 2782 | return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2828 | - } |
|
| 2829 | - elseif (isset($this->data['headers']['content-language'])) |
|
| 2783 | + } elseif (isset($this->data['headers']['content-language'])) |
|
| 2830 | 2784 | { |
| 2831 | 2785 | return $this->sanitize($this->data['headers']['content-language'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2832 | 2786 | } |
@@ -2852,8 +2806,7 @@ discard block |
||
| 2852 | 2806 | if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) |
| 2853 | 2807 | { |
| 2854 | 2808 | return (float) $return[0]['data']; |
| 2855 | - } |
|
| 2856 | - elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) |
|
| 2809 | + } elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) |
|
| 2857 | 2810 | { |
| 2858 | 2811 | return (float) $match[1]; |
| 2859 | 2812 | } |
@@ -2878,12 +2831,10 @@ discard block |
||
| 2878 | 2831 | if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) |
| 2879 | 2832 | { |
| 2880 | 2833 | return (float) $return[0]['data']; |
| 2881 | - } |
|
| 2882 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) |
|
| 2834 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) |
|
| 2883 | 2835 | { |
| 2884 | 2836 | return (float) $return[0]['data']; |
| 2885 | - } |
|
| 2886 | - elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) |
|
| 2837 | + } elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) |
|
| 2887 | 2838 | { |
| 2888 | 2839 | return (float) $match[2]; |
| 2889 | 2840 | } |
@@ -2905,20 +2856,16 @@ discard block |
||
| 2905 | 2856 | if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) |
| 2906 | 2857 | { |
| 2907 | 2858 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2908 | - } |
|
| 2909 | - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
|
| 2859 | + } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
|
| 2910 | 2860 | { |
| 2911 | 2861 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2912 | - } |
|
| 2913 | - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) |
|
| 2862 | + } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) |
|
| 2914 | 2863 | { |
| 2915 | 2864 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2916 | - } |
|
| 2917 | - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
|
| 2865 | + } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
|
| 2918 | 2866 | { |
| 2919 | 2867 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2920 | - } |
|
| 2921 | - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) |
|
| 2868 | + } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) |
|
| 2922 | 2869 | { |
| 2923 | 2870 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
| 2924 | 2871 | } |
@@ -2942,24 +2889,19 @@ discard block |
||
| 2942 | 2889 | if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) |
| 2943 | 2890 | { |
| 2944 | 2891 | return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI); |
| 2945 | - } |
|
| 2946 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) |
|
| 2892 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo')) |
|
| 2947 | 2893 | { |
| 2948 | 2894 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
| 2949 | - } |
|
| 2950 | - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) |
|
| 2895 | + } elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) |
|
| 2951 | 2896 | { |
| 2952 | 2897 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
| 2953 | - } |
|
| 2954 | - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url')) |
|
| 2898 | + } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url')) |
|
| 2955 | 2899 | { |
| 2956 | 2900 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
| 2957 | - } |
|
| 2958 | - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url')) |
|
| 2901 | + } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url')) |
|
| 2959 | 2902 | { |
| 2960 | 2903 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
| 2961 | - } |
|
| 2962 | - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) |
|
| 2904 | + } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) |
|
| 2963 | 2905 | { |
| 2964 | 2906 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
| 2965 | 2907 | } |
@@ -2984,12 +2926,10 @@ discard block |
||
| 2984 | 2926 | if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) |
| 2985 | 2927 | { |
| 2986 | 2928 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
| 2987 | - } |
|
| 2988 | - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) |
|
| 2929 | + } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) |
|
| 2989 | 2930 | { |
| 2990 | 2931 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
| 2991 | - } |
|
| 2992 | - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) |
|
| 2932 | + } elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) |
|
| 2993 | 2933 | { |
| 2994 | 2934 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
| 2995 | 2935 | } |
@@ -3012,8 +2952,7 @@ discard block |
||
| 3012 | 2952 | if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width')) |
| 3013 | 2953 | { |
| 3014 | 2954 | return round($return[0]['data']); |
| 3015 | - } |
|
| 3016 | - elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) |
|
| 2955 | + } elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) |
|
| 3017 | 2956 | { |
| 3018 | 2957 | return 88.0; |
| 3019 | 2958 | } |
@@ -3036,8 +2975,7 @@ discard block |
||
| 3036 | 2975 | if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height')) |
| 3037 | 2976 | { |
| 3038 | 2977 | return round($return[0]['data']); |
| 3039 | - } |
|
| 3040 | - elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) |
|
| 2978 | + } elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) |
|
| 3041 | 2979 | { |
| 3042 | 2980 | return 31.0; |
| 3043 | 2981 | } |
@@ -3171,8 +3109,7 @@ discard block |
||
| 3171 | 3109 | usort($this->data['ordered_items'], array(get_class($this), 'sort_items')); |
| 3172 | 3110 | } |
| 3173 | 3111 | $items = $this->data['ordered_items']; |
| 3174 | - } |
|
| 3175 | - else |
|
| 3112 | + } else |
|
| 3176 | 3113 | { |
| 3177 | 3114 | $items = $this->data['items']; |
| 3178 | 3115 | } |
@@ -3292,8 +3229,7 @@ discard block |
||
| 3292 | 3229 | if ($arg instanceof SimplePie) |
| 3293 | 3230 | { |
| 3294 | 3231 | $items = array_merge($items, $arg->get_items(0, $limit)); |
| 3295 | - } |
|
| 3296 | - else |
|
| 3232 | + } else |
|
| 3297 | 3233 | { |
| 3298 | 3234 | trigger_error('Arguments must be SimplePie objects', E_USER_WARNING); |
| 3299 | 3235 | } |
@@ -3338,8 +3274,7 @@ discard block |
||
| 3338 | 3274 | { |
| 3339 | 3275 | $file->headers['link'] = ', '; |
| 3340 | 3276 | } |
| 3341 | - } |
|
| 3342 | - else |
|
| 3277 | + } else |
|
| 3343 | 3278 | { |
| 3344 | 3279 | $file->headers['link'] = ''; |
| 3345 | 3280 | } |
@@ -4321,9 +4321,11 @@ |
||
| 4321 | 4321 | ); |
| 4322 | 4322 | |
| 4323 | 4323 | $dots = true; |
| 4324 | - else : |
|
| 4324 | + else { |
|
| 4325 | + : |
|
| 4325 | 4326 | if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : |
| 4326 | 4327 | $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); |
| 4328 | + } |
|
| 4327 | 4329 | $link = str_replace( '%#%', $n, $link ); |
| 4328 | 4330 | if ( $add_args ) { |
| 4329 | 4331 | $link = add_query_arg( $add_args, $link ); |
@@ -81,8 +81,11 @@ |
||
| 81 | 81 | |
| 82 | 82 | <?php if ( get_option( 'rss_use_excerpt' ) ) : ?> |
| 83 | 83 | <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description> |
| 84 | - <?php else : ?> |
|
| 85 | - <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description> |
|
| 84 | + <?php else { |
|
| 85 | + : ?> |
|
| 86 | + <description><![CDATA[<?php the_excerpt_rss(); |
|
| 87 | +} |
|
| 88 | +?>]]></description> |
|
| 86 | 89 | <content:encoded><![CDATA[<?php the_content_feed( 'rdf' ); ?>]]></content:encoded> |
| 87 | 90 | <?php endif; ?> |
| 88 | 91 | |
@@ -105,9 +105,10 @@ discard block |
||
| 105 | 105 | _deprecated_function( __FUNCTION__, '2.5.0', 'wp_set_auth_cookie()' ); |
| 106 | 106 | $user = get_user_by('login', $username); |
| 107 | 107 | wp_set_auth_cookie($user->ID, $remember); |
| 108 | -} |
|
| 109 | -else : |
|
| 108 | +} else { |
|
| 109 | + : |
|
| 110 | 110 | _deprecated_function( 'wp_setcookie', '2.5.0', 'wp_set_auth_cookie()' ); |
| 111 | +} |
|
| 111 | 112 | endif; |
| 112 | 113 | |
| 113 | 114 | if ( !function_exists('wp_clearcookie') ) : |
@@ -121,9 +122,10 @@ discard block |
||
| 121 | 122 | function wp_clearcookie() { |
| 122 | 123 | _deprecated_function( __FUNCTION__, '2.5.0', 'wp_clear_auth_cookie()' ); |
| 123 | 124 | wp_clear_auth_cookie(); |
| 124 | -} |
|
| 125 | -else : |
|
| 125 | +} else { |
|
| 126 | + : |
|
| 126 | 127 | _deprecated_function( 'wp_clearcookie', '2.5.0', 'wp_clear_auth_cookie()' ); |
| 128 | +} |
|
| 127 | 129 | endif; |
| 128 | 130 | |
| 129 | 131 | if ( !function_exists('wp_get_cookie_login') ): |
@@ -141,9 +143,10 @@ discard block |
||
| 141 | 143 | function wp_get_cookie_login() { |
| 142 | 144 | _deprecated_function( __FUNCTION__, '2.5.0' ); |
| 143 | 145 | return false; |
| 144 | -} |
|
| 145 | -else : |
|
| 146 | +} else { |
|
| 147 | + : |
|
| 146 | 148 | _deprecated_function( 'wp_get_cookie_login', '2.5.0' ); |
| 149 | +} |
|
| 147 | 150 | endif; |
| 148 | 151 | |
| 149 | 152 | if ( !function_exists('wp_login') ) : |
@@ -174,14 +177,16 @@ discard block |
||
| 174 | 177 | |
| 175 | 178 | $user = wp_authenticate($username, $password); |
| 176 | 179 | |
| 177 | - if ( ! is_wp_error($user) ) |
|
| 178 | - return true; |
|
| 180 | + if ( ! is_wp_error($user) ) { |
|
| 181 | + return true; |
|
| 182 | + } |
|
| 179 | 183 | |
| 180 | 184 | $error = $user->get_error_message(); |
| 181 | 185 | return false; |
| 182 | -} |
|
| 183 | -else : |
|
| 186 | +} else { |
|
| 187 | + : |
|
| 184 | 188 | _deprecated_function( 'wp_login', '2.5.0', 'wp_signon()' ); |
| 189 | +} |
|
| 185 | 190 | endif; |
| 186 | 191 | |
| 187 | 192 | /** |
@@ -86,8 +86,9 @@ discard block |
||
| 86 | 86 | $categories = get_the_category(); |
| 87 | 87 | $cat = $categories[0]->term_id; |
| 88 | 88 | |
| 89 | - if ( $display ) |
|
| 90 | - echo $cat; |
|
| 89 | + if ( $display ) { |
|
| 90 | + echo $cat; |
|
| 91 | + } |
|
| 91 | 92 | |
| 92 | 93 | return $cat; |
| 93 | 94 | } |
@@ -136,19 +137,22 @@ discard block |
||
| 136 | 137 | |
| 137 | 138 | _deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' ); |
| 138 | 139 | |
| 139 | - if ( empty($in_same_cat) || 'no' == $in_same_cat ) |
|
| 140 | - $in_same_cat = false; |
|
| 141 | - else |
|
| 142 | - $in_same_cat = true; |
|
| 140 | + if ( empty($in_same_cat) || 'no' == $in_same_cat ) { |
|
| 141 | + $in_same_cat = false; |
|
| 142 | + } else { |
|
| 143 | + $in_same_cat = true; |
|
| 144 | + } |
|
| 143 | 145 | |
| 144 | 146 | $post = get_previous_post($in_same_cat, $excluded_categories); |
| 145 | 147 | |
| 146 | - if ( !$post ) |
|
| 147 | - return; |
|
| 148 | + if ( !$post ) { |
|
| 149 | + return; |
|
| 150 | + } |
|
| 148 | 151 | |
| 149 | 152 | $string = '<a href="'.get_permalink($post->ID).'">'.$previous; |
| 150 | - if ( 'yes' == $title ) |
|
| 151 | - $string .= apply_filters('the_title', $post->post_title, $post->ID); |
|
| 153 | + if ( 'yes' == $title ) { |
|
| 154 | + $string .= apply_filters('the_title', $post->post_title, $post->ID); |
|
| 155 | + } |
|
| 152 | 156 | $string .= '</a>'; |
| 153 | 157 | $format = str_replace('%', $string, $format); |
| 154 | 158 | echo $format; |
@@ -171,19 +175,22 @@ discard block |
||
| 171 | 175 | function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { |
| 172 | 176 | _deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' ); |
| 173 | 177 | |
| 174 | - if ( empty($in_same_cat) || 'no' == $in_same_cat ) |
|
| 175 | - $in_same_cat = false; |
|
| 176 | - else |
|
| 177 | - $in_same_cat = true; |
|
| 178 | + if ( empty($in_same_cat) || 'no' == $in_same_cat ) { |
|
| 179 | + $in_same_cat = false; |
|
| 180 | + } else { |
|
| 181 | + $in_same_cat = true; |
|
| 182 | + } |
|
| 178 | 183 | |
| 179 | 184 | $post = get_next_post($in_same_cat, $excluded_categories); |
| 180 | 185 | |
| 181 | - if ( !$post ) |
|
| 182 | - return; |
|
| 186 | + if ( !$post ) { |
|
| 187 | + return; |
|
| 188 | + } |
|
| 183 | 189 | |
| 184 | 190 | $string = '<a href="'.get_permalink($post->ID).'">'.$next; |
| 185 | - if ( 'yes' == $title ) |
|
| 186 | - $string .= apply_filters('the_title', $post->post_title, $post->ID); |
|
| 191 | + if ( 'yes' == $title ) { |
|
| 192 | + $string .= apply_filters('the_title', $post->post_title, $post->ID); |
|
| 193 | + } |
|
| 187 | 194 | $string .= '</a>'; |
| 188 | 195 | $format = str_replace('%', $string, $format); |
| 189 | 196 | echo $format; |
@@ -366,11 +373,12 @@ discard block |
||
| 366 | 373 | |
| 367 | 374 | $user = get_userdata($user_id); |
| 368 | 375 | $other = get_userdata($other_user); |
| 369 | - if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) |
|
| 370 | - return true; |
|
| 371 | - else |
|
| 372 | - return false; |
|
| 373 | -} |
|
| 376 | + if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) { |
|
| 377 | + return true; |
|
| 378 | + } else { |
|
| 379 | + return false; |
|
| 380 | + } |
|
| 381 | + } |
|
| 374 | 382 | |
| 375 | 383 | /** |
| 376 | 384 | * Gets the links associated with category $cat_name. |
@@ -404,8 +412,9 @@ discard block |
||
| 404 | 412 | |
| 405 | 413 | $cat_id = -1; |
| 406 | 414 | $cat = get_term_by('name', $cat_name, 'link_category'); |
| 407 | - if ( $cat ) |
|
| 408 | - $cat_id = $cat->term_id; |
|
| 415 | + if ( $cat ) { |
|
| 416 | + $cat_id = $cat->term_id; |
|
| 417 | + } |
|
| 409 | 418 | |
| 410 | 419 | get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated); |
| 411 | 420 | } |
@@ -467,8 +476,9 @@ discard block |
||
| 467 | 476 | |
| 468 | 477 | $cat_id = -1; |
| 469 | 478 | $cat = get_term_by('name', $cat_name, 'link_category'); |
| 470 | - if ( $cat ) |
|
| 471 | - $cat_id = $cat->term_id; |
|
| 479 | + if ( $cat ) { |
|
| 480 | + $cat_id = $cat->term_id; |
|
| 481 | + } |
|
| 472 | 482 | |
| 473 | 483 | return get_linkobjects($cat_id, $orderby, $limit); |
| 474 | 484 | } |
@@ -521,8 +531,9 @@ discard block |
||
| 521 | 531 | $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ; |
| 522 | 532 | |
| 523 | 533 | $links_array = array(); |
| 524 | - foreach ($links as $link) |
|
| 525 | - $links_array[] = $link; |
|
| 534 | + foreach ($links as $link) { |
|
| 535 | + $links_array[] = $link; |
|
| 536 | + } |
|
| 526 | 537 | |
| 527 | 538 | return $links_array; |
| 528 | 539 | } |
@@ -656,18 +667,24 @@ discard block |
||
| 656 | 667 | $parsed_args = wp_parse_args( $args ); |
| 657 | 668 | |
| 658 | 669 | // Map to new names. |
| 659 | - if ( isset($parsed_args['optionall']) && isset($parsed_args['all'])) |
|
| 660 | - $parsed_args['show_option_all'] = $parsed_args['all']; |
|
| 661 | - if ( isset($parsed_args['sort_column']) ) |
|
| 662 | - $parsed_args['orderby'] = $parsed_args['sort_column']; |
|
| 663 | - if ( isset($parsed_args['sort_order']) ) |
|
| 664 | - $parsed_args['order'] = $parsed_args['sort_order']; |
|
| 665 | - if ( isset($parsed_args['optiondates']) ) |
|
| 666 | - $parsed_args['show_last_update'] = $parsed_args['optiondates']; |
|
| 667 | - if ( isset($parsed_args['optioncount']) ) |
|
| 668 | - $parsed_args['show_count'] = $parsed_args['optioncount']; |
|
| 669 | - if ( isset($parsed_args['list']) ) |
|
| 670 | - $parsed_args['style'] = $parsed_args['list'] ? 'list' : 'break'; |
|
| 670 | + if ( isset($parsed_args['optionall']) && isset($parsed_args['all'])) { |
|
| 671 | + $parsed_args['show_option_all'] = $parsed_args['all']; |
|
| 672 | + } |
|
| 673 | + if ( isset($parsed_args['sort_column']) ) { |
|
| 674 | + $parsed_args['orderby'] = $parsed_args['sort_column']; |
|
| 675 | + } |
|
| 676 | + if ( isset($parsed_args['sort_order']) ) { |
|
| 677 | + $parsed_args['order'] = $parsed_args['sort_order']; |
|
| 678 | + } |
|
| 679 | + if ( isset($parsed_args['optiondates']) ) { |
|
| 680 | + $parsed_args['show_last_update'] = $parsed_args['optiondates']; |
|
| 681 | + } |
|
| 682 | + if ( isset($parsed_args['optioncount']) ) { |
|
| 683 | + $parsed_args['show_count'] = $parsed_args['optioncount']; |
|
| 684 | + } |
|
| 685 | + if ( isset($parsed_args['list']) ) { |
|
| 686 | + $parsed_args['style'] = $parsed_args['list'] ? 'list' : 'break'; |
|
| 687 | + } |
|
| 671 | 688 | $parsed_args['title_li'] = ''; |
| 672 | 689 | |
| 673 | 690 | return wp_list_categories($parsed_args); |
@@ -698,12 +715,14 @@ discard block |
||
| 698 | 715 | _deprecated_function( __FUNCTION__, '2.1.0', 'wp_dropdown_categories()' ); |
| 699 | 716 | |
| 700 | 717 | $show_option_all = ''; |
| 701 | - if ( $optionall ) |
|
| 702 | - $show_option_all = $all; |
|
| 718 | + if ( $optionall ) { |
|
| 719 | + $show_option_all = $all; |
|
| 720 | + } |
|
| 703 | 721 | |
| 704 | 722 | $show_option_none = ''; |
| 705 | - if ( $optionnone ) |
|
| 706 | - $show_option_none = __('None'); |
|
| 723 | + if ( $optionnone ) { |
|
| 724 | + $show_option_none = __('None'); |
|
| 725 | + } |
|
| 707 | 726 | |
| 708 | 727 | $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order', |
| 709 | 728 | 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude'); |
@@ -805,8 +824,9 @@ discard block |
||
| 805 | 824 | |
| 806 | 825 | $link = get_author_posts_url($author_id, $author_nicename); |
| 807 | 826 | |
| 808 | - if ( $display ) |
|
| 809 | - echo $link; |
|
| 827 | + if ( $display ) { |
|
| 828 | + echo $link; |
|
| 829 | + } |
|
| 810 | 830 | return $link; |
| 811 | 831 | } |
| 812 | 832 | |
@@ -952,64 +972,78 @@ discard block |
||
| 952 | 972 | $orderby = substr($orderby, 1); |
| 953 | 973 | } |
| 954 | 974 | |
| 955 | - if ( $category == -1 ) // get_bookmarks() uses '' to signify all categories. |
|
| 975 | + if ( $category == -1 ) { |
|
| 976 | + // get_bookmarks() uses '' to signify all categories. |
|
| 956 | 977 | $category = ''; |
| 978 | + } |
|
| 957 | 979 | |
| 958 | 980 | $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit)); |
| 959 | 981 | |
| 960 | - if ( !$results ) |
|
| 961 | - return; |
|
| 982 | + if ( !$results ) { |
|
| 983 | + return; |
|
| 984 | + } |
|
| 962 | 985 | |
| 963 | 986 | $output = ''; |
| 964 | 987 | |
| 965 | 988 | foreach ( (array) $results as $row ) { |
| 966 | - if ( !isset($row->recently_updated) ) |
|
| 967 | - $row->recently_updated = false; |
|
| 989 | + if ( !isset($row->recently_updated) ) { |
|
| 990 | + $row->recently_updated = false; |
|
| 991 | + } |
|
| 968 | 992 | $output .= $before; |
| 969 | - if ( $show_updated && $row->recently_updated ) |
|
| 970 | - $output .= get_option('links_recently_updated_prepend'); |
|
| 993 | + if ( $show_updated && $row->recently_updated ) { |
|
| 994 | + $output .= get_option('links_recently_updated_prepend'); |
|
| 995 | + } |
|
| 971 | 996 | $the_link = '#'; |
| 972 | - if ( !empty($row->link_url) ) |
|
| 973 | - $the_link = esc_url($row->link_url); |
|
| 997 | + if ( !empty($row->link_url) ) { |
|
| 998 | + $the_link = esc_url($row->link_url); |
|
| 999 | + } |
|
| 974 | 1000 | $rel = $row->link_rel; |
| 975 | - if ( '' != $rel ) |
|
| 976 | - $rel = ' rel="' . $rel . '"'; |
|
| 1001 | + if ( '' != $rel ) { |
|
| 1002 | + $rel = ' rel="' . $rel . '"'; |
|
| 1003 | + } |
|
| 977 | 1004 | |
| 978 | 1005 | $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display')); |
| 979 | 1006 | $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display')); |
| 980 | 1007 | $title = $desc; |
| 981 | 1008 | |
| 982 | - if ( $show_updated ) |
|
| 983 | - if (substr($row->link_updated_f, 0, 2) != '00') |
|
| 1009 | + if ( $show_updated ) { |
|
| 1010 | + if (substr($row->link_updated_f, 0, 2) != '00') |
|
| 984 | 1011 | $title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')'; |
| 1012 | + } |
|
| 985 | 1013 | |
| 986 | - if ( '' != $title ) |
|
| 987 | - $title = ' title="' . $title . '"'; |
|
| 1014 | + if ( '' != $title ) { |
|
| 1015 | + $title = ' title="' . $title . '"'; |
|
| 1016 | + } |
|
| 988 | 1017 | |
| 989 | 1018 | $alt = ' alt="' . $name . '"'; |
| 990 | 1019 | |
| 991 | 1020 | $target = $row->link_target; |
| 992 | - if ( '' != $target ) |
|
| 993 | - $target = ' target="' . $target . '"'; |
|
| 1021 | + if ( '' != $target ) { |
|
| 1022 | + $target = ' target="' . $target . '"'; |
|
| 1023 | + } |
|
| 994 | 1024 | |
| 995 | 1025 | $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>'; |
| 996 | 1026 | |
| 997 | 1027 | if ( $row->link_image != null && $show_images ) { |
| 998 | - if ( strpos($row->link_image, 'http') !== false ) |
|
| 999 | - $output .= "<img src=\"$row->link_image\" $alt $title />"; |
|
| 1000 | - else // If it's a relative path. |
|
| 1028 | + if ( strpos($row->link_image, 'http') !== false ) { |
|
| 1029 | + $output .= "<img src=\"$row->link_image\" $alt $title />"; |
|
| 1030 | + } else { |
|
| 1031 | + // If it's a relative path. |
|
| 1001 | 1032 | $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />"; |
| 1033 | + } |
|
| 1002 | 1034 | } else { |
| 1003 | 1035 | $output .= $name; |
| 1004 | 1036 | } |
| 1005 | 1037 | |
| 1006 | 1038 | $output .= '</a>'; |
| 1007 | 1039 | |
| 1008 | - if ( $show_updated && $row->recently_updated ) |
|
| 1009 | - $output .= get_option('links_recently_updated_append'); |
|
| 1040 | + if ( $show_updated && $row->recently_updated ) { |
|
| 1041 | + $output .= get_option('links_recently_updated_append'); |
|
| 1042 | + } |
|
| 1010 | 1043 | |
| 1011 | - if ( $show_description && '' != $desc ) |
|
| 1012 | - $output .= $between . $desc; |
|
| 1044 | + if ( $show_description && '' != $desc ) { |
|
| 1045 | + $output .= $between . $desc; |
|
| 1046 | + } |
|
| 1013 | 1047 | |
| 1014 | 1048 | if ($show_rating) { |
| 1015 | 1049 | $output .= $between . get_linkrating($row); |
@@ -1018,8 +1052,9 @@ discard block |
||
| 1018 | 1052 | $output .= "$after\n"; |
| 1019 | 1053 | } // End while. |
| 1020 | 1054 | |
| 1021 | - if ( !$display ) |
|
| 1022 | - return $output; |
|
| 1055 | + if ( !$display ) { |
|
| 1056 | + return $output; |
|
| 1057 | + } |
|
| 1023 | 1058 | echo $output; |
| 1024 | 1059 | } |
| 1025 | 1060 | |
@@ -1047,8 +1082,9 @@ discard block |
||
| 1047 | 1082 | $order = substr($order,1); |
| 1048 | 1083 | } |
| 1049 | 1084 | |
| 1050 | - if ( !isset($direction) ) |
|
| 1051 | - $direction = ''; |
|
| 1085 | + if ( !isset($direction) ) { |
|
| 1086 | + $direction = ''; |
|
| 1087 | + } |
|
| 1052 | 1088 | |
| 1053 | 1089 | $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0)); |
| 1054 | 1090 | |
@@ -1114,13 +1150,15 @@ discard block |
||
| 1114 | 1150 | |
| 1115 | 1151 | $id = (int) $id; |
| 1116 | 1152 | |
| 1117 | - if ( empty($id) ) |
|
| 1118 | - return ''; |
|
| 1153 | + if ( empty($id) ) { |
|
| 1154 | + return ''; |
|
| 1155 | + } |
|
| 1119 | 1156 | |
| 1120 | 1157 | $cats = wp_get_link_cats($id); |
| 1121 | 1158 | |
| 1122 | - if ( empty($cats) || ! is_array($cats) ) |
|
| 1123 | - return ''; |
|
| 1159 | + if ( empty($cats) || ! is_array($cats) ) { |
|
| 1160 | + return ''; |
|
| 1161 | + } |
|
| 1124 | 1162 | |
| 1125 | 1163 | $cat_id = (int) $cats[0]; // Take the first cat. |
| 1126 | 1164 | |
@@ -1158,8 +1196,9 @@ discard block |
||
| 1158 | 1196 | |
| 1159 | 1197 | $link = get_category_feed_link($cat_ID, 'rss2'); |
| 1160 | 1198 | |
| 1161 | - if ( $display ) |
|
| 1162 | - echo $link; |
|
| 1199 | + if ( $display ) { |
|
| 1200 | + echo $link; |
|
| 1201 | + } |
|
| 1163 | 1202 | return $link; |
| 1164 | 1203 | } |
| 1165 | 1204 | |
@@ -1178,8 +1217,9 @@ discard block |
||
| 1178 | 1217 | _deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' ); |
| 1179 | 1218 | |
| 1180 | 1219 | $link = get_author_feed_link($author_id); |
| 1181 | - if ( $display ) |
|
| 1182 | - echo $link; |
|
| 1220 | + if ( $display ) { |
|
| 1221 | + echo $link; |
|
| 1222 | + } |
|
| 1183 | 1223 | return $link; |
| 1184 | 1224 | } |
| 1185 | 1225 | |
@@ -1272,19 +1312,22 @@ discard block |
||
| 1272 | 1312 | */ |
| 1273 | 1313 | function get_category_children( $id, $before = '/', $after = '', $visited = array() ) { |
| 1274 | 1314 | _deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' ); |
| 1275 | - if ( 0 == $id ) |
|
| 1276 | - return ''; |
|
| 1315 | + if ( 0 == $id ) { |
|
| 1316 | + return ''; |
|
| 1317 | + } |
|
| 1277 | 1318 | |
| 1278 | 1319 | $chain = ''; |
| 1279 | 1320 | /** TODO: Consult hierarchy */ |
| 1280 | 1321 | $cat_ids = get_all_category_ids(); |
| 1281 | 1322 | foreach ( (array) $cat_ids as $cat_id ) { |
| 1282 | - if ( $cat_id == $id ) |
|
| 1283 | - continue; |
|
| 1323 | + if ( $cat_id == $id ) { |
|
| 1324 | + continue; |
|
| 1325 | + } |
|
| 1284 | 1326 | |
| 1285 | 1327 | $category = get_category( $cat_id ); |
| 1286 | - if ( is_wp_error( $category ) ) |
|
| 1287 | - return $category; |
|
| 1328 | + if ( is_wp_error( $category ) ) { |
|
| 1329 | + return $category; |
|
| 1330 | + } |
|
| 1288 | 1331 | if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) { |
| 1289 | 1332 | $visited[] = $category->term_id; |
| 1290 | 1333 | $chain .= $before.$category->term_id.$after; |
@@ -1687,8 +1730,9 @@ discard block |
||
| 1687 | 1730 | * @param string $content Content of the current post. |
| 1688 | 1731 | */ |
| 1689 | 1732 | $content = apply_filters('the_content_rss', $content); |
| 1690 | - if ( $cut && !$encode_html ) |
|
| 1691 | - $encode_html = 2; |
|
| 1733 | + if ( $cut && !$encode_html ) { |
|
| 1734 | + $encode_html = 2; |
|
| 1735 | + } |
|
| 1692 | 1736 | if ( 1== $encode_html ) { |
| 1693 | 1737 | $content = esc_html($content); |
| 1694 | 1738 | $cut = 0; |
@@ -1708,8 +1752,9 @@ discard block |
||
| 1708 | 1752 | } |
| 1709 | 1753 | |
| 1710 | 1754 | /** @todo Check performance, might be faster to use array slice instead. */ |
| 1711 | - for ( $i=0; $i<$k; $i++ ) |
|
| 1712 | - $excerpt .= $blah[$i].' '; |
|
| 1755 | + for ( $i=0; $i<$k; $i++ ) { |
|
| 1756 | + $excerpt .= $blah[$i].' '; |
|
| 1757 | + } |
|
| 1713 | 1758 | $excerpt .= ($use_dotdotdot) ? '...' : ''; |
| 1714 | 1759 | $content = $excerpt; |
| 1715 | 1760 | } |
@@ -1868,11 +1913,13 @@ discard block |
||
| 1868 | 1913 | $id = (int) $id; |
| 1869 | 1914 | $_post = get_post($id); |
| 1870 | 1915 | |
| 1871 | - if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) |
|
| 1872 | - return __('Missing Attachment'); |
|
| 1916 | + if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) { |
|
| 1917 | + return __('Missing Attachment'); |
|
| 1918 | + } |
|
| 1873 | 1919 | |
| 1874 | - if ( $permalink ) |
|
| 1875 | - $url = get_attachment_link($_post->ID); |
|
| 1920 | + if ( $permalink ) { |
|
| 1921 | + $url = get_attachment_link($_post->ID); |
|
| 1922 | + } |
|
| 1876 | 1923 | |
| 1877 | 1924 | $post_title = esc_attr($_post->post_title); |
| 1878 | 1925 | |
@@ -1894,8 +1941,9 @@ discard block |
||
| 1894 | 1941 | function get_attachment_icon_src( $id = 0, $fullsize = false ) { |
| 1895 | 1942 | _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' ); |
| 1896 | 1943 | $id = (int) $id; |
| 1897 | - if ( !$post = get_post($id) ) |
|
| 1898 | - return false; |
|
| 1944 | + if ( !$post = get_post($id) ) { |
|
| 1945 | + return false; |
|
| 1946 | + } |
|
| 1899 | 1947 | |
| 1900 | 1948 | $file = get_attached_file( $post->ID ); |
| 1901 | 1949 | |
@@ -1916,8 +1964,9 @@ discard block |
||
| 1916 | 1964 | $src_file = $icon_dir . '/' . wp_basename($src); |
| 1917 | 1965 | } |
| 1918 | 1966 | |
| 1919 | - if ( !isset($src) || !$src ) |
|
| 1920 | - return false; |
|
| 1967 | + if ( !isset($src) || !$src ) { |
|
| 1968 | + return false; |
|
| 1969 | + } |
|
| 1921 | 1970 | |
| 1922 | 1971 | return array($src, $src_file); |
| 1923 | 1972 | } |
@@ -1937,11 +1986,13 @@ discard block |
||
| 1937 | 1986 | function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { |
| 1938 | 1987 | _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); |
| 1939 | 1988 | $id = (int) $id; |
| 1940 | - if ( !$post = get_post($id) ) |
|
| 1941 | - return false; |
|
| 1989 | + if ( !$post = get_post($id) ) { |
|
| 1990 | + return false; |
|
| 1991 | + } |
|
| 1942 | 1992 | |
| 1943 | - if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) |
|
| 1944 | - return false; |
|
| 1993 | + if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) { |
|
| 1994 | + return false; |
|
| 1995 | + } |
|
| 1945 | 1996 | |
| 1946 | 1997 | list($src, $src_file) = $src; |
| 1947 | 1998 | |
@@ -1993,11 +2044,13 @@ discard block |
||
| 1993 | 2044 | function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { |
| 1994 | 2045 | _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); |
| 1995 | 2046 | $id = (int) $id; |
| 1996 | - if ( !$post = get_post($id) ) |
|
| 1997 | - return false; |
|
| 2047 | + if ( !$post = get_post($id) ) { |
|
| 2048 | + return false; |
|
| 2049 | + } |
|
| 1998 | 2050 | |
| 1999 | - if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) |
|
| 2000 | - return $innerHTML; |
|
| 2051 | + if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) { |
|
| 2052 | + return $innerHTML; |
|
| 2053 | + } |
|
| 2001 | 2054 | |
| 2002 | 2055 | $innerHTML = esc_attr($post->post_title); |
| 2003 | 2056 | |
@@ -2040,10 +2093,11 @@ discard block |
||
| 2040 | 2093 | * @return string The cleaned $url after the {@see 'clean_url'} filter is applied. |
| 2041 | 2094 | */ |
| 2042 | 2095 | function clean_url( $url, $protocols = null, $context = 'display' ) { |
| 2043 | - if ( $context == 'db' ) |
|
| 2044 | - _deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' ); |
|
| 2045 | - else |
|
| 2046 | - _deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' ); |
|
| 2096 | + if ( $context == 'db' ) { |
|
| 2097 | + _deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' ); |
|
| 2098 | + } else { |
|
| 2099 | + _deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' ); |
|
| 2100 | + } |
|
| 2047 | 2101 | return esc_url( $url, $protocols, $context ); |
| 2048 | 2102 | } |
| 2049 | 2103 | |
@@ -2225,29 +2279,34 @@ discard block |
||
| 2225 | 2279 | function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) { |
| 2226 | 2280 | _deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' ); |
| 2227 | 2281 | global $wpdb; |
| 2228 | - if ( !is_numeric( $user_id ) ) |
|
| 2229 | - return false; |
|
| 2282 | + if ( !is_numeric( $user_id ) ) { |
|
| 2283 | + return false; |
|
| 2284 | + } |
|
| 2230 | 2285 | $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); |
| 2231 | 2286 | |
| 2232 | - if ( is_array($meta_value) || is_object($meta_value) ) |
|
| 2233 | - $meta_value = serialize($meta_value); |
|
| 2287 | + if ( is_array($meta_value) || is_object($meta_value) ) { |
|
| 2288 | + $meta_value = serialize($meta_value); |
|
| 2289 | + } |
|
| 2234 | 2290 | $meta_value = trim( $meta_value ); |
| 2235 | 2291 | |
| 2236 | 2292 | $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
| 2237 | 2293 | |
| 2238 | - if ( $cur && $cur->umeta_id ) |
|
| 2239 | - do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
| 2294 | + if ( $cur && $cur->umeta_id ) { |
|
| 2295 | + do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
| 2296 | + } |
|
| 2240 | 2297 | |
| 2241 | - if ( ! empty($meta_value) ) |
|
| 2242 | - $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) ); |
|
| 2243 | - else |
|
| 2244 | - $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
|
| 2298 | + if ( ! empty($meta_value) ) { |
|
| 2299 | + $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) ); |
|
| 2300 | + } else { |
|
| 2301 | + $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
|
| 2302 | + } |
|
| 2245 | 2303 | |
| 2246 | 2304 | clean_user_cache( $user_id ); |
| 2247 | 2305 | wp_cache_delete( $user_id, 'user_meta' ); |
| 2248 | 2306 | |
| 2249 | - if ( $cur && $cur->umeta_id ) |
|
| 2250 | - do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
| 2307 | + if ( $cur && $cur->umeta_id ) { |
|
| 2308 | + do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
| 2309 | + } |
|
| 2251 | 2310 | |
| 2252 | 2311 | return true; |
| 2253 | 2312 | } |
@@ -2273,35 +2332,39 @@ discard block |
||
| 2273 | 2332 | global $wpdb; |
| 2274 | 2333 | $user_id = (int) $user_id; |
| 2275 | 2334 | |
| 2276 | - if ( !$user_id ) |
|
| 2277 | - return false; |
|
| 2335 | + if ( !$user_id ) { |
|
| 2336 | + return false; |
|
| 2337 | + } |
|
| 2278 | 2338 | |
| 2279 | 2339 | if ( !empty($meta_key) ) { |
| 2280 | 2340 | $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); |
| 2281 | 2341 | $user = wp_cache_get($user_id, 'users'); |
| 2282 | 2342 | // Check the cached user object. |
| 2283 | - if ( false !== $user && isset($user->$meta_key) ) |
|
| 2284 | - $metas = array($user->$meta_key); |
|
| 2285 | - else |
|
| 2286 | - $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
|
| 2343 | + if ( false !== $user && isset($user->$meta_key) ) { |
|
| 2344 | + $metas = array($user->$meta_key); |
|
| 2345 | + } else { |
|
| 2346 | + $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
|
| 2347 | + } |
|
| 2287 | 2348 | } else { |
| 2288 | 2349 | $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) ); |
| 2289 | 2350 | } |
| 2290 | 2351 | |
| 2291 | 2352 | if ( empty($metas) ) { |
| 2292 | - if ( empty($meta_key) ) |
|
| 2293 | - return array(); |
|
| 2294 | - else |
|
| 2295 | - return ''; |
|
| 2353 | + if ( empty($meta_key) ) { |
|
| 2354 | + return array(); |
|
| 2355 | + } else { |
|
| 2356 | + return ''; |
|
| 2357 | + } |
|
| 2296 | 2358 | } |
| 2297 | 2359 | |
| 2298 | 2360 | $metas = array_map('maybe_unserialize', $metas); |
| 2299 | 2361 | |
| 2300 | - if ( count($metas) == 1 ) |
|
| 2301 | - return $metas[0]; |
|
| 2302 | - else |
|
| 2303 | - return $metas; |
|
| 2304 | -} |
|
| 2362 | + if ( count($metas) == 1 ) { |
|
| 2363 | + return $metas[0]; |
|
| 2364 | + } else { |
|
| 2365 | + return $metas; |
|
| 2366 | + } |
|
| 2367 | + } |
|
| 2305 | 2368 | |
| 2306 | 2369 | /** |
| 2307 | 2370 | * Update metadata of user. |
@@ -2324,13 +2387,15 @@ discard block |
||
| 2324 | 2387 | function update_usermeta( $user_id, $meta_key, $meta_value ) { |
| 2325 | 2388 | _deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' ); |
| 2326 | 2389 | global $wpdb; |
| 2327 | - if ( !is_numeric( $user_id ) ) |
|
| 2328 | - return false; |
|
| 2390 | + if ( !is_numeric( $user_id ) ) { |
|
| 2391 | + return false; |
|
| 2392 | + } |
|
| 2329 | 2393 | $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); |
| 2330 | 2394 | |
| 2331 | 2395 | /** @todo Might need fix because usermeta data is assumed to be already escaped */ |
| 2332 | - if ( is_string($meta_value) ) |
|
| 2333 | - $meta_value = stripslashes($meta_value); |
|
| 2396 | + if ( is_string($meta_value) ) { |
|
| 2397 | + $meta_value = stripslashes($meta_value); |
|
| 2398 | + } |
|
| 2334 | 2399 | $meta_value = maybe_serialize($meta_value); |
| 2335 | 2400 | |
| 2336 | 2401 | if (empty($meta_value)) { |
@@ -2339,23 +2404,26 @@ discard block |
||
| 2339 | 2404 | |
| 2340 | 2405 | $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); |
| 2341 | 2406 | |
| 2342 | - if ( $cur ) |
|
| 2343 | - do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
| 2407 | + if ( $cur ) { |
|
| 2408 | + do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
| 2409 | + } |
|
| 2344 | 2410 | |
| 2345 | - if ( !$cur ) |
|
| 2346 | - $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') ); |
|
| 2347 | - elseif ( $cur->meta_value != $meta_value ) |
|
| 2348 | - $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') ); |
|
| 2349 | - else |
|
| 2350 | - return false; |
|
| 2411 | + if ( !$cur ) { |
|
| 2412 | + $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') ); |
|
| 2413 | + } elseif ( $cur->meta_value != $meta_value ) { |
|
| 2414 | + $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') ); |
|
| 2415 | + } else { |
|
| 2416 | + return false; |
|
| 2417 | + } |
|
| 2351 | 2418 | |
| 2352 | 2419 | clean_user_cache( $user_id ); |
| 2353 | 2420 | wp_cache_delete( $user_id, 'user_meta' ); |
| 2354 | 2421 | |
| 2355 | - if ( !$cur ) |
|
| 2356 | - do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value ); |
|
| 2357 | - else |
|
| 2358 | - do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
| 2422 | + if ( !$cur ) { |
|
| 2423 | + do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value ); |
|
| 2424 | + } else { |
|
| 2425 | + do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); |
|
| 2426 | + } |
|
| 2359 | 2427 | |
| 2360 | 2428 | return true; |
| 2361 | 2429 | } |
@@ -2399,10 +2467,12 @@ discard block |
||
| 2399 | 2467 | function automatic_feed_links( $add = true ) { |
| 2400 | 2468 | _deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" ); |
| 2401 | 2469 | |
| 2402 | - if ( $add ) |
|
| 2403 | - add_theme_support( 'automatic-feed-links' ); |
|
| 2404 | - else |
|
| 2405 | - remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+. |
|
| 2470 | + if ( $add ) { |
|
| 2471 | + add_theme_support( 'automatic-feed-links' ); |
|
| 2472 | + } else { |
|
| 2473 | + remove_action( 'wp_head', 'feed_links_extra', 3 ); |
|
| 2474 | + } |
|
| 2475 | + // Just do this yourself in 3.0+. |
|
| 2406 | 2476 | } |
| 2407 | 2477 | |
| 2408 | 2478 | /** |
@@ -2473,10 +2543,11 @@ discard block |
||
| 2473 | 2543 | // Fixes for browsers' JavaScript bugs. |
| 2474 | 2544 | global $is_macIE, $is_winIE; |
| 2475 | 2545 | |
| 2476 | - if ( $is_winIE || $is_macIE ) |
|
| 2477 | - $text = preg_replace_callback("/\%u([0-9A-F]{4,4})/", |
|
| 2546 | + if ( $is_winIE || $is_macIE ) { |
|
| 2547 | + $text = preg_replace_callback("/\%u([0-9A-F]{4,4})/", |
|
| 2478 | 2548 | "funky_javascript_callback", |
| 2479 | 2549 | $text); |
| 2550 | + } |
|
| 2480 | 2551 | |
| 2481 | 2552 | return $text; |
| 2482 | 2553 | } |
@@ -2534,8 +2605,9 @@ discard block |
||
| 2534 | 2605 | |
| 2535 | 2606 | global $plugin_page; |
| 2536 | 2607 | |
| 2537 | - if ( isset($plugin_page) ) |
|
| 2538 | - return true; |
|
| 2608 | + if ( isset($plugin_page) ) { |
|
| 2609 | + return true; |
|
| 2610 | + } |
|
| 2539 | 2611 | |
| 2540 | 2612 | return false; |
| 2541 | 2613 | } |
@@ -2607,8 +2679,9 @@ discard block |
||
| 2607 | 2679 | $objects = array(); |
| 2608 | 2680 | |
| 2609 | 2681 | $ids = array_map('intval', $ids); |
| 2610 | - foreach ( $ids as $id ) |
|
| 2611 | - $objects[$id] = array(); |
|
| 2682 | + foreach ( $ids as $id ) { |
|
| 2683 | + $objects[$id] = array(); |
|
| 2684 | + } |
|
| 2612 | 2685 | |
| 2613 | 2686 | $metas = update_meta_cache('user', $ids); |
| 2614 | 2687 | |
@@ -2639,21 +2712,25 @@ discard block |
||
| 2639 | 2712 | _deprecated_function( __FUNCTION__, '3.3.0' ); |
| 2640 | 2713 | |
| 2641 | 2714 | if ( is_object($user) ) { |
| 2642 | - if ( !isset($user->ID) ) |
|
| 2643 | - $user->ID = 0; |
|
| 2715 | + if ( !isset($user->ID) ) { |
|
| 2716 | + $user->ID = 0; |
|
| 2717 | + } |
|
| 2644 | 2718 | if ( ! ( $user instanceof WP_User ) ) { |
| 2645 | 2719 | $vars = get_object_vars($user); |
| 2646 | 2720 | foreach ( array_keys($vars) as $field ) { |
| 2647 | - if ( is_string($user->$field) || is_numeric($user->$field) ) |
|
| 2648 | - $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context); |
|
| 2721 | + if ( is_string($user->$field) || is_numeric($user->$field) ) { |
|
| 2722 | + $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context); |
|
| 2723 | + } |
|
| 2649 | 2724 | } |
| 2650 | 2725 | } |
| 2651 | 2726 | $user->filter = $context; |
| 2652 | 2727 | } else { |
| 2653 | - if ( !isset($user['ID']) ) |
|
| 2654 | - $user['ID'] = 0; |
|
| 2655 | - foreach ( array_keys($user) as $field ) |
|
| 2656 | - $user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context); |
|
| 2728 | + if ( !isset($user['ID']) ) { |
|
| 2729 | + $user['ID'] = 0; |
|
| 2730 | + } |
|
| 2731 | + foreach ( array_keys($user) as $field ) { |
|
| 2732 | + $user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context); |
|
| 2733 | + } |
|
| 2657 | 2734 | $user['filter'] = $context; |
| 2658 | 2735 | } |
| 2659 | 2736 | |
@@ -2681,14 +2758,16 @@ discard block |
||
| 2681 | 2758 | |
| 2682 | 2759 | $posts = get_boundary_post($in_same_cat, $excluded_categories, $start); |
| 2683 | 2760 | // If there is no post, stop. |
| 2684 | - if ( empty($posts) ) |
|
| 2685 | - return; |
|
| 2761 | + if ( empty($posts) ) { |
|
| 2762 | + return; |
|
| 2763 | + } |
|
| 2686 | 2764 | |
| 2687 | 2765 | // Even though we limited get_posts() to return only 1 item it still returns an array of objects. |
| 2688 | 2766 | $post = $posts[0]; |
| 2689 | 2767 | |
| 2690 | - if ( empty($post->post_title) ) |
|
| 2691 | - $post->post_title = $start ? __('First Post') : __('Last Post'); |
|
| 2768 | + if ( empty($post->post_title) ) { |
|
| 2769 | + $post->post_title = $start ? __('First Post') : __('Last Post'); |
|
| 2770 | + } |
|
| 2692 | 2771 | |
| 2693 | 2772 | $date = mysql2date(get_option('date_format'), $post->post_date); |
| 2694 | 2773 | |
@@ -2759,11 +2838,13 @@ discard block |
||
| 2759 | 2838 | function get_parent_post_rel_link( $title = '%title' ) { |
| 2760 | 2839 | _deprecated_function( __FUNCTION__, '3.3.0' ); |
| 2761 | 2840 | |
| 2762 | - if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) |
|
| 2763 | - $post = get_post($GLOBALS['post']->post_parent); |
|
| 2841 | + if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) { |
|
| 2842 | + $post = get_post($GLOBALS['post']->post_parent); |
|
| 2843 | + } |
|
| 2764 | 2844 | |
| 2765 | - if ( empty($post) ) |
|
| 2766 | - return; |
|
| 2845 | + if ( empty($post) ) { |
|
| 2846 | + return; |
|
| 2847 | + } |
|
| 2767 | 2848 | |
| 2768 | 2849 | $date = mysql2date(get_option('date_format'), $post->post_date); |
| 2769 | 2850 | |
@@ -2806,12 +2887,13 @@ discard block |
||
| 2806 | 2887 | $user_id = get_current_user_id(); |
| 2807 | 2888 | |
| 2808 | 2889 | if ( 0 != $user_id ) { |
| 2809 | - if ( is_admin() ) |
|
| 2810 | - $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); |
|
| 2811 | - elseif ( is_multisite() ) |
|
| 2812 | - $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); |
|
| 2813 | - else |
|
| 2814 | - $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); |
|
| 2890 | + if ( is_admin() ) { |
|
| 2891 | + $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); |
|
| 2892 | + } elseif ( is_multisite() ) { |
|
| 2893 | + $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); |
|
| 2894 | + } else { |
|
| 2895 | + $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); |
|
| 2896 | + } |
|
| 2815 | 2897 | } |
| 2816 | 2898 | } |
| 2817 | 2899 | |
@@ -2863,9 +2945,10 @@ discard block |
||
| 2863 | 2945 | */ |
| 2864 | 2946 | function debug_fwrite( $fp, $message ) { |
| 2865 | 2947 | _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); |
| 2866 | - if ( ! empty( $GLOBALS['debug'] ) ) |
|
| 2867 | - error_log( $message ); |
|
| 2868 | -} |
|
| 2948 | + if ( ! empty( $GLOBALS['debug'] ) ) { |
|
| 2949 | + error_log( $message ); |
|
| 2950 | + } |
|
| 2951 | + } |
|
| 2869 | 2952 | |
| 2870 | 2953 | /** |
| 2871 | 2954 | * Close the debugging file handle. |
@@ -2899,18 +2982,20 @@ discard block |
||
| 2899 | 2982 | _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' ); |
| 2900 | 2983 | |
| 2901 | 2984 | global $wp_themes; |
| 2902 | - if ( isset( $wp_themes ) ) |
|
| 2903 | - return $wp_themes; |
|
| 2985 | + if ( isset( $wp_themes ) ) { |
|
| 2986 | + return $wp_themes; |
|
| 2987 | + } |
|
| 2904 | 2988 | |
| 2905 | 2989 | $themes = wp_get_themes(); |
| 2906 | 2990 | $wp_themes = array(); |
| 2907 | 2991 | |
| 2908 | 2992 | foreach ( $themes as $theme ) { |
| 2909 | 2993 | $name = $theme->get('Name'); |
| 2910 | - if ( isset( $wp_themes[ $name ] ) ) |
|
| 2911 | - $wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme; |
|
| 2912 | - else |
|
| 2913 | - $wp_themes[ $name ] = $theme; |
|
| 2994 | + if ( isset( $wp_themes[ $name ] ) ) { |
|
| 2995 | + $wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme; |
|
| 2996 | + } else { |
|
| 2997 | + $wp_themes[ $name ] = $theme; |
|
| 2998 | + } |
|
| 2914 | 2999 | } |
| 2915 | 3000 | |
| 2916 | 3001 | return $wp_themes; |
@@ -2930,8 +3015,9 @@ discard block |
||
| 2930 | 3015 | _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' ); |
| 2931 | 3016 | |
| 2932 | 3017 | $themes = get_themes(); |
| 2933 | - if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) |
|
| 2934 | - return $themes[ $theme ]; |
|
| 3018 | + if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) { |
|
| 3019 | + return $themes[ $theme ]; |
|
| 3020 | + } |
|
| 2935 | 3021 | return null; |
| 2936 | 3022 | } |
| 2937 | 3023 | |
@@ -2947,8 +3033,9 @@ discard block |
||
| 2947 | 3033 | function get_current_theme() { |
| 2948 | 3034 | _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); |
| 2949 | 3035 | |
| 2950 | - if ( $theme = get_option( 'current_theme' ) ) |
|
| 2951 | - return $theme; |
|
| 3036 | + if ( $theme = get_option( 'current_theme' ) ) { |
|
| 3037 | + return $theme; |
|
| 3038 | + } |
|
| 2952 | 3039 | |
| 2953 | 3040 | return wp_get_theme()->get('Name'); |
| 2954 | 3041 | } |
@@ -2968,10 +3055,11 @@ discard block |
||
| 2968 | 3055 | function clean_pre($matches) { |
| 2969 | 3056 | _deprecated_function( __FUNCTION__, '3.4.0' ); |
| 2970 | 3057 | |
| 2971 | - if ( is_array($matches) ) |
|
| 2972 | - $text = $matches[1] . $matches[2] . "</pre>"; |
|
| 2973 | - else |
|
| 2974 | - $text = $matches; |
|
| 3058 | + if ( is_array($matches) ) { |
|
| 3059 | + $text = $matches[1] . $matches[2] . "</pre>"; |
|
| 3060 | + } else { |
|
| 3061 | + $text = $matches; |
|
| 3062 | + } |
|
| 2975 | 3063 | |
| 2976 | 3064 | $text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text); |
| 2977 | 3065 | $text = str_replace('<p>', "\n", $text); |
@@ -2998,8 +3086,9 @@ discard block |
||
| 2998 | 3086 | 'wp-head-callback' => $wp_head_callback, |
| 2999 | 3087 | 'admin-head-callback' => $admin_head_callback, |
| 3000 | 3088 | ); |
| 3001 | - if ( $admin_preview_callback ) |
|
| 3002 | - $args['admin-preview-callback'] = $admin_preview_callback; |
|
| 3089 | + if ( $admin_preview_callback ) { |
|
| 3090 | + $args['admin-preview-callback'] = $admin_preview_callback; |
|
| 3091 | + } |
|
| 3003 | 3092 | return add_theme_support( 'custom-header', $args ); |
| 3004 | 3093 | } |
| 3005 | 3094 | |
@@ -3031,12 +3120,15 @@ discard block |
||
| 3031 | 3120 | function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { |
| 3032 | 3121 | _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )' ); |
| 3033 | 3122 | $args = array(); |
| 3034 | - if ( $wp_head_callback ) |
|
| 3035 | - $args['wp-head-callback'] = $wp_head_callback; |
|
| 3036 | - if ( $admin_head_callback ) |
|
| 3037 | - $args['admin-head-callback'] = $admin_head_callback; |
|
| 3038 | - if ( $admin_preview_callback ) |
|
| 3039 | - $args['admin-preview-callback'] = $admin_preview_callback; |
|
| 3123 | + if ( $wp_head_callback ) { |
|
| 3124 | + $args['wp-head-callback'] = $wp_head_callback; |
|
| 3125 | + } |
|
| 3126 | + if ( $admin_head_callback ) { |
|
| 3127 | + $args['admin-head-callback'] = $admin_head_callback; |
|
| 3128 | + } |
|
| 3129 | + if ( $admin_preview_callback ) { |
|
| 3130 | + $args['admin-preview-callback'] = $admin_preview_callback; |
|
| 3131 | + } |
|
| 3040 | 3132 | return add_theme_support( 'custom-background', $args ); |
| 3041 | 3133 | } |
| 3042 | 3134 | |
@@ -3083,8 +3175,9 @@ discard block |
||
| 3083 | 3175 | ); |
| 3084 | 3176 | |
| 3085 | 3177 | foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) { |
| 3086 | - if ( ! isset( $theme_data[ $extra_header ] ) ) |
|
| 3087 | - $theme_data[ $extra_header ] = $theme->get( $extra_header ); |
|
| 3178 | + if ( ! isset( $theme_data[ $extra_header ] ) ) { |
|
| 3179 | + $theme_data[ $extra_header ] = $theme->get( $extra_header ); |
|
| 3180 | + } |
|
| 3088 | 3181 | } |
| 3089 | 3182 | |
| 3090 | 3183 | return $theme_data; |
@@ -3153,9 +3246,10 @@ discard block |
||
| 3153 | 3246 | */ |
| 3154 | 3247 | function sticky_class( $post_id = null ) { |
| 3155 | 3248 | _deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' ); |
| 3156 | - if ( is_sticky( $post_id ) ) |
|
| 3157 | - echo ' sticky'; |
|
| 3158 | -} |
|
| 3249 | + if ( is_sticky( $post_id ) ) { |
|
| 3250 | + echo ' sticky'; |
|
| 3251 | + } |
|
| 3252 | + } |
|
| 3159 | 3253 | |
| 3160 | 3254 | /** |
| 3161 | 3255 | * Retrieve post ancestors. |
@@ -3187,16 +3281,18 @@ discard block |
||
| 3187 | 3281 | function wp_load_image( $file ) { |
| 3188 | 3282 | _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); |
| 3189 | 3283 | |
| 3190 | - if ( is_numeric( $file ) ) |
|
| 3191 | - $file = get_attached_file( $file ); |
|
| 3284 | + if ( is_numeric( $file ) ) { |
|
| 3285 | + $file = get_attached_file( $file ); |
|
| 3286 | + } |
|
| 3192 | 3287 | |
| 3193 | 3288 | if ( ! is_file( $file ) ) { |
| 3194 | 3289 | /* translators: %s: File name. */ |
| 3195 | 3290 | return sprintf( __( 'File “%s” does not exist?' ), $file ); |
| 3196 | 3291 | } |
| 3197 | 3292 | |
| 3198 | - if ( ! function_exists('imagecreatefromstring') ) |
|
| 3199 | - return __('The GD image library is not installed.'); |
|
| 3293 | + if ( ! function_exists('imagecreatefromstring') ) { |
|
| 3294 | + return __('The GD image library is not installed.'); |
|
| 3295 | + } |
|
| 3200 | 3296 | |
| 3201 | 3297 | // Set artificially high because GD uses uncompressed images in memory. |
| 3202 | 3298 | wp_raise_memory_limit( 'image' ); |
@@ -3239,19 +3335,22 @@ discard block |
||
| 3239 | 3335 | _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); |
| 3240 | 3336 | |
| 3241 | 3337 | $editor = wp_get_image_editor( $file ); |
| 3242 | - if ( is_wp_error( $editor ) ) |
|
| 3243 | - return $editor; |
|
| 3338 | + if ( is_wp_error( $editor ) ) { |
|
| 3339 | + return $editor; |
|
| 3340 | + } |
|
| 3244 | 3341 | $editor->set_quality( $jpeg_quality ); |
| 3245 | 3342 | |
| 3246 | 3343 | $resized = $editor->resize( $max_w, $max_h, $crop ); |
| 3247 | - if ( is_wp_error( $resized ) ) |
|
| 3248 | - return $resized; |
|
| 3344 | + if ( is_wp_error( $resized ) ) { |
|
| 3345 | + return $resized; |
|
| 3346 | + } |
|
| 3249 | 3347 | |
| 3250 | 3348 | $dest_file = $editor->generate_filename( $suffix, $dest_path ); |
| 3251 | 3349 | $saved = $editor->save( $dest_file ); |
| 3252 | 3350 | |
| 3253 | - if ( is_wp_error( $saved ) ) |
|
| 3254 | - return $saved; |
|
| 3351 | + if ( is_wp_error( $saved ) ) { |
|
| 3352 | + return $saved; |
|
| 3353 | + } |
|
| 3255 | 3354 | |
| 3256 | 3355 | return $dest_file; |
| 3257 | 3356 | } |
@@ -3289,8 +3388,9 @@ discard block |
||
| 3289 | 3388 | function user_pass_ok($user_login, $user_pass) { |
| 3290 | 3389 | _deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' ); |
| 3291 | 3390 | $user = wp_authenticate( $user_login, $user_pass ); |
| 3292 | - if ( is_wp_error( $user ) ) |
|
| 3293 | - return false; |
|
| 3391 | + if ( is_wp_error( $user ) ) { |
|
| 3392 | + return false; |
|
| 3393 | + } |
|
| 3294 | 3394 | |
| 3295 | 3395 | return true; |
| 3296 | 3396 | } |
@@ -3400,8 +3500,9 @@ discard block |
||
| 3400 | 3500 | global $wp_rich_edit_exists; |
| 3401 | 3501 | _deprecated_function( __FUNCTION__, '3.9.0' ); |
| 3402 | 3502 | |
| 3403 | - if ( ! isset( $wp_rich_edit_exists ) ) |
|
| 3404 | - $wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' ); |
|
| 3503 | + if ( ! isset( $wp_rich_edit_exists ) ) { |
|
| 3504 | + $wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' ); |
|
| 3505 | + } |
|
| 3405 | 3506 | |
| 3406 | 3507 | return $wp_rich_edit_exists; |
| 3407 | 3508 | } |
@@ -3610,8 +3711,10 @@ discard block |
||
| 3610 | 3711 | function wp_htmledit_pre($output) { |
| 3611 | 3712 | _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); |
| 3612 | 3713 | |
| 3613 | - if ( !empty($output) ) |
|
| 3614 | - $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // Convert only '< > &'. |
|
| 3714 | + if ( !empty($output) ) { |
|
| 3715 | + $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); |
|
| 3716 | + } |
|
| 3717 | + // Convert only '< > &'. |
|
| 3615 | 3718 | |
| 3616 | 3719 | /** |
| 3617 | 3720 | * Filters the text before it is formatted for the HTML editor. |
@@ -3661,21 +3764,24 @@ discard block |
||
| 3661 | 3764 | |
| 3662 | 3765 | @set_time_limit( 60 ); |
| 3663 | 3766 | |
| 3664 | - if ( $red > 5 ) |
|
| 3665 | - return false; |
|
| 3767 | + if ( $red > 5 ) { |
|
| 3768 | + return false; |
|
| 3769 | + } |
|
| 3666 | 3770 | |
| 3667 | 3771 | $options = array(); |
| 3668 | 3772 | $options['redirection'] = 5; |
| 3669 | 3773 | |
| 3670 | - if ( false == $file_path ) |
|
| 3671 | - $options['method'] = 'HEAD'; |
|
| 3672 | - else |
|
| 3673 | - $options['method'] = 'GET'; |
|
| 3774 | + if ( false == $file_path ) { |
|
| 3775 | + $options['method'] = 'HEAD'; |
|
| 3776 | + } else { |
|
| 3777 | + $options['method'] = 'GET'; |
|
| 3778 | + } |
|
| 3674 | 3779 | |
| 3675 | 3780 | $response = wp_safe_remote_request( $url, $options ); |
| 3676 | 3781 | |
| 3677 | - if ( is_wp_error( $response ) ) |
|
| 3678 | - return false; |
|
| 3782 | + if ( is_wp_error( $response ) ) { |
|
| 3783 | + return false; |
|
| 3784 | + } |
|
| 3679 | 3785 | |
| 3680 | 3786 | $headers = wp_remote_retrieve_headers( $response ); |
| 3681 | 3787 | $headers['response'] = wp_remote_retrieve_response_code( $response ); |
@@ -3685,13 +3791,15 @@ discard block |
||
| 3685 | 3791 | return wp_get_http( $headers['location'], $file_path, ++$red ); |
| 3686 | 3792 | } |
| 3687 | 3793 | |
| 3688 | - if ( false == $file_path ) |
|
| 3689 | - return $headers; |
|
| 3794 | + if ( false == $file_path ) { |
|
| 3795 | + return $headers; |
|
| 3796 | + } |
|
| 3690 | 3797 | |
| 3691 | 3798 | // GET request - write it to the supplied filename. |
| 3692 | 3799 | $out_fp = fopen($file_path, 'w'); |
| 3693 | - if ( !$out_fp ) |
|
| 3694 | - return $headers; |
|
| 3800 | + if ( !$out_fp ) { |
|
| 3801 | + return $headers; |
|
| 3802 | + } |
|
| 3695 | 3803 | |
| 3696 | 3804 | fwrite( $out_fp, wp_remote_retrieve_body( $response ) ); |
| 3697 | 3805 | fclose($out_fp); |
@@ -3846,13 +3954,14 @@ discard block |
||
| 3846 | 3954 | function _usort_terms_by_ID( $a, $b ) { |
| 3847 | 3955 | _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); |
| 3848 | 3956 | |
| 3849 | - if ( $a->term_id > $b->term_id ) |
|
| 3850 | - return 1; |
|
| 3851 | - elseif ( $a->term_id < $b->term_id ) |
|
| 3852 | - return -1; |
|
| 3853 | - else |
|
| 3854 | - return 0; |
|
| 3855 | -} |
|
| 3957 | + if ( $a->term_id > $b->term_id ) { |
|
| 3958 | + return 1; |
|
| 3959 | + } elseif ( $a->term_id < $b->term_id ) { |
|
| 3960 | + return -1; |
|
| 3961 | + } else { |
|
| 3962 | + return 0; |
|
| 3963 | + } |
|
| 3964 | + } |
|
| 3856 | 3965 | |
| 3857 | 3966 | /** |
| 3858 | 3967 | * Sort categories by name. |
@@ -3892,22 +4001,25 @@ discard block |
||
| 3892 | 4001 | |
| 3893 | 4002 | _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); |
| 3894 | 4003 | |
| 3895 | - if ( empty( $_menu_item_sort_prop ) ) |
|
| 3896 | - return 0; |
|
| 4004 | + if ( empty( $_menu_item_sort_prop ) ) { |
|
| 4005 | + return 0; |
|
| 4006 | + } |
|
| 3897 | 4007 | |
| 3898 | - if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) ) |
|
| 3899 | - return 0; |
|
| 4008 | + if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) ) { |
|
| 4009 | + return 0; |
|
| 4010 | + } |
|
| 3900 | 4011 | |
| 3901 | 4012 | $_a = (int) $a->$_menu_item_sort_prop; |
| 3902 | 4013 | $_b = (int) $b->$_menu_item_sort_prop; |
| 3903 | 4014 | |
| 3904 | - if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop ) |
|
| 3905 | - return 0; |
|
| 3906 | - elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop ) |
|
| 3907 | - return $_a < $_b ? -1 : 1; |
|
| 3908 | - else |
|
| 3909 | - return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop ); |
|
| 3910 | -} |
|
| 4015 | + if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop ) { |
|
| 4016 | + return 0; |
|
| 4017 | + } elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop ) { |
|
| 4018 | + return $_a < $_b ? -1 : 1; |
|
| 4019 | + } else { |
|
| 4020 | + return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop ); |
|
| 4021 | + } |
|
| 4022 | + } |
|
| 3911 | 4023 | |
| 3912 | 4024 | /** |
| 3913 | 4025 | * Retrieves the Press This bookmarklet link. |
@@ -53,8 +53,9 @@ discard block |
||
| 53 | 53 | // Do not allow programs to alter MAILSERVER |
| 54 | 54 | // if it is already specified. They can get around |
| 55 | 55 | // this if they -really- want to, so don't count on it. |
| 56 | - if(empty($this->MAILSERVER)) |
|
| 57 | - $this->MAILSERVER = $server; |
|
| 56 | + if(empty($this->MAILSERVER)) { |
|
| 57 | + $this->MAILSERVER = $server; |
|
| 58 | + } |
|
| 58 | 59 | } |
| 59 | 60 | if(!empty($timeout)) { |
| 60 | 61 | settype($timeout,"integer"); |
@@ -83,8 +84,9 @@ discard block |
||
| 83 | 84 | // If MAILSERVER is set, override $server with its value. |
| 84 | 85 | |
| 85 | 86 | if (!isset($port) || !$port) {$port = 110;} |
| 86 | - if(!empty($this->MAILSERVER)) |
|
| 87 | - $server = $this->MAILSERVER; |
|
| 87 | + if(!empty($this->MAILSERVER)) { |
|
| 88 | + $server = $this->MAILSERVER; |
|
| 89 | + } |
|
| 88 | 90 | |
| 89 | 91 | if(empty($server)){ |
| 90 | 92 | $this->ERROR = "POP3 connect: " . _("No server specified"); |
@@ -104,8 +106,9 @@ discard block |
||
| 104 | 106 | $this->update_timer(); |
| 105 | 107 | $reply = fgets($fp,$this->BUFFER); |
| 106 | 108 | $reply = $this->strip_clf($reply); |
| 107 | - if($this->DEBUG) |
|
| 108 | - error_log("POP3 SEND [connect: $server] GOT [$reply]",0); |
|
| 109 | + if($this->DEBUG) { |
|
| 110 | + error_log("POP3 SEND [connect: $server] GOT [$reply]",0); |
|
| 111 | + } |
|
| 109 | 112 | if(!$this->is_ok($reply)) { |
| 110 | 113 | $this->ERROR = "POP3 connect: " . _("Error ") . "[$reply]"; |
| 111 | 114 | unset($this->FP); |
@@ -130,8 +133,9 @@ discard block |
||
| 130 | 133 | if(!$this->is_ok($reply)) { |
| 131 | 134 | $this->ERROR = "POP3 user: " . _("Error ") . "[$reply]"; |
| 132 | 135 | return false; |
| 133 | - } else |
|
| 134 | - return true; |
|
| 136 | + } else { |
|
| 137 | + return true; |
|
| 138 | + } |
|
| 135 | 139 | } |
| 136 | 140 | } |
| 137 | 141 | |
@@ -222,8 +226,9 @@ discard block |
||
| 222 | 226 | if( (!$count) || ($count == -1) ) { |
| 223 | 227 | // Preserve the error generated by last() and pass() |
| 224 | 228 | return false; |
| 225 | - } else |
|
| 226 | - return $count; |
|
| 229 | + } else { |
|
| 230 | + return $count; |
|
| 231 | + } |
|
| 227 | 232 | } |
| 228 | 233 | } |
| 229 | 234 | } |
@@ -336,8 +341,7 @@ discard block |
||
| 336 | 341 | if($thisMsg != $msgC) |
| 337 | 342 | { |
| 338 | 343 | $MsgArray[$msgC] = "deleted"; |
| 339 | - } |
|
| 340 | - else |
|
| 344 | + } else |
|
| 341 | 345 | { |
| 342 | 346 | $MsgArray[$msgC] = $msgSize; |
| 343 | 347 | } |
@@ -565,8 +569,7 @@ discard block |
||
| 565 | 569 | $msgUidl = $this->strip_clf($msgUidl); |
| 566 | 570 | if($count == $msg) { |
| 567 | 571 | $UIDLArray[$msg] = $msgUidl; |
| 568 | - } |
|
| 569 | - else |
|
| 572 | + } else |
|
| 570 | 573 | { |
| 571 | 574 | $UIDLArray[$count] = 'deleted'; |
| 572 | 575 | } |
@@ -607,18 +610,19 @@ discard block |
||
| 607 | 610 | function is_ok ($cmd = "") { |
| 608 | 611 | // Return true or false on +OK or -ERR |
| 609 | 612 | |
| 610 | - if( empty($cmd) ) |
|
| 611 | - return false; |
|
| 612 | - else |
|
| 613 | - return( stripos($cmd, '+OK') !== false ); |
|
| 613 | + if( empty($cmd) ) { |
|
| 614 | + return false; |
|
| 615 | + } else { |
|
| 616 | + return( stripos($cmd, '+OK') !== false ); |
|
| 617 | + } |
|
| 614 | 618 | } |
| 615 | 619 | |
| 616 | 620 | function strip_clf ($text = "") { |
| 617 | 621 | // Strips \r\n from server responses |
| 618 | 622 | |
| 619 | - if(empty($text)) |
|
| 620 | - return $text; |
|
| 621 | - else { |
|
| 623 | + if(empty($text)) { |
|
| 624 | + return $text; |
|
| 625 | + } else { |
|
| 622 | 626 | $stripped = str_replace(array("\r","\n"),'',$text); |
| 623 | 627 | return $stripped; |
| 624 | 628 | } |
@@ -131,29 +131,33 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | //preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS); |
| 133 | 133 | $URI_PARTS = parse_url($URI); |
| 134 | - if (!empty($URI_PARTS["user"])) |
|
| 135 | - $this->user = $URI_PARTS["user"]; |
|
| 136 | - if (!empty($URI_PARTS["pass"])) |
|
| 137 | - $this->pass = $URI_PARTS["pass"]; |
|
| 138 | - if (empty($URI_PARTS["query"])) |
|
| 139 | - $URI_PARTS["query"] = ''; |
|
| 140 | - if (empty($URI_PARTS["path"])) |
|
| 141 | - $URI_PARTS["path"] = ''; |
|
| 134 | + if (!empty($URI_PARTS["user"])) { |
|
| 135 | + $this->user = $URI_PARTS["user"]; |
|
| 136 | + } |
|
| 137 | + if (!empty($URI_PARTS["pass"])) { |
|
| 138 | + $this->pass = $URI_PARTS["pass"]; |
|
| 139 | + } |
|
| 140 | + if (empty($URI_PARTS["query"])) { |
|
| 141 | + $URI_PARTS["query"] = ''; |
|
| 142 | + } |
|
| 143 | + if (empty($URI_PARTS["path"])) { |
|
| 144 | + $URI_PARTS["path"] = ''; |
|
| 145 | + } |
|
| 142 | 146 | |
| 143 | 147 | switch(strtolower($URI_PARTS["scheme"])) |
| 144 | 148 | { |
| 145 | 149 | case "http": |
| 146 | 150 | $this->host = $URI_PARTS["host"]; |
| 147 | - if(!empty($URI_PARTS["port"])) |
|
| 148 | - $this->port = $URI_PARTS["port"]; |
|
| 151 | + if(!empty($URI_PARTS["port"])) { |
|
| 152 | + $this->port = $URI_PARTS["port"]; |
|
| 153 | + } |
|
| 149 | 154 | if($this->_connect($fp)) |
| 150 | 155 | { |
| 151 | 156 | if($this->_isproxy) |
| 152 | 157 | { |
| 153 | 158 | // using proxy, send entire URI |
| 154 | 159 | $this->_httprequest($URI,$fp,$URI,$this->_httpmethod); |
| 155 | - } |
|
| 156 | - else |
|
| 160 | + } else |
|
| 157 | 161 | { |
| 158 | 162 | $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); |
| 159 | 163 | // no proxy, send only the path |
@@ -189,33 +193,34 @@ discard block |
||
| 189 | 193 | { |
| 190 | 194 | $this->fetch($frameurl); |
| 191 | 195 | $this->_framedepth++; |
| 196 | + } else { |
|
| 197 | + break; |
|
| 192 | 198 | } |
| 193 | - else |
|
| 194 | - break; |
|
| 195 | 199 | } |
| 196 | 200 | } |
| 197 | - } |
|
| 198 | - else |
|
| 201 | + } else |
|
| 199 | 202 | { |
| 200 | 203 | return false; |
| 201 | 204 | } |
| 202 | 205 | return true; |
| 203 | 206 | break; |
| 204 | 207 | case "https": |
| 205 | - if(!$this->curl_path) |
|
| 206 | - return false; |
|
| 207 | - if(function_exists("is_executable")) |
|
| 208 | - if (!is_executable($this->curl_path)) |
|
| 208 | + if(!$this->curl_path) { |
|
| 209 | + return false; |
|
| 210 | + } |
|
| 211 | + if(function_exists("is_executable")) { |
|
| 212 | + if (!is_executable($this->curl_path)) |
|
| 209 | 213 | return false; |
| 214 | + } |
|
| 210 | 215 | $this->host = $URI_PARTS["host"]; |
| 211 | - if(!empty($URI_PARTS["port"])) |
|
| 212 | - $this->port = $URI_PARTS["port"]; |
|
| 216 | + if(!empty($URI_PARTS["port"])) { |
|
| 217 | + $this->port = $URI_PARTS["port"]; |
|
| 218 | + } |
|
| 213 | 219 | if($this->_isproxy) |
| 214 | 220 | { |
| 215 | 221 | // using proxy, send entire URI |
| 216 | 222 | $this->_httpsrequest($URI,$URI,$this->_httpmethod); |
| 217 | - } |
|
| 218 | - else |
|
| 223 | + } else |
|
| 219 | 224 | { |
| 220 | 225 | $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); |
| 221 | 226 | // no proxy, send only the path |
@@ -249,9 +254,9 @@ discard block |
||
| 249 | 254 | { |
| 250 | 255 | $this->fetch($frameurl); |
| 251 | 256 | $this->_framedepth++; |
| 257 | + } else { |
|
| 258 | + break; |
|
| 252 | 259 | } |
| 253 | - else |
|
| 254 | - break; |
|
| 255 | 260 | } |
| 256 | 261 | } |
| 257 | 262 | return true; |
@@ -283,29 +288,33 @@ discard block |
||
| 283 | 288 | $postdata = $this->_prepare_post_body($formvars, $formfiles); |
| 284 | 289 | |
| 285 | 290 | $URI_PARTS = parse_url($URI); |
| 286 | - if (!empty($URI_PARTS["user"])) |
|
| 287 | - $this->user = $URI_PARTS["user"]; |
|
| 288 | - if (!empty($URI_PARTS["pass"])) |
|
| 289 | - $this->pass = $URI_PARTS["pass"]; |
|
| 290 | - if (empty($URI_PARTS["query"])) |
|
| 291 | - $URI_PARTS["query"] = ''; |
|
| 292 | - if (empty($URI_PARTS["path"])) |
|
| 293 | - $URI_PARTS["path"] = ''; |
|
| 291 | + if (!empty($URI_PARTS["user"])) { |
|
| 292 | + $this->user = $URI_PARTS["user"]; |
|
| 293 | + } |
|
| 294 | + if (!empty($URI_PARTS["pass"])) { |
|
| 295 | + $this->pass = $URI_PARTS["pass"]; |
|
| 296 | + } |
|
| 297 | + if (empty($URI_PARTS["query"])) { |
|
| 298 | + $URI_PARTS["query"] = ''; |
|
| 299 | + } |
|
| 300 | + if (empty($URI_PARTS["path"])) { |
|
| 301 | + $URI_PARTS["path"] = ''; |
|
| 302 | + } |
|
| 294 | 303 | |
| 295 | 304 | switch(strtolower($URI_PARTS["scheme"])) |
| 296 | 305 | { |
| 297 | 306 | case "http": |
| 298 | 307 | $this->host = $URI_PARTS["host"]; |
| 299 | - if(!empty($URI_PARTS["port"])) |
|
| 300 | - $this->port = $URI_PARTS["port"]; |
|
| 308 | + if(!empty($URI_PARTS["port"])) { |
|
| 309 | + $this->port = $URI_PARTS["port"]; |
|
| 310 | + } |
|
| 301 | 311 | if($this->_connect($fp)) |
| 302 | 312 | { |
| 303 | 313 | if($this->_isproxy) |
| 304 | 314 | { |
| 305 | 315 | // using proxy, send entire URI |
| 306 | 316 | $this->_httprequest($URI,$fp,$URI,$this->_submit_method,$this->_submit_type,$postdata); |
| 307 | - } |
|
| 308 | - else |
|
| 317 | + } else |
|
| 309 | 318 | { |
| 310 | 319 | $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); |
| 311 | 320 | // no proxy, send only the path |
@@ -319,8 +328,9 @@ discard block |
||
| 319 | 328 | /* url was redirected, check if we've hit the max depth */ |
| 320 | 329 | if($this->maxredirs > $this->_redirectdepth) |
| 321 | 330 | { |
| 322 | - if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) |
|
| 323 | - $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); |
|
| 331 | + if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) { |
|
| 332 | + $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); |
|
| 333 | + } |
|
| 324 | 334 | |
| 325 | 335 | // only follow redirect if it's on this site, or offsiteok is true |
| 326 | 336 | if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) |
@@ -328,10 +338,13 @@ discard block |
||
| 328 | 338 | /* follow the redirect */ |
| 329 | 339 | $this->_redirectdepth++; |
| 330 | 340 | $this->lastredirectaddr=$this->_redirectaddr; |
| 331 | - if( strpos( $this->_redirectaddr, "?" ) > 0 ) |
|
| 332 | - $this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get |
|
| 333 | - else |
|
| 334 | - $this->submit($this->_redirectaddr,$formvars, $formfiles); |
|
| 341 | + if( strpos( $this->_redirectaddr, "?" ) > 0 ) { |
|
| 342 | + $this->fetch($this->_redirectaddr); |
|
| 343 | + } |
|
| 344 | + // the redirect has changed the request method from post to get |
|
| 345 | + else { |
|
| 346 | + $this->submit($this->_redirectaddr,$formvars, $formfiles); |
|
| 347 | + } |
|
| 335 | 348 | } |
| 336 | 349 | } |
| 337 | 350 | } |
@@ -347,34 +360,35 @@ discard block |
||
| 347 | 360 | { |
| 348 | 361 | $this->fetch($frameurl); |
| 349 | 362 | $this->_framedepth++; |
| 363 | + } else { |
|
| 364 | + break; |
|
| 350 | 365 | } |
| 351 | - else |
|
| 352 | - break; |
|
| 353 | 366 | } |
| 354 | 367 | } |
| 355 | 368 | |
| 356 | - } |
|
| 357 | - else |
|
| 369 | + } else |
|
| 358 | 370 | { |
| 359 | 371 | return false; |
| 360 | 372 | } |
| 361 | 373 | return true; |
| 362 | 374 | break; |
| 363 | 375 | case "https": |
| 364 | - if(!$this->curl_path) |
|
| 365 | - return false; |
|
| 366 | - if(function_exists("is_executable")) |
|
| 367 | - if (!is_executable($this->curl_path)) |
|
| 376 | + if(!$this->curl_path) { |
|
| 377 | + return false; |
|
| 378 | + } |
|
| 379 | + if(function_exists("is_executable")) { |
|
| 380 | + if (!is_executable($this->curl_path)) |
|
| 368 | 381 | return false; |
| 382 | + } |
|
| 369 | 383 | $this->host = $URI_PARTS["host"]; |
| 370 | - if(!empty($URI_PARTS["port"])) |
|
| 371 | - $this->port = $URI_PARTS["port"]; |
|
| 384 | + if(!empty($URI_PARTS["port"])) { |
|
| 385 | + $this->port = $URI_PARTS["port"]; |
|
| 386 | + } |
|
| 372 | 387 | if($this->_isproxy) |
| 373 | 388 | { |
| 374 | 389 | // using proxy, send entire URI |
| 375 | 390 | $this->_httpsrequest($URI, $URI, $this->_submit_method, $this->_submit_type, $postdata); |
| 376 | - } |
|
| 377 | - else |
|
| 391 | + } else |
|
| 378 | 392 | { |
| 379 | 393 | $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); |
| 380 | 394 | // no proxy, send only the path |
@@ -386,8 +400,9 @@ discard block |
||
| 386 | 400 | /* url was redirected, check if we've hit the max depth */ |
| 387 | 401 | if($this->maxredirs > $this->_redirectdepth) |
| 388 | 402 | { |
| 389 | - if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) |
|
| 390 | - $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); |
|
| 403 | + if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) { |
|
| 404 | + $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); |
|
| 405 | + } |
|
| 391 | 406 | |
| 392 | 407 | // only follow redirect if it's on this site, or offsiteok is true |
| 393 | 408 | if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) |
@@ -395,10 +410,13 @@ discard block |
||
| 395 | 410 | /* follow the redirect */ |
| 396 | 411 | $this->_redirectdepth++; |
| 397 | 412 | $this->lastredirectaddr=$this->_redirectaddr; |
| 398 | - if( strpos( $this->_redirectaddr, "?" ) > 0 ) |
|
| 399 | - $this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get |
|
| 400 | - else |
|
| 401 | - $this->submit($this->_redirectaddr,$formvars, $formfiles); |
|
| 413 | + if( strpos( $this->_redirectaddr, "?" ) > 0 ) { |
|
| 414 | + $this->fetch($this->_redirectaddr); |
|
| 415 | + } |
|
| 416 | + // the redirect has changed the request method from post to get |
|
| 417 | + else { |
|
| 418 | + $this->submit($this->_redirectaddr,$formvars, $formfiles); |
|
| 419 | + } |
|
| 402 | 420 | } |
| 403 | 421 | } |
| 404 | 422 | } |
@@ -414,9 +432,9 @@ discard block |
||
| 414 | 432 | { |
| 415 | 433 | $this->fetch($frameurl); |
| 416 | 434 | $this->_framedepth++; |
| 435 | + } else { |
|
| 436 | + break; |
|
| 417 | 437 | } |
| 418 | - else |
|
| 419 | - break; |
|
| 420 | 438 | } |
| 421 | 439 | } |
| 422 | 440 | return true; |
@@ -442,22 +460,25 @@ discard block |
||
| 442 | 460 | { |
| 443 | 461 | if ($this->fetch($URI)) |
| 444 | 462 | { |
| 445 | - if($this->lastredirectaddr) |
|
| 446 | - $URI = $this->lastredirectaddr; |
|
| 463 | + if($this->lastredirectaddr) { |
|
| 464 | + $URI = $this->lastredirectaddr; |
|
| 465 | + } |
|
| 447 | 466 | if(is_array($this->results)) |
| 448 | 467 | { |
| 449 | - for($x=0;$x<count($this->results);$x++) |
|
| 450 | - $this->results[$x] = $this->_striplinks($this->results[$x]); |
|
| 468 | + for($x=0;$x<count($this->results);$x++) { |
|
| 469 | + $this->results[$x] = $this->_striplinks($this->results[$x]); |
|
| 470 | + } |
|
| 471 | + } else { |
|
| 472 | + $this->results = $this->_striplinks($this->results); |
|
| 451 | 473 | } |
| 452 | - else |
|
| 453 | - $this->results = $this->_striplinks($this->results); |
|
| 454 | 474 | |
| 455 | - if($this->expandlinks) |
|
| 456 | - $this->results = $this->_expandlinks($this->results, $URI); |
|
| 475 | + if($this->expandlinks) { |
|
| 476 | + $this->results = $this->_expandlinks($this->results, $URI); |
|
| 477 | + } |
|
| 457 | 478 | return true; |
| 479 | + } else { |
|
| 480 | + return false; |
|
| 458 | 481 | } |
| 459 | - else |
|
| 460 | - return false; |
|
| 461 | 482 | } |
| 462 | 483 | |
| 463 | 484 | /*======================================================================*\ |
@@ -475,16 +496,17 @@ discard block |
||
| 475 | 496 | |
| 476 | 497 | if(is_array($this->results)) |
| 477 | 498 | { |
| 478 | - for($x=0;$x<count($this->results);$x++) |
|
| 479 | - $this->results[$x] = $this->_stripform($this->results[$x]); |
|
| 499 | + for($x=0;$x<count($this->results);$x++) { |
|
| 500 | + $this->results[$x] = $this->_stripform($this->results[$x]); |
|
| 501 | + } |
|
| 502 | + } else { |
|
| 503 | + $this->results = $this->_stripform($this->results); |
|
| 480 | 504 | } |
| 481 | - else |
|
| 482 | - $this->results = $this->_stripform($this->results); |
|
| 483 | 505 | |
| 484 | 506 | return true; |
| 507 | + } else { |
|
| 508 | + return false; |
|
| 485 | 509 | } |
| 486 | - else |
|
| 487 | - return false; |
|
| 488 | 510 | } |
| 489 | 511 | |
| 490 | 512 | |
@@ -501,15 +523,16 @@ discard block |
||
| 501 | 523 | { |
| 502 | 524 | if(is_array($this->results)) |
| 503 | 525 | { |
| 504 | - for($x=0;$x<count($this->results);$x++) |
|
| 505 | - $this->results[$x] = $this->_striptext($this->results[$x]); |
|
| 526 | + for($x=0;$x<count($this->results);$x++) { |
|
| 527 | + $this->results[$x] = $this->_striptext($this->results[$x]); |
|
| 528 | + } |
|
| 529 | + } else { |
|
| 530 | + $this->results = $this->_striptext($this->results); |
|
| 506 | 531 | } |
| 507 | - else |
|
| 508 | - $this->results = $this->_striptext($this->results); |
|
| 509 | 532 | return true; |
| 533 | + } else { |
|
| 534 | + return false; |
|
| 510 | 535 | } |
| 511 | - else |
|
| 512 | - return false; |
|
| 513 | 536 | } |
| 514 | 537 | |
| 515 | 538 | /*======================================================================*\ |
@@ -523,27 +546,29 @@ discard block |
||
| 523 | 546 | { |
| 524 | 547 | if($this->submit($URI,$formvars, $formfiles)) |
| 525 | 548 | { |
| 526 | - if($this->lastredirectaddr) |
|
| 527 | - $URI = $this->lastredirectaddr; |
|
| 549 | + if($this->lastredirectaddr) { |
|
| 550 | + $URI = $this->lastredirectaddr; |
|
| 551 | + } |
|
| 528 | 552 | if(is_array($this->results)) |
| 529 | 553 | { |
| 530 | 554 | for($x=0;$x<count($this->results);$x++) |
| 531 | 555 | { |
| 532 | 556 | $this->results[$x] = $this->_striplinks($this->results[$x]); |
| 533 | - if($this->expandlinks) |
|
| 534 | - $this->results[$x] = $this->_expandlinks($this->results[$x],$URI); |
|
| 557 | + if($this->expandlinks) { |
|
| 558 | + $this->results[$x] = $this->_expandlinks($this->results[$x],$URI); |
|
| 559 | + } |
|
| 535 | 560 | } |
| 536 | - } |
|
| 537 | - else |
|
| 561 | + } else |
|
| 538 | 562 | { |
| 539 | 563 | $this->results = $this->_striplinks($this->results); |
| 540 | - if($this->expandlinks) |
|
| 541 | - $this->results = $this->_expandlinks($this->results,$URI); |
|
| 564 | + if($this->expandlinks) { |
|
| 565 | + $this->results = $this->_expandlinks($this->results,$URI); |
|
| 566 | + } |
|
| 542 | 567 | } |
| 543 | 568 | return true; |
| 569 | + } else { |
|
| 570 | + return false; |
|
| 544 | 571 | } |
| 545 | - else |
|
| 546 | - return false; |
|
| 547 | 572 | } |
| 548 | 573 | |
| 549 | 574 | /*======================================================================*\ |
@@ -557,27 +582,29 @@ discard block |
||
| 557 | 582 | { |
| 558 | 583 | if($this->submit($URI,$formvars, $formfiles)) |
| 559 | 584 | { |
| 560 | - if($this->lastredirectaddr) |
|
| 561 | - $URI = $this->lastredirectaddr; |
|
| 585 | + if($this->lastredirectaddr) { |
|
| 586 | + $URI = $this->lastredirectaddr; |
|
| 587 | + } |
|
| 562 | 588 | if(is_array($this->results)) |
| 563 | 589 | { |
| 564 | 590 | for($x=0;$x<count($this->results);$x++) |
| 565 | 591 | { |
| 566 | 592 | $this->results[$x] = $this->_striptext($this->results[$x]); |
| 567 | - if($this->expandlinks) |
|
| 568 | - $this->results[$x] = $this->_expandlinks($this->results[$x],$URI); |
|
| 593 | + if($this->expandlinks) { |
|
| 594 | + $this->results[$x] = $this->_expandlinks($this->results[$x],$URI); |
|
| 595 | + } |
|
| 569 | 596 | } |
| 570 | - } |
|
| 571 | - else |
|
| 597 | + } else |
|
| 572 | 598 | { |
| 573 | 599 | $this->results = $this->_striptext($this->results); |
| 574 | - if($this->expandlinks) |
|
| 575 | - $this->results = $this->_expandlinks($this->results,$URI); |
|
| 600 | + if($this->expandlinks) { |
|
| 601 | + $this->results = $this->_expandlinks($this->results,$URI); |
|
| 602 | + } |
|
| 576 | 603 | } |
| 577 | 604 | return true; |
| 605 | + } else { |
|
| 606 | + return false; |
|
| 578 | 607 | } |
| 579 | - else |
|
| 580 | - return false; |
|
| 581 | 608 | } |
| 582 | 609 | |
| 583 | 610 | |
@@ -631,14 +658,16 @@ discard block |
||
| 631 | 658 | |
| 632 | 659 | foreach ( $links[2] as $key => $val ) |
| 633 | 660 | { |
| 634 | - if(!empty($val)) |
|
| 635 | - $match[] = $val; |
|
| 661 | + if(!empty($val)) { |
|
| 662 | + $match[] = $val; |
|
| 663 | + } |
|
| 636 | 664 | } |
| 637 | 665 | |
| 638 | 666 | foreach ( $links[3] as $key => $val ) |
| 639 | 667 | { |
| 640 | - if(!empty($val)) |
|
| 641 | - $match[] = $val; |
|
| 668 | + if(!empty($val)) { |
|
| 669 | + $match[] = $val; |
|
| 670 | + } |
|
| 642 | 671 | } |
| 643 | 672 | |
| 644 | 673 | // return the links |
@@ -784,29 +813,36 @@ discard block |
||
| 784 | 813 | function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="") |
| 785 | 814 | { |
| 786 | 815 | $cookie_headers = ''; |
| 787 | - if($this->passcookies && $this->_redirectaddr) |
|
| 788 | - $this->setcookies(); |
|
| 816 | + if($this->passcookies && $this->_redirectaddr) { |
|
| 817 | + $this->setcookies(); |
|
| 818 | + } |
|
| 789 | 819 | |
| 790 | 820 | $URI_PARTS = parse_url($URI); |
| 791 | - if(empty($url)) |
|
| 792 | - $url = "/"; |
|
| 821 | + if(empty($url)) { |
|
| 822 | + $url = "/"; |
|
| 823 | + } |
|
| 793 | 824 | $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; |
| 794 | - if(!empty($this->agent)) |
|
| 795 | - $headers .= "User-Agent: ".$this->agent."\r\n"; |
|
| 825 | + if(!empty($this->agent)) { |
|
| 826 | + $headers .= "User-Agent: ".$this->agent."\r\n"; |
|
| 827 | + } |
|
| 796 | 828 | if(!empty($this->host) && !isset($this->rawheaders['Host'])) { |
| 797 | 829 | $headers .= "Host: ".$this->host; |
| 798 | - if(!empty($this->port) && $this->port != 80) |
|
| 799 | - $headers .= ":".$this->port; |
|
| 830 | + if(!empty($this->port) && $this->port != 80) { |
|
| 831 | + $headers .= ":".$this->port; |
|
| 832 | + } |
|
| 800 | 833 | $headers .= "\r\n"; |
| 801 | 834 | } |
| 802 | - if(!empty($this->accept)) |
|
| 803 | - $headers .= "Accept: ".$this->accept."\r\n"; |
|
| 804 | - if(!empty($this->referer)) |
|
| 805 | - $headers .= "Referer: ".$this->referer."\r\n"; |
|
| 835 | + if(!empty($this->accept)) { |
|
| 836 | + $headers .= "Accept: ".$this->accept."\r\n"; |
|
| 837 | + } |
|
| 838 | + if(!empty($this->referer)) { |
|
| 839 | + $headers .= "Referer: ".$this->referer."\r\n"; |
|
| 840 | + } |
|
| 806 | 841 | if(!empty($this->cookies)) |
| 807 | 842 | { |
| 808 | - if(!is_array($this->cookies)) |
|
| 809 | - $this->cookies = (array)$this->cookies; |
|
| 843 | + if(!is_array($this->cookies)) { |
|
| 844 | + $this->cookies = (array)$this->cookies; |
|
| 845 | + } |
|
| 810 | 846 | |
| 811 | 847 | reset($this->cookies); |
| 812 | 848 | if ( count($this->cookies) > 0 ) { |
@@ -819,32 +855,39 @@ discard block |
||
| 819 | 855 | } |
| 820 | 856 | if(!empty($this->rawheaders)) |
| 821 | 857 | { |
| 822 | - if(!is_array($this->rawheaders)) |
|
| 823 | - $this->rawheaders = (array)$this->rawheaders; |
|
| 824 | - foreach ( $this->rawheaders as $headerKey => $headerVal ) |
|
| 825 | - $headers .= $headerKey.": ".$headerVal."\r\n"; |
|
| 858 | + if(!is_array($this->rawheaders)) { |
|
| 859 | + $this->rawheaders = (array)$this->rawheaders; |
|
| 860 | + } |
|
| 861 | + foreach ( $this->rawheaders as $headerKey => $headerVal ) { |
|
| 862 | + $headers .= $headerKey.": ".$headerVal."\r\n"; |
|
| 863 | + } |
|
| 826 | 864 | } |
| 827 | 865 | if(!empty($content_type)) { |
| 828 | 866 | $headers .= "Content-type: $content_type"; |
| 829 | - if ($content_type == "multipart/form-data") |
|
| 830 | - $headers .= "; boundary=".$this->_mime_boundary; |
|
| 867 | + if ($content_type == "multipart/form-data") { |
|
| 868 | + $headers .= "; boundary=".$this->_mime_boundary; |
|
| 869 | + } |
|
| 831 | 870 | $headers .= "\r\n"; |
| 832 | 871 | } |
| 833 | - if(!empty($body)) |
|
| 834 | - $headers .= "Content-length: ".strlen($body)."\r\n"; |
|
| 835 | - if(!empty($this->user) || !empty($this->pass)) |
|
| 836 | - $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; |
|
| 872 | + if(!empty($body)) { |
|
| 873 | + $headers .= "Content-length: ".strlen($body)."\r\n"; |
|
| 874 | + } |
|
| 875 | + if(!empty($this->user) || !empty($this->pass)) { |
|
| 876 | + $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; |
|
| 877 | + } |
|
| 837 | 878 | |
| 838 | 879 | //add proxy auth headers |
| 839 | - if(!empty($this->proxy_user)) |
|
| 840 | - $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n"; |
|
| 880 | + if(!empty($this->proxy_user)) { |
|
| 881 | + $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n"; |
|
| 882 | + } |
|
| 841 | 883 | |
| 842 | 884 | |
| 843 | 885 | $headers .= "\r\n"; |
| 844 | 886 | |
| 845 | 887 | // set the read timeout if needed |
| 846 | - if ($this->read_timeout > 0) |
|
| 847 | - socket_set_timeout($fp, $this->read_timeout); |
|
| 888 | + if ($this->read_timeout > 0) { |
|
| 889 | + socket_set_timeout($fp, $this->read_timeout); |
|
| 890 | + } |
|
| 848 | 891 | $this->timed_out = false; |
| 849 | 892 | |
| 850 | 893 | fwrite($fp,$headers.$body,strlen($headers.$body)); |
@@ -860,8 +903,9 @@ discard block |
||
| 860 | 903 | return false; |
| 861 | 904 | } |
| 862 | 905 | |
| 863 | - if($currentHeader == "\r\n") |
|
| 864 | - break; |
|
| 906 | + if($currentHeader == "\r\n") { |
|
| 907 | + break; |
|
| 908 | + } |
|
| 865 | 909 | |
| 866 | 910 | // if a header begins with Location: or URI:, set the redirect |
| 867 | 911 | if(preg_match("/^(Location:|URI:)/i",$currentHeader)) |
@@ -874,13 +918,14 @@ discard block |
||
| 874 | 918 | // no host in the path, so prepend |
| 875 | 919 | $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; |
| 876 | 920 | // eliminate double slash |
| 877 | - if(!preg_match("|^/|",$matches[2])) |
|
| 878 | - $this->_redirectaddr .= "/".$matches[2]; |
|
| 879 | - else |
|
| 880 | - $this->_redirectaddr .= $matches[2]; |
|
| 921 | + if(!preg_match("|^/|",$matches[2])) { |
|
| 922 | + $this->_redirectaddr .= "/".$matches[2]; |
|
| 923 | + } else { |
|
| 924 | + $this->_redirectaddr .= $matches[2]; |
|
| 925 | + } |
|
| 926 | + } else { |
|
| 927 | + $this->_redirectaddr = $matches[2]; |
|
| 881 | 928 | } |
| 882 | - else |
|
| 883 | - $this->_redirectaddr = $matches[2]; |
|
| 884 | 929 | } |
| 885 | 930 | |
| 886 | 931 | if(preg_match("|^HTTP/|",$currentHeader)) |
@@ -922,15 +967,18 @@ discard block |
||
| 922 | 967 | if(($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i",$results,$match)) |
| 923 | 968 | { |
| 924 | 969 | $this->results[] = $results; |
| 925 | - for($x=0; $x<count($match[1]); $x++) |
|
| 926 | - $this->_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host); |
|
| 970 | + for($x=0; $x<count($match[1]); $x++) { |
|
| 971 | + $this->_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host); |
|
| 972 | + } |
|
| 927 | 973 | } |
| 928 | 974 | // have we already fetched framed content? |
| 929 | - elseif(is_array($this->results)) |
|
| 930 | - $this->results[] = $results; |
|
| 975 | + elseif(is_array($this->results)) { |
|
| 976 | + $this->results[] = $results; |
|
| 977 | + } |
|
| 931 | 978 | // no framed content |
| 932 | - else |
|
| 933 | - $this->results = $results; |
|
| 979 | + else { |
|
| 980 | + $this->results = $results; |
|
| 981 | + } |
|
| 934 | 982 | |
| 935 | 983 | return true; |
| 936 | 984 | } |
@@ -946,31 +994,38 @@ discard block |
||
| 946 | 994 | |
| 947 | 995 | function _httpsrequest($url,$URI,$http_method,$content_type="",$body="") |
| 948 | 996 | { |
| 949 | - if($this->passcookies && $this->_redirectaddr) |
|
| 950 | - $this->setcookies(); |
|
| 997 | + if($this->passcookies && $this->_redirectaddr) { |
|
| 998 | + $this->setcookies(); |
|
| 999 | + } |
|
| 951 | 1000 | |
| 952 | 1001 | $headers = array(); |
| 953 | 1002 | |
| 954 | 1003 | $URI_PARTS = parse_url($URI); |
| 955 | - if(empty($url)) |
|
| 956 | - $url = "/"; |
|
| 1004 | + if(empty($url)) { |
|
| 1005 | + $url = "/"; |
|
| 1006 | + } |
|
| 957 | 1007 | // GET ... header not needed for curl |
| 958 | 1008 | //$headers[] = $http_method." ".$url." ".$this->_httpversion; |
| 959 | - if(!empty($this->agent)) |
|
| 960 | - $headers[] = "User-Agent: ".$this->agent; |
|
| 961 | - if(!empty($this->host)) |
|
| 962 | - if(!empty($this->port)) |
|
| 1009 | + if(!empty($this->agent)) { |
|
| 1010 | + $headers[] = "User-Agent: ".$this->agent; |
|
| 1011 | + } |
|
| 1012 | + if(!empty($this->host)) { |
|
| 1013 | + if(!empty($this->port)) |
|
| 963 | 1014 | $headers[] = "Host: ".$this->host.":".$this->port; |
| 964 | - else |
|
| 965 | - $headers[] = "Host: ".$this->host; |
|
| 966 | - if(!empty($this->accept)) |
|
| 967 | - $headers[] = "Accept: ".$this->accept; |
|
| 968 | - if(!empty($this->referer)) |
|
| 969 | - $headers[] = "Referer: ".$this->referer; |
|
| 1015 | + } else { |
|
| 1016 | + $headers[] = "Host: ".$this->host; |
|
| 1017 | + } |
|
| 1018 | + if(!empty($this->accept)) { |
|
| 1019 | + $headers[] = "Accept: ".$this->accept; |
|
| 1020 | + } |
|
| 1021 | + if(!empty($this->referer)) { |
|
| 1022 | + $headers[] = "Referer: ".$this->referer; |
|
| 1023 | + } |
|
| 970 | 1024 | if(!empty($this->cookies)) |
| 971 | 1025 | { |
| 972 | - if(!is_array($this->cookies)) |
|
| 973 | - $this->cookies = (array)$this->cookies; |
|
| 1026 | + if(!is_array($this->cookies)) { |
|
| 1027 | + $this->cookies = (array)$this->cookies; |
|
| 1028 | + } |
|
| 974 | 1029 | |
| 975 | 1030 | reset($this->cookies); |
| 976 | 1031 | if ( count($this->cookies) > 0 ) { |
@@ -983,21 +1038,26 @@ discard block |
||
| 983 | 1038 | } |
| 984 | 1039 | if(!empty($this->rawheaders)) |
| 985 | 1040 | { |
| 986 | - if(!is_array($this->rawheaders)) |
|
| 987 | - $this->rawheaders = (array)$this->rawheaders; |
|
| 988 | - foreach ( $this->rawheaders as $headerKey => $headerVal ) |
|
| 989 | - $headers[] = $headerKey.": ".$headerVal; |
|
| 1041 | + if(!is_array($this->rawheaders)) { |
|
| 1042 | + $this->rawheaders = (array)$this->rawheaders; |
|
| 1043 | + } |
|
| 1044 | + foreach ( $this->rawheaders as $headerKey => $headerVal ) { |
|
| 1045 | + $headers[] = $headerKey.": ".$headerVal; |
|
| 1046 | + } |
|
| 990 | 1047 | } |
| 991 | 1048 | if(!empty($content_type)) { |
| 992 | - if ($content_type == "multipart/form-data") |
|
| 993 | - $headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary; |
|
| 994 | - else |
|
| 995 | - $headers[] = "Content-type: $content_type"; |
|
| 1049 | + if ($content_type == "multipart/form-data") { |
|
| 1050 | + $headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary; |
|
| 1051 | + } else { |
|
| 1052 | + $headers[] = "Content-type: $content_type"; |
|
| 1053 | + } |
|
| 1054 | + } |
|
| 1055 | + if(!empty($body)) { |
|
| 1056 | + $headers[] = "Content-length: ".strlen($body); |
|
| 1057 | + } |
|
| 1058 | + if(!empty($this->user) || !empty($this->pass)) { |
|
| 1059 | + $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); |
|
| 996 | 1060 | } |
| 997 | - if(!empty($body)) |
|
| 998 | - $headers[] = "Content-length: ".strlen($body); |
|
| 999 | - if(!empty($this->user) || !empty($this->pass)) |
|
| 1000 | - $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); |
|
| 1001 | 1061 | |
| 1002 | 1062 | $headerfile = tempnam( $this->temp_dir, "sno" ); |
| 1003 | 1063 | $cmdline_params = '-k -D ' . escapeshellarg( $headerfile ); |
@@ -1045,17 +1105,19 @@ discard block |
||
| 1045 | 1105 | // no host in the path, so prepend |
| 1046 | 1106 | $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; |
| 1047 | 1107 | // eliminate double slash |
| 1048 | - if(!preg_match("|^/|",$matches[2])) |
|
| 1049 | - $this->_redirectaddr .= "/".$matches[2]; |
|
| 1050 | - else |
|
| 1051 | - $this->_redirectaddr .= $matches[2]; |
|
| 1108 | + if(!preg_match("|^/|",$matches[2])) { |
|
| 1109 | + $this->_redirectaddr .= "/".$matches[2]; |
|
| 1110 | + } else { |
|
| 1111 | + $this->_redirectaddr .= $matches[2]; |
|
| 1112 | + } |
|
| 1113 | + } else { |
|
| 1114 | + $this->_redirectaddr = $matches[2]; |
|
| 1052 | 1115 | } |
| 1053 | - else |
|
| 1054 | - $this->_redirectaddr = $matches[2]; |
|
| 1055 | 1116 | } |
| 1056 | 1117 | |
| 1057 | - if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) |
|
| 1058 | - $this->response_code = $result_headers[$currentHeader]; |
|
| 1118 | + if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) { |
|
| 1119 | + $this->response_code = $result_headers[$currentHeader]; |
|
| 1120 | + } |
|
| 1059 | 1121 | |
| 1060 | 1122 | $this->headers[] = $result_headers[$currentHeader]; |
| 1061 | 1123 | } |
@@ -1071,15 +1133,18 @@ discard block |
||
| 1071 | 1133 | if(($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i",$results,$match)) |
| 1072 | 1134 | { |
| 1073 | 1135 | $this->results[] = $results; |
| 1074 | - for($x=0; $x<count($match[1]); $x++) |
|
| 1075 | - $this->_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host); |
|
| 1136 | + for($x=0; $x<count($match[1]); $x++) { |
|
| 1137 | + $this->_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host); |
|
| 1138 | + } |
|
| 1076 | 1139 | } |
| 1077 | 1140 | // have we already fetched framed content? |
| 1078 | - elseif(is_array($this->results)) |
|
| 1079 | - $this->results[] = $results; |
|
| 1141 | + elseif(is_array($this->results)) { |
|
| 1142 | + $this->results[] = $results; |
|
| 1143 | + } |
|
| 1080 | 1144 | // no framed content |
| 1081 | - else |
|
| 1082 | - $this->results = $results; |
|
| 1145 | + else { |
|
| 1146 | + $this->results = $results; |
|
| 1147 | + } |
|
| 1083 | 1148 | |
| 1084 | 1149 | unlink("$headerfile"); |
| 1085 | 1150 | |
@@ -1095,8 +1160,9 @@ discard block |
||
| 1095 | 1160 | { |
| 1096 | 1161 | for($x=0; $x<count($this->headers); $x++) |
| 1097 | 1162 | { |
| 1098 | - if(preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x],$match)) |
|
| 1099 | - $this->cookies[$match[1]] = urldecode($match[2]); |
|
| 1163 | + if(preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x],$match)) { |
|
| 1164 | + $this->cookies[$match[1]] = urldecode($match[2]); |
|
| 1165 | + } |
|
| 1100 | 1166 | } |
| 1101 | 1167 | } |
| 1102 | 1168 | |
@@ -1133,8 +1199,7 @@ discard block |
||
| 1133 | 1199 | |
| 1134 | 1200 | $host = $this->proxy_host; |
| 1135 | 1201 | $port = $this->proxy_port; |
| 1136 | - } |
|
| 1137 | - else |
|
| 1202 | + } else |
|
| 1138 | 1203 | { |
| 1139 | 1204 | $host = $this->host; |
| 1140 | 1205 | $port = $this->port; |
@@ -1153,8 +1218,7 @@ discard block |
||
| 1153 | 1218 | // socket connection succeeded |
| 1154 | 1219 | |
| 1155 | 1220 | return true; |
| 1156 | - } |
|
| 1157 | - else |
|
| 1221 | + } else |
|
| 1158 | 1222 | { |
| 1159 | 1223 | // socket connection failed |
| 1160 | 1224 | $this->status = $errno; |
@@ -1198,8 +1262,9 @@ discard block |
||
| 1198 | 1262 | settype($formfiles, "array"); |
| 1199 | 1263 | $postdata = ''; |
| 1200 | 1264 | |
| 1201 | - if (count($formvars) == 0 && count($formfiles) == 0) |
|
| 1202 | - return; |
|
| 1265 | + if (count($formvars) == 0 && count($formfiles) == 0) { |
|
| 1266 | + return; |
|
| 1267 | + } |
|
| 1203 | 1268 | |
| 1204 | 1269 | switch ($this->_submit_type) { |
| 1205 | 1270 | case "application/x-www-form-urlencoded": |
@@ -1209,8 +1274,9 @@ discard block |
||
| 1209 | 1274 | foreach ( $val as $cur_key => $cur_val ) { |
| 1210 | 1275 | $postdata .= urlencode($key)."[]=".urlencode($cur_val)."&"; |
| 1211 | 1276 | } |
| 1212 | - } else |
|
| 1213 | - $postdata .= urlencode($key)."=".urlencode($val)."&"; |
|
| 1277 | + } else { |
|
| 1278 | + $postdata .= urlencode($key)."=".urlencode($val)."&"; |
|
| 1279 | + } |
|
| 1214 | 1280 | } |
| 1215 | 1281 | break; |
| 1216 | 1282 | |
@@ -1236,7 +1302,9 @@ discard block |
||
| 1236 | 1302 | foreach ( $formfiles as $field_name => $file_names ) { |
| 1237 | 1303 | settype($file_names, "array"); |
| 1238 | 1304 | foreach ( $file_names as $file_name ) { |
| 1239 | - if (!is_readable($file_name)) continue; |
|
| 1305 | + if (!is_readable($file_name)) { |
|
| 1306 | + continue; |
|
| 1307 | + } |
|
| 1240 | 1308 | |
| 1241 | 1309 | $fp = fopen($file_name, "r"); |
| 1242 | 1310 | $file_content = fread($fp, filesize($file_name)); |