false, 'error' => '' ); if ( isset( $_POST['submit_password'] ) ) { // when we have a submision check the password and its submision if ( isset( $_POST['submit_password_nonce'] ) && wp_verify_nonce( $_POST['submit_password_nonce'], 'password_protection' ) ) { if ( isset ( $_POST['post_password'] ) && ! empty( $_POST['post_password'] ) ) { // some simple checks on password // finally test if the password submitted is correct if ( $post->post_password === $_POST['post_password'] ) { $private_post['allowed'] = true; // ok if we have a correct password we should inform wordpress too // otherwise the mad dog will put the password form again in the_content() and other filters global $wp_hasher; if ( empty( $wp_hasher ) ) { require_once( ABSPATH . 'wp-includes/class-phpass.php' ); $wp_hasher = new PasswordHash( 8, true ); } setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( stripslashes( $_POST['post_password'] ) ), 0, COOKIEPATH ); } else { $private_post['error'] = '

Wrong Password

'; } } } } if ( isset( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ) && get_permalink() == wp_get_referer() ) { $private_post['error'] = '

Wrong Password

'; } return $private_post; } /** Limit words for a string */ static function limit_words( $string, $word_limit, $more_text = ' […]' ) { $words = explode( " ", $string ); $output = implode( " ", array_splice( $words, 0, $word_limit ) ); //check fi we actually cut something if ( count( $words ) > $word_limit ) { $output .= $more_text; } return $output; } static function get_post_format_first_image_src() { global $post; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all( '//i', $post->post_content, $matches ); $first_img = $matches[1][0]; if ( empty( $first_img ) ) { //Defines a default image $first_img = wpgrade::uri( "/assets/img/default.jpg" ); } return $first_img; } /** * Returns the URL from the post. * Falls back to the post permalink if no URL is found in the post. * @return string The Link format URL. */ static function get_content_link_url() { $content = get_the_content(); $has_url = get_url_in_content( $content ); return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); } static function featured_image_as_style_bg( $size = 'full', $additional_css = '' ) { global $post; if ( has_post_thumbnail( $post->ID ) ) { $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $size ); if ( ! empty( $image[0] ) ) { $style = ' style="background-image: url(' . $image[0] . '); ' . $additional_css . '"'; return $style; } } return ''; } static function get_gallery_type( $post_id ) { $template = get_post_meta( $post_id, wpgrade::prefix() . 'gallery_template', true ); if ( $template == 'slideshow' ) { return $template; } else { return get_post_meta( $post_id, wpgrade::prefix() . 'grid_thumbnails', true ); } return ''; } static function the_archive_title() { $object = get_queried_object(); if ( is_home() ) { ?>

post_title)) echo $object->post_title; else _e( 'News', 'rosa_txtd' ); ?>




term_id ) ) { ?>

name; ?>






$term ) { if ( $field == 'name' ) { $return .= $term->name; } elseif ( $field == 'slug' ) { $return .= $term->slug; } else { continue; } if ( $last != $key ) { $return .= $separator; } } } return $return; } static function get_edit_url() { global $wp_the_query; $current_object = $wp_the_query->get_queried_object(); $theID = false; if ( ! empty( $current_object->post_type ) && ( $post_type_object = get_post_type_object( $current_object->post_type ) ) && current_user_can( 'edit_post', $current_object->ID ) && $post_type_object->show_ui && $post_type_object->show_in_admin_bar ) { $theID = $current_object->ID; } elseif ( ! empty( $current_object->taxonomy ) && ( $tax = get_taxonomy( $current_object->taxonomy ) ) && current_user_can( $tax->cap->edit_terms ) && $tax->show_ui ) { $theID = $current_object->term_id; } if ( $theID ) { return get_edit_post_link( $theID ); } return ''; } /** * We check if there is a gallery meta data, then a gallery shortcode in the content, extract it and * display it in the form of a slideshow. */ static function gallery_slideshow( $current_post, $template = null, $size = 'medium-size' ) { if ( $template === null ) { $image_scale_mode = get_post_meta( $current_post->ID, wpgrade::prefix() . 'post_image_scale_mode', true ); $slider_visiblenearby = get_post_meta( $current_post->ID, wpgrade::prefix() . 'post_slider_visiblenearby', true ); $slider_transition = get_post_meta( $current_post->ID, wpgrade::prefix() . 'post_slider_transition', true ); $slider_autoplay = get_post_meta( $current_post->ID, wpgrade::prefix() . 'post_slider_autoplay', true ); if ( $slider_autoplay ) { $slider_delay = get_post_meta( $current_post->ID, wpgrade::prefix() . 'post_slider_delay', true ); } $template = '