IPB

( Zaloguj | Zarejestruj )

 
Reply to this topicStart new topic
> wp get post - problem z kodowaniem tytułów
kidler
post 30.7.2009 - 01:37
Post #1


aktywność:
***

Grupa: +Bloger
Postów: 110

Nr: 4 032



Witam. Wgrałem wtyczkę get post(http://wordpress.org/extend/plugins/get-post/). Niestety w tytułach zamiast polskich znaków są krzaczki... Co dziwnego treść wyświetla normalnie.. proszę o pomoc.. z góry thx

kod wtyczki
KOD
<?php
if (!class_exists('JamesGetPost'))
{
    class JamesGetPost
    {
        function JamesGetPost()
        {
        }

        function get_post($tag='')
        {
            global $wp_query, $post, $id;
            $temp_query = clone $wp_query;
            $temp_post = clone $post;
            $temp_id = $id;
            $tag=htmlentities($tag);
            $myq = new WP_Query("tag=$tag&showposts=1");
            if ( $myq->have_posts() ) while ( $myq->have_posts() )
            {
                $myq->the_post();
                $pc='';
                $pc='<div class="post" id="post-'.$post->ID.'">';
                $pc.='<h2><a href="'.get_permalink().'" rel="bookmark">'.htmlentities($post->post_title).'</a></h2>';
                $pc.=$post->post_date;
                $pc.='<div class="entry">';
                $pc.=$post->post_content;
                $pc.='</div>';
                $pc.='</div>';
            }
            $wp_query = clone $temp_query;
            $post = clone $temp_post;
            $id = $temp_id;
            return $pc;
        }

        function read_params($params)
        {
            $re = '/tag="(?<tag>.+)"/';
            preg_match($re, $params, $matches);
            $tag = $matches['tag'];
            // Post content would be here
            return $this->get_post($tag);
        }
        function scan_content($content = '')
        {
            $re = '/(?<str>\[get\-post(?<params>.*)\])/';
            if (preg_match($re, $content, $matches))
            {
                $params = $matches['params'];
                $replace = $matches['str'];
                // Post content would be here
                $postcontent = $this->read_params($params);
                $content = str_replace($replace, $postcontent, $content);
            }
            return $content;
        }
    }

}

if (class_exists('JamesGetPost'))
{
    $getpostplugin = new JamesGetPost();
}

if (isset($getpostplugin))
{
    add_filter('the_content', array($getpostplugin, 'scan_content'));
}

?>


kodowanie strony utf-8
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



: 24 05 12 - 13:46