@@ -12,7 +12,7 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * Returns list of allowed variables that can be used in theme config |
| 14 | 14 | * |
| 15 | - * @return array |
|
| 15 | + * @return string[] |
|
| 16 | 16 | */ |
| 17 | 17 | private static function get_allowed_variables() { |
| 18 | 18 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | private static function get_allowed_variables() { |
| 18 | 18 | |
| 19 | - return array( 'environment', 'textdomain', 'post_types', 'taxonomies', 'post_formats', 'sidebars' );; |
|
| 19 | + return array('environment', 'textdomain', 'post_types', 'taxonomies', 'post_formats', 'sidebars'); ; |
|
| 20 | 20 | |
| 21 | 21 | } |
| 22 | 22 | |
@@ -27,30 +27,30 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public static function get_vars() { |
| 29 | 29 | |
| 30 | - if ( null === self::$vars ) { |
|
| 30 | + if (null === self::$vars) { |
|
| 31 | 31 | |
| 32 | 32 | // Check for a theme config |
| 33 | - $config_file = THEME_FRAMEWORK_PATH . 'config.php'; |
|
| 33 | + $config_file = THEME_FRAMEWORK_PATH.'config.php'; |
|
| 34 | 34 | |
| 35 | - if ( file_exists( $config_file ) ) { |
|
| 35 | + if (file_exists($config_file)) { |
|
| 36 | 36 | |
| 37 | - require_once THEME_FRAMEWORK_PATH . 'config.php'; |
|
| 37 | + require_once THEME_FRAMEWORK_PATH.'config.php'; |
|
| 38 | 38 | |
| 39 | 39 | $vars = self::get_allowed_variables(); |
| 40 | 40 | |
| 41 | - foreach ( $vars as $var ) { |
|
| 41 | + foreach ($vars as $var) { |
|
| 42 | 42 | |
| 43 | - if ( isset( $$var ) ) { |
|
| 43 | + if (isset($$var)) { |
|
| 44 | 44 | |
| 45 | - self::$vars[ $var ] = $$var; |
|
| 45 | + self::$vars[$var] = $$var; |
|
| 46 | 46 | |
| 47 | - unset( $$var ); // We don't require it anymore |
|
| 47 | + unset($$var); // We don't require it anymore |
|
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | } else { |
| 52 | 52 | |
| 53 | - die( 'There is no config file in ' . THEME . ' custom/config.php' ); |
|
| 53 | + die('There is no config file in '.THEME.' custom/config.php'); |
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -69,16 +69,16 @@ discard block |
||
| 69 | 69 | $vars = self::get_vars(); |
| 70 | 70 | |
| 71 | 71 | // Init Post Types |
| 72 | - if ( isset( $vars['post_types'] ) ) { self::init_post_types( $vars['post_types'] ); } |
|
| 72 | + if (isset($vars['post_types'])) { self::init_post_types($vars['post_types']); } |
|
| 73 | 73 | |
| 74 | 74 | // Init Taxonomies |
| 75 | - if ( isset( $vars['taxonomies'] ) ) { self::init_taxonomies( $vars['taxonomies'] ); } |
|
| 75 | + if (isset($vars['taxonomies'])) { self::init_taxonomies($vars['taxonomies']); } |
|
| 76 | 76 | |
| 77 | 77 | // Init Post Formats |
| 78 | - if ( isset( $vars['post_formats'] ) ) { self::init_post_formats( $vars['post_formats'] ); } |
|
| 78 | + if (isset($vars['post_formats'])) { self::init_post_formats($vars['post_formats']); } |
|
| 79 | 79 | |
| 80 | 80 | // Init Sidebars |
| 81 | - if ( isset( $vars['sidebars'] ) ) { self::init_sidebars( $vars['sidebars'] ); } |
|
| 81 | + if (isset($vars['sidebars'])) { self::init_sidebars($vars['sidebars']); } |
|
| 82 | 82 | |
| 83 | 83 | } |
| 84 | 84 | |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @param array $post_types |
| 91 | 91 | */ |
| 92 | - private static function init_post_types( $post_types ) { |
|
| 92 | + private static function init_post_types($post_types) { |
|
| 93 | 93 | |
| 94 | - if ( is_array( $post_types ) ) { |
|
| 94 | + if (is_array($post_types)) { |
|
| 95 | 95 | |
| 96 | - foreach ( $post_types as $type => $options ) { |
|
| 96 | + foreach ($post_types as $type => $options) { |
|
| 97 | 97 | |
| 98 | - self::add_post_type( $type, $options['config'], $options['singular'], $options['multiple'] ); |
|
| 98 | + self::add_post_type($type, $options['config'], $options['singular'], $options['multiple']); |
|
| 99 | 99 | |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -111,28 +111,28 @@ discard block |
||
| 111 | 111 | * @param string $singular |
| 112 | 112 | * @param string $multiple |
| 113 | 113 | */ |
| 114 | - private static function add_post_type( $name, $config, $singular = 'Entry', $multiple = 'Entries' ) { |
|
| 114 | + private static function add_post_type($name, $config, $singular = 'Entry', $multiple = 'Entries') { |
|
| 115 | 115 | |
| 116 | 116 | $domain = Classy::textdomain(); |
| 117 | 117 | |
| 118 | - if ( ! isset( $config['labels'] ) ) { |
|
| 118 | + if (!isset($config['labels'])) { |
|
| 119 | 119 | |
| 120 | 120 | $config['labels'] = array( |
| 121 | - 'name' => __( $multiple, $domain ), |
|
| 122 | - 'singular_name' => __( $singular, $domain ), |
|
| 123 | - 'not_found' => __( 'No ' . $multiple . ' Found', $domain ), |
|
| 124 | - 'not_found_in_trash' => __( 'No ' . $multiple . ' found in Trash', $domain ), |
|
| 125 | - 'edit_item' => __( 'Edit ', $singular, $domain ), |
|
| 126 | - 'search_items' => __( 'Search ' . $multiple, $domain ), |
|
| 127 | - 'view_item' => __( 'View ', $singular, $domain ), |
|
| 128 | - 'new_item' => __( 'New ' . $singular, $domain ), |
|
| 129 | - 'add_new' => __( 'Add New', $domain ), |
|
| 130 | - 'add_new_item' => __( 'Add New ' . $singular, $domain ), |
|
| 121 | + 'name' => __($multiple, $domain), |
|
| 122 | + 'singular_name' => __($singular, $domain), |
|
| 123 | + 'not_found' => __('No '.$multiple.' Found', $domain), |
|
| 124 | + 'not_found_in_trash' => __('No '.$multiple.' found in Trash', $domain), |
|
| 125 | + 'edit_item' => __('Edit ', $singular, $domain), |
|
| 126 | + 'search_items' => __('Search '.$multiple, $domain), |
|
| 127 | + 'view_item' => __('View ', $singular, $domain), |
|
| 128 | + 'new_item' => __('New '.$singular, $domain), |
|
| 129 | + 'add_new' => __('Add New', $domain), |
|
| 130 | + 'add_new_item' => __('Add New '.$singular, $domain), |
|
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - register_post_type( $name, $config ); |
|
| 135 | + register_post_type($name, $config); |
|
| 136 | 136 | |
| 137 | 137 | } |
| 138 | 138 | |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | * |
| 142 | 142 | * @param array $taxonomies |
| 143 | 143 | */ |
| 144 | - private static function init_taxonomies( $taxonomies ) { |
|
| 144 | + private static function init_taxonomies($taxonomies) { |
|
| 145 | 145 | |
| 146 | - if ( is_array( $taxonomies ) ) { |
|
| 146 | + if (is_array($taxonomies)) { |
|
| 147 | 147 | |
| 148 | - foreach ( $taxonomies as $type => $options ) { |
|
| 148 | + foreach ($taxonomies as $type => $options) { |
|
| 149 | 149 | |
| 150 | - self::add_taxonomy( $type, $options['for'], $options['config'], $options['singular'], $options['multiple'] ); |
|
| 150 | + self::add_taxonomy($type, $options['for'], $options['config'], $options['singular'], $options['multiple']); |
|
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -163,29 +163,29 @@ discard block |
||
| 163 | 163 | * @param string $singular |
| 164 | 164 | * @param string $multiple |
| 165 | 165 | */ |
| 166 | - private static function add_taxonomy( $name, $object_type, $config, $singular = 'Entry', $multiple = 'Entries' ) { |
|
| 166 | + private static function add_taxonomy($name, $object_type, $config, $singular = 'Entry', $multiple = 'Entries') { |
|
| 167 | 167 | |
| 168 | 168 | $domain = Classy::textdomain(); |
| 169 | 169 | |
| 170 | - if ( ! isset( $config['labels'] ) ) { |
|
| 170 | + if (!isset($config['labels'])) { |
|
| 171 | 171 | |
| 172 | 172 | $config['labels'] = array( |
| 173 | - 'name' => __( $multiple, $domain ), |
|
| 174 | - 'singular_name' => __( $singular, $domain ), |
|
| 175 | - 'search_items' => __( 'Search ' . $multiple, $domain ), |
|
| 176 | - 'all_items' => __( 'All ' . $multiple, $domain ), |
|
| 177 | - 'parent_item' => __( 'Parent ' . $singular, $domain ), |
|
| 178 | - 'parent_item_colon' => __( 'Parent ' . $singular . ':', $domain ), |
|
| 179 | - 'edit_item' => __( 'Edit ' . $singular, $domain ), |
|
| 180 | - 'update_item' => __( 'Update ' . $singular, $domain ), |
|
| 181 | - 'add_new_item' => __( 'Add New ' . $singular, $domain ), |
|
| 182 | - 'new_item_name' => __( 'New ' . $singular . ' Name', $domain ), |
|
| 183 | - 'menu_name' => __( $singular, $domain ), |
|
| 173 | + 'name' => __($multiple, $domain), |
|
| 174 | + 'singular_name' => __($singular, $domain), |
|
| 175 | + 'search_items' => __('Search '.$multiple, $domain), |
|
| 176 | + 'all_items' => __('All '.$multiple, $domain), |
|
| 177 | + 'parent_item' => __('Parent '.$singular, $domain), |
|
| 178 | + 'parent_item_colon' => __('Parent '.$singular.':', $domain), |
|
| 179 | + 'edit_item' => __('Edit '.$singular, $domain), |
|
| 180 | + 'update_item' => __('Update '.$singular, $domain), |
|
| 181 | + 'add_new_item' => __('Add New '.$singular, $domain), |
|
| 182 | + 'new_item_name' => __('New '.$singular.' Name', $domain), |
|
| 183 | + 'menu_name' => __($singular, $domain), |
|
| 184 | 184 | ); |
| 185 | 185 | |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - register_taxonomy( $name, $object_type, $config ); |
|
| 188 | + register_taxonomy($name, $object_type, $config); |
|
| 189 | 189 | |
| 190 | 190 | } |
| 191 | 191 | |
@@ -194,11 +194,11 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @param array $post_formats |
| 196 | 196 | */ |
| 197 | - private static function init_post_formats( $post_formats ) { |
|
| 197 | + private static function init_post_formats($post_formats) { |
|
| 198 | 198 | |
| 199 | - if ( is_array( $post_formats ) ) { |
|
| 199 | + if (is_array($post_formats)) { |
|
| 200 | 200 | |
| 201 | - add_theme_support( 'post-formats', $post_formats ); |
|
| 201 | + add_theme_support('post-formats', $post_formats); |
|
| 202 | 202 | |
| 203 | 203 | } |
| 204 | 204 | |
@@ -209,19 +209,19 @@ discard block |
||
| 209 | 209 | * |
| 210 | 210 | * @param array $sidebars |
| 211 | 211 | */ |
| 212 | - private static function init_sidebars( $sidebars ) { |
|
| 212 | + private static function init_sidebars($sidebars) { |
|
| 213 | 213 | |
| 214 | 214 | $domain = Classy::textdomain(); |
| 215 | 215 | |
| 216 | - if ( is_array( $sidebars ) ) { |
|
| 216 | + if (is_array($sidebars)) { |
|
| 217 | 217 | |
| 218 | - foreach ( $sidebars as $id => $title ) { |
|
| 218 | + foreach ($sidebars as $id => $title) { |
|
| 219 | 219 | |
| 220 | 220 | register_sidebar( |
| 221 | 221 | array( |
| 222 | 222 | 'id' => $id, |
| 223 | - 'name' => __( $title, $domain ), |
|
| 224 | - 'description' => __( $title, $domain ), |
|
| 223 | + 'name' => __($title, $domain), |
|
| 224 | + 'description' => __($title, $domain), |
|
| 225 | 225 | 'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">', |
| 226 | 226 | 'after_widget' => '</div></div>', |
| 227 | 227 | 'before_title' => '<h3>', |
@@ -48,7 +48,8 @@ |
||
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | - } else { |
|
| 51 | + } |
|
| 52 | + else { |
|
| 52 | 53 | |
| 53 | 54 | die( 'There is no config file in ' . THEME . ' custom/config.php' ); |
| 54 | 55 | |
@@ -54,6 +54,7 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @param string |
| 56 | 56 | * @param string |
| 57 | + * @param string $name |
|
| 57 | 58 | */ |
| 58 | 59 | private function define( $name, $value ) { |
| 59 | 60 | if ( !defined($name) ) { |
@@ -241,7 +242,7 @@ discard block |
||
| 241 | 242 | |
| 242 | 243 | /** |
| 243 | 244 | * @param array $prefs |
| 244 | - * @return array mixed |
|
| 245 | + * @return stdClass mixed |
|
| 245 | 246 | */ |
| 246 | 247 | public static function get_pagination( $prefs = array() ) { |
| 247 | 248 | global $wp_query; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public static function get_instance() { |
| 31 | 31 | |
| 32 | - if ( null === self::$single_instance ) { |
|
| 32 | + if (null === self::$single_instance) { |
|
| 33 | 33 | |
| 34 | 34 | self::$single_instance = new self(); |
| 35 | 35 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $this->init_config(); |
| 58 | 58 | |
| 59 | - add_filter( 'theme_page_templates', array( $this, 'filter_templates' ), 3 ); |
|
| 59 | + add_filter('theme_page_templates', array($this, 'filter_templates'), 3); |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | * @param string |
| 67 | 67 | * @param string |
| 68 | 68 | */ |
| 69 | - private function define( $name, $value ) { |
|
| 69 | + private function define($name, $value) { |
|
| 70 | 70 | |
| 71 | - if ( ! defined( $name ) ) { |
|
| 71 | + if (!defined($name)) { |
|
| 72 | 72 | |
| 73 | - define( $name, $value ); |
|
| 73 | + define($name, $value); |
|
| 74 | 74 | |
| 75 | 75 | } |
| 76 | 76 | |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $theme = wp_get_theme(); |
| 88 | 88 | |
| 89 | - $this->define( 'THEME', $theme->template ); |
|
| 90 | - $this->define( 'THEME_NAME', $theme->get( 'Name' ) ); |
|
| 91 | - $this->define( 'THEME_PATH', get_template_directory() . '/' ); |
|
| 92 | - $this->define( 'THEME_DIR', get_template_directory_uri() . '/' ); |
|
| 93 | - $this->define( 'THEME_VERSION', $theme->get( 'Version' ) ); |
|
| 94 | - $this->define( 'THEME_FRAMEWORK_PATH', THEME_PATH . 'app/' ); |
|
| 95 | - $this->define( 'THEME_FRAMEWORK_DIR', THEME_DIR . 'app/' ); |
|
| 89 | + $this->define('THEME', $theme->template); |
|
| 90 | + $this->define('THEME_NAME', $theme->get('Name')); |
|
| 91 | + $this->define('THEME_PATH', get_template_directory().'/'); |
|
| 92 | + $this->define('THEME_DIR', get_template_directory_uri().'/'); |
|
| 93 | + $this->define('THEME_VERSION', $theme->get('Version')); |
|
| 94 | + $this->define('THEME_FRAMEWORK_PATH', THEME_PATH.'app/'); |
|
| 95 | + $this->define('THEME_FRAMEWORK_DIR', THEME_DIR.'app/'); |
|
| 96 | 96 | |
| 97 | 97 | } |
| 98 | 98 | |
@@ -101,40 +101,40 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | private function include_core_files() { |
| 103 | 103 | |
| 104 | - require_once THEME_PATH . 'vendor/autoload.php'; |
|
| 104 | + require_once THEME_PATH.'vendor/autoload.php'; |
|
| 105 | 105 | |
| 106 | 106 | // Basis Class |
| 107 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-basis.php'; |
|
| 107 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-basis.php'; |
|
| 108 | 108 | |
| 109 | 109 | // Hierarchy |
| 110 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-hierarchy.php'; |
|
| 110 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-hierarchy.php'; |
|
| 111 | 111 | |
| 112 | 112 | // Theme Config |
| 113 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-config.php'; |
|
| 113 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-config.php'; |
|
| 114 | 114 | |
| 115 | 115 | // Scope |
| 116 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-scope.php'; |
|
| 116 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-scope.php'; |
|
| 117 | 117 | |
| 118 | 118 | // View Loader |
| 119 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-view.php'; |
|
| 119 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-view.php'; |
|
| 120 | 120 | |
| 121 | 121 | // Helper functions |
| 122 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-helper.php'; |
|
| 122 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-helper.php'; |
|
| 123 | 123 | |
| 124 | 124 | // Query Helper |
| 125 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-query-helper.php'; |
|
| 125 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-query-helper.php'; |
|
| 126 | 126 | |
| 127 | 127 | // Menu |
| 128 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-menu.php'; |
|
| 128 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-menu.php'; |
|
| 129 | 129 | |
| 130 | 130 | // Menu Item |
| 131 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-menu-item.php'; |
|
| 131 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-menu-item.php'; |
|
| 132 | 132 | |
| 133 | 133 | // Comment |
| 134 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-comment.php'; |
|
| 134 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-comment.php'; |
|
| 135 | 135 | |
| 136 | 136 | // Appearance |
| 137 | - require_once THEME_FRAMEWORK_PATH . 'appearance.php'; |
|
| 137 | + require_once THEME_FRAMEWORK_PATH.'appearance.php'; |
|
| 138 | 138 | |
| 139 | 139 | } |
| 140 | 140 | |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | private function include_models() { |
| 145 | 145 | |
| 146 | - $files = (array) glob( THEME_FRAMEWORK_PATH . '/models/*.php' ); |
|
| 146 | + $files = (array) glob(THEME_FRAMEWORK_PATH.'/models/*.php'); |
|
| 147 | 147 | |
| 148 | - foreach ( $files as $filename ) { |
|
| 148 | + foreach ($files as $filename) { |
|
| 149 | 149 | |
| 150 | - if ( ! empty( $filename ) ) { |
|
| 150 | + if (!empty($filename)) { |
|
| 151 | 151 | |
| 152 | 152 | require_once $filename; |
| 153 | 153 | |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | * @return array |
| 172 | 172 | */ |
| 173 | 173 | |
| 174 | - public function filter_templates( $page_templates = array(), $object = null, $post = null ) { |
|
| 174 | + public function filter_templates($page_templates = array(), $object = null, $post = null) { |
|
| 175 | 175 | |
| 176 | 176 | $custom_templates = ClassyView::get_page_templates_list(); |
| 177 | 177 | |
| 178 | - return array_merge( $page_templates, $custom_templates ); |
|
| 178 | + return array_merge($page_templates, $custom_templates); |
|
| 179 | 179 | |
| 180 | 180 | } |
| 181 | 181 | |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | * @param string $name |
| 186 | 186 | * @return any |
| 187 | 187 | */ |
| 188 | - public static function get_config_var( $name ) { |
|
| 188 | + public static function get_config_var($name) { |
|
| 189 | 189 | |
| 190 | 190 | $vars = ClassyConfig::get_vars(); |
| 191 | 191 | |
| 192 | - if ( isset( $vars[ $name ] ) ) { return $vars[ $name ]; } |
|
| 192 | + if (isset($vars[$name])) { return $vars[$name]; } |
|
| 193 | 193 | |
| 194 | 194 | return false; |
| 195 | 195 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public static function textdomain() { |
| 204 | 204 | |
| 205 | - $textdomain = Classy::get_config_var( 'textdomain' ); |
|
| 205 | + $textdomain = Classy::get_config_var('textdomain'); |
|
| 206 | 206 | |
| 207 | 207 | return $textdomain ? $textdomain : THEME; |
| 208 | 208 | |
@@ -217,17 +217,17 @@ discard block |
||
| 217 | 217 | * @param array|null $data Additional params |
| 218 | 218 | * @return void |
| 219 | 219 | */ |
| 220 | - public static function render( $view = null, $data = null ) { |
|
| 220 | + public static function render($view = null, $data = null) { |
|
| 221 | 221 | |
| 222 | - $views = THEME_PATH . ClassyView::$folder; |
|
| 223 | - $cache = WP_CONTENT_DIR . '/viewcache'; |
|
| 222 | + $views = THEME_PATH.ClassyView::$folder; |
|
| 223 | + $cache = WP_CONTENT_DIR.'/viewcache'; |
|
| 224 | 224 | $common_scope = ClassyScope::get_common_scope(); |
| 225 | 225 | |
| 226 | - if ( null !== $view && is_string( $view ) ) { |
|
| 226 | + if (null !== $view && is_string($view)) { |
|
| 227 | 227 | |
| 228 | - if ( $data && is_array( $data ) ) { |
|
| 228 | + if ($data && is_array($data)) { |
|
| 229 | 229 | |
| 230 | - $scope = array_merge( $common_scope, $data ); |
|
| 230 | + $scope = array_merge($common_scope, $data); |
|
| 231 | 231 | |
| 232 | 232 | } else { |
| 233 | 233 | |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - $renderer = new BladeRenderer( $views, array( 'cache_path' => $cache ) ); |
|
| 245 | + $renderer = new BladeRenderer($views, array('cache_path' => $cache)); |
|
| 246 | 246 | |
| 247 | - echo $renderer->render( $view, $scope ); |
|
| 247 | + echo $renderer->render($view, $scope); |
|
| 248 | 248 | |
| 249 | 249 | } |
| 250 | 250 | |
@@ -269,21 +269,21 @@ discard block |
||
| 269 | 269 | * @param string $return_type ClassyPost/object/id |
| 270 | 270 | * @return mixed |
| 271 | 271 | */ |
| 272 | - public static function get_posts( $args = false, $return_type = 'ClassyPost' ) { |
|
| 272 | + public static function get_posts($args = false, $return_type = 'ClassyPost') { |
|
| 273 | 273 | |
| 274 | 274 | $_return = array(); |
| 275 | 275 | |
| 276 | - $query = ClassyQueryHelper::find_query( $args ); |
|
| 276 | + $query = ClassyQueryHelper::find_query($args); |
|
| 277 | 277 | |
| 278 | - if ( isset( $query->posts ) ) { |
|
| 278 | + if (isset($query->posts)) { |
|
| 279 | 279 | |
| 280 | - foreach ( $query->posts as $post ) { |
|
| 280 | + foreach ($query->posts as $post) { |
|
| 281 | 281 | |
| 282 | - if ( 'ClassyPost' == $return_type ) { |
|
| 282 | + if ('ClassyPost' == $return_type) { |
|
| 283 | 283 | |
| 284 | - $_return[] = new ClassyPost( $post ); |
|
| 284 | + $_return[] = new ClassyPost($post); |
|
| 285 | 285 | |
| 286 | - } elseif ( 'id' == $return_type ) { |
|
| 286 | + } elseif ('id' == $return_type) { |
|
| 287 | 287 | |
| 288 | 288 | $_return[] = $post->id; |
| 289 | 289 | |
@@ -305,11 +305,11 @@ discard block |
||
| 305 | 305 | * @param string $return_type ClassyPost/object/id |
| 306 | 306 | * @return mixed |
| 307 | 307 | */ |
| 308 | - public static function get_post( $args = false, $return_type = 'ClassyPost' ) { |
|
| 308 | + public static function get_post($args = false, $return_type = 'ClassyPost') { |
|
| 309 | 309 | |
| 310 | - $posts = self::get_posts( $args, $return_type ); |
|
| 310 | + $posts = self::get_posts($args, $return_type); |
|
| 311 | 311 | |
| 312 | - if ( $post = reset( $posts ) ) { |
|
| 312 | + if ($post = reset($posts)) { |
|
| 313 | 313 | return $post; |
| 314 | 314 | } |
| 315 | 315 | |
@@ -319,62 +319,62 @@ discard block |
||
| 319 | 319 | * @param array $prefs |
| 320 | 320 | * @return array mixed |
| 321 | 321 | */ |
| 322 | - public static function get_pagination( $prefs = array() ) { |
|
| 322 | + public static function get_pagination($prefs = array()) { |
|
| 323 | 323 | |
| 324 | 324 | global $wp_query; |
| 325 | 325 | global $paged; |
| 326 | 326 | global $wp_rewrite; |
| 327 | 327 | |
| 328 | 328 | $args = array(); |
| 329 | - $args['total'] = ceil( $wp_query->found_posts / $wp_query->query_vars['posts_per_page'] ); |
|
| 329 | + $args['total'] = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']); |
|
| 330 | 330 | |
| 331 | - if ( $wp_rewrite->using_permalinks() ) { |
|
| 331 | + if ($wp_rewrite->using_permalinks()) { |
|
| 332 | 332 | |
| 333 | - $url = explode( '?', get_pagenum_link( 0 ) ); |
|
| 333 | + $url = explode('?', get_pagenum_link(0)); |
|
| 334 | 334 | |
| 335 | - if ( isset( $url[1] ) ) { |
|
| 336 | - parse_str( $url[1], $query ); |
|
| 335 | + if (isset($url[1])) { |
|
| 336 | + parse_str($url[1], $query); |
|
| 337 | 337 | $args['add_args'] = $query; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | $args['format'] = 'page/%#%'; |
| 341 | - $args['base'] = trailingslashit( $url[0] ).'%_%'; |
|
| 341 | + $args['base'] = trailingslashit($url[0]).'%_%'; |
|
| 342 | 342 | |
| 343 | 343 | } else { |
| 344 | 344 | $big = 999999999; |
| 345 | - $args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ); |
|
| 345 | + $args['base'] = str_replace($big, '%#%', esc_url(get_pagenum_link($big))); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | $args['type'] = 'array'; |
| 349 | - $args['current'] = max( 1, get_query_var( 'paged' ) ); |
|
| 350 | - $args['mid_size'] = max( 9 - $args['current'], 3 ); |
|
| 349 | + $args['current'] = max(1, get_query_var('paged')); |
|
| 350 | + $args['mid_size'] = max(9 - $args['current'], 3); |
|
| 351 | 351 | $args['prev_next'] = false; |
| 352 | 352 | |
| 353 | - if ( is_int( $prefs ) ) { |
|
| 353 | + if (is_int($prefs)) { |
|
| 354 | 354 | $args['mid_size'] = $prefs - 2; |
| 355 | 355 | } else { |
| 356 | - $args = array_merge( $args, $prefs ); |
|
| 356 | + $args = array_merge($args, $prefs); |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | $data = array(); |
| 360 | - $data['pages'] = ClassyHelper::paginate_links( $args ); |
|
| 361 | - $next = get_next_posts_page_link( $args['total'] ); |
|
| 360 | + $data['pages'] = ClassyHelper::paginate_links($args); |
|
| 361 | + $next = get_next_posts_page_link($args['total']); |
|
| 362 | 362 | |
| 363 | - if ( $next ) { |
|
| 364 | - $data['next'] = array( 'link' => untrailingslashit( $next ), 'class' => 'page-numbers next' ); |
|
| 363 | + if ($next) { |
|
| 364 | + $data['next'] = array('link' => untrailingslashit($next), 'class' => 'page-numbers next'); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - $prev = previous_posts( false ); |
|
| 367 | + $prev = previous_posts(false); |
|
| 368 | 368 | |
| 369 | - if ( $prev ) { |
|
| 370 | - $data['prev'] = array( 'link' => untrailingslashit( $prev ), 'class' => 'page-numbers prev' ); |
|
| 369 | + if ($prev) { |
|
| 370 | + $data['prev'] = array('link' => untrailingslashit($prev), 'class' => 'page-numbers prev'); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - if ( $paged < 2 ) { |
|
| 373 | + if ($paged < 2) { |
|
| 374 | 374 | $data['prev'] = null; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - return ClassyHelper::array_to_object( $data ); |
|
| 377 | + return ClassyHelper::array_to_object($data); |
|
| 378 | 378 | |
| 379 | 379 | } |
| 380 | 380 | } |
@@ -229,12 +229,14 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | $scope = array_merge( $common_scope, $data ); |
| 231 | 231 | |
| 232 | - } else { |
|
| 232 | + } |
|
| 233 | + else { |
|
| 233 | 234 | |
| 234 | 235 | $scope = $common_scope; |
| 235 | 236 | |
| 236 | 237 | } |
| 237 | - } else { |
|
| 238 | + } |
|
| 239 | + else { |
|
| 238 | 240 | |
| 239 | 241 | $view = ClassyView::get_view(); |
| 240 | 242 | |
@@ -283,11 +285,13 @@ discard block |
||
| 283 | 285 | |
| 284 | 286 | $_return[] = new ClassyPost( $post ); |
| 285 | 287 | |
| 286 | - } elseif ( 'id' == $return_type ) { |
|
| 288 | + } |
|
| 289 | + elseif ( 'id' == $return_type ) { |
|
| 287 | 290 | |
| 288 | 291 | $_return[] = $post->id; |
| 289 | 292 | |
| 290 | - } else { |
|
| 293 | + } |
|
| 294 | + else { |
|
| 291 | 295 | |
| 292 | 296 | $_return[] = $post; |
| 293 | 297 | |
@@ -340,7 +344,8 @@ discard block |
||
| 340 | 344 | $args['format'] = 'page/%#%'; |
| 341 | 345 | $args['base'] = trailingslashit( $url[0] ).'%_%'; |
| 342 | 346 | |
| 343 | - } else { |
|
| 347 | + } |
|
| 348 | + else { |
|
| 344 | 349 | $big = 999999999; |
| 345 | 350 | $args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ); |
| 346 | 351 | } |
@@ -352,7 +357,8 @@ discard block |
||
| 352 | 357 | |
| 353 | 358 | if ( is_int( $prefs ) ) { |
| 354 | 359 | $args['mid_size'] = $prefs - 2; |
| 355 | - } else { |
|
| 360 | + } |
|
| 361 | + else { |
|
| 356 | 362 | $args = array_merge( $args, $prefs ); |
| 357 | 363 | } |
| 358 | 364 | |
@@ -61,6 +61,9 @@ |
||
| 61 | 61 | $this->init(); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | + /** |
|
| 65 | + * @param integer|null $uid |
|
| 66 | + */ |
|
| 64 | 67 | private function verify_id($uid) { |
| 65 | 68 | return $uid; |
| 66 | 69 | } |
@@ -43,7 +43,8 @@ |
||
| 43 | 43 | |
| 44 | 44 | wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/min/production.js', array( 'jquery' ), THEME_VERSION, true ); |
| 45 | 45 | |
| 46 | - } else { |
|
| 46 | + } |
|
| 47 | + else { |
|
| 47 | 48 | |
| 48 | 49 | wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/plugins.js', array( 'jquery' ), THEME_VERSION, true ); |
| 49 | 50 | |
@@ -60,13 +60,13 @@ discard block |
||
| 60 | 60 | * Main constructor function. Requires user id |
| 61 | 61 | * @param int $uid |
| 62 | 62 | */ |
| 63 | - public function __construct( $uid = null ) { |
|
| 64 | - $this->ID = $this->verify_id( $uid ); |
|
| 63 | + public function __construct($uid = null) { |
|
| 64 | + $this->ID = $this->verify_id($uid); |
|
| 65 | 65 | |
| 66 | 66 | $this->init(); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - private function verify_id( $uid ) { |
|
| 69 | + private function verify_id($uid) { |
|
| 70 | 70 | return $uid; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | private function init() { |
| 77 | 77 | $object = (array) $this->get_object(); |
| 78 | 78 | |
| 79 | - $this->import( $object ); |
|
| 79 | + $this->import($object); |
|
| 80 | 80 | |
| 81 | - if ( isset( $this->first_name ) && isset( $this->last_name ) ) { |
|
| 82 | - $this->name = $this->first_name . ' ' . $this->last_name; |
|
| 81 | + if (isset($this->first_name) && isset($this->last_name)) { |
|
| 82 | + $this->name = $this->first_name.' '.$this->last_name; |
|
| 83 | 83 | } else { |
| 84 | 84 | $this->name = 'Anonymous'; |
| 85 | 85 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @return object |
| 93 | 93 | */ |
| 94 | 94 | private function get_object() { |
| 95 | - return get_userdata( $this->ID ); |
|
| 95 | + return get_userdata($this->ID); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | * @return string |
| 157 | 157 | */ |
| 158 | 158 | public function link() { |
| 159 | - if ( ! $this->link ) { |
|
| 160 | - $this->link = get_author_posts_url( $this->ID ); |
|
| 159 | + if (!$this->link) { |
|
| 160 | + $this->link = get_author_posts_url($this->ID); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | return $this->link; |
@@ -43,7 +43,8 @@ |
||
| 43 | 43 | |
| 44 | 44 | wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/min/production.js', array( 'jquery' ), THEME_VERSION, true ); |
| 45 | 45 | |
| 46 | - } else { |
|
| 46 | + } |
|
| 47 | + else { |
|
| 47 | 48 | |
| 48 | 49 | wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/plugins.js', array( 'jquery' ), THEME_VERSION, true ); |
| 49 | 50 | |
@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | public function __construct() { |
| 11 | 11 | |
| 12 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); |
|
| 12 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles')); |
|
| 13 | 13 | |
| 14 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 14 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
| 15 | 15 | |
| 16 | - add_action( 'wp_print_scripts', array( $this, 'init_js_vars' ) ); |
|
| 16 | + add_action('wp_print_scripts', array($this, 'init_js_vars')); |
|
| 17 | 17 | |
| 18 | - add_action( 'after_setup_theme', array( $this, 'setup_theme' ) ); |
|
| 18 | + add_action('after_setup_theme', array($this, 'setup_theme')); |
|
| 19 | 19 | |
| 20 | 20 | } |
| 21 | 21 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function enqueue_styles() { |
| 26 | 26 | |
| 27 | - wp_register_style( 'general_css', THEME_DIR . 'assets/css/general.css', array(), THEME_VERSION, 'all' ); |
|
| 27 | + wp_register_style('general_css', THEME_DIR.'assets/css/general.css', array(), THEME_VERSION, 'all'); |
|
| 28 | 28 | |
| 29 | 29 | // wp_enqueue_style( 'general_css' ); |
| 30 | 30 | |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function enqueue_scripts() { |
| 37 | 37 | |
| 38 | - if ( Classy::get_config_var( 'environment' ) == 'production' ) { |
|
| 38 | + if (Classy::get_config_var('environment') == 'production') { |
|
| 39 | 39 | |
| 40 | - wp_register_script( 'theme_scripts', THEME_DIR . 'assets/js/min/production.js', array( 'jquery' ), THEME_VERSION, true ); |
|
| 40 | + wp_register_script('theme_scripts', THEME_DIR.'assets/js/min/production.js', array('jquery'), THEME_VERSION, true); |
|
| 41 | 41 | |
| 42 | 42 | } else { |
| 43 | 43 | |
| 44 | - wp_register_script( 'theme_scripts', THEME_DIR . 'assets/js/scripts.js', array( 'jquery' ), THEME_VERSION, true ); |
|
| 44 | + wp_register_script('theme_scripts', THEME_DIR.'assets/js/scripts.js', array('jquery'), THEME_VERSION, true); |
|
| 45 | 45 | |
| 46 | 46 | } |
| 47 | 47 | |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | public function init_js_vars() { |
| 56 | 56 | |
| 57 | 57 | $options = array( |
| 58 | - 'base_url' => home_url( '' ), |
|
| 59 | - 'blog_url' => home_url( 'archives/' ), |
|
| 58 | + 'base_url' => home_url(''), |
|
| 59 | + 'blog_url' => home_url('archives/'), |
|
| 60 | 60 | 'template_dir' => THEME_DIR, |
| 61 | - 'ajax_load_url' => admin_url( 'admin-ajax.php' ), |
|
| 61 | + 'ajax_load_url' => admin_url('admin-ajax.php'), |
|
| 62 | 62 | 'is_mobile' => (int) wp_is_mobile(), |
| 63 | 63 | ); |
| 64 | 64 | |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails |
| 87 | 87 | */ |
| 88 | 88 | |
| 89 | - add_theme_support( 'post-thumbnails' ); |
|
| 89 | + add_theme_support('post-thumbnails'); |
|
| 90 | 90 | |
| 91 | 91 | // This theme uses wp_nav_menu() in one location. |
| 92 | 92 | register_nav_menus(array( |
| 93 | - 'header-menu' => __( 'Header Menu', Classy::textdomain() ), |
|
| 94 | - 'footer-menu' => __( 'Footer Menu', Classy::textdomain() ), |
|
| 93 | + 'header-menu' => __('Header Menu', Classy::textdomain()), |
|
| 94 | + 'footer-menu' => __('Footer Menu', Classy::textdomain()), |
|
| 95 | 95 | )); |
| 96 | 96 | |
| 97 | 97 | /* |
@@ -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 | |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @param WP_Comment $item |
| 51 | 51 | */ |
| 52 | - public function __construct( $item ) { |
|
| 52 | + public function __construct($item) { |
|
| 53 | 53 | |
| 54 | - if ( is_a( $item, 'WP_Comment' ) ) { |
|
| 54 | + if (is_a($item, 'WP_Comment')) { |
|
| 55 | 55 | |
| 56 | - $this->import( $item ); |
|
| 56 | + $this->import($item); |
|
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
@@ -66,15 +66,15 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function author() { |
| 68 | 68 | |
| 69 | - if ( $this->user_id ) { |
|
| 69 | + if ($this->user_id) { |
|
| 70 | 70 | |
| 71 | - return new ClassyUser( $this->user_id ); |
|
| 71 | + return new ClassyUser($this->user_id); |
|
| 72 | 72 | |
| 73 | 73 | } else { |
| 74 | 74 | |
| 75 | - $author = new ClassyUser( 0 ); |
|
| 75 | + $author = new ClassyUser(0); |
|
| 76 | 76 | |
| 77 | - if ( isset( $this->comment_author ) && $this->comment_author ) { |
|
| 77 | + if (isset($this->comment_author) && $this->comment_author) { |
|
| 78 | 78 | |
| 79 | 79 | $author->name = $this->comment_author; |
| 80 | 80 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @return string |
| 92 | 92 | */ |
| 93 | 93 | public function content() { |
| 94 | - return apply_filters( 'get_comment_text ', $this->comment_content ); |
|
| 94 | + return apply_filters('get_comment_text ', $this->comment_content); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | * @param string $date_format |
| 110 | 110 | * @return string |
| 111 | 111 | */ |
| 112 | - public function date( $date_format = '' ) { |
|
| 113 | - $df = $date_format ? $date_format : get_option( 'date_format' ); |
|
| 114 | - $the_date = (string) mysql2date( $df, $this->comment_date ); |
|
| 112 | + public function date($date_format = '') { |
|
| 113 | + $df = $date_format ? $date_format : get_option('date_format'); |
|
| 114 | + $the_date = (string) mysql2date($df, $this->comment_date); |
|
| 115 | 115 | |
| 116 | - return apply_filters( 'get_comment_date ', $the_date, $df ); |
|
| 116 | + return apply_filters('get_comment_date ', $the_date, $df); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -132,26 +132,26 @@ discard block |
||
| 132 | 132 | * @param string $default |
| 133 | 133 | * @return string |
| 134 | 134 | */ |
| 135 | - public function avatar( $size = 92, $default = '' ) { |
|
| 135 | + public function avatar($size = 92, $default = '') { |
|
| 136 | 136 | |
| 137 | - if ( ! get_option( 'show_avatars' ) ) { |
|
| 137 | + if (!get_option('show_avatars')) { |
|
| 138 | 138 | return false; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if ( ! is_numeric( $size ) ) { $size = '92'; } |
|
| 141 | + if (!is_numeric($size)) { $size = '92'; } |
|
| 142 | 142 | |
| 143 | 143 | $email = $this->get_avatar_email(); |
| 144 | 144 | $email_hash = ''; |
| 145 | 145 | |
| 146 | - if ( ! empty( $email ) ) { |
|
| 147 | - $email_hash = md5( strtolower( trim( $email ) ) ); |
|
| 146 | + if (!empty($email)) { |
|
| 147 | + $email_hash = md5(strtolower(trim($email))); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - $host = $this->get_avatar_host( $email_hash ); |
|
| 151 | - $default = $this->get_default_avatar( $default, $email, $size, $host ); |
|
| 150 | + $host = $this->get_avatar_host($email_hash); |
|
| 151 | + $default = $this->get_default_avatar($default, $email, $size, $host); |
|
| 152 | 152 | |
| 153 | - if ( ! empty( $email ) ) { |
|
| 154 | - $avatar = $this->get_avatar_url( $default, $host, $email_hash, $size ); |
|
| 153 | + if (!empty($email)) { |
|
| 154 | + $avatar = $this->get_avatar_url($default, $host, $email_hash, $size); |
|
| 155 | 155 | } else { |
| 156 | 156 | $avatar = $default; |
| 157 | 157 | } |
@@ -168,9 +168,9 @@ discard block |
||
| 168 | 168 | protected function get_avatar_email() { |
| 169 | 169 | |
| 170 | 170 | $id = (int) $this->user_id; |
| 171 | - $user = get_userdata( $id ); |
|
| 171 | + $user = get_userdata($id); |
|
| 172 | 172 | |
| 173 | - if ( $user ) { |
|
| 173 | + if ($user) { |
|
| 174 | 174 | $email = $user->user_email; |
| 175 | 175 | } else { |
| 176 | 176 | $email = $this->comment_author_email; |
@@ -189,32 +189,32 @@ discard block |
||
| 189 | 189 | * @param string $host |
| 190 | 190 | * @return string |
| 191 | 191 | */ |
| 192 | - protected function get_default_avatar( $default, $email, $size, $host ) { |
|
| 192 | + protected function get_default_avatar($default, $email, $size, $host) { |
|
| 193 | 193 | |
| 194 | - if ( substr( $default, 0, 1 ) == '/' ) { |
|
| 195 | - $default = home_url() . $default; |
|
| 194 | + if (substr($default, 0, 1) == '/') { |
|
| 195 | + $default = home_url().$default; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if ( empty( $default ) ) { |
|
| 199 | - $avatar_default = get_option( 'avatar_default' ); |
|
| 200 | - if ( empty( $avatar_default ) ) { |
|
| 198 | + if (empty($default)) { |
|
| 199 | + $avatar_default = get_option('avatar_default'); |
|
| 200 | + if (empty($avatar_default)) { |
|
| 201 | 201 | $default = 'mystery'; |
| 202 | 202 | } else { |
| 203 | 203 | $default = $avatar_default; |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - if ( 'mystery' == $default ) { |
|
| 208 | - $default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size; |
|
| 207 | + if ('mystery' == $default) { |
|
| 208 | + $default = $host.'/avatar/ad516503a11cd5ca435acc9bb6523536?s='.$size; |
|
| 209 | 209 | // ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]') |
| 210 | - } else if ( 'blank' == $default ) { |
|
| 211 | - $default = $email ? 'blank' : includes_url( 'images/blank.gif' ); |
|
| 212 | - } else if ( ! empty( $email ) && 'gravatar_default' == $default ) { |
|
| 210 | + } else if ('blank' == $default) { |
|
| 211 | + $default = $email ? 'blank' : includes_url('images/blank.gif'); |
|
| 212 | + } else if (!empty($email) && 'gravatar_default' == $default) { |
|
| 213 | 213 | $default = ''; |
| 214 | - } else if ( 'gravatar_default' == $default ) { |
|
| 215 | - $default = $host . '/avatar/?s=' . $size; |
|
| 216 | - } else if ( empty( $email ) && ! strstr( $default, 'http://' ) ) { |
|
| 217 | - $default = $host . '/avatar/?d=' . $default . '&s=' . $size; |
|
| 214 | + } else if ('gravatar_default' == $default) { |
|
| 215 | + $default = $host.'/avatar/?s='.$size; |
|
| 216 | + } else if (empty($email) && !strstr($default, 'http://')) { |
|
| 217 | + $default = $host.'/avatar/?d='.$default.'&s='.$size; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | return $default; |
@@ -227,13 +227,13 @@ discard block |
||
| 227 | 227 | * @param string $email_hash |
| 228 | 228 | * @return string |
| 229 | 229 | */ |
| 230 | - protected function get_avatar_host( $email_hash ) { |
|
| 230 | + protected function get_avatar_host($email_hash) { |
|
| 231 | 231 | |
| 232 | - if ( is_ssl() ) { |
|
| 232 | + if (is_ssl()) { |
|
| 233 | 233 | $host = 'https://secure.gravatar.com'; |
| 234 | 234 | } else { |
| 235 | - if ( ! empty( $email_hash ) ) { |
|
| 236 | - $host = sprintf( 'http://%d.gravatar.com', (hexdec( $email_hash[0] ) % 2) ); |
|
| 235 | + if (!empty($email_hash)) { |
|
| 236 | + $host = sprintf('http://%d.gravatar.com', (hexdec($email_hash[0]) % 2)); |
|
| 237 | 237 | } else { |
| 238 | 238 | $host = 'http://0.gravatar.com'; |
| 239 | 239 | } |
@@ -252,16 +252,16 @@ discard block |
||
| 252 | 252 | * @param int $size |
| 253 | 253 | * @return string |
| 254 | 254 | */ |
| 255 | - protected function get_avatar_url( $default, $host, $email_hash, $size ) { |
|
| 255 | + protected function get_avatar_url($default, $host, $email_hash, $size) { |
|
| 256 | 256 | |
| 257 | - $_return = $host . '/avatar/' . $email_hash . '?s=' . $size . '&d=' . urlencode( $default ); |
|
| 258 | - $rating = get_option( 'avatar_rating' ); |
|
| 257 | + $_return = $host.'/avatar/'.$email_hash.'?s='.$size.'&d='.urlencode($default); |
|
| 258 | + $rating = get_option('avatar_rating'); |
|
| 259 | 259 | |
| 260 | - if ( ! empty( $rating ) ) { |
|
| 261 | - $_return .= '&r=' . $rating; |
|
| 260 | + if (!empty($rating)) { |
|
| 261 | + $_return .= '&r='.$rating; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - return str_replace( '&', '&', esc_url( $_return ) ); |
|
| 264 | + return str_replace('&', '&', esc_url($_return)); |
|
| 265 | 265 | |
| 266 | 266 | } |
| 267 | 267 | |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @param ClassyComment $comment |
| 272 | 272 | */ |
| 273 | - public function add_child( $comment ) { |
|
| 273 | + public function add_child($comment) { |
|
| 274 | 274 | |
| 275 | 275 | $this->children[] = $item; |
| 276 | 276 | $item->level = $this->level + 1; |
| 277 | 277 | |
| 278 | - if ( $item->children ) { |
|
| 278 | + if ($item->children) { |
|
| 279 | 279 | $this->update_child_levels(); |
| 280 | 280 | } |
| 281 | 281 | |
@@ -289,9 +289,9 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | protected function update_child_levels() { |
| 291 | 291 | |
| 292 | - if ( is_array( $this->children ) ) { |
|
| 292 | + if (is_array($this->children)) { |
|
| 293 | 293 | |
| 294 | - foreach ( $this->children as $child ) { |
|
| 294 | + foreach ($this->children as $child) { |
|
| 295 | 295 | $child->level = $this->level + 1; |
| 296 | 296 | $child->update_child_levels(); |
| 297 | 297 | } |
@@ -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 | |
@@ -152,7 +153,8 @@ discard block |
||
| 152 | 153 | |
| 153 | 154 | if ( ! empty( $email ) ) { |
| 154 | 155 | $avatar = $this->get_avatar_url( $default, $host, $email_hash, $size ); |
| 155 | - } else { |
|
| 156 | + } |
|
| 157 | + else { |
|
| 156 | 158 | $avatar = $default; |
| 157 | 159 | } |
| 158 | 160 | |
@@ -172,7 +174,8 @@ discard block |
||
| 172 | 174 | |
| 173 | 175 | if ( $user ) { |
| 174 | 176 | $email = $user->user_email; |
| 175 | - } else { |
|
| 177 | + } |
|
| 178 | + else { |
|
| 176 | 179 | $email = $this->comment_author_email; |
| 177 | 180 | } |
| 178 | 181 | |
@@ -199,7 +202,8 @@ discard block |
||
| 199 | 202 | $avatar_default = get_option( 'avatar_default' ); |
| 200 | 203 | if ( empty( $avatar_default ) ) { |
| 201 | 204 | $default = 'mystery'; |
| 202 | - } else { |
|
| 205 | + } |
|
| 206 | + else { |
|
| 203 | 207 | $default = $avatar_default; |
| 204 | 208 | } |
| 205 | 209 | } |
@@ -207,13 +211,17 @@ discard block |
||
| 207 | 211 | if ( 'mystery' == $default ) { |
| 208 | 212 | $default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size; |
| 209 | 213 | // ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]') |
| 210 | - } else if ( 'blank' == $default ) { |
|
| 214 | + } |
|
| 215 | + else if ( 'blank' == $default ) { |
|
| 211 | 216 | $default = $email ? 'blank' : includes_url( 'images/blank.gif' ); |
| 212 | - } else if ( ! empty( $email ) && 'gravatar_default' == $default ) { |
|
| 217 | + } |
|
| 218 | + else if ( ! empty( $email ) && 'gravatar_default' == $default ) { |
|
| 213 | 219 | $default = ''; |
| 214 | - } else if ( 'gravatar_default' == $default ) { |
|
| 220 | + } |
|
| 221 | + else if ( 'gravatar_default' == $default ) { |
|
| 215 | 222 | $default = $host . '/avatar/?s=' . $size; |
| 216 | - } else if ( empty( $email ) && ! strstr( $default, 'http://' ) ) { |
|
| 223 | + } |
|
| 224 | + else if ( empty( $email ) && ! strstr( $default, 'http://' ) ) { |
|
| 217 | 225 | $default = $host . '/avatar/?d=' . $default . '&s=' . $size; |
| 218 | 226 | } |
| 219 | 227 | |
@@ -231,10 +239,12 @@ discard block |
||
| 231 | 239 | |
| 232 | 240 | if ( is_ssl() ) { |
| 233 | 241 | $host = 'https://secure.gravatar.com'; |
| 234 | - } else { |
|
| 242 | + } |
|
| 243 | + else { |
|
| 235 | 244 | if ( ! empty( $email_hash ) ) { |
| 236 | 245 | $host = sprintf( 'http://%d.gravatar.com', (hexdec( $email_hash[0] ) % 2) ); |
| 237 | - } else { |
|
| 246 | + } |
|
| 247 | + else { |
|
| 238 | 248 | $host = 'http://0.gravatar.com'; |
| 239 | 249 | } |
| 240 | 250 | } |
@@ -43,7 +43,8 @@ |
||
| 43 | 43 | |
| 44 | 44 | wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/min/production.js', array( 'jquery' ), THEME_VERSION, true ); |
| 45 | 45 | |
| 46 | - } else { |
|
| 46 | + } |
|
| 47 | + else { |
|
| 47 | 48 | |
| 48 | 49 | wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/plugins.js', array( 'jquery' ), THEME_VERSION, true ); |
| 49 | 50 | |
@@ -43,6 +43,7 @@ |
||
| 43 | 43 | /** |
| 44 | 44 | * Extends Scope with scope that is defined in theme_name/scope folder |
| 45 | 45 | * |
| 46 | + * @param string|false $view_name |
|
| 46 | 47 | * @return array |
| 47 | 48 | */ |
| 48 | 49 | public static function extend_scope($scope, $view_name) { |
@@ -16,21 +16,21 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @return array |
| 18 | 18 | */ |
| 19 | - public static function get_scope( $view_name = null ) { |
|
| 19 | + public static function get_scope($view_name = null) { |
|
| 20 | 20 | |
| 21 | 21 | $scope = self::get_common_scope(); |
| 22 | 22 | |
| 23 | - if ( is_string( $view_name ) ) { |
|
| 23 | + if (is_string($view_name)) { |
|
| 24 | 24 | |
| 25 | - $scope = self::extend_scope( $scope, $view_name ); |
|
| 25 | + $scope = self::extend_scope($scope, $view_name); |
|
| 26 | 26 | |
| 27 | 27 | } else { |
| 28 | 28 | |
| 29 | 29 | $request = ClassyHierarchy::get_current_request(); |
| 30 | 30 | |
| 31 | - $file = ClassyHierarchy::get_available_file( 'scope', $request ); |
|
| 31 | + $file = ClassyHierarchy::get_available_file('scope', $request); |
|
| 32 | 32 | |
| 33 | - $scope = self::extend_scope( $scope, $file ); |
|
| 33 | + $scope = self::extend_scope($scope, $file); |
|
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @return array |
| 46 | 46 | */ |
| 47 | - public static function extend_scope( $scope, $view_name ) { |
|
| 47 | + public static function extend_scope($scope, $view_name) { |
|
| 48 | 48 | |
| 49 | - $scope = array_merge( $scope, self::require_scope( $view_name ) ); |
|
| 49 | + $scope = array_merge($scope, self::require_scope($view_name)); |
|
| 50 | 50 | |
| 51 | 51 | return $scope; |
| 52 | 52 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public static function get_common_scope() { |
| 62 | 62 | |
| 63 | - if ( null === self::$common ) { |
|
| 63 | + if (null === self::$common) { |
|
| 64 | 64 | |
| 65 | - self::$common = self::require_scope( 'common' ); |
|
| 65 | + self::$common = self::require_scope('common'); |
|
| 66 | 66 | |
| 67 | 67 | } |
| 68 | 68 | |
@@ -76,19 +76,19 @@ discard block |
||
| 76 | 76 | * @param string $filename |
| 77 | 77 | * @return array |
| 78 | 78 | */ |
| 79 | - public static function require_scope( $filename ) { |
|
| 79 | + public static function require_scope($filename) { |
|
| 80 | 80 | |
| 81 | 81 | $_return = array(); |
| 82 | 82 | |
| 83 | - $file = ClassyHierarchy::get_file_path( 'scope', $filename ); |
|
| 83 | + $file = ClassyHierarchy::get_file_path('scope', $filename); |
|
| 84 | 84 | |
| 85 | - if ( file_exists( $file ) ) { |
|
| 85 | + if (file_exists($file)) { |
|
| 86 | 86 | |
| 87 | 87 | require $file; |
| 88 | 88 | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if ( isset( $data ) ) { |
|
| 91 | + if (isset($data)) { |
|
| 92 | 92 | |
| 93 | 93 | $_return = $data; |
| 94 | 94 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * Checks if view exists |
| 111 | 111 | * |
| 112 | 112 | * @param string $type view/scope |
| 113 | - * @param string $view in blade path format, ex: layout/header |
|
| 113 | + * @param string|false $file |
|
| 114 | 114 | * @return boolean true/false |
| 115 | 115 | */ |
| 116 | 116 | public static function file_exists( $type = 'view', $file ) { |
@@ -129,7 +129,8 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @param string $type view/scope |
| 131 | 131 | * @param string $type |
| 132 | - * @return array |
|
| 132 | + * @param string $page |
|
| 133 | + * @return string|false |
|
| 133 | 134 | */ |
| 134 | 135 | public static function get_available_file( $type = 'view', $page ) { |
| 135 | 136 | |
@@ -370,7 +371,7 @@ discard block |
||
| 370 | 371 | /** |
| 371 | 372 | * Returns classy template name or boolean if this is not classy template |
| 372 | 373 | * |
| 373 | - * @return mixed |
|
| 374 | + * @return string|false |
|
| 374 | 375 | */ |
| 375 | 376 | public static function get_classy_template() { |
| 376 | 377 | |
@@ -54,9 +54,11 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | elseif ( is_paged() ) : return 'paged'; |
| 56 | 56 | |
| 57 | - else : |
|
| 57 | + else { |
|
| 58 | + : |
|
| 58 | 59 | |
| 59 | 60 | return 'index'; |
| 61 | + } |
|
| 60 | 62 | |
| 61 | 63 | endif; |
| 62 | 64 | |
@@ -95,7 +97,8 @@ discard block |
||
| 95 | 97 | |
| 96 | 98 | return THEME_PATH . $folder . '/' . $view . '.blade.php'; |
| 97 | 99 | |
| 98 | - } elseif ( 'scope' == $type ) { |
|
| 100 | + } |
|
| 101 | + elseif ( 'scope' == $type ) { |
|
| 99 | 102 | |
| 100 | 103 | $folder = ClassyScope::$folder; |
| 101 | 104 | |
@@ -232,7 +235,8 @@ discard block |
||
| 232 | 235 | |
| 233 | 236 | list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); |
| 234 | 237 | |
| 235 | - } else { |
|
| 238 | + } |
|
| 239 | + else { |
|
| 236 | 240 | |
| 237 | 241 | list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); |
| 238 | 242 | |
@@ -343,9 +347,11 @@ discard block |
||
| 343 | 347 | |
| 344 | 348 | // Default |
| 345 | 349 | |
| 346 | - else : |
|
| 350 | + else { |
|
| 351 | + : |
|
| 347 | 352 | |
| 348 | 353 | $views[] = $type; |
| 354 | + } |
|
| 349 | 355 | |
| 350 | 356 | endif; |
| 351 | 357 | |
@@ -20,39 +20,39 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | protected static function check_request() { |
| 22 | 22 | |
| 23 | - if ( is_404() ) : return '404'; |
|
| 23 | + if (is_404()) : return '404'; |
|
| 24 | 24 | |
| 25 | - elseif ( is_search() ) : return 'search'; |
|
| 25 | + elseif (is_search()) : return 'search'; |
|
| 26 | 26 | |
| 27 | - elseif ( is_front_page() ) : return 'front-page'; |
|
| 27 | + elseif (is_front_page()) : return 'front-page'; |
|
| 28 | 28 | |
| 29 | - elseif ( is_home() ) : return 'home'; |
|
| 29 | + elseif (is_home()) : return 'home'; |
|
| 30 | 30 | |
| 31 | - elseif ( is_post_type_archive() ) : return 'post_type_archive'; |
|
| 31 | + elseif (is_post_type_archive()) : return 'post_type_archive'; |
|
| 32 | 32 | |
| 33 | - elseif ( is_tax() ) : return 'taxonomy'; |
|
| 33 | + elseif (is_tax()) : return 'taxonomy'; |
|
| 34 | 34 | |
| 35 | - elseif ( is_attachment() ) : return 'attachment'; |
|
| 35 | + elseif (is_attachment()) : return 'attachment'; |
|
| 36 | 36 | |
| 37 | - elseif ( is_single() ) : return 'single'; |
|
| 37 | + elseif (is_single()) : return 'single'; |
|
| 38 | 38 | |
| 39 | - elseif ( self::is_classy_template() ) : return 'classy-template'; |
|
| 39 | + elseif (self::is_classy_template()) : return 'classy-template'; |
|
| 40 | 40 | |
| 41 | - elseif ( is_page() ) : return 'page'; |
|
| 41 | + elseif (is_page()) : return 'page'; |
|
| 42 | 42 | |
| 43 | - elseif ( is_singular() ) : return 'singular'; |
|
| 43 | + elseif (is_singular()) : return 'singular'; |
|
| 44 | 44 | |
| 45 | - elseif ( is_category() ) : return 'category'; |
|
| 45 | + elseif (is_category()) : return 'category'; |
|
| 46 | 46 | |
| 47 | - elseif ( is_tag() ) : return 'tag'; |
|
| 47 | + elseif (is_tag()) : return 'tag'; |
|
| 48 | 48 | |
| 49 | - elseif ( is_author() ) : return 'author'; |
|
| 49 | + elseif (is_author()) : return 'author'; |
|
| 50 | 50 | |
| 51 | - elseif ( is_date() ) : return 'date'; |
|
| 51 | + elseif (is_date()) : return 'date'; |
|
| 52 | 52 | |
| 53 | - elseif ( is_archive() ) : return 'archive'; |
|
| 53 | + elseif (is_archive()) : return 'archive'; |
|
| 54 | 54 | |
| 55 | - elseif ( is_paged() ) : return 'paged'; |
|
| 55 | + elseif (is_paged()) : return 'paged'; |
|
| 56 | 56 | |
| 57 | 57 | else : |
| 58 | 58 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public static function get_current_request() { |
| 71 | 71 | |
| 72 | - if ( null === self::$current_request ) { |
|
| 72 | + if (null === self::$current_request) { |
|
| 73 | 73 | |
| 74 | 74 | self::$current_request = self::check_request(); |
| 75 | 75 | |
@@ -87,21 +87,21 @@ discard block |
||
| 87 | 87 | * @param string $view path to view ex: "post/archive" |
| 88 | 88 | * @return string full fule path |
| 89 | 89 | */ |
| 90 | - public static function get_file_path( $type = 'view', $view ) { |
|
| 90 | + public static function get_file_path($type = 'view', $view) { |
|
| 91 | 91 | |
| 92 | - $view = str_replace( '.', '/', $view ); |
|
| 92 | + $view = str_replace('.', '/', $view); |
|
| 93 | 93 | |
| 94 | - if ( 'view' == $type ) { |
|
| 94 | + if ('view' == $type) { |
|
| 95 | 95 | |
| 96 | 96 | $folder = ClassyView::$folder; |
| 97 | 97 | |
| 98 | - return THEME_PATH . $folder . '/' . $view . '.blade.php'; |
|
| 98 | + return THEME_PATH.$folder.'/'.$view.'.blade.php'; |
|
| 99 | 99 | |
| 100 | - } elseif ( 'scope' == $type ) { |
|
| 100 | + } elseif ('scope' == $type) { |
|
| 101 | 101 | |
| 102 | 102 | $folder = ClassyScope::$folder; |
| 103 | 103 | |
| 104 | - return THEME_PATH . $folder . '/' . $view . '.php'; |
|
| 104 | + return THEME_PATH.$folder.'/'.$view.'.php'; |
|
| 105 | 105 | |
| 106 | 106 | } |
| 107 | 107 | |
@@ -115,13 +115,13 @@ discard block |
||
| 115 | 115 | * @param string $view in blade path format, ex: layout/header |
| 116 | 116 | * @return boolean true/false |
| 117 | 117 | */ |
| 118 | - public static function file_exists( $type = 'view', $file ) { |
|
| 118 | + public static function file_exists($type = 'view', $file) { |
|
| 119 | 119 | |
| 120 | - $file = str_replace( '.', '/', $file ); |
|
| 120 | + $file = str_replace('.', '/', $file); |
|
| 121 | 121 | |
| 122 | - $file_path = self::get_file_path( $type, $file ); |
|
| 122 | + $file_path = self::get_file_path($type, $file); |
|
| 123 | 123 | |
| 124 | - return file_exists( $file_path ); |
|
| 124 | + return file_exists($file_path); |
|
| 125 | 125 | |
| 126 | 126 | } |
| 127 | 127 | |
@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | * @param string $type |
| 134 | 134 | * @return array |
| 135 | 135 | */ |
| 136 | - public static function get_available_file( $type = 'view', $page ) { |
|
| 136 | + public static function get_available_file($type = 'view', $page) { |
|
| 137 | 137 | |
| 138 | - $views = self::get_request_hierarchy_list( $page ); |
|
| 138 | + $views = self::get_request_hierarchy_list($page); |
|
| 139 | 139 | |
| 140 | - foreach ( $views as $view ) { |
|
| 140 | + foreach ($views as $view) { |
|
| 141 | 141 | |
| 142 | - if ( self::file_exists( $type, $view ) ) : |
|
| 142 | + if (self::file_exists($type, $view)) : |
|
| 143 | 143 | |
| 144 | 144 | return $view; |
| 145 | 145 | |
@@ -158,43 +158,43 @@ discard block |
||
| 158 | 158 | * @param string $type |
| 159 | 159 | * @return array |
| 160 | 160 | */ |
| 161 | - private static function get_request_hierarchy_list( $type ) { |
|
| 161 | + private static function get_request_hierarchy_list($type) { |
|
| 162 | 162 | |
| 163 | 163 | $views = array(); |
| 164 | 164 | |
| 165 | 165 | // Home |
| 166 | 166 | |
| 167 | - if ( 'home' == $type ) : |
|
| 167 | + if ('home' == $type) : |
|
| 168 | 168 | |
| 169 | 169 | $views[] = 'home'; |
| 170 | 170 | |
| 171 | 171 | // Single |
| 172 | 172 | |
| 173 | - elseif ( 'single' == $type ) : |
|
| 173 | + elseif ('single' == $type) : |
|
| 174 | 174 | |
| 175 | 175 | $post_type = get_post_type(); |
| 176 | 176 | |
| 177 | - $views[] = $post_type . '.single'; |
|
| 177 | + $views[] = $post_type.'.single'; |
|
| 178 | 178 | |
| 179 | 179 | $views[] = 'single'; |
| 180 | 180 | |
| 181 | 181 | // Post type |
| 182 | 182 | |
| 183 | - elseif ( 'post_type_archive' == $type ) : |
|
| 183 | + elseif ('post_type_archive' == $type) : |
|
| 184 | 184 | |
| 185 | 185 | $post_type = get_post_type(); |
| 186 | 186 | |
| 187 | - $views[] = $post_type . '.archive'; |
|
| 187 | + $views[] = $post_type.'.archive'; |
|
| 188 | 188 | |
| 189 | 189 | $views[] = 'archive'; |
| 190 | 190 | |
| 191 | 191 | // Taxonomy |
| 192 | 192 | |
| 193 | - elseif ( 'taxonomy' == $type ) : |
|
| 193 | + elseif ('taxonomy' == $type) : |
|
| 194 | 194 | |
| 195 | 195 | $term = get_queried_object(); |
| 196 | 196 | |
| 197 | - if ( ! empty( $term->slug ) ) { |
|
| 197 | + if (!empty($term->slug)) { |
|
| 198 | 198 | |
| 199 | 199 | $taxonomy = $term->taxonomy; |
| 200 | 200 | |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | // Category |
| 211 | 211 | |
| 212 | - elseif ( 'category' == $type ) : |
|
| 212 | + elseif ('category' == $type) : |
|
| 213 | 213 | |
| 214 | 214 | $category = get_queried_object(); |
| 215 | 215 | |
| 216 | - if ( ! empty( $category->slug ) ) { |
|
| 216 | + if (!empty($category->slug)) { |
|
| 217 | 217 | $views[] = "category.{$category->slug}"; |
| 218 | 218 | $views[] = "category.{$category->term_id}"; |
| 219 | 219 | } |
@@ -224,23 +224,23 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | // Attachment |
| 226 | 226 | |
| 227 | - elseif ( 'attachment' == $type ) : |
|
| 227 | + elseif ('attachment' == $type) : |
|
| 228 | 228 | |
| 229 | 229 | $attachment = get_queried_object(); |
| 230 | 230 | |
| 231 | - if ( $attachment ) { |
|
| 231 | + if ($attachment) { |
|
| 232 | 232 | |
| 233 | - if ( false !== strpos( $attachment->post_mime_type, '/' ) ) { |
|
| 233 | + if (false !== strpos($attachment->post_mime_type, '/')) { |
|
| 234 | 234 | |
| 235 | - list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); |
|
| 235 | + list($type, $subtype) = explode('/', $attachment->post_mime_type); |
|
| 236 | 236 | |
| 237 | 237 | } else { |
| 238 | 238 | |
| 239 | - list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); |
|
| 239 | + list($type, $subtype) = array($attachment->post_mime_type, ''); |
|
| 240 | 240 | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - if ( ! empty( $subtype ) ) { |
|
| 243 | + if (!empty($subtype)) { |
|
| 244 | 244 | $views[] = "attachment.{$type}.{$subtype}"; |
| 245 | 245 | $views[] = "attachment.{$subtype}"; |
| 246 | 246 | |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | // Tag |
| 261 | 261 | |
| 262 | - elseif ( 'tag' == $type ) : |
|
| 262 | + elseif ('tag' == $type) : |
|
| 263 | 263 | |
| 264 | 264 | $tag = get_queried_object(); |
| 265 | 265 | |
| 266 | - if ( ! empty( $tag->slug ) ) { |
|
| 266 | + if (!empty($tag->slug)) { |
|
| 267 | 267 | $views[] = "post.tag.{$tag->slug}"; |
| 268 | 268 | $views[] = "post.tag.{$tag->term_id}"; |
| 269 | 269 | |
@@ -276,11 +276,11 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | // Author |
| 278 | 278 | |
| 279 | - elseif ( 'author' == $type ) : |
|
| 279 | + elseif ('author' == $type) : |
|
| 280 | 280 | |
| 281 | 281 | $author = get_queried_object(); |
| 282 | 282 | |
| 283 | - if ( $author instanceof WP_User ) { |
|
| 283 | + if ($author instanceof WP_User) { |
|
| 284 | 284 | $views[] = "post.author.{$author->user_nicename}"; |
| 285 | 285 | $views[] = "post.author.{$author->ID}"; |
| 286 | 286 | |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | // Front Page |
| 296 | 296 | |
| 297 | - elseif ( 'front-page' == $type ) : |
|
| 297 | + elseif ('front-page' == $type) : |
|
| 298 | 298 | |
| 299 | 299 | $views[] = 'front-page.front-page'; |
| 300 | 300 | $views[] = 'front-page'; |
@@ -302,41 +302,41 @@ discard block |
||
| 302 | 302 | $views[] = 'home.home'; |
| 303 | 303 | $views[] = 'home'; |
| 304 | 304 | |
| 305 | - $views = array_merge( $views, self::get_request_hierarchy_list( 'post_type_archive' ) ); |
|
| 305 | + $views = array_merge($views, self::get_request_hierarchy_list('post_type_archive')); |
|
| 306 | 306 | |
| 307 | 307 | // Page |
| 308 | 308 | |
| 309 | - elseif ( 'classy-template' == $type ) : |
|
| 309 | + elseif ('classy-template' == $type) : |
|
| 310 | 310 | |
| 311 | 311 | $template = self::get_classy_template(); |
| 312 | 312 | |
| 313 | 313 | $views[] = $template; |
| 314 | 314 | |
| 315 | - $views[] = 'page.' . $template; |
|
| 315 | + $views[] = 'page.'.$template; |
|
| 316 | 316 | |
| 317 | - $views[] = 'template.' . $template; |
|
| 317 | + $views[] = 'template.'.$template; |
|
| 318 | 318 | |
| 319 | - elseif ( 'page' == $type ) : |
|
| 319 | + elseif ('page' == $type) : |
|
| 320 | 320 | |
| 321 | 321 | $id = get_queried_object_id(); |
| 322 | 322 | |
| 323 | - $pagename = get_query_var( 'pagename' ); |
|
| 323 | + $pagename = get_query_var('pagename'); |
|
| 324 | 324 | |
| 325 | - if ( ! $pagename && $id ) { |
|
| 325 | + if (!$pagename && $id) { |
|
| 326 | 326 | // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object |
| 327 | 327 | $post = get_queried_object(); |
| 328 | 328 | |
| 329 | - if ( $post ) { |
|
| 329 | + if ($post) { |
|
| 330 | 330 | $pagename = $post->post_name; |
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if ( $pagename ) { |
|
| 335 | - $views[] = 'page.' . $pagename; |
|
| 334 | + if ($pagename) { |
|
| 335 | + $views[] = 'page.'.$pagename; |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - if ( $id ) { |
|
| 339 | - $views[] = 'page.' . $id; |
|
| 338 | + if ($id) { |
|
| 339 | + $views[] = 'page.'.$id; |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | $views[] = 'page.page'; |
@@ -378,9 +378,9 @@ discard block |
||
| 378 | 378 | |
| 379 | 379 | $template_slug = get_page_template_slug(); |
| 380 | 380 | |
| 381 | - preg_match( '/classy\-(.*)/', $template_slug, $matches ); |
|
| 381 | + preg_match('/classy\-(.*)/', $template_slug, $matches); |
|
| 382 | 382 | |
| 383 | - if ( $matches && isset( $matches[1] ) ) { return $matches[1]; } |
|
| 383 | + if ($matches && isset($matches[1])) { return $matches[1]; } |
|
| 384 | 384 | |
| 385 | 385 | return false; |
| 386 | 386 | |
@@ -1,1 +1,1 @@ |
||
| 1 | -<?php Classy::render( 'layout.footer' ); ?> |
|
| 2 | 1 | \ No newline at end of file |
| 2 | +<?php Classy::render('layout.footer'); ?> |
|
| 3 | 3 | \ No newline at end of file |
@@ -73,12 +73,12 @@ discard block |
||
| 73 | 73 | * Main constructor function. If ID won't be provided we will try to find it, based on your query |
| 74 | 74 | * @param object/int $post |
| 75 | 75 | */ |
| 76 | - public function __construct( $post = null ) { |
|
| 77 | - if ( is_integer( $post ) ) { |
|
| 76 | + public function __construct($post = null) { |
|
| 77 | + if (is_integer($post)) { |
|
| 78 | 78 | $this->ID = $post; |
| 79 | 79 | $this->init(); |
| 80 | - } elseif ( is_a( $post, 'WP_Post' ) ) { |
|
| 81 | - $this->import( $post ); |
|
| 80 | + } elseif (is_a($post, 'WP_Post')) { |
|
| 81 | + $this->import($post); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | protected function init() { |
| 89 | 89 | $post = $this->get_object(); |
| 90 | 90 | |
| 91 | - if ( is_a( $post, 'WP_Post' ) ) { |
|
| 92 | - $this->import( $post ); |
|
| 91 | + if (is_a($post, 'WP_Post')) { |
|
| 92 | + $this->import($post); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | |
| 102 | 102 | public function get_object() { |
| 103 | - $object = get_post( $this->ID ); |
|
| 103 | + $object = get_post($this->ID); |
|
| 104 | 104 | |
| 105 | 105 | return $object; |
| 106 | 106 | } |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | * @return boolean |
| 112 | 112 | */ |
| 113 | 113 | public function can_edit() { |
| 114 | - if ( ! function_exists( 'current_user_can' ) ) { |
|
| 114 | + if (!function_exists('current_user_can')) { |
|
| 115 | 115 | return false; |
| 116 | 116 | } |
| 117 | - if ( current_user_can( 'edit_post', $this->ID ) ) { |
|
| 117 | + if (current_user_can('edit_post', $this->ID)) { |
|
| 118 | 118 | return true; |
| 119 | 119 | } |
| 120 | 120 | return false; |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | * @return string |
| 127 | 127 | */ |
| 128 | 128 | public function get_edit_url() { |
| 129 | - if ( $this->can_edit() ) { |
|
| 130 | - return get_edit_post_link( $this->ID ); |
|
| 129 | + if ($this->can_edit()) { |
|
| 130 | + return get_edit_post_link($this->ID); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | * @return ClassyImage |
| 139 | 139 | */ |
| 140 | 140 | public function get_thumbnail() { |
| 141 | - if ( function_exists( 'get_post_thumbnail_id' ) ) { |
|
| 142 | - $image_id = get_post_thumbnail_id( $this->ID ); |
|
| 141 | + if (function_exists('get_post_thumbnail_id')) { |
|
| 142 | + $image_id = get_post_thumbnail_id($this->ID); |
|
| 143 | 143 | |
| 144 | - if ( $image_id ) { |
|
| 145 | - return new ClassyImage( $image_id ); |
|
| 144 | + if ($image_id) { |
|
| 145 | + return new ClassyImage($image_id); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @return string |
| 155 | 155 | */ |
| 156 | 156 | public function get_title() { |
| 157 | - return apply_filters( 'the_title', $this->post_title, $this->ID ); |
|
| 157 | + return apply_filters('the_title', $this->post_title, $this->ID); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -173,24 +173,24 @@ discard block |
||
| 173 | 173 | * @param integer $page Page number, in case our post has <!--nextpage--> tags |
| 174 | 174 | * @return string Post content |
| 175 | 175 | */ |
| 176 | - public function get_content( $page = 0 ) { |
|
| 177 | - if ( 0 == $page && $this->post_content ) { |
|
| 176 | + public function get_content($page = 0) { |
|
| 177 | + if (0 == $page && $this->post_content) { |
|
| 178 | 178 | return $this->post_content; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | $content = $this->post_content; |
| 182 | 182 | |
| 183 | - if ( $page ) { |
|
| 184 | - $contents = explode( '<!--nextpage-->', $content ); |
|
| 183 | + if ($page) { |
|
| 184 | + $contents = explode('<!--nextpage-->', $content); |
|
| 185 | 185 | |
| 186 | 186 | $page--; |
| 187 | 187 | |
| 188 | - if ( count( $contents ) > $page ) { |
|
| 189 | - $content = $contents[ $page ]; |
|
| 188 | + if (count($contents) > $page) { |
|
| 189 | + $content = $contents[$page]; |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - $content = apply_filters( 'the_content', ($content) ); |
|
| 193 | + $content = apply_filters('the_content', ($content)); |
|
| 194 | 194 | |
| 195 | 195 | return $content; |
| 196 | 196 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @return object |
| 212 | 212 | */ |
| 213 | 213 | public function get_post_type() { |
| 214 | - return get_post_type_object( $this->post_type ); |
|
| 214 | + return get_post_type_object($this->post_type); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | * @return string |
| 221 | 221 | */ |
| 222 | 222 | public function get_permalink() { |
| 223 | - if ( isset( $this->permalink ) ) { |
|
| 223 | + if (isset($this->permalink)) { |
|
| 224 | 224 | return $this->permalink; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - $this->permalink = get_permalink( $this->ID ); |
|
| 227 | + $this->permalink = get_permalink($this->ID); |
|
| 228 | 228 | |
| 229 | 229 | return $this->permalink; |
| 230 | 230 | } |
@@ -250,91 +250,91 @@ discard block |
||
| 250 | 250 | * @param boolean $strip Should we strip tags? |
| 251 | 251 | * @return string Post preview |
| 252 | 252 | */ |
| 253 | - public function get_preview( $len = 50, $force = false, $readmore = 'Read More', $strip = true ) { |
|
| 253 | + public function get_preview($len = 50, $force = false, $readmore = 'Read More', $strip = true) { |
|
| 254 | 254 | $text = ''; |
| 255 | 255 | $trimmed = false; |
| 256 | 256 | |
| 257 | - if ( isset( $this->post_excerpt ) && strlen( $this->post_excerpt ) ) { |
|
| 257 | + if (isset($this->post_excerpt) && strlen($this->post_excerpt)) { |
|
| 258 | 258 | |
| 259 | - if ( $force ) { |
|
| 260 | - $text = ClassyHelper::trim_words( $this->post_excerpt, $len, false ); |
|
| 259 | + if ($force) { |
|
| 260 | + $text = ClassyHelper::trim_words($this->post_excerpt, $len, false); |
|
| 261 | 261 | $trimmed = true; |
| 262 | 262 | } else { |
| 263 | 263 | $text = $this->post_excerpt; |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - if ( ! strlen( $text ) && preg_match( '/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches ) ) { |
|
| 267 | + if (!strlen($text) && preg_match('/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches)) { |
|
| 268 | 268 | |
| 269 | - $pieces = explode( $readmore_matches[0], $this->post_content ); |
|
| 269 | + $pieces = explode($readmore_matches[0], $this->post_content); |
|
| 270 | 270 | $text = $pieces[0]; |
| 271 | 271 | |
| 272 | - if ( $force ) { |
|
| 273 | - $text = ClassyHelper::trim_words( $text, $len, false ); |
|
| 272 | + if ($force) { |
|
| 273 | + $text = ClassyHelper::trim_words($text, $len, false); |
|
| 274 | 274 | $trimmed = true; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - $text = do_shortcode( $text ); |
|
| 277 | + $text = do_shortcode($text); |
|
| 278 | 278 | |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - if ( ! strlen( $text ) ) { |
|
| 281 | + if (!strlen($text)) { |
|
| 282 | 282 | |
| 283 | - $text = ClassyHelper::trim_words( $this->get_content(), $len, false ); |
|
| 283 | + $text = ClassyHelper::trim_words($this->get_content(), $len, false); |
|
| 284 | 284 | $trimmed = true; |
| 285 | 285 | |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - if ( ! strlen( trim( $text ) ) ) { |
|
| 288 | + if (!strlen(trim($text))) { |
|
| 289 | 289 | |
| 290 | - return trim( $text ); |
|
| 290 | + return trim($text); |
|
| 291 | 291 | |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - if ( $strip ) { |
|
| 294 | + if ($strip) { |
|
| 295 | 295 | |
| 296 | - $text = trim( strip_tags( $text ) ); |
|
| 296 | + $text = trim(strip_tags($text)); |
|
| 297 | 297 | |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - if ( strlen( $text ) ) { |
|
| 300 | + if (strlen($text)) { |
|
| 301 | 301 | |
| 302 | - $text = trim( $text ); |
|
| 303 | - $last = $text[ strlen( $text ) - 1 ]; |
|
| 302 | + $text = trim($text); |
|
| 303 | + $last = $text[strlen($text) - 1]; |
|
| 304 | 304 | |
| 305 | - if ( '.' != $last && $trimmed ) { |
|
| 305 | + if ('.' != $last && $trimmed) { |
|
| 306 | 306 | $text .= ' … '; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - if ( ! $strip ) { |
|
| 310 | - $last_p_tag = strrpos( $text, '</p>' ); |
|
| 311 | - if ( false !== $last_p_tag ) { |
|
| 312 | - $text = substr( $text, 0, $last_p_tag ); |
|
| 309 | + if (!$strip) { |
|
| 310 | + $last_p_tag = strrpos($text, '</p>'); |
|
| 311 | + if (false !== $last_p_tag) { |
|
| 312 | + $text = substr($text, 0, $last_p_tag); |
|
| 313 | 313 | } |
| 314 | - if ( '.' != $last && $trimmed ) { |
|
| 314 | + if ('.' != $last && $trimmed) { |
|
| 315 | 315 | $text .= ' … '; |
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - if ( $readmore && isset( $readmore_matches ) && ! empty( $readmore_matches[1] ) ) { |
|
| 320 | - $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore_matches[1] ) . '</a>'; |
|
| 321 | - } elseif ( $readmore ) { |
|
| 322 | - $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore ) . '</a>'; |
|
| 319 | + if ($readmore && isset($readmore_matches) && !empty($readmore_matches[1])) { |
|
| 320 | + $text .= ' <a href="'.$this->get_permalink().'" class="read-more">'.trim($readmore_matches[1]).'</a>'; |
|
| 321 | + } elseif ($readmore) { |
|
| 322 | + $text .= ' <a href="'.$this->get_permalink().'" class="read-more">'.trim($readmore).'</a>'; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - if ( ! $strip ) { |
|
| 325 | + if (!$strip) { |
|
| 326 | 326 | $text .= '</p>'; |
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - return trim( $text ); |
|
| 330 | + return trim($text); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
| 334 | 334 | * Returns comments array |
| 335 | 335 | * @return array |
| 336 | 336 | */ |
| 337 | - public function get_comments( $status = 'approve', $order = 'DESC' ) { |
|
| 337 | + public function get_comments($status = 'approve', $order = 'DESC') { |
|
| 338 | 338 | |
| 339 | 339 | $_return = array(); |
| 340 | 340 | |
@@ -344,26 +344,26 @@ discard block |
||
| 344 | 344 | 'order' => $order, |
| 345 | 345 | ); |
| 346 | 346 | |
| 347 | - $comments = get_comments( $args ); |
|
| 347 | + $comments = get_comments($args); |
|
| 348 | 348 | |
| 349 | - foreach ( $comments as $comment ) { |
|
| 349 | + foreach ($comments as $comment) { |
|
| 350 | 350 | |
| 351 | - $_return[ $comment->comment_ID ] = new ClassyComment( $comment ); |
|
| 351 | + $_return[$comment->comment_ID] = new ClassyComment($comment); |
|
| 352 | 352 | |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - foreach ( $_return as $key => $comment ) { |
|
| 355 | + foreach ($_return as $key => $comment) { |
|
| 356 | 356 | |
| 357 | - if ( $comment->has_parent() ) { |
|
| 357 | + if ($comment->has_parent()) { |
|
| 358 | 358 | |
| 359 | - $_return[ $comment->comment_parent ]->add_child( $comment ); |
|
| 359 | + $_return[$comment->comment_parent]->add_child($comment); |
|
| 360 | 360 | |
| 361 | - unset( $_return[ $key ] ); |
|
| 361 | + unset($_return[$key]); |
|
| 362 | 362 | |
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - return array_values( $_return ); |
|
| 366 | + return array_values($_return); |
|
| 367 | 367 | |
| 368 | 368 | } |
| 369 | 369 | } |
@@ -77,7 +77,8 @@ discard block |
||
| 77 | 77 | if ( is_integer( $post ) ) { |
| 78 | 78 | $this->ID = $post; |
| 79 | 79 | $this->init(); |
| 80 | - } elseif ( is_a( $post, 'WP_Post' ) ) { |
|
| 80 | + } |
|
| 81 | + elseif ( is_a( $post, 'WP_Post' ) ) { |
|
| 81 | 82 | $this->import( $post ); |
| 82 | 83 | } |
| 83 | 84 | } |
@@ -259,7 +260,8 @@ discard block |
||
| 259 | 260 | if ( $force ) { |
| 260 | 261 | $text = ClassyHelper::trim_words( $this->post_excerpt, $len, false ); |
| 261 | 262 | $trimmed = true; |
| 262 | - } else { |
|
| 263 | + } |
|
| 264 | + else { |
|
| 263 | 265 | $text = $this->post_excerpt; |
| 264 | 266 | } |
| 265 | 267 | } |
@@ -318,7 +320,8 @@ discard block |
||
| 318 | 320 | |
| 319 | 321 | if ( $readmore && isset( $readmore_matches ) && ! empty( $readmore_matches[1] ) ) { |
| 320 | 322 | $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore_matches[1] ) . '</a>'; |
| 321 | - } elseif ( $readmore ) { |
|
| 323 | + } |
|
| 324 | + elseif ( $readmore ) { |
|
| 322 | 325 | $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore ) . '</a>'; |
| 323 | 326 | } |
| 324 | 327 | |