66 * @type int $descendants_and_self ID of the category to output along with its descendants. |
66 * @type int $descendants_and_self ID of the category to output along with its descendants. |
67 * Default 0. |
67 * Default 0. |
68 * @type int[] $selected_cats Array of category IDs to mark as checked. Default false. |
68 * @type int[] $selected_cats Array of category IDs to mark as checked. Default false. |
69 * @type int[] $popular_cats Array of category IDs to receive the "popular-category" class. |
69 * @type int[] $popular_cats Array of category IDs to receive the "popular-category" class. |
70 * Default false. |
70 * Default false. |
71 * @type Walker $walker Walker object to use to build the output. |
71 * @type Walker $walker Walker object to use to build the output. Default empty which |
72 * Default is a Walker_Category_Checklist instance. |
72 * results in a Walker_Category_Checklist instance being used. |
73 * @type string $taxonomy Taxonomy to generate the checklist for. Default 'category'. |
73 * @type string $taxonomy Taxonomy to generate the checklist for. Default 'category'. |
74 * @type bool $checked_ontop Whether to move checked items out of the hierarchy and to |
74 * @type bool $checked_ontop Whether to move checked items out of the hierarchy and to |
75 * the top of the list. Default true. |
75 * the top of the list. Default true. |
76 * @type bool $echo Whether to echo the generated markup. False to return the markup instead |
76 * @type bool $echo Whether to echo the generated markup. False to return the markup instead |
77 * of echoing it. Default true. |
77 * of echoing it. Default true. |
94 * |
94 * |
95 * @since 3.4.0 |
95 * @since 3.4.0 |
96 * |
96 * |
97 * @see wp_terms_checklist() |
97 * @see wp_terms_checklist() |
98 * |
98 * |
99 * @param array $args An array of arguments. |
99 * @param array|string $args An array or string of arguments. |
100 * @param int $post_id The post ID. |
100 * @param int $post_id The post ID. |
101 */ |
101 */ |
102 $params = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); |
102 $params = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); |
103 |
103 |
104 $parsed_args = wp_parse_args( $params, $defaults ); |
104 $parsed_args = wp_parse_args( $params, $defaults ); |
105 |
105 |
189 |
189 |
190 return $output; |
190 return $output; |
191 } |
191 } |
192 |
192 |
193 /** |
193 /** |
194 * Retrieve a list of the most popular terms from the specified taxonomy. |
194 * Retrieves a list of the most popular terms from the specified taxonomy. |
195 * |
195 * |
196 * If the $echo argument is true then the elements for a list of checkbox |
196 * If the `$display` argument is true then the elements for a list of checkbox |
197 * `<input>` elements labelled with the names of the selected terms is output. |
197 * `<input>` elements labelled with the names of the selected terms is output. |
198 * If the $post_ID global isn't empty then the terms associated with that |
198 * If the `$post_ID` global is not empty then the terms associated with that |
199 * post will be marked as checked. |
199 * post will be marked as checked. |
200 * |
200 * |
201 * @since 2.5.0 |
201 * @since 2.5.0 |
202 * |
202 * |
203 * @param string $taxonomy Taxonomy to retrieve terms from. |
203 * @param string $taxonomy Taxonomy to retrieve terms from. |
204 * @param int $default Not used. |
204 * @param int $default_term Optional. Not used. |
205 * @param int $number Number of terms to retrieve. Defaults to 10. |
205 * @param int $number Optional. Number of terms to retrieve. Default 10. |
206 * @param bool $echo Optionally output the list as well. Defaults to true. |
206 * @param bool $display Optional. Whether to display the list as well. Default true. |
207 * @return int[] Array of popular term IDs. |
207 * @return int[] Array of popular term IDs. |
208 */ |
208 */ |
209 function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) { |
209 function wp_popular_terms_checklist( $taxonomy, $default_term = 0, $number = 10, $display = true ) { |
210 $post = get_post(); |
210 $post = get_post(); |
211 |
211 |
212 if ( $post && $post->ID ) { |
212 if ( $post && $post->ID ) { |
213 $checked_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); |
213 $checked_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); |
214 } else { |
214 } else { |
229 |
229 |
230 $popular_ids = array(); |
230 $popular_ids = array(); |
231 |
231 |
232 foreach ( (array) $terms as $term ) { |
232 foreach ( (array) $terms as $term ) { |
233 $popular_ids[] = $term->term_id; |
233 $popular_ids[] = $term->term_id; |
234 if ( ! $echo ) { // Hack for Ajax use. |
234 |
|
235 if ( ! $display ) { // Hack for Ajax use. |
235 continue; |
236 continue; |
236 } |
237 } |
|
238 |
237 $id = "popular-$taxonomy-$term->term_id"; |
239 $id = "popular-$taxonomy-$term->term_id"; |
238 $checked = in_array( $term->term_id, $checked_terms, true ) ? 'checked="checked"' : ''; |
240 $checked = in_array( $term->term_id, $checked_terms, true ) ? 'checked="checked"' : ''; |
239 ?> |
241 ?> |
240 |
242 |
241 <li id="<?php echo $id; ?>" class="popular-category"> |
243 <li id="<?php echo $id; ?>" class="popular-category"> |
342 $taxonomy_names = get_object_taxonomies( $post->post_type ); |
344 $taxonomy_names = get_object_taxonomies( $post->post_type ); |
343 |
345 |
344 foreach ( $taxonomy_names as $taxonomy_name ) { |
346 foreach ( $taxonomy_names as $taxonomy_name ) { |
345 $taxonomy = get_taxonomy( $taxonomy_name ); |
347 $taxonomy = get_taxonomy( $taxonomy_name ); |
346 |
348 |
347 if ( $taxonomy->hierarchical && $taxonomy->show_ui ) { |
349 if ( ! $taxonomy->show_in_quick_edit ) { |
|
350 continue; |
|
351 } |
|
352 |
|
353 if ( $taxonomy->hierarchical ) { |
348 |
354 |
349 $terms = get_object_term_cache( $post->ID, $taxonomy_name ); |
355 $terms = get_object_term_cache( $post->ID, $taxonomy_name ); |
350 if ( false === $terms ) { |
356 if ( false === $terms ) { |
351 $terms = wp_get_object_terms( $post->ID, $taxonomy_name ); |
357 $terms = wp_get_object_terms( $post->ID, $taxonomy_name ); |
352 wp_cache_add( $post->ID, wp_list_pluck( $terms, 'term_id' ), $taxonomy_name . '_relationships' ); |
358 wp_cache_add( $post->ID, wp_list_pluck( $terms, 'term_id' ), $taxonomy_name . '_relationships' ); |
353 } |
359 } |
354 $term_ids = empty( $terms ) ? array() : wp_list_pluck( $terms, 'term_id' ); |
360 $term_ids = empty( $terms ) ? array() : wp_list_pluck( $terms, 'term_id' ); |
355 |
361 |
356 echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' . implode( ',', $term_ids ) . '</div>'; |
362 echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' . implode( ',', $term_ids ) . '</div>'; |
357 |
363 |
358 } elseif ( $taxonomy->show_ui ) { |
364 } else { |
359 |
365 |
360 $terms_to_edit = get_terms_to_edit( $post->ID, $taxonomy_name ); |
366 $terms_to_edit = get_terms_to_edit( $post->ID, $taxonomy_name ); |
361 if ( ! is_string( $terms_to_edit ) ) { |
367 if ( ! is_string( $terms_to_edit ) ) { |
362 $terms_to_edit = ''; |
368 $terms_to_edit = ''; |
363 } |
369 } |
863 </p> |
869 </p> |
864 <?php |
870 <?php |
865 } |
871 } |
866 |
872 |
867 /** |
873 /** |
868 * Print out option HTML elements for the page templates drop-down. |
874 * Prints out option HTML elements for the page templates drop-down. |
869 * |
875 * |
870 * @since 1.5.0 |
876 * @since 1.5.0 |
871 * @since 4.7.0 Added the `$post_type` parameter. |
877 * @since 4.7.0 Added the `$post_type` parameter. |
872 * |
878 * |
873 * @param string $default Optional. The template file name. Default empty. |
879 * @param string $default_template Optional. The template file name. Default empty. |
874 * @param string $post_type Optional. Post type to get templates for. Default 'post'. |
880 * @param string $post_type Optional. Post type to get templates for. Default 'post'. |
875 */ |
881 */ |
876 function page_template_dropdown( $default = '', $post_type = 'page' ) { |
882 function page_template_dropdown( $default_template = '', $post_type = 'page' ) { |
877 $templates = get_page_templates( null, $post_type ); |
883 $templates = get_page_templates( null, $post_type ); |
878 |
884 |
879 ksort( $templates ); |
885 ksort( $templates ); |
880 |
886 |
881 foreach ( array_keys( $templates ) as $template ) { |
887 foreach ( array_keys( $templates ) as $template ) { |
882 $selected = selected( $default, $templates[ $template ], false ); |
888 $selected = selected( $default_template, $templates[ $template ], false ); |
883 echo "\n\t<option value='" . esc_attr( $templates[ $template ] ) . "' $selected>" . esc_html( $template ) . '</option>'; |
889 echo "\n\t<option value='" . esc_attr( $templates[ $template ] ) . "' $selected>" . esc_html( $template ) . '</option>'; |
884 } |
890 } |
885 } |
891 } |
886 |
892 |
887 /** |
893 /** |
888 * Print out option HTML elements for the page parents drop-down. |
894 * Prints out option HTML elements for the page parents drop-down. |
889 * |
895 * |
890 * @since 1.5.0 |
896 * @since 1.5.0 |
891 * @since 4.4.0 `$post` argument was added. |
897 * @since 4.4.0 `$post` argument was added. |
892 * |
898 * |
893 * @global wpdb $wpdb WordPress database abstraction object. |
899 * @global wpdb $wpdb WordPress database abstraction object. |
894 * |
900 * |
895 * @param int $default Optional. The default page ID to be pre-selected. Default 0. |
901 * @param int $default_page Optional. The default page ID to be pre-selected. Default 0. |
896 * @param int $parent Optional. The parent page ID. Default 0. |
902 * @param int $parent Optional. The parent page ID. Default 0. |
897 * @param int $level Optional. Page depth level. Default 0. |
903 * @param int $level Optional. Page depth level. Default 0. |
898 * @param int|WP_Post $post Post ID or WP_Post object. |
904 * @param int|WP_Post $post Post ID or WP_Post object. |
899 * @return void|false Void on success, false if the page has no children. |
905 * @return void|false Void on success, false if the page has no children. |
900 */ |
906 */ |
901 function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) { |
907 function parent_dropdown( $default_page = 0, $parent = 0, $level = 0, $post = null ) { |
902 global $wpdb; |
908 global $wpdb; |
903 |
909 |
904 $post = get_post( $post ); |
910 $post = get_post( $post ); |
905 $items = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent ) ); |
911 $items = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent ) ); |
906 |
912 |
910 if ( $post && $post->ID && (int) $item->ID === $post->ID ) { |
916 if ( $post && $post->ID && (int) $item->ID === $post->ID ) { |
911 continue; |
917 continue; |
912 } |
918 } |
913 |
919 |
914 $pad = str_repeat( ' ', $level * 3 ); |
920 $pad = str_repeat( ' ', $level * 3 ); |
915 $selected = selected( $default, $item->ID, false ); |
921 $selected = selected( $default_page, $item->ID, false ); |
916 |
922 |
917 echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad " . esc_html( $item->post_title ) . '</option>'; |
923 echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad " . esc_html( $item->post_title ) . '</option>'; |
918 parent_dropdown( $default, $item->ID, $level + 1 ); |
924 parent_dropdown( $default_page, $item->ID, $level + 1 ); |
919 } |
925 } |
920 } else { |
926 } else { |
921 return false; |
927 return false; |
922 } |
928 } |
923 } |
929 } |
924 |
930 |
925 /** |
931 /** |
926 * Print out option HTML elements for role selectors. |
932 * Prints out option HTML elements for role selectors. |
927 * |
933 * |
928 * @since 2.1.0 |
934 * @since 2.1.0 |
929 * |
935 * |
930 * @param string $selected Slug for the role that should be already selected. |
936 * @param string $selected Slug for the role that should be already selected. |
931 */ |
937 */ |
1117 ); |
1123 ); |
1118 } |
1124 } |
1119 |
1125 |
1120 |
1126 |
1121 /** |
1127 /** |
1122 * Function that renders a "fake" meta box with an information message, |
1128 * Renders a "fake" meta box with an information message, |
1123 * shown on the block editor, when an incompatible meta box is found. |
1129 * shown on the block editor, when an incompatible meta box is found. |
1124 * |
1130 * |
1125 * @since 5.0.0 |
1131 * @since 5.0.0 |
1126 * |
1132 * |
1127 * @param mixed $object The data object being rendered on this screen. |
1133 * @param mixed $data_object The data object being rendered on this screen. |
1128 * @param array $box { |
1134 * @param array $box { |
1129 * Custom formats meta box arguments. |
1135 * Custom formats meta box arguments. |
1130 * |
1136 * |
1131 * @type string $id Meta box 'id' attribute. |
1137 * @type string $id Meta box 'id' attribute. |
1132 * @type string $title Meta box title. |
1138 * @type string $title Meta box title. |
1133 * @type callable $old_callback The original callback for this meta box. |
1139 * @type callable $old_callback The original callback for this meta box. |
1134 * @type array $args Extra meta box arguments. |
1140 * @type array $args Extra meta box arguments. |
1135 * } |
1141 * } |
1136 */ |
1142 */ |
1137 function do_block_editor_incompatible_meta_box( $object, $box ) { |
1143 function do_block_editor_incompatible_meta_box( $data_object, $box ) { |
1138 $plugin = _get_plugin_from_callback( $box['old_callback'] ); |
1144 $plugin = _get_plugin_from_callback( $box['old_callback'] ); |
1139 $plugins = get_plugins(); |
1145 $plugins = get_plugins(); |
1140 echo '<p>'; |
1146 echo '<p>'; |
1141 if ( $plugin ) { |
1147 if ( $plugin ) { |
1142 /* translators: %s: The name of the plugin that generated this meta box. */ |
1148 /* translators: %s: The name of the plugin that generated this meta box. */ |
1143 printf( __( "This meta box, from the %s plugin, isn't compatible with the block editor." ), "<strong>{$plugin['Name']}</strong>" ); |
1149 printf( __( 'This meta box, from the %s plugin, is not compatible with the block editor.' ), "<strong>{$plugin['Name']}</strong>" ); |
1144 } else { |
1150 } else { |
1145 _e( "This meta box isn't compatible with the block editor." ); |
1151 _e( 'This meta box is not compatible with the block editor.' ); |
1146 } |
1152 } |
1147 echo '</p>'; |
1153 echo '</p>'; |
1148 |
1154 |
1149 if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) { |
1155 if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) { |
1150 if ( current_user_can( 'install_plugins' ) ) { |
1156 if ( current_user_can( 'install_plugins' ) ) { |
1168 echo '<p>'; |
1174 echo '<p>'; |
1169 /* translators: %s: A link to activate the Classic Editor plugin. */ |
1175 /* translators: %s: A link to activate the Classic Editor plugin. */ |
1170 printf( __( 'Please activate the <a href="%s">Classic Editor plugin</a> to use this meta box.' ), esc_url( $activate_url ) ); |
1176 printf( __( 'Please activate the <a href="%s">Classic Editor plugin</a> to use this meta box.' ), esc_url( $activate_url ) ); |
1171 echo '</p>'; |
1177 echo '</p>'; |
1172 } |
1178 } |
1173 } elseif ( $object instanceof WP_Post ) { |
1179 } elseif ( $data_object instanceof WP_Post ) { |
1174 $edit_url = add_query_arg( |
1180 $edit_url = add_query_arg( |
1175 array( |
1181 array( |
1176 'classic-editor' => '', |
1182 'classic-editor' => '', |
1177 'classic-editor__forget' => '', |
1183 'classic-editor__forget' => '', |
1178 ), |
1184 ), |
1179 get_edit_post_link( $object ) |
1185 get_edit_post_link( $data_object ) |
1180 ); |
1186 ); |
1181 echo '<p>'; |
1187 echo '<p>'; |
1182 /* translators: %s: A link to use the Classic Editor plugin. */ |
1188 /* translators: %s: A link to use the Classic Editor plugin. */ |
1183 printf( __( 'Please open the <a href="%s">classic editor</a> to use this meta box.' ), esc_url( $edit_url ) ); |
1189 printf( __( 'Please open the <a href="%s">classic editor</a> to use this meta box.' ), esc_url( $edit_url ) ); |
1184 echo '</p>'; |
1190 echo '</p>'; |
1238 * |
1244 * |
1239 * @since 2.5.0 |
1245 * @since 2.5.0 |
1240 * |
1246 * |
1241 * @global array $wp_meta_boxes |
1247 * @global array $wp_meta_boxes |
1242 * |
1248 * |
1243 * @param string|WP_Screen $screen The screen identifier. If you have used add_menu_page() or |
1249 * @param string|WP_Screen $screen The screen identifier. If you have used add_menu_page() or |
1244 * add_submenu_page() to create a new screen (and hence screen_id) |
1250 * add_submenu_page() to create a new screen (and hence screen_id) |
1245 * make sure your menu slug conforms to the limits of sanitize_key() |
1251 * make sure your menu slug conforms to the limits of sanitize_key() |
1246 * otherwise the 'screen' menu may not correctly render on your page. |
1252 * otherwise the 'screen' menu may not correctly render on your page. |
1247 * @param string $context The screen context for which to display meta boxes. |
1253 * @param string $context The screen context for which to display meta boxes. |
1248 * @param mixed $object Gets passed to the meta box callback function as the first parameter. |
1254 * @param mixed $data_object Gets passed to the meta box callback function as the first parameter. |
1249 * Often this is the object that's the focus of the current screen, for |
1255 * Often this is the object that's the focus of the current screen, |
1250 * example a `WP_Post` or `WP_Comment` object. |
1256 * for example a `WP_Post` or `WP_Comment` object. |
1251 * @return int Number of meta_boxes. |
1257 * @return int Number of meta_boxes. |
1252 */ |
1258 */ |
1253 function do_meta_boxes( $screen, $context, $object ) { |
1259 function do_meta_boxes( $screen, $context, $data_object ) { |
1254 global $wp_meta_boxes; |
1260 global $wp_meta_boxes; |
1255 static $already_sorted = false; |
1261 static $already_sorted = false; |
1256 |
1262 |
1257 if ( empty( $screen ) ) { |
1263 if ( empty( $screen ) ) { |
1258 $screen = get_current_screen(); |
1264 $screen = get_current_screen(); |
1382 ?> |
1388 ?> |
1383 <div class="error inline"> |
1389 <div class="error inline"> |
1384 <p> |
1390 <p> |
1385 <?php |
1391 <?php |
1386 /* translators: %s: The name of the plugin that generated this meta box. */ |
1392 /* translators: %s: The name of the plugin that generated this meta box. */ |
1387 printf( __( "This meta box, from the %s plugin, isn't compatible with the block editor." ), "<strong>{$plugin['Name']}</strong>" ); |
1393 printf( __( 'This meta box, from the %s plugin, is not compatible with the block editor.' ), "<strong>{$plugin['Name']}</strong>" ); |
1388 ?> |
1394 ?> |
1389 </p> |
1395 </p> |
1390 </div> |
1396 </div> |
1391 <?php |
1397 <?php |
1392 } |
1398 } |
1393 } |
1399 } |
1394 |
1400 |
1395 call_user_func( $box['callback'], $object, $box ); |
1401 call_user_func( $box['callback'], $data_object, $box ); |
1396 echo "</div>\n"; |
1402 echo "</div>\n"; |
1397 echo "</div>\n"; |
1403 echo "</div>\n"; |
1398 } |
1404 } |
1399 } |
1405 } |
1400 } |
1406 } |
1467 * |
1473 * |
1468 * @since 3.6.0 |
1474 * @since 3.6.0 |
1469 * |
1475 * |
1470 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes. |
1476 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes. |
1471 * |
1477 * |
1472 * @param string|object $screen The screen identifier. |
1478 * @param string|object $screen The screen identifier. |
1473 * @param string $context The screen context for which to display accordion sections. |
1479 * @param string $context The screen context for which to display accordion sections. |
1474 * @param mixed $object Gets passed to the section callback function as the first parameter. |
1480 * @param mixed $data_object Gets passed to the section callback function as the first parameter. |
1475 * @return int Number of meta boxes as accordion sections. |
1481 * @return int Number of meta boxes as accordion sections. |
1476 */ |
1482 */ |
1477 function do_accordion_sections( $screen, $context, $object ) { |
1483 function do_accordion_sections( $screen, $context, $data_object ) { |
1478 global $wp_meta_boxes; |
1484 global $wp_meta_boxes; |
1479 |
1485 |
1480 wp_enqueue_script( 'accordion' ); |
1486 wp_enqueue_script( 'accordion' ); |
1481 |
1487 |
1482 if ( empty( $screen ) ) { |
1488 if ( empty( $screen ) ) { |
1517 <?php echo esc_html( $box['title'] ); ?> |
1523 <?php echo esc_html( $box['title'] ); ?> |
1518 <span class="screen-reader-text"><?php _e( 'Press return or enter to open this section' ); ?></span> |
1524 <span class="screen-reader-text"><?php _e( 'Press return or enter to open this section' ); ?></span> |
1519 </h3> |
1525 </h3> |
1520 <div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>"> |
1526 <div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>"> |
1521 <div class="inside"> |
1527 <div class="inside"> |
1522 <?php call_user_func( $box['callback'], $object, $box ); ?> |
1528 <?php call_user_func( $box['callback'], $data_object, $box ); ?> |
1523 </div><!-- .inside --> |
1529 </div><!-- .inside --> |
1524 </div><!-- .accordion-section-content --> |
1530 </div><!-- .accordion-section-content --> |
1525 </li><!-- .accordion-section --> |
1531 </li><!-- .accordion-section --> |
1526 <?php |
1532 <?php |
1527 } |
1533 } |
1592 'callback' => $callback, |
1598 'callback' => $callback, |
1593 ); |
1599 ); |
1594 } |
1600 } |
1595 |
1601 |
1596 /** |
1602 /** |
1597 * Add a new field to a section of a settings page. |
1603 * Adds a new field to a section of a settings page. |
1598 * |
1604 * |
1599 * Part of the Settings API. Use this to define a settings field that will show |
1605 * Part of the Settings API. Use this to define a settings field that will show |
1600 * as part of a settings section inside a settings page. The fields are shown using |
1606 * as part of a settings section inside a settings page. The fields are shown using |
1601 * do_settings_fields() in do_settings_sections(). |
1607 * do_settings_fields() in do_settings_sections(). |
1602 * |
1608 * |
2029 <title><?php bloginfo( 'name' ); ?> › <?php echo $title; ?> — <?php _e( 'WordPress' ); ?></title> |
2035 <title><?php bloginfo( 'name' ); ?> › <?php echo $title; ?> — <?php _e( 'WordPress' ); ?></title> |
2030 <?php |
2036 <?php |
2031 wp_enqueue_style( 'colors' ); |
2037 wp_enqueue_style( 'colors' ); |
2032 ?> |
2038 ?> |
2033 <script type="text/javascript"> |
2039 <script type="text/javascript"> |
2034 addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(document).ready(func);else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; |
2040 addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; |
2035 function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();} |
2041 function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();} |
2036 var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', |
2042 var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', |
2037 pagenow = '<?php echo esc_js( $current_screen->id ); ?>', |
2043 pagenow = '<?php echo esc_js( $current_screen->id ); ?>', |
2038 typenow = '<?php echo esc_js( $current_screen->post_type ); ?>', |
2044 typenow = '<?php echo esc_js( $current_screen->post_type ); ?>', |
2039 adminpage = '<?php echo esc_js( $admin_body_class ); ?>', |
2045 adminpage = '<?php echo esc_js( $admin_body_class ); ?>', |
2126 </html> |
2132 </html> |
2127 <?php |
2133 <?php |
2128 } |
2134 } |
2129 |
2135 |
2130 /** |
2136 /** |
2131 * Function to echo or return the post states as HTML. |
2137 * Echoes or returns the post states as HTML. |
2132 * |
2138 * |
2133 * @since 2.7.0 |
2139 * @since 2.7.0 |
2134 * @since 5.3.0 Added the `$echo` parameter and a return value. |
2140 * @since 5.3.0 Added the `$display` parameter and a return value. |
2135 * |
2141 * |
2136 * @see get_post_states() |
2142 * @see get_post_states() |
2137 * |
2143 * |
2138 * @param WP_Post $post The post to retrieve states for. |
2144 * @param WP_Post $post The post to retrieve states for. |
2139 * @param bool $echo Optional. Whether to echo the post states as an HTML string. Default true. |
2145 * @param bool $display Optional. Whether to display the post states as an HTML string. |
|
2146 * Default true. |
2140 * @return string Post states string. |
2147 * @return string Post states string. |
2141 */ |
2148 */ |
2142 function _post_states( $post, $echo = true ) { |
2149 function _post_states( $post, $display = true ) { |
2143 $post_states = get_post_states( $post ); |
2150 $post_states = get_post_states( $post ); |
2144 $post_states_string = ''; |
2151 $post_states_string = ''; |
2145 |
2152 |
2146 if ( ! empty( $post_states ) ) { |
2153 if ( ! empty( $post_states ) ) { |
2147 $state_count = count( $post_states ); |
2154 $state_count = count( $post_states ); |
2148 $i = 0; |
2155 |
|
2156 $i = 0; |
2149 |
2157 |
2150 $post_states_string .= ' — '; |
2158 $post_states_string .= ' — '; |
2151 |
2159 |
2152 foreach ( $post_states as $state ) { |
2160 foreach ( $post_states as $state ) { |
2153 $sep = ( ++$i === $state_count ) ? '' : ', '; |
2161 ++$i; |
|
2162 |
|
2163 $sep = ( $i < $state_count ) ? ', ' : ''; |
2154 |
2164 |
2155 $post_states_string .= "<span class='post-state'>$state$sep</span>"; |
2165 $post_states_string .= "<span class='post-state'>$state$sep</span>"; |
2156 } |
2166 } |
2157 } |
2167 } |
2158 |
2168 |
2159 if ( $echo ) { |
2169 if ( $display ) { |
2160 echo $post_states_string; |
2170 echo $post_states_string; |
2161 } |
2171 } |
2162 |
2172 |
2163 return $post_states_string; |
2173 return $post_states_string; |
2164 } |
2174 } |
2241 |
2251 |
2242 /** |
2252 /** |
2243 * Outputs the attachment media states as HTML. |
2253 * Outputs the attachment media states as HTML. |
2244 * |
2254 * |
2245 * @since 3.2.0 |
2255 * @since 3.2.0 |
2246 * @since 5.6.0 Added the `$echo` parameter and a return value. |
2256 * @since 5.6.0 Added the `$display` parameter and a return value. |
2247 * |
2257 * |
2248 * @param WP_Post $post The attachment post to retrieve states for. |
2258 * @param WP_Post $post The attachment post to retrieve states for. |
2249 * @param bool $echo Optional. Whether to echo the post states as an HTML string. Default true. |
2259 * @param bool $display Optional. Whether to display the post states as an HTML string. |
|
2260 * Default true. |
2250 * @return string Media states string. |
2261 * @return string Media states string. |
2251 */ |
2262 */ |
2252 function _media_states( $post, $echo = true ) { |
2263 function _media_states( $post, $display = true ) { |
2253 $media_states = get_media_states( $post ); |
2264 $media_states = get_media_states( $post ); |
2254 $media_states_string = ''; |
2265 $media_states_string = ''; |
2255 |
2266 |
2256 if ( ! empty( $media_states ) ) { |
2267 if ( ! empty( $media_states ) ) { |
2257 $state_count = count( $media_states ); |
2268 $state_count = count( $media_states ); |
2258 $i = 0; |
2269 |
|
2270 $i = 0; |
2259 |
2271 |
2260 $media_states_string .= ' — '; |
2272 $media_states_string .= ' — '; |
2261 |
2273 |
2262 foreach ( $media_states as $state ) { |
2274 foreach ( $media_states as $state ) { |
2263 $sep = ( ++$i === $state_count ) ? '' : ', '; |
2275 ++$i; |
|
2276 |
|
2277 $sep = ( $i < $state_count ) ? ', ' : ''; |
2264 |
2278 |
2265 $media_states_string .= "<span class='post-state'>$state$sep</span>"; |
2279 $media_states_string .= "<span class='post-state'>$state$sep</span>"; |
2266 } |
2280 } |
2267 } |
2281 } |
2268 |
2282 |
2269 if ( $echo ) { |
2283 if ( $display ) { |
2270 echo $media_states_string; |
2284 echo $media_states_string; |
2271 } |
2285 } |
2272 |
2286 |
2273 return $media_states_string; |
2287 return $media_states_string; |
2274 } |
2288 } |
2353 */ |
2367 */ |
2354 return apply_filters( 'display_media_states', $media_states, $post ); |
2368 return apply_filters( 'display_media_states', $media_states, $post ); |
2355 } |
2369 } |
2356 |
2370 |
2357 /** |
2371 /** |
2358 * Test support for compressing JavaScript from PHP |
2372 * Tests support for compressing JavaScript from PHP. |
2359 * |
2373 * |
2360 * Outputs JavaScript that tests if compression from PHP works as expected |
2374 * Outputs JavaScript that tests if compression from PHP works as expected |
2361 * and sets an option with the result. Has no effect when the current user |
2375 * and sets an option with the result. Has no effect when the current user |
2362 * is not an administrator. To run the test again the option 'can_compress_scripts' |
2376 * is not an administrator. To run the test again the option 'can_compress_scripts' |
2363 * has to be deleted. |
2377 * has to be deleted. |
2443 function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) { |
2457 function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) { |
2444 echo get_submit_button( $text, $type, $name, $wrap, $other_attributes ); |
2458 echo get_submit_button( $text, $type, $name, $wrap, $other_attributes ); |
2445 } |
2459 } |
2446 |
2460 |
2447 /** |
2461 /** |
2448 * Returns a submit button, with provided text and appropriate class |
2462 * Returns a submit button, with provided text and appropriate class. |
2449 * |
2463 * |
2450 * @since 3.1.0 |
2464 * @since 3.1.0 |
2451 * |
2465 * |
2452 * @param string $text Optional. The text of the button. Default 'Save Changes'. |
2466 * @param string $text Optional. The text of the button. Default 'Save Changes'. |
2453 * @param string $type Optional. The type and CSS class(es) of the button. Core values |
2467 * @param string $type Optional. The type and CSS class(es) of the button. Core values |
2596 </div> |
2610 </div> |
2597 <?php |
2611 <?php |
2598 } |
2612 } |
2599 |
2613 |
2600 /** |
2614 /** |
2601 * Output a HTML element with a star rating for a given rating. |
2615 * Outputs a HTML element with a star rating for a given rating. |
2602 * |
2616 * |
2603 * Outputs a HTML element with the star rating exposed on a 0..5 scale in |
2617 * Outputs a HTML element with the star rating exposed on a 0..5 scale in |
2604 * half star increments (ie. 1, 1.5, 2 stars). Optionally, if specified, the |
2618 * half star increments (ie. 1, 1.5, 2 stars). Optionally, if specified, the |
2605 * number of ratings may also be displayed by passing the $number parameter. |
2619 * number of ratings may also be displayed by passing the $number parameter. |
2606 * |
2620 * |