Plugin Directory

Changeset 491862


Ignore:
Timestamp:
01/18/2012 09:12:18 PM (14 years ago)
Author:
sebstein
Message:
  • API key and G+ ID don't get removed anymore in case plugin is unable to connect to the G+ API; it seems that this now happens more often even if all settings are correct; a future version will need a better error reporting mechanism, but unfortunately Wordpress doesn't provide a convenient API for reporting configuration errors to the users and so the plugin will need to come up with an own mechanism
  • fix a small bug of posts not getting loaded in case no length of title was specified
Location:
g-crossposting/trunk
Files:
3 edited

Legend:

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

    r482762 r491862  
    1111    exit;
    1212}
     13
     14require_once dirname(__FILE__).'/gplus-crosspost.php';
    1315
    1416// register our admin actions
     
    7072 */
    7173function g_crossposting_gplusid_field() {
    72     $options = get_option('g_crossposting_options');
     74    $options = g_crossposting_get_settings();
    7375    echo "<input id='g_crossposting_gplusid' name='g_crossposting_options[gplusid]' size='59' maxlength='21' type='text' value='{$options['gplusid']}' />";
    7476}
     
    7880 */
    7981function g_crossposting_apikey_field() {
    80     $options = get_option('g_crossposting_options');
     82    $options = g_crossposting_get_settings();
    8183    echo "<input id='g_crossposting_apikey' name='g_crossposting_options[apikey]' size='59' maxlength='39' type='text' value='{$options['apikey']}' />";
    8284}
     
    8688 */
    8789function g_crossposting_maxactivities_field() {
    88     $options = get_option('g_crossposting_options');
     90    $options = g_crossposting_get_settings();
    8991    echo "<input id='g_crossposting_maxactivities' name='g_crossposting_options[maxactivities]' size='59' maxlength='3' type='text' value='{$options['maxactivities']}' />";
    9092}
     
    9496 */
    9597function g_crossposting_titlelen_field() {
    96     $options = get_option('g_crossposting_options');
     98    $options = g_crossposting_get_settings();
    9799    echo "<input id='g_crossposting_titlelen' name='g_crossposting_options[titlelen]' size='59' maxlength='3' type='text' value='{$options['titlelen']}' />";
    98100}
     
    102104 */
    103105function g_crossposting_addcanonical_field() {
    104     $options = get_option('g_crossposting_options');
     106    $options = g_crossposting_get_settings();
    105107    echo "<input id='g_crossposting_addcanonical' name='g_crossposting_options[addcanonical]' type='checkbox' value='true'";
    106108    if ($options['addcanonical'] == 'true') {
     
    114116 */
    115117function g_crossposting_category_field() {
    116     $options = get_option('g_crossposting_options');
     118    $options = g_crossposting_get_settings();
    117119    $selected = $options['category'];
    118120    $option_str = 'hide_empty&name=g_crossposting_options[category]&id=g_crossposting_category';
     
    127129 */
    128130function g_crossposting_comment_field() {
    129     $options = get_option('g_crossposting_options');
     131    $options = g_crossposting_get_settings();
    130132    echo "<input id='g_crossposting_comment' name='g_crossposting_options[comment]' type='checkbox' value='true'";
    131133    if ($options['comment'] == 'true') {
     
    139141 */
    140142function g_crossposting_author_field() {
    141     $options = get_option('g_crossposting_options');
     143    $options = g_crossposting_get_settings();
    142144    $selected = $options['author'];
    143145    $option_str = 'name=g_crossposting_options[author]&id=g_crossposting_author&who=author&who=authors';
     
    188190        if (g_crossposting_api_activities_list($new_input['gplusid'], $new_input['apikey'], 1) == null) {
    189191            // at least one of both must be wrong
    190             $new_input['gplusid'] = '';
    191             $new_input['apikey'] = '';
     192            // $new_input['gplusid'] = '';
     193            // $new_input['apikey'] = '';
    192194        }
    193195    }
     
    266268    echo '</a></div>';
    267269/*
    268     $options = get_option('g_crossposting_options');
     270    $options = g_crossposting_get_settings();
    269271
    270272    // get latest Google+ activities
  • g-crossposting/trunk/gplus-crosspost.php

    r482762 r491862  
    44    Plugin URI: http://wordpress.org/extend/plugins/g-crossposting/
    55    Description: Imports your public Google+ activities in your Wordpress blog.
    6     Version: 1.1.0
     6    Version: 1.1.1
    77    Author: Sebastian Stein
    88    Author URI: http://sebstein.hpfsc.de/
     
    5454
    5555// get our options
    56 $options = get_option('g_crossposting_options');
     56$options = g_crossposting_get_settings();
    5757
    5858// register an action for wp_head() hook with high priority so that we can still
     
    6565// bind _update function to update action triggered as a scheduled event
    6666add_action('g_crossposting_update_action', 'g_crossposting_update');
     67
     68/**
     69 * gets setup options from DB and adds some default values in case a setting is
     70 * missing
     71 */
     72function g_crossposting_get_settings() {
     73    $options = get_option('g_crossposting_options');
     74
     75    if (! isset($options['titlelen']) || empty($options['titlelen'])) {
     76        $options['titlelen'] = 0;
     77        update_option('g_crossposting_options', $options);
     78    }
     79
     80    return $options;
     81}
    6782
    6883/**
     
    145160 */
    146161function g_crossposting_is_enabled() {
    147     $options = get_option('g_crossposting_options');
     162    $options = g_crossposting_get_settings();
    148163
    149164    if (! g_crossposting_check_gplusid($options['gplusid'])) {
     
    231246function g_crossposting_get_new_activities() {
    232247    // load options
    233     $options = get_option('g_crossposting_options');
     248    $options = g_crossposting_get_settings();
    234249    $last_activity_id = get_option('g_crossposting_last_activity_id', null);
    235250
     
    281296
    282297        // get options to configure way how activities get imported
    283         $options = get_option('g_crossposting_options');
     298        $options = g_crossposting_get_settings();
    284299
    285300        // prepare data for new post
  • g-crossposting/trunk/readme.txt

    r482762 r491862  
    55Requires at least: 3.0.0
    66Tested up to: 3.3.0
    7 Stable tag: 1.1.0
     7Stable tag: 1.1.1
    88
    99Imports your public Google+ activities in your Wordpress blog.
     
    8888== Changelog ==
    8989
     90= 1.1.1 =
     91* API key and G+ ID don't get removed anymore in case plugin is unable to connect to the G+ API; it seems that this now happens more often even if all settings are correct; a future version will need a better error reporting mechanism, but unfortunately Wordpress doesn't provide a convenient API for reporting configuration errors to the users and so the plugin will need to come up with an own mechanism
     92* fix a small bug of posts not getting loaded in case no length of title was specified
     93
    9094= 1.1.0 =
    9195* make sure to post on Google+ that you are using this plugin!!!
Note: See TracChangeset for help on using the changeset viewer.