@@ -2,5 +2,5 @@ |
||
2 | 2 | /** |
3 | 3 | * Init our WordPress Theme. |
4 | 4 | */ |
5 | -require_once( __DIR__ . '/vendor/autoload.php' ); |
|
5 | +require_once(__DIR__.'/vendor/autoload.php'); |
|
6 | 6 | \Classy\Classy::get_instance(); |
@@ -2,6 +2,6 @@ |
||
2 | 2 | |
3 | 3 | global $post; |
4 | 4 | |
5 | -$classypost = new \Classy\Models\Post( $post ); |
|
5 | +$classypost = new \Classy\Models\Post($post); |
|
6 | 6 | |
7 | -Classy\Classy::render( 'layout.comments', array( 'post' => $classypost ) ); |
|
7 | +Classy\Classy::render('layout.comments', array('post' => $classypost)); |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param int $uid User id. |
68 | 68 | */ |
69 | - public function __construct( $uid = null ) { |
|
70 | - $this->ID = $this->verify_id( $uid ); |
|
69 | + public function __construct($uid = null) { |
|
70 | + $this->ID = $this->verify_id($uid); |
|
71 | 71 | |
72 | 72 | $this->init(); |
73 | 73 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return int |
81 | 81 | */ |
82 | - private function verify_id( $uid ) { |
|
82 | + private function verify_id($uid) { |
|
83 | 83 | // @todo: Realize this method. |
84 | 84 | return $uid; |
85 | 85 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | private function init() { |
91 | 91 | $this->object = $this->get_object(); |
92 | 92 | |
93 | - $this->import( $this->object ); |
|
93 | + $this->import($this->object); |
|
94 | 94 | |
95 | 95 | $this->setup_user_name(); |
96 | 96 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return object |
102 | 102 | */ |
103 | 103 | private function get_object() { |
104 | - return get_user_by( 'id', $this->ID ); |
|
104 | + return get_user_by('id', $this->ID); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | * @return string |
156 | 156 | */ |
157 | 157 | public function link() { |
158 | - if ( ! $this->link ) { |
|
159 | - $this->link = get_author_posts_url( $this->ID ); |
|
158 | + if (!$this->link) { |
|
159 | + $this->link = get_author_posts_url($this->ID); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | return $this->link; |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | */ |
168 | 168 | private function setup_user_name() { |
169 | 169 | $this->name = 'Anonymous'; |
170 | - if ( isset( $this->object->first_name ) && isset( $this->object->last_name ) ) { |
|
171 | - $this->name = $this->object->first_name . ' ' . $this->object->last_name; |
|
170 | + if (isset($this->object->first_name) && isset($this->object->last_name)) { |
|
171 | + $this->name = $this->object->first_name.' '.$this->object->last_name; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | $this->display_name = $this->object->display_name; |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | |
30 | 30 | $request = Hierarchy::get_current_request(); |
31 | 31 | |
32 | - $file = Hierarchy::get_available_file( 'view', $request ); |
|
32 | + $file = Hierarchy::get_available_file('view', $request); |
|
33 | 33 | |
34 | - $view = self::get_blade_view( $file ); |
|
34 | + $view = self::get_blade_view($file); |
|
35 | 35 | |
36 | 36 | return $view; |
37 | 37 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return string |
46 | 46 | */ |
47 | - public static function get_blade_view( $view ) { |
|
47 | + public static function get_blade_view($view) { |
|
48 | 48 | |
49 | - return str_replace( '/', '.', $view ); |
|
49 | + return str_replace('/', '.', $view); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -59,21 +59,21 @@ discard block |
||
59 | 59 | |
60 | 60 | $templates = array(); |
61 | 61 | |
62 | - $files = (array) glob( CLASSY_THEME_PATH . '/' . self::$folder . '/*/*.blade.php' ); |
|
62 | + $files = (array) glob(CLASSY_THEME_PATH.'/'.self::$folder.'/*/*.blade.php'); |
|
63 | 63 | |
64 | - foreach ( $files as $filename ) { |
|
64 | + foreach ($files as $filename) { |
|
65 | 65 | |
66 | - if ( ! empty( $filename ) ) { |
|
66 | + if (!empty($filename)) { |
|
67 | 67 | |
68 | - if ( ! preg_match( '/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents( $filename ), $header ) ) { continue; } |
|
68 | + if (!preg_match('/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents($filename), $header)) { continue; } |
|
69 | 69 | |
70 | - $template_name = trim( $header[1] ); |
|
70 | + $template_name = trim($header[1]); |
|
71 | 71 | |
72 | - preg_match( '/\/([^\/]*)\.blade.php$/is', $filename, $filename_match ); |
|
72 | + preg_match('/\/([^\/]*)\.blade.php$/is', $filename, $filename_match); |
|
73 | 73 | |
74 | - $template_file = 'classy-' . $filename_match[1]; |
|
74 | + $template_file = 'classy-'.$filename_match[1]; |
|
75 | 75 | |
76 | - $templates[ $template_file ] = $template_name; |
|
76 | + $templates[$template_file] = $template_name; |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | } |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function __construct() { |
14 | 14 | |
15 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); |
|
15 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles')); |
|
16 | 16 | |
17 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
17 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
18 | 18 | |
19 | - add_action( 'wp_print_scripts', array( $this, 'init_js_vars' ) ); |
|
19 | + add_action('wp_print_scripts', array($this, 'init_js_vars')); |
|
20 | 20 | |
21 | - add_action( 'after_setup_theme', array( $this, 'setup_theme' ) ); |
|
21 | + add_action('after_setup_theme', array($this, 'setup_theme')); |
|
22 | 22 | |
23 | 23 | } |
24 | 24 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function enqueue_styles() { |
29 | 29 | |
30 | - wp_register_style( 'general_css', CLASSY_THEME_DIR . 'assets/css/general.css', array(), CLASSY_THEME_VERSION, 'all' ); |
|
30 | + wp_register_style('general_css', CLASSY_THEME_DIR.'assets/css/general.css', array(), CLASSY_THEME_VERSION, 'all'); |
|
31 | 31 | |
32 | 32 | } |
33 | 33 | |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function enqueue_scripts() { |
38 | 38 | |
39 | - if ( 'production' === Classy::get_config_var( 'environment' ) ) { |
|
39 | + if ('production' === Classy::get_config_var('environment')) { |
|
40 | 40 | |
41 | - wp_register_script( 'theme_scripts', CLASSY_THEME_DIR . 'assets/js/min/production.js', array( 'jquery' ), CLASSY_THEME_VERSION, true ); |
|
41 | + wp_register_script('theme_scripts', CLASSY_THEME_DIR.'assets/js/min/production.js', array('jquery'), CLASSY_THEME_VERSION, true); |
|
42 | 42 | |
43 | 43 | } else { |
44 | 44 | |
45 | - wp_register_script( 'theme_scripts', CLASSY_THEME_DIR . 'assets/js/scripts.js', array( 'jquery' ), CLASSY_THEME_VERSION, true ); |
|
45 | + wp_register_script('theme_scripts', CLASSY_THEME_DIR.'assets/js/scripts.js', array('jquery'), CLASSY_THEME_VERSION, true); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | public function init_js_vars() { |
55 | 55 | |
56 | 56 | $options = array( |
57 | - 'base_url' => home_url( '' ), |
|
58 | - 'blog_url' => home_url( 'archives/' ), |
|
57 | + 'base_url' => home_url(''), |
|
58 | + 'blog_url' => home_url('archives/'), |
|
59 | 59 | 'template_dir' => CLASSY_THEME_DIR, |
60 | - 'ajax_load_url' => admin_url( 'admin-ajax.php' ), |
|
60 | + 'ajax_load_url' => admin_url('admin-ajax.php'), |
|
61 | 61 | 'is_mobile' => (int) wp_is_mobile(), |
62 | 62 | ); |
63 | 63 | |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails |
86 | 86 | */ |
87 | 87 | |
88 | - add_theme_support( 'post-thumbnails' ); |
|
88 | + add_theme_support('post-thumbnails'); |
|
89 | 89 | |
90 | 90 | // This theme uses wp_nav_menu() in one location. |
91 | 91 | register_nav_menus(array( |
92 | - 'header-menu' => __( 'Header Menu', Classy::textdomain() ), |
|
93 | - 'footer-menu' => __( 'Footer Menu', Classy::textdomain() ), |
|
92 | + 'header-menu' => __('Header Menu', Classy::textdomain()), |
|
93 | + 'footer-menu' => __('Footer Menu', Classy::textdomain()), |
|
94 | 94 | )); |
95 | 95 | |
96 | 96 | /* |
@@ -22,41 +22,41 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return string Trimmed text. |
24 | 24 | */ |
25 | - public static function trim_words( $text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote' ) { |
|
26 | - if ( null === $more ) { |
|
27 | - $more = __( '…' ); |
|
25 | + public static function trim_words($text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote') { |
|
26 | + if (null === $more) { |
|
27 | + $more = __('…'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $original_text = $text; |
31 | 31 | $allowed_tag_string = ''; |
32 | 32 | |
33 | - foreach ( explode( ' ', $allowed_tags ) as $tag ) { |
|
34 | - $allowed_tag_string .= '<' . $tag . '>'; |
|
33 | + foreach (explode(' ', $allowed_tags) as $tag) { |
|
34 | + $allowed_tag_string .= '<'.$tag.'>'; |
|
35 | 35 | } |
36 | 36 | |
37 | - $text = strip_tags( $text, $allowed_tag_string ); |
|
37 | + $text = strip_tags($text, $allowed_tag_string); |
|
38 | 38 | |
39 | - if ( 'characters' === _x( 'words', 'word count: words or characters?' ) && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) { |
|
40 | - $text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' ); |
|
41 | - preg_match_all( '/./u', $text, $words_array ); |
|
42 | - $words_array = array_slice( $words_array[0], 0, $num_words + 1 ); |
|
39 | + if ('characters' === _x('words', 'word count: words or characters?') && preg_match('/^utf\-?8$/i', get_option('blog_charset'))) { |
|
40 | + $text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' '); |
|
41 | + preg_match_all('/./u', $text, $words_array); |
|
42 | + $words_array = array_slice($words_array[0], 0, $num_words + 1); |
|
43 | 43 | $sep = ''; |
44 | 44 | } else { |
45 | - $words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY ); |
|
45 | + $words_array = preg_split("/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY); |
|
46 | 46 | $sep = ' '; |
47 | 47 | } |
48 | 48 | |
49 | - if ( count( $words_array ) > $num_words ) { |
|
50 | - array_pop( $words_array ); |
|
51 | - $text = implode( $sep, $words_array ); |
|
52 | - $text = $text . $more; |
|
49 | + if (count($words_array) > $num_words) { |
|
50 | + array_pop($words_array); |
|
51 | + $text = implode($sep, $words_array); |
|
52 | + $text = $text.$more; |
|
53 | 53 | } else { |
54 | - $text = implode( $sep, $words_array ); |
|
54 | + $text = implode($sep, $words_array); |
|
55 | 55 | } |
56 | 56 | |
57 | - $text = self::close_tags( $text ); |
|
57 | + $text = self::close_tags($text); |
|
58 | 58 | |
59 | - return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text ); |
|
59 | + return apply_filters('wp_trim_words', $text, $num_words, $more, $original_text); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -66,36 +66,36 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return string |
68 | 68 | */ |
69 | - public static function close_tags( $html ) { |
|
69 | + public static function close_tags($html) { |
|
70 | 70 | // Put all opened tags into an array. |
71 | - preg_match_all( '#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result ); |
|
71 | + preg_match_all('#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result); |
|
72 | 72 | |
73 | 73 | $openedtags = $result[1]; |
74 | 74 | |
75 | 75 | // Put all closed tags into an array. |
76 | - preg_match_all( '#</([a-z]+)>#iU', $html, $result ); |
|
76 | + preg_match_all('#</([a-z]+)>#iU', $html, $result); |
|
77 | 77 | |
78 | 78 | $closedtags = $result[1]; |
79 | - $len_opened = count( $openedtags ); |
|
79 | + $len_opened = count($openedtags); |
|
80 | 80 | |
81 | 81 | // All tags are closed. |
82 | - if ( count( $closedtags ) === $len_opened ) { |
|
82 | + if (count($closedtags) === $len_opened) { |
|
83 | 83 | return $html; |
84 | 84 | } |
85 | 85 | |
86 | - $openedtags = array_reverse( $openedtags ); |
|
86 | + $openedtags = array_reverse($openedtags); |
|
87 | 87 | |
88 | 88 | // Close tags. |
89 | - for ( $i = 0; $i < $len_opened; $i++ ) { |
|
90 | - if ( ! in_array( $openedtags[ $i ], $closedtags, true ) ) { |
|
91 | - $html .= '</' . $openedtags[ $i ] . '>'; |
|
89 | + for ($i = 0; $i < $len_opened; $i++) { |
|
90 | + if (!in_array($openedtags[$i], $closedtags, true)) { |
|
91 | + $html .= '</'.$openedtags[$i].'>'; |
|
92 | 92 | } else { |
93 | - unset( $closedtags[ array_search( $openedtags[ $i ], $closedtags ) ] ); |
|
93 | + unset($closedtags[array_search($openedtags[$i], $closedtags)]); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | - $html = str_replace( array( '</br>', '</hr>', '</wbr>' ), '', $html ); |
|
98 | - $html = str_replace( array( '<br>', '<hr>', '<wbr>' ), array( '<br />', '<hr />', '<wbr />' ), $html ); |
|
97 | + $html = str_replace(array('</br>', '</hr>', '</wbr>'), '', $html); |
|
98 | + $html = str_replace(array('<br>', '<hr>', '<wbr>'), array('<br />', '<hr />', '<wbr />'), $html); |
|
99 | 99 | |
100 | 100 | return $html; |
101 | 101 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return array |
109 | 109 | */ |
110 | - public static function paginate_links( $args = '' ) { |
|
110 | + public static function paginate_links($args = '') { |
|
111 | 111 | $defaults = array( |
112 | 112 | 'base' => '%_%', // Example http://example.com/all_posts.php%_% : %_% is replaced by format (below). |
113 | 113 | 'format' => '?page=%#%', // Example ?page=%#% : %#% is replaced by the page number. |
@@ -115,44 +115,44 @@ discard block |
||
115 | 115 | 'current' => 0, |
116 | 116 | 'show_all' => false, |
117 | 117 | 'prev_next' => true, |
118 | - 'prev_text' => __( '« Previous' ), |
|
119 | - 'next_text' => __( 'Next »' ), |
|
118 | + 'prev_text' => __('« Previous'), |
|
119 | + 'next_text' => __('Next »'), |
|
120 | 120 | 'end_size' => 1, |
121 | 121 | 'mid_size' => 2, |
122 | 122 | 'type' => 'array', |
123 | 123 | 'add_args' => false, // Array of query args to add. |
124 | 124 | 'add_fragment' => '', |
125 | 125 | ); |
126 | - $args = wp_parse_args( $args, $defaults ); |
|
126 | + $args = wp_parse_args($args, $defaults); |
|
127 | 127 | |
128 | 128 | // Who knows what else people pass in $args. |
129 | - $args['total'] = intval( (int) $args['total'] ); |
|
130 | - if ( $args['total'] < 2 ) { |
|
129 | + $args['total'] = intval((int) $args['total']); |
|
130 | + if ($args['total'] < 2) { |
|
131 | 131 | return array(); |
132 | 132 | } |
133 | 133 | $args['current'] = (int) $args['current']; |
134 | 134 | $args['end_size'] = 0 < (int) $args['end_size'] ? (int) $args['end_size'] : 1; // Out of bounds? Make it the default. |
135 | 135 | $args['mid_size'] = 0 <= (int) $args['mid_size'] ? (int) $args['mid_size'] : 2; |
136 | - $args['add_args'] = is_array( $args['add_args'] ) ? $args['add_args'] : false; |
|
136 | + $args['add_args'] = is_array($args['add_args']) ? $args['add_args'] : false; |
|
137 | 137 | $page_links = array(); |
138 | 138 | $dots = false; |
139 | - if ( $args['prev_next'] && $args['current'] && 1 < $args['current'] ) { |
|
140 | - $link = str_replace( '%_%', 2 === absint( $args['current'] ) ? '' : $args['format'], $args['base'] ); |
|
141 | - $link = str_replace( '%#%', $args['current'] - 1, $link ); |
|
142 | - if ( $args['add_args'] ) { |
|
143 | - $link = add_query_arg( $args['add_args'], $link ); |
|
139 | + if ($args['prev_next'] && $args['current'] && 1 < $args['current']) { |
|
140 | + $link = str_replace('%_%', 2 === absint($args['current']) ? '' : $args['format'], $args['base']); |
|
141 | + $link = str_replace('%#%', $args['current'] - 1, $link); |
|
142 | + if ($args['add_args']) { |
|
143 | + $link = add_query_arg($args['add_args'], $link); |
|
144 | 144 | } |
145 | 145 | $link .= $args['add_fragment']; |
146 | - $link = untrailingslashit( $link ); |
|
146 | + $link = untrailingslashit($link); |
|
147 | 147 | $page_links[] = array( |
148 | 148 | 'class' => 'prev page-numbers', |
149 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ), |
|
149 | + 'link' => esc_url(apply_filters('paginate_links', $link)), |
|
150 | 150 | 'title' => $args['prev_text'], |
151 | 151 | ); |
152 | 152 | } |
153 | - for ( $n = 1; $n <= $args['total']; $n++ ) { |
|
154 | - $n_display = number_format_i18n( $n ); |
|
155 | - if ( absint( $args['current'] ) === $n ) { |
|
153 | + for ($n = 1; $n <= $args['total']; $n++) { |
|
154 | + $n_display = number_format_i18n($n); |
|
155 | + if (absint($args['current']) === $n) { |
|
156 | 156 | $page_links[] = array( |
157 | 157 | 'class' => 'page-number page-numbers current', |
158 | 158 | 'title' => $n_display, |
@@ -162,42 +162,42 @@ discard block |
||
162 | 162 | ); |
163 | 163 | $dots = true; |
164 | 164 | } else { |
165 | - 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'] ) ) { |
|
166 | - $link = str_replace( '%_%', 1 === absint( $n ) ? '' : $args['format'], $args['base'] ); |
|
167 | - $link = str_replace( '%#%', $n, $link ); |
|
168 | - $link = trailingslashit( $link ) . ltrim( $args['add_fragment'], '/' ); |
|
169 | - if ( $args['add_args'] ) { |
|
170 | - $link = rtrim( add_query_arg( $args['add_args'], $link ), '/' ); |
|
165 | + 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'])) { |
|
166 | + $link = str_replace('%_%', 1 === absint($n) ? '' : $args['format'], $args['base']); |
|
167 | + $link = str_replace('%#%', $n, $link); |
|
168 | + $link = trailingslashit($link).ltrim($args['add_fragment'], '/'); |
|
169 | + if ($args['add_args']) { |
|
170 | + $link = rtrim(add_query_arg($args['add_args'], $link), '/'); |
|
171 | 171 | } |
172 | - $link = str_replace( ' ', '+', $link ); |
|
173 | - $link = untrailingslashit( $link ); |
|
172 | + $link = str_replace(' ', '+', $link); |
|
173 | + $link = untrailingslashit($link); |
|
174 | 174 | $page_links[] = array( |
175 | 175 | 'class' => 'page-number page-numbers', |
176 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ), |
|
176 | + 'link' => esc_url(apply_filters('paginate_links', $link)), |
|
177 | 177 | 'title' => $n_display, |
178 | 178 | 'name' => $n_display, |
179 | - 'current' => absint( $args['current'] ) === $n, |
|
179 | + 'current' => absint($args['current']) === $n, |
|
180 | 180 | ); |
181 | 181 | $dots = true; |
182 | - } elseif ( $dots && ! $args['show_all'] ) { |
|
182 | + } elseif ($dots && !$args['show_all']) { |
|
183 | 183 | $page_links[] = array( |
184 | 184 | 'class' => 'dots', |
185 | - 'title' => __( '…' ), |
|
185 | + 'title' => __('…'), |
|
186 | 186 | ); |
187 | 187 | $dots = false; |
188 | 188 | } |
189 | 189 | } |
190 | 190 | } |
191 | - if ( $args['prev_next'] && $args['current'] && ( $args['current'] < $args['total'] || -1 === intval( $args['total'] ) ) ) { |
|
192 | - $link = str_replace( '%_%', $args['format'], $args['base'] ); |
|
193 | - $link = str_replace( '%#%', $args['current'] + 1, $link ); |
|
194 | - if ( $args['add_args'] ) { |
|
195 | - $link = add_query_arg( $args['add_args'], $link ); |
|
191 | + if ($args['prev_next'] && $args['current'] && ($args['current'] < $args['total'] || -1 === intval($args['total']))) { |
|
192 | + $link = str_replace('%_%', $args['format'], $args['base']); |
|
193 | + $link = str_replace('%#%', $args['current'] + 1, $link); |
|
194 | + if ($args['add_args']) { |
|
195 | + $link = add_query_arg($args['add_args'], $link); |
|
196 | 196 | } |
197 | - $link = untrailingslashit( trailingslashit( $link ) . $args['add_fragment'] ); |
|
197 | + $link = untrailingslashit(trailingslashit($link).$args['add_fragment']); |
|
198 | 198 | $page_links[] = array( |
199 | 199 | 'class' => 'next page-numbers', |
200 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ), |
|
200 | + 'link' => esc_url(apply_filters('paginate_links', $link)), |
|
201 | 201 | 'title' => $args['next_text'], |
202 | 202 | ); |
203 | 203 | } |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | * |
212 | 212 | * @return object |
213 | 213 | */ |
214 | - public static function array_to_object( $array ) { |
|
214 | + public static function array_to_object($array) { |
|
215 | 215 | $obj = new \stdClass; |
216 | 216 | |
217 | - foreach ( $array as $k => $v ) { |
|
218 | - if ( strlen( $k ) ) { |
|
219 | - if ( is_array( $v ) ) { |
|
220 | - $obj->{$k} = self::array_to_object( $v ); // Recursion. |
|
217 | + foreach ($array as $k => $v) { |
|
218 | + if (strlen($k)) { |
|
219 | + if (is_array($v)) { |
|
220 | + $obj->{$k} = self::array_to_object($v); // Recursion. |
|
221 | 221 | } else { |
222 | 222 | $obj->{$k} = $v; |
223 | 223 | } |
@@ -236,26 +236,26 @@ discard block |
||
236 | 236 | $textdomain = Classy::textdomain(); |
237 | 237 | $archives_title = ''; |
238 | 238 | |
239 | - if ( is_category() ) { |
|
240 | - $archives_title = single_cat_title( '', false ); |
|
241 | - } else if ( is_tag() ) { |
|
242 | - $archives_title = 'Tag: ' . single_tag_title( '', false ); |
|
243 | - } else if ( is_author() ) { |
|
244 | - if ( have_posts() ) { |
|
239 | + if (is_category()) { |
|
240 | + $archives_title = single_cat_title('', false); |
|
241 | + } else if (is_tag()) { |
|
242 | + $archives_title = 'Tag: '.single_tag_title('', false); |
|
243 | + } else if (is_author()) { |
|
244 | + if (have_posts()) { |
|
245 | 245 | the_post(); |
246 | - $archives_title = 'Author: ' . get_the_author(); |
|
246 | + $archives_title = 'Author: '.get_the_author(); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | rewind_posts(); |
250 | - } else if ( is_search() ) { |
|
251 | - $archives_title = sprintf( __( 'Search Results for: %s', $textdomain ), '<span>' . get_search_query() . '</span>' ); |
|
252 | - } else if ( is_archive() ) { |
|
253 | - if ( is_day() ) { |
|
250 | + } else if (is_search()) { |
|
251 | + $archives_title = sprintf(__('Search Results for: %s', $textdomain), '<span>'.get_search_query().'</span>'); |
|
252 | + } else if (is_archive()) { |
|
253 | + if (is_day()) { |
|
254 | 254 | $archives_title = get_the_date(); |
255 | - } elseif ( is_month() ) { |
|
256 | - $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', $textdomain ) ); |
|
257 | - } elseif ( is_year() ) { |
|
258 | - $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', $textdomain ) ); |
|
255 | + } elseif (is_month()) { |
|
256 | + $archives_title = get_the_date(_x('F Y', 'monthly archives date format', $textdomain)); |
|
257 | + } elseif (is_year()) { |
|
258 | + $archives_title = get_the_date(_x('Y', 'yearly archives date format', $textdomain)); |
|
259 | 259 | } else { |
260 | 260 | $archives_title = 'Archives'; |
261 | 261 | } |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param int $pid Image attachment ID. |
28 | 28 | */ |
29 | - public function __construct( $pid = null ) { |
|
29 | + public function __construct($pid = null) { |
|
30 | 30 | $this->ID = 0; |
31 | 31 | |
32 | 32 | // Checks if image with this id exists. |
33 | - if ( null !== $pid && wp_get_attachment_image_src( $pid ) ) { |
|
33 | + if (null !== $pid && wp_get_attachment_image_src($pid)) { |
|
34 | 34 | $this->ID = $pid; |
35 | 35 | } |
36 | 36 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public static function get_default_image() { |
44 | 44 | // You can put here any url. |
45 | - return CLASSY_THEME_DIR . '/assets/noimage.png'; |
|
45 | + return CLASSY_THEME_DIR.'/assets/noimage.png'; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return string |
54 | 54 | */ |
55 | - public function src( $size = 'medium' ) { |
|
56 | - if ( $this->ID ) { |
|
57 | - $thumb = wp_get_attachment_image_src( $this->ID, $size ); |
|
55 | + public function src($size = 'medium') { |
|
56 | + if ($this->ID) { |
|
57 | + $thumb = wp_get_attachment_image_src($this->ID, $size); |
|
58 | 58 | |
59 | 59 | return $thumb[0]; |
60 | 60 | } |
@@ -19,18 +19,18 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return \WP_Query |
21 | 21 | */ |
22 | - public static function find_query( $args = false ) { |
|
22 | + public static function find_query($args = false) { |
|
23 | 23 | $default_args = array(); |
24 | 24 | |
25 | - if ( ! $args ) { |
|
25 | + if (!$args) { |
|
26 | 26 | return self::get_current_query(); |
27 | 27 | } |
28 | 28 | |
29 | - if ( is_array( $args ) ) { |
|
30 | - return new \WP_Query( array_merge( $default_args, $args ) ); |
|
29 | + if (is_array($args)) { |
|
30 | + return new \WP_Query(array_merge($default_args, $args)); |
|
31 | 31 | } |
32 | 32 | |
33 | - return new \WP_Query( $default_args ); |
|
33 | + return new \WP_Query($default_args); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function get_current_query() { |
42 | 42 | global $wp_query; |
43 | - $query =& $wp_query; |
|
44 | - $query = self::handle_maybe_custom_posts_page( $query ); |
|
43 | + $query = & $wp_query; |
|
44 | + $query = self::handle_maybe_custom_posts_page($query); |
|
45 | 45 | |
46 | 46 | return $query; |
47 | 47 | } |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return \WP_Query |
55 | 55 | */ |
56 | - private static function handle_maybe_custom_posts_page( $query ) { |
|
57 | - if ( $custom_posts_page = get_option( 'page_for_posts' ) ) { |
|
56 | + private static function handle_maybe_custom_posts_page($query) { |
|
57 | + if ($custom_posts_page = get_option('page_for_posts')) { |
|
58 | 58 | if ( |
59 | - isset( $query->query['p'] ) && |
|
60 | - absint( $query->query['p'] ) === absint( $custom_posts_page ) |
|
59 | + isset($query->query['p']) && |
|
60 | + absint($query->query['p']) === absint($custom_posts_page) |
|
61 | 61 | ) { |
62 | - return new \WP_Query( array( 'post_type' => 'post' ) ); |
|
62 | + return new \WP_Query(array('post_type' => 'post')); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -19,21 +19,21 @@ |
||
19 | 19 | * |
20 | 20 | * @return void |
21 | 21 | */ |
22 | - protected function import( $data ) { |
|
23 | - if ( is_object( $data ) ) { |
|
24 | - $data = get_object_vars( $data ); |
|
22 | + protected function import($data) { |
|
23 | + if (is_object($data)) { |
|
24 | + $data = get_object_vars($data); |
|
25 | 25 | } |
26 | 26 | |
27 | - if ( is_array( $data ) ) { |
|
27 | + if (is_array($data)) { |
|
28 | 28 | // In case if we import WP_User object. |
29 | - if ( isset( $data['data'] ) ) { |
|
29 | + if (isset($data['data'])) { |
|
30 | 30 | $data = $data['data']; |
31 | 31 | } |
32 | 32 | |
33 | - foreach ( $data as $key => $value ) { |
|
34 | - if ( ! empty( $key ) ) { |
|
33 | + foreach ($data as $key => $value) { |
|
34 | + if (!empty($key)) { |
|
35 | 35 | $this->$key = $value; |
36 | - } else if ( ! empty( $key ) && ! method_exists( $this, $key ) ) { |
|
36 | + } else if (!empty($key) && !method_exists($this, $key)) { |
|
37 | 37 | $this->$key = $value; |
38 | 38 | } |
39 | 39 | } |