) $r['pages_with_children'][ $page->post_parent ] = true; } $args = array($pages, $depth, $r, $current_page); return call_user_func_array(array($walker, 'walk'), $args); } /** * Retrieve HTML dropdown (select) content for page list. * * @uses Walker_PageDropdown to create HTML dropdown content. * @since 2.1.0 * @see Walker_PageDropdown::walk() for parameters and return description. */ function walk_page_dropdown_tree() { $args = func_get_args(); if ( empty($args[2]['walker']) ) // the user's options are the third parameter $walker = new Walker_PageDropdown; else $walker = $args[2]['walker']; return call_user_func_array(array($walker, 'walk'), $args); } /** * Create HTML list of pages. * * @since 2.1.0 * @uses Walker */ class Walker_Page extends Walker { /** * @see Walker::$tree_type * @since 2.1.0 * @var string */ var $tree_type = 'page'; /** * @see Walker::$db_fields * @since 2.1.0 * @todo Decouple this. * @var array */ var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); /** * @see Walker::start_lvl() * @since 2.1.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of page. Used for padding. * @param array $args */ function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent\n"; } /** * @see Walker::start_el() * @since 2.1.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $page Page data object. * @param int $depth Depth of page. Used for padding. * @param int $current_page Page ID. * @param array $args */ function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) { if ( $depth ) $indent = str_repeat("\t", $depth); else $indent = ''; extract($args, EXTR_SKIP); $css_class = array('page_item', 'page-item-'.$page->ID); if( isset( $args['pages_with_children'][ $page->ID ] ) ) $css_class[] = 'page_item_has_children'; if ( !empty($current_page) ) { $_current_page = get_post( $current_page ); if ( in_array( $page->ID, $_current_page->ancestors ) ) $css_class[] = 'current_page_ancestor'; if ( $page->ID == $current_page ) $css_class[] = 'current_page_item'; elseif ( $_current_page && $page->ID == $_current_page->post_parent ) $css_class[] = 'current_page_parent'; } elseif ( $page->ID == get_option('page_for_posts') ) { $css_class[] = 'current_page_parent'; } /** * Filter the list of CSS classes to include with each page item in the list. * * @since 2.8.0 * * @see wp_list_pages() * * @param array $css_class An array of CSS classes to be applied * to each list item. * @param WP_Post $page Page data object. * @param int $depth Depth of page, used for padding. * @param array $args An array of arguments. * @param int $current_page ID of the current page. */ $css_class = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) ); if ( '' === $page->post_title ) $page->post_title = sprintf( __( '#%d (no title)' ), $page->ID ); /** This filter is documented in wp-includes/post-template.php */ $output .= $indent . '
  • ' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . ''; if ( !empty($show_date) ) { if ( 'modified' == $show_date ) $time = $page->post_modified; else $time = $page->post_date; $output .= " " . mysql2date($date_format, $time); } } /** * @see Walker::end_el() * @since 2.1.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $page Page data object. Not used. * @param int $depth Depth of page. Not Used. * @param array $args */ function end_el( &$output, $page, $depth = 0, $args = array() ) { $output .= "
  • \n"; } } /** * Create HTML dropdown list of pages. * * @since 2.1.0 * @uses Walker */ class Walker_PageDropdown extends Walker { /** * @see Walker::$tree_type * @since 2.1.0 * @var string */ var $tree_type = 'page'; /** * @see Walker::$db_fields * @since 2.1.0 * @todo Decouple this * @var array */ var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); /** * @see Walker::start_el() * @since 2.1.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $page Page data object. * @param int $depth Depth of page in reference to parent pages. Used for padding. * @param array $args Uses 'selected' argument for selected page to set selected HTML attribute for option element. * @param int $id */ function start_el( &$output, $page, $depth = 0, $args = array(), $id = 0 ) { $pad = str_repeat(' ', $depth * 3); $output .= "\t\n"; } } // // Attachments // /** * Display an attachment page link using an image or icon. * * @since 2.0.0 * * @param int|WP_Post $id Optional. Post ID or post object. * @param bool $fullsize Optional, default is false. Whether to use full size. * @param bool $deprecated Deprecated. Not used. * @param bool $permalink Optional, default is false. Whether to include permalink. */ function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) { if ( !empty( $deprecated ) ) _deprecated_argument( __FUNCTION__, '2.5' ); if ( $fullsize ) echo wp_get_attachment_link($id, 'full', $permalink); else echo wp_get_attachment_link($id, 'thumbnail', $permalink); } /** * Retrieve an attachment page link using an image or icon, if possible. * * @since 2.5.0 * @uses apply_filters() Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function. * * @param int|WP_Post $id Optional. Post ID or post object. * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. * @param bool $permalink Optional, default is false. Whether to add permalink to image. * @param bool $icon Optional, default is false. Whether to include icon. * @param string|bool $text Optional, default is false. If string, then will be link text. * @return string HTML content. */ function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) { $id = intval( $id ); $_post = get_post( $id ); if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) ) return __( 'Missing Attachment' ); if ( $permalink ) $url = get_attachment_link( $_post->ID ); $post_title = esc_attr( $_post->post_title ); if ( $text ) $link_text = $text; elseif ( $size && 'none' != $size ) $link_text = wp_get_attachment_image( $id, $size, $icon ); else $link_text = ''; if ( trim( $link_text ) == '' ) $link_text = $_post->post_title; /** * Filter a retrieved attachment page link. * * @since 2.7.0 * * @param string $link_html The page link HTML output. * @param int $id Post ID. * @param string $size Image size. Default 'thumbnail'. * @param bool $permalink Whether to add permalink to image. Default false. * @param bool $icon Whether to include an icon. Default false. * @param string|bool $text If string, will be link text. Default false. */ return apply_filters( 'wp_get_attachment_link', "$link_text", $id, $size, $permalink, $icon, $text ); } /** * Wrap attachment in <

    > element before content. * * @since 2.0.0 * * @param string $content * @return string */ function prepend_attachment($content) { $post = get_post(); if ( empty($post->post_type) || $post->post_type != 'attachment' ) return $content; if ( 0 === strpos( $post->post_mime_type, 'video' ) ) { $meta = wp_get_attachment_metadata( get_the_ID() ); $atts = array( 'src' => wp_get_attachment_url() ); if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) { $atts['width'] = (int) $meta['width']; $atts['height'] = (int) $meta['height']; } $p = wp_video_shortcode( $atts ); } elseif ( 0 === strpos( $post->post_mime_type, 'audio' ) ) { $p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) ); } else { $p = '

    '; // show the medium sized image representation of the attachment if available, and link to the raw file $p .= wp_get_attachment_link(0, 'medium', false); $p .= '

    '; } /** * Filter the attachment markup to be prepended to the post content. * * @since 2.0.0 * * @see prepend_attachment() * * @param string $p The attachment HTML output. */ $p = apply_filters( 'prepend_attachment', $p ); return "$p\n$content"; } // // Misc // /** * Retrieve protected post password form content. * * @since 1.0.0 * @uses apply_filters() Calls 'the_password_form' filter on output. * @param int|WP_Post $post Optional. A post ID or post object. * @return string HTML content for password form for password protected post. */ function get_the_password_form( $post = 0 ) { $post = get_post( $post ); $label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID ); $output = '

    ' . __( 'This content is password protected. To view it please enter your password below:' ) . '

    '; /** * Filter the HTML output for the protected post password form. * * If modifying the password field, please note that the core database schema * limits the password field to 20 characters regardless of the value of the * size attribute in the form input. * * @since 2.7.0 * * @param string $output The password form HTML output. */ return apply_filters( 'the_password_form', $output ); } /** * Whether currently in a page template. * * This template tag allows you to determine if you are in a page template. * You can optionally provide a template name and then the check will be * specific to that template. * * @since 2.5.0 * @uses $wp_query * * @param string $template The specific template name if specific matching is required. * @return bool True on success, false on failure. */ function is_page_template( $template = '' ) { if ( ! is_page() ) return false; $page_template = get_page_template_slug( get_queried_object_id() ); if ( empty( $template ) ) return (bool) $page_template; if ( $template == $page_template ) return true; if ( 'default' == $template && ! $page_template ) return true; return false; } /** * Get the specific template name for a page. * * @since 3.4.0 * * @param int $post_id Optional. The page ID to check. Defaults to the current post, when used in the loop. * @return string|bool Page template filename. Returns an empty string when the default page template * is in use. Returns false if the post is not a page. */ function get_page_template_slug( $post_id = null ) { $post = get_post( $post_id ); if ( ! $post || 'page' != $post->post_type ) return false; $template = get_post_meta( $post->ID, '_wp_page_template', true ); if ( ! $template || 'default' == $template ) return ''; return $template; } /** * Retrieve formatted date timestamp of a revision (linked to that revisions's page). * * @since 2.6.0 * * @uses date_i18n() * * @param int|object $revision Revision ID or revision object. * @param bool $link Optional, default is true. Link to revisions's page? * @return string i18n formatted datetimestamp or localized 'Current Revision'. */ function wp_post_revision_title( $revision, $link = true ) { if ( !$revision = get_post( $revision ) ) return $revision; if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) return false; /* translators: revision date format, see http://php.net/date */ $datef = _x( 'j F, Y @ G:i', 'revision date format'); /* translators: 1: date */ $autosavef = _x( '%1$s [Autosave]', 'post revision title extra' ); /* translators: 1: date */ $currentf = _x( '%1$s [Current Revision]', 'post revision title extra' ); $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) $date = "$date"; if ( !wp_is_post_revision( $revision ) ) $date = sprintf( $currentf, $date ); elseif ( wp_is_post_autosave( $revision ) ) $date = sprintf( $autosavef, $date ); return $date; } /** * Retrieve formatted date timestamp of a revision (linked to that revisions's page). * * @since 3.6.0 * * @uses date_i18n() * * @param int|object $revision Revision ID or revision object. * @param bool $link Optional, default is true. Link to revisions's page? * @return string gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'. */ function wp_post_revision_title_expanded( $revision, $link = true ) { if ( !$revision = get_post( $revision ) ) return $revision; if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) return false; $author = get_the_author_meta( 'display_name', $revision->post_author ); /* translators: revision date format, see http://php.net/date */ $datef = _x( 'j F, Y @ G:i:s', 'revision date format'); $gravatar = get_avatar( $revision->post_author, 24 ); $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) $date = "$date"; $revision_date_author = sprintf( /* translators: post revision title: 1: author avatar, 2: author name, 3: time ago, 4: date */ _x( '%1$s %2$s, %3$s ago (%4$s)', 'post revision title' ), $gravatar, $author, human_time_diff( strtotime( $revision->post_modified ), current_time( 'timestamp' ) ), $date ); $autosavef = __( '%1$s [Autosave]' ); $currentf = __( '%1$s [Current Revision]' ); if ( !wp_is_post_revision( $revision ) ) $revision_date_author = sprintf( $currentf, $revision_date_author ); elseif ( wp_is_post_autosave( $revision ) ) $revision_date_author = sprintf( $autosavef, $revision_date_author ); return $revision_date_author; } /** * Display list of a post's revisions. * * Can output either a UL with edit links or a TABLE with diff interface, and * restore action links. * * @since 2.6.0 * * @uses wp_get_post_revisions() * @uses wp_post_revision_title_expanded() * @uses get_edit_post_link() * @uses get_the_author_meta() * * @param int|WP_Post $post_id Optional. Post ID or post object. * @param string $type 'all' (default), 'revision' or 'autosave' * @return null */ function wp_list_post_revisions( $post_id = 0, $type = 'all' ) { if ( ! $post = get_post( $post_id ) ) return; // $args array with (parent, format, right, left, type) deprecated since 3.6 if ( is_array( $type ) ) { $type = ! empty( $type['type'] ) ? $type['type'] : $type; _deprecated_argument( __FUNCTION__, '3.6' ); } if ( ! $revisions = wp_get_post_revisions( $post->ID ) ) return; $rows = ''; foreach ( $revisions as $revision ) { if ( ! current_user_can( 'read_post', $revision->ID ) ) continue; $is_autosave = wp_is_post_autosave( $revision ); if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) ) continue; $rows .= "\t
  • " . wp_post_revision_title_expanded( $revision ) . "
  • \n"; } echo "

    " . __( 'JavaScript must be enabled to use this feature.' ) . "

    \n"; echo ""; } Tapetenwechsel für die Seele http://www.tapetenwechsel.me Einfach entstressen. Coaching & Auszeiten Sat, 30 Apr 2016 18:20:24 +0000 en-US hourly 1 http://wordpress.org/?v=3.9.13