@@ -245,58 +245,58 @@ |
||
| 245 | 245 | */ |
| 246 | 246 | public static function get_archives_title() { |
| 247 | 247 | |
| 248 | - $archives_title = ''; |
|
| 248 | + $archives_title = ''; |
|
| 249 | 249 | |
| 250 | - if ( is_category() ) { |
|
| 250 | + if ( is_category() ) { |
|
| 251 | 251 | |
| 252 | - $archives_title = single_cat_title( '', false ); |
|
| 252 | + $archives_title = single_cat_title( '', false ); |
|
| 253 | 253 | |
| 254 | - } else if ( is_tag() ) { |
|
| 254 | + } else if ( is_tag() ) { |
|
| 255 | 255 | |
| 256 | - $archives_title = 'Tag: ' . single_tag_title( '', false ); |
|
| 256 | + $archives_title = 'Tag: ' . single_tag_title( '', false ); |
|
| 257 | 257 | |
| 258 | - } else if ( is_author() ) { |
|
| 258 | + } else if ( is_author() ) { |
|
| 259 | 259 | |
| 260 | - if ( have_posts() ) { |
|
| 260 | + if ( have_posts() ) { |
|
| 261 | 261 | |
| 262 | - the_post(); |
|
| 263 | - $archives_title = 'Author: ' . get_the_author(); |
|
| 262 | + the_post(); |
|
| 263 | + $archives_title = 'Author: ' . get_the_author(); |
|
| 264 | 264 | |
| 265 | - } |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - rewind_posts(); |
|
| 267 | + rewind_posts(); |
|
| 268 | 268 | |
| 269 | - } else if ( is_search() ) { |
|
| 269 | + } else if ( is_search() ) { |
|
| 270 | 270 | |
| 271 | - $archives_title = sprintf( __( 'Search Results for: %s', 'flotheme' ), '<span>' . get_search_query() . '</span>' ); |
|
| 271 | + $archives_title = sprintf( __( 'Search Results for: %s', 'flotheme' ), '<span>' . get_search_query() . '</span>' ); |
|
| 272 | 272 | |
| 273 | - } else if ( is_archive() ) { |
|
| 273 | + } else if ( is_archive() ) { |
|
| 274 | 274 | |
| 275 | - if ( is_day() ) { |
|
| 275 | + if ( is_day() ) { |
|
| 276 | 276 | |
| 277 | - $archives_title = get_the_date(); |
|
| 277 | + $archives_title = get_the_date(); |
|
| 278 | 278 | |
| 279 | - } elseif ( is_month() ) { |
|
| 279 | + } elseif ( is_month() ) { |
|
| 280 | 280 | |
| 281 | - $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', 'flotheme')); |
|
| 281 | + $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', 'flotheme')); |
|
| 282 | 282 | |
| 283 | - } elseif ( is_year() ) { |
|
| 283 | + } elseif ( is_year() ) { |
|
| 284 | 284 | |
| 285 | - $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', 'flotheme')); |
|
| 285 | + $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', 'flotheme')); |
|
| 286 | 286 | |
| 287 | - } else { |
|
| 287 | + } else { |
|
| 288 | 288 | |
| 289 | - $archives_title = 'Archives'; |
|
| 289 | + $archives_title = 'Archives'; |
|
| 290 | 290 | |
| 291 | - } |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | - } else { |
|
| 293 | + } else { |
|
| 294 | 294 | |
| 295 | - $archives_title = 'Archives'; |
|
| 295 | + $archives_title = 'Archives'; |
|
| 296 | 296 | |
| 297 | - } |
|
| 297 | + } |
|
| 298 | 298 | |
| 299 | - return $archives_title; |
|
| 299 | + return $archives_title; |
|
| 300 | 300 | |
| 301 | 301 | } |
| 302 | 302 | |
@@ -15,44 +15,44 @@ discard block |
||
| 15 | 15 | * @param string $allowed_tags |
| 16 | 16 | * @return string |
| 17 | 17 | */ |
| 18 | - public static function trim_words( $text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote' ) { |
|
| 19 | - if ( null === $more ) { |
|
| 20 | - $more = __( '…' ); |
|
| 18 | + public static function trim_words($text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote') { |
|
| 19 | + if (null === $more) { |
|
| 20 | + $more = __('…'); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | $original_text = $text; |
| 24 | 24 | $allowed_tag_string = ''; |
| 25 | 25 | |
| 26 | - foreach ( explode( ' ', $allowed_tags ) as $tag ) { |
|
| 27 | - $allowed_tag_string .= '<' . $tag . '>'; |
|
| 26 | + foreach (explode(' ', $allowed_tags) as $tag) { |
|
| 27 | + $allowed_tag_string .= '<'.$tag.'>'; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - $text = strip_tags( $text, $allowed_tag_string ); |
|
| 30 | + $text = strip_tags($text, $allowed_tag_string); |
|
| 31 | 31 | |
| 32 | 32 | /* translators: If your word count is based on single characters (East Asian characters), |
| 33 | 33 | enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */ |
| 34 | 34 | |
| 35 | - if ( 'characters' == _x( 'words', 'word count: words or characters?' ) && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) { |
|
| 36 | - $text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' ); |
|
| 37 | - preg_match_all( '/./u', $text, $words_array ); |
|
| 38 | - $words_array = array_slice( $words_array[0], 0, $num_words + 1 ); |
|
| 35 | + if ('characters' == _x('words', 'word count: words or characters?') && preg_match('/^utf\-?8$/i', get_option('blog_charset'))) { |
|
| 36 | + $text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' '); |
|
| 37 | + preg_match_all('/./u', $text, $words_array); |
|
| 38 | + $words_array = array_slice($words_array[0], 0, $num_words + 1); |
|
| 39 | 39 | $sep = ''; |
| 40 | 40 | } else { |
| 41 | - $words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY ); |
|
| 41 | + $words_array = preg_split("/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY); |
|
| 42 | 42 | $sep = ' '; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if ( count( $words_array ) > $num_words ) { |
|
| 46 | - array_pop( $words_array ); |
|
| 47 | - $text = implode( $sep, $words_array ); |
|
| 48 | - $text = $text . $more; |
|
| 45 | + if (count($words_array) > $num_words) { |
|
| 46 | + array_pop($words_array); |
|
| 47 | + $text = implode($sep, $words_array); |
|
| 48 | + $text = $text.$more; |
|
| 49 | 49 | } else { |
| 50 | - $text = implode( $sep, $words_array ); |
|
| 50 | + $text = implode($sep, $words_array); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $text = self::close_tags( $text ); |
|
| 53 | + $text = self::close_tags($text); |
|
| 54 | 54 | |
| 55 | - return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text ); |
|
| 55 | + return apply_filters('wp_trim_words', $text, $num_words, $more, $original_text); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -62,36 +62,36 @@ discard block |
||
| 62 | 62 | * @param string $html |
| 63 | 63 | * @return string |
| 64 | 64 | */ |
| 65 | - public static function close_tags( $html ) { |
|
| 65 | + public static function close_tags($html) { |
|
| 66 | 66 | //put all opened tags into an array |
| 67 | - preg_match_all( '#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result ); |
|
| 67 | + preg_match_all('#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result); |
|
| 68 | 68 | |
| 69 | 69 | $openedtags = $result[1]; |
| 70 | 70 | |
| 71 | 71 | //put all closed tags into an array |
| 72 | - preg_match_all( '#</([a-z]+)>#iU', $html, $result ); |
|
| 72 | + preg_match_all('#</([a-z]+)>#iU', $html, $result); |
|
| 73 | 73 | |
| 74 | 74 | $closedtags = $result[1]; |
| 75 | - $len_opened = count( $openedtags ); |
|
| 75 | + $len_opened = count($openedtags); |
|
| 76 | 76 | |
| 77 | 77 | // all tags are closed |
| 78 | - if ( count( $closedtags ) == $len_opened ) { |
|
| 78 | + if (count($closedtags) == $len_opened) { |
|
| 79 | 79 | return $html; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $openedtags = array_reverse( $openedtags ); |
|
| 82 | + $openedtags = array_reverse($openedtags); |
|
| 83 | 83 | |
| 84 | 84 | // close tags |
| 85 | - for ( $i = 0; $i < $len_opened; $i++ ) { |
|
| 86 | - if ( !in_array( $openedtags[$i], $closedtags ) ) { |
|
| 87 | - $html .= '</' . $openedtags[$i] . '>'; |
|
| 85 | + for ($i = 0; $i < $len_opened; $i++) { |
|
| 86 | + if (!in_array($openedtags[$i], $closedtags)) { |
|
| 87 | + $html .= '</'.$openedtags[$i].'>'; |
|
| 88 | 88 | } else { |
| 89 | - unset( $closedtags[array_search( $openedtags[$i], $closedtags )] ); |
|
| 89 | + unset($closedtags[array_search($openedtags[$i], $closedtags)]); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $html = str_replace(array('</br>','</hr>','</wbr>'), '', $html); |
|
| 94 | - $html = str_replace(array('<br>','<hr>','<wbr>'), array('<br />','<hr />','<wbr />'), $html); |
|
| 93 | + $html = str_replace(array('</br>', '</hr>', '</wbr>'), '', $html); |
|
| 94 | + $html = str_replace(array('<br>', '<hr>', '<wbr>'), array('<br />', '<hr />', '<wbr />'), $html); |
|
| 95 | 95 | |
| 96 | 96 | return $html; |
| 97 | 97 | } |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @param mixed $arg |
| 103 | 103 | */ |
| 104 | - public static function error_log( $arg ) { |
|
| 105 | - if ( !WP_DEBUG ) { |
|
| 104 | + public static function error_log($arg) { |
|
| 105 | + if (!WP_DEBUG) { |
|
| 106 | 106 | return; |
| 107 | 107 | } |
| 108 | - if ( is_object( $arg ) || is_array( $arg ) ) { |
|
| 109 | - $arg = print_r( $arg, true ); |
|
| 108 | + if (is_object($arg) || is_array($arg)) { |
|
| 109 | + $arg = print_r($arg, true); |
|
| 110 | 110 | } |
| 111 | - return error_log( $arg ); |
|
| 111 | + return error_log($arg); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param string $args |
| 118 | 118 | * @return array |
| 119 | 119 | */ |
| 120 | - public static function paginate_links( $args = '' ) { |
|
| 120 | + public static function paginate_links($args = '') { |
|
| 121 | 121 | $defaults = array( |
| 122 | 122 | 'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below) |
| 123 | 123 | 'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number |
@@ -125,43 +125,43 @@ discard block |
||
| 125 | 125 | 'current' => 0, |
| 126 | 126 | 'show_all' => false, |
| 127 | 127 | 'prev_next' => true, |
| 128 | - 'prev_text' => __( '« Previous' ), |
|
| 129 | - 'next_text' => __( 'Next »' ), |
|
| 128 | + 'prev_text' => __('« Previous'), |
|
| 129 | + 'next_text' => __('Next »'), |
|
| 130 | 130 | 'end_size' => 1, |
| 131 | 131 | 'mid_size' => 2, |
| 132 | 132 | 'type' => 'array', |
| 133 | 133 | 'add_args' => false, // array of query args to add |
| 134 | 134 | 'add_fragment' => '' |
| 135 | 135 | ); |
| 136 | - $args = wp_parse_args( $args, $defaults ); |
|
| 136 | + $args = wp_parse_args($args, $defaults); |
|
| 137 | 137 | // Who knows what else people pass in $args |
| 138 | - $args['total'] = intval( (int)$args['total'] ); |
|
| 139 | - if ( $args['total'] < 2 ) { |
|
| 138 | + $args['total'] = intval((int) $args['total']); |
|
| 139 | + if ($args['total'] < 2) { |
|
| 140 | 140 | return array(); |
| 141 | 141 | } |
| 142 | - $args['current'] = (int)$args['current']; |
|
| 143 | - $args['end_size'] = 0 < (int)$args['end_size'] ? (int)$args['end_size'] : 1; // Out of bounds? Make it the default. |
|
| 144 | - $args['mid_size'] = 0 <= (int)$args['mid_size'] ? (int)$args['mid_size'] : 2; |
|
| 145 | - $args['add_args'] = is_array( $args['add_args'] ) ? $args['add_args'] : false; |
|
| 142 | + $args['current'] = (int) $args['current']; |
|
| 143 | + $args['end_size'] = 0 < (int) $args['end_size'] ? (int) $args['end_size'] : 1; // Out of bounds? Make it the default. |
|
| 144 | + $args['mid_size'] = 0 <= (int) $args['mid_size'] ? (int) $args['mid_size'] : 2; |
|
| 145 | + $args['add_args'] = is_array($args['add_args']) ? $args['add_args'] : false; |
|
| 146 | 146 | $page_links = array(); |
| 147 | 147 | $dots = false; |
| 148 | - if ( $args['prev_next'] && $args['current'] && 1 < $args['current'] ) { |
|
| 149 | - $link = str_replace( '%_%', 2 == $args['current'] ? '' : $args['format'], $args['base'] ); |
|
| 150 | - $link = str_replace( '%#%', $args['current'] - 1, $link ); |
|
| 151 | - if ( $args['add_args'] ) { |
|
| 152 | - $link = add_query_arg( $args['add_args'], $link ); |
|
| 148 | + if ($args['prev_next'] && $args['current'] && 1 < $args['current']) { |
|
| 149 | + $link = str_replace('%_%', 2 == $args['current'] ? '' : $args['format'], $args['base']); |
|
| 150 | + $link = str_replace('%#%', $args['current'] - 1, $link); |
|
| 151 | + if ($args['add_args']) { |
|
| 152 | + $link = add_query_arg($args['add_args'], $link); |
|
| 153 | 153 | } |
| 154 | 154 | $link .= $args['add_fragment']; |
| 155 | - $link = untrailingslashit( $link ); |
|
| 155 | + $link = untrailingslashit($link); |
|
| 156 | 156 | $page_links[] = array( |
| 157 | 157 | 'class' => 'prev page-numbers', |
| 158 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ), |
|
| 158 | + 'link' => esc_url(apply_filters('paginate_links', $link)), |
|
| 159 | 159 | 'title' => $args['prev_text'] |
| 160 | 160 | ); |
| 161 | 161 | } |
| 162 | - for ( $n = 1; $n <= $args['total']; $n++ ) { |
|
| 163 | - $n_display = number_format_i18n( $n ); |
|
| 164 | - if ( $n == $args['current'] ) { |
|
| 162 | + for ($n = 1; $n <= $args['total']; $n++) { |
|
| 163 | + $n_display = number_format_i18n($n); |
|
| 164 | + if ($n == $args['current']) { |
|
| 165 | 165 | $page_links[] = array( |
| 166 | 166 | 'class' => 'page-number page-numbers current', |
| 167 | 167 | 'title' => $n_display, |
@@ -171,42 +171,42 @@ discard block |
||
| 171 | 171 | ); |
| 172 | 172 | $dots = true; |
| 173 | 173 | } else { |
| 174 | - if ( $args['show_all'] || ( $n <= $args['end_size'] || ( $args['current'] && $n >= $args['current'] - $args['mid_size'] && $n <= $args['current'] + $args['mid_size'] ) || $n > $args['total'] - $args['end_size'] ) ) { |
|
| 175 | - $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); |
|
| 176 | - $link = str_replace( '%#%', $n, $link ); |
|
| 177 | - $link = trailingslashit( $link ) . ltrim( $args['add_fragment'], '/' ); |
|
| 178 | - if ( $args['add_args'] ) { |
|
| 179 | - $link = rtrim( add_query_arg( $args['add_args'], $link ), '/' ); |
|
| 174 | + if ($args['show_all'] || ($n <= $args['end_size'] || ($args['current'] && $n >= $args['current'] - $args['mid_size'] && $n <= $args['current'] + $args['mid_size']) || $n > $args['total'] - $args['end_size'])) { |
|
| 175 | + $link = str_replace('%_%', 1 == $n ? '' : $args['format'], $args['base']); |
|
| 176 | + $link = str_replace('%#%', $n, $link); |
|
| 177 | + $link = trailingslashit($link).ltrim($args['add_fragment'], '/'); |
|
| 178 | + if ($args['add_args']) { |
|
| 179 | + $link = rtrim(add_query_arg($args['add_args'], $link), '/'); |
|
| 180 | 180 | } |
| 181 | 181 | $link = str_replace(' ', '+', $link); |
| 182 | - $link = untrailingslashit( $link ); |
|
| 182 | + $link = untrailingslashit($link); |
|
| 183 | 183 | $page_links[] = array( |
| 184 | 184 | 'class' => 'page-number page-numbers', |
| 185 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ), |
|
| 185 | + 'link' => esc_url(apply_filters('paginate_links', $link)), |
|
| 186 | 186 | 'title' => $n_display, |
| 187 | 187 | 'name' => $n_display, |
| 188 | 188 | 'current' => $args['current'] == $n |
| 189 | 189 | ); |
| 190 | 190 | $dots = true; |
| 191 | - } elseif ( $dots && !$args['show_all'] ) { |
|
| 191 | + } elseif ($dots && !$args['show_all']) { |
|
| 192 | 192 | $page_links[] = array( |
| 193 | 193 | 'class' => 'dots', |
| 194 | - 'title' => __( '…' ) |
|
| 194 | + 'title' => __('…') |
|
| 195 | 195 | ); |
| 196 | 196 | $dots = false; |
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | - if ( $args['prev_next'] && $args['current'] && ( $args['current'] < $args['total'] || -1 == $args['total'] ) ) { |
|
| 201 | - $link = str_replace( '%_%', $args['format'], $args['base'] ); |
|
| 202 | - $link = str_replace( '%#%', $args['current'] + 1, $link ); |
|
| 203 | - if ( $args['add_args'] ) { |
|
| 204 | - $link = add_query_arg( $args['add_args'], $link ); |
|
| 200 | + if ($args['prev_next'] && $args['current'] && ($args['current'] < $args['total'] || -1 == $args['total'])) { |
|
| 201 | + $link = str_replace('%_%', $args['format'], $args['base']); |
|
| 202 | + $link = str_replace('%#%', $args['current'] + 1, $link); |
|
| 203 | + if ($args['add_args']) { |
|
| 204 | + $link = add_query_arg($args['add_args'], $link); |
|
| 205 | 205 | } |
| 206 | - $link = untrailingslashit( trailingslashit( $link ) . $args['add_fragment'] ); |
|
| 206 | + $link = untrailingslashit(trailingslashit($link).$args['add_fragment']); |
|
| 207 | 207 | $page_links[] = array( |
| 208 | 208 | 'class' => 'next page-numbers', |
| 209 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ), |
|
| 209 | + 'link' => esc_url(apply_filters('paginate_links', $link)), |
|
| 210 | 210 | 'title' => $args['next_text'] |
| 211 | 211 | ); |
| 212 | 212 | } |
@@ -247,42 +247,42 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | $archives_title = ''; |
| 249 | 249 | |
| 250 | - if ( is_category() ) { |
|
| 250 | + if (is_category()) { |
|
| 251 | 251 | |
| 252 | - $archives_title = single_cat_title( '', false ); |
|
| 252 | + $archives_title = single_cat_title('', false); |
|
| 253 | 253 | |
| 254 | - } else if ( is_tag() ) { |
|
| 254 | + } else if (is_tag()) { |
|
| 255 | 255 | |
| 256 | - $archives_title = 'Tag: ' . single_tag_title( '', false ); |
|
| 256 | + $archives_title = 'Tag: '.single_tag_title('', false); |
|
| 257 | 257 | |
| 258 | - } else if ( is_author() ) { |
|
| 258 | + } else if (is_author()) { |
|
| 259 | 259 | |
| 260 | - if ( have_posts() ) { |
|
| 260 | + if (have_posts()) { |
|
| 261 | 261 | |
| 262 | 262 | the_post(); |
| 263 | - $archives_title = 'Author: ' . get_the_author(); |
|
| 263 | + $archives_title = 'Author: '.get_the_author(); |
|
| 264 | 264 | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | rewind_posts(); |
| 268 | 268 | |
| 269 | - } else if ( is_search() ) { |
|
| 269 | + } else if (is_search()) { |
|
| 270 | 270 | |
| 271 | - $archives_title = sprintf( __( 'Search Results for: %s', 'flotheme' ), '<span>' . get_search_query() . '</span>' ); |
|
| 271 | + $archives_title = sprintf(__('Search Results for: %s', 'flotheme'), '<span>'.get_search_query().'</span>'); |
|
| 272 | 272 | |
| 273 | - } else if ( is_archive() ) { |
|
| 273 | + } else if (is_archive()) { |
|
| 274 | 274 | |
| 275 | - if ( is_day() ) { |
|
| 275 | + if (is_day()) { |
|
| 276 | 276 | |
| 277 | 277 | $archives_title = get_the_date(); |
| 278 | 278 | |
| 279 | - } elseif ( is_month() ) { |
|
| 279 | + } elseif (is_month()) { |
|
| 280 | 280 | |
| 281 | - $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', 'flotheme')); |
|
| 281 | + $archives_title = get_the_date(_x('F Y', 'monthly archives date format', 'flotheme')); |
|
| 282 | 282 | |
| 283 | - } elseif ( is_year() ) { |
|
| 283 | + } elseif (is_year()) { |
|
| 284 | 284 | |
| 285 | - $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', 'flotheme')); |
|
| 285 | + $archives_title = get_the_date(_x('Y', 'yearly archives date format', 'flotheme')); |
|
| 286 | 286 | |
| 287 | 287 | } else { |
| 288 | 288 | |
@@ -37,7 +37,8 @@ discard block |
||
| 37 | 37 | preg_match_all( '/./u', $text, $words_array ); |
| 38 | 38 | $words_array = array_slice( $words_array[0], 0, $num_words + 1 ); |
| 39 | 39 | $sep = ''; |
| 40 | - } else { |
|
| 40 | + } |
|
| 41 | + else { |
|
| 41 | 42 | $words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY ); |
| 42 | 43 | $sep = ' '; |
| 43 | 44 | } |
@@ -46,7 +47,8 @@ discard block |
||
| 46 | 47 | array_pop( $words_array ); |
| 47 | 48 | $text = implode( $sep, $words_array ); |
| 48 | 49 | $text = $text . $more; |
| 49 | - } else { |
|
| 50 | + } |
|
| 51 | + else { |
|
| 50 | 52 | $text = implode( $sep, $words_array ); |
| 51 | 53 | } |
| 52 | 54 | |
@@ -85,7 +87,8 @@ discard block |
||
| 85 | 87 | for ( $i = 0; $i < $len_opened; $i++ ) { |
| 86 | 88 | if ( !in_array( $openedtags[$i], $closedtags ) ) { |
| 87 | 89 | $html .= '</' . $openedtags[$i] . '>'; |
| 88 | - } else { |
|
| 90 | + } |
|
| 91 | + else { |
|
| 89 | 92 | unset( $closedtags[array_search( $openedtags[$i], $closedtags )] ); |
| 90 | 93 | } |
| 91 | 94 | } |
@@ -170,7 +173,8 @@ discard block |
||
| 170 | 173 | 'current' => true |
| 171 | 174 | ); |
| 172 | 175 | $dots = true; |
| 173 | - } else { |
|
| 176 | + } |
|
| 177 | + else { |
|
| 174 | 178 | if ( $args['show_all'] || ( $n <= $args['end_size'] || ( $args['current'] && $n >= $args['current'] - $args['mid_size'] && $n <= $args['current'] + $args['mid_size'] ) || $n > $args['total'] - $args['end_size'] ) ) { |
| 175 | 179 | $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); |
| 176 | 180 | $link = str_replace( '%#%', $n, $link ); |
@@ -188,7 +192,8 @@ discard block |
||
| 188 | 192 | 'current' => $args['current'] == $n |
| 189 | 193 | ); |
| 190 | 194 | $dots = true; |
| 191 | - } elseif ( $dots && !$args['show_all'] ) { |
|
| 195 | + } |
|
| 196 | + elseif ( $dots && !$args['show_all'] ) { |
|
| 192 | 197 | $page_links[] = array( |
| 193 | 198 | 'class' => 'dots', |
| 194 | 199 | 'title' => __( '…' ) |
@@ -227,7 +232,8 @@ discard block |
||
| 227 | 232 | if (strlen($k)) { |
| 228 | 233 | if (is_array($v)) { |
| 229 | 234 | $obj->{$k} = self::array_to_object($v); //RECURSION |
| 230 | - } else { |
|
| 235 | + } |
|
| 236 | + else { |
|
| 231 | 237 | $obj->{$k} = $v; |
| 232 | 238 | } |
| 233 | 239 | } |
@@ -251,11 +257,13 @@ discard block |
||
| 251 | 257 | |
| 252 | 258 | $archives_title = single_cat_title( '', false ); |
| 253 | 259 | |
| 254 | - } else if ( is_tag() ) { |
|
| 260 | + } |
|
| 261 | + else if ( is_tag() ) { |
|
| 255 | 262 | |
| 256 | 263 | $archives_title = 'Tag: ' . single_tag_title( '', false ); |
| 257 | 264 | |
| 258 | - } else if ( is_author() ) { |
|
| 265 | + } |
|
| 266 | + else if ( is_author() ) { |
|
| 259 | 267 | |
| 260 | 268 | if ( have_posts() ) { |
| 261 | 269 | |
@@ -266,31 +274,37 @@ discard block |
||
| 266 | 274 | |
| 267 | 275 | rewind_posts(); |
| 268 | 276 | |
| 269 | - } else if ( is_search() ) { |
|
| 277 | + } |
|
| 278 | + else if ( is_search() ) { |
|
| 270 | 279 | |
| 271 | 280 | $archives_title = sprintf( __( 'Search Results for: %s', 'flotheme' ), '<span>' . get_search_query() . '</span>' ); |
| 272 | 281 | |
| 273 | - } else if ( is_archive() ) { |
|
| 282 | + } |
|
| 283 | + else if ( is_archive() ) { |
|
| 274 | 284 | |
| 275 | 285 | if ( is_day() ) { |
| 276 | 286 | |
| 277 | 287 | $archives_title = get_the_date(); |
| 278 | 288 | |
| 279 | - } elseif ( is_month() ) { |
|
| 289 | + } |
|
| 290 | + elseif ( is_month() ) { |
|
| 280 | 291 | |
| 281 | 292 | $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', 'flotheme')); |
| 282 | 293 | |
| 283 | - } elseif ( is_year() ) { |
|
| 294 | + } |
|
| 295 | + elseif ( is_year() ) { |
|
| 284 | 296 | |
| 285 | 297 | $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', 'flotheme')); |
| 286 | 298 | |
| 287 | - } else { |
|
| 299 | + } |
|
| 300 | + else { |
|
| 288 | 301 | |
| 289 | 302 | $archives_title = 'Archives'; |
| 290 | 303 | |
| 291 | 304 | } |
| 292 | 305 | |
| 293 | - } else { |
|
| 306 | + } |
|
| 307 | + else { |
|
| 294 | 308 | |
| 295 | 309 | $archives_title = 'Archives'; |
| 296 | 310 | |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | /** |
| 63 | 63 | * Returns ClassyUser object of comment author |
| 64 | 64 | * |
| 65 | - * @return object ClassyUser |
|
| 65 | + * @return ClassyUser ClassyUser |
|
| 66 | 66 | */ |
| 67 | 67 | public function author() { |
| 68 | 68 | |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | * @param string $date_format |
| 111 | 111 | * @return string |
| 112 | 112 | */ |
| 113 | - public function date( $date_format = '' ) { |
|
| 113 | + public function date($date_format = '') { |
|
| 114 | 114 | $df = $date_format ? $date_format : get_option('date_format'); |
| 115 | - $the_date = (string)mysql2date($df, $this->comment_date); |
|
| 115 | + $the_date = (string) mysql2date($df, $this->comment_date); |
|
| 116 | 116 | |
| 117 | 117 | return apply_filters('get_comment_date ', $the_date, $df); |
| 118 | 118 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | protected function get_avatar_email() { |
| 171 | 171 | |
| 172 | - $id = (int)$this->user_id; |
|
| 172 | + $id = (int) $this->user_id; |
|
| 173 | 173 | $user = get_userdata($id); |
| 174 | 174 | |
| 175 | 175 | if ($user) { |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | protected function get_default_avatar($default, $email, $size, $host) { |
| 195 | 195 | |
| 196 | 196 | if (substr($default, 0, 1) == '/') { |
| 197 | - $default = home_url() . $default; |
|
| 197 | + $default = home_url().$default; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | if (empty($default)) { |
@@ -207,16 +207,16 @@ discard block |
||
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | if ('mystery' == $default) { |
| 210 | - $default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size; |
|
| 210 | + $default = $host.'/avatar/ad516503a11cd5ca435acc9bb6523536?s='.$size; |
|
| 211 | 211 | // ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]') |
| 212 | 212 | } else if ('blank' == $default) { |
| 213 | 213 | $default = $email ? 'blank' : includes_url('images/blank.gif'); |
| 214 | 214 | } else if (!empty($email) && 'gravatar_default' == $default) { |
| 215 | 215 | $default = ''; |
| 216 | 216 | } else if ('gravatar_default' == $default) { |
| 217 | - $default = $host . '/avatar/?s=' . $size; |
|
| 217 | + $default = $host.'/avatar/?s='.$size; |
|
| 218 | 218 | } else if (empty($email) && !strstr($default, 'http://')) { |
| 219 | - $default = $host . '/avatar/?d=' . $default . '&s=' . $size; |
|
| 219 | + $default = $host.'/avatar/?d='.$default.'&s='.$size; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | return $default; |
@@ -256,11 +256,11 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | protected function get_avatar_url($default, $host, $email_hash, $size) { |
| 258 | 258 | |
| 259 | - $_return = $host . '/avatar/' . $email_hash . '?s=' . $size . '&d=' . urlencode($default); |
|
| 259 | + $_return = $host.'/avatar/'.$email_hash.'?s='.$size.'&d='.urlencode($default); |
|
| 260 | 260 | $rating = get_option('avatar_rating'); |
| 261 | 261 | |
| 262 | 262 | if (!empty($rating)) { |
| 263 | - $_return .= '&r=' . $rating; |
|
| 263 | + $_return .= '&r='.$rating; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | return str_replace('&', '&', esc_url($_return)); |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | |
| 294 | 294 | if (is_array($this->children)) { |
| 295 | 295 | |
| 296 | - foreach( $this->children as $child ) { |
|
| 296 | + foreach ($this->children as $child) { |
|
| 297 | 297 | $child->level = $this->level + 1; |
| 298 | 298 | $child->update_child_levels(); |
| 299 | 299 | } |
@@ -70,7 +70,8 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | return new ClassyUser($this->user_id); |
| 72 | 72 | |
| 73 | - } else { |
|
| 73 | + } |
|
| 74 | + else { |
|
| 74 | 75 | |
| 75 | 76 | $author = new ClassyUser(0); |
| 76 | 77 | |
@@ -139,7 +140,9 @@ discard block |
||
| 139 | 140 | return false; |
| 140 | 141 | } |
| 141 | 142 | |
| 142 | - if (!is_numeric($size)) $size = '92'; |
|
| 143 | + if (!is_numeric($size)) { |
|
| 144 | + $size = '92'; |
|
| 145 | + } |
|
| 143 | 146 | |
| 144 | 147 | |
| 145 | 148 | $email = $this->get_avatar_email(); |
@@ -154,7 +157,8 @@ discard block |
||
| 154 | 157 | |
| 155 | 158 | if (!empty($email)) { |
| 156 | 159 | $avatar = $this->get_avatar_url($default, $host, $email_hash, $size); |
| 157 | - } else { |
|
| 160 | + } |
|
| 161 | + else { |
|
| 158 | 162 | $avatar = $default; |
| 159 | 163 | } |
| 160 | 164 | |
@@ -174,7 +178,8 @@ discard block |
||
| 174 | 178 | |
| 175 | 179 | if ($user) { |
| 176 | 180 | $email = $user->user_email; |
| 177 | - } else { |
|
| 181 | + } |
|
| 182 | + else { |
|
| 178 | 183 | $email = $this->comment_author_email; |
| 179 | 184 | } |
| 180 | 185 | |
@@ -201,7 +206,8 @@ discard block |
||
| 201 | 206 | $avatar_default = get_option('avatar_default'); |
| 202 | 207 | if (empty($avatar_default)) { |
| 203 | 208 | $default = 'mystery'; |
| 204 | - } else { |
|
| 209 | + } |
|
| 210 | + else { |
|
| 205 | 211 | $default = $avatar_default; |
| 206 | 212 | } |
| 207 | 213 | } |
@@ -209,13 +215,17 @@ discard block |
||
| 209 | 215 | if ('mystery' == $default) { |
| 210 | 216 | $default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size; |
| 211 | 217 | // ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]') |
| 212 | - } else if ('blank' == $default) { |
|
| 218 | + } |
|
| 219 | + else if ('blank' == $default) { |
|
| 213 | 220 | $default = $email ? 'blank' : includes_url('images/blank.gif'); |
| 214 | - } else if (!empty($email) && 'gravatar_default' == $default) { |
|
| 221 | + } |
|
| 222 | + else if (!empty($email) && 'gravatar_default' == $default) { |
|
| 215 | 223 | $default = ''; |
| 216 | - } else if ('gravatar_default' == $default) { |
|
| 224 | + } |
|
| 225 | + else if ('gravatar_default' == $default) { |
|
| 217 | 226 | $default = $host . '/avatar/?s=' . $size; |
| 218 | - } else if (empty($email) && !strstr($default, 'http://')) { |
|
| 227 | + } |
|
| 228 | + else if (empty($email) && !strstr($default, 'http://')) { |
|
| 219 | 229 | $default = $host . '/avatar/?d=' . $default . '&s=' . $size; |
| 220 | 230 | } |
| 221 | 231 | |
@@ -233,10 +243,12 @@ discard block |
||
| 233 | 243 | |
| 234 | 244 | if (is_ssl()) { |
| 235 | 245 | $host = 'https://secure.gravatar.com'; |
| 236 | - } else { |
|
| 246 | + } |
|
| 247 | + else { |
|
| 237 | 248 | if (!empty($email_hash)) { |
| 238 | 249 | $host = sprintf("http://%d.gravatar.com", (hexdec($email_hash[0]) % 2)); |
| 239 | - } else { |
|
| 250 | + } |
|
| 251 | + else { |
|
| 240 | 252 | $host = 'http://0.gravatar.com'; |
| 241 | 253 | } |
| 242 | 254 | } |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function add_child($item) { |
| 126 | 126 | |
| 127 | - if ( !$this->has_child ) { |
|
| 128 | - $this->add_class( 'menu-item-has-children' ); |
|
| 127 | + if (!$this->has_child) { |
|
| 128 | + $this->add_class('menu-item-has-children'); |
|
| 129 | 129 | $this->has_child = true; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | protected function filter_classes() { |
| 147 | 147 | |
| 148 | - $this->classes = apply_filters( 'nav_menu_css_class', $this->classes, $this ); |
|
| 148 | + $this->classes = apply_filters('nav_menu_css_class', $this->classes, $this); |
|
| 149 | 149 | |
| 150 | 150 | } |
| 151 | 151 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | if (is_array($this->children)) { |
| 160 | 160 | |
| 161 | - foreach( $this->children as $child ) { |
|
| 161 | + foreach ($this->children as $child) { |
|
| 162 | 162 | $child->level = $this->level + 1; |
| 163 | 163 | $child->update_child_levels(); |
| 164 | 164 | } |