Plugin Directory

Changeset 346599


Ignore:
Timestamp:
02/16/2011 10:05:56 PM (15 years ago)
Author:
0xTC
Message:

Now is the winter of our discontent made summer by this version of WP Tweet Button

Location:
wp-tweet-button/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-tweet-button/trunk/readme.txt

    r315651 r346599  
    33Tags: twitter, tweet button, retweet, tweet, autotweet, WP Tweet Button, advanced, tweeting, social media, button, SEO, share, shortener, awe.sm, b2l.me, bit.ly, cli.gs, sl.ly, snipr, su.pr, tinyurl, analytics, google analytics, campaign, campaign tracking, auto tweeting, auto posts
    44Requires at least: 2.7.2
    5 Tested up to: 3.0.1
     5Tested up to: 3.0.5
    66Stable tag: trunk
    77Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6331357
     
    124124== Changelog ==
    125125
     126= 2.0.3 =
     127* Transposh Translation Filter support.
     128* Added option to remove styles in RSS feeds.
     129* Improved compatibility with All in One SEO (thanks to monodistortion)
     130
    126131= 2.0.2 =
    127132* Bugfix related to Auto-Tweeting and custom menus.
  • wp-tweet-button/trunk/wp-tweet-button.php

    r315652 r346599  
    22/*
    33Plugin Name: WP Tweet Button
    4 Version: 2.0.2
     4Version: 2.0.3
    55Plugin URI: http://0xtc.com/plugins/wp-tweet-button
    66Description: The WordPress implementation of the official Twitter Tweet Button.
     
    2626    (string:html)
    2727    Use this hook to manipulate the generated button html code.
    28    
     28
    2929#   wp_tweet_button_options
    3030    (Array)
     
    3434    (Array)
    3535    Use this hook together with the wp_tweet_button_options hook to add new shorteners to the configuration.
    36 
    3736*/
    3837
     
    4140    var $txtdom = 'wp-tweet-button';
    4241    var $readyState = false;
     42    var $excerptState = false;
    4343    var $postid;
     44    /**
     45    * The following are default settings for the plugin's configuration.
     46    * Most of these settings can be accessed from the plugin's settings page.
     47    */
    4448    var $options = array(
    4549        'tw_hook_prio'=> '75',
     
    7882        'tw_style_c'=> '',
    7983        'tw_count'=> 'horizontal',
     84        'tw_nostyle_feed'=> '',
    8085        'tw_force_manual'=> '',
    8186        'tw_display_single'=> '1',
     
    9196        'tw_use_rel_me'=> '',
    9297        'tw_add_rel_shortlink'=> '',
     98        'tw_no_https_shortlinks'=> '1',
    9399        'tw_post_type_exclude'=>'',
    94100        'tw_config_ver'=>'',
     
    101107        'tw_script_infooter'=>'0'
    102108        );
     109    /**
     110    * These are settings from the list above that have boolean values (true or false / 1 or 0)
     111    * It is used for cleanup and validation actions.
     112    */
    103113    var $boolops = array(
    104114        'tw_debug',
     
    120130        'tw_url_samecount',
    121131        'tw_auto_tweet_pages',
    122         'tw_auto_tweet_posts'
     132        'tw_auto_tweet_posts',
     133        'tw_no_https_shortlinks',
     134        'tw_nostyle_feed'
    123135        );
     136    /**
     137    * These are TinyArro.ws domains.
     138    * Due to javascript ristrictions there is currently no method to automatically add
     139    * TinyArro.ws domains to a tweet button dialog.
     140    * Although TinyArro.ws is not supported we're declaring them here in the hope of one day
     141    * being able to use them.
     142    */
    124143    var $tinyarrow_hosts = array(
    125144        'xn--ogi.ws'=>'➨.ws',
     
    138157        'ta.gd '=>'ta.gd'
    139158        );
    140 
     159    /**
     160    * The following array is used to extract data about shorteners and
     161    * their configuration.
     162    */
    141163    var $shortenerdata = array(
    142164        'none' => array(
     
    256278        )
    257279    );
     280
     281    /**
     282    * Auto-tweet provider URL.
     283    */
     284   
    258285    var $wptbsrv = 'http://wptbsrv.0xtc.com/a/';
    259286
     287    /**
     288    * This function is used during development to output debug data.
     289    */
    260290    function decho ($var_name,$thingie){
    261291        if ($this->tw_get_option('tw_debug') != '1') return false;
     
    269299    }
    270300
     301    /**
     302    * This function isn't actually used but is left here for historical reasons. Yeah, that's it...historical reasons.
     303    */
    271304    function init() {
    272305        $this->tw_readoptions();
    273306    }
    274307
     308    /**
     309    * Commits options to database.
     310    */
    275311    function tw_writeoptions(){
    276312        update_option($this->optionsname, $this->options);
    277313    }
    278314
     315    /**
     316    * Validate and write settings.
     317    */
    279318    function tw_updateoptions() {
    280319        if( isset($_POST['tw_where']) ) {
     
    296335    }
    297336   
     337    /**
     338    * Validate and read configuration into class.
     339    */
    298340    function tw_readoptions() {
    299341        $values = $this->options;
     
    326368    }
    327369
     370    /**
     371    * This function reads individual settings
     372    */
    328373    function tw_get_option($optionname){
    329374        return $this->options[$optionname];
    330375    }
    331376
     377    /**
     378    * This function sets individual settings
     379    */
    332380    function tw_set_option($optionname=null, $value=null){
    333381        $this->options[$optionname]=$value;
    334382    }
    335383
     384    /**
     385    * Clear cached shortURLs if requested.
     386    */
    336387    function tw_flush_cached_shortlinks(){
    337388        if ($_POST['tw_flush_cached_shortlinks']=='1'){
     
    346397    }
    347398   
     399    /**
     400    * Clear page cache if requested
     401    */
    348402    function tw_flush_cache(){
    349403        $msg = '';
     
    360414    }
    361415
     416    /**
     417    * Find the author's twitter name from various settings.
     418    */
    362419    function tw_get_twitter_name(){
    363420        $viauser=false;
     
    379436    }
    380437
     438    /**
     439    * This function decides the format of the tweet text based on preferences and limitations.
     440    */
    381441    function tw_get_text($entitydecode=false){
     442        global $post;
    382443        if(is_int($this->postid)) {
    383444            $post = get_post($this->postid);
    384445        } else {
    385             global $post;
    386         }
     446            $this->postid = $post->ID;
     447        }
     448       
    387449        if (get_post_meta($post->ID, '_twitterrelated_custom_text', true)){
    388450            if ($entitydecode){
     
    401463    }
    402464   
     465    /**
     466    * Applies formatting and transformations to texts.
     467    */ 
    403468    function tw_preptext($text){
    404469        if(is_int($this->postid)) {
     
    415480    }
    416481
     482    /**
     483    * Adds relational tag "me" to header.
     484    */
    417485    function tw_add_rel_me(){
    418486        echo '<link rel="me" href="http://twitter.com/'.$this->tw_get_twitter_name().'" />';
    419487    }
     488   
     489    /**
     490    * Adds relational tag "shortlink" to header.
     491    */
    420492    function tw_add_rel_shortlink(){
    421493        echo '<link rel="shortlink" href="'.$this->tw_get_short_url().'" />';
    422494    }
    423495   
     496    /**
     497    * Used once to hook up actions.
     498    */
     499    function tw_hook_up_actions (){
     500            add_action('admin_menu',            array(&$this, 'tw_options'));
     501            add_action('admin_init',            array(&$this, 'tw_init'));
     502            add_action('admin_menu',            array(&$this, 'tw_tweet_button_post_options_box'));
     503
     504            add_action('new_to_publish',        array(&$this, 'tw_post_tweet_button_box_process'));
     505            add_action('new_to_future',         array(&$this, 'tw_post_tweet_button_box_process'));
     506            add_action('new_to_draft',          array(&$this, 'tw_post_tweet_button_box_process'));
     507            add_action('future_to_draft',       array(&$this, 'tw_post_tweet_button_box_process'));
     508            add_action('future_to_future',      array(&$this, 'tw_post_tweet_button_box_process'));
     509            add_action('draft_to_future',       array(&$this, 'tw_post_tweet_button_box_process'));
     510            add_action('draft_to_draft',        array(&$this, 'tw_post_tweet_button_box_process'));
     511            add_action('draft_to_publish',      array(&$this, 'tw_post_tweet_button_box_process'));
     512            add_action('pending_to_publish',    array(&$this, 'tw_post_tweet_button_box_process'));
     513
     514            add_action('publish_post',          array(&$this, 'tw_post_tweet_button_box_process'));         
     515            add_action('publish_page',          array(&$this, 'tw_post_tweet_button_box_process'));
     516
     517            add_action('publish_post',          array(&$this, 'tw_send_auto_tweet'),100,1);
     518            add_action('new_to_publish',        array(&$this, 'tw_send_auto_tweet'),100,1);
     519            add_action('draft_to_publish',      array(&$this, 'tw_send_auto_tweet'),100,1);
     520            add_action('pending_to_publish',    array(&$this, 'tw_send_auto_tweet'),100,1);
     521
     522            add_action('profile_update',        array(&$this, 'tw_account_cleanup'));   
     523    }
     524   
     525    /**
     526    * The function that runs the show.
     527    */
    424528    function wpTweetButton(){
    425529        if(is_int($this->postid)) {
     
    427531        } else {
    428532            global $post;
     533            $this->postid = $post->ID;
    429534        }
    430535        $this->options = $this->tw_readoptions();
     
    433538        add_action('future_to_publish',         array(&$this, 'tw_send_auto_tweet'),100,1);
    434539        if (is_admin()){
    435             add_action('admin_menu',            array(&$this, 'tw_options'));
    436             add_action('admin_init',            array(&$this, 'tw_init'));
    437             add_action('admin_menu',            array(&$this, 'tw_tweet_button_post_options_box'));
    438             add_action('new_to_publish',        array(&$this, 'tw_post_tweet_button_box_process'));
    439             add_action('publish_post',          array(&$this, 'tw_post_tweet_button_box_process'));
    440 
    441             add_action('publish_post',          array(&$this, 'tw_send_auto_tweet'),100,1);
    442             add_action('new_to_publish',        array(&$this, 'tw_send_auto_tweet'),100,1);
    443             add_action('draft_to_publish',      array(&$this, 'tw_send_auto_tweet'),100,1);
    444             add_action('pending_to_publish',    array(&$this, 'tw_send_auto_tweet'),100,1);
    445 
    446             add_action('profile_update',        array(&$this, 'tw_account_cleanup'));
    447 
     540            $this->tw_hook_up_actions();
    448541            $uri=null;
    449542            if($this->tw_updateoptions()){
     
    463556                $oauth = filter_input(INPUT_GET, 'oauth', FILTER_SANITIZE_STRING);
    464557            } else {
    465                 // for hosts that refuse to upgrade to php5 (This is less secure)
    466558                $t1 = $_GET['t1'];
    467559                $t2 = $_GET['t2'];
     
    500592        add_filter('the_title', array(&$this,'tw_set_placement_ready'), 9);
    501593        add_filter('the_content', array(&$this, 'tw_update'),$this->tw_get_option('tw_hook_prio'));
    502         add_filter('get_the_excerpt', array(&$this, 'tw_remove_filter'), 9);
     594        add_filter('get_the_excerpt', array(&$this,'tw_enter_excerpt'), 1);
     595        add_filter('get_the_excerpt', array(&$this,'tw_exit_excerpt'), 9999);
     596        // add_filter('get_the_excerpt', array(&$this, 'tw_remove_filter'), 9);
     597        // ----------------------
    503598        if ($this->tw_get_option('tw_display_excerpt') == '1') add_filter('the_excerpt', array(&$this, 'tw_update'), $this->tw_get_option('tw_hook_prio'));
    504599        add_action('init', array(&$this, 'tw_add_script'));
     
    512607    }
    513608
     609    /**
     610    * This is called if a post is in excerpt mode.  It sets $this->excerptState to
     611    * true, so we can test for it later.
     612    */
     613    function tw_enter_excerpt($the_excerpt) {
     614        $this->excerptState = true;
     615        return $the_excerpt;
     616    }
     617   
     618    function tw_exit_excerpt($the_excerpt) {
     619        $this->excerptState = false;
     620        return $the_excerpt;
     621    }
     622   
     623    /**
     624    * This writes a twitter username to the user's settings.
     625    */
    514626    function tw_account_cleanup($user_id) {
    515627        $twitter_username = $_POST['twitter'];
     
    523635
    524636   
     637    /**
     638    * This function sets the readyState when the title is displayed.
     639    * This prevents that the tweet button isn't rendered in the header area.
     640    */
    525641    function tw_set_placement_ready($title){
    526642        $this->readyState=true;
     
    528644    }
    529645
     646    /**
     647    * Deprecated function that removed content filter and added kit again at a later time
     648    */
    530649    function tw_remove_filter($content) {
    531650        remove_action('the_content', array(&$this, 'tw_update'),$this->tw_get_option('tw_hook_prio'));
     
    534653    }
    535654
     655    /**
     656    * Deprecated function that added content filter
     657    */
    536658    function tw_add_content_filter ($content){
    537659        add_filter('the_content', array(&$this, 'tw_update'),$this->tw_get_option('tw_hook_prio'));
     
    539661    }
    540662
     663    /**
     664    * Function returns a list of hashtags (#one #two #three) based on post tags.
     665    */
    541666    function tw_get_hash_tags(){
    542667        if(is_int($this->postid)) {
     
    555680    }
    556681
     682    /**
     683    * Function returns a list of category hash tags (#one #two #three) based on post categories.
     684    */
    557685    function tw_get_hash_cats(){
    558686        if(is_int($this->postid)) {
     
    571699    }
    572700
     701    /**
     702    * Universal function for gettings the URL of a post.
     703    */
    573704    function tw_get_the_url($bwdata=false){
    574705        $shortener = $this->tw_get_option('tw_url_shortener');
     
    581712    }
    582713
     714    /**
     715    * Function returns the post's relationship with a twitter account.
     716    */
    583717    function tw_get_related_text($urenc=false){
    584718        if(is_int($this->postid)) {
     
    601735    }
    602736   
     737    /**
     738    * Function returns attributes for HTML5 based buttons
     739    */
    603740    function tw_build_options_data() {
    604741        if(is_int($this->postid)) {
     
    606743        } else {
    607744            global $post;
     745            $this->postid = $post->ID;
    608746        }
    609747        $textprefix = null;
     
    644782    }
    645783   
     784    /**
     785    * Function returns url parameters for legacy buttons
     786    */
    646787    function tw_build_options($bwdata=false) {
    647788        if(is_int($this->postid)) {
     
    649790        } else {
    650791            global $post;
     792            $this->postid = $post->ID;
    651793        }
    652794        $textprefix =null;
     
    674816    }
    675817
     818    /**
     819    * Function is an HTTP tool for requesting HTML.
     820    */
    676821    function tw_nav_browse($url, $use_POST_method = false, $POST_data = null) {
    677822        if(function_exists('wp_remote_request') && function_exists('wp_remote_retrieve_response_code') && function_exists('wp_remote_retrieve_body') && $use_POST_method == 'GET') {
     
    715860    }
    716861
     862    /**
     863    * Function returns the "long" url for a post.
     864    */
    717865    //  hook: wp_tweet_button_long_url
    718866    function tw_get_long_url($addtrack=false) {
     867        global $my_transposh_plugin;
     868   
    719869        if(is_int($this->postid)) {
    720870            $post = get_post($this->postid);
     
    729879            $perms = trim(get_permalink($post->ID));
    730880        }
    731         if ($addtrack && $this->tw_get_option('tw_ga_code') && $this->tw_get_option('tw_enable_ga_code')==1) {
     881       
     882        if (is_object($my_transposh_plugin)){
     883            if ($my_transposh_plugin->target_language) {
     884                $perms= transposh_utils::rewrite_url_lang_param($perms, $my_transposh_plugin->home_url, $my_transposh_plugin->enable_permalinks_rewrite, $my_transposh_plugin->target_language, $my_transposh_plugin->edit_mode);
     885            }
     886        }
     887            if ($addtrack && $this->tw_get_option('tw_ga_code') && $this->tw_get_option('tw_enable_ga_code')==1) {
    732888            if (strstr($perms,'?')){$prestr='&';} else {$prestr='?';}
    733889            $tmptxt= str_replace('?', '', $this->tw_get_option('tw_ga_code'));
     
    739895            $perms = $perms . $prestr . $tmptxt;
    740896        }
     897       
    741898        $perms = apply_filters('wp_tweet_button_long_url', $perms);
    742899        if (strstr($perms,admin_url())){return false;}
     
    745902    }
    746903
     904    /**
     905    * Function strips www. prefix from URLs.
     906    */
    747907    function tw_strip_www($content){
    748908        $str = str_replace('http://www.','http://',$content);
     
    751911    }
    752912   
     913    /**
     914    * Function returns the "short" url for a post (or not...).
     915    */
    753916    // hook: wp_tweet_button_url
    754917    function tw_get_short_url() {
     
    757920        } else {
    758921            global $post;
     922            $this->postid = $post->ID;
    759923        }
    760924        $perms = $this->tw_get_long_url(true);
    761925        if ($perms == false) return false;
     926        if (strstr($perms,'https://') && $this->tw_get_option('tw_no_https_shortlinks')=='1') return $perms;
     927        if (strstr($perms,'preview=true')) return $perms;
    762928        $selectedshortener=$this->tw_get_option('tw_url_shortener');
    763929        if (
    764             ($post && get_post_status($post->ID) != 'publish') ||
     930//          ($post && $post->post_status != 'publish') ||
    765931            ($selectedshortener == 'none')) {
    766932            return $perms;
     
    808974                    $fetch_url = trim($this->tw_nav_browse($request_url, $method, $POST_data));
    809975                }
    810                 if ( !empty( $fetch_url ) && ($fetch_url != $perms) && strstr($fetch_url,'http://')) {
     976                if ( !empty( $fetch_url ) && ($fetch_url != $perms) && strstr($fetch_url,'http://') && (!strstr($perms,'preview=true'))) {
    811977                    if (!update_post_meta($post->ID, '_activeshortener', $selectedshortener )) {
    812978                        add_post_meta($post->ID, '_activeshortener', $selectedshortener);
     
    819985                    }
    820986                } else {
    821                     $fetch_url = $perms;           
     987//                  $fetch_url = $perms;
    822988                }
    823989            } else {
     
    833999    }
    8341000
     1001    /**
     1002    * Function generates a tweet button.
     1003    * $bwdata can be used to return HTML5 (true) or not (false)
     1004    */
    8351005    // Hook : wp_tweet_button
    8361006    function tw_generate_button($bwdata=false) {
     
    8511021            if ($alignment=='center') $alignstr = ';float:none;margin:0 auto;text-align:center;';
    8521022        }
    853         $button =   '<div class="tw_button" style="' . $this->tw_get_option('tw_style_c') . $alignstr . '">';
    854         $button .=  '<a href="http://twitter.com/share'.$this->tw_build_options($bwdata).'" ' . $data . $relstr . ' class="twitter-share-button" target="_blank" style="width:55px;height:22px;background:transparent url(\''. WP_PLUGIN_URL.'/wp-tweet-button/tweetn.png\') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">'.$tw_text.'</a>';
     1023
     1024        if ($this->tw_get_option('tw_nostyle_feed') == ''){
     1025            $StyleStrDiv = ' style="' . $this->tw_get_option('tw_style_c') . $alignstr . '"';
     1026            $StyleStrBtn = ' style="width:55px;height:22px;background:transparent url(\''. WP_PLUGIN_URL.'/wp-tweet-button/tweetn.png\') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;"';
     1027        } else {
     1028            $StyleStrDiv = '';
     1029            $StyleStrBtn = ''; 
     1030        }
     1031
     1032        $button =   '<div class="tw_button"'.$StyleStrDiv.'>';
     1033        $button .=  '<a href="http://twitter.com/share'.$this->tw_build_options($bwdata).'" class="twitter-share-button" target="_blank" ' . $data . $relstr . $StyleStrBtn.'>'.$tw_text.'</a>';
    8551034        $button .=  '</div>';
    8561035        $button = apply_filters( 'wp_tweet_button', $button );
     
    8581037    }
    8591038   
     1039    /**
     1040    * Function places button in content.
     1041    */
    8601042    function tw_update($content) { 
    8611043        if(is_int($this->postid)) {
     
    8631045        } else {
    8641046            global $post;
     1047            $this->postid = $post->ID;
    8651048        }
    8661049        if (
    8671050            (!$this->readyState) ||
     1051            ($this->tw_get_option('tw_display_excerpt') == '' && $this->excerptState) ||
    8681052            (get_post_meta($post->ID, '_exclude_tweet_button', true))                           ||
    8691053            ($this->tw_get_option('tw_display_feed') == '' && is_feed())                        ||
     
    9121096    }
    9131097
     1098    /**
     1099    * Function returns a tweet button.
     1100    */
    9141101    function tweetbutton($post,$bwdata=false) {
    9151102        if (isset($post->ID)){
     
    9251112    }
    9261113
    927     // Put the script for the button in your head or foot
     1114    /**
     1115    * Function places twitter script in your header or footer
     1116    */
    9281117    function tw_add_script() {
    9291118        if ($this->tw_get_option('tw_url_shortener')=='awesm') {
     
    9381127    }
    9391128
     1129    /**
     1130    * Function outputs CSS for the settings page
     1131    */
    9401132    function tw_drawcss_admin(){
    9411133            ?><style type="text/css">
     
    9681160    }
    9691161
     1162    /**
     1163    * Function returns settings page
     1164    */
    9701165    function tw_options_page(){
    9711166        if( function_exists( 'add_meta_box' )) {
     
    9931188    }
    9941189
     1190    /**
     1191    * Function returns a row on the settings page
     1192    */
    9951193    function tw_row_head($rh,$lfor=""){
    9961194        return '
     
    10021200    }
    10031201   
     1202    /**
     1203    * Function outputs the settings page contents
     1204    */
    10041205    function tw_options_box() {
    10051206        $msg['w3'] = __('W3 Total Cache page cache has been cleared',$this->txtdom);
     
    13351536                                <input type="checkbox" value="1" name="tw_flush_cached_shortlinks" id="tw_flush_cached_shortlinks" />
    13361537                                <label for="tw_flush_cached_shortlinks"><?php _e('Delete all previously saved shortlinks when I save.',$this->txtdom); ?></label><br />
    1337 
     1538                                <input type="checkbox" value="1" <?php if ($this->tw_get_option('tw_no_https_shortlinks') == '1') echo 'checked="checked"'; ?> name="tw_no_https_shortlinks" id="tw_no_https_shortlinks" />
     1539                                <label for="tw_no_https_shortlinks"><?php _e('Do not shrink HTTPS URLs.',$this->txtdom); ?></label><br />
    13381540                        </td>
    13391541                        <td class="twhdata twhhlp" crowspan="<?php echo ($this->shortenerdata['tinyarrow']['enabled']!='false') ? '7' : '6';?>" valign="top" style="border-top:1px solid #fff;">
     
    14421644                            <input type="checkbox" value="1" <?php if ($this->tw_get_option('tw_script_infooter') == '1') echo 'checked="checked"'; ?> name="tw_script_infooter" id="tw_script_infooter" />
    14431645                            <label for="tw_script_infooter"><?php _e('Place script in footer.',$this->txtdom); ?></label><br />
     1646                            <input type="checkbox" value="1" <?php if ($this->tw_get_option('tw_nostyle_feed') == '1') echo 'checked="checked"'; ?> name="tw_nostyle_feed" id="tw_nostyle_feed" />
     1647                            <label for="tw_nostyle_feed"><?php _e('No styles in feeds.',$this->txtdom); ?></label><br />
    14441648                            <?php
    14451649                                    if (function_exists('w3tc_pgcache_flush')) {
     
    15071711    }
    15081712
     1713    /**
     1714    * Function saves per-post options
     1715    */
    15091716    function tw_post_tweet_button_box_process($post_ID) {
    15101717        $thepost = get_post($post_ID);
     1718        $this->postid = $post_ID;
    15111719        if (!empty($_POST)){
    15121720            if ($_POST['tw_do_not_send_auto_tweet'] == '1') {
     
    15451753    }
    15461754
    1547 
     1755    /**
     1756    * Function regulates and manages autotweeting
     1757    */
    15481758    function tw_send_auto_tweet($post_id){
    15491759        global $post_type_object;
     
    15581768        if ($thepost->post_type == 'revision' || ($thepost->post_status != 'publish' && $thepost->post_status != 'future') || $thepost->post_password != '' ) return false;
    15591769        if (
    1560         (
    1561             ($this->tw_get_option('tw_auto_tweet_posts') == '1' && $post_type_object->hierarchical=='') ||
    1562             ($this->tw_get_option('tw_auto_tweet_pages') == '1' && $post_type_object->hierarchical=='1')
    1563         ) &&
     1770                (
     1771                    ($this->tw_get_option('tw_auto_tweet_posts') == '1' && $post_type_object->hierarchical=='') ||
     1772                    ($this->tw_get_option('tw_auto_tweet_pages') == '1' && $post_type_object->hierarchical=='1')
     1773                ) &&
    15641774        $this->tw_get_option('tw_auto_tweet_token') != '' &&
    15651775        $this->tw_get_option('tw_auto_tweet_token_secret') != '' &&
     
    15871797    }
    15881798
     1799    /**
     1800    * Function validates, edits and optimizes tweet text for an autotweet
     1801    */
    15891802    function tw_validate_tweet($text, $url){
    15901803        $max    = 134;
     
    16571870        }
    16581871    }
    1659    
     1872
     1873    /**
     1874    * Function outputs the per-post settings dialog.
     1875    */ 
    16601876    function tw_post_tweet_button_box() {
    16611877        if(is_int($this->postid)) {
     
    17181934    }
    17191935
     1936    /**
     1937    * Function hooks per-post settings dialog
     1938    */
    17201939    function tw_tweet_button_post_options_box() {
    17211940        if ( version_compare(get_bloginfo('version'), '2.7', '>=')) {
     
    17261945    }
    17271946
     1947    /**
     1948    * Function registers settings record
     1949    */
    17281950    function tw_init(){
    17291951        if(function_exists('register_setting')){
     
    17321954    }
    17331955
     1956    /**
     1957    * Function cleans up returned twitter usernames
     1958    */
    17341959    function tw_sanitize_username($username){
    17351960        $username = str_replace(array('http://','https://','twitter.com/','twitter.com','@'),'',$username);
     
    17371962    }
    17381963
    1739     // Release the Kraken!
     1964    /**
     1965    * Function releases the Kraken.
     1966    */
    17401967    function tw_activate(){
    17411968        add_option('wp_tweet_button',array());
     
    17431970    }
    17441971
     1972    /**
     1973    * Function adds settings page to the menu.
     1974    */
    17451975    function tw_options() {
    17461976        add_options_page('WP Tweet Button', 'WP Tweet Button', 8, basename(__FILE__), array(&$this, 'tw_options_page'));
    17471977    }
    17481978
     1979    /**
     1980    * Function adds Twitter as a contact method in the Wordpress user settings.
     1981    */
    17491982    function tw_add_twitter_contactmethod($contactmethods) {
    17501983        $contactmethods['twitter'] = 'Twitter <span class="description">(username)</span>';
     
    17531986}
    17541987
     1988/**
     1989* Function manages manual tweetbutton() calls to generate a button.
     1990*/
    17551991function tweetbutton($thepost='',$bwdata=false,$type='d'){
    17561992    global $wpTweetButton, $post;
     
    17631999}
    17642000
     2001/**
     2002* Other things...and stuff...
     2003*/
     2004/**
     2005* Class, exciting and new. Create one or even a few. Bugs, a coder's reward. Ruins flow and it comes back to you. Wordpress, soon will be making another run and Wordpress promises something for everyone....
     2006*/ 
    17652007$wpTweetButton = new wpTweetButton();
    17662008load_plugin_textdomain($wpTweetButton->txtdom,null,dirname( plugin_basename( __FILE__ ) ).'/lang/');
    17672009register_activation_hook( __FILE__, array(&$wpTweetButton, 'tw_activate'));
     2010
    17682011?>
Note: See TracChangeset for help on using the changeset viewer.