• Resolved Rotozaza

    (@rotozaza)


    Value for og:title is twice encoded if fetched by get_the_title, my straight fix for titles only.

    
    [ 1 ] C:\Installation\Content Management\WordPress\Plugins\complete-open-graph.2.1.4\src\OpenGraph.php 16.08.2017, 01:37:52
    [ 2 ] C:\wp-content\plugins\complete-open-graph\src\OpenGraph.php 16.08.2017, 01:57:42
    ------------------------------------------------------------------------------------------------------------------------
    +++ \Installation\Content Management\WordPress\Plugins\complete-open-graph.2.1.4\src\OpenGraph.php 16.8.2017 1:37:52
    --- \wp-content\plugins\complete-open-graph\src\OpenGraph.php 16.8.2017 1:57:42
    -----------
    @@ +62,7 -62,7 @@
        $startTime = microtime(true);
    
        foreach($this->get_open_graph_values() as $key=>$data) {
    +       $content = preg_replace( "/\r|\n/", "", htmlentities($data['value']));
    -       $content = preg_replace( "/\r|\n/", "", $data['value']);
    
          if($data['value']) {
            if($data['attribute'] === 'property') {
    @@ +156,9 -156,9 @@
            'attribute' => 'property',
            'value' => $this->get_open_graph_value( 'title',
              array(
    +             Utilities::get_post_option('title'),
    -             htmlentities(Utilities::get_post_option('title')),
                get_the_title(),
    +             Utilities::get_option('title'),
    -             htmlentities(Utilities::get_option('title')),
                $site_name
              )
            )
    ------------------------------------------------------------------------------------------------------------------------
     
    Report type: All (Matching and Differences)
    
    Summary:
    280 Line(s) match   3 Block(s) diff   3 : 3 Line(s) diff
    
    ------------------------------------------------------------------------------------------------------------------------

    nicer than my first reflex

    html_entity_decode(get_the_title(),ENT_QUOTES,'UTF-8'),

    • This topic was modified 7 years, 3 months ago by Rotozaza.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Alex MacArthur

    (@alexmacarthur)

    Hi! I’m not entirely sure I understand the issue you’re talking about, but version 3.0.1 (just released) resolves issues with certain characters being improperly decoded.

    Thread Starter Rotozaza

    (@rotozaza)

    sorry diff was in wrong direction

    get_the_title()
    returns enocded HTML, if there are special signs you get &, which is encoded again by
    $content = preg_replace( "/\r|\n/", "", htmlentities($data['value']));

    • This reply was modified 7 years, 3 months ago by Rotozaza.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Title twice encoded for get_the_title’ is closed to new replies.