@@ -8,34 +8,34 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( empty( $_REQUEST['tag_ID'] ) ) { |
|
14 | - $sendback = admin_url( 'edit-tags.php' ); |
|
15 | - if ( ! empty( $taxnow ) ) { |
|
16 | - $sendback = add_query_arg( array( 'taxonomy' => $taxnow ), $sendback ); |
|
13 | +if (empty($_REQUEST['tag_ID'])) { |
|
14 | + $sendback = admin_url('edit-tags.php'); |
|
15 | + if ( ! empty($taxnow)) { |
|
16 | + $sendback = add_query_arg(array('taxonomy' => $taxnow), $sendback); |
|
17 | 17 | } |
18 | - wp_redirect( esc_url( $sendback ) ); |
|
18 | + wp_redirect(esc_url($sendback)); |
|
19 | 19 | exit; |
20 | 20 | } |
21 | 21 | |
22 | -$tag_ID = absint( $_REQUEST['tag_ID'] ); |
|
23 | -$tag = get_term( $tag_ID, $taxnow, OBJECT, 'edit' ); |
|
22 | +$tag_ID = absint($_REQUEST['tag_ID']); |
|
23 | +$tag = get_term($tag_ID, $taxnow, OBJECT, 'edit'); |
|
24 | 24 | |
25 | -if ( ! $tag instanceof WP_Term ) { |
|
26 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
25 | +if ( ! $tag instanceof WP_Term) { |
|
26 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
27 | 27 | } |
28 | 28 | |
29 | -$tax = get_taxonomy( $tag->taxonomy ); |
|
29 | +$tax = get_taxonomy($tag->taxonomy); |
|
30 | 30 | $taxonomy = $tax->name; |
31 | 31 | $title = $tax->labels->edit_item; |
32 | 32 | |
33 | -if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ) ) || |
|
34 | - ! current_user_can( $tax->cap->manage_terms ) |
|
33 | +if ( ! in_array($taxonomy, get_taxonomies(array('show_ui' => true))) || |
|
34 | + ! current_user_can($tax->cap->manage_terms) |
|
35 | 35 | ) { |
36 | 36 | wp_die( |
37 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
38 | - '<p>' . __( 'Sorry, you are not allowed to manage this item.' ) . '</p>', |
|
37 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
38 | + '<p>'.__('Sorry, you are not allowed to manage this item.').'</p>', |
|
39 | 39 | 403 |
40 | 40 | ); |
41 | 41 | } |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | $post_type = get_current_screen()->post_type; |
44 | 44 | |
45 | 45 | // Default to the first object_type associated with the taxonomy if no post type was passed. |
46 | -if ( empty( $post_type ) ) { |
|
47 | - $post_type = reset( $tax->object_type ); |
|
46 | +if (empty($post_type)) { |
|
47 | + $post_type = reset($tax->object_type); |
|
48 | 48 | } |
49 | 49 | |
50 | -if ( 'post' != $post_type ) { |
|
51 | - $parent_file = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type"; |
|
50 | +if ('post' != $post_type) { |
|
51 | + $parent_file = ('attachment' == $post_type) ? 'upload.php' : "edit.php?post_type=$post_type"; |
|
52 | 52 | $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; |
53 | -} elseif ( 'link_category' == $taxonomy ) { |
|
53 | +} elseif ('link_category' == $taxonomy) { |
|
54 | 54 | $parent_file = 'link-manager.php'; |
55 | 55 | $submenu_file = 'edit-tags.php?taxonomy=link_category'; |
56 | 56 | } else { |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; |
59 | 59 | } |
60 | 60 | |
61 | -get_current_screen()->set_screen_reader_content( array( |
|
61 | +get_current_screen()->set_screen_reader_content(array( |
|
62 | 62 | 'heading_pagination' => $tax->labels->items_list_navigation, |
63 | 63 | 'heading_list' => $tax->labels->items_list, |
64 | -) ); |
|
64 | +)); |
|
65 | 65 | |
66 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
67 | -include( ABSPATH . 'wp-admin/edit-tag-form.php' ); |
|
68 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
66 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
67 | +include(ABSPATH.'wp-admin/edit-tag-form.php'); |
|
68 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -7,116 +7,116 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** Load WordPress Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | 12 | /** Load WordPress dashboard API */ |
13 | -require_once(ABSPATH . 'wp-admin/includes/dashboard.php'); |
|
13 | +require_once(ABSPATH.'wp-admin/includes/dashboard.php'); |
|
14 | 14 | |
15 | 15 | wp_dashboard_setup(); |
16 | 16 | |
17 | -wp_enqueue_script( 'dashboard' ); |
|
18 | -if ( current_user_can( 'edit_theme_options' ) ) |
|
19 | - wp_enqueue_script( 'customize-loader' ); |
|
20 | -if ( current_user_can( 'install_plugins' ) ) { |
|
21 | - wp_enqueue_script( 'plugin-install' ); |
|
22 | - wp_enqueue_script( 'updates' ); |
|
17 | +wp_enqueue_script('dashboard'); |
|
18 | +if (current_user_can('edit_theme_options')) |
|
19 | + wp_enqueue_script('customize-loader'); |
|
20 | +if (current_user_can('install_plugins')) { |
|
21 | + wp_enqueue_script('plugin-install'); |
|
22 | + wp_enqueue_script('updates'); |
|
23 | 23 | } |
24 | -if ( current_user_can( 'upload_files' ) ) |
|
25 | - wp_enqueue_script( 'media-upload' ); |
|
24 | +if (current_user_can('upload_files')) |
|
25 | + wp_enqueue_script('media-upload'); |
|
26 | 26 | add_thickbox(); |
27 | 27 | |
28 | -if ( wp_is_mobile() ) |
|
29 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
28 | +if (wp_is_mobile()) |
|
29 | + wp_enqueue_script('jquery-touch-punch'); |
|
30 | 30 | |
31 | 31 | $title = __('Dashboard'); |
32 | 32 | $parent_file = 'index.php'; |
33 | 33 | |
34 | -$help = '<p>' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab above the screen title.' ) . '</p>'; |
|
34 | +$help = '<p>'.__('Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab above the screen title.').'</p>'; |
|
35 | 35 | |
36 | 36 | // Not using chaining here, so as to be parseable by PHP4. |
37 | 37 | $screen = get_current_screen(); |
38 | 38 | |
39 | -$screen->add_help_tab( array( |
|
39 | +$screen->add_help_tab(array( |
|
40 | 40 | 'id' => 'overview', |
41 | - 'title' => __( 'Overview' ), |
|
41 | + 'title' => __('Overview'), |
|
42 | 42 | 'content' => $help, |
43 | -) ); |
|
43 | +)); |
|
44 | 44 | |
45 | 45 | // Help tabs |
46 | 46 | |
47 | -$help = '<p>' . __( 'The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.' ) . '</p>'; |
|
48 | -$help .= '<p>' . __( 'Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.' ) . '</p>'; |
|
47 | +$help = '<p>'.__('The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.').'</p>'; |
|
48 | +$help .= '<p>'.__('Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.').'</p>'; |
|
49 | 49 | |
50 | -$screen->add_help_tab( array( |
|
50 | +$screen->add_help_tab(array( |
|
51 | 51 | 'id' => 'help-navigation', |
52 | - 'title' => __( 'Navigation' ), |
|
52 | + 'title' => __('Navigation'), |
|
53 | 53 | 'content' => $help, |
54 | -) ); |
|
54 | +)); |
|
55 | 55 | |
56 | -$help = '<p>' . __( 'You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.' ) . '</p>'; |
|
57 | -$help .= '<p>' . __( '<strong>Screen Options</strong> — Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</p>'; |
|
58 | -$help .= '<p>' . __( '<strong>Drag and Drop</strong> — To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.' ) . '</p>'; |
|
59 | -$help .= '<p>' . __( '<strong>Box Controls</strong> — Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a “Configure” link in the title bar if you hover over it.' ) . '</p>'; |
|
56 | +$help = '<p>'.__('You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.').'</p>'; |
|
57 | +$help .= '<p>'.__('<strong>Screen Options</strong> — Use the Screen Options tab to choose which Dashboard boxes to show.').'</p>'; |
|
58 | +$help .= '<p>'.__('<strong>Drag and Drop</strong> — To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.').'</p>'; |
|
59 | +$help .= '<p>'.__('<strong>Box Controls</strong> — Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a “Configure” link in the title bar if you hover over it.').'</p>'; |
|
60 | 60 | |
61 | -$screen->add_help_tab( array( |
|
61 | +$screen->add_help_tab(array( |
|
62 | 62 | 'id' => 'help-layout', |
63 | - 'title' => __( 'Layout' ), |
|
63 | + 'title' => __('Layout'), |
|
64 | 64 | 'content' => $help, |
65 | -) ); |
|
66 | - |
|
67 | -$help = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>'; |
|
68 | -if ( current_user_can( 'edit_posts' ) ) |
|
69 | - $help .= '<p>' . __( '<strong>At A Glance</strong> — Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>'; |
|
70 | - $help .= '<p>' . __( '<strong>Activity</strong> — Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>'; |
|
71 | -if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) |
|
72 | - $help .= '<p>' . __( "<strong>Quick Draft</strong> — Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '</p>'; |
|
73 | -if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) |
|
74 | - $help .= '<p>' . sprintf( |
|
65 | +)); |
|
66 | + |
|
67 | +$help = '<p>'.__('The boxes on your Dashboard screen are:').'</p>'; |
|
68 | +if (current_user_can('edit_posts')) |
|
69 | + $help .= '<p>'.__('<strong>At A Glance</strong> — Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.').'</p>'; |
|
70 | + $help .= '<p>'.__('<strong>Activity</strong> — Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.').'</p>'; |
|
71 | +if (is_blog_admin() && current_user_can('edit_posts')) |
|
72 | + $help .= '<p>'.__("<strong>Quick Draft</strong> — Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started.").'</p>'; |
|
73 | +if ( ! is_multisite() && current_user_can('install_plugins')) |
|
74 | + $help .= '<p>'.sprintf( |
|
75 | 75 | /* translators: %s: WordPress Planet URL */ |
76 | - __( '<strong>WordPress News</strong> — Latest news from the official WordPress project, the <a href="%s">WordPress Planet</a>, and popular plugins.' ), |
|
77 | - __( 'https://planet.wordpress.org/' ) |
|
78 | - ) . '</p>'; |
|
76 | + __('<strong>WordPress News</strong> — Latest news from the official WordPress project, the <a href="%s">WordPress Planet</a>, and popular plugins.'), |
|
77 | + __('https://planet.wordpress.org/') |
|
78 | + ).'</p>'; |
|
79 | 79 | else |
80 | - $help .= '<p>' . sprintf( |
|
80 | + $help .= '<p>'.sprintf( |
|
81 | 81 | /* translators: %s: WordPress Planet URL */ |
82 | - __( '<strong>WordPress News</strong> — Latest news from the official WordPress project and the <a href="%s">WordPress Planet</a>.' ), |
|
83 | - __( 'https://planet.wordpress.org/' ) |
|
84 | - ) . '</p>'; |
|
85 | -if ( current_user_can( 'edit_theme_options' ) ) |
|
86 | - $help .= '<p>' . __( '<strong>Welcome</strong> — Shows links for some of the most common tasks when setting up a new site.' ) . '</p>'; |
|
82 | + __('<strong>WordPress News</strong> — Latest news from the official WordPress project and the <a href="%s">WordPress Planet</a>.'), |
|
83 | + __('https://planet.wordpress.org/') |
|
84 | + ).'</p>'; |
|
85 | +if (current_user_can('edit_theme_options')) |
|
86 | + $help .= '<p>'.__('<strong>Welcome</strong> — Shows links for some of the most common tasks when setting up a new site.').'</p>'; |
|
87 | 87 | |
88 | -$screen->add_help_tab( array( |
|
88 | +$screen->add_help_tab(array( |
|
89 | 89 | 'id' => 'help-content', |
90 | - 'title' => __( 'Content' ), |
|
90 | + 'title' => __('Content'), |
|
91 | 91 | 'content' => $help, |
92 | -) ); |
|
92 | +)); |
|
93 | 93 | |
94 | -unset( $help ); |
|
94 | +unset($help); |
|
95 | 95 | |
96 | 96 | $screen->set_help_sidebar( |
97 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
98 | - '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>' . |
|
99 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
97 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
98 | + '<p>'.__('<a href="https://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>').'</p>'. |
|
99 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
100 | 100 | ); |
101 | 101 | |
102 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
102 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
103 | 103 | ?> |
104 | 104 | |
105 | 105 | <div class="wrap"> |
106 | - <h1><?php echo esc_html( $title ); ?></h1> |
|
106 | + <h1><?php echo esc_html($title); ?></h1> |
|
107 | 107 | |
108 | -<?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) : |
|
108 | +<?php if (has_action('welcome_panel') && current_user_can('edit_theme_options')) : |
|
109 | 109 | $classes = 'welcome-panel'; |
110 | 110 | |
111 | - $option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); |
|
111 | + $option = get_user_meta(get_current_user_id(), 'show_welcome_panel', true); |
|
112 | 112 | // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner |
113 | - $hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) ); |
|
114 | - if ( $hide ) |
|
113 | + $hide = 0 == $option || (2 == $option && wp_get_current_user()->user_email != get_option('admin_email')); |
|
114 | + if ($hide) |
|
115 | 115 | $classes .= ' hidden'; ?> |
116 | 116 | |
117 | - <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>"> |
|
118 | - <?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?> |
|
119 | - <a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the welcome panel' ); ?>"><?php _e( 'Dismiss' ); ?></a> |
|
117 | + <div id="welcome-panel" class="<?php echo esc_attr($classes); ?>"> |
|
118 | + <?php wp_nonce_field('welcome-panel-nonce', 'welcomepanelnonce', false); ?> |
|
119 | + <a class="welcome-panel-close" href="<?php echo esc_url(admin_url('?welcome=0')); ?>" aria-label="<?php esc_attr_e('Dismiss the welcome panel'); ?>"><?php _e('Dismiss'); ?></a> |
|
120 | 120 | <?php |
121 | 121 | /** |
122 | 122 | * Add content to the welcome panel on the admin dashboard. |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @since 3.5.0 |
129 | 129 | */ |
130 | - do_action( 'welcome_panel' ); |
|
130 | + do_action('welcome_panel'); |
|
131 | 131 | ?> |
132 | 132 | </div> |
133 | 133 | <?php endif; ?> |
@@ -139,4 +139,4 @@ discard block |
||
139 | 139 | </div><!-- wrap --> |
140 | 140 | |
141 | 141 | <?php |
142 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
142 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -15,18 +15,21 @@ discard block |
||
15 | 15 | wp_dashboard_setup(); |
16 | 16 | |
17 | 17 | wp_enqueue_script( 'dashboard' ); |
18 | -if ( current_user_can( 'edit_theme_options' ) ) |
|
18 | +if ( current_user_can( 'edit_theme_options' ) ) { |
|
19 | 19 | wp_enqueue_script( 'customize-loader' ); |
20 | +} |
|
20 | 21 | if ( current_user_can( 'install_plugins' ) ) { |
21 | 22 | wp_enqueue_script( 'plugin-install' ); |
22 | 23 | wp_enqueue_script( 'updates' ); |
23 | 24 | } |
24 | -if ( current_user_can( 'upload_files' ) ) |
|
25 | +if ( current_user_can( 'upload_files' ) ) { |
|
25 | 26 | wp_enqueue_script( 'media-upload' ); |
27 | +} |
|
26 | 28 | add_thickbox(); |
27 | 29 | |
28 | -if ( wp_is_mobile() ) |
|
30 | +if ( wp_is_mobile() ) { |
|
29 | 31 | wp_enqueue_script( 'jquery-touch-punch' ); |
32 | +} |
|
30 | 33 | |
31 | 34 | $title = __('Dashboard'); |
32 | 35 | $parent_file = 'index.php'; |
@@ -65,25 +68,29 @@ discard block |
||
65 | 68 | ) ); |
66 | 69 | |
67 | 70 | $help = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>'; |
68 | -if ( current_user_can( 'edit_posts' ) ) |
|
71 | +if ( current_user_can( 'edit_posts' ) ) { |
|
69 | 72 | $help .= '<p>' . __( '<strong>At A Glance</strong> — Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>'; |
73 | +} |
|
70 | 74 | $help .= '<p>' . __( '<strong>Activity</strong> — Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>'; |
71 | -if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) |
|
75 | +if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) { |
|
72 | 76 | $help .= '<p>' . __( "<strong>Quick Draft</strong> — Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '</p>'; |
73 | -if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) |
|
77 | +} |
|
78 | +if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { |
|
74 | 79 | $help .= '<p>' . sprintf( |
75 | 80 | /* translators: %s: WordPress Planet URL */ |
76 | 81 | __( '<strong>WordPress News</strong> — Latest news from the official WordPress project, the <a href="%s">WordPress Planet</a>, and popular plugins.' ), |
77 | 82 | __( 'https://planet.wordpress.org/' ) |
78 | 83 | ) . '</p>'; |
79 | -else |
|
84 | +} else { |
|
80 | 85 | $help .= '<p>' . sprintf( |
81 | 86 | /* translators: %s: WordPress Planet URL */ |
82 | 87 | __( '<strong>WordPress News</strong> — Latest news from the official WordPress project and the <a href="%s">WordPress Planet</a>.' ), |
83 | 88 | __( 'https://planet.wordpress.org/' ) |
84 | 89 | ) . '</p>'; |
85 | -if ( current_user_can( 'edit_theme_options' ) ) |
|
90 | +} |
|
91 | +if ( current_user_can( 'edit_theme_options' ) ) { |
|
86 | 92 | $help .= '<p>' . __( '<strong>Welcome</strong> — Shows links for some of the most common tasks when setting up a new site.' ) . '</p>'; |
93 | +} |
|
87 | 94 | |
88 | 95 | $screen->add_help_tab( array( |
89 | 96 | 'id' => 'help-content', |
@@ -111,8 +118,10 @@ discard block |
||
111 | 118 | $option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); |
112 | 119 | // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner |
113 | 120 | $hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) ); |
114 | - if ( $hide ) |
|
115 | - $classes .= ' hidden'; ?> |
|
121 | + if ( $hide ) { |
|
122 | + $classes .= ' hidden'; |
|
123 | + } |
|
124 | + ?> |
|
116 | 125 | |
117 | 126 | <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>"> |
118 | 127 | <?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?> |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( ! wp_is_mobile() ) { |
|
13 | - wp_enqueue_style( 'wp-mediaelement' ); |
|
14 | - wp_enqueue_script( 'wp-mediaelement' ); |
|
15 | - wp_localize_script( 'mediaelement', '_wpmejsSettings', array( |
|
16 | - 'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ), |
|
12 | +if ( ! wp_is_mobile()) { |
|
13 | + wp_enqueue_style('wp-mediaelement'); |
|
14 | + wp_enqueue_script('wp-mediaelement'); |
|
15 | + wp_localize_script('mediaelement', '_wpmejsSettings', array( |
|
16 | + 'pluginPath' => includes_url('js/mediaelement/', 'relative'), |
|
17 | 17 | 'pauseOtherPlayers' => '', |
18 | - ) ); |
|
18 | + )); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -29,33 +29,33 @@ discard block |
||
29 | 29 | * @param $output Video shortcode HTML output. |
30 | 30 | * @return string Filtered HTML content to display video. |
31 | 31 | */ |
32 | -function _wp_override_admin_video_width_limit( $output ) { |
|
33 | - return str_replace( array( '640', '384' ), array( '1050', '630' ), $output ); |
|
32 | +function _wp_override_admin_video_width_limit($output) { |
|
33 | + return str_replace(array('640', '384'), array('1050', '630'), $output); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $video_url = 'https://videopress.com/embed/scFdjVo6?hd=true'; |
37 | -$locale = str_replace( '_', '-', get_locale() ); |
|
38 | -list( $locale ) = explode( '-', $locale ); |
|
39 | -if ( 'en' !== $locale ) { |
|
40 | - $video_url = add_query_arg( 'defaultLangCode', $locale, $video_url ); |
|
37 | +$locale = str_replace('_', '-', get_locale()); |
|
38 | +list($locale) = explode('-', $locale); |
|
39 | +if ('en' !== $locale) { |
|
40 | + $video_url = add_query_arg('defaultLangCode', $locale, $video_url); |
|
41 | 41 | } |
42 | 42 | |
43 | -$title = __( 'About' ); |
|
43 | +$title = __('About'); |
|
44 | 44 | |
45 | -list( $display_version ) = explode( '-', $wp_version ); |
|
45 | +list($display_version) = explode('-', $wp_version); |
|
46 | 46 | |
47 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
47 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
48 | 48 | ?> |
49 | 49 | <div class="wrap about-wrap"> |
50 | - <h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1> |
|
50 | + <h1><?php printf(__('Welcome to WordPress %s'), $display_version); ?></h1> |
|
51 | 51 | |
52 | - <p class="about-text"><?php printf( __( 'Thank you for updating to the latest version. WordPress %s changes a lot behind the scenes to make your WordPress experience even better!' ), $display_version ); ?></p> |
|
53 | - <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div> |
|
52 | + <p class="about-text"><?php printf(__('Thank you for updating to the latest version. WordPress %s changes a lot behind the scenes to make your WordPress experience even better!'), $display_version); ?></p> |
|
53 | + <div class="wp-badge"><?php printf(__('Version %s'), $display_version); ?></div> |
|
54 | 54 | |
55 | 55 | <h2 class="nav-tab-wrapper wp-clearfix"> |
56 | - <a href="about.php" class="nav-tab nav-tab-active"><?php _e( 'What’s New' ); ?></a> |
|
57 | - <a href="credits.php" class="nav-tab"><?php _e( 'Credits' ); ?></a> |
|
58 | - <a href="freedoms.php" class="nav-tab"><?php _e( 'Freedoms' ); ?></a> |
|
56 | + <a href="about.php" class="nav-tab nav-tab-active"><?php _e('What’s New'); ?></a> |
|
57 | + <a href="credits.php" class="nav-tab"><?php _e('Credits'); ?></a> |
|
58 | + <a href="freedoms.php" class="nav-tab"><?php _e('Freedoms'); ?></a> |
|
59 | 59 | </h2> |
60 | 60 | |
61 | 61 | <div class="headline-feature feature-video" style="background-color:#191E23;"> |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | <hr> |
69 | 69 | |
70 | 70 | <div class="streamlined-updates feature-section one-col"> |
71 | - <h2><?php _e( 'Streamlined Updates' ); ?></h2> |
|
72 | - <p><?php _e( 'Don’t lose your place: stay on the same page while you update, install, and delete your plugins and themes.' ); ?></p> |
|
71 | + <h2><?php _e('Streamlined Updates'); ?></h2> |
|
72 | + <p><?php _e('Don’t lose your place: stay on the same page while you update, install, and delete your plugins and themes.'); ?></p> |
|
73 | 73 | <?php |
74 | - if ( ! wp_is_mobile() ) { |
|
75 | - add_filter( 'wp_video_shortcode', '_wp_override_admin_video_width_limit' ); |
|
76 | - echo wp_video_shortcode( array( |
|
74 | + if ( ! wp_is_mobile()) { |
|
75 | + add_filter('wp_video_shortcode', '_wp_override_admin_video_width_limit'); |
|
76 | + echo wp_video_shortcode(array( |
|
77 | 77 | 'mp4' => 'https://cldup.com/5ho0rKdXXe.mp4', |
78 | 78 | 'webm' => 'https://cldup.com/VdSgwAtHNX.webm', |
79 | 79 | 'poster' => 'https://cldup.com/c0kfjoVcFo.png', |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | 'width' => 1050, |
83 | 83 | 'height' => 630, |
84 | 84 | 'class' => 'wp-video-shortcode feature-video', |
85 | - ) ); |
|
86 | - remove_filter( 'wp_video_shortcode', '_wp_override_admin_video_width_limit' ); |
|
85 | + )); |
|
86 | + remove_filter('wp_video_shortcode', '_wp_override_admin_video_width_limit'); |
|
87 | 87 | } else { |
88 | 88 | echo '<img src="https://cldup.com/c0kfjoVcFo.png" alt="" srcset=""/>'; |
89 | 89 | } |
@@ -93,62 +93,62 @@ discard block |
||
93 | 93 | <hr /> |
94 | 94 | |
95 | 95 | <div class="native-fonts feature-section one-col"> |
96 | - <h2><?php _e( 'Native Fonts' ); ?></h2> |
|
97 | - <p><?php _e( 'The WordPress dashboard now takes advantage of the fonts you already have, making it load faster and letting you feel more at home on whatever device you use.' ); ?></p> |
|
96 | + <h2><?php _e('Native Fonts'); ?></h2> |
|
97 | + <p><?php _e('The WordPress dashboard now takes advantage of the fonts you already have, making it load faster and letting you feel more at home on whatever device you use.'); ?></p> |
|
98 | 98 | <img src="https://cldup.com/bCuNzRdtHm.png" alt="" srcset="https://cldup.com/YiMPjePe7J.png 200w, https://cldup.com/xqWD9T2h61.png 371w, https://cldup.com/OGC8NS0zmX.png 510w, https://cldup.com/cXPTP-tbix.png 560w, https://cldup.com/gjZNfc58Ya.png 781w, https://cldup.com/Hqmo5VLb-E.png 922w, https://cldup.com/5tU3wu6537.png 2000w" sizes="(max-width: 500px) calc(100vw - 40px), (max-width: 782px) calc(100vw - 70px), (max-width: 959px) calc(100vw - 116px), (max-width: 1290px) calc(100vw - 240px), 1050px"/> |
99 | 99 | </div> |
100 | 100 | |
101 | 101 | <hr /> |
102 | 102 | |
103 | 103 | <div class="feature-section two-col"> |
104 | - <h2><?php _e( 'Editor Improvements' ); ?></h2> |
|
104 | + <h2><?php _e('Editor Improvements'); ?></h2> |
|
105 | 105 | <div class="col"> |
106 | 106 | <img src="https://cldup.com/rUgTVXZedO.png" alt="" srcset="https://cldup.com/P9uN0OArJ7.png 200w, https://cldup.com/3TU9rBnLw5.png 384w, https://cldup.com/k3kZhYI0tE.png 608w, https://cldup.com/ACglmMoOdP.png 789w, https://cldup.com/rUgTVXZedO.png 992w" sizes="(max-width: 500px) calc(100vw - 40px), (max-width: 781px) calc((100vw - 70px) * .466), (max-width: 959px) calc((100vw - 116px) * .469), (max-width: 1290px) calc((100vw - 240px) * .472), 496px"/> |
107 | - <h3><?php _e( 'Inline Link Checker' ); ?></h3> |
|
107 | + <h3><?php _e('Inline Link Checker'); ?></h3> |
|
108 | 108 | <p><?php |
109 | 109 | printf( |
110 | 110 | /* translators: %s: Home URL appended with 'wordpress.org' */ |
111 | - __( 'Ever accidentally made a link to %s? Now WordPress automatically checks to make sure you didn’t.' ), |
|
112 | - home_url( 'wordpress.org' ) |
|
111 | + __('Ever accidentally made a link to %s? Now WordPress automatically checks to make sure you didn’t.'), |
|
112 | + home_url('wordpress.org') |
|
113 | 113 | ); |
114 | 114 | ?></p> |
115 | 115 | </div> |
116 | 116 | <div class="col"> |
117 | 117 | <img src="https://cldup.com/fxzqZFrDxo.png" alt="" srcset="https://cldup.com/QAjwr6h33d.png 200w, https://cldup.com/YwJSETYBwk.png 400w, https://cldup.com/wbwkFYER9C.png 561w, https://cldup.com/9T-ckRM67P.png 701w, https://cldup.com/sQYWMMsU4g.png 992w" sizes="(max-width: 500px) calc(100vw - 40px), (max-width: 781px) calc((100vw - 70px) * .466), (max-width: 959px) calc((100vw - 116px) * .469), (max-width: 1290px) calc((100vw - 240px) * .472), 496px"/> |
118 | - <h3><?php _e( 'Content Recovery' ); ?></h3> |
|
119 | - <p><?php _e( 'As you type, WordPress saves your content to the browser. Recovering saved content is even easier with WordPress 4.6.' ); ?></p> |
|
118 | + <h3><?php _e('Content Recovery'); ?></h3> |
|
119 | + <p><?php _e('As you type, WordPress saves your content to the browser. Recovering saved content is even easier with WordPress 4.6.'); ?></p> |
|
120 | 120 | </div> |
121 | 121 | </div> |
122 | 122 | |
123 | 123 | <hr /> |
124 | 124 | |
125 | 125 | <div class="changelog"> |
126 | - <h2><?php _e( 'Under the Hood' ); ?></h2> |
|
126 | + <h2><?php _e('Under the Hood'); ?></h2> |
|
127 | 127 | |
128 | 128 | <div class="under-the-hood three-col"> |
129 | 129 | <div class="col"> |
130 | - <h3><?php _e( 'Resource Hints' ); ?></h3> |
|
130 | + <h3><?php _e('Resource Hints'); ?></h3> |
|
131 | 131 | <p><?php |
132 | 132 | printf( |
133 | 133 | /* translators: %s: https://make.wordpress.org/core/2016/07/06/resource-hints-in-4-6/ */ |
134 | - __( '<a href="%s">Resource hints help browsers</a> decide which resources to fetch and preprocess. WordPress 4.6 adds them automatically for your styles and scripts making your site even faster.' ), |
|
134 | + __('<a href="%s">Resource hints help browsers</a> decide which resources to fetch and preprocess. WordPress 4.6 adds them automatically for your styles and scripts making your site even faster.'), |
|
135 | 135 | 'https://make.wordpress.org/core/2016/07/06/resource-hints-in-4-6/' |
136 | 136 | ); |
137 | 137 | ?></p> |
138 | 138 | </div> |
139 | 139 | <div class="col"> |
140 | - <h3><?php _e( 'Robust Requests' ); ?></h3> |
|
141 | - <p><?php _e( 'The HTTP API now leverages the Requests library, improving HTTP standard support and adding case-insensitive headers, parallel HTTP requests, and support for Internationalized Domain Names.' ); ?></p> |
|
140 | + <h3><?php _e('Robust Requests'); ?></h3> |
|
141 | + <p><?php _e('The HTTP API now leverages the Requests library, improving HTTP standard support and adding case-insensitive headers, parallel HTTP requests, and support for Internationalized Domain Names.'); ?></p> |
|
142 | 142 | </div> |
143 | 143 | <div class="col"> |
144 | 144 | <h3><?php |
145 | 145 | /* translators: 1: WP_Term_Query, 2: WP_Post_Type */ |
146 | - printf( __( '%1$s and %2$s' ), '<code>WP_Term_Query</code>', '<code>WP_Post_Type</code>' ); |
|
146 | + printf(__('%1$s and %2$s'), '<code>WP_Term_Query</code>', '<code>WP_Post_Type</code>'); |
|
147 | 147 | ?></h3> |
148 | 148 | <p><?php |
149 | 149 | printf( |
150 | 150 | /* translators: 1: WP_Term_Query, 2: WP_Post_Type */ |
151 | - __( 'A new %1$s class adds flexibility to query term information while a new %2$s object makes interacting with post types more predictable.' ), |
|
151 | + __('A new %1$s class adds flexibility to query term information while a new %2$s object makes interacting with post types more predictable.'), |
|
152 | 152 | '<code>WP_Term_Query</code>', |
153 | 153 | '<code>WP_Post_Type</code>' |
154 | 154 | ); |
@@ -158,36 +158,36 @@ discard block |
||
158 | 158 | |
159 | 159 | <div class="under-the-hood three-col"> |
160 | 160 | <div class="col"> |
161 | - <h3><?php _e( 'Meta Registration API' ); ?></h3> |
|
161 | + <h3><?php _e('Meta Registration API'); ?></h3> |
|
162 | 162 | <p><?php |
163 | 163 | printf( |
164 | 164 | /* translators: %s: https://make.wordpress.org/core/2016/07/08/enhancing-register_meta-in-4-6/ */ |
165 | - __( 'The Meta Registration API <a href="%s">has been expanded</a> to support types, descriptions, and REST API visibility.' ), |
|
165 | + __('The Meta Registration API <a href="%s">has been expanded</a> to support types, descriptions, and REST API visibility.'), |
|
166 | 166 | 'https://make.wordpress.org/core/2016/07/08/enhancing-register_meta-in-4-6/' |
167 | 167 | ); |
168 | 168 | ?></p> |
169 | 169 | </div> |
170 | 170 | <div class="col"> |
171 | - <h3><?php _e( 'Translations On Demand' ); ?></h3> |
|
172 | - <p><?php _e( 'WordPress will install and use the newest language packs for your plugins and themes as soon as they’re available from <a href="https://translate.wordpress.org/">WordPress.org’s community of translators</a>.' ); ?></p> |
|
171 | + <h3><?php _e('Translations On Demand'); ?></h3> |
|
172 | + <p><?php _e('WordPress will install and use the newest language packs for your plugins and themes as soon as they’re available from <a href="https://translate.wordpress.org/">WordPress.org’s community of translators</a>.'); ?></p> |
|
173 | 173 | </div> |
174 | 174 | <div class="col"> |
175 | - <h3><?php _e( 'JavaScript Library Updates' ); ?></h3> |
|
176 | - <p><?php _e( 'Masonry 3.3.2, imagesLoaded 3.2.0, MediaElement.js 2.22.0, TinyMCE 4.4.1, and Backbone.js 1.3.3 are bundled.' ); ?></p> |
|
175 | + <h3><?php _e('JavaScript Library Updates'); ?></h3> |
|
176 | + <p><?php _e('Masonry 3.3.2, imagesLoaded 3.2.0, MediaElement.js 2.22.0, TinyMCE 4.4.1, and Backbone.js 1.3.3 are bundled.'); ?></p> |
|
177 | 177 | </div> |
178 | 178 | </div> |
179 | 179 | |
180 | 180 | <div class="under-the-hood two-col"> |
181 | 181 | <div class="col"> |
182 | - <h3><?php _e( 'Customizer APIs for Setting Validation and Notifications' ); ?></h3> |
|
183 | - <p><?php _e( 'Settings now have an <a href="https://make.wordpress.org/core/2016/07/05/customizer-apis-in-4-6-for-setting-validation-and-notifications/">API for enforcing validation constraints</a>. Likewise, customizer controls now support notifications, which are used to display validation errors instead of failing silently.' ); ?></p> |
|
182 | + <h3><?php _e('Customizer APIs for Setting Validation and Notifications'); ?></h3> |
|
183 | + <p><?php _e('Settings now have an <a href="https://make.wordpress.org/core/2016/07/05/customizer-apis-in-4-6-for-setting-validation-and-notifications/">API for enforcing validation constraints</a>. Likewise, customizer controls now support notifications, which are used to display validation errors instead of failing silently.'); ?></p> |
|
184 | 184 | </div> |
185 | 185 | <div class="col"> |
186 | - <h3><?php _e( 'Multisite, now faster than ever' ); ?></h3> |
|
186 | + <h3><?php _e('Multisite, now faster than ever'); ?></h3> |
|
187 | 187 | <p><?php |
188 | 188 | printf( |
189 | 189 | /* translators: 1: WP_Site_Query, 2: WP_Network_Query */ |
190 | - __( 'Cached and comprehensive site queries improve your network admin experience. The addition of %1$s and %2$s help craft advanced queries with less effort.' ), |
|
190 | + __('Cached and comprehensive site queries improve your network admin experience. The addition of %1$s and %2$s help craft advanced queries with less effort.'), |
|
191 | 191 | '<code>WP_Site_Query</code>', |
192 | 192 | '<code>WP_Network_Query</code>' |
193 | 193 | ); |
@@ -199,47 +199,47 @@ discard block |
||
199 | 199 | <hr /> |
200 | 200 | |
201 | 201 | <div class="return-to-dashboard"> |
202 | - <?php if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : ?> |
|
203 | - <a href="<?php echo esc_url( self_admin_url( 'update-core.php' ) ); ?>"> |
|
204 | - <?php is_multisite() ? _e( 'Return to Updates' ) : _e( 'Return to Dashboard → Updates' ); ?> |
|
202 | + <?php if (current_user_can('update_core') && isset($_GET['updated'])) : ?> |
|
203 | + <a href="<?php echo esc_url(self_admin_url('update-core.php')); ?>"> |
|
204 | + <?php is_multisite() ? _e('Return to Updates') : _e('Return to Dashboard → Updates'); ?> |
|
205 | 205 | </a> | |
206 | 206 | <?php endif; ?> |
207 | - <a href="<?php echo esc_url( self_admin_url() ); ?>"><?php is_blog_admin() ? _e( 'Go to Dashboard → Home' ) : _e( 'Go to Dashboard' ); ?></a> |
|
207 | + <a href="<?php echo esc_url(self_admin_url()); ?>"><?php is_blog_admin() ? _e('Go to Dashboard → Home') : _e('Go to Dashboard'); ?></a> |
|
208 | 208 | </div> |
209 | 209 | |
210 | 210 | </div> |
211 | 211 | <?php |
212 | 212 | |
213 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
213 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
|
214 | 214 | |
215 | 215 | // These are strings we may use to describe maintenance/security releases, where we aim for no new strings. |
216 | 216 | return; |
217 | 217 | |
218 | -__( 'Maintenance Release' ); |
|
219 | -__( 'Maintenance Releases' ); |
|
218 | +__('Maintenance Release'); |
|
219 | +__('Maintenance Releases'); |
|
220 | 220 | |
221 | -__( 'Security Release' ); |
|
222 | -__( 'Security Releases' ); |
|
221 | +__('Security Release'); |
|
222 | +__('Security Releases'); |
|
223 | 223 | |
224 | -__( 'Maintenance and Security Release' ); |
|
225 | -__( 'Maintenance and Security Releases' ); |
|
224 | +__('Maintenance and Security Release'); |
|
225 | +__('Maintenance and Security Releases'); |
|
226 | 226 | |
227 | 227 | /* translators: %s: WordPress version number */ |
228 | -__( '<strong>Version %s</strong> addressed one security issue.' ); |
|
228 | +__('<strong>Version %s</strong> addressed one security issue.'); |
|
229 | 229 | /* translators: %s: WordPress version number */ |
230 | -__( '<strong>Version %s</strong> addressed some security issues.' ); |
|
230 | +__('<strong>Version %s</strong> addressed some security issues.'); |
|
231 | 231 | |
232 | 232 | /* translators: 1: WordPress version number, 2: plural number of bugs. */ |
233 | -_n_noop( '<strong>Version %1$s</strong> addressed %2$s bug.', |
|
234 | - '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
233 | +_n_noop('<strong>Version %1$s</strong> addressed %2$s bug.', |
|
234 | + '<strong>Version %1$s</strong> addressed %2$s bugs.'); |
|
235 | 235 | |
236 | 236 | /* translators: 1: WordPress version number, 2: plural number of bugs. Singular security issue. */ |
237 | -_n_noop( '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
|
238 | - '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
237 | +_n_noop('<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
|
238 | + '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.'); |
|
239 | 239 | |
240 | 240 | /* translators: 1: WordPress version number, 2: plural number of bugs. More than one security issue. */ |
241 | -_n_noop( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
|
242 | - '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
241 | +_n_noop('<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
|
242 | + '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.'); |
|
243 | 243 | |
244 | 244 | /* translators: %s: Codex URL */ |
245 | -__( 'For more information, see <a href="%s">the release notes</a>.' ); |
|
245 | +__('For more information, see <a href="%s">the release notes</a>.'); |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @see twentythirteen_content_width() for template-specific adjustments. |
30 | 30 | */ |
31 | -if ( ! isset( $content_width ) ) |
|
31 | +if ( ! isset($content_width)) |
|
32 | 32 | $content_width = 604; |
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Add support for a custom header image. |
36 | 36 | */ |
37 | -require get_template_directory() . '/inc/custom-header.php'; |
|
37 | +require get_template_directory().'/inc/custom-header.php'; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Twenty Thirteen only works in WordPress 3.6 or later. |
41 | 41 | */ |
42 | -if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '<' ) ) |
|
43 | - require get_template_directory() . '/inc/back-compat.php'; |
|
42 | +if (version_compare($GLOBALS['wp_version'], '3.6-alpha', '<')) |
|
43 | + require get_template_directory().'/inc/back-compat.php'; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Twenty Thirteen setup. |
@@ -66,50 +66,50 @@ discard block |
||
66 | 66 | * replace to change 'twentythirteen' to the name of your theme in all |
67 | 67 | * template files. |
68 | 68 | */ |
69 | - load_theme_textdomain( 'twentythirteen' ); |
|
69 | + load_theme_textdomain('twentythirteen'); |
|
70 | 70 | |
71 | 71 | /* |
72 | 72 | * This theme styles the visual editor to resemble the theme style, |
73 | 73 | * specifically font, colors, icons, and column width. |
74 | 74 | */ |
75 | - add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentythirteen_fonts_url() ) ); |
|
75 | + add_editor_style(array('css/editor-style.css', 'genericons/genericons.css', twentythirteen_fonts_url())); |
|
76 | 76 | |
77 | 77 | // Adds RSS feed links to <head> for posts and comments. |
78 | - add_theme_support( 'automatic-feed-links' ); |
|
78 | + add_theme_support('automatic-feed-links'); |
|
79 | 79 | |
80 | 80 | /* |
81 | 81 | * Switches default core markup for search form, comment form, |
82 | 82 | * and comments to output valid HTML5. |
83 | 83 | */ |
84 | - add_theme_support( 'html5', array( |
|
84 | + add_theme_support('html5', array( |
|
85 | 85 | 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' |
86 | - ) ); |
|
86 | + )); |
|
87 | 87 | |
88 | 88 | /* |
89 | 89 | * This theme supports all available post formats by default. |
90 | 90 | * See https://codex.wordpress.org/Post_Formats |
91 | 91 | */ |
92 | - add_theme_support( 'post-formats', array( |
|
92 | + add_theme_support('post-formats', array( |
|
93 | 93 | 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' |
94 | - ) ); |
|
94 | + )); |
|
95 | 95 | |
96 | 96 | // This theme uses wp_nav_menu() in one location. |
97 | - register_nav_menu( 'primary', __( 'Navigation Menu', 'twentythirteen' ) ); |
|
97 | + register_nav_menu('primary', __('Navigation Menu', 'twentythirteen')); |
|
98 | 98 | |
99 | 99 | /* |
100 | 100 | * This theme uses a custom image size for featured images, displayed on |
101 | 101 | * "standard" posts and pages. |
102 | 102 | */ |
103 | - add_theme_support( 'post-thumbnails' ); |
|
104 | - set_post_thumbnail_size( 604, 270, true ); |
|
103 | + add_theme_support('post-thumbnails'); |
|
104 | + set_post_thumbnail_size(604, 270, true); |
|
105 | 105 | |
106 | 106 | // This theme uses its own gallery styles. |
107 | - add_filter( 'use_default_gallery_style', '__return_false' ); |
|
107 | + add_filter('use_default_gallery_style', '__return_false'); |
|
108 | 108 | |
109 | 109 | // Indicate widget sidebars can use selective refresh in the Customizer. |
110 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
110 | + add_theme_support('customize-selective-refresh-widgets'); |
|
111 | 111 | } |
112 | -add_action( 'after_setup_theme', 'twentythirteen_setup' ); |
|
112 | +add_action('after_setup_theme', 'twentythirteen_setup'); |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * Return the Google font stylesheet URL, if available. |
@@ -128,28 +128,28 @@ discard block |
||
128 | 128 | * supported by Source Sans Pro, translate this to 'off'. Do not translate |
129 | 129 | * into your own language. |
130 | 130 | */ |
131 | - $source_sans_pro = _x( 'on', 'Source Sans Pro font: on or off', 'twentythirteen' ); |
|
131 | + $source_sans_pro = _x('on', 'Source Sans Pro font: on or off', 'twentythirteen'); |
|
132 | 132 | |
133 | 133 | /* Translators: If there are characters in your language that are not |
134 | 134 | * supported by Bitter, translate this to 'off'. Do not translate into your |
135 | 135 | * own language. |
136 | 136 | */ |
137 | - $bitter = _x( 'on', 'Bitter font: on or off', 'twentythirteen' ); |
|
137 | + $bitter = _x('on', 'Bitter font: on or off', 'twentythirteen'); |
|
138 | 138 | |
139 | - if ( 'off' !== $source_sans_pro || 'off' !== $bitter ) { |
|
139 | + if ('off' !== $source_sans_pro || 'off' !== $bitter) { |
|
140 | 140 | $font_families = array(); |
141 | 141 | |
142 | - if ( 'off' !== $source_sans_pro ) |
|
142 | + if ('off' !== $source_sans_pro) |
|
143 | 143 | $font_families[] = 'Source Sans Pro:300,400,700,300italic,400italic,700italic'; |
144 | 144 | |
145 | - if ( 'off' !== $bitter ) |
|
145 | + if ('off' !== $bitter) |
|
146 | 146 | $font_families[] = 'Bitter:400,700'; |
147 | 147 | |
148 | 148 | $query_args = array( |
149 | - 'family' => urlencode( implode( '|', $font_families ) ), |
|
150 | - 'subset' => urlencode( 'latin,latin-ext' ), |
|
149 | + 'family' => urlencode(implode('|', $font_families)), |
|
150 | + 'subset' => urlencode('latin,latin-ext'), |
|
151 | 151 | ); |
152 | - $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); |
|
152 | + $fonts_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | return $fonts_url; |
@@ -165,30 +165,30 @@ discard block |
||
165 | 165 | * Adds JavaScript to pages with the comment form to support |
166 | 166 | * sites with threaded comments (when in use). |
167 | 167 | */ |
168 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) |
|
169 | - wp_enqueue_script( 'comment-reply' ); |
|
168 | + if (is_singular() && comments_open() && get_option('thread_comments')) |
|
169 | + wp_enqueue_script('comment-reply'); |
|
170 | 170 | |
171 | 171 | // Adds Masonry to handle vertical alignment of footer widgets. |
172 | - if ( is_active_sidebar( 'sidebar-1' ) ) |
|
173 | - wp_enqueue_script( 'jquery-masonry' ); |
|
172 | + if (is_active_sidebar('sidebar-1')) |
|
173 | + wp_enqueue_script('jquery-masonry'); |
|
174 | 174 | |
175 | 175 | // Loads JavaScript file with functionality specific to Twenty Thirteen. |
176 | - wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20160717', true ); |
|
176 | + wp_enqueue_script('twentythirteen-script', get_template_directory_uri().'/js/functions.js', array('jquery'), '20160717', true); |
|
177 | 177 | |
178 | 178 | // Add Source Sans Pro and Bitter fonts, used in the main stylesheet. |
179 | - wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null ); |
|
179 | + wp_enqueue_style('twentythirteen-fonts', twentythirteen_fonts_url(), array(), null); |
|
180 | 180 | |
181 | 181 | // Add Genericons font, used in the main stylesheet. |
182 | - wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.03' ); |
|
182 | + wp_enqueue_style('genericons', get_template_directory_uri().'/genericons/genericons.css', array(), '3.03'); |
|
183 | 183 | |
184 | 184 | // Loads our main stylesheet. |
185 | - wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri(), array(), '2013-07-18' ); |
|
185 | + wp_enqueue_style('twentythirteen-style', get_stylesheet_uri(), array(), '2013-07-18'); |
|
186 | 186 | |
187 | 187 | // Loads the Internet Explorer specific stylesheet. |
188 | - wp_enqueue_style( 'twentythirteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentythirteen-style' ), '2013-07-18' ); |
|
189 | - wp_style_add_data( 'twentythirteen-ie', 'conditional', 'lt IE 9' ); |
|
188 | + wp_enqueue_style('twentythirteen-ie', get_template_directory_uri().'/css/ie.css', array('twentythirteen-style'), '2013-07-18'); |
|
189 | + wp_style_add_data('twentythirteen-ie', 'conditional', 'lt IE 9'); |
|
190 | 190 | } |
191 | -add_action( 'wp_enqueue_scripts', 'twentythirteen_scripts_styles' ); |
|
191 | +add_action('wp_enqueue_scripts', 'twentythirteen_scripts_styles'); |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * Filter the page title. |
@@ -202,27 +202,27 @@ discard block |
||
202 | 202 | * @param string $sep Optional separator. |
203 | 203 | * @return string The filtered title. |
204 | 204 | */ |
205 | -function twentythirteen_wp_title( $title, $sep ) { |
|
205 | +function twentythirteen_wp_title($title, $sep) { |
|
206 | 206 | global $paged, $page; |
207 | 207 | |
208 | - if ( is_feed() ) |
|
208 | + if (is_feed()) |
|
209 | 209 | return $title; |
210 | 210 | |
211 | 211 | // Add the site name. |
212 | - $title .= get_bloginfo( 'name', 'display' ); |
|
212 | + $title .= get_bloginfo('name', 'display'); |
|
213 | 213 | |
214 | 214 | // Add the site description for the home/front page. |
215 | - $site_description = get_bloginfo( 'description', 'display' ); |
|
216 | - if ( $site_description && ( is_home() || is_front_page() ) ) |
|
215 | + $site_description = get_bloginfo('description', 'display'); |
|
216 | + if ($site_description && (is_home() || is_front_page())) |
|
217 | 217 | $title = "$title $sep $site_description"; |
218 | 218 | |
219 | 219 | // Add a page number if necessary. |
220 | - if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) |
|
221 | - $title = "$title $sep " . sprintf( __( 'Page %s', 'twentythirteen' ), max( $paged, $page ) ); |
|
220 | + if (($paged >= 2 || $page >= 2) && ! is_404()) |
|
221 | + $title = "$title $sep ".sprintf(__('Page %s', 'twentythirteen'), max($paged, $page)); |
|
222 | 222 | |
223 | 223 | return $title; |
224 | 224 | } |
225 | -add_filter( 'wp_title', 'twentythirteen_wp_title', 10, 2 ); |
|
225 | +add_filter('wp_title', 'twentythirteen_wp_title', 10, 2); |
|
226 | 226 | |
227 | 227 | /** |
228 | 228 | * Register two widget areas. |
@@ -230,29 +230,29 @@ discard block |
||
230 | 230 | * @since Twenty Thirteen 1.0 |
231 | 231 | */ |
232 | 232 | function twentythirteen_widgets_init() { |
233 | - register_sidebar( array( |
|
234 | - 'name' => __( 'Main Widget Area', 'twentythirteen' ), |
|
233 | + register_sidebar(array( |
|
234 | + 'name' => __('Main Widget Area', 'twentythirteen'), |
|
235 | 235 | 'id' => 'sidebar-1', |
236 | - 'description' => __( 'Appears in the footer section of the site.', 'twentythirteen' ), |
|
236 | + 'description' => __('Appears in the footer section of the site.', 'twentythirteen'), |
|
237 | 237 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
238 | 238 | 'after_widget' => '</aside>', |
239 | 239 | 'before_title' => '<h3 class="widget-title">', |
240 | 240 | 'after_title' => '</h3>', |
241 | - ) ); |
|
241 | + )); |
|
242 | 242 | |
243 | - register_sidebar( array( |
|
244 | - 'name' => __( 'Secondary Widget Area', 'twentythirteen' ), |
|
243 | + register_sidebar(array( |
|
244 | + 'name' => __('Secondary Widget Area', 'twentythirteen'), |
|
245 | 245 | 'id' => 'sidebar-2', |
246 | - 'description' => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ), |
|
246 | + 'description' => __('Appears on posts and pages in the sidebar.', 'twentythirteen'), |
|
247 | 247 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
248 | 248 | 'after_widget' => '</aside>', |
249 | 249 | 'before_title' => '<h3 class="widget-title">', |
250 | 250 | 'after_title' => '</h3>', |
251 | - ) ); |
|
251 | + )); |
|
252 | 252 | } |
253 | -add_action( 'widgets_init', 'twentythirteen_widgets_init' ); |
|
253 | +add_action('widgets_init', 'twentythirteen_widgets_init'); |
|
254 | 254 | |
255 | -if ( ! function_exists( 'twentythirteen_paging_nav' ) ) : |
|
255 | +if ( ! function_exists('twentythirteen_paging_nav')) : |
|
256 | 256 | /** |
257 | 257 | * Display navigation to next/previous set of posts when applicable. |
258 | 258 | * |
@@ -262,19 +262,19 @@ discard block |
||
262 | 262 | global $wp_query; |
263 | 263 | |
264 | 264 | // Don't print empty markup if there's only one page. |
265 | - if ( $wp_query->max_num_pages < 2 ) |
|
265 | + if ($wp_query->max_num_pages < 2) |
|
266 | 266 | return; |
267 | 267 | ?> |
268 | 268 | <nav class="navigation paging-navigation" role="navigation"> |
269 | - <h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'twentythirteen' ); ?></h1> |
|
269 | + <h1 class="screen-reader-text"><?php _e('Posts navigation', 'twentythirteen'); ?></h1> |
|
270 | 270 | <div class="nav-links"> |
271 | 271 | |
272 | - <?php if ( get_next_posts_link() ) : ?> |
|
273 | - <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentythirteen' ) ); ?></div> |
|
272 | + <?php if (get_next_posts_link()) : ?> |
|
273 | + <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">←</span> Older posts', 'twentythirteen')); ?></div> |
|
274 | 274 | <?php endif; ?> |
275 | 275 | |
276 | - <?php if ( get_previous_posts_link() ) : ?> |
|
277 | - <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentythirteen' ) ); ?></div> |
|
276 | + <?php if (get_previous_posts_link()) : ?> |
|
277 | + <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'twentythirteen')); ?></div> |
|
278 | 278 | <?php endif; ?> |
279 | 279 | |
280 | 280 | </div><!-- .nav-links --> |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | } |
284 | 284 | endif; |
285 | 285 | |
286 | -if ( ! function_exists( 'twentythirteen_post_nav' ) ) : |
|
286 | +if ( ! function_exists('twentythirteen_post_nav')) : |
|
287 | 287 | /** |
288 | 288 | * Display navigation to next/previous post when applicable. |
289 | 289 | * |
@@ -293,18 +293,18 @@ discard block |
||
293 | 293 | global $post; |
294 | 294 | |
295 | 295 | // Don't print empty markup if there's nowhere to navigate. |
296 | - $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true ); |
|
297 | - $next = get_adjacent_post( false, '', false ); |
|
296 | + $previous = (is_attachment()) ? get_post($post->post_parent) : get_adjacent_post(false, '', true); |
|
297 | + $next = get_adjacent_post(false, '', false); |
|
298 | 298 | |
299 | - if ( ! $next && ! $previous ) |
|
299 | + if ( ! $next && ! $previous) |
|
300 | 300 | return; |
301 | 301 | ?> |
302 | 302 | <nav class="navigation post-navigation" role="navigation"> |
303 | - <h1 class="screen-reader-text"><?php _e( 'Post navigation', 'twentythirteen' ); ?></h1> |
|
303 | + <h1 class="screen-reader-text"><?php _e('Post navigation', 'twentythirteen'); ?></h1> |
|
304 | 304 | <div class="nav-links"> |
305 | 305 | |
306 | - <?php previous_post_link( '%link', _x( '<span class="meta-nav">←</span> %title', 'Previous post link', 'twentythirteen' ) ); ?> |
|
307 | - <?php next_post_link( '%link', _x( '%title <span class="meta-nav">→</span>', 'Next post link', 'twentythirteen' ) ); ?> |
|
306 | + <?php previous_post_link('%link', _x('<span class="meta-nav">←</span> %title', 'Previous post link', 'twentythirteen')); ?> |
|
307 | + <?php next_post_link('%link', _x('%title <span class="meta-nav">→</span>', 'Next post link', 'twentythirteen')); ?> |
|
308 | 308 | |
309 | 309 | </div><!-- .nav-links --> |
310 | 310 | </nav><!-- .navigation --> |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | } |
313 | 313 | endif; |
314 | 314 | |
315 | -if ( ! function_exists( 'twentythirteen_entry_meta' ) ) : |
|
315 | +if ( ! function_exists('twentythirteen_entry_meta')) : |
|
316 | 316 | /** |
317 | 317 | * Print HTML with meta information for current post: categories, tags, permalink, author, and date. |
318 | 318 | * |
@@ -321,36 +321,36 @@ discard block |
||
321 | 321 | * @since Twenty Thirteen 1.0 |
322 | 322 | */ |
323 | 323 | function twentythirteen_entry_meta() { |
324 | - if ( is_sticky() && is_home() && ! is_paged() ) |
|
325 | - echo '<span class="featured-post">' . esc_html__( 'Sticky', 'twentythirteen' ) . '</span>'; |
|
324 | + if (is_sticky() && is_home() && ! is_paged()) |
|
325 | + echo '<span class="featured-post">'.esc_html__('Sticky', 'twentythirteen').'</span>'; |
|
326 | 326 | |
327 | - if ( ! has_post_format( 'link' ) && 'post' == get_post_type() ) |
|
327 | + if ( ! has_post_format('link') && 'post' == get_post_type()) |
|
328 | 328 | twentythirteen_entry_date(); |
329 | 329 | |
330 | 330 | // Translators: used between list items, there is a space after the comma. |
331 | - $categories_list = get_the_category_list( __( ', ', 'twentythirteen' ) ); |
|
332 | - if ( $categories_list ) { |
|
333 | - echo '<span class="categories-links">' . $categories_list . '</span>'; |
|
331 | + $categories_list = get_the_category_list(__(', ', 'twentythirteen')); |
|
332 | + if ($categories_list) { |
|
333 | + echo '<span class="categories-links">'.$categories_list.'</span>'; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | // Translators: used between list items, there is a space after the comma. |
337 | - $tag_list = get_the_tag_list( '', __( ', ', 'twentythirteen' ) ); |
|
338 | - if ( $tag_list ) { |
|
339 | - echo '<span class="tags-links">' . $tag_list . '</span>'; |
|
337 | + $tag_list = get_the_tag_list('', __(', ', 'twentythirteen')); |
|
338 | + if ($tag_list) { |
|
339 | + echo '<span class="tags-links">'.$tag_list.'</span>'; |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | // Post author |
343 | - if ( 'post' == get_post_type() ) { |
|
344 | - printf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>', |
|
345 | - esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), |
|
346 | - esc_attr( sprintf( __( 'View all posts by %s', 'twentythirteen' ), get_the_author() ) ), |
|
343 | + if ('post' == get_post_type()) { |
|
344 | + printf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>', |
|
345 | + esc_url(get_author_posts_url(get_the_author_meta('ID'))), |
|
346 | + esc_attr(sprintf(__('View all posts by %s', 'twentythirteen'), get_the_author())), |
|
347 | 347 | get_the_author() |
348 | 348 | ); |
349 | 349 | } |
350 | 350 | } |
351 | 351 | endif; |
352 | 352 | |
353 | -if ( ! function_exists( 'twentythirteen_entry_date' ) ) : |
|
353 | +if ( ! function_exists('twentythirteen_entry_date')) : |
|
354 | 354 | /** |
355 | 355 | * Print HTML with date information for current post. |
356 | 356 | * |
@@ -361,27 +361,27 @@ discard block |
||
361 | 361 | * @param boolean $echo (optional) Whether to echo the date. Default true. |
362 | 362 | * @return string The HTML-formatted post date. |
363 | 363 | */ |
364 | -function twentythirteen_entry_date( $echo = true ) { |
|
365 | - if ( has_post_format( array( 'chat', 'status' ) ) ) |
|
366 | - $format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'twentythirteen' ); |
|
364 | +function twentythirteen_entry_date($echo = true) { |
|
365 | + if (has_post_format(array('chat', 'status'))) |
|
366 | + $format_prefix = _x('%1$s on %2$s', '1: post format name. 2: date', 'twentythirteen'); |
|
367 | 367 | else |
368 | 368 | $format_prefix = '%2$s'; |
369 | 369 | |
370 | - $date = sprintf( '<span class="date"><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a></span>', |
|
371 | - esc_url( get_permalink() ), |
|
372 | - esc_attr( sprintf( __( 'Permalink to %s', 'twentythirteen' ), the_title_attribute( 'echo=0' ) ) ), |
|
373 | - esc_attr( get_the_date( 'c' ) ), |
|
374 | - esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) ) |
|
370 | + $date = sprintf('<span class="date"><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a></span>', |
|
371 | + esc_url(get_permalink()), |
|
372 | + esc_attr(sprintf(__('Permalink to %s', 'twentythirteen'), the_title_attribute('echo=0'))), |
|
373 | + esc_attr(get_the_date('c')), |
|
374 | + esc_html(sprintf($format_prefix, get_post_format_string(get_post_format()), get_the_date())) |
|
375 | 375 | ); |
376 | 376 | |
377 | - if ( $echo ) |
|
377 | + if ($echo) |
|
378 | 378 | echo $date; |
379 | 379 | |
380 | 380 | return $date; |
381 | 381 | } |
382 | 382 | endif; |
383 | 383 | |
384 | -if ( ! function_exists( 'twentythirteen_the_attached_image' ) ) : |
|
384 | +if ( ! function_exists('twentythirteen_the_attached_image')) : |
|
385 | 385 | /** |
386 | 386 | * Print the attached image with a link to the next attached image. |
387 | 387 | * |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * @type int The attachment width in pixels. |
399 | 399 | * } |
400 | 400 | */ |
401 | - $attachment_size = apply_filters( 'twentythirteen_attachment_size', array( 724, 724 ) ); |
|
401 | + $attachment_size = apply_filters('twentythirteen_attachment_size', array(724, 724)); |
|
402 | 402 | $next_attachment_url = wp_get_attachment_url(); |
403 | 403 | $post = get_post(); |
404 | 404 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * looking at the last image in a gallery), or, in a gallery of one, just the |
409 | 409 | * link to that image file. |
410 | 410 | */ |
411 | - $attachment_ids = get_posts( array( |
|
411 | + $attachment_ids = get_posts(array( |
|
412 | 412 | 'post_parent' => $post->post_parent, |
413 | 413 | 'fields' => 'ids', |
414 | 414 | 'numberposts' => -1, |
@@ -417,30 +417,30 @@ discard block |
||
417 | 417 | 'post_mime_type' => 'image', |
418 | 418 | 'order' => 'ASC', |
419 | 419 | 'orderby' => 'menu_order ID', |
420 | - ) ); |
|
420 | + )); |
|
421 | 421 | |
422 | 422 | // If there is more than 1 attachment in a gallery... |
423 | - if ( count( $attachment_ids ) > 1 ) { |
|
424 | - foreach ( $attachment_ids as $idx => $attachment_id ) { |
|
425 | - if ( $attachment_id == $post->ID ) { |
|
426 | - $next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ]; |
|
423 | + if (count($attachment_ids) > 1) { |
|
424 | + foreach ($attachment_ids as $idx => $attachment_id) { |
|
425 | + if ($attachment_id == $post->ID) { |
|
426 | + $next_id = $attachment_ids[($idx + 1) % count($attachment_ids)]; |
|
427 | 427 | break; |
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
431 | 431 | // get the URL of the next image attachment... |
432 | - if ( $next_id ) |
|
433 | - $next_attachment_url = get_attachment_link( $next_id ); |
|
432 | + if ($next_id) |
|
433 | + $next_attachment_url = get_attachment_link($next_id); |
|
434 | 434 | |
435 | 435 | // or get the URL of the first image attachment. |
436 | 436 | else |
437 | - $next_attachment_url = get_attachment_link( reset( $attachment_ids ) ); |
|
437 | + $next_attachment_url = get_attachment_link(reset($attachment_ids)); |
|
438 | 438 | } |
439 | 439 | |
440 | - printf( '<a href="%1$s" title="%2$s" rel="attachment">%3$s</a>', |
|
441 | - esc_url( $next_attachment_url ), |
|
442 | - the_title_attribute( array( 'echo' => false ) ), |
|
443 | - wp_get_attachment_image( $post->ID, $attachment_size ) |
|
440 | + printf('<a href="%1$s" title="%2$s" rel="attachment">%3$s</a>', |
|
441 | + esc_url($next_attachment_url), |
|
442 | + the_title_attribute(array('echo' => false)), |
|
443 | + wp_get_attachment_image($post->ID, $attachment_size) |
|
444 | 444 | ); |
445 | 445 | } |
446 | 446 | endif; |
@@ -459,12 +459,12 @@ discard block |
||
459 | 459 | */ |
460 | 460 | function twentythirteen_get_link_url() { |
461 | 461 | $content = get_the_content(); |
462 | - $has_url = get_url_in_content( $content ); |
|
462 | + $has_url = get_url_in_content($content); |
|
463 | 463 | |
464 | - return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); |
|
464 | + return ($has_url) ? $has_url : apply_filters('the_permalink', get_permalink()); |
|
465 | 465 | } |
466 | 466 | |
467 | -if ( ! function_exists( 'twentythirteen_excerpt_more' ) && ! is_admin() ) : |
|
467 | +if ( ! function_exists('twentythirteen_excerpt_more') && ! is_admin()) : |
|
468 | 468 | /** |
469 | 469 | * Replaces "[...]" (appended to automatically generated excerpts) with ... |
470 | 470 | * and a Continue reading link. |
@@ -474,15 +474,15 @@ discard block |
||
474 | 474 | * @param string $more Default Read More excerpt link. |
475 | 475 | * @return string Filtered Read More excerpt link. |
476 | 476 | */ |
477 | -function twentythirteen_excerpt_more( $more ) { |
|
478 | - $link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>', |
|
479 | - esc_url( get_permalink( get_the_ID() ) ), |
|
477 | +function twentythirteen_excerpt_more($more) { |
|
478 | + $link = sprintf('<a href="%1$s" class="more-link">%2$s</a>', |
|
479 | + esc_url(get_permalink(get_the_ID())), |
|
480 | 480 | /* translators: %s: Name of current post */ |
481 | - sprintf( __( 'Continue reading %s <span class="meta-nav">→</span>', 'twentythirteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' ) |
|
481 | + sprintf(__('Continue reading %s <span class="meta-nav">→</span>', 'twentythirteen'), '<span class="screen-reader-text">'.get_the_title(get_the_ID()).'</span>') |
|
482 | 482 | ); |
483 | - return ' … ' . $link; |
|
483 | + return ' … '.$link; |
|
484 | 484 | } |
485 | -add_filter( 'excerpt_more', 'twentythirteen_excerpt_more' ); |
|
485 | +add_filter('excerpt_more', 'twentythirteen_excerpt_more'); |
|
486 | 486 | endif; |
487 | 487 | |
488 | 488 | /** |
@@ -498,19 +498,19 @@ discard block |
||
498 | 498 | * @param array $classes A list of existing body class values. |
499 | 499 | * @return array The filtered body class list. |
500 | 500 | */ |
501 | -function twentythirteen_body_class( $classes ) { |
|
502 | - if ( ! is_multi_author() ) |
|
501 | +function twentythirteen_body_class($classes) { |
|
502 | + if ( ! is_multi_author()) |
|
503 | 503 | $classes[] = 'single-author'; |
504 | 504 | |
505 | - if ( is_active_sidebar( 'sidebar-2' ) && ! is_attachment() && ! is_404() ) |
|
505 | + if (is_active_sidebar('sidebar-2') && ! is_attachment() && ! is_404()) |
|
506 | 506 | $classes[] = 'sidebar'; |
507 | 507 | |
508 | - if ( ! get_option( 'show_avatars' ) ) |
|
508 | + if ( ! get_option('show_avatars')) |
|
509 | 509 | $classes[] = 'no-avatars'; |
510 | 510 | |
511 | 511 | return $classes; |
512 | 512 | } |
513 | -add_filter( 'body_class', 'twentythirteen_body_class' ); |
|
513 | +add_filter('body_class', 'twentythirteen_body_class'); |
|
514 | 514 | |
515 | 515 | /** |
516 | 516 | * Adjust content_width value for video post formats and attachment templates. |
@@ -520,12 +520,12 @@ discard block |
||
520 | 520 | function twentythirteen_content_width() { |
521 | 521 | global $content_width; |
522 | 522 | |
523 | - if ( is_attachment() ) |
|
523 | + if (is_attachment()) |
|
524 | 524 | $content_width = 724; |
525 | - elseif ( has_post_format( 'audio' ) ) |
|
525 | + elseif (has_post_format('audio')) |
|
526 | 526 | $content_width = 484; |
527 | 527 | } |
528 | -add_action( 'template_redirect', 'twentythirteen_content_width' ); |
|
528 | +add_action('template_redirect', 'twentythirteen_content_width'); |
|
529 | 529 | |
530 | 530 | /** |
531 | 531 | * Add postMessage support for site title and description for the Customizer. |
@@ -534,25 +534,25 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @param WP_Customize_Manager $wp_customize Customizer object. |
536 | 536 | */ |
537 | -function twentythirteen_customize_register( $wp_customize ) { |
|
538 | - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
|
539 | - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
540 | - $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; |
|
537 | +function twentythirteen_customize_register($wp_customize) { |
|
538 | + $wp_customize->get_setting('blogname')->transport = 'postMessage'; |
|
539 | + $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; |
|
540 | + $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; |
|
541 | 541 | |
542 | - if ( isset( $wp_customize->selective_refresh ) ) { |
|
543 | - $wp_customize->selective_refresh->add_partial( 'blogname', array( |
|
542 | + if (isset($wp_customize->selective_refresh)) { |
|
543 | + $wp_customize->selective_refresh->add_partial('blogname', array( |
|
544 | 544 | 'selector' => '.site-title', |
545 | 545 | 'container_inclusive' => false, |
546 | 546 | 'render_callback' => 'twentythirteen_customize_partial_blogname', |
547 | - ) ); |
|
548 | - $wp_customize->selective_refresh->add_partial( 'blogdescription', array( |
|
547 | + )); |
|
548 | + $wp_customize->selective_refresh->add_partial('blogdescription', array( |
|
549 | 549 | 'selector' => '.site-description', |
550 | 550 | 'container_inclusive' => false, |
551 | 551 | 'render_callback' => 'twentythirteen_customize_partial_blogdescription', |
552 | - ) ); |
|
552 | + )); |
|
553 | 553 | } |
554 | 554 | } |
555 | -add_action( 'customize_register', 'twentythirteen_customize_register' ); |
|
555 | +add_action('customize_register', 'twentythirteen_customize_register'); |
|
556 | 556 | |
557 | 557 | /** |
558 | 558 | * Render the site title for the selective refresh partial. |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | * @return void |
564 | 564 | */ |
565 | 565 | function twentythirteen_customize_partial_blogname() { |
566 | - bloginfo( 'name' ); |
|
566 | + bloginfo('name'); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | /** |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | * @return void |
576 | 576 | */ |
577 | 577 | function twentythirteen_customize_partial_blogdescription() { |
578 | - bloginfo( 'description' ); |
|
578 | + bloginfo('description'); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | /** |
@@ -587,6 +587,6 @@ discard block |
||
587 | 587 | * @since Twenty Thirteen 1.0 |
588 | 588 | */ |
589 | 589 | function twentythirteen_customize_preview_js() { |
590 | - wp_enqueue_script( 'twentythirteen-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20141120', true ); |
|
590 | + wp_enqueue_script('twentythirteen-customizer', get_template_directory_uri().'/js/theme-customizer.js', array('customize-preview'), '20141120', true); |
|
591 | 591 | } |
592 | -add_action( 'customize_preview_init', 'twentythirteen_customize_preview_js' ); |
|
592 | +add_action('customize_preview_init', 'twentythirteen_customize_preview_js'); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Set up the content width value based on the theme's design and stylesheet. |
26 | -if ( ! isset( $content_width ) ) |
|
26 | +if ( ! isset($content_width)) |
|
27 | 27 | $content_width = 625; |
28 | 28 | |
29 | 29 | /** |
@@ -49,41 +49,41 @@ discard block |
||
49 | 49 | * If you're building a theme based on Twenty Twelve, use a find and replace |
50 | 50 | * to change 'twentytwelve' to the name of your theme in all the template files. |
51 | 51 | */ |
52 | - load_theme_textdomain( 'twentytwelve' ); |
|
52 | + load_theme_textdomain('twentytwelve'); |
|
53 | 53 | |
54 | 54 | // This theme styles the visual editor with editor-style.css to match the theme style. |
55 | 55 | add_editor_style(); |
56 | 56 | |
57 | 57 | // Adds RSS feed links to <head> for posts and comments. |
58 | - add_theme_support( 'automatic-feed-links' ); |
|
58 | + add_theme_support('automatic-feed-links'); |
|
59 | 59 | |
60 | 60 | // This theme supports a variety of post formats. |
61 | - add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status' ) ); |
|
61 | + add_theme_support('post-formats', array('aside', 'image', 'link', 'quote', 'status')); |
|
62 | 62 | |
63 | 63 | // This theme uses wp_nav_menu() in one location. |
64 | - register_nav_menu( 'primary', __( 'Primary Menu', 'twentytwelve' ) ); |
|
64 | + register_nav_menu('primary', __('Primary Menu', 'twentytwelve')); |
|
65 | 65 | |
66 | 66 | /* |
67 | 67 | * This theme supports custom background color and image, |
68 | 68 | * and here we also set up the default background color. |
69 | 69 | */ |
70 | - add_theme_support( 'custom-background', array( |
|
70 | + add_theme_support('custom-background', array( |
|
71 | 71 | 'default-color' => 'e6e6e6', |
72 | - ) ); |
|
72 | + )); |
|
73 | 73 | |
74 | 74 | // This theme uses a custom image size for featured images, displayed on "standard" posts. |
75 | - add_theme_support( 'post-thumbnails' ); |
|
76 | - set_post_thumbnail_size( 624, 9999 ); // Unlimited height, soft crop |
|
75 | + add_theme_support('post-thumbnails'); |
|
76 | + set_post_thumbnail_size(624, 9999); // Unlimited height, soft crop |
|
77 | 77 | |
78 | 78 | // Indicate widget sidebars can use selective refresh in the Customizer. |
79 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
79 | + add_theme_support('customize-selective-refresh-widgets'); |
|
80 | 80 | } |
81 | -add_action( 'after_setup_theme', 'twentytwelve_setup' ); |
|
81 | +add_action('after_setup_theme', 'twentytwelve_setup'); |
|
82 | 82 | |
83 | 83 | /** |
84 | 84 | * Add support for a custom header image. |
85 | 85 | */ |
86 | -require( get_template_directory() . '/inc/custom-header.php' ); |
|
86 | +require(get_template_directory().'/inc/custom-header.php'); |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Return the Google font stylesheet URL if available. |
@@ -101,26 +101,26 @@ discard block |
||
101 | 101 | /* translators: If there are characters in your language that are not supported |
102 | 102 | * by Open Sans, translate this to 'off'. Do not translate into your own language. |
103 | 103 | */ |
104 | - if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'twentytwelve' ) ) { |
|
104 | + if ('off' !== _x('on', 'Open Sans font: on or off', 'twentytwelve')) { |
|
105 | 105 | $subsets = 'latin,latin-ext'; |
106 | 106 | |
107 | 107 | /* translators: To add an additional Open Sans character subset specific to your language, |
108 | 108 | * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. |
109 | 109 | */ |
110 | - $subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'twentytwelve' ); |
|
110 | + $subset = _x('no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'twentytwelve'); |
|
111 | 111 | |
112 | - if ( 'cyrillic' == $subset ) |
|
112 | + if ('cyrillic' == $subset) |
|
113 | 113 | $subsets .= ',cyrillic,cyrillic-ext'; |
114 | - elseif ( 'greek' == $subset ) |
|
114 | + elseif ('greek' == $subset) |
|
115 | 115 | $subsets .= ',greek,greek-ext'; |
116 | - elseif ( 'vietnamese' == $subset ) |
|
116 | + elseif ('vietnamese' == $subset) |
|
117 | 117 | $subsets .= ',vietnamese'; |
118 | 118 | |
119 | 119 | $query_args = array( |
120 | 120 | 'family' => 'Open+Sans:400italic,700italic,400,700', |
121 | 121 | 'subset' => $subsets, |
122 | 122 | ); |
123 | - $font_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); |
|
123 | + $font_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css'); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | return $font_url; |
@@ -138,24 +138,24 @@ discard block |
||
138 | 138 | * Adds JavaScript to pages with the comment form to support |
139 | 139 | * sites with threaded comments (when in use). |
140 | 140 | */ |
141 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) |
|
142 | - wp_enqueue_script( 'comment-reply' ); |
|
141 | + if (is_singular() && comments_open() && get_option('thread_comments')) |
|
142 | + wp_enqueue_script('comment-reply'); |
|
143 | 143 | |
144 | 144 | // Adds JavaScript for handling the navigation menu hide-and-show behavior. |
145 | - wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20140711', true ); |
|
145 | + wp_enqueue_script('twentytwelve-navigation', get_template_directory_uri().'/js/navigation.js', array('jquery'), '20140711', true); |
|
146 | 146 | |
147 | 147 | $font_url = twentytwelve_get_font_url(); |
148 | - if ( ! empty( $font_url ) ) |
|
149 | - wp_enqueue_style( 'twentytwelve-fonts', esc_url_raw( $font_url ), array(), null ); |
|
148 | + if ( ! empty($font_url)) |
|
149 | + wp_enqueue_style('twentytwelve-fonts', esc_url_raw($font_url), array(), null); |
|
150 | 150 | |
151 | 151 | // Loads our main stylesheet. |
152 | - wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri() ); |
|
152 | + wp_enqueue_style('twentytwelve-style', get_stylesheet_uri()); |
|
153 | 153 | |
154 | 154 | // Loads the Internet Explorer specific stylesheet. |
155 | - wp_enqueue_style( 'twentytwelve-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentytwelve-style' ), '20121010' ); |
|
156 | - $wp_styles->add_data( 'twentytwelve-ie', 'conditional', 'lt IE 9' ); |
|
155 | + wp_enqueue_style('twentytwelve-ie', get_template_directory_uri().'/css/ie.css', array('twentytwelve-style'), '20121010'); |
|
156 | + $wp_styles->add_data('twentytwelve-ie', 'conditional', 'lt IE 9'); |
|
157 | 157 | } |
158 | -add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' ); |
|
158 | +add_action('wp_enqueue_scripts', 'twentytwelve_scripts_styles'); |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * Filter TinyMCE CSS path to include Google Fonts. |
@@ -169,20 +169,20 @@ discard block |
||
169 | 169 | * @param string $mce_css CSS path to load in TinyMCE. |
170 | 170 | * @return string Filtered CSS path. |
171 | 171 | */ |
172 | -function twentytwelve_mce_css( $mce_css ) { |
|
172 | +function twentytwelve_mce_css($mce_css) { |
|
173 | 173 | $font_url = twentytwelve_get_font_url(); |
174 | 174 | |
175 | - if ( empty( $font_url ) ) |
|
175 | + if (empty($font_url)) |
|
176 | 176 | return $mce_css; |
177 | 177 | |
178 | - if ( ! empty( $mce_css ) ) |
|
178 | + if ( ! empty($mce_css)) |
|
179 | 179 | $mce_css .= ','; |
180 | 180 | |
181 | - $mce_css .= esc_url_raw( str_replace( ',', '%2C', $font_url ) ); |
|
181 | + $mce_css .= esc_url_raw(str_replace(',', '%2C', $font_url)); |
|
182 | 182 | |
183 | 183 | return $mce_css; |
184 | 184 | } |
185 | -add_filter( 'mce_css', 'twentytwelve_mce_css' ); |
|
185 | +add_filter('mce_css', 'twentytwelve_mce_css'); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Filter the page title. |
@@ -196,27 +196,27 @@ discard block |
||
196 | 196 | * @param string $sep Optional separator. |
197 | 197 | * @return string Filtered title. |
198 | 198 | */ |
199 | -function twentytwelve_wp_title( $title, $sep ) { |
|
199 | +function twentytwelve_wp_title($title, $sep) { |
|
200 | 200 | global $paged, $page; |
201 | 201 | |
202 | - if ( is_feed() ) |
|
202 | + if (is_feed()) |
|
203 | 203 | return $title; |
204 | 204 | |
205 | 205 | // Add the site name. |
206 | - $title .= get_bloginfo( 'name', 'display' ); |
|
206 | + $title .= get_bloginfo('name', 'display'); |
|
207 | 207 | |
208 | 208 | // Add the site description for the home/front page. |
209 | - $site_description = get_bloginfo( 'description', 'display' ); |
|
210 | - if ( $site_description && ( is_home() || is_front_page() ) ) |
|
209 | + $site_description = get_bloginfo('description', 'display'); |
|
210 | + if ($site_description && (is_home() || is_front_page())) |
|
211 | 211 | $title = "$title $sep $site_description"; |
212 | 212 | |
213 | 213 | // Add a page number if necessary. |
214 | - if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) |
|
215 | - $title = "$title $sep " . sprintf( __( 'Page %s', 'twentytwelve' ), max( $paged, $page ) ); |
|
214 | + if (($paged >= 2 || $page >= 2) && ! is_404()) |
|
215 | + $title = "$title $sep ".sprintf(__('Page %s', 'twentytwelve'), max($paged, $page)); |
|
216 | 216 | |
217 | 217 | return $title; |
218 | 218 | } |
219 | -add_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 ); |
|
219 | +add_filter('wp_title', 'twentytwelve_wp_title', 10, 2); |
|
220 | 220 | |
221 | 221 | /** |
222 | 222 | * Filter the page menu arguments. |
@@ -225,12 +225,12 @@ discard block |
||
225 | 225 | * |
226 | 226 | * @since Twenty Twelve 1.0 |
227 | 227 | */ |
228 | -function twentytwelve_page_menu_args( $args ) { |
|
229 | - if ( ! isset( $args['show_home'] ) ) |
|
228 | +function twentytwelve_page_menu_args($args) { |
|
229 | + if ( ! isset($args['show_home'])) |
|
230 | 230 | $args['show_home'] = true; |
231 | 231 | return $args; |
232 | 232 | } |
233 | -add_filter( 'wp_page_menu_args', 'twentytwelve_page_menu_args' ); |
|
233 | +add_filter('wp_page_menu_args', 'twentytwelve_page_menu_args'); |
|
234 | 234 | |
235 | 235 | /** |
236 | 236 | * Register sidebars. |
@@ -240,58 +240,58 @@ discard block |
||
240 | 240 | * @since Twenty Twelve 1.0 |
241 | 241 | */ |
242 | 242 | function twentytwelve_widgets_init() { |
243 | - register_sidebar( array( |
|
244 | - 'name' => __( 'Main Sidebar', 'twentytwelve' ), |
|
243 | + register_sidebar(array( |
|
244 | + 'name' => __('Main Sidebar', 'twentytwelve'), |
|
245 | 245 | 'id' => 'sidebar-1', |
246 | - 'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'twentytwelve' ), |
|
246 | + 'description' => __('Appears on posts and pages except the optional Front Page template, which has its own widgets', 'twentytwelve'), |
|
247 | 247 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
248 | 248 | 'after_widget' => '</aside>', |
249 | 249 | 'before_title' => '<h3 class="widget-title">', |
250 | 250 | 'after_title' => '</h3>', |
251 | - ) ); |
|
251 | + )); |
|
252 | 252 | |
253 | - register_sidebar( array( |
|
254 | - 'name' => __( 'First Front Page Widget Area', 'twentytwelve' ), |
|
253 | + register_sidebar(array( |
|
254 | + 'name' => __('First Front Page Widget Area', 'twentytwelve'), |
|
255 | 255 | 'id' => 'sidebar-2', |
256 | - 'description' => __( 'Appears when using the optional Front Page template with a page set as Static Front Page', 'twentytwelve' ), |
|
256 | + 'description' => __('Appears when using the optional Front Page template with a page set as Static Front Page', 'twentytwelve'), |
|
257 | 257 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
258 | 258 | 'after_widget' => '</aside>', |
259 | 259 | 'before_title' => '<h3 class="widget-title">', |
260 | 260 | 'after_title' => '</h3>', |
261 | - ) ); |
|
261 | + )); |
|
262 | 262 | |
263 | - register_sidebar( array( |
|
264 | - 'name' => __( 'Second Front Page Widget Area', 'twentytwelve' ), |
|
263 | + register_sidebar(array( |
|
264 | + 'name' => __('Second Front Page Widget Area', 'twentytwelve'), |
|
265 | 265 | 'id' => 'sidebar-3', |
266 | - 'description' => __( 'Appears when using the optional Front Page template with a page set as Static Front Page', 'twentytwelve' ), |
|
266 | + 'description' => __('Appears when using the optional Front Page template with a page set as Static Front Page', 'twentytwelve'), |
|
267 | 267 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
268 | 268 | 'after_widget' => '</aside>', |
269 | 269 | 'before_title' => '<h3 class="widget-title">', |
270 | 270 | 'after_title' => '</h3>', |
271 | - ) ); |
|
271 | + )); |
|
272 | 272 | } |
273 | -add_action( 'widgets_init', 'twentytwelve_widgets_init' ); |
|
273 | +add_action('widgets_init', 'twentytwelve_widgets_init'); |
|
274 | 274 | |
275 | -if ( ! function_exists( 'twentytwelve_content_nav' ) ) : |
|
275 | +if ( ! function_exists('twentytwelve_content_nav')) : |
|
276 | 276 | /** |
277 | 277 | * Displays navigation to next/previous pages when applicable. |
278 | 278 | * |
279 | 279 | * @since Twenty Twelve 1.0 |
280 | 280 | */ |
281 | -function twentytwelve_content_nav( $html_id ) { |
|
281 | +function twentytwelve_content_nav($html_id) { |
|
282 | 282 | global $wp_query; |
283 | 283 | |
284 | - if ( $wp_query->max_num_pages > 1 ) : ?> |
|
285 | - <nav id="<?php echo esc_attr( $html_id ); ?>" class="navigation" role="navigation"> |
|
286 | - <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3> |
|
287 | - <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentytwelve' ) ); ?></div> |
|
288 | - <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?></div> |
|
284 | + if ($wp_query->max_num_pages > 1) : ?> |
|
285 | + <nav id="<?php echo esc_attr($html_id); ?>" class="navigation" role="navigation"> |
|
286 | + <h3 class="assistive-text"><?php _e('Post navigation', 'twentytwelve'); ?></h3> |
|
287 | + <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">←</span> Older posts', 'twentytwelve')); ?></div> |
|
288 | + <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'twentytwelve')); ?></div> |
|
289 | 289 | </nav><!-- .navigation --> |
290 | 290 | <?php endif; |
291 | 291 | } |
292 | 292 | endif; |
293 | 293 | |
294 | -if ( ! function_exists( 'twentytwelve_comment' ) ) : |
|
294 | +if ( ! function_exists('twentytwelve_comment')) : |
|
295 | 295 | /** |
296 | 296 | * Template for comments and pingbacks. |
297 | 297 | * |
@@ -302,15 +302,15 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @since Twenty Twelve 1.0 |
304 | 304 | */ |
305 | -function twentytwelve_comment( $comment, $args, $depth ) { |
|
305 | +function twentytwelve_comment($comment, $args, $depth) { |
|
306 | 306 | $GLOBALS['comment'] = $comment; |
307 | - switch ( $comment->comment_type ) : |
|
307 | + switch ($comment->comment_type) : |
|
308 | 308 | case 'pingback' : |
309 | 309 | case 'trackback' : |
310 | 310 | // Display trackbacks differently than normal comments. |
311 | 311 | ?> |
312 | 312 | <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>"> |
313 | - <p><?php _e( 'Pingback:', 'twentytwelve' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?></p> |
|
313 | + <p><?php _e('Pingback:', 'twentytwelve'); ?> <?php comment_author_link(); ?> <?php edit_comment_link(__('(Edit)', 'twentytwelve'), '<span class="edit-link">', '</span>'); ?></p> |
|
314 | 314 | <?php |
315 | 315 | break; |
316 | 316 | default : |
@@ -321,32 +321,32 @@ discard block |
||
321 | 321 | <article id="comment-<?php comment_ID(); ?>" class="comment"> |
322 | 322 | <header class="comment-meta comment-author vcard"> |
323 | 323 | <?php |
324 | - echo get_avatar( $comment, 44 ); |
|
325 | - printf( '<cite><b class="fn">%1$s</b> %2$s</cite>', |
|
324 | + echo get_avatar($comment, 44); |
|
325 | + printf('<cite><b class="fn">%1$s</b> %2$s</cite>', |
|
326 | 326 | get_comment_author_link(), |
327 | 327 | // If current post author is also comment author, make it known visually. |
328 | - ( $comment->user_id === $post->post_author ) ? '<span>' . __( 'Post author', 'twentytwelve' ) . '</span>' : '' |
|
328 | + ($comment->user_id === $post->post_author) ? '<span>'.__('Post author', 'twentytwelve').'</span>' : '' |
|
329 | 329 | ); |
330 | - printf( '<a href="%1$s"><time datetime="%2$s">%3$s</time></a>', |
|
331 | - esc_url( get_comment_link( $comment->comment_ID ) ), |
|
332 | - get_comment_time( 'c' ), |
|
330 | + printf('<a href="%1$s"><time datetime="%2$s">%3$s</time></a>', |
|
331 | + esc_url(get_comment_link($comment->comment_ID)), |
|
332 | + get_comment_time('c'), |
|
333 | 333 | /* translators: 1: date, 2: time */ |
334 | - sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() ) |
|
334 | + sprintf(__('%1$s at %2$s', 'twentytwelve'), get_comment_date(), get_comment_time()) |
|
335 | 335 | ); |
336 | 336 | ?> |
337 | 337 | </header><!-- .comment-meta --> |
338 | 338 | |
339 | - <?php if ( '0' == $comment->comment_approved ) : ?> |
|
340 | - <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentytwelve' ); ?></p> |
|
339 | + <?php if ('0' == $comment->comment_approved) : ?> |
|
340 | + <p class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.', 'twentytwelve'); ?></p> |
|
341 | 341 | <?php endif; ?> |
342 | 342 | |
343 | 343 | <section class="comment-content comment"> |
344 | 344 | <?php comment_text(); ?> |
345 | - <?php edit_comment_link( __( 'Edit', 'twentytwelve' ), '<p class="edit-link">', '</p>' ); ?> |
|
345 | + <?php edit_comment_link(__('Edit', 'twentytwelve'), '<p class="edit-link">', '</p>'); ?> |
|
346 | 346 | </section><!-- .comment-content --> |
347 | 347 | |
348 | 348 | <div class="reply"> |
349 | - <?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply', 'twentytwelve' ), 'after' => ' <span>↓</span>', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> |
|
349 | + <?php comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'twentytwelve'), 'after' => ' <span>↓</span>', 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?> |
|
350 | 350 | </div><!-- .reply --> |
351 | 351 | </article><!-- #comment-## --> |
352 | 352 | <?php |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | } |
356 | 356 | endif; |
357 | 357 | |
358 | -if ( ! function_exists( 'twentytwelve_entry_meta' ) ) : |
|
358 | +if ( ! function_exists('twentytwelve_entry_meta')) : |
|
359 | 359 | /** |
360 | 360 | * Set up post entry meta. |
361 | 361 | * |
@@ -367,31 +367,31 @@ discard block |
||
367 | 367 | */ |
368 | 368 | function twentytwelve_entry_meta() { |
369 | 369 | // Translators: used between list items, there is a space after the comma. |
370 | - $categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) ); |
|
370 | + $categories_list = get_the_category_list(__(', ', 'twentytwelve')); |
|
371 | 371 | |
372 | 372 | // Translators: used between list items, there is a space after the comma. |
373 | - $tag_list = get_the_tag_list( '', __( ', ', 'twentytwelve' ) ); |
|
373 | + $tag_list = get_the_tag_list('', __(', ', 'twentytwelve')); |
|
374 | 374 | |
375 | - $date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>', |
|
376 | - esc_url( get_permalink() ), |
|
377 | - esc_attr( get_the_time() ), |
|
378 | - esc_attr( get_the_date( 'c' ) ), |
|
379 | - esc_html( get_the_date() ) |
|
375 | + $date = sprintf('<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>', |
|
376 | + esc_url(get_permalink()), |
|
377 | + esc_attr(get_the_time()), |
|
378 | + esc_attr(get_the_date('c')), |
|
379 | + esc_html(get_the_date()) |
|
380 | 380 | ); |
381 | 381 | |
382 | - $author = sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>', |
|
383 | - esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), |
|
384 | - esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ), |
|
382 | + $author = sprintf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>', |
|
383 | + esc_url(get_author_posts_url(get_the_author_meta('ID'))), |
|
384 | + esc_attr(sprintf(__('View all posts by %s', 'twentytwelve'), get_the_author())), |
|
385 | 385 | get_the_author() |
386 | 386 | ); |
387 | 387 | |
388 | 388 | // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name. |
389 | - if ( $tag_list ) { |
|
390 | - $utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' ); |
|
391 | - } elseif ( $categories_list ) { |
|
392 | - $utility_text = __( 'This entry was posted in %1$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' ); |
|
389 | + if ($tag_list) { |
|
390 | + $utility_text = __('This entry was posted in %1$s and tagged %2$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve'); |
|
391 | + } elseif ($categories_list) { |
|
392 | + $utility_text = __('This entry was posted in %1$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve'); |
|
393 | 393 | } else { |
394 | - $utility_text = __( 'This entry was posted on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' ); |
|
394 | + $utility_text = __('This entry was posted on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve'); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | printf( |
@@ -421,38 +421,38 @@ discard block |
||
421 | 421 | * @param array $classes Existing class values. |
422 | 422 | * @return array Filtered class values. |
423 | 423 | */ |
424 | -function twentytwelve_body_class( $classes ) { |
|
424 | +function twentytwelve_body_class($classes) { |
|
425 | 425 | $background_color = get_background_color(); |
426 | 426 | $background_image = get_background_image(); |
427 | 427 | |
428 | - if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'page-templates/full-width.php' ) ) |
|
428 | + if ( ! is_active_sidebar('sidebar-1') || is_page_template('page-templates/full-width.php')) |
|
429 | 429 | $classes[] = 'full-width'; |
430 | 430 | |
431 | - if ( is_page_template( 'page-templates/front-page.php' ) ) { |
|
431 | + if (is_page_template('page-templates/front-page.php')) { |
|
432 | 432 | $classes[] = 'template-front-page'; |
433 | - if ( has_post_thumbnail() ) |
|
433 | + if (has_post_thumbnail()) |
|
434 | 434 | $classes[] = 'has-post-thumbnail'; |
435 | - if ( is_active_sidebar( 'sidebar-2' ) && is_active_sidebar( 'sidebar-3' ) ) |
|
435 | + if (is_active_sidebar('sidebar-2') && is_active_sidebar('sidebar-3')) |
|
436 | 436 | $classes[] = 'two-sidebars'; |
437 | 437 | } |
438 | 438 | |
439 | - if ( empty( $background_image ) ) { |
|
440 | - if ( empty( $background_color ) ) |
|
439 | + if (empty($background_image)) { |
|
440 | + if (empty($background_color)) |
|
441 | 441 | $classes[] = 'custom-background-empty'; |
442 | - elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) ) |
|
442 | + elseif (in_array($background_color, array('fff', 'ffffff'))) |
|
443 | 443 | $classes[] = 'custom-background-white'; |
444 | 444 | } |
445 | 445 | |
446 | 446 | // Enable custom font class only if the font CSS is queued to load. |
447 | - if ( wp_style_is( 'twentytwelve-fonts', 'queue' ) ) |
|
447 | + if (wp_style_is('twentytwelve-fonts', 'queue')) |
|
448 | 448 | $classes[] = 'custom-font-enabled'; |
449 | 449 | |
450 | - if ( ! is_multi_author() ) |
|
450 | + if ( ! is_multi_author()) |
|
451 | 451 | $classes[] = 'single-author'; |
452 | 452 | |
453 | 453 | return $classes; |
454 | 454 | } |
455 | -add_filter( 'body_class', 'twentytwelve_body_class' ); |
|
455 | +add_filter('body_class', 'twentytwelve_body_class'); |
|
456 | 456 | |
457 | 457 | /** |
458 | 458 | * Adjust content width in certain contexts. |
@@ -463,12 +463,12 @@ discard block |
||
463 | 463 | * @since Twenty Twelve 1.0 |
464 | 464 | */ |
465 | 465 | function twentytwelve_content_width() { |
466 | - if ( is_page_template( 'page-templates/full-width.php' ) || is_attachment() || ! is_active_sidebar( 'sidebar-1' ) ) { |
|
466 | + if (is_page_template('page-templates/full-width.php') || is_attachment() || ! is_active_sidebar('sidebar-1')) { |
|
467 | 467 | global $content_width; |
468 | 468 | $content_width = 960; |
469 | 469 | } |
470 | 470 | } |
471 | -add_action( 'template_redirect', 'twentytwelve_content_width' ); |
|
471 | +add_action('template_redirect', 'twentytwelve_content_width'); |
|
472 | 472 | |
473 | 473 | /** |
474 | 474 | * Register postMessage support. |
@@ -479,25 +479,25 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @param WP_Customize_Manager $wp_customize Customizer object. |
481 | 481 | */ |
482 | -function twentytwelve_customize_register( $wp_customize ) { |
|
483 | - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
|
484 | - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
485 | - $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; |
|
482 | +function twentytwelve_customize_register($wp_customize) { |
|
483 | + $wp_customize->get_setting('blogname')->transport = 'postMessage'; |
|
484 | + $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; |
|
485 | + $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; |
|
486 | 486 | |
487 | - if ( isset( $wp_customize->selective_refresh ) ) { |
|
488 | - $wp_customize->selective_refresh->add_partial( 'blogname', array( |
|
487 | + if (isset($wp_customize->selective_refresh)) { |
|
488 | + $wp_customize->selective_refresh->add_partial('blogname', array( |
|
489 | 489 | 'selector' => '.site-title > a', |
490 | 490 | 'container_inclusive' => false, |
491 | 491 | 'render_callback' => 'twentytwelve_customize_partial_blogname', |
492 | - ) ); |
|
493 | - $wp_customize->selective_refresh->add_partial( 'blogdescription', array( |
|
492 | + )); |
|
493 | + $wp_customize->selective_refresh->add_partial('blogdescription', array( |
|
494 | 494 | 'selector' => '.site-description', |
495 | 495 | 'container_inclusive' => false, |
496 | 496 | 'render_callback' => 'twentytwelve_customize_partial_blogdescription', |
497 | - ) ); |
|
497 | + )); |
|
498 | 498 | } |
499 | 499 | } |
500 | -add_action( 'customize_register', 'twentytwelve_customize_register' ); |
|
500 | +add_action('customize_register', 'twentytwelve_customize_register'); |
|
501 | 501 | |
502 | 502 | /** |
503 | 503 | * Render the site title for the selective refresh partial. |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @return void |
509 | 509 | */ |
510 | 510 | function twentytwelve_customize_partial_blogname() { |
511 | - bloginfo( 'name' ); |
|
511 | + bloginfo('name'); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | /** |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | * @return void |
521 | 521 | */ |
522 | 522 | function twentytwelve_customize_partial_blogdescription() { |
523 | - bloginfo( 'description' ); |
|
523 | + bloginfo('description'); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | /** |
@@ -531,6 +531,6 @@ discard block |
||
531 | 531 | * @since Twenty Twelve 1.0 |
532 | 532 | */ |
533 | 533 | function twentytwelve_customize_preview_js() { |
534 | - wp_enqueue_script( 'twentytwelve-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20141120', true ); |
|
534 | + wp_enqueue_script('twentytwelve-customizer', get_template_directory_uri().'/js/theme-customizer.js', array('customize-preview'), '20141120', true); |
|
535 | 535 | } |
536 | -add_action( 'customize_preview_init', 'twentytwelve_customize_preview_js' ); |
|
536 | +add_action('customize_preview_init', 'twentytwelve_customize_preview_js'); |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @since Twenty Fifteen 1.0 |
32 | 32 | */ |
33 | -if ( ! isset( $content_width ) ) { |
|
33 | +if ( ! isset($content_width)) { |
|
34 | 34 | $content_width = 660; |
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Twenty Fifteen only works in WordPress 4.1 or later. |
39 | 39 | */ |
40 | -if ( version_compare( $GLOBALS['wp_version'], '4.1-alpha', '<' ) ) { |
|
41 | - require get_template_directory() . '/inc/back-compat.php'; |
|
40 | +if (version_compare($GLOBALS['wp_version'], '4.1-alpha', '<')) { |
|
41 | + require get_template_directory().'/inc/back-compat.php'; |
|
42 | 42 | } |
43 | 43 | |
44 | -if ( ! function_exists( 'twentyfifteen_setup' ) ) : |
|
44 | +if ( ! function_exists('twentyfifteen_setup')) : |
|
45 | 45 | /** |
46 | 46 | * Sets up theme defaults and registers support for various WordPress features. |
47 | 47 | * |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | * If you're building a theme based on twentyfifteen, use a find and replace |
60 | 60 | * to change 'twentyfifteen' to the name of your theme in all the template files |
61 | 61 | */ |
62 | - load_theme_textdomain( 'twentyfifteen' ); |
|
62 | + load_theme_textdomain('twentyfifteen'); |
|
63 | 63 | |
64 | 64 | // Add default posts and comments RSS feed links to head. |
65 | - add_theme_support( 'automatic-feed-links' ); |
|
65 | + add_theme_support('automatic-feed-links'); |
|
66 | 66 | |
67 | 67 | /* |
68 | 68 | * Let WordPress manage the document title. |
@@ -70,70 +70,70 @@ discard block |
||
70 | 70 | * hard-coded <title> tag in the document head, and expect WordPress to |
71 | 71 | * provide it for us. |
72 | 72 | */ |
73 | - add_theme_support( 'title-tag' ); |
|
73 | + add_theme_support('title-tag'); |
|
74 | 74 | |
75 | 75 | /* |
76 | 76 | * Enable support for Post Thumbnails on posts and pages. |
77 | 77 | * |
78 | 78 | * See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails |
79 | 79 | */ |
80 | - add_theme_support( 'post-thumbnails' ); |
|
81 | - set_post_thumbnail_size( 825, 510, true ); |
|
80 | + add_theme_support('post-thumbnails'); |
|
81 | + set_post_thumbnail_size(825, 510, true); |
|
82 | 82 | |
83 | 83 | // This theme uses wp_nav_menu() in two locations. |
84 | - register_nav_menus( array( |
|
85 | - 'primary' => __( 'Primary Menu', 'twentyfifteen' ), |
|
86 | - 'social' => __( 'Social Links Menu', 'twentyfifteen' ), |
|
87 | - ) ); |
|
84 | + register_nav_menus(array( |
|
85 | + 'primary' => __('Primary Menu', 'twentyfifteen'), |
|
86 | + 'social' => __('Social Links Menu', 'twentyfifteen'), |
|
87 | + )); |
|
88 | 88 | |
89 | 89 | /* |
90 | 90 | * Switch default core markup for search form, comment form, and comments |
91 | 91 | * to output valid HTML5. |
92 | 92 | */ |
93 | - add_theme_support( 'html5', array( |
|
93 | + add_theme_support('html5', array( |
|
94 | 94 | 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' |
95 | - ) ); |
|
95 | + )); |
|
96 | 96 | |
97 | 97 | /* |
98 | 98 | * Enable support for Post Formats. |
99 | 99 | * |
100 | 100 | * See: https://codex.wordpress.org/Post_Formats |
101 | 101 | */ |
102 | - add_theme_support( 'post-formats', array( |
|
102 | + add_theme_support('post-formats', array( |
|
103 | 103 | 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat' |
104 | - ) ); |
|
104 | + )); |
|
105 | 105 | |
106 | 106 | /* |
107 | 107 | * Enable support for custom logo. |
108 | 108 | * |
109 | 109 | * @since Twenty Fifteen 1.5 |
110 | 110 | */ |
111 | - add_theme_support( 'custom-logo', array( |
|
111 | + add_theme_support('custom-logo', array( |
|
112 | 112 | 'height' => 248, |
113 | 113 | 'width' => 248, |
114 | 114 | 'flex-height' => true, |
115 | - ) ); |
|
115 | + )); |
|
116 | 116 | |
117 | 117 | $color_scheme = twentyfifteen_get_color_scheme(); |
118 | - $default_color = trim( $color_scheme[0], '#' ); |
|
118 | + $default_color = trim($color_scheme[0], '#'); |
|
119 | 119 | |
120 | 120 | // Setup the WordPress core custom background feature. |
121 | - add_theme_support( 'custom-background', apply_filters( 'twentyfifteen_custom_background_args', array( |
|
121 | + add_theme_support('custom-background', apply_filters('twentyfifteen_custom_background_args', array( |
|
122 | 122 | 'default-color' => $default_color, |
123 | 123 | 'default-attachment' => 'fixed', |
124 | - ) ) ); |
|
124 | + ))); |
|
125 | 125 | |
126 | 126 | /* |
127 | 127 | * This theme styles the visual editor to resemble the theme style, |
128 | 128 | * specifically font, colors, icons, and column width. |
129 | 129 | */ |
130 | - add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url() ) ); |
|
130 | + add_editor_style(array('css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url())); |
|
131 | 131 | |
132 | 132 | // Indicate widget sidebars can use selective refresh in the Customizer. |
133 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
133 | + add_theme_support('customize-selective-refresh-widgets'); |
|
134 | 134 | } |
135 | 135 | endif; // twentyfifteen_setup |
136 | -add_action( 'after_setup_theme', 'twentyfifteen_setup' ); |
|
136 | +add_action('after_setup_theme', 'twentyfifteen_setup'); |
|
137 | 137 | |
138 | 138 | /** |
139 | 139 | * Register widget area. |
@@ -143,19 +143,19 @@ discard block |
||
143 | 143 | * @link https://codex.wordpress.org/Function_Reference/register_sidebar |
144 | 144 | */ |
145 | 145 | function twentyfifteen_widgets_init() { |
146 | - register_sidebar( array( |
|
147 | - 'name' => __( 'Widget Area', 'twentyfifteen' ), |
|
146 | + register_sidebar(array( |
|
147 | + 'name' => __('Widget Area', 'twentyfifteen'), |
|
148 | 148 | 'id' => 'sidebar-1', |
149 | - 'description' => __( 'Add widgets here to appear in your sidebar.', 'twentyfifteen' ), |
|
149 | + 'description' => __('Add widgets here to appear in your sidebar.', 'twentyfifteen'), |
|
150 | 150 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
151 | 151 | 'after_widget' => '</aside>', |
152 | 152 | 'before_title' => '<h2 class="widget-title">', |
153 | 153 | 'after_title' => '</h2>', |
154 | - ) ); |
|
154 | + )); |
|
155 | 155 | } |
156 | -add_action( 'widgets_init', 'twentyfifteen_widgets_init' ); |
|
156 | +add_action('widgets_init', 'twentyfifteen_widgets_init'); |
|
157 | 157 | |
158 | -if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) : |
|
158 | +if ( ! function_exists('twentyfifteen_fonts_url')) : |
|
159 | 159 | /** |
160 | 160 | * Register Google fonts for Twenty Fifteen. |
161 | 161 | * |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * Translators: If there are characters in your language that are not supported |
173 | 173 | * by Noto Sans, translate this to 'off'. Do not translate into your own language. |
174 | 174 | */ |
175 | - if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'twentyfifteen' ) ) { |
|
175 | + if ('off' !== _x('on', 'Noto Sans font: on or off', 'twentyfifteen')) { |
|
176 | 176 | $fonts[] = 'Noto Sans:400italic,700italic,400,700'; |
177 | 177 | } |
178 | 178 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * Translators: If there are characters in your language that are not supported |
181 | 181 | * by Noto Serif, translate this to 'off'. Do not translate into your own language. |
182 | 182 | */ |
183 | - if ( 'off' !== _x( 'on', 'Noto Serif font: on or off', 'twentyfifteen' ) ) { |
|
183 | + if ('off' !== _x('on', 'Noto Serif font: on or off', 'twentyfifteen')) { |
|
184 | 184 | $fonts[] = 'Noto Serif:400italic,700italic,400,700'; |
185 | 185 | } |
186 | 186 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * Translators: If there are characters in your language that are not supported |
189 | 189 | * by Inconsolata, translate this to 'off'. Do not translate into your own language. |
190 | 190 | */ |
191 | - if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'twentyfifteen' ) ) { |
|
191 | + if ('off' !== _x('on', 'Inconsolata font: on or off', 'twentyfifteen')) { |
|
192 | 192 | $fonts[] = 'Inconsolata:400,700'; |
193 | 193 | } |
194 | 194 | |
@@ -196,23 +196,23 @@ discard block |
||
196 | 196 | * Translators: To add an additional character subset specific to your language, |
197 | 197 | * translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language. |
198 | 198 | */ |
199 | - $subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' ); |
|
199 | + $subset = _x('no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen'); |
|
200 | 200 | |
201 | - if ( 'cyrillic' == $subset ) { |
|
201 | + if ('cyrillic' == $subset) { |
|
202 | 202 | $subsets .= ',cyrillic,cyrillic-ext'; |
203 | - } elseif ( 'greek' == $subset ) { |
|
203 | + } elseif ('greek' == $subset) { |
|
204 | 204 | $subsets .= ',greek,greek-ext'; |
205 | - } elseif ( 'devanagari' == $subset ) { |
|
205 | + } elseif ('devanagari' == $subset) { |
|
206 | 206 | $subsets .= ',devanagari'; |
207 | - } elseif ( 'vietnamese' == $subset ) { |
|
207 | + } elseif ('vietnamese' == $subset) { |
|
208 | 208 | $subsets .= ',vietnamese'; |
209 | 209 | } |
210 | 210 | |
211 | - if ( $fonts ) { |
|
212 | - $fonts_url = add_query_arg( array( |
|
213 | - 'family' => urlencode( implode( '|', $fonts ) ), |
|
214 | - 'subset' => urlencode( $subsets ), |
|
215 | - ), 'https://fonts.googleapis.com/css' ); |
|
211 | + if ($fonts) { |
|
212 | + $fonts_url = add_query_arg(array( |
|
213 | + 'family' => urlencode(implode('|', $fonts)), |
|
214 | + 'subset' => urlencode($subsets), |
|
215 | + ), 'https://fonts.googleapis.com/css'); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | return $fonts_url; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | function twentyfifteen_javascript_detection() { |
230 | 230 | echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n"; |
231 | 231 | } |
232 | -add_action( 'wp_head', 'twentyfifteen_javascript_detection', 0 ); |
|
232 | +add_action('wp_head', 'twentyfifteen_javascript_detection', 0); |
|
233 | 233 | |
234 | 234 | /** |
235 | 235 | * Enqueue scripts and styles. |
@@ -238,39 +238,39 @@ discard block |
||
238 | 238 | */ |
239 | 239 | function twentyfifteen_scripts() { |
240 | 240 | // Add custom fonts, used in the main stylesheet. |
241 | - wp_enqueue_style( 'twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null ); |
|
241 | + wp_enqueue_style('twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null); |
|
242 | 242 | |
243 | 243 | // Add Genericons, used in the main stylesheet. |
244 | - wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.2' ); |
|
244 | + wp_enqueue_style('genericons', get_template_directory_uri().'/genericons/genericons.css', array(), '3.2'); |
|
245 | 245 | |
246 | 246 | // Load our main stylesheet. |
247 | - wp_enqueue_style( 'twentyfifteen-style', get_stylesheet_uri() ); |
|
247 | + wp_enqueue_style('twentyfifteen-style', get_stylesheet_uri()); |
|
248 | 248 | |
249 | 249 | // Load the Internet Explorer specific stylesheet. |
250 | - wp_enqueue_style( 'twentyfifteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfifteen-style' ), '20141010' ); |
|
251 | - wp_style_add_data( 'twentyfifteen-ie', 'conditional', 'lt IE 9' ); |
|
250 | + wp_enqueue_style('twentyfifteen-ie', get_template_directory_uri().'/css/ie.css', array('twentyfifteen-style'), '20141010'); |
|
251 | + wp_style_add_data('twentyfifteen-ie', 'conditional', 'lt IE 9'); |
|
252 | 252 | |
253 | 253 | // Load the Internet Explorer 7 specific stylesheet. |
254 | - wp_enqueue_style( 'twentyfifteen-ie7', get_template_directory_uri() . '/css/ie7.css', array( 'twentyfifteen-style' ), '20141010' ); |
|
255 | - wp_style_add_data( 'twentyfifteen-ie7', 'conditional', 'lt IE 8' ); |
|
254 | + wp_enqueue_style('twentyfifteen-ie7', get_template_directory_uri().'/css/ie7.css', array('twentyfifteen-style'), '20141010'); |
|
255 | + wp_style_add_data('twentyfifteen-ie7', 'conditional', 'lt IE 8'); |
|
256 | 256 | |
257 | - wp_enqueue_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20141010', true ); |
|
257 | + wp_enqueue_script('twentyfifteen-skip-link-focus-fix', get_template_directory_uri().'/js/skip-link-focus-fix.js', array(), '20141010', true); |
|
258 | 258 | |
259 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { |
|
260 | - wp_enqueue_script( 'comment-reply' ); |
|
259 | + if (is_singular() && comments_open() && get_option('thread_comments')) { |
|
260 | + wp_enqueue_script('comment-reply'); |
|
261 | 261 | } |
262 | 262 | |
263 | - if ( is_singular() && wp_attachment_is_image() ) { |
|
264 | - wp_enqueue_script( 'twentyfifteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20141010' ); |
|
263 | + if (is_singular() && wp_attachment_is_image()) { |
|
264 | + wp_enqueue_script('twentyfifteen-keyboard-image-navigation', get_template_directory_uri().'/js/keyboard-image-navigation.js', array('jquery'), '20141010'); |
|
265 | 265 | } |
266 | 266 | |
267 | - wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true ); |
|
268 | - wp_localize_script( 'twentyfifteen-script', 'screenReaderText', array( |
|
269 | - 'expand' => '<span class="screen-reader-text">' . __( 'expand child menu', 'twentyfifteen' ) . '</span>', |
|
270 | - 'collapse' => '<span class="screen-reader-text">' . __( 'collapse child menu', 'twentyfifteen' ) . '</span>', |
|
271 | - ) ); |
|
267 | + wp_enqueue_script('twentyfifteen-script', get_template_directory_uri().'/js/functions.js', array('jquery'), '20150330', true); |
|
268 | + wp_localize_script('twentyfifteen-script', 'screenReaderText', array( |
|
269 | + 'expand' => '<span class="screen-reader-text">'.__('expand child menu', 'twentyfifteen').'</span>', |
|
270 | + 'collapse' => '<span class="screen-reader-text">'.__('collapse child menu', 'twentyfifteen').'</span>', |
|
271 | + )); |
|
272 | 272 | } |
273 | -add_action( 'wp_enqueue_scripts', 'twentyfifteen_scripts' ); |
|
273 | +add_action('wp_enqueue_scripts', 'twentyfifteen_scripts'); |
|
274 | 274 | |
275 | 275 | /** |
276 | 276 | * Add featured image as background image to post navigation elements. |
@@ -280,39 +280,39 @@ discard block |
||
280 | 280 | * @see wp_add_inline_style() |
281 | 281 | */ |
282 | 282 | function twentyfifteen_post_nav_background() { |
283 | - if ( ! is_single() ) { |
|
283 | + if ( ! is_single()) { |
|
284 | 284 | return; |
285 | 285 | } |
286 | 286 | |
287 | - $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); |
|
288 | - $next = get_adjacent_post( false, '', false ); |
|
287 | + $previous = (is_attachment()) ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); |
|
288 | + $next = get_adjacent_post(false, '', false); |
|
289 | 289 | $css = ''; |
290 | 290 | |
291 | - if ( is_attachment() && 'attachment' == $previous->post_type ) { |
|
291 | + if (is_attachment() && 'attachment' == $previous->post_type) { |
|
292 | 292 | return; |
293 | 293 | } |
294 | 294 | |
295 | - if ( $previous && has_post_thumbnail( $previous->ID ) ) { |
|
296 | - $prevthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $previous->ID ), 'post-thumbnail' ); |
|
295 | + if ($previous && has_post_thumbnail($previous->ID)) { |
|
296 | + $prevthumb = wp_get_attachment_image_src(get_post_thumbnail_id($previous->ID), 'post-thumbnail'); |
|
297 | 297 | $css .= ' |
298 | - .post-navigation .nav-previous { background-image: url(' . esc_url( $prevthumb[0] ) . '); } |
|
298 | + .post-navigation .nav-previous { background-image: url(' . esc_url($prevthumb[0]).'); } |
|
299 | 299 | .post-navigation .nav-previous .post-title, .post-navigation .nav-previous a:hover .post-title, .post-navigation .nav-previous .meta-nav { color: #fff; } |
300 | 300 | .post-navigation .nav-previous a:before { background-color: rgba(0, 0, 0, 0.4); } |
301 | 301 | '; |
302 | 302 | } |
303 | 303 | |
304 | - if ( $next && has_post_thumbnail( $next->ID ) ) { |
|
305 | - $nextthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $next->ID ), 'post-thumbnail' ); |
|
304 | + if ($next && has_post_thumbnail($next->ID)) { |
|
305 | + $nextthumb = wp_get_attachment_image_src(get_post_thumbnail_id($next->ID), 'post-thumbnail'); |
|
306 | 306 | $css .= ' |
307 | - .post-navigation .nav-next { background-image: url(' . esc_url( $nextthumb[0] ) . '); border-top: 0; } |
|
307 | + .post-navigation .nav-next { background-image: url(' . esc_url($nextthumb[0]).'); border-top: 0; } |
|
308 | 308 | .post-navigation .nav-next .post-title, .post-navigation .nav-next a:hover .post-title, .post-navigation .nav-next .meta-nav { color: #fff; } |
309 | 309 | .post-navigation .nav-next a:before { background-color: rgba(0, 0, 0, 0.4); } |
310 | 310 | '; |
311 | 311 | } |
312 | 312 | |
313 | - wp_add_inline_style( 'twentyfifteen-style', $css ); |
|
313 | + wp_add_inline_style('twentyfifteen-style', $css); |
|
314 | 314 | } |
315 | -add_action( 'wp_enqueue_scripts', 'twentyfifteen_post_nav_background' ); |
|
315 | +add_action('wp_enqueue_scripts', 'twentyfifteen_post_nav_background'); |
|
316 | 316 | |
317 | 317 | /** |
318 | 318 | * Display descriptions in main navigation. |
@@ -325,14 +325,14 @@ discard block |
||
325 | 325 | * @param array $args wp_nav_menu() arguments. |
326 | 326 | * @return string Menu item with possible description. |
327 | 327 | */ |
328 | -function twentyfifteen_nav_description( $item_output, $item, $depth, $args ) { |
|
329 | - if ( 'primary' == $args->theme_location && $item->description ) { |
|
330 | - $item_output = str_replace( $args->link_after . '</a>', '<div class="menu-item-description">' . $item->description . '</div>' . $args->link_after . '</a>', $item_output ); |
|
328 | +function twentyfifteen_nav_description($item_output, $item, $depth, $args) { |
|
329 | + if ('primary' == $args->theme_location && $item->description) { |
|
330 | + $item_output = str_replace($args->link_after.'</a>', '<div class="menu-item-description">'.$item->description.'</div>'.$args->link_after.'</a>', $item_output); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | return $item_output; |
334 | 334 | } |
335 | -add_filter( 'walker_nav_menu_start_el', 'twentyfifteen_nav_description', 10, 4 ); |
|
335 | +add_filter('walker_nav_menu_start_el', 'twentyfifteen_nav_description', 10, 4); |
|
336 | 336 | |
337 | 337 | /** |
338 | 338 | * Add a `screen-reader-text` class to the search form's submit button. |
@@ -342,28 +342,28 @@ discard block |
||
342 | 342 | * @param string $html Search form HTML. |
343 | 343 | * @return string Modified search form HTML. |
344 | 344 | */ |
345 | -function twentyfifteen_search_form_modify( $html ) { |
|
346 | - return str_replace( 'class="search-submit"', 'class="search-submit screen-reader-text"', $html ); |
|
345 | +function twentyfifteen_search_form_modify($html) { |
|
346 | + return str_replace('class="search-submit"', 'class="search-submit screen-reader-text"', $html); |
|
347 | 347 | } |
348 | -add_filter( 'get_search_form', 'twentyfifteen_search_form_modify' ); |
|
348 | +add_filter('get_search_form', 'twentyfifteen_search_form_modify'); |
|
349 | 349 | |
350 | 350 | /** |
351 | 351 | * Implement the Custom Header feature. |
352 | 352 | * |
353 | 353 | * @since Twenty Fifteen 1.0 |
354 | 354 | */ |
355 | -require get_template_directory() . '/inc/custom-header.php'; |
|
355 | +require get_template_directory().'/inc/custom-header.php'; |
|
356 | 356 | |
357 | 357 | /** |
358 | 358 | * Custom template tags for this theme. |
359 | 359 | * |
360 | 360 | * @since Twenty Fifteen 1.0 |
361 | 361 | */ |
362 | -require get_template_directory() . '/inc/template-tags.php'; |
|
362 | +require get_template_directory().'/inc/template-tags.php'; |
|
363 | 363 | |
364 | 364 | /** |
365 | 365 | * Customizer additions. |
366 | 366 | * |
367 | 367 | * @since Twenty Fifteen 1.0 |
368 | 368 | */ |
369 | -require get_template_directory() . '/inc/customizer.php'; |
|
369 | +require get_template_directory().'/inc/customizer.php'; |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since Twenty Fourteen 1.0 |
34 | 34 | */ |
35 | -if ( ! isset( $content_width ) ) { |
|
35 | +if ( ! isset($content_width)) { |
|
36 | 36 | $content_width = 474; |
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Twenty Fourteen only works in WordPress 3.6 or later. |
41 | 41 | */ |
42 | -if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) { |
|
43 | - require get_template_directory() . '/inc/back-compat.php'; |
|
42 | +if (version_compare($GLOBALS['wp_version'], '3.6', '<')) { |
|
43 | + require get_template_directory().'/inc/back-compat.php'; |
|
44 | 44 | } |
45 | 45 | |
46 | -if ( ! function_exists( 'twentyfourteen_setup' ) ) : |
|
46 | +if ( ! function_exists('twentyfourteen_setup')) : |
|
47 | 47 | /** |
48 | 48 | * Twenty Fourteen setup. |
49 | 49 | * |
@@ -65,60 +65,60 @@ discard block |
||
65 | 65 | * replace to change 'twentyfourteen' to the name of your theme in all |
66 | 66 | * template files. |
67 | 67 | */ |
68 | - load_theme_textdomain( 'twentyfourteen' ); |
|
68 | + load_theme_textdomain('twentyfourteen'); |
|
69 | 69 | |
70 | 70 | // This theme styles the visual editor to resemble the theme style. |
71 | - add_editor_style( array( 'css/editor-style.css', twentyfourteen_font_url(), 'genericons/genericons.css' ) ); |
|
71 | + add_editor_style(array('css/editor-style.css', twentyfourteen_font_url(), 'genericons/genericons.css')); |
|
72 | 72 | |
73 | 73 | // Add RSS feed links to <head> for posts and comments. |
74 | - add_theme_support( 'automatic-feed-links' ); |
|
74 | + add_theme_support('automatic-feed-links'); |
|
75 | 75 | |
76 | 76 | // Enable support for Post Thumbnails, and declare two sizes. |
77 | - add_theme_support( 'post-thumbnails' ); |
|
78 | - set_post_thumbnail_size( 672, 372, true ); |
|
79 | - add_image_size( 'twentyfourteen-full-width', 1038, 576, true ); |
|
77 | + add_theme_support('post-thumbnails'); |
|
78 | + set_post_thumbnail_size(672, 372, true); |
|
79 | + add_image_size('twentyfourteen-full-width', 1038, 576, true); |
|
80 | 80 | |
81 | 81 | // This theme uses wp_nav_menu() in two locations. |
82 | - register_nav_menus( array( |
|
83 | - 'primary' => __( 'Top primary menu', 'twentyfourteen' ), |
|
84 | - 'secondary' => __( 'Secondary menu in left sidebar', 'twentyfourteen' ), |
|
85 | - ) ); |
|
82 | + register_nav_menus(array( |
|
83 | + 'primary' => __('Top primary menu', 'twentyfourteen'), |
|
84 | + 'secondary' => __('Secondary menu in left sidebar', 'twentyfourteen'), |
|
85 | + )); |
|
86 | 86 | |
87 | 87 | /* |
88 | 88 | * Switch default core markup for search form, comment form, and comments |
89 | 89 | * to output valid HTML5. |
90 | 90 | */ |
91 | - add_theme_support( 'html5', array( |
|
91 | + add_theme_support('html5', array( |
|
92 | 92 | 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' |
93 | - ) ); |
|
93 | + )); |
|
94 | 94 | |
95 | 95 | /* |
96 | 96 | * Enable support for Post Formats. |
97 | 97 | * See https://codex.wordpress.org/Post_Formats |
98 | 98 | */ |
99 | - add_theme_support( 'post-formats', array( |
|
99 | + add_theme_support('post-formats', array( |
|
100 | 100 | 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery', |
101 | - ) ); |
|
101 | + )); |
|
102 | 102 | |
103 | 103 | // This theme allows users to set a custom background. |
104 | - add_theme_support( 'custom-background', apply_filters( 'twentyfourteen_custom_background_args', array( |
|
104 | + add_theme_support('custom-background', apply_filters('twentyfourteen_custom_background_args', array( |
|
105 | 105 | 'default-color' => 'f5f5f5', |
106 | - ) ) ); |
|
106 | + ))); |
|
107 | 107 | |
108 | 108 | // Add support for featured content. |
109 | - add_theme_support( 'featured-content', array( |
|
109 | + add_theme_support('featured-content', array( |
|
110 | 110 | 'featured_content_filter' => 'twentyfourteen_get_featured_posts', |
111 | 111 | 'max_posts' => 6, |
112 | - ) ); |
|
112 | + )); |
|
113 | 113 | |
114 | 114 | // This theme uses its own gallery styles. |
115 | - add_filter( 'use_default_gallery_style', '__return_false' ); |
|
115 | + add_filter('use_default_gallery_style', '__return_false'); |
|
116 | 116 | |
117 | 117 | // Indicate widget sidebars can use selective refresh in the Customizer. |
118 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
118 | + add_theme_support('customize-selective-refresh-widgets'); |
|
119 | 119 | } |
120 | 120 | endif; // twentyfourteen_setup |
121 | -add_action( 'after_setup_theme', 'twentyfourteen_setup' ); |
|
121 | +add_action('after_setup_theme', 'twentyfourteen_setup'); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Adjust content_width value for image attachment template. |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | * @since Twenty Fourteen 1.0 |
127 | 127 | */ |
128 | 128 | function twentyfourteen_content_width() { |
129 | - if ( is_attachment() && wp_attachment_is_image() ) { |
|
129 | + if (is_attachment() && wp_attachment_is_image()) { |
|
130 | 130 | $GLOBALS['content_width'] = 810; |
131 | 131 | } |
132 | 132 | } |
133 | -add_action( 'template_redirect', 'twentyfourteen_content_width' ); |
|
133 | +add_action('template_redirect', 'twentyfourteen_content_width'); |
|
134 | 134 | |
135 | 135 | /** |
136 | 136 | * Getter function for Featured Content Plugin. |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * |
148 | 148 | * @param array|bool $posts Array of featured posts, otherwise false. |
149 | 149 | */ |
150 | - return apply_filters( 'twentyfourteen_get_featured_posts', array() ); |
|
150 | + return apply_filters('twentyfourteen_get_featured_posts', array()); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -167,38 +167,38 @@ discard block |
||
167 | 167 | * @since Twenty Fourteen 1.0 |
168 | 168 | */ |
169 | 169 | function twentyfourteen_widgets_init() { |
170 | - require get_template_directory() . '/inc/widgets.php'; |
|
171 | - register_widget( 'Twenty_Fourteen_Ephemera_Widget' ); |
|
170 | + require get_template_directory().'/inc/widgets.php'; |
|
171 | + register_widget('Twenty_Fourteen_Ephemera_Widget'); |
|
172 | 172 | |
173 | - register_sidebar( array( |
|
174 | - 'name' => __( 'Primary Sidebar', 'twentyfourteen' ), |
|
173 | + register_sidebar(array( |
|
174 | + 'name' => __('Primary Sidebar', 'twentyfourteen'), |
|
175 | 175 | 'id' => 'sidebar-1', |
176 | - 'description' => __( 'Main sidebar that appears on the left.', 'twentyfourteen' ), |
|
176 | + 'description' => __('Main sidebar that appears on the left.', 'twentyfourteen'), |
|
177 | 177 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
178 | 178 | 'after_widget' => '</aside>', |
179 | 179 | 'before_title' => '<h1 class="widget-title">', |
180 | 180 | 'after_title' => '</h1>', |
181 | - ) ); |
|
182 | - register_sidebar( array( |
|
183 | - 'name' => __( 'Content Sidebar', 'twentyfourteen' ), |
|
181 | + )); |
|
182 | + register_sidebar(array( |
|
183 | + 'name' => __('Content Sidebar', 'twentyfourteen'), |
|
184 | 184 | 'id' => 'sidebar-2', |
185 | - 'description' => __( 'Additional sidebar that appears on the right.', 'twentyfourteen' ), |
|
185 | + 'description' => __('Additional sidebar that appears on the right.', 'twentyfourteen'), |
|
186 | 186 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
187 | 187 | 'after_widget' => '</aside>', |
188 | 188 | 'before_title' => '<h1 class="widget-title">', |
189 | 189 | 'after_title' => '</h1>', |
190 | - ) ); |
|
191 | - register_sidebar( array( |
|
192 | - 'name' => __( 'Footer Widget Area', 'twentyfourteen' ), |
|
190 | + )); |
|
191 | + register_sidebar(array( |
|
192 | + 'name' => __('Footer Widget Area', 'twentyfourteen'), |
|
193 | 193 | 'id' => 'sidebar-3', |
194 | - 'description' => __( 'Appears in the footer section of the site.', 'twentyfourteen' ), |
|
194 | + 'description' => __('Appears in the footer section of the site.', 'twentyfourteen'), |
|
195 | 195 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
196 | 196 | 'after_widget' => '</aside>', |
197 | 197 | 'before_title' => '<h1 class="widget-title">', |
198 | 198 | 'after_title' => '</h1>', |
199 | - ) ); |
|
199 | + )); |
|
200 | 200 | } |
201 | -add_action( 'widgets_init', 'twentyfourteen_widgets_init' ); |
|
201 | +add_action('widgets_init', 'twentyfourteen_widgets_init'); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Register Lato Google font for Twenty Fourteen. |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | * Translators: If there are characters in your language that are not supported |
214 | 214 | * by Lato, translate this to 'off'. Do not translate into your own language. |
215 | 215 | */ |
216 | - if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) { |
|
216 | + if ('off' !== _x('on', 'Lato font: on or off', 'twentyfourteen')) { |
|
217 | 217 | $query_args = array( |
218 | - 'family' => urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), |
|
219 | - 'subset' => urlencode( 'latin,latin-ext' ), |
|
218 | + 'family' => urlencode('Lato:300,400,700,900,300italic,400italic,700italic'), |
|
219 | + 'subset' => urlencode('latin,latin-ext'), |
|
220 | 220 | ); |
221 | - $font_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); |
|
221 | + $font_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css'); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | return $font_url; |
@@ -231,41 +231,41 @@ discard block |
||
231 | 231 | */ |
232 | 232 | function twentyfourteen_scripts() { |
233 | 233 | // Add Lato font, used in the main stylesheet. |
234 | - wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null ); |
|
234 | + wp_enqueue_style('twentyfourteen-lato', twentyfourteen_font_url(), array(), null); |
|
235 | 235 | |
236 | 236 | // Add Genericons font, used in the main stylesheet. |
237 | - wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' ); |
|
237 | + wp_enqueue_style('genericons', get_template_directory_uri().'/genericons/genericons.css', array(), '3.0.3'); |
|
238 | 238 | |
239 | 239 | // Load our main stylesheet. |
240 | - wp_enqueue_style( 'twentyfourteen-style', get_stylesheet_uri() ); |
|
240 | + wp_enqueue_style('twentyfourteen-style', get_stylesheet_uri()); |
|
241 | 241 | |
242 | 242 | // Load the Internet Explorer specific stylesheet. |
243 | - wp_enqueue_style( 'twentyfourteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfourteen-style' ), '20131205' ); |
|
244 | - wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' ); |
|
243 | + wp_enqueue_style('twentyfourteen-ie', get_template_directory_uri().'/css/ie.css', array('twentyfourteen-style'), '20131205'); |
|
244 | + wp_style_add_data('twentyfourteen-ie', 'conditional', 'lt IE 9'); |
|
245 | 245 | |
246 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { |
|
247 | - wp_enqueue_script( 'comment-reply' ); |
|
246 | + if (is_singular() && comments_open() && get_option('thread_comments')) { |
|
247 | + wp_enqueue_script('comment-reply'); |
|
248 | 248 | } |
249 | 249 | |
250 | - if ( is_singular() && wp_attachment_is_image() ) { |
|
251 | - wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' ); |
|
250 | + if (is_singular() && wp_attachment_is_image()) { |
|
251 | + wp_enqueue_script('twentyfourteen-keyboard-image-navigation', get_template_directory_uri().'/js/keyboard-image-navigation.js', array('jquery'), '20130402'); |
|
252 | 252 | } |
253 | 253 | |
254 | - if ( is_active_sidebar( 'sidebar-3' ) ) { |
|
255 | - wp_enqueue_script( 'jquery-masonry' ); |
|
254 | + if (is_active_sidebar('sidebar-3')) { |
|
255 | + wp_enqueue_script('jquery-masonry'); |
|
256 | 256 | } |
257 | 257 | |
258 | - if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { |
|
259 | - wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true ); |
|
260 | - wp_localize_script( 'twentyfourteen-slider', 'featuredSliderDefaults', array( |
|
261 | - 'prevText' => __( 'Previous', 'twentyfourteen' ), |
|
262 | - 'nextText' => __( 'Next', 'twentyfourteen' ) |
|
263 | - ) ); |
|
258 | + if (is_front_page() && 'slider' == get_theme_mod('featured_content_layout')) { |
|
259 | + wp_enqueue_script('twentyfourteen-slider', get_template_directory_uri().'/js/slider.js', array('jquery'), '20131205', true); |
|
260 | + wp_localize_script('twentyfourteen-slider', 'featuredSliderDefaults', array( |
|
261 | + 'prevText' => __('Previous', 'twentyfourteen'), |
|
262 | + 'nextText' => __('Next', 'twentyfourteen') |
|
263 | + )); |
|
264 | 264 | } |
265 | 265 | |
266 | - wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150315', true ); |
|
266 | + wp_enqueue_script('twentyfourteen-script', get_template_directory_uri().'/js/functions.js', array('jquery'), '20150315', true); |
|
267 | 267 | } |
268 | -add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' ); |
|
268 | +add_action('wp_enqueue_scripts', 'twentyfourteen_scripts'); |
|
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Enqueue Google fonts style to admin screen for custom header display. |
@@ -273,18 +273,18 @@ discard block |
||
273 | 273 | * @since Twenty Fourteen 1.0 |
274 | 274 | */ |
275 | 275 | function twentyfourteen_admin_fonts() { |
276 | - wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null ); |
|
276 | + wp_enqueue_style('twentyfourteen-lato', twentyfourteen_font_url(), array(), null); |
|
277 | 277 | } |
278 | -add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' ); |
|
278 | +add_action('admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts'); |
|
279 | 279 | |
280 | -if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) : |
|
280 | +if ( ! function_exists('twentyfourteen_the_attached_image')) : |
|
281 | 281 | /** |
282 | 282 | * Print the attached image with a link to the next attached image. |
283 | 283 | * |
284 | 284 | * @since Twenty Fourteen 1.0 |
285 | 285 | */ |
286 | 286 | function twentyfourteen_the_attached_image() { |
287 | - $post = get_post(); |
|
287 | + $post = get_post(); |
|
288 | 288 | /** |
289 | 289 | * Filter the default Twenty Fourteen attachment size. |
290 | 290 | * |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @type int $width Width of the image in pixels. Default 810. |
298 | 298 | * } |
299 | 299 | */ |
300 | - $attachment_size = apply_filters( 'twentyfourteen_attachment_size', array( 810, 810 ) ); |
|
300 | + $attachment_size = apply_filters('twentyfourteen_attachment_size', array(810, 810)); |
|
301 | 301 | $next_attachment_url = wp_get_attachment_url(); |
302 | 302 | |
303 | 303 | /* |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * looking at the last image in a gallery), or, in a gallery of one, just the |
307 | 307 | * link to that image file. |
308 | 308 | */ |
309 | - $attachment_ids = get_posts( array( |
|
309 | + $attachment_ids = get_posts(array( |
|
310 | 310 | 'post_parent' => $post->post_parent, |
311 | 311 | 'fields' => 'ids', |
312 | 312 | 'numberposts' => -1, |
@@ -315,68 +315,68 @@ discard block |
||
315 | 315 | 'post_mime_type' => 'image', |
316 | 316 | 'order' => 'ASC', |
317 | 317 | 'orderby' => 'menu_order ID', |
318 | - ) ); |
|
318 | + )); |
|
319 | 319 | |
320 | 320 | // If there is more than 1 attachment in a gallery... |
321 | - if ( count( $attachment_ids ) > 1 ) { |
|
322 | - foreach ( $attachment_ids as $idx => $attachment_id ) { |
|
323 | - if ( $attachment_id == $post->ID ) { |
|
324 | - $next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ]; |
|
321 | + if (count($attachment_ids) > 1) { |
|
322 | + foreach ($attachment_ids as $idx => $attachment_id) { |
|
323 | + if ($attachment_id == $post->ID) { |
|
324 | + $next_id = $attachment_ids[($idx + 1) % count($attachment_ids)]; |
|
325 | 325 | break; |
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
329 | 329 | // get the URL of the next image attachment... |
330 | - if ( $next_id ) { |
|
331 | - $next_attachment_url = get_attachment_link( $next_id ); |
|
330 | + if ($next_id) { |
|
331 | + $next_attachment_url = get_attachment_link($next_id); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | // or get the URL of the first image attachment. |
335 | 335 | else { |
336 | - $next_attachment_url = get_attachment_link( reset( $attachment_ids ) ); |
|
336 | + $next_attachment_url = get_attachment_link(reset($attachment_ids)); |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
340 | - printf( '<a href="%1$s" rel="attachment">%2$s</a>', |
|
341 | - esc_url( $next_attachment_url ), |
|
342 | - wp_get_attachment_image( $post->ID, $attachment_size ) |
|
340 | + printf('<a href="%1$s" rel="attachment">%2$s</a>', |
|
341 | + esc_url($next_attachment_url), |
|
342 | + wp_get_attachment_image($post->ID, $attachment_size) |
|
343 | 343 | ); |
344 | 344 | } |
345 | 345 | endif; |
346 | 346 | |
347 | -if ( ! function_exists( 'twentyfourteen_list_authors' ) ) : |
|
347 | +if ( ! function_exists('twentyfourteen_list_authors')) : |
|
348 | 348 | /** |
349 | 349 | * Print a list of all site contributors who published at least one post. |
350 | 350 | * |
351 | 351 | * @since Twenty Fourteen 1.0 |
352 | 352 | */ |
353 | 353 | function twentyfourteen_list_authors() { |
354 | - $contributor_ids = get_users( array( |
|
354 | + $contributor_ids = get_users(array( |
|
355 | 355 | 'fields' => 'ID', |
356 | 356 | 'orderby' => 'post_count', |
357 | 357 | 'order' => 'DESC', |
358 | 358 | 'who' => 'authors', |
359 | - ) ); |
|
359 | + )); |
|
360 | 360 | |
361 | - foreach ( $contributor_ids as $contributor_id ) : |
|
362 | - $post_count = count_user_posts( $contributor_id ); |
|
361 | + foreach ($contributor_ids as $contributor_id) : |
|
362 | + $post_count = count_user_posts($contributor_id); |
|
363 | 363 | |
364 | 364 | // Move on if user has not published a post (yet). |
365 | - if ( ! $post_count ) { |
|
365 | + if ( ! $post_count) { |
|
366 | 366 | continue; |
367 | 367 | } |
368 | 368 | ?> |
369 | 369 | |
370 | 370 | <div class="contributor"> |
371 | 371 | <div class="contributor-info"> |
372 | - <div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 132 ); ?></div> |
|
372 | + <div class="contributor-avatar"><?php echo get_avatar($contributor_id, 132); ?></div> |
|
373 | 373 | <div class="contributor-summary"> |
374 | - <h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2> |
|
374 | + <h2 class="contributor-name"><?php echo get_the_author_meta('display_name', $contributor_id); ?></h2> |
|
375 | 375 | <p class="contributor-bio"> |
376 | - <?php echo get_the_author_meta( 'description', $contributor_id ); ?> |
|
376 | + <?php echo get_the_author_meta('description', $contributor_id); ?> |
|
377 | 377 | </p> |
378 | - <a class="button contributor-posts-link" href="<?php echo esc_url( get_author_posts_url( $contributor_id ) ); ?>"> |
|
379 | - <?php printf( _n( '%d Article', '%d Articles', $post_count, 'twentyfourteen' ), $post_count ); ?> |
|
378 | + <a class="button contributor-posts-link" href="<?php echo esc_url(get_author_posts_url($contributor_id)); ?>"> |
|
379 | + <?php printf(_n('%d Article', '%d Articles', $post_count, 'twentyfourteen'), $post_count); ?> |
|
380 | 380 | </a> |
381 | 381 | </div><!-- .contributor-summary --> |
382 | 382 | </div><!-- .contributor-info --> |
@@ -404,45 +404,45 @@ discard block |
||
404 | 404 | * @param array $classes A list of existing body class values. |
405 | 405 | * @return array The filtered body class list. |
406 | 406 | */ |
407 | -function twentyfourteen_body_classes( $classes ) { |
|
408 | - if ( is_multi_author() ) { |
|
407 | +function twentyfourteen_body_classes($classes) { |
|
408 | + if (is_multi_author()) { |
|
409 | 409 | $classes[] = 'group-blog'; |
410 | 410 | } |
411 | 411 | |
412 | - if ( get_header_image() ) { |
|
412 | + if (get_header_image()) { |
|
413 | 413 | $classes[] = 'header-image'; |
414 | - } elseif ( ! in_array( $GLOBALS['pagenow'], array( 'wp-activate.php', 'wp-signup.php' ) ) ) { |
|
414 | + } elseif ( ! in_array($GLOBALS['pagenow'], array('wp-activate.php', 'wp-signup.php'))) { |
|
415 | 415 | $classes[] = 'masthead-fixed'; |
416 | 416 | } |
417 | 417 | |
418 | - if ( is_archive() || is_search() || is_home() ) { |
|
418 | + if (is_archive() || is_search() || is_home()) { |
|
419 | 419 | $classes[] = 'list-view'; |
420 | 420 | } |
421 | 421 | |
422 | - if ( ( ! is_active_sidebar( 'sidebar-2' ) ) |
|
423 | - || is_page_template( 'page-templates/full-width.php' ) |
|
424 | - || is_page_template( 'page-templates/contributors.php' ) |
|
425 | - || is_attachment() ) { |
|
422 | + if (( ! is_active_sidebar('sidebar-2')) |
|
423 | + || is_page_template('page-templates/full-width.php') |
|
424 | + || is_page_template('page-templates/contributors.php') |
|
425 | + || is_attachment()) { |
|
426 | 426 | $classes[] = 'full-width'; |
427 | 427 | } |
428 | 428 | |
429 | - if ( is_active_sidebar( 'sidebar-3' ) ) { |
|
429 | + if (is_active_sidebar('sidebar-3')) { |
|
430 | 430 | $classes[] = 'footer-widgets'; |
431 | 431 | } |
432 | 432 | |
433 | - if ( is_singular() && ! is_front_page() ) { |
|
433 | + if (is_singular() && ! is_front_page()) { |
|
434 | 434 | $classes[] = 'singular'; |
435 | 435 | } |
436 | 436 | |
437 | - if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { |
|
437 | + if (is_front_page() && 'slider' == get_theme_mod('featured_content_layout')) { |
|
438 | 438 | $classes[] = 'slider'; |
439 | - } elseif ( is_front_page() ) { |
|
439 | + } elseif (is_front_page()) { |
|
440 | 440 | $classes[] = 'grid'; |
441 | 441 | } |
442 | 442 | |
443 | 443 | return $classes; |
444 | 444 | } |
445 | -add_filter( 'body_class', 'twentyfourteen_body_classes' ); |
|
445 | +add_filter('body_class', 'twentyfourteen_body_classes'); |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Extend the default WordPress post classes. |
@@ -455,14 +455,14 @@ discard block |
||
455 | 455 | * @param array $classes A list of existing post class values. |
456 | 456 | * @return array The filtered post class list. |
457 | 457 | */ |
458 | -function twentyfourteen_post_classes( $classes ) { |
|
459 | - if ( ! post_password_required() && ! is_attachment() && has_post_thumbnail() ) { |
|
458 | +function twentyfourteen_post_classes($classes) { |
|
459 | + if ( ! post_password_required() && ! is_attachment() && has_post_thumbnail()) { |
|
460 | 460 | $classes[] = 'has-post-thumbnail'; |
461 | 461 | } |
462 | 462 | |
463 | 463 | return $classes; |
464 | 464 | } |
465 | -add_filter( 'post_class', 'twentyfourteen_post_classes' ); |
|
465 | +add_filter('post_class', 'twentyfourteen_post_classes'); |
|
466 | 466 | |
467 | 467 | /** |
468 | 468 | * Create a nicely formatted and more specific title element text for output |
@@ -477,39 +477,39 @@ discard block |
||
477 | 477 | * @param string $sep Optional separator. |
478 | 478 | * @return string The filtered title. |
479 | 479 | */ |
480 | -function twentyfourteen_wp_title( $title, $sep ) { |
|
480 | +function twentyfourteen_wp_title($title, $sep) { |
|
481 | 481 | global $paged, $page; |
482 | 482 | |
483 | - if ( is_feed() ) { |
|
483 | + if (is_feed()) { |
|
484 | 484 | return $title; |
485 | 485 | } |
486 | 486 | |
487 | 487 | // Add the site name. |
488 | - $title .= get_bloginfo( 'name', 'display' ); |
|
488 | + $title .= get_bloginfo('name', 'display'); |
|
489 | 489 | |
490 | 490 | // Add the site description for the home/front page. |
491 | - $site_description = get_bloginfo( 'description', 'display' ); |
|
492 | - if ( $site_description && ( is_home() || is_front_page() ) ) { |
|
491 | + $site_description = get_bloginfo('description', 'display'); |
|
492 | + if ($site_description && (is_home() || is_front_page())) { |
|
493 | 493 | $title = "$title $sep $site_description"; |
494 | 494 | } |
495 | 495 | |
496 | 496 | // Add a page number if necessary. |
497 | - if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { |
|
498 | - $title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) ); |
|
497 | + if (($paged >= 2 || $page >= 2) && ! is_404()) { |
|
498 | + $title = "$title $sep ".sprintf(__('Page %s', 'twentyfourteen'), max($paged, $page)); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | return $title; |
502 | 502 | } |
503 | -add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 ); |
|
503 | +add_filter('wp_title', 'twentyfourteen_wp_title', 10, 2); |
|
504 | 504 | |
505 | 505 | // Implement Custom Header features. |
506 | -require get_template_directory() . '/inc/custom-header.php'; |
|
506 | +require get_template_directory().'/inc/custom-header.php'; |
|
507 | 507 | |
508 | 508 | // Custom template tags for this theme. |
509 | -require get_template_directory() . '/inc/template-tags.php'; |
|
509 | +require get_template_directory().'/inc/template-tags.php'; |
|
510 | 510 | |
511 | 511 | // Add Customizer functionality. |
512 | -require get_template_directory() . '/inc/customizer.php'; |
|
512 | +require get_template_directory().'/inc/customizer.php'; |
|
513 | 513 | |
514 | 514 | /* |
515 | 515 | * Add Featured Content functionality. |
@@ -517,6 +517,6 @@ discard block |
||
517 | 517 | * To overwrite in a plugin, define your own Featured_Content class on or |
518 | 518 | * before the 'setup_theme' hook. |
519 | 519 | */ |
520 | -if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) { |
|
521 | - require get_template_directory() . '/inc/featured-content.php'; |
|
520 | +if ( ! class_exists('Featured_Content') && 'plugins.php' !== $GLOBALS['pagenow']) { |
|
521 | + require get_template_directory().'/inc/featured-content.php'; |
|
522 | 522 | } |
@@ -17,19 +17,19 @@ discard block |
||
17 | 17 | |
18 | 18 | // A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default, |
19 | 19 | // but we can do it ourself. |
20 | -if ( !isset( $HTTP_RAW_POST_DATA ) ) { |
|
21 | - $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' ); |
|
20 | +if ( ! isset($HTTP_RAW_POST_DATA)) { |
|
21 | + $HTTP_RAW_POST_DATA = file_get_contents('php://input'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | // fix for mozBlog and other cases where '<?xml' isn't on the very first line |
25 | -if ( isset($HTTP_RAW_POST_DATA) ) |
|
25 | +if (isset($HTTP_RAW_POST_DATA)) |
|
26 | 26 | $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA); |
27 | 27 | |
28 | 28 | /** Include the bootstrap for setting up WordPress environment */ |
29 | -include( dirname( __FILE__ ) . '/wp-load.php' ); |
|
29 | +include(dirname(__FILE__).'/wp-load.php'); |
|
30 | 30 | |
31 | -if ( isset( $_GET['rsd'] ) ) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html |
|
32 | -header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); |
|
31 | +if (isset($_GET['rsd'])) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html |
|
32 | +header('Content-Type: text/xml; charset='.get_option('blog_charset'), true); |
|
33 | 33 | ?> |
34 | 34 | <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> |
35 | 35 | <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd"> |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @since 3.5.0 |
52 | 52 | */ |
53 | - do_action( 'xmlrpc_rsd_apis' ); |
|
53 | + do_action('xmlrpc_rsd_apis'); |
|
54 | 54 | ?> |
55 | 55 | </apis> |
56 | 56 | </service> |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | exit; |
60 | 60 | } |
61 | 61 | |
62 | -include_once(ABSPATH . 'wp-admin/includes/admin.php'); |
|
63 | -include_once(ABSPATH . WPINC . '/class-IXR.php'); |
|
64 | -include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php'); |
|
62 | +include_once(ABSPATH.'wp-admin/includes/admin.php'); |
|
63 | +include_once(ABSPATH.WPINC.'/class-IXR.php'); |
|
64 | +include_once(ABSPATH.WPINC.'/class-wp-xmlrpc-server.php'); |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Posts submitted via the XML-RPC interface get that title |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @param string $class The name of the XML-RPC server class. |
79 | 79 | */ |
80 | -$wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' ); |
|
80 | +$wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server'); |
|
81 | 81 | $wp_xmlrpc_server = new $wp_xmlrpc_server_class; |
82 | 82 | |
83 | 83 | // Fire off the request |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @param string $io Whether input or output |
95 | 95 | * @param string $msg Information describing logging reason. |
96 | 96 | */ |
97 | -function logIO( $io, $msg ) { |
|
98 | - _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); |
|
99 | - if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) |
|
100 | - error_log( $io . ' - ' . $msg ); |
|
97 | +function logIO($io, $msg) { |
|
98 | + _deprecated_function(__FUNCTION__, '3.4.0', 'error_log()'); |
|
99 | + if ( ! empty($GLOBALS['xmlrpc_logging'])) |
|
100 | + error_log($io.' - '.$msg); |
|
101 | 101 | } |
102 | 102 | \ No newline at end of file |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | * @param mixed $default Optional. Default value to return if the option does not exist. |
28 | 28 | * @return mixed Value set for the option. |
29 | 29 | */ |
30 | -function get_option( $option, $default = false ) { |
|
30 | +function get_option($option, $default = false) { |
|
31 | 31 | global $wpdb; |
32 | 32 | |
33 | - $option = trim( $option ); |
|
34 | - if ( empty( $option ) ) |
|
33 | + $option = trim($option); |
|
34 | + if (empty($option)) |
|
35 | 35 | return false; |
36 | 36 | |
37 | 37 | /** |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | * Default false to skip it. |
50 | 50 | * @param string $option Option name. |
51 | 51 | */ |
52 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
53 | - if ( false !== $pre ) |
|
52 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
53 | + if (false !== $pre) |
|
54 | 54 | return $pre; |
55 | 55 | |
56 | - if ( defined( 'WP_SETUP_CONFIG' ) ) |
|
56 | + if (defined('WP_SETUP_CONFIG')) |
|
57 | 57 | return false; |
58 | 58 | |
59 | - if ( ! wp_installing() ) { |
|
59 | + if ( ! wp_installing()) { |
|
60 | 60 | // prevent non-existent options from triggering multiple queries |
61 | - $notoptions = wp_cache_get( 'notoptions', 'options' ); |
|
62 | - if ( isset( $notoptions[ $option ] ) ) { |
|
61 | + $notoptions = wp_cache_get('notoptions', 'options'); |
|
62 | + if (isset($notoptions[$option])) { |
|
63 | 63 | /** |
64 | 64 | * Filters the default value for an option. |
65 | 65 | * |
@@ -72,53 +72,53 @@ discard block |
||
72 | 72 | * in the database. |
73 | 73 | * @param string $option Option name. |
74 | 74 | */ |
75 | - return apply_filters( 'default_option_' . $option, $default, $option ); |
|
75 | + return apply_filters('default_option_'.$option, $default, $option); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $alloptions = wp_load_alloptions(); |
79 | 79 | |
80 | - if ( isset( $alloptions[$option] ) ) { |
|
80 | + if (isset($alloptions[$option])) { |
|
81 | 81 | $value = $alloptions[$option]; |
82 | 82 | } else { |
83 | - $value = wp_cache_get( $option, 'options' ); |
|
83 | + $value = wp_cache_get($option, 'options'); |
|
84 | 84 | |
85 | - if ( false === $value ) { |
|
86 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) ); |
|
85 | + if (false === $value) { |
|
86 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option)); |
|
87 | 87 | |
88 | 88 | // Has to be get_row instead of get_var because of funkiness with 0, false, null values |
89 | - if ( is_object( $row ) ) { |
|
89 | + if (is_object($row)) { |
|
90 | 90 | $value = $row->option_value; |
91 | - wp_cache_add( $option, $value, 'options' ); |
|
91 | + wp_cache_add($option, $value, 'options'); |
|
92 | 92 | } else { // option does not exist, so we must cache its non-existence |
93 | - if ( ! is_array( $notoptions ) ) { |
|
93 | + if ( ! is_array($notoptions)) { |
|
94 | 94 | $notoptions = array(); |
95 | 95 | } |
96 | 96 | $notoptions[$option] = true; |
97 | - wp_cache_set( 'notoptions', $notoptions, 'options' ); |
|
97 | + wp_cache_set('notoptions', $notoptions, 'options'); |
|
98 | 98 | |
99 | 99 | /** This filter is documented in wp-includes/option.php */ |
100 | - return apply_filters( 'default_option_' . $option, $default, $option ); |
|
100 | + return apply_filters('default_option_'.$option, $default, $option); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | 104 | } else { |
105 | 105 | $suppress = $wpdb->suppress_errors(); |
106 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) ); |
|
107 | - $wpdb->suppress_errors( $suppress ); |
|
108 | - if ( is_object( $row ) ) { |
|
106 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option)); |
|
107 | + $wpdb->suppress_errors($suppress); |
|
108 | + if (is_object($row)) { |
|
109 | 109 | $value = $row->option_value; |
110 | 110 | } else { |
111 | 111 | /** This filter is documented in wp-includes/option.php */ |
112 | - return apply_filters( 'default_option_' . $option, $default, $option ); |
|
112 | + return apply_filters('default_option_'.$option, $default, $option); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | // If home is not set use siteurl. |
117 | - if ( 'home' == $option && '' == $value ) |
|
118 | - return get_option( 'siteurl' ); |
|
117 | + if ('home' == $option && '' == $value) |
|
118 | + return get_option('siteurl'); |
|
119 | 119 | |
120 | - if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) ) |
|
121 | - $value = untrailingslashit( $value ); |
|
120 | + if (in_array($option, array('siteurl', 'home', 'category_base', 'tag_base'))) |
|
121 | + $value = untrailingslashit($value); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Filters the value of an existing option. |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * unserialized prior to being returned. |
134 | 134 | * @param string $option Option name. |
135 | 135 | */ |
136 | - return apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
136 | + return apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param string $option Option name. |
148 | 148 | */ |
149 | -function wp_protect_special_option( $option ) { |
|
150 | - if ( 'alloptions' === $option || 'notoptions' === $option ) |
|
151 | - wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) ); |
|
149 | +function wp_protect_special_option($option) { |
|
150 | + if ('alloptions' === $option || 'notoptions' === $option) |
|
151 | + wp_die(sprintf(__('%s is a protected WP option and may not be modified'), esc_html($option))); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @param string $option Option name. |
160 | 160 | */ |
161 | -function form_option( $option ) { |
|
162 | - echo esc_attr( get_option( $option ) ); |
|
161 | +function form_option($option) { |
|
162 | + echo esc_attr(get_option($option)); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -174,22 +174,22 @@ discard block |
||
174 | 174 | function wp_load_alloptions() { |
175 | 175 | global $wpdb; |
176 | 176 | |
177 | - if ( ! wp_installing() || ! is_multisite() ) |
|
178 | - $alloptions = wp_cache_get( 'alloptions', 'options' ); |
|
177 | + if ( ! wp_installing() || ! is_multisite()) |
|
178 | + $alloptions = wp_cache_get('alloptions', 'options'); |
|
179 | 179 | else |
180 | 180 | $alloptions = false; |
181 | 181 | |
182 | - if ( !$alloptions ) { |
|
182 | + if ( ! $alloptions) { |
|
183 | 183 | $suppress = $wpdb->suppress_errors(); |
184 | - if ( !$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) ) |
|
185 | - $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); |
|
184 | + if ( ! $alloptions_db = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'")) |
|
185 | + $alloptions_db = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options"); |
|
186 | 186 | $wpdb->suppress_errors($suppress); |
187 | 187 | $alloptions = array(); |
188 | - foreach ( (array) $alloptions_db as $o ) { |
|
188 | + foreach ((array) $alloptions_db as $o) { |
|
189 | 189 | $alloptions[$o->option_name] = $o->option_value; |
190 | 190 | } |
191 | - if ( ! wp_installing() || ! is_multisite() ) |
|
192 | - wp_cache_add( 'alloptions', $alloptions, 'options' ); |
|
191 | + if ( ! wp_installing() || ! is_multisite()) |
|
192 | + wp_cache_add('alloptions', $alloptions, 'options'); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | return $alloptions; |
@@ -204,26 +204,26 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @param int $site_id Optional site ID for which to query the options. Defaults to the current site. |
206 | 206 | */ |
207 | -function wp_load_core_site_options( $site_id = null ) { |
|
207 | +function wp_load_core_site_options($site_id = null) { |
|
208 | 208 | global $wpdb; |
209 | 209 | |
210 | - if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() ) |
|
210 | + if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing()) |
|
211 | 211 | return; |
212 | 212 | |
213 | - if ( empty($site_id) ) |
|
213 | + if (empty($site_id)) |
|
214 | 214 | $site_id = $wpdb->siteid; |
215 | 215 | |
216 | - $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' ); |
|
216 | + $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting'); |
|
217 | 217 | |
218 | - $core_options_in = "'" . implode("', '", $core_options) . "'"; |
|
219 | - $options = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id) ); |
|
218 | + $core_options_in = "'".implode("', '", $core_options)."'"; |
|
219 | + $options = $wpdb->get_results($wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id)); |
|
220 | 220 | |
221 | - foreach ( $options as $option ) { |
|
221 | + foreach ($options as $option) { |
|
222 | 222 | $key = $option->meta_key; |
223 | 223 | $cache_key = "{$site_id}:$key"; |
224 | - $option->meta_value = maybe_unserialize( $option->meta_value ); |
|
224 | + $option->meta_value = maybe_unserialize($option->meta_value); |
|
225 | 225 | |
226 | - wp_cache_set( $cache_key, $option->meta_value, 'site-options' ); |
|
226 | + wp_cache_set($cache_key, $option->meta_value, 'site-options'); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
@@ -250,20 +250,20 @@ discard block |
||
250 | 250 | * the default value is 'yes'. Default null. |
251 | 251 | * @return bool False if value was not updated and true if value was updated. |
252 | 252 | */ |
253 | -function update_option( $option, $value, $autoload = null ) { |
|
253 | +function update_option($option, $value, $autoload = null) { |
|
254 | 254 | global $wpdb; |
255 | 255 | |
256 | 256 | $option = trim($option); |
257 | - if ( empty($option) ) |
|
257 | + if (empty($option)) |
|
258 | 258 | return false; |
259 | 259 | |
260 | - wp_protect_special_option( $option ); |
|
260 | + wp_protect_special_option($option); |
|
261 | 261 | |
262 | - if ( is_object( $value ) ) |
|
262 | + if (is_object($value)) |
|
263 | 263 | $value = clone $value; |
264 | 264 | |
265 | - $value = sanitize_option( $option, $value ); |
|
266 | - $old_value = get_option( $option ); |
|
265 | + $value = sanitize_option($option, $value); |
|
266 | + $old_value = get_option($option); |
|
267 | 267 | |
268 | 268 | /** |
269 | 269 | * Filters a specific option before its value is (maybe) serialized and updated. |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @param mixed $old_value The old option value. |
278 | 278 | * @param string $option Option name. |
279 | 279 | */ |
280 | - $value = apply_filters( 'pre_update_option_' . $option, $value, $old_value, $option ); |
|
280 | + $value = apply_filters('pre_update_option_'.$option, $value, $old_value, $option); |
|
281 | 281 | |
282 | 282 | /** |
283 | 283 | * Filters an option before its value is (maybe) serialized and updated. |
@@ -288,23 +288,23 @@ discard block |
||
288 | 288 | * @param string $option Name of the option. |
289 | 289 | * @param mixed $old_value The old option value. |
290 | 290 | */ |
291 | - $value = apply_filters( 'pre_update_option', $value, $option, $old_value ); |
|
291 | + $value = apply_filters('pre_update_option', $value, $option, $old_value); |
|
292 | 292 | |
293 | 293 | // If the new and old values are the same, no need to update. |
294 | - if ( $value === $old_value ) |
|
294 | + if ($value === $old_value) |
|
295 | 295 | return false; |
296 | 296 | |
297 | 297 | /** This filter is documented in wp-includes/option.php */ |
298 | - if ( apply_filters( 'default_option_' . $option, false, $option ) === $old_value ) { |
|
298 | + if (apply_filters('default_option_'.$option, false, $option) === $old_value) { |
|
299 | 299 | // Default setting for new options is 'yes'. |
300 | - if ( null === $autoload ) { |
|
300 | + if (null === $autoload) { |
|
301 | 301 | $autoload = 'yes'; |
302 | 302 | } |
303 | 303 | |
304 | - return add_option( $option, $value, '', $autoload ); |
|
304 | + return add_option($option, $value, '', $autoload); |
|
305 | 305 | } |
306 | 306 | |
307 | - $serialized_value = maybe_serialize( $value ); |
|
307 | + $serialized_value = maybe_serialize($value); |
|
308 | 308 | |
309 | 309 | /** |
310 | 310 | * Fires immediately before an option value is updated. |
@@ -315,33 +315,33 @@ discard block |
||
315 | 315 | * @param mixed $old_value The old option value. |
316 | 316 | * @param mixed $value The new option value. |
317 | 317 | */ |
318 | - do_action( 'update_option', $option, $old_value, $value ); |
|
318 | + do_action('update_option', $option, $old_value, $value); |
|
319 | 319 | |
320 | 320 | $update_args = array( |
321 | 321 | 'option_value' => $serialized_value, |
322 | 322 | ); |
323 | 323 | |
324 | - if ( null !== $autoload ) { |
|
325 | - $update_args['autoload'] = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes'; |
|
324 | + if (null !== $autoload) { |
|
325 | + $update_args['autoload'] = ('no' === $autoload || false === $autoload) ? 'no' : 'yes'; |
|
326 | 326 | } |
327 | 327 | |
328 | - $result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => $option ) ); |
|
329 | - if ( ! $result ) |
|
328 | + $result = $wpdb->update($wpdb->options, $update_args, array('option_name' => $option)); |
|
329 | + if ( ! $result) |
|
330 | 330 | return false; |
331 | 331 | |
332 | - $notoptions = wp_cache_get( 'notoptions', 'options' ); |
|
333 | - if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) { |
|
334 | - unset( $notoptions[$option] ); |
|
335 | - wp_cache_set( 'notoptions', $notoptions, 'options' ); |
|
332 | + $notoptions = wp_cache_get('notoptions', 'options'); |
|
333 | + if (is_array($notoptions) && isset($notoptions[$option])) { |
|
334 | + unset($notoptions[$option]); |
|
335 | + wp_cache_set('notoptions', $notoptions, 'options'); |
|
336 | 336 | } |
337 | 337 | |
338 | - if ( ! wp_installing() ) { |
|
338 | + if ( ! wp_installing()) { |
|
339 | 339 | $alloptions = wp_load_alloptions(); |
340 | - if ( isset( $alloptions[$option] ) ) { |
|
341 | - $alloptions[ $option ] = $serialized_value; |
|
342 | - wp_cache_set( 'alloptions', $alloptions, 'options' ); |
|
340 | + if (isset($alloptions[$option])) { |
|
341 | + $alloptions[$option] = $serialized_value; |
|
342 | + wp_cache_set('alloptions', $alloptions, 'options'); |
|
343 | 343 | } else { |
344 | - wp_cache_set( $option, $serialized_value, 'options' ); |
|
344 | + wp_cache_set($option, $serialized_value, 'options'); |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | * @param mixed $value The new option value. |
358 | 358 | * @param string $option Option name. |
359 | 359 | */ |
360 | - do_action( "update_option_{$option}", $old_value, $value, $option ); |
|
360 | + do_action("update_option_{$option}", $old_value, $value, $option); |
|
361 | 361 | |
362 | 362 | /** |
363 | 363 | * Fires after the value of an option has been successfully updated. |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * @param mixed $old_value The old option value. |
369 | 369 | * @param mixed $value The new option value. |
370 | 370 | */ |
371 | - do_action( 'updated_option', $option, $old_value, $value ); |
|
371 | + do_action('updated_option', $option, $old_value, $value); |
|
372 | 372 | return true; |
373 | 373 | } |
374 | 374 | |
@@ -395,32 +395,32 @@ discard block |
||
395 | 395 | * Default is enabled. Accepts 'no' to disable for legacy reasons. |
396 | 396 | * @return bool False if option was not added and true if option was added. |
397 | 397 | */ |
398 | -function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) { |
|
398 | +function add_option($option, $value = '', $deprecated = '', $autoload = 'yes') { |
|
399 | 399 | global $wpdb; |
400 | 400 | |
401 | - if ( !empty( $deprecated ) ) |
|
402 | - _deprecated_argument( __FUNCTION__, '2.3.0' ); |
|
401 | + if ( ! empty($deprecated)) |
|
402 | + _deprecated_argument(__FUNCTION__, '2.3.0'); |
|
403 | 403 | |
404 | 404 | $option = trim($option); |
405 | - if ( empty($option) ) |
|
405 | + if (empty($option)) |
|
406 | 406 | return false; |
407 | 407 | |
408 | - wp_protect_special_option( $option ); |
|
408 | + wp_protect_special_option($option); |
|
409 | 409 | |
410 | - if ( is_object($value) ) |
|
410 | + if (is_object($value)) |
|
411 | 411 | $value = clone $value; |
412 | 412 | |
413 | - $value = sanitize_option( $option, $value ); |
|
413 | + $value = sanitize_option($option, $value); |
|
414 | 414 | |
415 | 415 | // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query |
416 | - $notoptions = wp_cache_get( 'notoptions', 'options' ); |
|
417 | - if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) ) |
|
416 | + $notoptions = wp_cache_get('notoptions', 'options'); |
|
417 | + if ( ! is_array($notoptions) || ! isset($notoptions[$option])) |
|
418 | 418 | /** This filter is documented in wp-includes/option.php */ |
419 | - if ( apply_filters( 'default_option_' . $option, false, $option ) !== get_option( $option ) ) |
|
419 | + if (apply_filters('default_option_'.$option, false, $option) !== get_option($option)) |
|
420 | 420 | return false; |
421 | 421 | |
422 | - $serialized_value = maybe_serialize( $value ); |
|
423 | - $autoload = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes'; |
|
422 | + $serialized_value = maybe_serialize($value); |
|
423 | + $autoload = ('no' === $autoload || false === $autoload) ? 'no' : 'yes'; |
|
424 | 424 | |
425 | 425 | /** |
426 | 426 | * Fires before an option is added. |
@@ -430,27 +430,27 @@ discard block |
||
430 | 430 | * @param string $option Name of the option to add. |
431 | 431 | * @param mixed $value Value of the option. |
432 | 432 | */ |
433 | - do_action( 'add_option', $option, $value ); |
|
433 | + do_action('add_option', $option, $value); |
|
434 | 434 | |
435 | - $result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload ) ); |
|
436 | - if ( ! $result ) |
|
435 | + $result = $wpdb->query($wpdb->prepare("INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload)); |
|
436 | + if ( ! $result) |
|
437 | 437 | return false; |
438 | 438 | |
439 | - if ( ! wp_installing() ) { |
|
440 | - if ( 'yes' == $autoload ) { |
|
439 | + if ( ! wp_installing()) { |
|
440 | + if ('yes' == $autoload) { |
|
441 | 441 | $alloptions = wp_load_alloptions(); |
442 | - $alloptions[ $option ] = $serialized_value; |
|
443 | - wp_cache_set( 'alloptions', $alloptions, 'options' ); |
|
442 | + $alloptions[$option] = $serialized_value; |
|
443 | + wp_cache_set('alloptions', $alloptions, 'options'); |
|
444 | 444 | } else { |
445 | - wp_cache_set( $option, $serialized_value, 'options' ); |
|
445 | + wp_cache_set($option, $serialized_value, 'options'); |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | |
449 | 449 | // This option exists now |
450 | - $notoptions = wp_cache_get( 'notoptions', 'options' ); // yes, again... we need it to be fresh |
|
451 | - if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) { |
|
452 | - unset( $notoptions[$option] ); |
|
453 | - wp_cache_set( 'notoptions', $notoptions, 'options' ); |
|
450 | + $notoptions = wp_cache_get('notoptions', 'options'); // yes, again... we need it to be fresh |
|
451 | + if (is_array($notoptions) && isset($notoptions[$option])) { |
|
452 | + unset($notoptions[$option]); |
|
453 | + wp_cache_set('notoptions', $notoptions, 'options'); |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | /** |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @param string $option Name of the option to add. |
465 | 465 | * @param mixed $value Value of the option. |
466 | 466 | */ |
467 | - do_action( "add_option_{$option}", $option, $value ); |
|
467 | + do_action("add_option_{$option}", $option, $value); |
|
468 | 468 | |
469 | 469 | /** |
470 | 470 | * Fires after an option has been added. |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | * @param string $option Name of the added option. |
475 | 475 | * @param mixed $value Value of the option. |
476 | 476 | */ |
477 | - do_action( 'added_option', $option, $value ); |
|
477 | + do_action('added_option', $option, $value); |
|
478 | 478 | return true; |
479 | 479 | } |
480 | 480 | |
@@ -488,18 +488,18 @@ discard block |
||
488 | 488 | * @param string $option Name of option to remove. Expected to not be SQL-escaped. |
489 | 489 | * @return bool True, if option is successfully deleted. False on failure. |
490 | 490 | */ |
491 | -function delete_option( $option ) { |
|
491 | +function delete_option($option) { |
|
492 | 492 | global $wpdb; |
493 | 493 | |
494 | - $option = trim( $option ); |
|
495 | - if ( empty( $option ) ) |
|
494 | + $option = trim($option); |
|
495 | + if (empty($option)) |
|
496 | 496 | return false; |
497 | 497 | |
498 | - wp_protect_special_option( $option ); |
|
498 | + wp_protect_special_option($option); |
|
499 | 499 | |
500 | 500 | // Get the ID, if no ID then return |
501 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option ) ); |
|
502 | - if ( is_null( $row ) ) |
|
501 | + $row = $wpdb->get_row($wpdb->prepare("SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option)); |
|
502 | + if (is_null($row)) |
|
503 | 503 | return false; |
504 | 504 | |
505 | 505 | /** |
@@ -509,21 +509,21 @@ discard block |
||
509 | 509 | * |
510 | 510 | * @param string $option Name of the option to delete. |
511 | 511 | */ |
512 | - do_action( 'delete_option', $option ); |
|
512 | + do_action('delete_option', $option); |
|
513 | 513 | |
514 | - $result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) ); |
|
515 | - if ( ! wp_installing() ) { |
|
516 | - if ( 'yes' == $row->autoload ) { |
|
514 | + $result = $wpdb->delete($wpdb->options, array('option_name' => $option)); |
|
515 | + if ( ! wp_installing()) { |
|
516 | + if ('yes' == $row->autoload) { |
|
517 | 517 | $alloptions = wp_load_alloptions(); |
518 | - if ( is_array( $alloptions ) && isset( $alloptions[$option] ) ) { |
|
519 | - unset( $alloptions[$option] ); |
|
520 | - wp_cache_set( 'alloptions', $alloptions, 'options' ); |
|
518 | + if (is_array($alloptions) && isset($alloptions[$option])) { |
|
519 | + unset($alloptions[$option]); |
|
520 | + wp_cache_set('alloptions', $alloptions, 'options'); |
|
521 | 521 | } |
522 | 522 | } else { |
523 | - wp_cache_delete( $option, 'options' ); |
|
523 | + wp_cache_delete($option, 'options'); |
|
524 | 524 | } |
525 | 525 | } |
526 | - if ( $result ) { |
|
526 | + if ($result) { |
|
527 | 527 | |
528 | 528 | /** |
529 | 529 | * Fires after a specific option has been deleted. |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @param string $option Name of the deleted option. |
536 | 536 | */ |
537 | - do_action( "delete_option_$option", $option ); |
|
537 | + do_action("delete_option_$option", $option); |
|
538 | 538 | |
539 | 539 | /** |
540 | 540 | * Fires after an option has been deleted. |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | * |
544 | 544 | * @param string $option Name of the deleted option. |
545 | 545 | */ |
546 | - do_action( 'deleted_option', $option ); |
|
546 | + do_action('deleted_option', $option); |
|
547 | 547 | return true; |
548 | 548 | } |
549 | 549 | return false; |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | * @param string $transient Transient name. Expected to not be SQL-escaped. |
558 | 558 | * @return bool true if successful, false otherwise |
559 | 559 | */ |
560 | -function delete_transient( $transient ) { |
|
560 | +function delete_transient($transient) { |
|
561 | 561 | |
562 | 562 | /** |
563 | 563 | * Fires immediately before a specific transient is deleted. |
@@ -568,19 +568,19 @@ discard block |
||
568 | 568 | * |
569 | 569 | * @param string $transient Transient name. |
570 | 570 | */ |
571 | - do_action( 'delete_transient_' . $transient, $transient ); |
|
571 | + do_action('delete_transient_'.$transient, $transient); |
|
572 | 572 | |
573 | - if ( wp_using_ext_object_cache() ) { |
|
574 | - $result = wp_cache_delete( $transient, 'transient' ); |
|
573 | + if (wp_using_ext_object_cache()) { |
|
574 | + $result = wp_cache_delete($transient, 'transient'); |
|
575 | 575 | } else { |
576 | - $option_timeout = '_transient_timeout_' . $transient; |
|
577 | - $option = '_transient_' . $transient; |
|
578 | - $result = delete_option( $option ); |
|
579 | - if ( $result ) |
|
580 | - delete_option( $option_timeout ); |
|
576 | + $option_timeout = '_transient_timeout_'.$transient; |
|
577 | + $option = '_transient_'.$transient; |
|
578 | + $result = delete_option($option); |
|
579 | + if ($result) |
|
580 | + delete_option($option_timeout); |
|
581 | 581 | } |
582 | 582 | |
583 | - if ( $result ) { |
|
583 | + if ($result) { |
|
584 | 584 | |
585 | 585 | /** |
586 | 586 | * Fires after a transient is deleted. |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | * |
590 | 590 | * @param string $transient Deleted transient name. |
591 | 591 | */ |
592 | - do_action( 'deleted_transient', $transient ); |
|
592 | + do_action('deleted_transient', $transient); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | return $result; |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | * @param string $transient Transient name. Expected to not be SQL-escaped. |
607 | 607 | * @return mixed Value of transient. |
608 | 608 | */ |
609 | -function get_transient( $transient ) { |
|
609 | +function get_transient($transient) { |
|
610 | 610 | |
611 | 611 | /** |
612 | 612 | * Filters the value of an existing transient. |
@@ -624,30 +624,30 @@ discard block |
||
624 | 624 | * of the transient, and return the returned value. |
625 | 625 | * @param string $transient Transient name. |
626 | 626 | */ |
627 | - $pre = apply_filters( 'pre_transient_' . $transient, false, $transient ); |
|
628 | - if ( false !== $pre ) |
|
627 | + $pre = apply_filters('pre_transient_'.$transient, false, $transient); |
|
628 | + if (false !== $pre) |
|
629 | 629 | return $pre; |
630 | 630 | |
631 | - if ( wp_using_ext_object_cache() ) { |
|
632 | - $value = wp_cache_get( $transient, 'transient' ); |
|
631 | + if (wp_using_ext_object_cache()) { |
|
632 | + $value = wp_cache_get($transient, 'transient'); |
|
633 | 633 | } else { |
634 | - $transient_option = '_transient_' . $transient; |
|
635 | - if ( ! wp_installing() ) { |
|
634 | + $transient_option = '_transient_'.$transient; |
|
635 | + if ( ! wp_installing()) { |
|
636 | 636 | // If option is not in alloptions, it is not autoloaded and thus has a timeout |
637 | 637 | $alloptions = wp_load_alloptions(); |
638 | - if ( !isset( $alloptions[$transient_option] ) ) { |
|
639 | - $transient_timeout = '_transient_timeout_' . $transient; |
|
640 | - $timeout = get_option( $transient_timeout ); |
|
641 | - if ( false !== $timeout && $timeout < time() ) { |
|
642 | - delete_option( $transient_option ); |
|
643 | - delete_option( $transient_timeout ); |
|
638 | + if ( ! isset($alloptions[$transient_option])) { |
|
639 | + $transient_timeout = '_transient_timeout_'.$transient; |
|
640 | + $timeout = get_option($transient_timeout); |
|
641 | + if (false !== $timeout && $timeout < time()) { |
|
642 | + delete_option($transient_option); |
|
643 | + delete_option($transient_timeout); |
|
644 | 644 | $value = false; |
645 | 645 | } |
646 | 646 | } |
647 | 647 | } |
648 | 648 | |
649 | - if ( ! isset( $value ) ) |
|
650 | - $value = get_option( $transient_option ); |
|
649 | + if ( ! isset($value)) |
|
650 | + $value = get_option($transient_option); |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | /** |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | * @param mixed $value Value of transient. |
662 | 662 | * @param string $transient Transient name. |
663 | 663 | */ |
664 | - return apply_filters( 'transient_' . $transient, $value, $transient ); |
|
664 | + return apply_filters('transient_'.$transient, $value, $transient); |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | /** |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | * @param int $expiration Optional. Time until expiration in seconds. Default 0 (no expiration). |
680 | 680 | * @return bool False if value was not set and true if value was set. |
681 | 681 | */ |
682 | -function set_transient( $transient, $value, $expiration = 0 ) { |
|
682 | +function set_transient($transient, $value, $expiration = 0) { |
|
683 | 683 | |
684 | 684 | $expiration = (int) $expiration; |
685 | 685 | |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | * @param int $expiration Time until expiration in seconds. |
697 | 697 | * @param string $transient Transient name. |
698 | 698 | */ |
699 | - $value = apply_filters( 'pre_set_transient_' . $transient, $value, $expiration, $transient ); |
|
699 | + $value = apply_filters('pre_set_transient_'.$transient, $value, $expiration, $transient); |
|
700 | 700 | |
701 | 701 | /** |
702 | 702 | * Filters the expiration for a transient before its value is set. |
@@ -709,41 +709,41 @@ discard block |
||
709 | 709 | * @param mixed $value New value of transient. |
710 | 710 | * @param string $transient Transient name. |
711 | 711 | */ |
712 | - $expiration = apply_filters( 'expiration_of_transient_' . $transient, $expiration, $value, $transient ); |
|
712 | + $expiration = apply_filters('expiration_of_transient_'.$transient, $expiration, $value, $transient); |
|
713 | 713 | |
714 | - if ( wp_using_ext_object_cache() ) { |
|
715 | - $result = wp_cache_set( $transient, $value, 'transient', $expiration ); |
|
714 | + if (wp_using_ext_object_cache()) { |
|
715 | + $result = wp_cache_set($transient, $value, 'transient', $expiration); |
|
716 | 716 | } else { |
717 | - $transient_timeout = '_transient_timeout_' . $transient; |
|
718 | - $transient_option = '_transient_' . $transient; |
|
719 | - if ( false === get_option( $transient_option ) ) { |
|
717 | + $transient_timeout = '_transient_timeout_'.$transient; |
|
718 | + $transient_option = '_transient_'.$transient; |
|
719 | + if (false === get_option($transient_option)) { |
|
720 | 720 | $autoload = 'yes'; |
721 | - if ( $expiration ) { |
|
721 | + if ($expiration) { |
|
722 | 722 | $autoload = 'no'; |
723 | - add_option( $transient_timeout, time() + $expiration, '', 'no' ); |
|
723 | + add_option($transient_timeout, time() + $expiration, '', 'no'); |
|
724 | 724 | } |
725 | - $result = add_option( $transient_option, $value, '', $autoload ); |
|
725 | + $result = add_option($transient_option, $value, '', $autoload); |
|
726 | 726 | } else { |
727 | 727 | // If expiration is requested, but the transient has no timeout option, |
728 | 728 | // delete, then re-create transient rather than update. |
729 | 729 | $update = true; |
730 | - if ( $expiration ) { |
|
731 | - if ( false === get_option( $transient_timeout ) ) { |
|
732 | - delete_option( $transient_option ); |
|
733 | - add_option( $transient_timeout, time() + $expiration, '', 'no' ); |
|
734 | - $result = add_option( $transient_option, $value, '', 'no' ); |
|
730 | + if ($expiration) { |
|
731 | + if (false === get_option($transient_timeout)) { |
|
732 | + delete_option($transient_option); |
|
733 | + add_option($transient_timeout, time() + $expiration, '', 'no'); |
|
734 | + $result = add_option($transient_option, $value, '', 'no'); |
|
735 | 735 | $update = false; |
736 | 736 | } else { |
737 | - update_option( $transient_timeout, time() + $expiration ); |
|
737 | + update_option($transient_timeout, time() + $expiration); |
|
738 | 738 | } |
739 | 739 | } |
740 | - if ( $update ) { |
|
741 | - $result = update_option( $transient_option, $value ); |
|
740 | + if ($update) { |
|
741 | + $result = update_option($transient_option, $value); |
|
742 | 742 | } |
743 | 743 | } |
744 | 744 | } |
745 | 745 | |
746 | - if ( $result ) { |
|
746 | + if ($result) { |
|
747 | 747 | |
748 | 748 | /** |
749 | 749 | * Fires after the value for a specific transient has been set. |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | * @param int $expiration Time until expiration in seconds. |
759 | 759 | * @param string $transient The name of the transient. |
760 | 760 | */ |
761 | - do_action( 'set_transient_' . $transient, $value, $expiration, $transient ); |
|
761 | + do_action('set_transient_'.$transient, $value, $expiration, $transient); |
|
762 | 762 | |
763 | 763 | /** |
764 | 764 | * Fires after the value for a transient has been set. |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | * @param mixed $value Transient value. |
771 | 771 | * @param int $expiration Time until expiration in seconds. |
772 | 772 | */ |
773 | - do_action( 'setted_transient', $transient, $value, $expiration ); |
|
773 | + do_action('setted_transient', $transient, $value, $expiration); |
|
774 | 774 | } |
775 | 775 | return $result; |
776 | 776 | } |
@@ -786,43 +786,43 @@ discard block |
||
786 | 786 | */ |
787 | 787 | function wp_user_settings() { |
788 | 788 | |
789 | - if ( ! is_admin() || defined( 'DOING_AJAX' ) ) { |
|
789 | + if ( ! is_admin() || defined('DOING_AJAX')) { |
|
790 | 790 | return; |
791 | 791 | } |
792 | 792 | |
793 | - if ( ! $user_id = get_current_user_id() ) { |
|
793 | + if ( ! $user_id = get_current_user_id()) { |
|
794 | 794 | return; |
795 | 795 | } |
796 | 796 | |
797 | - if ( is_super_admin() && ! is_user_member_of_blog() ) { |
|
797 | + if (is_super_admin() && ! is_user_member_of_blog()) { |
|
798 | 798 | return; |
799 | 799 | } |
800 | 800 | |
801 | - $settings = (string) get_user_option( 'user-settings', $user_id ); |
|
801 | + $settings = (string) get_user_option('user-settings', $user_id); |
|
802 | 802 | |
803 | - if ( isset( $_COOKIE['wp-settings-' . $user_id] ) ) { |
|
804 | - $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user_id] ); |
|
803 | + if (isset($_COOKIE['wp-settings-'.$user_id])) { |
|
804 | + $cookie = preg_replace('/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-'.$user_id]); |
|
805 | 805 | |
806 | 806 | // No change or both empty |
807 | - if ( $cookie == $settings ) |
|
807 | + if ($cookie == $settings) |
|
808 | 808 | return; |
809 | 809 | |
810 | - $last_saved = (int) get_user_option( 'user-settings-time', $user_id ); |
|
811 | - $current = isset( $_COOKIE['wp-settings-time-' . $user_id]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user_id] ) : 0; |
|
810 | + $last_saved = (int) get_user_option('user-settings-time', $user_id); |
|
811 | + $current = isset($_COOKIE['wp-settings-time-'.$user_id]) ? preg_replace('/[^0-9]/', '', $_COOKIE['wp-settings-time-'.$user_id]) : 0; |
|
812 | 812 | |
813 | 813 | // The cookie is newer than the saved value. Update the user_option and leave the cookie as-is |
814 | - if ( $current > $last_saved ) { |
|
815 | - update_user_option( $user_id, 'user-settings', $cookie, false ); |
|
816 | - update_user_option( $user_id, 'user-settings-time', time() - 5, false ); |
|
814 | + if ($current > $last_saved) { |
|
815 | + update_user_option($user_id, 'user-settings', $cookie, false); |
|
816 | + update_user_option($user_id, 'user-settings-time', time() - 5, false); |
|
817 | 817 | return; |
818 | 818 | } |
819 | 819 | } |
820 | 820 | |
821 | 821 | // The cookie is not set in the current browser or the saved value is newer. |
822 | - $secure = ( 'https' === parse_url( admin_url(), PHP_URL_SCHEME ) ); |
|
823 | - setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure ); |
|
824 | - setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure ); |
|
825 | - $_COOKIE['wp-settings-' . $user_id] = $settings; |
|
822 | + $secure = ('https' === parse_url(admin_url(), PHP_URL_SCHEME)); |
|
823 | + setcookie('wp-settings-'.$user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure); |
|
824 | + setcookie('wp-settings-time-'.$user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure); |
|
825 | + $_COOKIE['wp-settings-'.$user_id] = $settings; |
|
826 | 826 | } |
827 | 827 | |
828 | 828 | /** |
@@ -834,10 +834,10 @@ discard block |
||
834 | 834 | * @param string $default Optional default value to return when $name is not set. |
835 | 835 | * @return mixed the last saved user setting or the default value/false if it doesn't exist. |
836 | 836 | */ |
837 | -function get_user_setting( $name, $default = false ) { |
|
837 | +function get_user_setting($name, $default = false) { |
|
838 | 838 | $all_user_settings = get_all_user_settings(); |
839 | 839 | |
840 | - return isset( $all_user_settings[$name] ) ? $all_user_settings[$name] : $default; |
|
840 | + return isset($all_user_settings[$name]) ? $all_user_settings[$name] : $default; |
|
841 | 841 | } |
842 | 842 | |
843 | 843 | /** |
@@ -853,15 +853,15 @@ discard block |
||
853 | 853 | * @param string $value The value for the setting. |
854 | 854 | * @return bool|null True if set successfully, false if not. Null if the current user can't be established. |
855 | 855 | */ |
856 | -function set_user_setting( $name, $value ) { |
|
857 | - if ( headers_sent() ) { |
|
856 | +function set_user_setting($name, $value) { |
|
857 | + if (headers_sent()) { |
|
858 | 858 | return false; |
859 | 859 | } |
860 | 860 | |
861 | 861 | $all_user_settings = get_all_user_settings(); |
862 | 862 | $all_user_settings[$name] = $value; |
863 | 863 | |
864 | - return wp_set_all_user_settings( $all_user_settings ); |
|
864 | + return wp_set_all_user_settings($all_user_settings); |
|
865 | 865 | } |
866 | 866 | |
867 | 867 | /** |
@@ -876,8 +876,8 @@ discard block |
||
876 | 876 | * @param string $names The name or array of names of the setting to be deleted. |
877 | 877 | * @return bool|null True if deleted successfully, false if not. Null if the current user can't be established. |
878 | 878 | */ |
879 | -function delete_user_setting( $names ) { |
|
880 | - if ( headers_sent() ) { |
|
879 | +function delete_user_setting($names) { |
|
880 | + if (headers_sent()) { |
|
881 | 881 | return false; |
882 | 882 | } |
883 | 883 | |
@@ -885,15 +885,15 @@ discard block |
||
885 | 885 | $names = (array) $names; |
886 | 886 | $deleted = false; |
887 | 887 | |
888 | - foreach ( $names as $name ) { |
|
889 | - if ( isset( $all_user_settings[$name] ) ) { |
|
890 | - unset( $all_user_settings[$name] ); |
|
888 | + foreach ($names as $name) { |
|
889 | + if (isset($all_user_settings[$name])) { |
|
890 | + unset($all_user_settings[$name]); |
|
891 | 891 | $deleted = true; |
892 | 892 | } |
893 | 893 | } |
894 | 894 | |
895 | - if ( $deleted ) { |
|
896 | - return wp_set_all_user_settings( $all_user_settings ); |
|
895 | + if ($deleted) { |
|
896 | + return wp_set_all_user_settings($all_user_settings); |
|
897 | 897 | } |
898 | 898 | |
899 | 899 | return false; |
@@ -911,27 +911,27 @@ discard block |
||
911 | 911 | function get_all_user_settings() { |
912 | 912 | global $_updated_user_settings; |
913 | 913 | |
914 | - if ( ! $user_id = get_current_user_id() ) { |
|
914 | + if ( ! $user_id = get_current_user_id()) { |
|
915 | 915 | return array(); |
916 | 916 | } |
917 | 917 | |
918 | - if ( isset( $_updated_user_settings ) && is_array( $_updated_user_settings ) ) { |
|
918 | + if (isset($_updated_user_settings) && is_array($_updated_user_settings)) { |
|
919 | 919 | return $_updated_user_settings; |
920 | 920 | } |
921 | 921 | |
922 | 922 | $user_settings = array(); |
923 | 923 | |
924 | - if ( isset( $_COOKIE['wp-settings-' . $user_id] ) ) { |
|
925 | - $cookie = preg_replace( '/[^A-Za-z0-9=&_-]/', '', $_COOKIE['wp-settings-' . $user_id] ); |
|
924 | + if (isset($_COOKIE['wp-settings-'.$user_id])) { |
|
925 | + $cookie = preg_replace('/[^A-Za-z0-9=&_-]/', '', $_COOKIE['wp-settings-'.$user_id]); |
|
926 | 926 | |
927 | - if ( strpos( $cookie, '=' ) ) { // '=' cannot be 1st char |
|
928 | - parse_str( $cookie, $user_settings ); |
|
927 | + if (strpos($cookie, '=')) { // '=' cannot be 1st char |
|
928 | + parse_str($cookie, $user_settings); |
|
929 | 929 | } |
930 | 930 | } else { |
931 | - $option = get_user_option( 'user-settings', $user_id ); |
|
931 | + $option = get_user_option('user-settings', $user_id); |
|
932 | 932 | |
933 | - if ( $option && is_string( $option ) ) { |
|
934 | - parse_str( $option, $user_settings ); |
|
933 | + if ($option && is_string($option)) { |
|
934 | + parse_str($option, $user_settings); |
|
935 | 935 | } |
936 | 936 | } |
937 | 937 | |
@@ -951,32 +951,32 @@ discard block |
||
951 | 951 | * @return bool|null False if the current user can't be found, null if the current |
952 | 952 | * user is not a super admin or a member of the site, otherwise true. |
953 | 953 | */ |
954 | -function wp_set_all_user_settings( $user_settings ) { |
|
954 | +function wp_set_all_user_settings($user_settings) { |
|
955 | 955 | global $_updated_user_settings; |
956 | 956 | |
957 | - if ( ! $user_id = get_current_user_id() ) { |
|
957 | + if ( ! $user_id = get_current_user_id()) { |
|
958 | 958 | return false; |
959 | 959 | } |
960 | 960 | |
961 | - if ( is_super_admin() && ! is_user_member_of_blog() ) { |
|
961 | + if (is_super_admin() && ! is_user_member_of_blog()) { |
|
962 | 962 | return; |
963 | 963 | } |
964 | 964 | |
965 | 965 | $settings = ''; |
966 | - foreach ( $user_settings as $name => $value ) { |
|
967 | - $_name = preg_replace( '/[^A-Za-z0-9_-]+/', '', $name ); |
|
968 | - $_value = preg_replace( '/[^A-Za-z0-9_-]+/', '', $value ); |
|
966 | + foreach ($user_settings as $name => $value) { |
|
967 | + $_name = preg_replace('/[^A-Za-z0-9_-]+/', '', $name); |
|
968 | + $_value = preg_replace('/[^A-Za-z0-9_-]+/', '', $value); |
|
969 | 969 | |
970 | - if ( ! empty( $_name ) ) { |
|
971 | - $settings .= $_name . '=' . $_value . '&'; |
|
970 | + if ( ! empty($_name)) { |
|
971 | + $settings .= $_name.'='.$_value.'&'; |
|
972 | 972 | } |
973 | 973 | } |
974 | 974 | |
975 | - $settings = rtrim( $settings, '&' ); |
|
976 | - parse_str( $settings, $_updated_user_settings ); |
|
975 | + $settings = rtrim($settings, '&'); |
|
976 | + parse_str($settings, $_updated_user_settings); |
|
977 | 977 | |
978 | - update_user_option( $user_id, 'user-settings', $settings, false ); |
|
979 | - update_user_option( $user_id, 'user-settings-time', time(), false ); |
|
978 | + update_user_option($user_id, 'user-settings', $settings, false); |
|
979 | + update_user_option($user_id, 'user-settings-time', time(), false); |
|
980 | 980 | |
981 | 981 | return true; |
982 | 982 | } |
@@ -987,12 +987,12 @@ discard block |
||
987 | 987 | * @since 2.7.0 |
988 | 988 | */ |
989 | 989 | function delete_all_user_settings() { |
990 | - if ( ! $user_id = get_current_user_id() ) { |
|
990 | + if ( ! $user_id = get_current_user_id()) { |
|
991 | 991 | return; |
992 | 992 | } |
993 | 993 | |
994 | - update_user_option( $user_id, 'user-settings', '', false ); |
|
995 | - setcookie( 'wp-settings-' . $user_id, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH ); |
|
994 | + update_user_option($user_id, 'user-settings', '', false); |
|
995 | + setcookie('wp-settings-'.$user_id, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH); |
|
996 | 996 | } |
997 | 997 | |
998 | 998 | /** |
@@ -1009,8 +1009,8 @@ discard block |
||
1009 | 1009 | * @param bool $deprecated Whether to use cache. Multisite only. Always set to true. |
1010 | 1010 | * @return mixed Value set for the option. |
1011 | 1011 | */ |
1012 | -function get_site_option( $option, $default = false, $deprecated = true ) { |
|
1013 | - return get_network_option( null, $option, $default ); |
|
1012 | +function get_site_option($option, $default = false, $deprecated = true) { |
|
1013 | + return get_network_option(null, $option, $default); |
|
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | /** |
@@ -1027,8 +1027,8 @@ discard block |
||
1027 | 1027 | * @param mixed $value Option value, can be anything. Expected to not be SQL-escaped. |
1028 | 1028 | * @return bool False if the option was not added. True if the option was added. |
1029 | 1029 | */ |
1030 | -function add_site_option( $option, $value ) { |
|
1031 | - return add_network_option( null, $option, $value ); |
|
1030 | +function add_site_option($option, $value) { |
|
1031 | + return add_network_option(null, $option, $value); |
|
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | /** |
@@ -1042,8 +1042,8 @@ discard block |
||
1042 | 1042 | * @param string $option Name of option to remove. Expected to not be SQL-escaped. |
1043 | 1043 | * @return bool True, if succeed. False, if failure. |
1044 | 1044 | */ |
1045 | -function delete_site_option( $option ) { |
|
1046 | - return delete_network_option( null, $option ); |
|
1045 | +function delete_site_option($option) { |
|
1046 | + return delete_network_option(null, $option); |
|
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | /** |
@@ -1058,8 +1058,8 @@ discard block |
||
1058 | 1058 | * @param mixed $value Option value. Expected to not be SQL-escaped. |
1059 | 1059 | * @return bool False if value was not updated. True if value was updated. |
1060 | 1060 | */ |
1061 | -function update_site_option( $option, $value ) { |
|
1062 | - return update_network_option( null, $option, $value ); |
|
1061 | +function update_site_option($option, $value) { |
|
1062 | + return update_network_option(null, $option, $value); |
|
1063 | 1063 | } |
1064 | 1064 | |
1065 | 1065 | /** |
@@ -1077,17 +1077,17 @@ discard block |
||
1077 | 1077 | * @param mixed $default Optional. Value to return if the option doesn't exist. Default false. |
1078 | 1078 | * @return mixed Value set for the option. |
1079 | 1079 | */ |
1080 | -function get_network_option( $network_id, $option, $default = false ) { |
|
1080 | +function get_network_option($network_id, $option, $default = false) { |
|
1081 | 1081 | global $wpdb, $current_site; |
1082 | 1082 | |
1083 | - if ( $network_id && ! is_numeric( $network_id ) ) { |
|
1083 | + if ($network_id && ! is_numeric($network_id)) { |
|
1084 | 1084 | return false; |
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | $network_id = (int) $network_id; |
1088 | 1088 | |
1089 | 1089 | // Fallback to the current network if a network ID is not specified. |
1090 | - if ( ! $network_id && is_multisite() ) { |
|
1090 | + if ( ! $network_id && is_multisite()) { |
|
1091 | 1091 | $network_id = $current_site->id; |
1092 | 1092 | } |
1093 | 1093 | |
@@ -1106,17 +1106,17 @@ discard block |
||
1106 | 1106 | * @param mixed $pre_option The default value to return if the option does not exist. |
1107 | 1107 | * @param string $option Option name. |
1108 | 1108 | */ |
1109 | - $pre = apply_filters( 'pre_site_option_' . $option, false, $option ); |
|
1109 | + $pre = apply_filters('pre_site_option_'.$option, false, $option); |
|
1110 | 1110 | |
1111 | - if ( false !== $pre ) { |
|
1111 | + if (false !== $pre) { |
|
1112 | 1112 | return $pre; |
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | // prevent non-existent options from triggering multiple queries |
1116 | 1116 | $notoptions_key = "$network_id:notoptions"; |
1117 | - $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); |
|
1117 | + $notoptions = wp_cache_get($notoptions_key, 'site-options'); |
|
1118 | 1118 | |
1119 | - if ( isset( $notoptions[ $option ] ) ) { |
|
1119 | + if (isset($notoptions[$option])) { |
|
1120 | 1120 | |
1121 | 1121 | /** |
1122 | 1122 | * Filters a specific default network option. |
@@ -1130,34 +1130,34 @@ discard block |
||
1130 | 1130 | * in the database. |
1131 | 1131 | * @param string $option Option name. |
1132 | 1132 | */ |
1133 | - return apply_filters( 'default_site_option_' . $option, $default, $option ); |
|
1133 | + return apply_filters('default_site_option_'.$option, $default, $option); |
|
1134 | 1134 | } |
1135 | 1135 | |
1136 | - if ( ! is_multisite() ) { |
|
1136 | + if ( ! is_multisite()) { |
|
1137 | 1137 | /** This filter is documented in wp-includes/option.php */ |
1138 | - $default = apply_filters( 'default_site_option_' . $option, $default, $option ); |
|
1139 | - $value = get_option( $option, $default ); |
|
1138 | + $default = apply_filters('default_site_option_'.$option, $default, $option); |
|
1139 | + $value = get_option($option, $default); |
|
1140 | 1140 | } else { |
1141 | 1141 | $cache_key = "$network_id:$option"; |
1142 | - $value = wp_cache_get( $cache_key, 'site-options' ); |
|
1142 | + $value = wp_cache_get($cache_key, 'site-options'); |
|
1143 | 1143 | |
1144 | - if ( ! isset( $value ) || false === $value ) { |
|
1145 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $network_id ) ); |
|
1144 | + if ( ! isset($value) || false === $value) { |
|
1145 | + $row = $wpdb->get_row($wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $network_id)); |
|
1146 | 1146 | |
1147 | 1147 | // Has to be get_row instead of get_var because of funkiness with 0, false, null values |
1148 | - if ( is_object( $row ) ) { |
|
1148 | + if (is_object($row)) { |
|
1149 | 1149 | $value = $row->meta_value; |
1150 | - $value = maybe_unserialize( $value ); |
|
1151 | - wp_cache_set( $cache_key, $value, 'site-options' ); |
|
1150 | + $value = maybe_unserialize($value); |
|
1151 | + wp_cache_set($cache_key, $value, 'site-options'); |
|
1152 | 1152 | } else { |
1153 | - if ( ! is_array( $notoptions ) ) { |
|
1153 | + if ( ! is_array($notoptions)) { |
|
1154 | 1154 | $notoptions = array(); |
1155 | 1155 | } |
1156 | - $notoptions[ $option ] = true; |
|
1157 | - wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); |
|
1156 | + $notoptions[$option] = true; |
|
1157 | + wp_cache_set($notoptions_key, $notoptions, 'site-options'); |
|
1158 | 1158 | |
1159 | 1159 | /** This filter is documented in wp-includes/option.php */ |
1160 | - $value = apply_filters( 'default_site_option_' . $option, $default, $option ); |
|
1160 | + $value = apply_filters('default_site_option_'.$option, $default, $option); |
|
1161 | 1161 | } |
1162 | 1162 | } |
1163 | 1163 | } |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | * @param mixed $value Value of network option. |
1175 | 1175 | * @param string $option Option name. |
1176 | 1176 | */ |
1177 | - return apply_filters( 'site_option_' . $option, $value, $option ); |
|
1177 | + return apply_filters('site_option_'.$option, $value, $option); |
|
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | /** |
@@ -1194,21 +1194,21 @@ discard block |
||
1194 | 1194 | * @param mixed $value Option value, can be anything. Expected to not be SQL-escaped. |
1195 | 1195 | * @return bool False if option was not added and true if option was added. |
1196 | 1196 | */ |
1197 | -function add_network_option( $network_id, $option, $value ) { |
|
1197 | +function add_network_option($network_id, $option, $value) { |
|
1198 | 1198 | global $wpdb, $current_site; |
1199 | 1199 | |
1200 | - if ( $network_id && ! is_numeric( $network_id ) ) { |
|
1200 | + if ($network_id && ! is_numeric($network_id)) { |
|
1201 | 1201 | return false; |
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | $network_id = (int) $network_id; |
1205 | 1205 | |
1206 | 1206 | // Fallback to the current network if a network ID is not specified. |
1207 | - if ( ! $network_id && is_multisite() ) { |
|
1207 | + if ( ! $network_id && is_multisite()) { |
|
1208 | 1208 | $network_id = $current_site->id; |
1209 | 1209 | } |
1210 | 1210 | |
1211 | - wp_protect_special_option( $option ); |
|
1211 | + wp_protect_special_option($option); |
|
1212 | 1212 | |
1213 | 1213 | /** |
1214 | 1214 | * Filters the value of a specific network option before it is added. |
@@ -1222,43 +1222,43 @@ discard block |
||
1222 | 1222 | * @param mixed $value Value of network option. |
1223 | 1223 | * @param string $option Option name. |
1224 | 1224 | */ |
1225 | - $value = apply_filters( 'pre_add_site_option_' . $option, $value, $option ); |
|
1225 | + $value = apply_filters('pre_add_site_option_'.$option, $value, $option); |
|
1226 | 1226 | |
1227 | 1227 | $notoptions_key = "$network_id:notoptions"; |
1228 | 1228 | |
1229 | - if ( ! is_multisite() ) { |
|
1230 | - $result = add_option( $option, $value, '', 'no' ); |
|
1229 | + if ( ! is_multisite()) { |
|
1230 | + $result = add_option($option, $value, '', 'no'); |
|
1231 | 1231 | } else { |
1232 | 1232 | $cache_key = "$network_id:$option"; |
1233 | 1233 | |
1234 | 1234 | // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query |
1235 | - $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); |
|
1236 | - if ( ! is_array( $notoptions ) || ! isset( $notoptions[ $option ] ) ) { |
|
1237 | - if ( false !== get_network_option( $network_id, $option, false ) ) { |
|
1235 | + $notoptions = wp_cache_get($notoptions_key, 'site-options'); |
|
1236 | + if ( ! is_array($notoptions) || ! isset($notoptions[$option])) { |
|
1237 | + if (false !== get_network_option($network_id, $option, false)) { |
|
1238 | 1238 | return false; |
1239 | 1239 | } |
1240 | 1240 | } |
1241 | 1241 | |
1242 | - $value = sanitize_option( $option, $value ); |
|
1242 | + $value = sanitize_option($option, $value); |
|
1243 | 1243 | |
1244 | - $serialized_value = maybe_serialize( $value ); |
|
1245 | - $result = $wpdb->insert( $wpdb->sitemeta, array( 'site_id' => $network_id, 'meta_key' => $option, 'meta_value' => $serialized_value ) ); |
|
1244 | + $serialized_value = maybe_serialize($value); |
|
1245 | + $result = $wpdb->insert($wpdb->sitemeta, array('site_id' => $network_id, 'meta_key' => $option, 'meta_value' => $serialized_value)); |
|
1246 | 1246 | |
1247 | - if ( ! $result ) { |
|
1247 | + if ( ! $result) { |
|
1248 | 1248 | return false; |
1249 | 1249 | } |
1250 | 1250 | |
1251 | - wp_cache_set( $cache_key, $value, 'site-options' ); |
|
1251 | + wp_cache_set($cache_key, $value, 'site-options'); |
|
1252 | 1252 | |
1253 | 1253 | // This option exists now |
1254 | - $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); // yes, again... we need it to be fresh |
|
1255 | - if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { |
|
1256 | - unset( $notoptions[ $option ] ); |
|
1257 | - wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); |
|
1254 | + $notoptions = wp_cache_get($notoptions_key, 'site-options'); // yes, again... we need it to be fresh |
|
1255 | + if (is_array($notoptions) && isset($notoptions[$option])) { |
|
1256 | + unset($notoptions[$option]); |
|
1257 | + wp_cache_set($notoptions_key, $notoptions, 'site-options'); |
|
1258 | 1258 | } |
1259 | 1259 | } |
1260 | 1260 | |
1261 | - if ( $result ) { |
|
1261 | + if ($result) { |
|
1262 | 1262 | |
1263 | 1263 | /** |
1264 | 1264 | * Fires after a specific network option has been successfully added. |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | * @param string $option Name of the network option. |
1272 | 1272 | * @param mixed $value Value of the network option. |
1273 | 1273 | */ |
1274 | - do_action( 'add_site_option_' . $option, $option, $value ); |
|
1274 | + do_action('add_site_option_'.$option, $option, $value); |
|
1275 | 1275 | |
1276 | 1276 | /** |
1277 | 1277 | * Fires after a network option has been successfully added. |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | * @param string $option Name of the network option. |
1282 | 1282 | * @param mixed $value Value of the network option. |
1283 | 1283 | */ |
1284 | - do_action( 'add_site_option', $option, $value ); |
|
1284 | + do_action('add_site_option', $option, $value); |
|
1285 | 1285 | |
1286 | 1286 | return true; |
1287 | 1287 | } |
@@ -1303,17 +1303,17 @@ discard block |
||
1303 | 1303 | * @param string $option Name of option to remove. Expected to not be SQL-escaped. |
1304 | 1304 | * @return bool True, if succeed. False, if failure. |
1305 | 1305 | */ |
1306 | -function delete_network_option( $network_id, $option ) { |
|
1306 | +function delete_network_option($network_id, $option) { |
|
1307 | 1307 | global $wpdb, $current_site; |
1308 | 1308 | |
1309 | - if ( $network_id && ! is_numeric( $network_id ) ) { |
|
1309 | + if ($network_id && ! is_numeric($network_id)) { |
|
1310 | 1310 | return false; |
1311 | 1311 | } |
1312 | 1312 | |
1313 | 1313 | $network_id = (int) $network_id; |
1314 | 1314 | |
1315 | 1315 | // Fallback to the current network if a network ID is not specified. |
1316 | - if ( ! $network_id && is_multisite() ) { |
|
1316 | + if ( ! $network_id && is_multisite()) { |
|
1317 | 1317 | $network_id = $current_site->id; |
1318 | 1318 | } |
1319 | 1319 | |
@@ -1327,22 +1327,22 @@ discard block |
||
1327 | 1327 | * |
1328 | 1328 | * @param string $option Option name. |
1329 | 1329 | */ |
1330 | - do_action( 'pre_delete_site_option_' . $option, $option ); |
|
1330 | + do_action('pre_delete_site_option_'.$option, $option); |
|
1331 | 1331 | |
1332 | - if ( ! is_multisite() ) { |
|
1333 | - $result = delete_option( $option ); |
|
1332 | + if ( ! is_multisite()) { |
|
1333 | + $result = delete_option($option); |
|
1334 | 1334 | } else { |
1335 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $network_id ) ); |
|
1336 | - if ( is_null( $row ) || ! $row->meta_id ) { |
|
1335 | + $row = $wpdb->get_row($wpdb->prepare("SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $network_id)); |
|
1336 | + if (is_null($row) || ! $row->meta_id) { |
|
1337 | 1337 | return false; |
1338 | 1338 | } |
1339 | 1339 | $cache_key = "$network_id:$option"; |
1340 | - wp_cache_delete( $cache_key, 'site-options' ); |
|
1340 | + wp_cache_delete($cache_key, 'site-options'); |
|
1341 | 1341 | |
1342 | - $result = $wpdb->delete( $wpdb->sitemeta, array( 'meta_key' => $option, 'site_id' => $network_id ) ); |
|
1342 | + $result = $wpdb->delete($wpdb->sitemeta, array('meta_key' => $option, 'site_id' => $network_id)); |
|
1343 | 1343 | } |
1344 | 1344 | |
1345 | - if ( $result ) { |
|
1345 | + if ($result) { |
|
1346 | 1346 | |
1347 | 1347 | /** |
1348 | 1348 | * Fires after a specific network option has been deleted. |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | * |
1355 | 1355 | * @param string $option Name of the network option. |
1356 | 1356 | */ |
1357 | - do_action( 'delete_site_option_' . $option, $option ); |
|
1357 | + do_action('delete_site_option_'.$option, $option); |
|
1358 | 1358 | |
1359 | 1359 | /** |
1360 | 1360 | * Fires after a network option has been deleted. |
@@ -1363,7 +1363,7 @@ discard block |
||
1363 | 1363 | * |
1364 | 1364 | * @param string $option Name of the network option. |
1365 | 1365 | */ |
1366 | - do_action( 'delete_site_option', $option ); |
|
1366 | + do_action('delete_site_option', $option); |
|
1367 | 1367 | |
1368 | 1368 | return true; |
1369 | 1369 | } |
@@ -1386,23 +1386,23 @@ discard block |
||
1386 | 1386 | * @param mixed $value Option value. Expected to not be SQL-escaped. |
1387 | 1387 | * @return bool False if value was not updated and true if value was updated. |
1388 | 1388 | */ |
1389 | -function update_network_option( $network_id, $option, $value ) { |
|
1389 | +function update_network_option($network_id, $option, $value) { |
|
1390 | 1390 | global $wpdb, $current_site; |
1391 | 1391 | |
1392 | - if ( $network_id && ! is_numeric( $network_id ) ) { |
|
1392 | + if ($network_id && ! is_numeric($network_id)) { |
|
1393 | 1393 | return false; |
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 | $network_id = (int) $network_id; |
1397 | 1397 | |
1398 | 1398 | // Fallback to the current network if a network ID is not specified. |
1399 | - if ( ! $network_id && is_multisite() ) { |
|
1399 | + if ( ! $network_id && is_multisite()) { |
|
1400 | 1400 | $network_id = $current_site->id; |
1401 | 1401 | } |
1402 | 1402 | |
1403 | - wp_protect_special_option( $option ); |
|
1403 | + wp_protect_special_option($option); |
|
1404 | 1404 | |
1405 | - $old_value = get_network_option( $network_id, $option, false ); |
|
1405 | + $old_value = get_network_option($network_id, $option, false); |
|
1406 | 1406 | |
1407 | 1407 | /** |
1408 | 1408 | * Filters a specific network option before its value is updated. |
@@ -1417,38 +1417,38 @@ discard block |
||
1417 | 1417 | * @param mixed $old_value Old value of the network option. |
1418 | 1418 | * @param string $option Option name. |
1419 | 1419 | */ |
1420 | - $value = apply_filters( 'pre_update_site_option_' . $option, $value, $old_value, $option ); |
|
1420 | + $value = apply_filters('pre_update_site_option_'.$option, $value, $old_value, $option); |
|
1421 | 1421 | |
1422 | - if ( $value === $old_value ) { |
|
1422 | + if ($value === $old_value) { |
|
1423 | 1423 | return false; |
1424 | 1424 | } |
1425 | 1425 | |
1426 | - if ( false === $old_value ) { |
|
1427 | - return add_network_option( $network_id, $option, $value ); |
|
1426 | + if (false === $old_value) { |
|
1427 | + return add_network_option($network_id, $option, $value); |
|
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | $notoptions_key = "$network_id:notoptions"; |
1431 | - $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); |
|
1432 | - if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { |
|
1433 | - unset( $notoptions[ $option ] ); |
|
1434 | - wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); |
|
1431 | + $notoptions = wp_cache_get($notoptions_key, 'site-options'); |
|
1432 | + if (is_array($notoptions) && isset($notoptions[$option])) { |
|
1433 | + unset($notoptions[$option]); |
|
1434 | + wp_cache_set($notoptions_key, $notoptions, 'site-options'); |
|
1435 | 1435 | } |
1436 | 1436 | |
1437 | - if ( ! is_multisite() ) { |
|
1438 | - $result = update_option( $option, $value, 'no' ); |
|
1437 | + if ( ! is_multisite()) { |
|
1438 | + $result = update_option($option, $value, 'no'); |
|
1439 | 1439 | } else { |
1440 | - $value = sanitize_option( $option, $value ); |
|
1440 | + $value = sanitize_option($option, $value); |
|
1441 | 1441 | |
1442 | - $serialized_value = maybe_serialize( $value ); |
|
1443 | - $result = $wpdb->update( $wpdb->sitemeta, array( 'meta_value' => $serialized_value ), array( 'site_id' => $network_id, 'meta_key' => $option ) ); |
|
1442 | + $serialized_value = maybe_serialize($value); |
|
1443 | + $result = $wpdb->update($wpdb->sitemeta, array('meta_value' => $serialized_value), array('site_id' => $network_id, 'meta_key' => $option)); |
|
1444 | 1444 | |
1445 | - if ( $result ) { |
|
1445 | + if ($result) { |
|
1446 | 1446 | $cache_key = "$network_id:$option"; |
1447 | - wp_cache_set( $cache_key, $value, 'site-options' ); |
|
1447 | + wp_cache_set($cache_key, $value, 'site-options'); |
|
1448 | 1448 | } |
1449 | 1449 | } |
1450 | 1450 | |
1451 | - if ( $result ) { |
|
1451 | + if ($result) { |
|
1452 | 1452 | |
1453 | 1453 | /** |
1454 | 1454 | * Fires after the value of a specific network option has been successfully updated. |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | * @param mixed $value Current value of the network option. |
1463 | 1463 | * @param mixed $old_value Old value of the network option. |
1464 | 1464 | */ |
1465 | - do_action( 'update_site_option_' . $option, $option, $value, $old_value ); |
|
1465 | + do_action('update_site_option_'.$option, $option, $value, $old_value); |
|
1466 | 1466 | |
1467 | 1467 | /** |
1468 | 1468 | * Fires after the value of a network option has been successfully updated. |
@@ -1473,7 +1473,7 @@ discard block |
||
1473 | 1473 | * @param mixed $value Current value of the network option. |
1474 | 1474 | * @param mixed $old_value Old value of the network option. |
1475 | 1475 | */ |
1476 | - do_action( 'update_site_option', $option, $value, $old_value ); |
|
1476 | + do_action('update_site_option', $option, $value, $old_value); |
|
1477 | 1477 | |
1478 | 1478 | return true; |
1479 | 1479 | } |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | * @param string $transient Transient name. Expected to not be SQL-escaped. |
1490 | 1490 | * @return bool True if successful, false otherwise |
1491 | 1491 | */ |
1492 | -function delete_site_transient( $transient ) { |
|
1492 | +function delete_site_transient($transient) { |
|
1493 | 1493 | |
1494 | 1494 | /** |
1495 | 1495 | * Fires immediately before a specific site transient is deleted. |
@@ -1500,18 +1500,18 @@ discard block |
||
1500 | 1500 | * |
1501 | 1501 | * @param string $transient Transient name. |
1502 | 1502 | */ |
1503 | - do_action( 'delete_site_transient_' . $transient, $transient ); |
|
1503 | + do_action('delete_site_transient_'.$transient, $transient); |
|
1504 | 1504 | |
1505 | - if ( wp_using_ext_object_cache() ) { |
|
1506 | - $result = wp_cache_delete( $transient, 'site-transient' ); |
|
1505 | + if (wp_using_ext_object_cache()) { |
|
1506 | + $result = wp_cache_delete($transient, 'site-transient'); |
|
1507 | 1507 | } else { |
1508 | - $option_timeout = '_site_transient_timeout_' . $transient; |
|
1509 | - $option = '_site_transient_' . $transient; |
|
1510 | - $result = delete_site_option( $option ); |
|
1511 | - if ( $result ) |
|
1512 | - delete_site_option( $option_timeout ); |
|
1508 | + $option_timeout = '_site_transient_timeout_'.$transient; |
|
1509 | + $option = '_site_transient_'.$transient; |
|
1510 | + $result = delete_site_option($option); |
|
1511 | + if ($result) |
|
1512 | + delete_site_option($option_timeout); |
|
1513 | 1513 | } |
1514 | - if ( $result ) { |
|
1514 | + if ($result) { |
|
1515 | 1515 | |
1516 | 1516 | /** |
1517 | 1517 | * Fires after a transient is deleted. |
@@ -1520,7 +1520,7 @@ discard block |
||
1520 | 1520 | * |
1521 | 1521 | * @param string $transient Deleted transient name. |
1522 | 1522 | */ |
1523 | - do_action( 'deleted_site_transient', $transient ); |
|
1523 | + do_action('deleted_site_transient', $transient); |
|
1524 | 1524 | } |
1525 | 1525 | |
1526 | 1526 | return $result; |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | * @param string $transient Transient name. Expected to not be SQL-escaped. |
1540 | 1540 | * @return mixed Value of transient. |
1541 | 1541 | */ |
1542 | -function get_site_transient( $transient ) { |
|
1542 | +function get_site_transient($transient) { |
|
1543 | 1543 | |
1544 | 1544 | /** |
1545 | 1545 | * Filters the value of an existing site transient. |
@@ -1557,29 +1557,29 @@ discard block |
||
1557 | 1557 | * of the transient, and return the returned value. |
1558 | 1558 | * @param string $transient Transient name. |
1559 | 1559 | */ |
1560 | - $pre = apply_filters( 'pre_site_transient_' . $transient, false, $transient ); |
|
1560 | + $pre = apply_filters('pre_site_transient_'.$transient, false, $transient); |
|
1561 | 1561 | |
1562 | - if ( false !== $pre ) |
|
1562 | + if (false !== $pre) |
|
1563 | 1563 | return $pre; |
1564 | 1564 | |
1565 | - if ( wp_using_ext_object_cache() ) { |
|
1566 | - $value = wp_cache_get( $transient, 'site-transient' ); |
|
1565 | + if (wp_using_ext_object_cache()) { |
|
1566 | + $value = wp_cache_get($transient, 'site-transient'); |
|
1567 | 1567 | } else { |
1568 | 1568 | // Core transients that do not have a timeout. Listed here so querying timeouts can be avoided. |
1569 | 1569 | $no_timeout = array('update_core', 'update_plugins', 'update_themes'); |
1570 | - $transient_option = '_site_transient_' . $transient; |
|
1571 | - if ( ! in_array( $transient, $no_timeout ) ) { |
|
1572 | - $transient_timeout = '_site_transient_timeout_' . $transient; |
|
1573 | - $timeout = get_site_option( $transient_timeout ); |
|
1574 | - if ( false !== $timeout && $timeout < time() ) { |
|
1575 | - delete_site_option( $transient_option ); |
|
1576 | - delete_site_option( $transient_timeout ); |
|
1570 | + $transient_option = '_site_transient_'.$transient; |
|
1571 | + if ( ! in_array($transient, $no_timeout)) { |
|
1572 | + $transient_timeout = '_site_transient_timeout_'.$transient; |
|
1573 | + $timeout = get_site_option($transient_timeout); |
|
1574 | + if (false !== $timeout && $timeout < time()) { |
|
1575 | + delete_site_option($transient_option); |
|
1576 | + delete_site_option($transient_timeout); |
|
1577 | 1577 | $value = false; |
1578 | 1578 | } |
1579 | 1579 | } |
1580 | 1580 | |
1581 | - if ( ! isset( $value ) ) |
|
1582 | - $value = get_site_option( $transient_option ); |
|
1581 | + if ( ! isset($value)) |
|
1582 | + $value = get_site_option($transient_option); |
|
1583 | 1583 | } |
1584 | 1584 | |
1585 | 1585 | /** |
@@ -1593,7 +1593,7 @@ discard block |
||
1593 | 1593 | * @param mixed $value Value of site transient. |
1594 | 1594 | * @param string $transient Transient name. |
1595 | 1595 | */ |
1596 | - return apply_filters( 'site_transient_' . $transient, $value, $transient ); |
|
1596 | + return apply_filters('site_transient_'.$transient, $value, $transient); |
|
1597 | 1597 | } |
1598 | 1598 | |
1599 | 1599 | /** |
@@ -1612,7 +1612,7 @@ discard block |
||
1612 | 1612 | * @param int $expiration Optional. Time until expiration in seconds. Default 0 (no expiration). |
1613 | 1613 | * @return bool False if value was not set and true if value was set. |
1614 | 1614 | */ |
1615 | -function set_site_transient( $transient, $value, $expiration = 0 ) { |
|
1615 | +function set_site_transient($transient, $value, $expiration = 0) { |
|
1616 | 1616 | |
1617 | 1617 | /** |
1618 | 1618 | * Filters the value of a specific site transient before it is set. |
@@ -1625,7 +1625,7 @@ discard block |
||
1625 | 1625 | * @param mixed $value New value of site transient. |
1626 | 1626 | * @param string $transient Transient name. |
1627 | 1627 | */ |
1628 | - $value = apply_filters( 'pre_set_site_transient_' . $transient, $value, $transient ); |
|
1628 | + $value = apply_filters('pre_set_site_transient_'.$transient, $value, $transient); |
|
1629 | 1629 | |
1630 | 1630 | $expiration = (int) $expiration; |
1631 | 1631 | |
@@ -1640,24 +1640,24 @@ discard block |
||
1640 | 1640 | * @param mixed $value New value of site transient. |
1641 | 1641 | * @param string $transient Transient name. |
1642 | 1642 | */ |
1643 | - $expiration = apply_filters( 'expiration_of_site_transient_' . $transient, $expiration, $value, $transient ); |
|
1643 | + $expiration = apply_filters('expiration_of_site_transient_'.$transient, $expiration, $value, $transient); |
|
1644 | 1644 | |
1645 | - if ( wp_using_ext_object_cache() ) { |
|
1646 | - $result = wp_cache_set( $transient, $value, 'site-transient', $expiration ); |
|
1645 | + if (wp_using_ext_object_cache()) { |
|
1646 | + $result = wp_cache_set($transient, $value, 'site-transient', $expiration); |
|
1647 | 1647 | } else { |
1648 | - $transient_timeout = '_site_transient_timeout_' . $transient; |
|
1649 | - $option = '_site_transient_' . $transient; |
|
1650 | - if ( false === get_site_option( $option ) ) { |
|
1651 | - if ( $expiration ) |
|
1652 | - add_site_option( $transient_timeout, time() + $expiration ); |
|
1653 | - $result = add_site_option( $option, $value ); |
|
1648 | + $transient_timeout = '_site_transient_timeout_'.$transient; |
|
1649 | + $option = '_site_transient_'.$transient; |
|
1650 | + if (false === get_site_option($option)) { |
|
1651 | + if ($expiration) |
|
1652 | + add_site_option($transient_timeout, time() + $expiration); |
|
1653 | + $result = add_site_option($option, $value); |
|
1654 | 1654 | } else { |
1655 | - if ( $expiration ) |
|
1656 | - update_site_option( $transient_timeout, time() + $expiration ); |
|
1657 | - $result = update_site_option( $option, $value ); |
|
1655 | + if ($expiration) |
|
1656 | + update_site_option($transient_timeout, time() + $expiration); |
|
1657 | + $result = update_site_option($option, $value); |
|
1658 | 1658 | } |
1659 | 1659 | } |
1660 | - if ( $result ) { |
|
1660 | + if ($result) { |
|
1661 | 1661 | |
1662 | 1662 | /** |
1663 | 1663 | * Fires after the value for a specific site transient has been set. |
@@ -1671,7 +1671,7 @@ discard block |
||
1671 | 1671 | * @param int $expiration Time until expiration in seconds. |
1672 | 1672 | * @param string $transient Transient name. |
1673 | 1673 | */ |
1674 | - do_action( 'set_site_transient_' . $transient, $value, $expiration, $transient ); |
|
1674 | + do_action('set_site_transient_'.$transient, $value, $expiration, $transient); |
|
1675 | 1675 | |
1676 | 1676 | /** |
1677 | 1677 | * Fires after the value for a site transient has been set. |
@@ -1682,7 +1682,7 @@ discard block |
||
1682 | 1682 | * @param mixed $value Site transient value. |
1683 | 1683 | * @param int $expiration Time until expiration in seconds. |
1684 | 1684 | */ |
1685 | - do_action( 'setted_site_transient', $transient, $value, $expiration ); |
|
1685 | + do_action('setted_site_transient', $transient, $value, $expiration); |
|
1686 | 1686 | } |
1687 | 1687 | return $result; |
1688 | 1688 | } |
@@ -31,8 +31,9 @@ discard block |
||
31 | 31 | global $wpdb; |
32 | 32 | |
33 | 33 | $option = trim( $option ); |
34 | - if ( empty( $option ) ) |
|
35 | - return false; |
|
34 | + if ( empty( $option ) ) { |
|
35 | + return false; |
|
36 | + } |
|
36 | 37 | |
37 | 38 | /** |
38 | 39 | * Filters the value of an existing option before it is retrieved. |
@@ -50,11 +51,13 @@ discard block |
||
50 | 51 | * @param string $option Option name. |
51 | 52 | */ |
52 | 53 | $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
53 | - if ( false !== $pre ) |
|
54 | - return $pre; |
|
54 | + if ( false !== $pre ) { |
|
55 | + return $pre; |
|
56 | + } |
|
55 | 57 | |
56 | - if ( defined( 'WP_SETUP_CONFIG' ) ) |
|
57 | - return false; |
|
58 | + if ( defined( 'WP_SETUP_CONFIG' ) ) { |
|
59 | + return false; |
|
60 | + } |
|
58 | 61 | |
59 | 62 | if ( ! wp_installing() ) { |
60 | 63 | // prevent non-existent options from triggering multiple queries |
@@ -114,11 +117,13 @@ discard block |
||
114 | 117 | } |
115 | 118 | |
116 | 119 | // If home is not set use siteurl. |
117 | - if ( 'home' == $option && '' == $value ) |
|
118 | - return get_option( 'siteurl' ); |
|
120 | + if ( 'home' == $option && '' == $value ) { |
|
121 | + return get_option( 'siteurl' ); |
|
122 | + } |
|
119 | 123 | |
120 | - if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) ) |
|
121 | - $value = untrailingslashit( $value ); |
|
124 | + if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) ) { |
|
125 | + $value = untrailingslashit( $value ); |
|
126 | + } |
|
122 | 127 | |
123 | 128 | /** |
124 | 129 | * Filters the value of an existing option. |
@@ -147,9 +152,10 @@ discard block |
||
147 | 152 | * @param string $option Option name. |
148 | 153 | */ |
149 | 154 | function wp_protect_special_option( $option ) { |
150 | - if ( 'alloptions' === $option || 'notoptions' === $option ) |
|
151 | - wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) ); |
|
152 | -} |
|
155 | + if ( 'alloptions' === $option || 'notoptions' === $option ) { |
|
156 | + wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) ); |
|
157 | + } |
|
158 | + } |
|
153 | 159 | |
154 | 160 | /** |
155 | 161 | * Print option value after sanitizing for forms. |
@@ -174,22 +180,25 @@ discard block |
||
174 | 180 | function wp_load_alloptions() { |
175 | 181 | global $wpdb; |
176 | 182 | |
177 | - if ( ! wp_installing() || ! is_multisite() ) |
|
178 | - $alloptions = wp_cache_get( 'alloptions', 'options' ); |
|
179 | - else |
|
180 | - $alloptions = false; |
|
183 | + if ( ! wp_installing() || ! is_multisite() ) { |
|
184 | + $alloptions = wp_cache_get( 'alloptions', 'options' ); |
|
185 | + } else { |
|
186 | + $alloptions = false; |
|
187 | + } |
|
181 | 188 | |
182 | 189 | if ( !$alloptions ) { |
183 | 190 | $suppress = $wpdb->suppress_errors(); |
184 | - if ( !$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) ) |
|
185 | - $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); |
|
191 | + if ( !$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) ) { |
|
192 | + $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); |
|
193 | + } |
|
186 | 194 | $wpdb->suppress_errors($suppress); |
187 | 195 | $alloptions = array(); |
188 | 196 | foreach ( (array) $alloptions_db as $o ) { |
189 | 197 | $alloptions[$o->option_name] = $o->option_value; |
190 | 198 | } |
191 | - if ( ! wp_installing() || ! is_multisite() ) |
|
192 | - wp_cache_add( 'alloptions', $alloptions, 'options' ); |
|
199 | + if ( ! wp_installing() || ! is_multisite() ) { |
|
200 | + wp_cache_add( 'alloptions', $alloptions, 'options' ); |
|
201 | + } |
|
193 | 202 | } |
194 | 203 | |
195 | 204 | return $alloptions; |
@@ -207,11 +216,13 @@ discard block |
||
207 | 216 | function wp_load_core_site_options( $site_id = null ) { |
208 | 217 | global $wpdb; |
209 | 218 | |
210 | - if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() ) |
|
211 | - return; |
|
219 | + if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() ) { |
|
220 | + return; |
|
221 | + } |
|
212 | 222 | |
213 | - if ( empty($site_id) ) |
|
214 | - $site_id = $wpdb->siteid; |
|
223 | + if ( empty($site_id) ) { |
|
224 | + $site_id = $wpdb->siteid; |
|
225 | + } |
|
215 | 226 | |
216 | 227 | $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' ); |
217 | 228 | |
@@ -254,13 +265,15 @@ discard block |
||
254 | 265 | global $wpdb; |
255 | 266 | |
256 | 267 | $option = trim($option); |
257 | - if ( empty($option) ) |
|
258 | - return false; |
|
268 | + if ( empty($option) ) { |
|
269 | + return false; |
|
270 | + } |
|
259 | 271 | |
260 | 272 | wp_protect_special_option( $option ); |
261 | 273 | |
262 | - if ( is_object( $value ) ) |
|
263 | - $value = clone $value; |
|
274 | + if ( is_object( $value ) ) { |
|
275 | + $value = clone $value; |
|
276 | + } |
|
264 | 277 | |
265 | 278 | $value = sanitize_option( $option, $value ); |
266 | 279 | $old_value = get_option( $option ); |
@@ -291,8 +304,9 @@ discard block |
||
291 | 304 | $value = apply_filters( 'pre_update_option', $value, $option, $old_value ); |
292 | 305 | |
293 | 306 | // If the new and old values are the same, no need to update. |
294 | - if ( $value === $old_value ) |
|
295 | - return false; |
|
307 | + if ( $value === $old_value ) { |
|
308 | + return false; |
|
309 | + } |
|
296 | 310 | |
297 | 311 | /** This filter is documented in wp-includes/option.php */ |
298 | 312 | if ( apply_filters( 'default_option_' . $option, false, $option ) === $old_value ) { |
@@ -326,8 +340,9 @@ discard block |
||
326 | 340 | } |
327 | 341 | |
328 | 342 | $result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => $option ) ); |
329 | - if ( ! $result ) |
|
330 | - return false; |
|
343 | + if ( ! $result ) { |
|
344 | + return false; |
|
345 | + } |
|
331 | 346 | |
332 | 347 | $notoptions = wp_cache_get( 'notoptions', 'options' ); |
333 | 348 | if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) { |
@@ -398,26 +413,30 @@ discard block |
||
398 | 413 | function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) { |
399 | 414 | global $wpdb; |
400 | 415 | |
401 | - if ( !empty( $deprecated ) ) |
|
402 | - _deprecated_argument( __FUNCTION__, '2.3.0' ); |
|
416 | + if ( !empty( $deprecated ) ) { |
|
417 | + _deprecated_argument( __FUNCTION__, '2.3.0' ); |
|
418 | + } |
|
403 | 419 | |
404 | 420 | $option = trim($option); |
405 | - if ( empty($option) ) |
|
406 | - return false; |
|
421 | + if ( empty($option) ) { |
|
422 | + return false; |
|
423 | + } |
|
407 | 424 | |
408 | 425 | wp_protect_special_option( $option ); |
409 | 426 | |
410 | - if ( is_object($value) ) |
|
411 | - $value = clone $value; |
|
427 | + if ( is_object($value) ) { |
|
428 | + $value = clone $value; |
|
429 | + } |
|
412 | 430 | |
413 | 431 | $value = sanitize_option( $option, $value ); |
414 | 432 | |
415 | 433 | // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query |
416 | 434 | $notoptions = wp_cache_get( 'notoptions', 'options' ); |
417 | - if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) ) |
|
418 | - /** This filter is documented in wp-includes/option.php */ |
|
435 | + if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) ) { |
|
436 | + /** This filter is documented in wp-includes/option.php */ |
|
419 | 437 | if ( apply_filters( 'default_option_' . $option, false, $option ) !== get_option( $option ) ) |
420 | 438 | return false; |
439 | + } |
|
421 | 440 | |
422 | 441 | $serialized_value = maybe_serialize( $value ); |
423 | 442 | $autoload = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes'; |
@@ -433,8 +452,9 @@ discard block |
||
433 | 452 | do_action( 'add_option', $option, $value ); |
434 | 453 | |
435 | 454 | $result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload ) ); |
436 | - if ( ! $result ) |
|
437 | - return false; |
|
455 | + if ( ! $result ) { |
|
456 | + return false; |
|
457 | + } |
|
438 | 458 | |
439 | 459 | if ( ! wp_installing() ) { |
440 | 460 | if ( 'yes' == $autoload ) { |
@@ -492,15 +512,17 @@ discard block |
||
492 | 512 | global $wpdb; |
493 | 513 | |
494 | 514 | $option = trim( $option ); |
495 | - if ( empty( $option ) ) |
|
496 | - return false; |
|
515 | + if ( empty( $option ) ) { |
|
516 | + return false; |
|
517 | + } |
|
497 | 518 | |
498 | 519 | wp_protect_special_option( $option ); |
499 | 520 | |
500 | 521 | // Get the ID, if no ID then return |
501 | 522 | $row = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option ) ); |
502 | - if ( is_null( $row ) ) |
|
503 | - return false; |
|
523 | + if ( is_null( $row ) ) { |
|
524 | + return false; |
|
525 | + } |
|
504 | 526 | |
505 | 527 | /** |
506 | 528 | * Fires immediately before an option is deleted. |
@@ -576,8 +598,9 @@ discard block |
||
576 | 598 | $option_timeout = '_transient_timeout_' . $transient; |
577 | 599 | $option = '_transient_' . $transient; |
578 | 600 | $result = delete_option( $option ); |
579 | - if ( $result ) |
|
580 | - delete_option( $option_timeout ); |
|
601 | + if ( $result ) { |
|
602 | + delete_option( $option_timeout ); |
|
603 | + } |
|
581 | 604 | } |
582 | 605 | |
583 | 606 | if ( $result ) { |
@@ -625,8 +648,9 @@ discard block |
||
625 | 648 | * @param string $transient Transient name. |
626 | 649 | */ |
627 | 650 | $pre = apply_filters( 'pre_transient_' . $transient, false, $transient ); |
628 | - if ( false !== $pre ) |
|
629 | - return $pre; |
|
651 | + if ( false !== $pre ) { |
|
652 | + return $pre; |
|
653 | + } |
|
630 | 654 | |
631 | 655 | if ( wp_using_ext_object_cache() ) { |
632 | 656 | $value = wp_cache_get( $transient, 'transient' ); |
@@ -646,8 +670,9 @@ discard block |
||
646 | 670 | } |
647 | 671 | } |
648 | 672 | |
649 | - if ( ! isset( $value ) ) |
|
650 | - $value = get_option( $transient_option ); |
|
673 | + if ( ! isset( $value ) ) { |
|
674 | + $value = get_option( $transient_option ); |
|
675 | + } |
|
651 | 676 | } |
652 | 677 | |
653 | 678 | /** |
@@ -804,8 +829,9 @@ discard block |
||
804 | 829 | $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user_id] ); |
805 | 830 | |
806 | 831 | // No change or both empty |
807 | - if ( $cookie == $settings ) |
|
808 | - return; |
|
832 | + if ( $cookie == $settings ) { |
|
833 | + return; |
|
834 | + } |
|
809 | 835 | |
810 | 836 | $last_saved = (int) get_user_option( 'user-settings-time', $user_id ); |
811 | 837 | $current = isset( $_COOKIE['wp-settings-time-' . $user_id]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user_id] ) : 0; |
@@ -1508,8 +1534,9 @@ discard block |
||
1508 | 1534 | $option_timeout = '_site_transient_timeout_' . $transient; |
1509 | 1535 | $option = '_site_transient_' . $transient; |
1510 | 1536 | $result = delete_site_option( $option ); |
1511 | - if ( $result ) |
|
1512 | - delete_site_option( $option_timeout ); |
|
1537 | + if ( $result ) { |
|
1538 | + delete_site_option( $option_timeout ); |
|
1539 | + } |
|
1513 | 1540 | } |
1514 | 1541 | if ( $result ) { |
1515 | 1542 | |
@@ -1559,8 +1586,9 @@ discard block |
||
1559 | 1586 | */ |
1560 | 1587 | $pre = apply_filters( 'pre_site_transient_' . $transient, false, $transient ); |
1561 | 1588 | |
1562 | - if ( false !== $pre ) |
|
1563 | - return $pre; |
|
1589 | + if ( false !== $pre ) { |
|
1590 | + return $pre; |
|
1591 | + } |
|
1564 | 1592 | |
1565 | 1593 | if ( wp_using_ext_object_cache() ) { |
1566 | 1594 | $value = wp_cache_get( $transient, 'site-transient' ); |
@@ -1578,8 +1606,9 @@ discard block |
||
1578 | 1606 | } |
1579 | 1607 | } |
1580 | 1608 | |
1581 | - if ( ! isset( $value ) ) |
|
1582 | - $value = get_site_option( $transient_option ); |
|
1609 | + if ( ! isset( $value ) ) { |
|
1610 | + $value = get_site_option( $transient_option ); |
|
1611 | + } |
|
1583 | 1612 | } |
1584 | 1613 | |
1585 | 1614 | /** |
@@ -1648,12 +1677,14 @@ discard block |
||
1648 | 1677 | $transient_timeout = '_site_transient_timeout_' . $transient; |
1649 | 1678 | $option = '_site_transient_' . $transient; |
1650 | 1679 | if ( false === get_site_option( $option ) ) { |
1651 | - if ( $expiration ) |
|
1652 | - add_site_option( $transient_timeout, time() + $expiration ); |
|
1680 | + if ( $expiration ) { |
|
1681 | + add_site_option( $transient_timeout, time() + $expiration ); |
|
1682 | + } |
|
1653 | 1683 | $result = add_site_option( $option, $value ); |
1654 | 1684 | } else { |
1655 | - if ( $expiration ) |
|
1656 | - update_site_option( $transient_timeout, time() + $expiration ); |
|
1685 | + if ( $expiration ) { |
|
1686 | + update_site_option( $transient_timeout, time() + $expiration ); |
|
1687 | + } |
|
1657 | 1688 | $result = update_site_option( $option, $value ); |
1658 | 1689 | } |
1659 | 1690 | } |