'parent', 'id' => 'term_id'); //TODO: decouple this /** * Starts the list before the elements are added. * * @see Walker:start_lvl() * * @since 2.5.1 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of category. Used for tab indentation. * @param array $args An array of arguments. @see wp_terms_checklist() */ public function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "$indent
'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta' ) ); ?>
|
$template"; } } /** * Print out option HTML elements for the page parents drop-down. * * @since 1.5.0 * * @param int $default Optional. The default page ID to be pre-selected. Default 0. * @param int $parent Optional. The parent page ID. Default 0. * @param int $level Optional. Page depth level. Default 0. * * @return void|bool Boolean False if page has no children, otherwise print out html elements */ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) { global $wpdb; $post = get_post(); $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) ); if ( $items ) { foreach ( $items as $item ) { // A page cannot be its own parent. if ( $post && $post->ID && $item->ID == $post->ID ) continue; $pad = str_repeat( ' ', $level * 3 ); $selected = selected( $default, $item->ID, false ); echo "\n\t"; parent_dropdown( $default, $item->ID, $level +1 ); } } else { return false; } } /** * Print out option html elements for role selectors. * * @since 2.1.0 * * @param string $selected slug for the role that should be already selected */ function wp_dropdown_roles( $selected = false ) { $p = ''; $r = ''; $editable_roles = array_reverse( get_editable_roles() ); foreach ( $editable_roles as $role => $details ) { $name = translate_user_role($details['name'] ); if ( $selected == $role ) // preselect specified role $p = "\n\t"; else $r .= "\n\t"; } echo $p . $r; } /** * Outputs the form used by the importers to accept the data to be imported * * @since 2.0.0 * * @param string $action The action attribute for the form. */ function wp_import_upload_form( $action ) { /** * Filter the maximum allowed upload size for import files. * * @since 2.3.0 * * @see wp_max_upload_size() * * @param int $max_upload_size Allowed upload size. Default 1 MB. */ $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() ); $size = size_format( $bytes ); $upload_dir = wp_upload_dir(); if ( ! empty( $upload_dir['error'] ) ) : ?>
` tags). * @param string $type The type of message it is, controls HTML class. Use 'error' or 'updated'. */ function add_settings_error( $setting, $code, $message, $type = 'error' ) { global $wp_settings_errors; $wp_settings_errors[] = array( 'setting' => $setting, 'code' => $code, 'message' => $message, 'type' => $type ); } /** * Fetch settings errors registered by add_settings_error() * * Checks the $wp_settings_errors array for any errors declared during the current * pageload and returns them. * * If changes were just submitted ($_GET['settings-updated']) and settings errors were saved * to the 'settings_errors' transient then those errors will be returned instead. This * is used to pass errors back across pageloads. * * Use the $sanitize argument to manually re-sanitize the option before returning errors. * This is useful if you have errors or notices you want to show even when the user * hasn't submitted data (i.e. when they first load an options page, or in admin_notices action hook) * * @since 3.0.0 * * @global array $wp_settings_errors Storage array of errors registered during this pageload * * @param string $setting Optional slug title of a specific setting who's errors you want. * @param boolean $sanitize Whether to re-sanitize the setting value before returning errors. * @return array Array of settings errors */ function get_settings_errors( $setting = '', $sanitize = false ) { global $wp_settings_errors; /* * If $sanitize is true, manually re-run the sanitization for this option * This allows the $sanitize_callback from register_setting() to run, adding * any settings errors you want to show by default. */ if ( $sanitize ) sanitize_option( $setting, get_option( $setting ) ); // If settings were passed back from options.php then use them. if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) { $wp_settings_errors = array_merge( (array) $wp_settings_errors, get_transient( 'settings_errors' ) ); delete_transient( 'settings_errors' ); } // Check global in case errors have been added on this pageload. if ( ! count( $wp_settings_errors ) ) return array(); // Filter the results to those of a specific setting if one was set. if ( $setting ) { $setting_errors = array(); foreach ( (array) $wp_settings_errors as $key => $details ) { if ( $setting == $details['setting'] ) $setting_errors[] = $wp_settings_errors[$key]; } return $setting_errors; } return $wp_settings_errors; } /** * Display settings errors registered by {@see add_settings_error()}. * * Part of the Settings API. Outputs a div for each error retrieved by * {@see get_settings_errors()}. * * This is called automatically after a settings page based on the * Settings API is submitted. Errors should be added during the validation * callback function for a setting defined in {@see register_setting()} * * The $sanitize option is passed into {@see get_settings_errors()} and will * re-run the setting sanitization * on its current value. * * The $hide_on_update option will cause errors to only show when the settings * page is first loaded. if the user has already saved new values it will be * hidden to avoid repeating messages already shown in the default error * reporting after submission. This is useful to show general errors like * missing settings when the user arrives at the settings page. * * @since 3.0.0 * * @param string $setting Optional slug title of a specific setting who's errors you want. * @param boolean $sanitize Whether to re-sanitize the setting value before returning errors. * @param boolean $hide_on_update If set to true errors will not be shown if the settings page has already been submitted. */ function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) { if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) ) return; $settings_errors = get_settings_errors( $setting, $sanitize ); if ( empty( $settings_errors ) ) return; $output = ''; foreach ( $settings_errors as $key => $details ) { $css_id = 'setting-error-' . $details['code']; $css_class = $details['type'] . ' settings-error'; $output .= "
{$details['message']}
"; $output .= "