@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * User profile network administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Multisite |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * User profile network administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Multisite |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -8,9 +8,9 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -require( ABSPATH . 'wp-admin/profile.php' ); |
|
16 | +require(ABSPATH.'wp-admin/profile.php'); |
@@ -10,7 +10,8 @@ |
||
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
13 | +if ( ! is_multisite() ) { |
|
14 | 14 | wp_die( __( 'Multisite support is not enabled.' ) ); |
15 | +} |
|
15 | 16 | |
16 | 17 | require( ABSPATH . 'wp-admin/profile.php' ); |
@@ -8,9 +8,9 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -require( ABSPATH . 'wp-admin/update-core.php' ); |
|
16 | +require(ABSPATH.'wp-admin/update-core.php'); |
@@ -10,7 +10,8 @@ |
||
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
13 | +if ( ! is_multisite() ) { |
|
14 | 14 | wp_die( __( 'Multisite support is not enabled.' ) ); |
15 | +} |
|
15 | 16 | |
16 | 17 | require( ABSPATH . 'wp-admin/update-core.php' ); |
@@ -8,9 +8,9 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -require( ABSPATH . 'wp-admin/plugins.php' ); |
|
16 | +require(ABSPATH.'wp-admin/plugins.php'); |
@@ -10,7 +10,8 @@ |
||
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
13 | +if ( ! is_multisite() ) { |
|
14 | 14 | wp_die( __( 'Multisite support is not enabled.' ) ); |
15 | +} |
|
15 | 16 | |
16 | 17 | require( ABSPATH . 'wp-admin/plugins.php' ); |
@@ -8,9 +8,9 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -require( ABSPATH . 'wp-admin/freedoms.php' ); |
|
16 | +require(ABSPATH.'wp-admin/freedoms.php'); |
@@ -10,7 +10,8 @@ |
||
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
13 | +if ( ! is_multisite() ) { |
|
14 | 14 | wp_die( __( 'Multisite support is not enabled.' ) ); |
15 | +} |
|
15 | 16 | |
16 | 17 | require( ABSPATH . 'wp-admin/freedoms.php' ); |
@@ -8,9 +8,9 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -require( ABSPATH . 'wp-admin/about.php' ); |
|
16 | +require(ABSPATH.'wp-admin/about.php'); |
@@ -10,7 +10,8 @@ |
||
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
13 | +if ( ! is_multisite() ) { |
|
14 | 14 | wp_die( __( 'Multisite support is not enabled.' ) ); |
15 | +} |
|
15 | 16 | |
16 | 17 | require( ABSPATH . 'wp-admin/about.php' ); |
@@ -7,9 +7,9 @@ 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 | -$title = __( 'Credits' ); |
|
12 | +$title = __('Credits'); |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Retrieve the contributor credits. |
@@ -24,23 +24,23 @@ discard block |
||
24 | 24 | global $wp_version; |
25 | 25 | $locale = get_locale(); |
26 | 26 | |
27 | - $results = get_site_transient( 'wordpress_credits_' . $locale ); |
|
27 | + $results = get_site_transient('wordpress_credits_'.$locale); |
|
28 | 28 | |
29 | - if ( ! is_array( $results ) |
|
30 | - || false !== strpos( $wp_version, '-' ) |
|
31 | - || ( isset( $results['data']['version'] ) && strpos( $wp_version, $results['data']['version'] ) !== 0 ) |
|
29 | + if ( ! is_array($results) |
|
30 | + || false !== strpos($wp_version, '-') |
|
31 | + || (isset($results['data']['version']) && strpos($wp_version, $results['data']['version']) !== 0) |
|
32 | 32 | ) { |
33 | - $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.1/?version=$wp_version&locale=$locale" ); |
|
33 | + $response = wp_remote_get("http://api.wordpress.org/core/credits/1.1/?version=$wp_version&locale=$locale"); |
|
34 | 34 | |
35 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) |
|
35 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) |
|
36 | 36 | return false; |
37 | 37 | |
38 | - $results = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
38 | + $results = json_decode(wp_remote_retrieve_body($response), true); |
|
39 | 39 | |
40 | - if ( ! is_array( $results ) ) |
|
40 | + if ( ! is_array($results)) |
|
41 | 41 | return false; |
42 | 42 | |
43 | - set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS ); |
|
43 | + set_site_transient('wordpress_credits_'.$locale, $results, DAY_IN_SECONDS); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return $results; |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param string $username The contributor's username. |
57 | 57 | * @param string $profiles URL to the contributor's WordPress.org profile page. |
58 | 58 | */ |
59 | -function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) { |
|
60 | - $display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>'; |
|
59 | +function _wp_credits_add_profile_link(&$display_name, $username, $profiles) { |
|
60 | + $display_name = '<a href="'.esc_url(sprintf($profiles, $username)).'">'.esc_html($display_name).'</a>'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -68,29 +68,29 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param string &$data External library data, passed by reference. |
70 | 70 | */ |
71 | -function _wp_credits_build_object_link( &$data ) { |
|
72 | - $data = '<a href="' . esc_url( $data[1] ) . '">' . esc_html( $data[0] ) . '</a>'; |
|
71 | +function _wp_credits_build_object_link(&$data) { |
|
72 | + $data = '<a href="'.esc_url($data[1]).'">'.esc_html($data[0]).'</a>'; |
|
73 | 73 | } |
74 | 74 | |
75 | -list( $display_version ) = explode( '-', $wp_version ); |
|
75 | +list($display_version) = explode('-', $wp_version); |
|
76 | 76 | |
77 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
77 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
78 | 78 | ?> |
79 | 79 | <div class="wrap about-wrap"> |
80 | 80 | |
81 | -<h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1> |
|
81 | +<h1><?php printf(__('Welcome to WordPress %s'), $display_version); ?></h1> |
|
82 | 82 | |
83 | -<div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s makes it even easier to format your content and customize your site.' ), $display_version ); ?></div> |
|
83 | +<div class="about-text"><?php printf(__('Thank you for updating! WordPress %s makes it even easier to format your content and customize your site.'), $display_version); ?></div> |
|
84 | 84 | |
85 | -<div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div> |
|
85 | +<div class="wp-badge"><?php printf(__('Version %s'), $display_version); ?></div> |
|
86 | 86 | |
87 | 87 | <h2 class="nav-tab-wrapper"> |
88 | 88 | <a href="about.php" class="nav-tab"> |
89 | - <?php _e( 'What’s New' ); ?> |
|
89 | + <?php _e('What’s New'); ?> |
|
90 | 90 | </a><a href="credits.php" class="nav-tab nav-tab-active"> |
91 | - <?php _e( 'Credits' ); ?> |
|
91 | + <?php _e('Credits'); ?> |
|
92 | 92 | </a><a href="freedoms.php" class="nav-tab"> |
93 | - <?php _e( 'Freedoms' ); ?> |
|
93 | + <?php _e('Freedoms'); ?> |
|
94 | 94 | </a> |
95 | 95 | </h2> |
96 | 96 | |
@@ -98,58 +98,58 @@ discard block |
||
98 | 98 | |
99 | 99 | $credits = wp_credits(); |
100 | 100 | |
101 | -if ( ! $credits ) { |
|
102 | - echo '<p class="about-description">' . sprintf( __( 'WordPress is created by a <a href="%1$s">worldwide team</a> of passionate individuals. <a href="%2$s">Get involved in WordPress</a>.' ), |
|
101 | +if ( ! $credits) { |
|
102 | + echo '<p class="about-description">'.sprintf(__('WordPress is created by a <a href="%1$s">worldwide team</a> of passionate individuals. <a href="%2$s">Get involved in WordPress</a>.'), |
|
103 | 103 | 'https://wordpress.org/about/', |
104 | 104 | /* translators: Url to the codex documentation on contributing to WordPress used on the credits page */ |
105 | - __( 'https://codex.wordpress.org/Contributing_to_WordPress' ) ) . '</p>'; |
|
106 | - include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
105 | + __('https://codex.wordpress.org/Contributing_to_WordPress')).'</p>'; |
|
106 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
107 | 107 | exit; |
108 | 108 | } |
109 | 109 | |
110 | -echo '<p class="about-description">' . __( 'WordPress is created by a worldwide team of passionate individuals.' ) . "</p>\n"; |
|
110 | +echo '<p class="about-description">'.__('WordPress is created by a worldwide team of passionate individuals.')."</p>\n"; |
|
111 | 111 | |
112 | -foreach ( $credits['groups'] as $group_slug => $group_data ) { |
|
113 | - if ( $group_data['name'] ) { |
|
114 | - if ( 'Translators' == $group_data['name'] ) { |
|
112 | +foreach ($credits['groups'] as $group_slug => $group_data) { |
|
113 | + if ($group_data['name']) { |
|
114 | + if ('Translators' == $group_data['name']) { |
|
115 | 115 | // Considered a special slug in the API response. (Also, will never be returned for en_US.) |
116 | - $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' ); |
|
117 | - } elseif ( isset( $group_data['placeholders'] ) ) { |
|
118 | - $title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] ); |
|
116 | + $title = _x('Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section'); |
|
117 | + } elseif (isset($group_data['placeholders'])) { |
|
118 | + $title = vsprintf(translate($group_data['name']), $group_data['placeholders']); |
|
119 | 119 | } else { |
120 | - $title = translate( $group_data['name'] ); |
|
120 | + $title = translate($group_data['name']); |
|
121 | 121 | } |
122 | 122 | |
123 | - echo '<h4 class="wp-people-group">' . esc_html( $title ) . "</h4>\n"; |
|
123 | + echo '<h4 class="wp-people-group">'.esc_html($title)."</h4>\n"; |
|
124 | 124 | } |
125 | 125 | |
126 | - if ( ! empty( $group_data['shuffle'] ) ) |
|
127 | - shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt. |
|
126 | + if ( ! empty($group_data['shuffle'])) |
|
127 | + shuffle($group_data['data']); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt. |
|
128 | 128 | |
129 | - switch ( $group_data['type'] ) { |
|
129 | + switch ($group_data['type']) { |
|
130 | 130 | case 'list' : |
131 | - array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits['data']['profiles'] ); |
|
132 | - echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n"; |
|
131 | + array_walk($group_data['data'], '_wp_credits_add_profile_link', $credits['data']['profiles']); |
|
132 | + echo '<p class="wp-credits-list">'.wp_sprintf('%l.', $group_data['data'])."</p>\n\n"; |
|
133 | 133 | break; |
134 | 134 | case 'libraries' : |
135 | - array_walk( $group_data['data'], '_wp_credits_build_object_link' ); |
|
136 | - echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n"; |
|
135 | + array_walk($group_data['data'], '_wp_credits_build_object_link'); |
|
136 | + echo '<p class="wp-credits-list">'.wp_sprintf('%l.', $group_data['data'])."</p>\n\n"; |
|
137 | 137 | break; |
138 | 138 | default: |
139 | 139 | $compact = 'compact' == $group_data['type']; |
140 | - $classes = 'wp-people-group ' . ( $compact ? 'compact' : '' ); |
|
141 | - echo '<ul class="' . $classes . '" id="wp-people-group-' . $group_slug . '">' . "\n"; |
|
142 | - foreach ( $group_data['data'] as $person_data ) { |
|
143 | - echo '<li class="wp-person" id="wp-person-' . esc_attr( $person_data[2] ) . '">' . "\n\t"; |
|
144 | - echo '<a href="' . esc_url( sprintf( $credits['data']['profiles'], $person_data[2] ) ) . '">'; |
|
140 | + $classes = 'wp-people-group '.($compact ? 'compact' : ''); |
|
141 | + echo '<ul class="'.$classes.'" id="wp-people-group-'.$group_slug.'">'."\n"; |
|
142 | + foreach ($group_data['data'] as $person_data) { |
|
143 | + echo '<li class="wp-person" id="wp-person-'.esc_attr($person_data[2]).'">'."\n\t"; |
|
144 | + echo '<a href="'.esc_url(sprintf($credits['data']['profiles'], $person_data[2])).'">'; |
|
145 | 145 | $size = 'compact' == $group_data['type'] ? 30 : 60; |
146 | - $data = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) ); |
|
146 | + $data = get_avatar_data($person_data[1].'@md5.gravatar.com', array('size' => $size)); |
|
147 | 147 | $size *= 2; |
148 | - $data2x = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) ); |
|
149 | - echo '<img src="' . esc_url( $data['url'] ) . '" srcset="' . esc_url( $data2x['url'] ) . ' 2x" class="gravatar" alt="' . esc_attr( $person_data[0] ) . '" /></a>' . "\n\t"; |
|
150 | - echo '<a class="web" href="' . esc_url( sprintf( $credits['data']['profiles'], $person_data[2] ) ) . '">' . esc_html( $person_data[0] ) . "</a>\n\t"; |
|
151 | - if ( ! $compact ) |
|
152 | - echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n"; |
|
148 | + $data2x = get_avatar_data($person_data[1].'@md5.gravatar.com', array('size' => $size)); |
|
149 | + echo '<img src="'.esc_url($data['url']).'" srcset="'.esc_url($data2x['url']).' 2x" class="gravatar" alt="'.esc_attr($person_data[0]).'" /></a>'."\n\t"; |
|
150 | + echo '<a class="web" href="'.esc_url(sprintf($credits['data']['profiles'], $person_data[2])).'">'.esc_html($person_data[0])."</a>\n\t"; |
|
151 | + if ( ! $compact) |
|
152 | + echo '<span class="title">'.translate($person_data[3])."</span>\n"; |
|
153 | 153 | echo "</li>\n"; |
154 | 154 | } |
155 | 155 | echo "</ul>\n"; |
@@ -158,34 +158,34 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | ?> |
161 | -<p class="clear"><?php printf( __( 'Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.' ), |
|
161 | +<p class="clear"><?php printf(__('Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.'), |
|
162 | 162 | /* translators: URL to the Make WordPress 'Get Involved' landing page used on the credits page */ |
163 | - __( 'https://make.wordpress.org/' ) ); ?></p> |
|
163 | + __('https://make.wordpress.org/')); ?></p> |
|
164 | 164 | |
165 | 165 | </div> |
166 | 166 | <?php |
167 | 167 | |
168 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
168 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
|
169 | 169 | |
170 | 170 | return; |
171 | 171 | |
172 | 172 | // These are strings returned by the API that we want to be translatable |
173 | -__( 'Project Leaders' ); |
|
174 | -__( 'Extended Core Team' ); |
|
175 | -__( 'Core Developers' ); |
|
176 | -__( 'Recent Rockstars' ); |
|
177 | -__( 'Core Contributors to WordPress %s' ); |
|
178 | -__( 'Contributing Developers' ); |
|
179 | -__( 'Cofounder, Project Lead' ); |
|
180 | -__( 'Lead Developer' ); |
|
181 | -__( 'Release Lead' ); |
|
182 | -__( 'User Experience Lead' ); |
|
183 | -__( 'Core Developer' ); |
|
184 | -__( 'Core Committer' ); |
|
185 | -__( 'Guest Committer' ); |
|
186 | -__( 'Developer' ); |
|
187 | -__( 'Designer' ); |
|
188 | -__( 'XML-RPC' ); |
|
189 | -__( 'Internationalization' ); |
|
190 | -__( 'External Libraries' ); |
|
191 | -__( 'Icon Design' ); |
|
173 | +__('Project Leaders'); |
|
174 | +__('Extended Core Team'); |
|
175 | +__('Core Developers'); |
|
176 | +__('Recent Rockstars'); |
|
177 | +__('Core Contributors to WordPress %s'); |
|
178 | +__('Contributing Developers'); |
|
179 | +__('Cofounder, Project Lead'); |
|
180 | +__('Lead Developer'); |
|
181 | +__('Release Lead'); |
|
182 | +__('User Experience Lead'); |
|
183 | +__('Core Developer'); |
|
184 | +__('Core Committer'); |
|
185 | +__('Guest Committer'); |
|
186 | +__('Developer'); |
|
187 | +__('Designer'); |
|
188 | +__('XML-RPC'); |
|
189 | +__('Internationalization'); |
|
190 | +__('External Libraries'); |
|
191 | +__('Icon Design'); |
@@ -32,13 +32,15 @@ discard block |
||
32 | 32 | ) { |
33 | 33 | $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.1/?version=$wp_version&locale=$locale" ); |
34 | 34 | |
35 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) |
|
36 | - return false; |
|
35 | + if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
36 | + return false; |
|
37 | + } |
|
37 | 38 | |
38 | 39 | $results = json_decode( wp_remote_retrieve_body( $response ), true ); |
39 | 40 | |
40 | - if ( ! is_array( $results ) ) |
|
41 | - return false; |
|
41 | + if ( ! is_array( $results ) ) { |
|
42 | + return false; |
|
43 | + } |
|
42 | 44 | |
43 | 45 | set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS ); |
44 | 46 | } |
@@ -123,8 +125,10 @@ discard block |
||
123 | 125 | echo '<h4 class="wp-people-group">' . esc_html( $title ) . "</h4>\n"; |
124 | 126 | } |
125 | 127 | |
126 | - if ( ! empty( $group_data['shuffle'] ) ) |
|
127 | - shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt. |
|
128 | + if ( ! empty( $group_data['shuffle'] ) ) { |
|
129 | + shuffle( $group_data['data'] ); |
|
130 | + } |
|
131 | + // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt. |
|
128 | 132 | |
129 | 133 | switch ( $group_data['type'] ) { |
130 | 134 | case 'list' : |
@@ -148,8 +152,9 @@ discard block |
||
148 | 152 | $data2x = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) ); |
149 | 153 | echo '<img src="' . esc_url( $data['url'] ) . '" srcset="' . esc_url( $data2x['url'] ) . ' 2x" class="gravatar" alt="' . esc_attr( $person_data[0] ) . '" /></a>' . "\n\t"; |
150 | 154 | echo '<a class="web" href="' . esc_url( sprintf( $credits['data']['profiles'], $person_data[2] ) ) . '">' . esc_html( $person_data[0] ) . "</a>\n\t"; |
151 | - if ( ! $compact ) |
|
152 | - echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n"; |
|
155 | + if ( ! $compact ) { |
|
156 | + echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n"; |
|
157 | + } |
|
153 | 158 | echo "</li>\n"; |
154 | 159 | } |
155 | 160 | echo "</ul>\n"; |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | if ( current_user_can($tax->cap->edit_terms) ) { |
403 | 403 | if ( 'category' == $taxonomy ) { |
404 | 404 | /** |
405 | - * Fires before the Add Category form. |
|
405 | + * Fires before the Add Category form. |
|
406 | 406 | * |
407 | 407 | * @since 2.1.0 |
408 | 408 | * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead. |
@@ -449,12 +449,12 @@ discard block |
||
449 | 449 | <form id="addtag" method="post" action="edit-tags.php" class="validate" |
450 | 450 | <?php |
451 | 451 | /** |
452 | - * Fires at the beginning of the Add Tag form. |
|
453 | - * |
|
454 | - * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
|
455 | - * |
|
456 | - * @since 3.7.0 |
|
457 | - */ |
|
452 | + * Fires at the beginning of the Add Tag form. |
|
453 | + * |
|
454 | + * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
|
455 | + * |
|
456 | + * @since 3.7.0 |
|
457 | + */ |
|
458 | 458 | do_action( "{$taxonomy}_term_new_form_tag" ); |
459 | 459 | ?>> |
460 | 460 | <input type="hidden" name="action" value="add-tag" /> |
@@ -49,119 +49,119 @@ |
||
49 | 49 | |
50 | 50 | switch ( $wp_list_table->current_action() ) { |
51 | 51 | |
52 | -case 'add-tag': |
|
52 | + case 'add-tag': |
|
53 | 53 | |
54 | - check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); |
|
54 | + check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); |
|
55 | 55 | |
56 | - if ( !current_user_can( $tax->cap->edit_terms ) ) |
|
57 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
56 | + if ( !current_user_can( $tax->cap->edit_terms ) ) |
|
57 | + wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
58 | 58 | |
59 | - $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); |
|
60 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
61 | - if ( 'post' != $post_type ) |
|
62 | - $location .= '&post_type=' . $post_type; |
|
59 | + $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); |
|
60 | + $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
61 | + if ( 'post' != $post_type ) |
|
62 | + $location .= '&post_type=' . $post_type; |
|
63 | 63 | |
64 | - if ( $referer = wp_get_original_referer() ) { |
|
65 | - if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
66 | - $location = $referer; |
|
67 | - } |
|
64 | + if ( $referer = wp_get_original_referer() ) { |
|
65 | + if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
66 | + $location = $referer; |
|
67 | + } |
|
68 | 68 | |
69 | - if ( $ret && !is_wp_error( $ret ) ) |
|
70 | - $location = add_query_arg( 'message', 1, $location ); |
|
71 | - else |
|
72 | - $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $location ); |
|
69 | + if ( $ret && !is_wp_error( $ret ) ) |
|
70 | + $location = add_query_arg( 'message', 1, $location ); |
|
71 | + else |
|
72 | + $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $location ); |
|
73 | 73 | |
74 | - break; |
|
74 | + break; |
|
75 | 75 | |
76 | -case 'delete': |
|
77 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
78 | - if ( 'post' != $post_type ) |
|
79 | - $location .= '&post_type=' . $post_type; |
|
80 | - if ( $referer = wp_get_referer() ) { |
|
81 | - if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
82 | - $location = $referer; |
|
83 | - } |
|
76 | + case 'delete': |
|
77 | + $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
78 | + if ( 'post' != $post_type ) |
|
79 | + $location .= '&post_type=' . $post_type; |
|
80 | + if ( $referer = wp_get_referer() ) { |
|
81 | + if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
82 | + $location = $referer; |
|
83 | + } |
|
84 | 84 | |
85 | - if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
86 | - break; |
|
87 | - } |
|
85 | + if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
86 | + break; |
|
87 | + } |
|
88 | 88 | |
89 | - $tag_ID = (int) $_REQUEST['tag_ID']; |
|
90 | - check_admin_referer( 'delete-tag_' . $tag_ID ); |
|
89 | + $tag_ID = (int) $_REQUEST['tag_ID']; |
|
90 | + check_admin_referer( 'delete-tag_' . $tag_ID ); |
|
91 | 91 | |
92 | - if ( !current_user_can( $tax->cap->delete_terms ) ) |
|
93 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
92 | + if ( !current_user_can( $tax->cap->delete_terms ) ) |
|
93 | + wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
94 | 94 | |
95 | - wp_delete_term( $tag_ID, $taxonomy ); |
|
95 | + wp_delete_term( $tag_ID, $taxonomy ); |
|
96 | 96 | |
97 | - $location = add_query_arg( 'message', 2, $location ); |
|
97 | + $location = add_query_arg( 'message', 2, $location ); |
|
98 | 98 | |
99 | - break; |
|
99 | + break; |
|
100 | 100 | |
101 | -case 'bulk-delete': |
|
102 | - check_admin_referer( 'bulk-tags' ); |
|
101 | + case 'bulk-delete': |
|
102 | + check_admin_referer( 'bulk-tags' ); |
|
103 | 103 | |
104 | - if ( !current_user_can( $tax->cap->delete_terms ) ) |
|
105 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
104 | + if ( !current_user_can( $tax->cap->delete_terms ) ) |
|
105 | + wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
106 | 106 | |
107 | - $tags = (array) $_REQUEST['delete_tags']; |
|
108 | - foreach ( $tags as $tag_ID ) { |
|
109 | - wp_delete_term( $tag_ID, $taxonomy ); |
|
110 | - } |
|
107 | + $tags = (array) $_REQUEST['delete_tags']; |
|
108 | + foreach ( $tags as $tag_ID ) { |
|
109 | + wp_delete_term( $tag_ID, $taxonomy ); |
|
110 | + } |
|
111 | 111 | |
112 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
113 | - if ( 'post' != $post_type ) |
|
114 | - $location .= '&post_type=' . $post_type; |
|
115 | - if ( $referer = wp_get_referer() ) { |
|
116 | - if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
117 | - $location = $referer; |
|
118 | - } |
|
112 | + $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
113 | + if ( 'post' != $post_type ) |
|
114 | + $location .= '&post_type=' . $post_type; |
|
115 | + if ( $referer = wp_get_referer() ) { |
|
116 | + if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
117 | + $location = $referer; |
|
118 | + } |
|
119 | 119 | |
120 | - $location = add_query_arg( 'message', 6, $location ); |
|
120 | + $location = add_query_arg( 'message', 6, $location ); |
|
121 | 121 | |
122 | - break; |
|
122 | + break; |
|
123 | 123 | |
124 | -case 'edit': |
|
125 | - $title = $tax->labels->edit_item; |
|
124 | + case 'edit': |
|
125 | + $title = $tax->labels->edit_item; |
|
126 | 126 | |
127 | - $tag_ID = (int) $_REQUEST['tag_ID']; |
|
127 | + $tag_ID = (int) $_REQUEST['tag_ID']; |
|
128 | 128 | |
129 | - $tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' ); |
|
130 | - if ( ! $tag ) |
|
131 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
132 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
133 | - include( ABSPATH . 'wp-admin/edit-tag-form.php' ); |
|
134 | - include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
129 | + $tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' ); |
|
130 | + if ( ! $tag ) |
|
131 | + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
132 | + require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
133 | + include( ABSPATH . 'wp-admin/edit-tag-form.php' ); |
|
134 | + include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
135 | 135 | |
136 | - exit; |
|
136 | + exit; |
|
137 | 137 | |
138 | -case 'editedtag': |
|
139 | - $tag_ID = (int) $_POST['tag_ID']; |
|
140 | - check_admin_referer( 'update-tag_' . $tag_ID ); |
|
138 | + case 'editedtag': |
|
139 | + $tag_ID = (int) $_POST['tag_ID']; |
|
140 | + check_admin_referer( 'update-tag_' . $tag_ID ); |
|
141 | 141 | |
142 | - if ( !current_user_can( $tax->cap->edit_terms ) ) |
|
143 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
142 | + if ( !current_user_can( $tax->cap->edit_terms ) ) |
|
143 | + wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
144 | 144 | |
145 | - $tag = get_term( $tag_ID, $taxonomy ); |
|
146 | - if ( ! $tag ) |
|
147 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
145 | + $tag = get_term( $tag_ID, $taxonomy ); |
|
146 | + if ( ! $tag ) |
|
147 | + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
148 | 148 | |
149 | - $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); |
|
149 | + $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); |
|
150 | 150 | |
151 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
152 | - if ( 'post' != $post_type ) |
|
153 | - $location .= '&post_type=' . $post_type; |
|
151 | + $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
152 | + if ( 'post' != $post_type ) |
|
153 | + $location .= '&post_type=' . $post_type; |
|
154 | 154 | |
155 | - if ( $referer = wp_get_original_referer() ) { |
|
156 | - if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
157 | - $location = $referer; |
|
158 | - } |
|
155 | + if ( $referer = wp_get_original_referer() ) { |
|
156 | + if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
157 | + $location = $referer; |
|
158 | + } |
|
159 | 159 | |
160 | - if ( $ret && !is_wp_error( $ret ) ) |
|
161 | - $location = add_query_arg( 'message', 3, $location ); |
|
162 | - else |
|
163 | - $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location ); |
|
164 | - break; |
|
160 | + if ( $ret && !is_wp_error( $ret ) ) |
|
161 | + $location = add_query_arg( 'message', 3, $location ); |
|
162 | + else |
|
163 | + $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location ); |
|
164 | + break; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
@@ -7,18 +7,18 @@ 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 ( ! $taxnow ) |
|
13 | - wp_die( __( 'Invalid taxonomy' ) ); |
|
12 | +if ( ! $taxnow) |
|
13 | + wp_die(__('Invalid taxonomy')); |
|
14 | 14 | |
15 | -$tax = get_taxonomy( $taxnow ); |
|
15 | +$tax = get_taxonomy($taxnow); |
|
16 | 16 | |
17 | -if ( ! $tax ) |
|
18 | - wp_die( __( 'Invalid taxonomy' ) ); |
|
17 | +if ( ! $tax) |
|
18 | + wp_die(__('Invalid taxonomy')); |
|
19 | 19 | |
20 | -if ( ! current_user_can( $tax->cap->manage_terms ) ) |
|
21 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
20 | +if ( ! current_user_can($tax->cap->manage_terms)) |
|
21 | + wp_die(__('Cheatin’ uh?'), 403); |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * $post_type is set when the WP_Terms_List_Table instance is created |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | |
33 | 33 | $title = $tax->labels->name; |
34 | 34 | |
35 | -if ( 'post' != $post_type ) { |
|
36 | - $parent_file = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type"; |
|
35 | +if ('post' != $post_type) { |
|
36 | + $parent_file = ('attachment' == $post_type) ? 'upload.php' : "edit.php?post_type=$post_type"; |
|
37 | 37 | $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; |
38 | -} elseif ( 'link_category' == $tax->name ) { |
|
38 | +} elseif ('link_category' == $tax->name) { |
|
39 | 39 | $parent_file = 'link-manager.php'; |
40 | 40 | $submenu_file = 'edit-tags.php?taxonomy=link_category'; |
41 | 41 | } else { |
@@ -43,81 +43,81 @@ discard block |
||
43 | 43 | $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; |
44 | 44 | } |
45 | 45 | |
46 | -add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page' ) ); |
|
46 | +add_screen_option('per_page', array('default' => 20, 'option' => 'edit_'.$tax->name.'_per_page')); |
|
47 | 47 | |
48 | 48 | $location = false; |
49 | 49 | |
50 | -switch ( $wp_list_table->current_action() ) { |
|
50 | +switch ($wp_list_table->current_action()) { |
|
51 | 51 | |
52 | 52 | case 'add-tag': |
53 | 53 | |
54 | - check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); |
|
54 | + check_admin_referer('add-tag', '_wpnonce_add-tag'); |
|
55 | 55 | |
56 | - if ( !current_user_can( $tax->cap->edit_terms ) ) |
|
57 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
56 | + if ( ! current_user_can($tax->cap->edit_terms)) |
|
57 | + wp_die(__('Cheatin’ uh?'), 403); |
|
58 | 58 | |
59 | - $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); |
|
60 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
61 | - if ( 'post' != $post_type ) |
|
62 | - $location .= '&post_type=' . $post_type; |
|
59 | + $ret = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST); |
|
60 | + $location = 'edit-tags.php?taxonomy='.$taxonomy; |
|
61 | + if ('post' != $post_type) |
|
62 | + $location .= '&post_type='.$post_type; |
|
63 | 63 | |
64 | - if ( $referer = wp_get_original_referer() ) { |
|
65 | - if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
64 | + if ($referer = wp_get_original_referer()) { |
|
65 | + if (false !== strpos($referer, 'edit-tags.php')) |
|
66 | 66 | $location = $referer; |
67 | 67 | } |
68 | 68 | |
69 | - if ( $ret && !is_wp_error( $ret ) ) |
|
70 | - $location = add_query_arg( 'message', 1, $location ); |
|
69 | + if ($ret && ! is_wp_error($ret)) |
|
70 | + $location = add_query_arg('message', 1, $location); |
|
71 | 71 | else |
72 | - $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $location ); |
|
72 | + $location = add_query_arg(array('error' => true, 'message' => 4), $location); |
|
73 | 73 | |
74 | 74 | break; |
75 | 75 | |
76 | 76 | case 'delete': |
77 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
78 | - if ( 'post' != $post_type ) |
|
79 | - $location .= '&post_type=' . $post_type; |
|
80 | - if ( $referer = wp_get_referer() ) { |
|
81 | - if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
77 | + $location = 'edit-tags.php?taxonomy='.$taxonomy; |
|
78 | + if ('post' != $post_type) |
|
79 | + $location .= '&post_type='.$post_type; |
|
80 | + if ($referer = wp_get_referer()) { |
|
81 | + if (false !== strpos($referer, 'edit-tags.php')) |
|
82 | 82 | $location = $referer; |
83 | 83 | } |
84 | 84 | |
85 | - if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
85 | + if ( ! isset($_REQUEST['tag_ID'])) { |
|
86 | 86 | break; |
87 | 87 | } |
88 | 88 | |
89 | 89 | $tag_ID = (int) $_REQUEST['tag_ID']; |
90 | - check_admin_referer( 'delete-tag_' . $tag_ID ); |
|
90 | + check_admin_referer('delete-tag_'.$tag_ID); |
|
91 | 91 | |
92 | - if ( !current_user_can( $tax->cap->delete_terms ) ) |
|
93 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
92 | + if ( ! current_user_can($tax->cap->delete_terms)) |
|
93 | + wp_die(__('Cheatin’ uh?'), 403); |
|
94 | 94 | |
95 | - wp_delete_term( $tag_ID, $taxonomy ); |
|
95 | + wp_delete_term($tag_ID, $taxonomy); |
|
96 | 96 | |
97 | - $location = add_query_arg( 'message', 2, $location ); |
|
97 | + $location = add_query_arg('message', 2, $location); |
|
98 | 98 | |
99 | 99 | break; |
100 | 100 | |
101 | 101 | case 'bulk-delete': |
102 | - check_admin_referer( 'bulk-tags' ); |
|
102 | + check_admin_referer('bulk-tags'); |
|
103 | 103 | |
104 | - if ( !current_user_can( $tax->cap->delete_terms ) ) |
|
105 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
104 | + if ( ! current_user_can($tax->cap->delete_terms)) |
|
105 | + wp_die(__('Cheatin’ uh?'), 403); |
|
106 | 106 | |
107 | 107 | $tags = (array) $_REQUEST['delete_tags']; |
108 | - foreach ( $tags as $tag_ID ) { |
|
109 | - wp_delete_term( $tag_ID, $taxonomy ); |
|
108 | + foreach ($tags as $tag_ID) { |
|
109 | + wp_delete_term($tag_ID, $taxonomy); |
|
110 | 110 | } |
111 | 111 | |
112 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
113 | - if ( 'post' != $post_type ) |
|
114 | - $location .= '&post_type=' . $post_type; |
|
115 | - if ( $referer = wp_get_referer() ) { |
|
116 | - if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
112 | + $location = 'edit-tags.php?taxonomy='.$taxonomy; |
|
113 | + if ('post' != $post_type) |
|
114 | + $location .= '&post_type='.$post_type; |
|
115 | + if ($referer = wp_get_referer()) { |
|
116 | + if (false !== strpos($referer, 'edit-tags.php')) |
|
117 | 117 | $location = $referer; |
118 | 118 | } |
119 | 119 | |
120 | - $location = add_query_arg( 'message', 6, $location ); |
|
120 | + $location = add_query_arg('message', 6, $location); |
|
121 | 121 | |
122 | 122 | break; |
123 | 123 | |
@@ -126,162 +126,162 @@ discard block |
||
126 | 126 | |
127 | 127 | $tag_ID = (int) $_REQUEST['tag_ID']; |
128 | 128 | |
129 | - $tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' ); |
|
130 | - if ( ! $tag ) |
|
131 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
132 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
133 | - include( ABSPATH . 'wp-admin/edit-tag-form.php' ); |
|
134 | - include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
129 | + $tag = get_term($tag_ID, $taxonomy, OBJECT, 'edit'); |
|
130 | + if ( ! $tag) |
|
131 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
132 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
133 | + include(ABSPATH.'wp-admin/edit-tag-form.php'); |
|
134 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
135 | 135 | |
136 | 136 | exit; |
137 | 137 | |
138 | 138 | case 'editedtag': |
139 | 139 | $tag_ID = (int) $_POST['tag_ID']; |
140 | - check_admin_referer( 'update-tag_' . $tag_ID ); |
|
140 | + check_admin_referer('update-tag_'.$tag_ID); |
|
141 | 141 | |
142 | - if ( !current_user_can( $tax->cap->edit_terms ) ) |
|
143 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
142 | + if ( ! current_user_can($tax->cap->edit_terms)) |
|
143 | + wp_die(__('Cheatin’ uh?'), 403); |
|
144 | 144 | |
145 | - $tag = get_term( $tag_ID, $taxonomy ); |
|
146 | - if ( ! $tag ) |
|
147 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
145 | + $tag = get_term($tag_ID, $taxonomy); |
|
146 | + if ( ! $tag) |
|
147 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
148 | 148 | |
149 | - $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); |
|
149 | + $ret = wp_update_term($tag_ID, $taxonomy, $_POST); |
|
150 | 150 | |
151 | - $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
|
152 | - if ( 'post' != $post_type ) |
|
153 | - $location .= '&post_type=' . $post_type; |
|
151 | + $location = 'edit-tags.php?taxonomy='.$taxonomy; |
|
152 | + if ('post' != $post_type) |
|
153 | + $location .= '&post_type='.$post_type; |
|
154 | 154 | |
155 | - if ( $referer = wp_get_original_referer() ) { |
|
156 | - if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
155 | + if ($referer = wp_get_original_referer()) { |
|
156 | + if (false !== strpos($referer, 'edit-tags.php')) |
|
157 | 157 | $location = $referer; |
158 | 158 | } |
159 | 159 | |
160 | - if ( $ret && !is_wp_error( $ret ) ) |
|
161 | - $location = add_query_arg( 'message', 3, $location ); |
|
160 | + if ($ret && ! is_wp_error($ret)) |
|
161 | + $location = add_query_arg('message', 3, $location); |
|
162 | 162 | else |
163 | - $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location ); |
|
163 | + $location = add_query_arg(array('error' => true, 'message' => 5), $location); |
|
164 | 164 | break; |
165 | 165 | } |
166 | 166 | |
167 | -if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
|
168 | - $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ); |
|
167 | +if ( ! $location && ! empty($_REQUEST['_wp_http_referer'])) { |
|
168 | + $location = remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])); |
|
169 | 169 | } |
170 | 170 | |
171 | -if ( $location ) { |
|
172 | - if ( ! empty( $_REQUEST['paged'] ) ) { |
|
173 | - $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
|
171 | +if ($location) { |
|
172 | + if ( ! empty($_REQUEST['paged'])) { |
|
173 | + $location = add_query_arg('paged', (int) $_REQUEST['paged'], $location); |
|
174 | 174 | } |
175 | - wp_redirect( $location ); |
|
175 | + wp_redirect($location); |
|
176 | 176 | exit; |
177 | 177 | } |
178 | 178 | |
179 | 179 | $wp_list_table->prepare_items(); |
180 | -$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
180 | +$total_pages = $wp_list_table->get_pagination_arg('total_pages'); |
|
181 | 181 | |
182 | -if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
183 | - wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
|
182 | +if ($pagenum > $total_pages && $total_pages > 0) { |
|
183 | + wp_redirect(add_query_arg('paged', $total_pages)); |
|
184 | 184 | exit; |
185 | 185 | } |
186 | 186 | |
187 | 187 | wp_enqueue_script('admin-tags'); |
188 | -if ( current_user_can($tax->cap->edit_terms) ) |
|
188 | +if (current_user_can($tax->cap->edit_terms)) |
|
189 | 189 | wp_enqueue_script('inline-edit-tax'); |
190 | 190 | |
191 | -if ( 'category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $taxonomy ) { |
|
192 | - $help =''; |
|
193 | - if ( 'category' == $taxonomy ) |
|
194 | - $help = '<p>' . sprintf(__( 'You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your <a href="%s">writing settings</a>.' ) , 'options-writing.php' ) . '</p>'; |
|
195 | - elseif ( 'link_category' == $taxonomy ) |
|
196 | - $help = '<p>' . __( 'You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.' ) . '</p>'; |
|
191 | +if ('category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $taxonomy) { |
|
192 | + $help = ''; |
|
193 | + if ('category' == $taxonomy) |
|
194 | + $help = '<p>'.sprintf(__('You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your <a href="%s">writing settings</a>.'), 'options-writing.php').'</p>'; |
|
195 | + elseif ('link_category' == $taxonomy) |
|
196 | + $help = '<p>'.__('You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.').'</p>'; |
|
197 | 197 | else |
198 | - $help = '<p>' . __( 'You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another.' ) . '</p>'; |
|
198 | + $help = '<p>'.__('You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another.').'</p>'; |
|
199 | 199 | |
200 | - if ( 'link_category' == $taxonomy ) |
|
201 | - $help .= '<p>' . __( 'You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.' ) . '</p>'; |
|
200 | + if ('link_category' == $taxonomy) |
|
201 | + $help .= '<p>'.__('You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.').'</p>'; |
|
202 | 202 | else |
203 | - $help .='<p>' . __( 'What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.' ) . '</p>'; |
|
203 | + $help .= '<p>'.__('What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.').'</p>'; |
|
204 | 204 | |
205 | - get_current_screen()->add_help_tab( array( |
|
205 | + get_current_screen()->add_help_tab(array( |
|
206 | 206 | 'id' => 'overview', |
207 | 207 | 'title' => __('Overview'), |
208 | 208 | 'content' => $help, |
209 | - ) ); |
|
209 | + )); |
|
210 | 210 | |
211 | - if ( 'category' == $taxonomy || 'post_tag' == $taxonomy ) { |
|
212 | - if ( 'category' == $taxonomy ) |
|
213 | - $help = '<p>' . __( 'When adding a new category on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
211 | + if ('category' == $taxonomy || 'post_tag' == $taxonomy) { |
|
212 | + if ('category' == $taxonomy) |
|
213 | + $help = '<p>'.__('When adding a new category on this screen, you’ll fill in the following fields:').'</p>'; |
|
214 | 214 | else |
215 | - $help = '<p>' . __( 'When adding a new tag on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
215 | + $help = '<p>'.__('When adding a new tag on this screen, you’ll fill in the following fields:').'</p>'; |
|
216 | 216 | |
217 | - $help .= '<ul>' . |
|
218 | - '<li>' . __( '<strong>Name</strong> — The name is how it appears on your site.' ) . '</li>'; |
|
217 | + $help .= '<ul>'. |
|
218 | + '<li>'.__('<strong>Name</strong> — The name is how it appears on your site.').'</li>'; |
|
219 | 219 | |
220 | - if ( ! global_terms_enabled() ) |
|
221 | - $help .= '<li>' . __( '<strong>Slug</strong> — The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>'; |
|
220 | + if ( ! global_terms_enabled()) |
|
221 | + $help .= '<li>'.__('<strong>Slug</strong> — The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.').'</li>'; |
|
222 | 222 | |
223 | - if ( 'category' == $taxonomy ) |
|
224 | - $help .= '<li>' . __( '<strong>Parent</strong> — Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>'; |
|
223 | + if ('category' == $taxonomy) |
|
224 | + $help .= '<li>'.__('<strong>Parent</strong> — Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.').'</li>'; |
|
225 | 225 | |
226 | - $help .= '<li>' . __( '<strong>Description</strong> — The description is not prominent by default; however, some themes may display it.' ) . '</li>' . |
|
227 | - '</ul>' . |
|
228 | - '<p>' . __( 'You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.' ) . '</p>'; |
|
226 | + $help .= '<li>'.__('<strong>Description</strong> — The description is not prominent by default; however, some themes may display it.').'</li>'. |
|
227 | + '</ul>'. |
|
228 | + '<p>'.__('You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.').'</p>'; |
|
229 | 229 | |
230 | - get_current_screen()->add_help_tab( array( |
|
230 | + get_current_screen()->add_help_tab(array( |
|
231 | 231 | 'id' => 'adding-terms', |
232 | - 'title' => 'category' == $taxonomy ? __( 'Adding Categories' ) : __( 'Adding Tags' ), |
|
232 | + 'title' => 'category' == $taxonomy ? __('Adding Categories') : __('Adding Tags'), |
|
233 | 233 | 'content' => $help, |
234 | - ) ); |
|
234 | + )); |
|
235 | 235 | } |
236 | 236 | |
237 | - $help = '<p><strong>' . __( 'For more information:' ) . '</strong></p>'; |
|
237 | + $help = '<p><strong>'.__('For more information:').'</strong></p>'; |
|
238 | 238 | |
239 | - if ( 'category' == $taxonomy ) |
|
240 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Categories_Screen" target="_blank">Documentation on Categories</a>' ) . '</p>'; |
|
241 | - elseif ( 'link_category' == $taxonomy ) |
|
242 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Links_Link_Categories_Screen" target="_blank">Documentation on Link Categories</a>' ) . '</p>'; |
|
239 | + if ('category' == $taxonomy) |
|
240 | + $help .= '<p>'.__('<a href="https://codex.wordpress.org/Posts_Categories_Screen" target="_blank">Documentation on Categories</a>').'</p>'; |
|
241 | + elseif ('link_category' == $taxonomy) |
|
242 | + $help .= '<p>'.__('<a href="https://codex.wordpress.org/Links_Link_Categories_Screen" target="_blank">Documentation on Link Categories</a>').'</p>'; |
|
243 | 243 | else |
244 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Tags_Screen" target="_blank">Documentation on Tags</a>' ) . '</p>'; |
|
244 | + $help .= '<p>'.__('<a href="https://codex.wordpress.org/Posts_Tags_Screen" target="_blank">Documentation on Tags</a>').'</p>'; |
|
245 | 245 | |
246 | - $help .= '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'; |
|
246 | + $help .= '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'; |
|
247 | 247 | |
248 | - get_current_screen()->set_help_sidebar( $help ); |
|
248 | + get_current_screen()->set_help_sidebar($help); |
|
249 | 249 | |
250 | - unset( $help ); |
|
250 | + unset($help); |
|
251 | 251 | } |
252 | 252 | |
253 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
253 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
254 | 254 | |
255 | -if ( !current_user_can($tax->cap->edit_terms) ) |
|
256 | - wp_die( __('You are not allowed to edit this item.') ); |
|
255 | +if ( ! current_user_can($tax->cap->edit_terms)) |
|
256 | + wp_die(__('You are not allowed to edit this item.')); |
|
257 | 257 | |
258 | 258 | $messages = array(); |
259 | 259 | $messages['_item'] = array( |
260 | 260 | 0 => '', // Unused. Messages start at index 1. |
261 | - 1 => __( 'Item added.' ), |
|
262 | - 2 => __( 'Item deleted.' ), |
|
263 | - 3 => __( 'Item updated.' ), |
|
264 | - 4 => __( 'Item not added.' ), |
|
265 | - 5 => __( 'Item not updated.' ), |
|
266 | - 6 => __( 'Items deleted.' ) |
|
261 | + 1 => __('Item added.'), |
|
262 | + 2 => __('Item deleted.'), |
|
263 | + 3 => __('Item updated.'), |
|
264 | + 4 => __('Item not added.'), |
|
265 | + 5 => __('Item not updated.'), |
|
266 | + 6 => __('Items deleted.') |
|
267 | 267 | ); |
268 | 268 | $messages['category'] = array( |
269 | 269 | 0 => '', // Unused. Messages start at index 1. |
270 | - 1 => __( 'Category added.' ), |
|
271 | - 2 => __( 'Category deleted.' ), |
|
272 | - 3 => __( 'Category updated.' ), |
|
273 | - 4 => __( 'Category not added.' ), |
|
274 | - 5 => __( 'Category not updated.' ), |
|
275 | - 6 => __( 'Categories deleted.' ) |
|
270 | + 1 => __('Category added.'), |
|
271 | + 2 => __('Category deleted.'), |
|
272 | + 3 => __('Category updated.'), |
|
273 | + 4 => __('Category not added.'), |
|
274 | + 5 => __('Category not updated.'), |
|
275 | + 6 => __('Categories deleted.') |
|
276 | 276 | ); |
277 | 277 | $messages['post_tag'] = array( |
278 | 278 | 0 => '', // Unused. Messages start at index 1. |
279 | - 1 => __( 'Tag added.' ), |
|
280 | - 2 => __( 'Tag deleted.' ), |
|
281 | - 3 => __( 'Tag updated.' ), |
|
282 | - 4 => __( 'Tag not added.' ), |
|
283 | - 5 => __( 'Tag not updated.' ), |
|
284 | - 6 => __( 'Tags deleted.' ) |
|
279 | + 1 => __('Tag added.'), |
|
280 | + 2 => __('Tag deleted.'), |
|
281 | + 3 => __('Tag updated.'), |
|
282 | + 4 => __('Tag not added.'), |
|
283 | + 5 => __('Tag not updated.'), |
|
284 | + 6 => __('Tags deleted.') |
|
285 | 285 | ); |
286 | 286 | |
287 | 287 | /** |
@@ -291,35 +291,35 @@ discard block |
||
291 | 291 | * |
292 | 292 | * @param array $messages The messages to be displayed. |
293 | 293 | */ |
294 | -$messages = apply_filters( 'term_updated_messages', $messages ); |
|
294 | +$messages = apply_filters('term_updated_messages', $messages); |
|
295 | 295 | |
296 | 296 | $message = false; |
297 | -if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) { |
|
298 | - if ( isset( $messages[ $taxonomy ][ $msg ] ) ) |
|
299 | - $message = $messages[ $taxonomy ][ $msg ]; |
|
300 | - elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) ) |
|
301 | - $message = $messages['_item'][ $msg ]; |
|
297 | +if (isset($_REQUEST['message']) && ($msg = (int) $_REQUEST['message'])) { |
|
298 | + if (isset($messages[$taxonomy][$msg])) |
|
299 | + $message = $messages[$taxonomy][$msg]; |
|
300 | + elseif ( ! isset($messages[$taxonomy]) && isset($messages['_item'][$msg])) |
|
301 | + $message = $messages['_item'][$msg]; |
|
302 | 302 | } |
303 | 303 | |
304 | -$class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated'; |
|
304 | +$class = (isset($_REQUEST['error'])) ? 'error' : 'updated'; |
|
305 | 305 | |
306 | -if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) { |
|
307 | - $import_link = admin_url( 'admin.php?import=wpcat2tag' ); |
|
306 | +if (is_plugin_active('wpcat2tag-importer/wpcat2tag-importer.php')) { |
|
307 | + $import_link = admin_url('admin.php?import=wpcat2tag'); |
|
308 | 308 | } else { |
309 | - $import_link = admin_url( 'import.php' ); |
|
309 | + $import_link = admin_url('import.php'); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | ?> |
313 | 313 | |
314 | 314 | <div class="wrap nosubsub"> |
315 | -<h1><?php echo esc_html( $title ); |
|
316 | -if ( !empty($_REQUEST['s']) ) |
|
317 | - printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?> |
|
315 | +<h1><?php echo esc_html($title); |
|
316 | +if ( ! empty($_REQUEST['s'])) |
|
317 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', esc_html(wp_unslash($_REQUEST['s']))); ?> |
|
318 | 318 | </h1> |
319 | 319 | |
320 | -<?php if ( $message ) : ?> |
|
320 | +<?php if ($message) : ?> |
|
321 | 321 | <div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $message; ?></p></div> |
322 | -<?php $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] ); |
|
322 | +<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message', 'error'), $_SERVER['REQUEST_URI']); |
|
323 | 323 | endif; ?> |
324 | 324 | <div id="ajax-response"></div> |
325 | 325 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" /> |
328 | 328 | <input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" /> |
329 | 329 | |
330 | -<?php $wp_list_table->search_box( $tax->labels->search_items, 'tag' ); ?> |
|
330 | +<?php $wp_list_table->search_box($tax->labels->search_items, 'tag'); ?> |
|
331 | 331 | |
332 | 332 | </form> |
333 | 333 | <br class="clear" /> |
@@ -345,21 +345,21 @@ discard block |
||
345 | 345 | <br class="clear" /> |
346 | 346 | </form> |
347 | 347 | |
348 | -<?php if ( 'category' == $taxonomy ) : ?> |
|
348 | +<?php if ('category' == $taxonomy) : ?> |
|
349 | 349 | <div class="form-wrap"> |
350 | 350 | <p> |
351 | 351 | <?php |
352 | 352 | /** This filter is documented in wp-includes/category-template.php */ |
353 | - printf( __( '<strong>Note:</strong><br />Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong>.' ), apply_filters( 'the_category', get_cat_name( get_option( 'default_category') ) ) ); |
|
353 | + printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), apply_filters('the_category', get_cat_name(get_option('default_category')))); |
|
354 | 354 | ?> |
355 | 355 | </p> |
356 | -<?php if ( current_user_can( 'import' ) ) : ?> |
|
357 | -<p><?php printf( __( 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.' ), esc_url( $import_link ) ) ?></p> |
|
356 | +<?php if (current_user_can('import')) : ?> |
|
357 | +<p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), esc_url($import_link)) ?></p> |
|
358 | 358 | <?php endif; ?> |
359 | 359 | </div> |
360 | -<?php elseif ( 'post_tag' == $taxonomy && current_user_can( 'import' ) ) : ?> |
|
360 | +<?php elseif ('post_tag' == $taxonomy && current_user_can('import')) : ?> |
|
361 | 361 | <div class="form-wrap"> |
362 | -<p><?php printf( __( 'Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.' ), esc_url( $import_link ) ) ;?></p> |
|
362 | +<p><?php printf(__('Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.'), esc_url($import_link)); ?></p> |
|
363 | 363 | </div> |
364 | 364 | <?php endif; |
365 | 365 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * |
373 | 373 | * @param string $taxonomy The taxonomy name. |
374 | 374 | */ |
375 | -do_action( "after-{$taxonomy}-table", $taxonomy ); |
|
375 | +do_action("after-{$taxonomy}-table", $taxonomy); |
|
376 | 376 | ?> |
377 | 377 | |
378 | 378 | </div> |
@@ -383,24 +383,24 @@ discard block |
||
383 | 383 | |
384 | 384 | <?php |
385 | 385 | |
386 | -if ( !is_null( $tax->labels->popular_items ) ) { |
|
387 | - if ( current_user_can( $tax->cap->edit_terms ) ) |
|
388 | - $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'post_type' => $post_type, 'echo' => false, 'link' => 'edit' ) ); |
|
386 | +if ( ! is_null($tax->labels->popular_items)) { |
|
387 | + if (current_user_can($tax->cap->edit_terms)) |
|
388 | + $tag_cloud = wp_tag_cloud(array('taxonomy' => $taxonomy, 'post_type' => $post_type, 'echo' => false, 'link' => 'edit')); |
|
389 | 389 | else |
390 | - $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false ) ); |
|
390 | + $tag_cloud = wp_tag_cloud(array('taxonomy' => $taxonomy, 'echo' => false)); |
|
391 | 391 | |
392 | - if ( $tag_cloud ) : |
|
392 | + if ($tag_cloud) : |
|
393 | 393 | ?> |
394 | 394 | <div class="tagcloud"> |
395 | 395 | <h3><?php echo $tax->labels->popular_items; ?></h3> |
396 | -<?php echo $tag_cloud; unset( $tag_cloud ); ?> |
|
396 | +<?php echo $tag_cloud; unset($tag_cloud); ?> |
|
397 | 397 | </div> |
398 | 398 | <?php |
399 | 399 | endif; |
400 | 400 | } |
401 | 401 | |
402 | -if ( current_user_can($tax->cap->edit_terms) ) { |
|
403 | - if ( 'category' == $taxonomy ) { |
|
402 | +if (current_user_can($tax->cap->edit_terms)) { |
|
403 | + if ('category' == $taxonomy) { |
|
404 | 404 | /** |
405 | 405 | * Fires before the Add Category form. |
406 | 406 | * |
@@ -409,8 +409,8 @@ discard block |
||
409 | 409 | * |
410 | 410 | * @param object $arg Optional arguments cast to an object. |
411 | 411 | */ |
412 | - do_action( 'add_category_form_pre', (object) array( 'parent' => 0 ) ); |
|
413 | - } elseif ( 'link_category' == $taxonomy ) { |
|
412 | + do_action('add_category_form_pre', (object) array('parent' => 0)); |
|
413 | + } elseif ('link_category' == $taxonomy) { |
|
414 | 414 | /** |
415 | 415 | * Fires before the link category form. |
416 | 416 | * |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @param object $arg Optional arguments cast to an object. |
421 | 421 | */ |
422 | - do_action( 'add_link_category_form_pre', (object) array( 'parent' => 0 ) ); |
|
422 | + do_action('add_link_category_form_pre', (object) array('parent' => 0)); |
|
423 | 423 | } else { |
424 | 424 | /** |
425 | 425 | * Fires before the Add Tag form. |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * |
430 | 430 | * @param string $taxonomy The taxonomy slug. |
431 | 431 | */ |
432 | - do_action( 'add_tag_form_pre', $taxonomy ); |
|
432 | + do_action('add_tag_form_pre', $taxonomy); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | /** |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | * |
442 | 442 | * @param string $taxonomy The taxonomy slug. |
443 | 443 | */ |
444 | - do_action( "{$taxonomy}_pre_add_form", $taxonomy ); |
|
444 | + do_action("{$taxonomy}_pre_add_form", $taxonomy); |
|
445 | 445 | ?> |
446 | 446 | |
447 | 447 | <div class="form-wrap"> |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | * |
456 | 456 | * @since 3.7.0 |
457 | 457 | */ |
458 | -do_action( "{$taxonomy}_term_new_form_tag" ); |
|
458 | +do_action("{$taxonomy}_term_new_form_tag"); |
|
459 | 459 | ?>> |
460 | 460 | <input type="hidden" name="action" value="add-tag" /> |
461 | 461 | <input type="hidden" name="screen" value="<?php echo esc_attr($current_screen->id); ?>" /> |
@@ -464,20 +464,20 @@ discard block |
||
464 | 464 | <?php wp_nonce_field('add-tag', '_wpnonce_add-tag'); ?> |
465 | 465 | |
466 | 466 | <div class="form-field form-required term-name-wrap"> |
467 | - <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label> |
|
467 | + <label for="tag-name"><?php _ex('Name', 'term name'); ?></label> |
|
468 | 468 | <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" /> |
469 | 469 | <p><?php _e('The name is how it appears on your site.'); ?></p> |
470 | 470 | </div> |
471 | -<?php if ( ! global_terms_enabled() ) : ?> |
|
471 | +<?php if ( ! global_terms_enabled()) : ?> |
|
472 | 472 | <div class="form-field term-slug-wrap"> |
473 | - <label for="tag-slug"><?php _e( 'Slug' ); ?></label> |
|
473 | + <label for="tag-slug"><?php _e('Slug'); ?></label> |
|
474 | 474 | <input name="slug" id="tag-slug" type="text" value="" size="40" /> |
475 | 475 | <p><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p> |
476 | 476 | </div> |
477 | 477 | <?php endif; // global_terms_enabled() ?> |
478 | -<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?> |
|
478 | +<?php if (is_taxonomy_hierarchical($taxonomy)) : ?> |
|
479 | 479 | <div class="form-field term-parent-wrap"> |
480 | - <label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label> |
|
480 | + <label for="parent"><?php _ex('Parent', 'term parent'); ?></label> |
|
481 | 481 | <?php |
482 | 482 | $dropdown_args = array( |
483 | 483 | 'hide_empty' => 0, |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | 'name' => 'parent', |
487 | 487 | 'orderby' => 'name', |
488 | 488 | 'hierarchical' => true, |
489 | - 'show_option_none' => __( 'None' ), |
|
489 | + 'show_option_none' => __('None'), |
|
490 | 490 | ); |
491 | 491 | |
492 | 492 | /** |
@@ -510,23 +510,23 @@ discard block |
||
510 | 510 | * @param string $taxonomy The taxonomy slug. |
511 | 511 | * @param string $context Filter context. Accepts 'new' or 'edit'. |
512 | 512 | */ |
513 | - $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' ); |
|
513 | + $dropdown_args = apply_filters('taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new'); |
|
514 | 514 | |
515 | - wp_dropdown_categories( $dropdown_args ); |
|
515 | + wp_dropdown_categories($dropdown_args); |
|
516 | 516 | ?> |
517 | - <?php if ( 'category' == $taxonomy ) : // @todo: Generic text for hierarchical taxonomies ?> |
|
517 | + <?php if ('category' == $taxonomy) : // @todo: Generic text for hierarchical taxonomies ?> |
|
518 | 518 | <p><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p> |
519 | 519 | <?php endif; ?> |
520 | 520 | </div> |
521 | 521 | <?php endif; // is_taxonomy_hierarchical() ?> |
522 | 522 | <div class="form-field term-description-wrap"> |
523 | - <label for="tag-description"><?php _e( 'Description' ); ?></label> |
|
523 | + <label for="tag-description"><?php _e('Description'); ?></label> |
|
524 | 524 | <textarea name="description" id="tag-description" rows="5" cols="40"></textarea> |
525 | 525 | <p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p> |
526 | 526 | </div> |
527 | 527 | |
528 | 528 | <?php |
529 | -if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { |
|
529 | +if ( ! is_taxonomy_hierarchical($taxonomy)) { |
|
530 | 530 | /** |
531 | 531 | * Fires after the Add Tag form fields for non-hierarchical taxonomies. |
532 | 532 | * |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @param string $taxonomy The taxonomy slug. |
536 | 536 | */ |
537 | - do_action( 'add_tag_form_fields', $taxonomy ); |
|
537 | + do_action('add_tag_form_fields', $taxonomy); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | /** |
@@ -546,11 +546,11 @@ discard block |
||
546 | 546 | * |
547 | 547 | * @param string $taxonomy The taxonomy slug. |
548 | 548 | */ |
549 | -do_action( "{$taxonomy}_add_form_fields", $taxonomy ); |
|
549 | +do_action("{$taxonomy}_add_form_fields", $taxonomy); |
|
550 | 550 | |
551 | -submit_button( $tax->labels->add_new_item ); |
|
551 | +submit_button($tax->labels->add_new_item); |
|
552 | 552 | |
553 | -if ( 'category' == $taxonomy ) { |
|
553 | +if ('category' == $taxonomy) { |
|
554 | 554 | /** |
555 | 555 | * Fires at the end of the Edit Category form. |
556 | 556 | * |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | * |
560 | 560 | * @param object $arg Optional arguments cast to an object. |
561 | 561 | */ |
562 | - do_action( 'edit_category_form', (object) array( 'parent' => 0 ) ); |
|
563 | -} elseif ( 'link_category' == $taxonomy ) { |
|
562 | + do_action('edit_category_form', (object) array('parent' => 0)); |
|
563 | +} elseif ('link_category' == $taxonomy) { |
|
564 | 564 | /** |
565 | 565 | * Fires at the end of the Edit Link form. |
566 | 566 | * |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | * |
570 | 570 | * @param object $arg Optional arguments cast to an object. |
571 | 571 | */ |
572 | - do_action( 'edit_link_category_form', (object) array( 'parent' => 0 ) ); |
|
572 | + do_action('edit_link_category_form', (object) array('parent' => 0)); |
|
573 | 573 | } else { |
574 | 574 | /** |
575 | 575 | * Fires at the end of the Add Tag form. |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | * |
580 | 580 | * @param string $taxonomy The taxonomy slug. |
581 | 581 | */ |
582 | - do_action( 'add_tag_form', $taxonomy ); |
|
582 | + do_action('add_tag_form', $taxonomy); |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | /** |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | * |
592 | 592 | * @param string $taxonomy The taxonomy slug. |
593 | 593 | */ |
594 | -do_action( "{$taxonomy}_add_form", $taxonomy ); |
|
594 | +do_action("{$taxonomy}_add_form", $taxonomy); |
|
595 | 595 | ?> |
596 | 596 | </form></div> |
597 | 597 | <?php } ?> |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | </div><!-- /col-container --> |
603 | 603 | </div><!-- /wrap --> |
604 | 604 | |
605 | -<?php if ( ! wp_is_mobile() ) : ?> |
|
605 | +<?php if ( ! wp_is_mobile()) : ?> |
|
606 | 606 | <script type="text/javascript"> |
607 | 607 | try{document.forms.addtag['tag-name'].focus();}catch(e){} |
608 | 608 | </script> |
@@ -611,4 +611,4 @@ discard block |
||
611 | 611 | |
612 | 612 | $wp_list_table->inline_edit(); |
613 | 613 | |
614 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
614 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -9,16 +9,19 @@ discard block |
||
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | -if ( ! $taxnow ) |
|
12 | +if ( ! $taxnow ) { |
|
13 | 13 | wp_die( __( 'Invalid taxonomy' ) ); |
14 | +} |
|
14 | 15 | |
15 | 16 | $tax = get_taxonomy( $taxnow ); |
16 | 17 | |
17 | -if ( ! $tax ) |
|
18 | +if ( ! $tax ) { |
|
18 | 19 | wp_die( __( 'Invalid taxonomy' ) ); |
20 | +} |
|
19 | 21 | |
20 | -if ( ! current_user_can( $tax->cap->manage_terms ) ) |
|
22 | +if ( ! current_user_can( $tax->cap->manage_terms ) ) { |
|
21 | 23 | wp_die( __( 'Cheatin’ uh?' ), 403 ); |
24 | +} |
|
22 | 25 | |
23 | 26 | /** |
24 | 27 | * $post_type is set when the WP_Terms_List_Table instance is created |
@@ -53,33 +56,39 @@ discard block |
||
53 | 56 | |
54 | 57 | check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); |
55 | 58 | |
56 | - if ( !current_user_can( $tax->cap->edit_terms ) ) |
|
57 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
59 | + if ( !current_user_can( $tax->cap->edit_terms ) ) { |
|
60 | + wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
61 | + } |
|
58 | 62 | |
59 | 63 | $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); |
60 | 64 | $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
61 | - if ( 'post' != $post_type ) |
|
62 | - $location .= '&post_type=' . $post_type; |
|
65 | + if ( 'post' != $post_type ) { |
|
66 | + $location .= '&post_type=' . $post_type; |
|
67 | + } |
|
63 | 68 | |
64 | 69 | if ( $referer = wp_get_original_referer() ) { |
65 | - if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
66 | - $location = $referer; |
|
70 | + if ( false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
71 | + $location = $referer; |
|
72 | + } |
|
67 | 73 | } |
68 | 74 | |
69 | - if ( $ret && !is_wp_error( $ret ) ) |
|
70 | - $location = add_query_arg( 'message', 1, $location ); |
|
71 | - else |
|
72 | - $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $location ); |
|
75 | + if ( $ret && !is_wp_error( $ret ) ) { |
|
76 | + $location = add_query_arg( 'message', 1, $location ); |
|
77 | + } else { |
|
78 | + $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $location ); |
|
79 | + } |
|
73 | 80 | |
74 | 81 | break; |
75 | 82 | |
76 | 83 | case 'delete': |
77 | 84 | $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
78 | - if ( 'post' != $post_type ) |
|
79 | - $location .= '&post_type=' . $post_type; |
|
85 | + if ( 'post' != $post_type ) { |
|
86 | + $location .= '&post_type=' . $post_type; |
|
87 | + } |
|
80 | 88 | if ( $referer = wp_get_referer() ) { |
81 | - if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
82 | - $location = $referer; |
|
89 | + if ( false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
90 | + $location = $referer; |
|
91 | + } |
|
83 | 92 | } |
84 | 93 | |
85 | 94 | if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
@@ -89,8 +98,9 @@ discard block |
||
89 | 98 | $tag_ID = (int) $_REQUEST['tag_ID']; |
90 | 99 | check_admin_referer( 'delete-tag_' . $tag_ID ); |
91 | 100 | |
92 | - if ( !current_user_can( $tax->cap->delete_terms ) ) |
|
93 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
101 | + if ( !current_user_can( $tax->cap->delete_terms ) ) { |
|
102 | + wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
103 | + } |
|
94 | 104 | |
95 | 105 | wp_delete_term( $tag_ID, $taxonomy ); |
96 | 106 | |
@@ -101,8 +111,9 @@ discard block |
||
101 | 111 | case 'bulk-delete': |
102 | 112 | check_admin_referer( 'bulk-tags' ); |
103 | 113 | |
104 | - if ( !current_user_can( $tax->cap->delete_terms ) ) |
|
105 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
114 | + if ( !current_user_can( $tax->cap->delete_terms ) ) { |
|
115 | + wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
116 | + } |
|
106 | 117 | |
107 | 118 | $tags = (array) $_REQUEST['delete_tags']; |
108 | 119 | foreach ( $tags as $tag_ID ) { |
@@ -110,11 +121,13 @@ discard block |
||
110 | 121 | } |
111 | 122 | |
112 | 123 | $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
113 | - if ( 'post' != $post_type ) |
|
114 | - $location .= '&post_type=' . $post_type; |
|
124 | + if ( 'post' != $post_type ) { |
|
125 | + $location .= '&post_type=' . $post_type; |
|
126 | + } |
|
115 | 127 | if ( $referer = wp_get_referer() ) { |
116 | - if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
117 | - $location = $referer; |
|
128 | + if ( false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
129 | + $location = $referer; |
|
130 | + } |
|
118 | 131 | } |
119 | 132 | |
120 | 133 | $location = add_query_arg( 'message', 6, $location ); |
@@ -127,8 +140,9 @@ discard block |
||
127 | 140 | $tag_ID = (int) $_REQUEST['tag_ID']; |
128 | 141 | |
129 | 142 | $tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' ); |
130 | - if ( ! $tag ) |
|
131 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
143 | + if ( ! $tag ) { |
|
144 | + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
145 | + } |
|
132 | 146 | require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
133 | 147 | include( ABSPATH . 'wp-admin/edit-tag-form.php' ); |
134 | 148 | include( ABSPATH . 'wp-admin/admin-footer.php' ); |
@@ -139,28 +153,33 @@ discard block |
||
139 | 153 | $tag_ID = (int) $_POST['tag_ID']; |
140 | 154 | check_admin_referer( 'update-tag_' . $tag_ID ); |
141 | 155 | |
142 | - if ( !current_user_can( $tax->cap->edit_terms ) ) |
|
143 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
156 | + if ( !current_user_can( $tax->cap->edit_terms ) ) { |
|
157 | + wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
158 | + } |
|
144 | 159 | |
145 | 160 | $tag = get_term( $tag_ID, $taxonomy ); |
146 | - if ( ! $tag ) |
|
147 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
161 | + if ( ! $tag ) { |
|
162 | + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
163 | + } |
|
148 | 164 | |
149 | 165 | $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); |
150 | 166 | |
151 | 167 | $location = 'edit-tags.php?taxonomy=' . $taxonomy; |
152 | - if ( 'post' != $post_type ) |
|
153 | - $location .= '&post_type=' . $post_type; |
|
168 | + if ( 'post' != $post_type ) { |
|
169 | + $location .= '&post_type=' . $post_type; |
|
170 | + } |
|
154 | 171 | |
155 | 172 | if ( $referer = wp_get_original_referer() ) { |
156 | - if ( false !== strpos( $referer, 'edit-tags.php' ) ) |
|
157 | - $location = $referer; |
|
173 | + if ( false !== strpos( $referer, 'edit-tags.php' ) ) { |
|
174 | + $location = $referer; |
|
175 | + } |
|
158 | 176 | } |
159 | 177 | |
160 | - if ( $ret && !is_wp_error( $ret ) ) |
|
161 | - $location = add_query_arg( 'message', 3, $location ); |
|
162 | - else |
|
163 | - $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location ); |
|
178 | + if ( $ret && !is_wp_error( $ret ) ) { |
|
179 | + $location = add_query_arg( 'message', 3, $location ); |
|
180 | + } else { |
|
181 | + $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location ); |
|
182 | + } |
|
164 | 183 | break; |
165 | 184 | } |
166 | 185 | |
@@ -185,22 +204,25 @@ discard block |
||
185 | 204 | } |
186 | 205 | |
187 | 206 | wp_enqueue_script('admin-tags'); |
188 | -if ( current_user_can($tax->cap->edit_terms) ) |
|
207 | +if ( current_user_can($tax->cap->edit_terms) ) { |
|
189 | 208 | wp_enqueue_script('inline-edit-tax'); |
209 | +} |
|
190 | 210 | |
191 | 211 | if ( 'category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $taxonomy ) { |
192 | 212 | $help =''; |
193 | - if ( 'category' == $taxonomy ) |
|
194 | - $help = '<p>' . sprintf(__( 'You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your <a href="%s">writing settings</a>.' ) , 'options-writing.php' ) . '</p>'; |
|
195 | - elseif ( 'link_category' == $taxonomy ) |
|
196 | - $help = '<p>' . __( 'You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.' ) . '</p>'; |
|
197 | - else |
|
198 | - $help = '<p>' . __( 'You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another.' ) . '</p>'; |
|
199 | - |
|
200 | - if ( 'link_category' == $taxonomy ) |
|
201 | - $help .= '<p>' . __( 'You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.' ) . '</p>'; |
|
202 | - else |
|
203 | - $help .='<p>' . __( 'What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.' ) . '</p>'; |
|
213 | + if ( 'category' == $taxonomy ) { |
|
214 | + $help = '<p>' . sprintf(__( 'You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your <a href="%s">writing settings</a>.' ) , 'options-writing.php' ) . '</p>'; |
|
215 | + } elseif ( 'link_category' == $taxonomy ) { |
|
216 | + $help = '<p>' . __( 'You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.' ) . '</p>'; |
|
217 | + } else { |
|
218 | + $help = '<p>' . __( 'You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another.' ) . '</p>'; |
|
219 | + } |
|
220 | + |
|
221 | + if ( 'link_category' == $taxonomy ) { |
|
222 | + $help .= '<p>' . __( 'You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.' ) . '</p>'; |
|
223 | + } else { |
|
224 | + $help .='<p>' . __( 'What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.' ) . '</p>'; |
|
225 | + } |
|
204 | 226 | |
205 | 227 | get_current_screen()->add_help_tab( array( |
206 | 228 | 'id' => 'overview', |
@@ -209,19 +231,22 @@ discard block |
||
209 | 231 | ) ); |
210 | 232 | |
211 | 233 | if ( 'category' == $taxonomy || 'post_tag' == $taxonomy ) { |
212 | - if ( 'category' == $taxonomy ) |
|
213 | - $help = '<p>' . __( 'When adding a new category on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
214 | - else |
|
215 | - $help = '<p>' . __( 'When adding a new tag on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
234 | + if ( 'category' == $taxonomy ) { |
|
235 | + $help = '<p>' . __( 'When adding a new category on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
236 | + } else { |
|
237 | + $help = '<p>' . __( 'When adding a new tag on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
238 | + } |
|
216 | 239 | |
217 | 240 | $help .= '<ul>' . |
218 | 241 | '<li>' . __( '<strong>Name</strong> — The name is how it appears on your site.' ) . '</li>'; |
219 | 242 | |
220 | - if ( ! global_terms_enabled() ) |
|
221 | - $help .= '<li>' . __( '<strong>Slug</strong> — The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>'; |
|
243 | + if ( ! global_terms_enabled() ) { |
|
244 | + $help .= '<li>' . __( '<strong>Slug</strong> — The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>'; |
|
245 | + } |
|
222 | 246 | |
223 | - if ( 'category' == $taxonomy ) |
|
224 | - $help .= '<li>' . __( '<strong>Parent</strong> — Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>'; |
|
247 | + if ( 'category' == $taxonomy ) { |
|
248 | + $help .= '<li>' . __( '<strong>Parent</strong> — Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>'; |
|
249 | + } |
|
225 | 250 | |
226 | 251 | $help .= '<li>' . __( '<strong>Description</strong> — The description is not prominent by default; however, some themes may display it.' ) . '</li>' . |
227 | 252 | '</ul>' . |
@@ -236,12 +261,13 @@ discard block |
||
236 | 261 | |
237 | 262 | $help = '<p><strong>' . __( 'For more information:' ) . '</strong></p>'; |
238 | 263 | |
239 | - if ( 'category' == $taxonomy ) |
|
240 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Categories_Screen" target="_blank">Documentation on Categories</a>' ) . '</p>'; |
|
241 | - elseif ( 'link_category' == $taxonomy ) |
|
242 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Links_Link_Categories_Screen" target="_blank">Documentation on Link Categories</a>' ) . '</p>'; |
|
243 | - else |
|
244 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Tags_Screen" target="_blank">Documentation on Tags</a>' ) . '</p>'; |
|
264 | + if ( 'category' == $taxonomy ) { |
|
265 | + $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Categories_Screen" target="_blank">Documentation on Categories</a>' ) . '</p>'; |
|
266 | + } elseif ( 'link_category' == $taxonomy ) { |
|
267 | + $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Links_Link_Categories_Screen" target="_blank">Documentation on Link Categories</a>' ) . '</p>'; |
|
268 | + } else { |
|
269 | + $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Tags_Screen" target="_blank">Documentation on Tags</a>' ) . '</p>'; |
|
270 | + } |
|
245 | 271 | |
246 | 272 | $help .= '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'; |
247 | 273 | |
@@ -252,8 +278,9 @@ discard block |
||
252 | 278 | |
253 | 279 | require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
254 | 280 | |
255 | -if ( !current_user_can($tax->cap->edit_terms) ) |
|
281 | +if ( !current_user_can($tax->cap->edit_terms) ) { |
|
256 | 282 | wp_die( __('You are not allowed to edit this item.') ); |
283 | +} |
|
257 | 284 | |
258 | 285 | $messages = array(); |
259 | 286 | $messages['_item'] = array( |
@@ -295,11 +322,12 @@ discard block |
||
295 | 322 | |
296 | 323 | $message = false; |
297 | 324 | if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) { |
298 | - if ( isset( $messages[ $taxonomy ][ $msg ] ) ) |
|
299 | - $message = $messages[ $taxonomy ][ $msg ]; |
|
300 | - elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) ) |
|
301 | - $message = $messages['_item'][ $msg ]; |
|
302 | -} |
|
325 | + if ( isset( $messages[ $taxonomy ][ $msg ] ) ) { |
|
326 | + $message = $messages[ $taxonomy ][ $msg ]; |
|
327 | + } elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) ) { |
|
328 | + $message = $messages['_item'][ $msg ]; |
|
329 | + } |
|
330 | + } |
|
303 | 331 | |
304 | 332 | $class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated'; |
305 | 333 | |
@@ -313,8 +341,10 @@ discard block |
||
313 | 341 | |
314 | 342 | <div class="wrap nosubsub"> |
315 | 343 | <h1><?php echo esc_html( $title ); |
316 | -if ( !empty($_REQUEST['s']) ) |
|
317 | - printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?> |
|
344 | +if ( !empty($_REQUEST['s']) ) { |
|
345 | + printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); |
|
346 | +} |
|
347 | +?> |
|
318 | 348 | </h1> |
319 | 349 | |
320 | 350 | <?php if ( $message ) : ?> |
@@ -384,10 +414,11 @@ discard block |
||
384 | 414 | <?php |
385 | 415 | |
386 | 416 | if ( !is_null( $tax->labels->popular_items ) ) { |
387 | - if ( current_user_can( $tax->cap->edit_terms ) ) |
|
388 | - $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'post_type' => $post_type, 'echo' => false, 'link' => 'edit' ) ); |
|
389 | - else |
|
390 | - $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false ) ); |
|
417 | + if ( current_user_can( $tax->cap->edit_terms ) ) { |
|
418 | + $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'post_type' => $post_type, 'echo' => false, 'link' => 'edit' ) ); |
|
419 | + } else { |
|
420 | + $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false ) ); |
|
421 | + } |
|
391 | 422 | |
392 | 423 | if ( $tag_cloud ) : |
393 | 424 | ?> |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * @since 3.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -wp_redirect( network_admin_url() ); |
|
12 | +wp_redirect(network_admin_url()); |
|
13 | 13 | exit; |
@@ -54,161 +54,161 @@ discard block |
||
54 | 54 | |
55 | 55 | switch ( $action ) { |
56 | 56 | |
57 | -case 'update': |
|
57 | + case 'update': |
|
58 | 58 | |
59 | - check_admin_referer('edit-plugin_' . $file); |
|
59 | + check_admin_referer('edit-plugin_' . $file); |
|
60 | 60 | |
61 | - $newcontent = wp_unslash( $_POST['newcontent'] ); |
|
62 | - if ( is_writeable($real_file) ) { |
|
63 | - $f = fopen($real_file, 'w+'); |
|
64 | - fwrite($f, $newcontent); |
|
65 | - fclose($f); |
|
61 | + $newcontent = wp_unslash( $_POST['newcontent'] ); |
|
62 | + if ( is_writeable($real_file) ) { |
|
63 | + $f = fopen($real_file, 'w+'); |
|
64 | + fwrite($f, $newcontent); |
|
65 | + fclose($f); |
|
66 | 66 | |
67 | - $network_wide = is_plugin_active_for_network( $file ); |
|
67 | + $network_wide = is_plugin_active_for_network( $file ); |
|
68 | 68 | |
69 | - // Deactivate so we can test it. |
|
70 | - if ( is_plugin_active($file) || isset($_POST['phperror']) ) { |
|
71 | - if ( is_plugin_active($file) ) |
|
72 | - deactivate_plugins($file, true); |
|
69 | + // Deactivate so we can test it. |
|
70 | + if ( is_plugin_active($file) || isset($_POST['phperror']) ) { |
|
71 | + if ( is_plugin_active($file) ) |
|
72 | + deactivate_plugins($file, true); |
|
73 | 73 | |
74 | - if ( ! is_network_admin() ) |
|
75 | - update_option( 'recently_activated', array( $file => time() ) + (array) get_option( 'recently_activated' ) ); |
|
74 | + if ( ! is_network_admin() ) |
|
75 | + update_option( 'recently_activated', array( $file => time() ) + (array) get_option( 'recently_activated' ) ); |
|
76 | 76 | |
77 | - wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide)); |
|
78 | - exit; |
|
77 | + wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide)); |
|
78 | + exit; |
|
79 | + } |
|
80 | + wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); |
|
81 | + } else { |
|
82 | + wp_redirect( self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto") ); |
|
79 | 83 | } |
80 | - wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); |
|
81 | - } else { |
|
82 | - wp_redirect( self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto") ); |
|
83 | - } |
|
84 | - exit; |
|
84 | + exit; |
|
85 | 85 | |
86 | -default: |
|
86 | + default: |
|
87 | 87 | |
88 | - if ( isset($_GET['liveupdate']) ) { |
|
89 | - check_admin_referer('edit-plugin-test_' . $file); |
|
88 | + if ( isset($_GET['liveupdate']) ) { |
|
89 | + check_admin_referer('edit-plugin-test_' . $file); |
|
90 | 90 | |
91 | - $error = validate_plugin($file); |
|
92 | - if ( is_wp_error($error) ) |
|
93 | - wp_die( $error ); |
|
91 | + $error = validate_plugin($file); |
|
92 | + if ( is_wp_error($error) ) |
|
93 | + wp_die( $error ); |
|
94 | 94 | |
95 | - if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) ) |
|
96 | - activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error |
|
95 | + if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) ) |
|
96 | + activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error |
|
97 | 97 | |
98 | - wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); |
|
99 | - exit; |
|
100 | - } |
|
98 | + wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); |
|
99 | + exit; |
|
100 | + } |
|
101 | 101 | |
102 | - // List of allowable extensions |
|
103 | - $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include'); |
|
102 | + // List of allowable extensions |
|
103 | + $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include'); |
|
104 | 104 | |
105 | - /** |
|
105 | + /** |
|
106 | 106 | * Filter file type extensions editable in the plugin editor. |
107 | 107 | * |
108 | 108 | * @since 2.8.0 |
109 | 109 | * |
110 | 110 | * @param array $editable_extensions An array of editable plugin file extensions. |
111 | 111 | */ |
112 | - $editable_extensions = (array) apply_filters( 'editable_extensions', $editable_extensions ); |
|
112 | + $editable_extensions = (array) apply_filters( 'editable_extensions', $editable_extensions ); |
|
113 | 113 | |
114 | - if ( ! is_file($real_file) ) { |
|
115 | - wp_die(sprintf('<p>%s</p>', __('No such file exists! Double check the name and try again.'))); |
|
116 | - } else { |
|
117 | - // Get the extension of the file |
|
118 | - if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) { |
|
119 | - $ext = strtolower($matches[1]); |
|
120 | - // If extension is not in the acceptable list, skip it |
|
121 | - if ( !in_array( $ext, $editable_extensions) ) |
|
122 | - wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.'))); |
|
114 | + if ( ! is_file($real_file) ) { |
|
115 | + wp_die(sprintf('<p>%s</p>', __('No such file exists! Double check the name and try again.'))); |
|
116 | + } else { |
|
117 | + // Get the extension of the file |
|
118 | + if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) { |
|
119 | + $ext = strtolower($matches[1]); |
|
120 | + // If extension is not in the acceptable list, skip it |
|
121 | + if ( !in_array( $ext, $editable_extensions) ) |
|
122 | + wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.'))); |
|
123 | + } |
|
123 | 124 | } |
124 | - } |
|
125 | - |
|
126 | - get_current_screen()->add_help_tab( array( |
|
127 | - 'id' => 'overview', |
|
128 | - 'title' => __('Overview'), |
|
129 | - 'content' => |
|
130 | - '<p>' . __('You can use the editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.') . '</p>' . |
|
131 | - '<p>' . __('Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished.') . '</p>' . |
|
132 | - '<p>' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.') . '</p>' . |
|
133 | - '<p id="newcontent-description">' . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ) . '</p>' . |
|
134 | - '<p>' . __('If you want to make changes but don’t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '</p>' . |
|
135 | - ( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' ) |
|
136 | - ) ); |
|
137 | - |
|
138 | - get_current_screen()->set_help_sidebar( |
|
139 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
140 | - '<p>' . __('<a href="https://codex.wordpress.org/Plugins_Editor_Screen" target="_blank">Documentation on Editing Plugins</a>') . '</p>' . |
|
141 | - '<p>' . __('<a href="https://codex.wordpress.org/Writing_a_Plugin" target="_blank">Documentation on Writing Plugins</a>') . '</p>' . |
|
142 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
143 | - ); |
|
144 | - |
|
145 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
146 | - |
|
147 | - update_recently_edited(WP_PLUGIN_DIR . '/' . $file); |
|
148 | - |
|
149 | - $content = file_get_contents( $real_file ); |
|
150 | - |
|
151 | - if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) { |
|
152 | - $functions = wp_doc_link_parse( $content ); |
|
153 | - |
|
154 | - if ( !empty($functions) ) { |
|
155 | - $docs_select = '<select name="docs-list" id="docs-list">'; |
|
156 | - $docs_select .= '<option value="">' . __( 'Function Name…' ) . '</option>'; |
|
157 | - foreach ( $functions as $function) { |
|
158 | - $docs_select .= '<option value="' . esc_attr( $function ) . '">' . esc_html( $function ) . '()</option>'; |
|
125 | + |
|
126 | + get_current_screen()->add_help_tab( array( |
|
127 | + 'id' => 'overview', |
|
128 | + 'title' => __('Overview'), |
|
129 | + 'content' => |
|
130 | + '<p>' . __('You can use the editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.') . '</p>' . |
|
131 | + '<p>' . __('Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished.') . '</p>' . |
|
132 | + '<p>' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.') . '</p>' . |
|
133 | + '<p id="newcontent-description">' . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ) . '</p>' . |
|
134 | + '<p>' . __('If you want to make changes but don’t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '</p>' . |
|
135 | + ( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' ) |
|
136 | + ) ); |
|
137 | + |
|
138 | + get_current_screen()->set_help_sidebar( |
|
139 | + '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
140 | + '<p>' . __('<a href="https://codex.wordpress.org/Plugins_Editor_Screen" target="_blank">Documentation on Editing Plugins</a>') . '</p>' . |
|
141 | + '<p>' . __('<a href="https://codex.wordpress.org/Writing_a_Plugin" target="_blank">Documentation on Writing Plugins</a>') . '</p>' . |
|
142 | + '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
143 | + ); |
|
144 | + |
|
145 | + require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
146 | + |
|
147 | + update_recently_edited(WP_PLUGIN_DIR . '/' . $file); |
|
148 | + |
|
149 | + $content = file_get_contents( $real_file ); |
|
150 | + |
|
151 | + if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) { |
|
152 | + $functions = wp_doc_link_parse( $content ); |
|
153 | + |
|
154 | + if ( !empty($functions) ) { |
|
155 | + $docs_select = '<select name="docs-list" id="docs-list">'; |
|
156 | + $docs_select .= '<option value="">' . __( 'Function Name…' ) . '</option>'; |
|
157 | + foreach ( $functions as $function) { |
|
158 | + $docs_select .= '<option value="' . esc_attr( $function ) . '">' . esc_html( $function ) . '()</option>'; |
|
159 | + } |
|
160 | + $docs_select .= '</select>'; |
|
159 | 161 | } |
160 | - $docs_select .= '</select>'; |
|
161 | 162 | } |
162 | - } |
|
163 | 163 | |
164 | - $content = esc_textarea( $content ); |
|
165 | - ?> |
|
166 | -<?php if (isset($_GET['a'])) : ?> |
|
167 | - <div id="message" class="updated notice is-dismissible"><p><?php _e('File edited successfully.') ?></p></div> |
|
168 | -<?php elseif (isset($_GET['phperror'])) : ?> |
|
169 | - <div id="message" class="updated"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p> |
|
164 | + $content = esc_textarea( $content ); |
|
165 | + ?> |
|
166 | + <?php if (isset($_GET['a'])) : ?> |
|
167 | + <div id="message" class="updated notice is-dismissible"><p><?php _e('File edited successfully.') ?></p></div> |
|
168 | + <?php elseif (isset($_GET['phperror'])) : ?> |
|
169 | + <div id="message" class="updated"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p> |
|
170 | 170 | <?php |
171 | - if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $file) ) { ?> |
|
172 | - <iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&plugin=<?php echo esc_attr($file); ?>&_wpnonce=<?php echo esc_attr($_GET['_error_nonce']); ?>"></iframe> |
|
171 | + if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $file) ) { ?> |
|
172 | + <iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&plugin=<?php echo esc_attr($file); ?>&_wpnonce=<?php echo esc_attr($_GET['_error_nonce']); ?>"></iframe> |
|
173 | 173 | <?php } ?> |
174 | -</div> |
|
175 | -<?php endif; ?> |
|
174 | + </div> |
|
175 | + <?php endif; ?> |
|
176 | 176 | <div class="wrap"> |
177 | 177 | <h1><?php echo esc_html( $title ); ?></h1> |
178 | 178 | |
179 | 179 | <div class="fileedit-sub"> |
180 | 180 | <div class="alignleft"> |
181 | 181 | <big><?php |
182 | - if ( is_plugin_active($plugin) ) { |
|
183 | - if ( is_writeable($real_file) ) |
|
184 | - echo sprintf(__('Editing <strong>%s</strong> (active)'), $file); |
|
185 | - else |
|
186 | - echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file); |
|
187 | - } else { |
|
188 | - if ( is_writeable($real_file) ) |
|
189 | - echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file); |
|
190 | - else |
|
191 | - echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file); |
|
192 | - } |
|
193 | - ?></big> |
|
182 | + if ( is_plugin_active($plugin) ) { |
|
183 | + if ( is_writeable($real_file) ) |
|
184 | + echo sprintf(__('Editing <strong>%s</strong> (active)'), $file); |
|
185 | + else |
|
186 | + echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file); |
|
187 | + } else { |
|
188 | + if ( is_writeable($real_file) ) |
|
189 | + echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file); |
|
190 | + else |
|
191 | + echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file); |
|
192 | + } |
|
193 | + ?></big> |
|
194 | 194 | </div> |
195 | 195 | <div class="alignright"> |
196 | 196 | <form action="plugin-editor.php" method="post"> |
197 | 197 | <strong><label for="plugin"><?php _e('Select plugin to edit:'); ?> </label></strong> |
198 | 198 | <select name="plugin" id="plugin"> |
199 | 199 | <?php |
200 | - foreach ( $plugins as $plugin_key => $a_plugin ) { |
|
201 | - $plugin_name = $a_plugin['Name']; |
|
202 | - if ( $plugin_key == $plugin ) |
|
203 | - $selected = " selected='selected'"; |
|
204 | - else |
|
205 | - $selected = ''; |
|
206 | - $plugin_name = esc_attr($plugin_name); |
|
207 | - $plugin_key = esc_attr($plugin_key); |
|
208 | - echo "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>"; |
|
209 | - } |
|
210 | -?> |
|
211 | - </select> |
|
200 | + foreach ( $plugins as $plugin_key => $a_plugin ) { |
|
201 | + $plugin_name = $a_plugin['Name']; |
|
202 | + if ( $plugin_key == $plugin ) |
|
203 | + $selected = " selected='selected'"; |
|
204 | + else |
|
205 | + $selected = ''; |
|
206 | + $plugin_name = esc_attr($plugin_name); |
|
207 | + $plugin_key = esc_attr($plugin_key); |
|
208 | + echo "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>"; |
|
209 | + } |
|
210 | + ?> |
|
211 | + </select> |
|
212 | 212 | <?php submit_button( __( 'Select' ), 'button', 'Submit', false ); ?> |
213 | 213 | </form> |
214 | 214 | </div> |
@@ -220,50 +220,50 @@ discard block |
||
220 | 220 | |
221 | 221 | <ul> |
222 | 222 | <?php |
223 | -foreach ( $plugin_files as $plugin_file ) : |
|
224 | - // Get the extension of the file |
|
225 | - if ( preg_match('/\.([^.]+)$/', $plugin_file, $matches) ) { |
|
226 | - $ext = strtolower($matches[1]); |
|
227 | - // If extension is not in the acceptable list, skip it |
|
228 | - if ( !in_array( $ext, $editable_extensions ) ) |
|
223 | + foreach ( $plugin_files as $plugin_file ) : |
|
224 | + // Get the extension of the file |
|
225 | + if ( preg_match('/\.([^.]+)$/', $plugin_file, $matches) ) { |
|
226 | + $ext = strtolower($matches[1]); |
|
227 | + // If extension is not in the acceptable list, skip it |
|
228 | + if ( !in_array( $ext, $editable_extensions ) ) |
|
229 | + continue; |
|
230 | + } else { |
|
231 | + // No extension found |
|
229 | 232 | continue; |
230 | - } else { |
|
231 | - // No extension found |
|
232 | - continue; |
|
233 | - } |
|
234 | -?> |
|
235 | - <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&plugin=<?php echo urlencode( $plugin ) ?>"><?php echo $plugin_file ?></a></li> |
|
236 | -<?php endforeach; ?> |
|
233 | + } |
|
234 | + ?> |
|
235 | + <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&plugin=<?php echo urlencode( $plugin ) ?>"><?php echo $plugin_file ?></a></li> |
|
236 | + <?php endforeach; ?> |
|
237 | 237 | </ul> |
238 | 238 | </div> |
239 | 239 | <form name="template" id="template" action="plugin-editor.php" method="post"> |
240 | 240 | <?php wp_nonce_field('edit-plugin_' . $file) ?> |
241 | - <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea> |
|
241 | + <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea> |
|
242 | 242 | <input type="hidden" name="action" value="update" /> |
243 | 243 | <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" /> |
244 | 244 | <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" /> |
245 | 245 | <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> |
246 | 246 | </div> |
247 | 247 | <?php if ( !empty( $docs_select ) ) : ?> |
248 | - <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version ) ?>&redirect=true'); }" /></div> |
|
248 | + <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version ) ?>&redirect=true'); }" /></div> |
|
249 | 249 | <?php endif; ?> |
250 | -<?php if ( is_writeable($real_file) ) : ?> |
|
251 | - <?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?> |
|
252 | - <p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p> |
|
250 | + <?php if ( is_writeable($real_file) ) : ?> |
|
251 | + <?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?> |
|
252 | + <p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p> |
|
253 | 253 | <?php } ?> |
254 | - <p class="submit"> |
|
254 | + <p class="submit"> |
|
255 | 255 | <?php |
256 | - if ( isset($_GET['phperror']) ) { |
|
257 | - echo "<input type='hidden' name='phperror' value='1' />"; |
|
258 | - submit_button( __( 'Update File and Attempt to Reactivate' ), 'primary', 'submit', false ); |
|
259 | - } else { |
|
260 | - submit_button( __( 'Update File' ), 'primary', 'submit', false ); |
|
261 | - } |
|
262 | - ?> |
|
263 | - </p> |
|
264 | -<?php else : ?> |
|
265 | - <p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="https://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p> |
|
266 | -<?php endif; ?> |
|
256 | + if ( isset($_GET['phperror']) ) { |
|
257 | + echo "<input type='hidden' name='phperror' value='1' />"; |
|
258 | + submit_button( __( 'Update File and Attempt to Reactivate' ), 'primary', 'submit', false ); |
|
259 | + } else { |
|
260 | + submit_button( __( 'Update File' ), 'primary', 'submit', false ); |
|
261 | + } |
|
262 | + ?> |
|
263 | + </p> |
|
264 | + <?php else : ?> |
|
265 | + <p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="https://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p> |
|
266 | + <?php endif; ?> |
|
267 | 267 | </form> |
268 | 268 | <br class="clear" /> |
269 | 269 | </div> |
@@ -274,6 +274,6 @@ discard block |
||
274 | 274 | }); |
275 | 275 | </script> |
276 | 276 | <?php |
277 | - break; |
|
277 | + break; |
|
278 | 278 | } |
279 | 279 | include(ABSPATH . "wp-admin/admin-footer.php"); |
@@ -7,95 +7,95 @@ 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 ( is_multisite() && ! is_network_admin() ) { |
|
13 | - wp_redirect( network_admin_url( 'plugin-editor.php' ) ); |
|
12 | +if (is_multisite() && ! is_network_admin()) { |
|
13 | + wp_redirect(network_admin_url('plugin-editor.php')); |
|
14 | 14 | exit(); |
15 | 15 | } |
16 | 16 | |
17 | -if ( !current_user_can('edit_plugins') ) |
|
18 | - wp_die( __('You do not have sufficient permissions to edit plugins for this site.') ); |
|
17 | +if ( ! current_user_can('edit_plugins')) |
|
18 | + wp_die(__('You do not have sufficient permissions to edit plugins for this site.')); |
|
19 | 19 | |
20 | 20 | $title = __("Edit Plugins"); |
21 | 21 | $parent_file = 'plugins.php'; |
22 | 22 | |
23 | -wp_reset_vars( array( 'action', 'error', 'file', 'plugin' ) ); |
|
23 | +wp_reset_vars(array('action', 'error', 'file', 'plugin')); |
|
24 | 24 | |
25 | 25 | $plugins = get_plugins(); |
26 | 26 | |
27 | -if ( empty( $plugins ) ) { |
|
28 | - include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
27 | +if (empty($plugins)) { |
|
28 | + include(ABSPATH.'wp-admin/admin-header.php'); |
|
29 | 29 | ?> |
30 | 30 | <div class="wrap"> |
31 | - <h1><?php echo esc_html( $title ); ?></h1> |
|
32 | - <div id="message" class="error"><p><?php _e( 'You do not appear to have any plugins available at this time.' ); ?></p></div> |
|
31 | + <h1><?php echo esc_html($title); ?></h1> |
|
32 | + <div id="message" class="error"><p><?php _e('You do not appear to have any plugins available at this time.'); ?></p></div> |
|
33 | 33 | </div> |
34 | 34 | <?php |
35 | - include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
35 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
36 | 36 | exit; |
37 | 37 | } |
38 | 38 | |
39 | -if ( $file ) { |
|
39 | +if ($file) { |
|
40 | 40 | $plugin = $file; |
41 | -} elseif ( empty( $plugin ) ) { |
|
41 | +} elseif (empty($plugin)) { |
|
42 | 42 | $plugin = array_keys($plugins); |
43 | 43 | $plugin = $plugin[0]; |
44 | 44 | } |
45 | 45 | |
46 | 46 | $plugin_files = get_plugin_files($plugin); |
47 | 47 | |
48 | -if ( empty($file) ) |
|
48 | +if (empty($file)) |
|
49 | 49 | $file = $plugin_files[0]; |
50 | 50 | |
51 | 51 | $file = validate_file_to_edit($file, $plugin_files); |
52 | -$real_file = WP_PLUGIN_DIR . '/' . $file; |
|
52 | +$real_file = WP_PLUGIN_DIR.'/'.$file; |
|
53 | 53 | $scrollto = isset($_REQUEST['scrollto']) ? (int) $_REQUEST['scrollto'] : 0; |
54 | 54 | |
55 | -switch ( $action ) { |
|
55 | +switch ($action) { |
|
56 | 56 | |
57 | 57 | case 'update': |
58 | 58 | |
59 | - check_admin_referer('edit-plugin_' . $file); |
|
59 | + check_admin_referer('edit-plugin_'.$file); |
|
60 | 60 | |
61 | - $newcontent = wp_unslash( $_POST['newcontent'] ); |
|
62 | - if ( is_writeable($real_file) ) { |
|
61 | + $newcontent = wp_unslash($_POST['newcontent']); |
|
62 | + if (is_writeable($real_file)) { |
|
63 | 63 | $f = fopen($real_file, 'w+'); |
64 | 64 | fwrite($f, $newcontent); |
65 | 65 | fclose($f); |
66 | 66 | |
67 | - $network_wide = is_plugin_active_for_network( $file ); |
|
67 | + $network_wide = is_plugin_active_for_network($file); |
|
68 | 68 | |
69 | 69 | // Deactivate so we can test it. |
70 | - if ( is_plugin_active($file) || isset($_POST['phperror']) ) { |
|
71 | - if ( is_plugin_active($file) ) |
|
70 | + if (is_plugin_active($file) || isset($_POST['phperror'])) { |
|
71 | + if (is_plugin_active($file)) |
|
72 | 72 | deactivate_plugins($file, true); |
73 | 73 | |
74 | - if ( ! is_network_admin() ) |
|
75 | - update_option( 'recently_activated', array( $file => time() ) + (array) get_option( 'recently_activated' ) ); |
|
74 | + if ( ! is_network_admin()) |
|
75 | + update_option('recently_activated', array($file => time()) + (array) get_option('recently_activated')); |
|
76 | 76 | |
77 | - wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide)); |
|
77 | + wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_'.$file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=".$network_wide)); |
|
78 | 78 | exit; |
79 | 79 | } |
80 | - wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); |
|
80 | + wp_redirect(self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto")); |
|
81 | 81 | } else { |
82 | - wp_redirect( self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto") ); |
|
82 | + wp_redirect(self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto")); |
|
83 | 83 | } |
84 | 84 | exit; |
85 | 85 | |
86 | 86 | default: |
87 | 87 | |
88 | - if ( isset($_GET['liveupdate']) ) { |
|
89 | - check_admin_referer('edit-plugin-test_' . $file); |
|
88 | + if (isset($_GET['liveupdate'])) { |
|
89 | + check_admin_referer('edit-plugin-test_'.$file); |
|
90 | 90 | |
91 | 91 | $error = validate_plugin($file); |
92 | - if ( is_wp_error($error) ) |
|
93 | - wp_die( $error ); |
|
92 | + if (is_wp_error($error)) |
|
93 | + wp_die($error); |
|
94 | 94 | |
95 | - if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) ) |
|
96 | - activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error |
|
95 | + if (( ! empty($_GET['networkwide']) && ! is_plugin_active_for_network($file)) || ! is_plugin_active($file)) |
|
96 | + activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty($_GET['networkwide'])); // we'll override this later if the plugin can be included without fatal error |
|
97 | 97 | |
98 | - wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); |
|
98 | + wp_redirect(self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto")); |
|
99 | 99 | exit; |
100 | 100 | } |
101 | 101 | |
@@ -109,83 +109,83 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @param array $editable_extensions An array of editable plugin file extensions. |
111 | 111 | */ |
112 | - $editable_extensions = (array) apply_filters( 'editable_extensions', $editable_extensions ); |
|
112 | + $editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions); |
|
113 | 113 | |
114 | - if ( ! is_file($real_file) ) { |
|
114 | + if ( ! is_file($real_file)) { |
|
115 | 115 | wp_die(sprintf('<p>%s</p>', __('No such file exists! Double check the name and try again.'))); |
116 | 116 | } else { |
117 | 117 | // Get the extension of the file |
118 | - if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) { |
|
118 | + if (preg_match('/\.([^.]+)$/', $real_file, $matches)) { |
|
119 | 119 | $ext = strtolower($matches[1]); |
120 | 120 | // If extension is not in the acceptable list, skip it |
121 | - if ( !in_array( $ext, $editable_extensions) ) |
|
121 | + if ( ! in_array($ext, $editable_extensions)) |
|
122 | 122 | wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.'))); |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - get_current_screen()->add_help_tab( array( |
|
126 | + get_current_screen()->add_help_tab(array( |
|
127 | 127 | 'id' => 'overview', |
128 | 128 | 'title' => __('Overview'), |
129 | 129 | 'content' => |
130 | - '<p>' . __('You can use the editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.') . '</p>' . |
|
131 | - '<p>' . __('Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished.') . '</p>' . |
|
132 | - '<p>' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.') . '</p>' . |
|
133 | - '<p id="newcontent-description">' . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ) . '</p>' . |
|
134 | - '<p>' . __('If you want to make changes but don’t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '</p>' . |
|
135 | - ( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' ) |
|
136 | - ) ); |
|
130 | + '<p>'.__('You can use the editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.').'</p>'. |
|
131 | + '<p>'.__('Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished.').'</p>'. |
|
132 | + '<p>'.__('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.').'</p>'. |
|
133 | + '<p id="newcontent-description">'.__('In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.').'</p>'. |
|
134 | + '<p>'.__('If you want to make changes but don’t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.').'</p>'. |
|
135 | + (is_network_admin() ? '<p>'.__('Any edits to files from this screen will be reflected on all sites in the network.').'</p>' : '') |
|
136 | + )); |
|
137 | 137 | |
138 | 138 | get_current_screen()->set_help_sidebar( |
139 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
140 | - '<p>' . __('<a href="https://codex.wordpress.org/Plugins_Editor_Screen" target="_blank">Documentation on Editing Plugins</a>') . '</p>' . |
|
141 | - '<p>' . __('<a href="https://codex.wordpress.org/Writing_a_Plugin" target="_blank">Documentation on Writing Plugins</a>') . '</p>' . |
|
142 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
139 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
140 | + '<p>'.__('<a href="https://codex.wordpress.org/Plugins_Editor_Screen" target="_blank">Documentation on Editing Plugins</a>').'</p>'. |
|
141 | + '<p>'.__('<a href="https://codex.wordpress.org/Writing_a_Plugin" target="_blank">Documentation on Writing Plugins</a>').'</p>'. |
|
142 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
143 | 143 | ); |
144 | 144 | |
145 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
145 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
146 | 146 | |
147 | - update_recently_edited(WP_PLUGIN_DIR . '/' . $file); |
|
147 | + update_recently_edited(WP_PLUGIN_DIR.'/'.$file); |
|
148 | 148 | |
149 | - $content = file_get_contents( $real_file ); |
|
149 | + $content = file_get_contents($real_file); |
|
150 | 150 | |
151 | - if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) { |
|
152 | - $functions = wp_doc_link_parse( $content ); |
|
151 | + if ('.php' == substr($real_file, strrpos($real_file, '.'))) { |
|
152 | + $functions = wp_doc_link_parse($content); |
|
153 | 153 | |
154 | - if ( !empty($functions) ) { |
|
154 | + if ( ! empty($functions)) { |
|
155 | 155 | $docs_select = '<select name="docs-list" id="docs-list">'; |
156 | - $docs_select .= '<option value="">' . __( 'Function Name…' ) . '</option>'; |
|
157 | - foreach ( $functions as $function) { |
|
158 | - $docs_select .= '<option value="' . esc_attr( $function ) . '">' . esc_html( $function ) . '()</option>'; |
|
156 | + $docs_select .= '<option value="">'.__('Function Name…').'</option>'; |
|
157 | + foreach ($functions as $function) { |
|
158 | + $docs_select .= '<option value="'.esc_attr($function).'">'.esc_html($function).'()</option>'; |
|
159 | 159 | } |
160 | 160 | $docs_select .= '</select>'; |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - $content = esc_textarea( $content ); |
|
164 | + $content = esc_textarea($content); |
|
165 | 165 | ?> |
166 | 166 | <?php if (isset($_GET['a'])) : ?> |
167 | 167 | <div id="message" class="updated notice is-dismissible"><p><?php _e('File edited successfully.') ?></p></div> |
168 | 168 | <?php elseif (isset($_GET['phperror'])) : ?> |
169 | 169 | <div id="message" class="updated"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p> |
170 | 170 | <?php |
171 | - if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $file) ) { ?> |
|
171 | + if (wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_'.$file)) { ?> |
|
172 | 172 | <iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&plugin=<?php echo esc_attr($file); ?>&_wpnonce=<?php echo esc_attr($_GET['_error_nonce']); ?>"></iframe> |
173 | 173 | <?php } ?> |
174 | 174 | </div> |
175 | 175 | <?php endif; ?> |
176 | 176 | <div class="wrap"> |
177 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
177 | +<h1><?php echo esc_html($title); ?></h1> |
|
178 | 178 | |
179 | 179 | <div class="fileedit-sub"> |
180 | 180 | <div class="alignleft"> |
181 | 181 | <big><?php |
182 | - if ( is_plugin_active($plugin) ) { |
|
183 | - if ( is_writeable($real_file) ) |
|
182 | + if (is_plugin_active($plugin)) { |
|
183 | + if (is_writeable($real_file)) |
|
184 | 184 | echo sprintf(__('Editing <strong>%s</strong> (active)'), $file); |
185 | 185 | else |
186 | 186 | echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file); |
187 | 187 | } else { |
188 | - if ( is_writeable($real_file) ) |
|
188 | + if (is_writeable($real_file)) |
|
189 | 189 | echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file); |
190 | 190 | else |
191 | 191 | echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file); |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | <strong><label for="plugin"><?php _e('Select plugin to edit:'); ?> </label></strong> |
198 | 198 | <select name="plugin" id="plugin"> |
199 | 199 | <?php |
200 | - foreach ( $plugins as $plugin_key => $a_plugin ) { |
|
200 | + foreach ($plugins as $plugin_key => $a_plugin) { |
|
201 | 201 | $plugin_name = $a_plugin['Name']; |
202 | - if ( $plugin_key == $plugin ) |
|
202 | + if ($plugin_key == $plugin) |
|
203 | 203 | $selected = " selected='selected'"; |
204 | 204 | else |
205 | 205 | $selected = ''; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | ?> |
211 | 211 | </select> |
212 | - <?php submit_button( __( 'Select' ), 'button', 'Submit', false ); ?> |
|
212 | + <?php submit_button(__('Select'), 'button', 'Submit', false); ?> |
|
213 | 213 | </form> |
214 | 214 | </div> |
215 | 215 | <br class="clear" /> |
@@ -220,44 +220,44 @@ discard block |
||
220 | 220 | |
221 | 221 | <ul> |
222 | 222 | <?php |
223 | -foreach ( $plugin_files as $plugin_file ) : |
|
223 | +foreach ($plugin_files as $plugin_file) : |
|
224 | 224 | // Get the extension of the file |
225 | - if ( preg_match('/\.([^.]+)$/', $plugin_file, $matches) ) { |
|
225 | + if (preg_match('/\.([^.]+)$/', $plugin_file, $matches)) { |
|
226 | 226 | $ext = strtolower($matches[1]); |
227 | 227 | // If extension is not in the acceptable list, skip it |
228 | - if ( !in_array( $ext, $editable_extensions ) ) |
|
228 | + if ( ! in_array($ext, $editable_extensions)) |
|
229 | 229 | continue; |
230 | 230 | } else { |
231 | 231 | // No extension found |
232 | 232 | continue; |
233 | 233 | } |
234 | 234 | ?> |
235 | - <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&plugin=<?php echo urlencode( $plugin ) ?>"><?php echo $plugin_file ?></a></li> |
|
235 | + <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode($plugin_file) ?>&plugin=<?php echo urlencode($plugin) ?>"><?php echo $plugin_file ?></a></li> |
|
236 | 236 | <?php endforeach; ?> |
237 | 237 | </ul> |
238 | 238 | </div> |
239 | 239 | <form name="template" id="template" action="plugin-editor.php" method="post"> |
240 | - <?php wp_nonce_field('edit-plugin_' . $file) ?> |
|
240 | + <?php wp_nonce_field('edit-plugin_'.$file) ?> |
|
241 | 241 | <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea> |
242 | 242 | <input type="hidden" name="action" value="update" /> |
243 | 243 | <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" /> |
244 | 244 | <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" /> |
245 | 245 | <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> |
246 | 246 | </div> |
247 | - <?php if ( !empty( $docs_select ) ) : ?> |
|
248 | - <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version ) ?>&redirect=true'); }" /></div> |
|
247 | + <?php if ( ! empty($docs_select)) : ?> |
|
248 | + <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e('Look Up') ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode(get_locale()) ?>&version=<?php echo urlencode($wp_version) ?>&redirect=true'); }" /></div> |
|
249 | 249 | <?php endif; ?> |
250 | -<?php if ( is_writeable($real_file) ) : ?> |
|
251 | - <?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?> |
|
250 | +<?php if (is_writeable($real_file)) : ?> |
|
251 | + <?php if (in_array($file, (array) get_option('active_plugins', array()))) { ?> |
|
252 | 252 | <p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p> |
253 | 253 | <?php } ?> |
254 | 254 | <p class="submit"> |
255 | 255 | <?php |
256 | - if ( isset($_GET['phperror']) ) { |
|
256 | + if (isset($_GET['phperror'])) { |
|
257 | 257 | echo "<input type='hidden' name='phperror' value='1' />"; |
258 | - submit_button( __( 'Update File and Attempt to Reactivate' ), 'primary', 'submit', false ); |
|
258 | + submit_button(__('Update File and Attempt to Reactivate'), 'primary', 'submit', false); |
|
259 | 259 | } else { |
260 | - submit_button( __( 'Update File' ), 'primary', 'submit', false ); |
|
260 | + submit_button(__('Update File'), 'primary', 'submit', false); |
|
261 | 261 | } |
262 | 262 | ?> |
263 | 263 | </p> |
@@ -276,4 +276,4 @@ discard block |
||
276 | 276 | <?php |
277 | 277 | break; |
278 | 278 | } |
279 | -include(ABSPATH . "wp-admin/admin-footer.php"); |
|
279 | +include(ABSPATH."wp-admin/admin-footer.php"); |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | exit(); |
15 | 15 | } |
16 | 16 | |
17 | -if ( !current_user_can('edit_plugins') ) |
|
17 | +if ( !current_user_can('edit_plugins') ) { |
|
18 | 18 | wp_die( __('You do not have sufficient permissions to edit plugins for this site.') ); |
19 | +} |
|
19 | 20 | |
20 | 21 | $title = __("Edit Plugins"); |
21 | 22 | $parent_file = 'plugins.php'; |
@@ -45,8 +46,9 @@ discard block |
||
45 | 46 | |
46 | 47 | $plugin_files = get_plugin_files($plugin); |
47 | 48 | |
48 | -if ( empty($file) ) |
|
49 | +if ( empty($file) ) { |
|
49 | 50 | $file = $plugin_files[0]; |
51 | +} |
|
50 | 52 | |
51 | 53 | $file = validate_file_to_edit($file, $plugin_files); |
52 | 54 | $real_file = WP_PLUGIN_DIR . '/' . $file; |
@@ -68,11 +70,13 @@ discard block |
||
68 | 70 | |
69 | 71 | // Deactivate so we can test it. |
70 | 72 | if ( is_plugin_active($file) || isset($_POST['phperror']) ) { |
71 | - if ( is_plugin_active($file) ) |
|
72 | - deactivate_plugins($file, true); |
|
73 | + if ( is_plugin_active($file) ) { |
|
74 | + deactivate_plugins($file, true); |
|
75 | + } |
|
73 | 76 | |
74 | - if ( ! is_network_admin() ) |
|
75 | - update_option( 'recently_activated', array( $file => time() ) + (array) get_option( 'recently_activated' ) ); |
|
77 | + if ( ! is_network_admin() ) { |
|
78 | + update_option( 'recently_activated', array( $file => time() ) + (array) get_option( 'recently_activated' ) ); |
|
79 | + } |
|
76 | 80 | |
77 | 81 | wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide)); |
78 | 82 | exit; |
@@ -89,11 +93,14 @@ discard block |
||
89 | 93 | check_admin_referer('edit-plugin-test_' . $file); |
90 | 94 | |
91 | 95 | $error = validate_plugin($file); |
92 | - if ( is_wp_error($error) ) |
|
93 | - wp_die( $error ); |
|
96 | + if ( is_wp_error($error) ) { |
|
97 | + wp_die( $error ); |
|
98 | + } |
|
94 | 99 | |
95 | - if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) ) |
|
96 | - activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error |
|
100 | + if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) ) { |
|
101 | + activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); |
|
102 | + } |
|
103 | + // we'll override this later if the plugin can be included without fatal error |
|
97 | 104 | |
98 | 105 | wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); |
99 | 106 | exit; |
@@ -118,8 +125,9 @@ discard block |
||
118 | 125 | if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) { |
119 | 126 | $ext = strtolower($matches[1]); |
120 | 127 | // If extension is not in the acceptable list, skip it |
121 | - if ( !in_array( $ext, $editable_extensions) ) |
|
122 | - wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.'))); |
|
128 | + if ( !in_array( $ext, $editable_extensions) ) { |
|
129 | + wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.'))); |
|
130 | + } |
|
123 | 131 | } |
124 | 132 | } |
125 | 133 | |
@@ -180,15 +188,17 @@ discard block |
||
180 | 188 | <div class="alignleft"> |
181 | 189 | <big><?php |
182 | 190 | if ( is_plugin_active($plugin) ) { |
183 | - if ( is_writeable($real_file) ) |
|
184 | - echo sprintf(__('Editing <strong>%s</strong> (active)'), $file); |
|
185 | - else |
|
186 | - echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file); |
|
191 | + if ( is_writeable($real_file) ) { |
|
192 | + echo sprintf(__('Editing <strong>%s</strong> (active)'), $file); |
|
193 | + } else { |
|
194 | + echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file); |
|
195 | + } |
|
187 | 196 | } else { |
188 | - if ( is_writeable($real_file) ) |
|
189 | - echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file); |
|
190 | - else |
|
191 | - echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file); |
|
197 | + if ( is_writeable($real_file) ) { |
|
198 | + echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file); |
|
199 | + } else { |
|
200 | + echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file); |
|
201 | + } |
|
192 | 202 | } |
193 | 203 | ?></big> |
194 | 204 | </div> |
@@ -199,10 +209,11 @@ discard block |
||
199 | 209 | <?php |
200 | 210 | foreach ( $plugins as $plugin_key => $a_plugin ) { |
201 | 211 | $plugin_name = $a_plugin['Name']; |
202 | - if ( $plugin_key == $plugin ) |
|
203 | - $selected = " selected='selected'"; |
|
204 | - else |
|
205 | - $selected = ''; |
|
212 | + if ( $plugin_key == $plugin ) { |
|
213 | + $selected = " selected='selected'"; |
|
214 | + } else { |
|
215 | + $selected = ''; |
|
216 | + } |
|
206 | 217 | $plugin_name = esc_attr($plugin_name); |
207 | 218 | $plugin_key = esc_attr($plugin_key); |
208 | 219 | echo "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>"; |
@@ -225,8 +236,9 @@ discard block |
||
225 | 236 | if ( preg_match('/\.([^.]+)$/', $plugin_file, $matches) ) { |
226 | 237 | $ext = strtolower($matches[1]); |
227 | 238 | // If extension is not in the acceptable list, skip it |
228 | - if ( !in_array( $ext, $editable_extensions ) ) |
|
229 | - continue; |
|
239 | + if ( !in_array( $ext, $editable_extensions ) ) { |
|
240 | + continue; |
|
241 | + } |
|
230 | 242 | } else { |
231 | 243 | // No extension found |
232 | 244 | continue; |
@@ -261,8 +273,11 @@ discard block |
||
261 | 273 | } |
262 | 274 | ?> |
263 | 275 | </p> |
264 | -<?php else : ?> |
|
265 | - <p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="https://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p> |
|
276 | +<?php else { |
|
277 | + : ?> |
|
278 | + <p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="https://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); |
|
279 | +} |
|
280 | +?></em></p> |
|
266 | 281 | <?php endif; ?> |
267 | 282 | </form> |
268 | 283 | <br class="clear" /> |