Plugin Directory

Changeset 912911


Ignore:
Timestamp:
05/12/2014 08:04:16 PM (12 years ago)
Author:
sebstein
Message:
  • If a Google+ posts starts with bold text, this bold text is used as title of the post instead of the title "guessed" by Google. You can insert bold text in your post by surrounding the text with asterics characters, e.g. *title*
  • fix PHP warning in admin.php
Location:
g-crossposting/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • g-crossposting/trunk/admin.php

    r847162 r912911  
    191191
    192192    // validate addcanonical setting
    193     $new_input['addcanonical'] = trim($input['addcanonical']);
    194     if (! g_crossposting_check_addcanonical($new_input['addcanonical'])) {
     193    if (isset($input['addcanonical'])) {
     194        $new_input['addcanonical'] = trim($input['addcanonical']);
     195        if (! g_crossposting_check_addcanonical($new_input['addcanonical'])) {
     196            $new_input['addcanonical'] = '';
     197        }
     198    } else {
    195199        $new_input['addcanonical'] = '';
    196200    }
  • g-crossposting/trunk/g-crossposting.php

    r912244 r912911  
    44    Plugin URI: http://wordpress.org/extend/plugins/g-crossposting/
    55    Description: Imports your public Google+ activities in your Wordpress blog.
    6     Version: 1.4.0
     6    Version: 1.5.0
    77    Author: Sebastian Stein
    88    Author URI: http://sebstein.hpfsc.de/
     
    341341            }
    342342            $post_content .= '<div class="g-crossposting-att">';
    343             $post_content .= "<div class=\"g-crossposting-att-title\"><p><a href=\"{$att_url}\" target=\"_blank\">{$att_title}</a></p></div>";
     343
     344            if (isset($att_url) && isset($att_title)) {
     345                $post_content .= "<div class=\"g-crossposting-att-title\"><p><a href=\"{$att_url}\" target=\"_blank\">{$att_title}</a></p></div>";
     346            }
    344347
    345348            if ($att_photo) {
     
    358361
    359362
    360         // set title for post
    361         if ($activity->title) {
    362             $post_title = $activity->title;
    363         } else if ($att_title) {
    364             $post_title = $att_title;
    365         } else {
    366             $post_title = __('Google+ post: No title available&hellip;', 'g-crossposting');
     363        // if content starts with bold text, use it as title
     364        $post_title = '';
     365        if (isset($activity->object->content)) {
     366            $trimmed_content = trim($activity->object->content);
     367            $regex = '/^<b>(.*)<\/b>/U';
     368            $matches = array();
     369            if (preg_match($regex, $trimmed_content, $matches) && count($matches) == 2) {
     370                $post_title = $matches[1];
     371            }
     372        }
     373
     374        // fallback on G+ title generation logic
     375        if (empty($post_title)) {
     376            if ($activity->title) {
     377                $post_title = $activity->title;
     378            } else if ($att_title) {
     379                $post_title = $att_title;
     380            } else {
     381                $post_title = __('Google+ post: No title available&hellip;', 'g-crossposting');
     382            }
    367383        }
    368384
  • g-crossposting/trunk/readme.txt

    r912244 r912911  
    11=== Google+ Crossposting ===
    22Contributors: sebstein
    3 Donate link: bitcoin:18dNV4mZyQMDdgd1ebe2Gm4f9MNZMLuNNb
     3Donate link: http://wordpress.org/plugins/g-crossposting/faq/
    44Tags: google, googleplus, posts, g+
    55Requires at least: 3.0.0
    66Tested up to: 3.9.1
    7 Stable tag: 1.4.0
     7Stable tag: 1.5.0
    88
    99Imports your public Google+ activities in your Wordpress blog.
     
    8787first!
    8888
    89 = Post titles are still shortened, even if I set length to 0 (meaning unlimited length)? =
     89= Where do post titles come from? =
     90
     91Google+ provides a title for each post. There is no documentation how Google+
     92generates those titles.
     93
     94You can set a custom title by starting your post with bold text. You can insert
     95bold text in your post by surrounding text with asterics characters, e.g. `*my
     96title*`.
     97
     98If the plugin doesn't find bold text at the beginning of your post, it will use
     99the title generated by Google+ instead.
     100
     101= Post titles are shortened, even if I set length to 0 (meaning unlimited length)? =
    90102
    91103Google+ itself limits the length of a post title. If you set 0 for the length of
    92104the post title, the plugin will import the whole title provided by Google+. If
    93105Google+ shortens your title, there is nothing this plugin can do.
     106
     107= How can I send you a donation? =
     108
     109I appreciate your support very much! As I don't want to feed the financial
     110industry, I only accept donations as [https://bitcoin.org/](Bitcoins). Please
     111send your donation to the following Bitcoin address:
     112
     113[bitcoin:1Fp4ZtGETPYkcbTW2uQDUPcbCkJBeAWQJr](1Fp4ZtGETPYkcbTW2uQDUPcbCkJBeAWQJr)
     114
     115If you are unable to send me Bitcoins, please consider making a donation to a
     116local charity of your choice (e.g. to support homeless people) or to an
     117international organisation like the Red Cross.
     118
     119Thank you!
    94120
    95121
     
    100126
    101127== Changelog ==
     128
     129= 1.5.0 =
     130
     131* If a Google+ posts starts with bold text, this bold text is used as title of
     132  the post instead of the title "guessed" by Google. You can insert bold text in
     133  your post by surrounding the text with asterics characters, e.g. *title*
     134* fix PHP warning in admin.php
    102135
    103136= 1.4.0 =
Note: See TracChangeset for help on using the changeset viewer.