WordPress.org

Plugin Directory

Changeset 555357


Ignore:
Timestamp:
06/09/12 17:44:20 (23 months ago)
Author:
SteveAtty
Message:

Version 2.1.13 - Live to Fight Another Day

Location:
wordbooker/trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • wordbooker/trunk/includes/wordbooker_cron.php

    r548667 r555357  
    4444        if($ret->error->message)  { 
    4545        wordbooker_append_to_errorlogs("Your Facebook Session is invalid", "99", $ret->error->message,'',$user_id); 
    46         wordbooker_delete_user($user_id,1); 
     46        #wordbooker_delete_user($user_id,1); 
    4747        return; 
    4848        } 
  • wordbooker/trunk/includes/wordbooker_facebook_curl.php

    r548667 r555357  
    6868} 
    6969 
     70function wordbooker_delete_fb_post($fb_post_id,$access_token){ 
     71    $url='https://graph.facebook.com/'.$fb_post_id.'?method=delete&access_token='.$access_token; 
     72    $x=wordbooker_make_curl_call($url); 
     73        return($x); 
     74} 
     75 
    7076function wordbooker_get_access_token($access_token) { 
    7177    #$url='https://graph.facebook.com/oauth/access_token?client_id='.WORDBOOKER_FB_ID.'&client_secret='.WORDBOOKER_FB_SECRET.'&grant_type=fb_exchange_token&fb_exchange_token='.$access_token; 
     
    101107        return($x); 
    102108} 
     109 
     110function wordbooker_fb_create_event($fb_id,$event_data,$access_token) { 
     111        $url = 'https://graph.facebook.com/'.$fb_id.'?access_token='.$access_token; 
     112    $event_data = array( 
     113        'name'          => 'Event: ' . date("H:m:s"), 
     114        'start_time'    => time() + 60*60, 
     115        'end_time'      => time() + 60*60*2, 
     116        'owner'         => $page 
     117    ); 
     118    $x=wordbooker_make_curl_post_call($url,$data); 
     119        return($x); 
     120} 
     121 
    103122function wordbooker_make_curl_call($url) { 
    104123    $ch = curl_init(); 
  • wordbooker/trunk/readme.txt

    r548667 r555357  
    66Requires at least: 2.9 
    77Tested up to: 3.4 
    8 Stable tag: 2.1.12 
     8Stable tag: 2.1.13 
    99 
    1010This plugin allows you to cross-post your blog posts to your Facebook Wall and to any Facebook Fan Page / Group that you are an administrator for.  
     
    4242For more details on the various features please read the additional Features.txt file or check the [wordbooker](http://blogs.canalplan.org.uk/steve/category/wordbooker/) category on my blog which will contain information on the current and planned features list. 
    4343 
    44 - Works with a complementary [Facebook application](http://www.facebook.com/apps/application.php?id=254577506873) to update your Facebook Wall and friends' News Feeds about your blog and page postings. 
     44- Works with a complementary [Facebook application](http://www.facebook.com/apps/application.php?id=254577506873) to update your Facebook Wall and friends' News Feeds about your blog and page postings. Does NOT require you to register your own Facebook Application. 
    4545- Supports multi-author blogs: each blog author notifies only their own friends of their blog/page posts. 
    4646- Features a sidebar widget to display your current Facebook Status and picture. Multiple widgets can be supported in one single blog. 
    4747- Features a sidebar widget to display a "Fan"/Like box for any of your pages. Multiple widgets can be supported in one single blog. 
    48 - Features a Facebook Like Button which can be customised as to where it appears in your blog. 
     48- Features a Facebook Like/Send Button which can be customised as to where it appears in your blog. 
    4949- Supports the posting of blog posts to Fan Pages and Groups (if you are an administrator of that page or group). 
     50- Pulls and pushes comments between your Blog Posts and the corresponsding Facebook Wall Post. 
    5051 
    5152 
     
    6061- With Wordbooker, your blog postings will have their own space in your Facebook Wall - just as if you'd written directly on to the wall yourself. 
    6162 
    62 - Your updates will show up with a nifty WordPress logo next to them instead of the normal "Notes" icon, plus a link back to the full entry on your blog. 
    63  
    64  
    65 = Why doesn't the Facebook Like / Facebook Share show up properly even though I've enabled it? 
     63- Your updates will show up with a Worbooker logo next to them instead of the normal "Notes" icon, plus a link back to the full entry on your blog. 
     64 
     65 
     66= Why doesn't the Facebook Like /Send show up properly even though I've enabled it? 
    6667 
    6768You may need to add the following to the HMTL tag in your theme : xmlns:fb="http://www.facebook.com/2008/fbml". 
     
    7980= My WordPress database doesn't use the default 'wp_' table prefix. Will this plugin still work? = 
    8081 
    81 Yes, and its also WPMU/ WP Networked Blogs mode compliant. 
    82  
     82Yes, and its also  WP Networked Blogs mode compliant. 
    8383 
    8484 
     
    102102- Use the [Wordbooker Support Forums](http://wordbooker.tty.org.uk/forums/). Either start a new topic, or add to an existing topic. Please don't post any issue you have onto an existing thread unless you are experiencing the same problem. 
    103103 
    104 - Alternatively, for major feature requests go to the Wordbooker Page on [GoogleCode](http://code.google.com/p/wordbooker/). 
    105  
    106104 
    107105== KNOWN CONFLICTS == 
     
    117115 
    118116== Changelog == 
     117 
     118= Version 2.1.13 09/06/2012 = 
     119- Fixed a bug where the Schema 4 code was messing up the schema 5 changes 
     120- Fixed a huge bug in how posting as a non Wordbooker configured user was working. 
     121- Fixed problems with Facebook rejecting large images by forcing the plugin to use the medium sized image if it could find it. 
     122- Limit caption field to 900 characters.. not that it should ever be that big. 
     123- Added support for translation of post title and post caption. 
     124- Added a check for undefined.undefined in shortened urls 
     125- Added support for translation of post attribute 
     126- Added a check to stop All in One Calendar events from taking the blog out due to a bug in the calendar code. 
     127- Removed the call to delete the stored session when the token is killed by Facebook. This stops the Status widgets from failing. 
     128- Added Japanese language files - Thanks to 田中昌平(Shohei Tanaka) 
     129 
    119130 
    120131= Version 2.1.12 24/05/2012 = 
  • wordbooker/trunk/wordbooker.php

    r548667 r555357  
    66Author: Steve Atty  
    77Author URI: http://wordbooker.tty.org.uk 
    8 Version: 2.1.12 
     8Version: 2.1.13 
    99*/ 
    1010 
     
    3939define('WORDBOOKER_DEBUG', false); 
    4040define('WORDBOOKER_TESTING', false); 
    41 define('WORDBOOKER_CODE_RELEASE',"2.1.12 R00 - My Recovery Injection"); 
     41define('WORDBOOKER_CODE_RELEASE',"2.1.13 R01 - Live to Fight Another Day"); 
    4242 
    4343# For Troubleshooting  
     
    7070define('WORDBOOKER_FB_VIDEO_UPLOAD',"video_upload"); 
    7171define('WORDBOOKER_FB_READ_FRIENDS',"read_friendlists"); 
    72 define('WORDBOOKER_SETTINGS', 'wordbooker_settings'); 
     72define('WORDBOOKER_SETTINGS','wordbooker_settings'); 
    7373define('WORDBOOKER_OPTION_SCHEMAVERS', 'schema_vers'); 
    74 define('WORDBOOKER_SCHEMA_VERSION', '5'); 
     74define('WORDBOOKER_SCHEMA_VERSION', '5.1'); 
    7575 
    7676$new_wb_table_prefix=$wpdb->base_prefix; 
     
    429429    } 
    430430 
    431     if ($wordbooker_settings['schema_vers']=='3') { 
     431    if ($wordbooker_settings['schema_vers']=='2.6') { 
    432432        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_POSTCOMMENTS. ' DROP PRIMARY KEY , DROP INDEX fb_comment_id, ADD PRIMARY KEY ( `blog_id` , `wp_post_id` , `fb_post_id` , `wp_comment_id` ) '); 
    433433        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_POSTCOMMENTS. ' ADD `user_id` BIGINT( 20 ) NOT NULL  '); 
     
    445445    }    
    446446 
    447     if ($wordbooker_settings['schema_vers']!='4') { 
     447    if ($wordbooker_settings['schema_vers']=='3') { 
    448448        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_POSTCOMMENTS. ' DROP PRIMARY KEY '); 
    449449        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_POSTCOMMENTS. ' DROP INDEX fb_comment_id,'); 
     
    462462    } 
    463463 
    464     if ($wordbooker_settings['schema_vers']!='5') { 
     464    if ($wordbooker_settings['schema_vers']=='4') { 
    465465 
    466466        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_POSTCOMMENTS. '  change  `fb_comment_id` `fb_comment_id` VARCHAR( 240 ) ');    
     
    473473        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_ERRORLOGS. ' change `sequence_id` `sequence_id` BIGINT( 20 ) NOT NULL AUTO_INCREMENT '); 
    474474        wordbooker_set_option('schema_vers', "5"); 
     475    } 
     476    # I know this is the same as above - brain cramp in my logic meant some changes got wiped out by accident. 
     477    if ($wordbooker_settings['schema_vers']=='5') { 
     478 
     479        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_POSTCOMMENTS. '  change  `fb_comment_id` `fb_comment_id` VARCHAR( 240 ) ');    
     480        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_POSTCOMMENTS. '  change  `fb_post_id` `fb_post_id` VARCHAR( 240 ) ');  
     481        $result = $wpdb->query('TRUNCATE TABLE '.WORDBOOKER_ERRORLOGS ); 
     482        $result = $wpdb->query('ALTER TABLE '.WORDBOOKER_ERRORLOGS.' CHANGE `sequence_id` `sequence_id` BIGINT( 20 ) NOT NULL'); 
     483        $result = $wpdb->query('ALTER TABLE '.WORDBOOKER_ERRORLOGS.' drop primary key'); 
     484        $result = $wpdb->query('TRUNCATE TABLE '.WORDBOOKER_ERRORLOGS ); 
     485        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_ERRORLOGS. ' ADD PRIMARY KEY ( `sequence_id` ) '); 
     486        $result = $wpdb->query('ALTER TABLE '. WORDBOOKER_ERRORLOGS. ' change `sequence_id` `sequence_id` BIGINT( 20 ) NOT NULL AUTO_INCREMENT '); 
     487        wordbooker_set_option('schema_vers', "5.1"); 
    475488    } 
    476489    $dummy=wp_clear_scheduled_hook('wb_cron_job'); 
     
    13991412    if ( $attachments ) { 
    14001413        foreach ( $attachments as $attachment ) { 
    1401             if ($attachment->post_type=='attachment') {wordbooker_debugger("Adding image",wp_get_attachment_url($attachment->ID),$postidD,80) ; 
    1402             $post_content2 .= ' <img src="' . wp_get_attachment_url($attachment->ID) . '"> ';} 
     1414            if ($attachment->post_type=='attachment') { 
     1415              $junk=wp_get_attachment_image_src( $attachment->ID,'medium'); 
     1416              $og_image=$junk[0]; 
     1417              if(!isset($og_image)) {$og_image=wp_get_attachment_url($attachment->ID);} 
     1418              wordbooker_debugger("Adding image",$og_image,$postidD,80) ; 
     1419     
     1420        #   $post_content2 .= ' <img src="' . wp_get_attachment_url($attachment->ID) . '"> ';} 
     1421            $post_content2 .= ' <img src="' . $og_image . '"> ';} 
    14031422        } 
    14041423    } 
     
    15091528        $images=wordbooker_strip_images($images,$flag); 
    15101529        # And limit it to 5 pictures to keep Facebook happy. 
    1511         $images = array_slice($images, 0, 5); 
     1530        $images = array_slice($images, 0, 2); 
    15121531 
    15131532    } else {  
     
    15431562    $post_link_share = get_permalink($post_id); 
    15441563    $post_link=wordbooker_short_url($post_id); 
    1545     $post_title=$post->post_title; 
     1564    $post_title=ltrim(wordbooker_translate($post->post_title),'@'); 
    15461565    $post_content = $post->post_content; 
    15471566    wordbooker_debugger("Getting the Excerpt"," ",$post->ID,80) ; 
     
    15601579        $post_content=wordbooker_translate($post_content); 
    15611580    } 
    1562     else {  $post_content=wordbooker_post_excerpt($post_content,$wordbooker_post_options['wordbooker_extract_length']);} 
     1581    else {  $post_content=wordbooker_post_excerpt(wordbooker_translate($post_content),$wordbooker_post_options['wordbooker_extract_length']);} 
    15631582    update_post_meta($post->ID,'_wordbooker_extract',$post_content); 
    15641583    # this is getting and setting the post attributes 
     
    15891608 
    15901609    $wordbooker_fb_post = array( 
    1591       'name' => ltrim($post_data['post_title'],'@'), 
     1610      'name' => ltrim(wordbooker_translate($post_data['post_title']),'@'), 
    15921611      'link' => $post_data['post_link'], 
    15931612      'message'=> $post_data['post_attribute'], 
    15941613      'description' => $post_data['post_excerpt'], 
    15951614      'picture'=>$images[0]['src'], 
    1596        'caption' => get_bloginfo('description') 
     1615    #  'icon'=>'http://www.canalplan.org.uk/favicon.ico', 
     1616       'caption' => wordbooker_translate(get_bloginfo('description')) 
    15971617    #  'media' => json_encode($images) 
    15981618    ); 
     
    16031623        $wordbooker_fb_post['caption'] = get_bloginfo(‘url’); 
    16041624    } 
     1625    $wordbooker_fb_post['caption']=wordwrap($wordbooker_fb_post['caption'],900); 
    16051626    wordbooker_debugger("Post Titled : ",$post_data['post_title'],$post_id,90) ; 
    16061627    wordbooker_debugger("Post URL : ",$post_data['post_link'],$post_id,90) ; 
     1628    wordbooker_debugger("Post Caption : ",$wordbooker_fb_post['caption'],$post_id,90) ; 
    16071629     
    16081630    if ($wordbooker_post_options['wordbooker_actionlink']==100) { 
     
    16331655    $target_types = array('PW' => "",'FW' => __('Fan Wall', 'wordbooker'), 'GW'=>__('Group wall', 'wordbooker')); 
    16341656 
    1635     $posting_type=array("1"=>"Wall Post","2"=>"Note","3"=>"Status Update"); 
     1657    $posting_type=array("1"=>"Wall Post","2"=>"Note","3"=>"Status Update","4"=>"Link"); 
    16361658    foreach($posting_array as $posting_target) { 
    16371659        $access_token='dummy access token'; 
     
    17141736    # This provides short_url responses by checking for various functions and using  
    17151737    $wordbooker_settings =wordbooker_options();  
    1716      
     1738    $url = get_permalink($post_id); 
    17171739    if (isset($wordbooker_settings["wordbooker_disable_shorties"])) { 
    1718         $url = get_permalink($post_id); 
    17191740        return $url; 
    17201741    } 
    1721     $url = get_permalink($post_id); 
    17221742    $url2 = $url; 
    17231743    if (function_exists(fts_show_shorturl)) {    
     
    17291749    } 
    17301750    if ("!!!".$url."XXXX"=="!!!XXXX") {$url = $url2;} 
     1751    if (stripos($url,'undefined.undefined')) {$url=$url2;} 
    17311752    return $url; 
    17321753} 
     
    17661787    $attribute_text=str_ireplace( '%time%', $time_info,$attribute_text ); 
    17671788 
    1768     return $attribute_text; 
     1789    return wordbooker_translate($attribute_text); 
    17691790} 
    17701791 
     
    23892410function wordbooker_publish_action($post_id) { 
    23902411    global $user_ID, $user_identity, $user_login, $wpdb,$wordbooker_post_options,$blog_id,$doing_post; 
     2412    $wordbooker_post_options= get_post_meta($post_id, '_wordbooker_options', true);  
     2413    # var_dump($fred); 
     2414    # var_dump($wordbooker_post_options); 
    23912415    if(isset($doing_post)) {wordbooker_debugger("Looks like we've already got a post going on so we can give up","",$post_id,99) ; return;} 
    23922416    $doing_post="running"; 
     
    24142438    if ($user_ID >=1) {$whichuser=$user_ID;}  
    24152439    # If the default user is set to 0 then we use the current user (or the author of the post if that isn't set - i.e. if this is a scheduled post) 
    2416     if  ($wordbooker_post_options["wordbooker_default_author"] == 0 ) {$wpuserid=$whichuser;} else {$wpuserid=$wordbooker_post_options["wordbooker_default_author"];} 
     2440    $wpuserid=$whichuser; 
     2441    if  ($wordbooker_post_options["wordbooker_override_id"] > 0 ) {$wpuserid=$wordbooker_post_options["wordbooker_override_id"];} 
    24172442    $images=wordbooker_return_images($post->post_content,$post->ID,0); 
    24182443    $ogimage=$images[0]['src']; 
     
    24672492        # This is where we need to put in the custom post type checks 
    24682493    if ($post->post_type=='reply') {return;} 
     2494    # Stop all in one calendar events from firing 
     2495    if ($post->post_type=='ai1ec_event') {return;} 
    24692496    if ($_POST['action']=='autosave') { return;} 
    24702497    wordbooker_update_post_meta($post); 
     
    24912518    $wb_params = get_post_meta($post->ID, '_wordbooker_options', true); 
    24922519    $wb_user_id=$post->post_author;  
     2520    #var_dump($fred);var_dump($fred); var_dump($wb_params);var_dump($fred);var_dump($fred); 
    24932521    # Put a check in here so that we can allow the EDIT user's preferences to over-ride the AUTHOR settings 
    24942522    if (wordbooker_get_userdata($user_ID) && (isset($wordbooker_settings["wordbooker_override_author"]))) {  
     
    25352563    if ( !wordbooker_get_userdata($wb_user_id)) { 
    25362564        wordbooker_debugger("No Settings for ".$post->post_author." so using default author settings",' ',$post->ID,80); 
    2537         $wb_user_id=$wordbooker_settings["wordbooker_default_author"]; 
     2565        $wb_user_id=$wordbooker_settings["wordbooker_default_author"]; } 
    25382566        # New get the user level settings from the DB 
    25392567        $wordbooker_user_settings_id="wordbookuser".$blog_id; 
     
    25572585            } 
    25582586        } 
    2559     } 
     2587    #} 
    25602588    # OK now lets get the settings from the POST array 
    25612589    foreach (array_keys($_POST) as $key ) { 
     
    25852613    global $user_ID, $user_identity, $user_login, $wpdb, $blog_id,$wordbooker_settings; 
    25862614    $post = get_post($post_id); 
     2615    #var_dump($wordbooker_settings); 
    25872616    if ((isset($user_ID) && $user_ID>0) &&  (!current_user_can(WORDBOOKER_MINIMUM_ADMIN_LEVEL))) { wordbooker_debugger("This user doesn't have enough rights"," ",$post_id,99) ; return; } 
    25882617    wordbooker_debugger("Commence Publish "," ",$post_id,99) ;  
Note: See TracChangeset for help on using the changeset viewer.