Dotclear

Changeset 2222


Ignore:
Timestamp:
05/06/10 17:31:55 (13 years ago)
Author:
JcDenis
Message:

shareOn 0.4.2:

  • Added post sample to Google buzz and fixed url
  • Fixed Flattr description
Location:
plugins/shareOn
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • plugins/shareOn/_define.php

    r2218 r2222  
    1717     /* Description*/         "Add some buttons to your posts to share them", 
    1818     /* Author */        "JC Denis", 
    19      /* Version */       '0.4.1', 
     19     /* Version */       '0.4.2.2', 
    2020     /* Permissions */        'content' 
    2121); 
    22      /* date */          #20100505 
     22     /* date */          #20100506 
    2323?> 
  • plugins/shareOn/inc/class.shareon.php

    r2219 r2222  
    402402          return  
    403403          trim( 
    404           preg_replace(array('~\r\n|\r|\n~',"'"),array(' ',"\'"), 
     404          str_replace("'","\'", 
     405          preg_replace('~\r\n|\r|\n~',' ', 
    405406          text::cutString( 
    406407          html::escapeHTML( 
     
    408409          html::clean( 
    409410               $str 
    410           ))),180))); 
     411          ))),180)))); 
    411412     } 
    412413      
     
    475476     public $name = 'Google Buzz'; 
    476477     public $home = 'http://www.google.com/buzz/stuff'; 
    477      public $base = '<a href="http://www.google.com/buzz/post" class="google-buzz-button" title="Google Buzz" data-message="%TITLE" data-url="%URL%" data-locale="%LANG%" data-button-style="%STYLE%"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script>'; 
     478     public $base = '<a href="http://www.google.com/buzz/post" class="google-buzz-button" title="Google Buzz" data-message="%TITLE%%DESC%" data-url="%URL%" data-locale="%LANG%" data-button-style="%STYLE%"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script>'; 
    478479     public $size = array( 
    479480          0 => array('style'=>'normal-count','width'=>51,'height'=>82), 
    480481          1 => array('style'=>'small-count','width'=>159,'height'=>22) 
    481482     ); 
    482  
    483      public function __construct($core) 
    484      { 
    485           parent::__construct($core); 
     483     public $encode = false; 
     484     public $_showdesc = false; 
     485 
     486     public function __construct($core) 
     487     { 
     488          parent::__construct($core); 
     489          $this->_showdesc = (string) $this->s->shareOn_button_gbuzz_showdesc; 
     490     } 
     491 
     492     public function moreSettingsForm() 
     493     { 
     494          return 
     495         '<p class="field"><label>'. 
     496          __('Add post description to message'). 
     497         form::checkbox(array('gbuzz_showdesc'),1,$this->_showdesc). 
     498          '</label></p>'; 
     499     } 
     500 
     501     public function moreSettingsSave() 
     502     { 
     503          if (isset($_POST['gbuzz_showdesc'])) { 
     504               $this->s->put('shareOn_button_gbuzz_showdesc',$_POST['gbuzz_showdesc'],'boolean'); 
     505          } 
     506     } 
     507 
     508     public function completeHTMLButton($base) 
     509     { 
     510          if (!$this->_showdesc) {  
     511               return str_replace('%DESC%','',$base); 
     512          } 
     513 
     514          global $core, $_ctx; 
     515           
     516          $desc = ''; 
     517          if ($_ctx->posts->post_excerpt != '') { 
     518               $desc = self::gbuzzClean($_ctx->posts->post_excerpt); 
     519          } 
     520          elseif ($_ctx->posts->post_content != '') { 
     521               $desc .= self::gbuzzClean($_ctx->posts->post_content,500); 
     522          } 
     523 
     524          return str_replace('%DESC%',' - '.$desc,$base); 
     525     } 
     526 
     527     protected static function gbuzzClean($str,$len=null) 
     528     { 
     529          $str = 
     530          trim( 
     531          preg_replace('~\r\n|\r|\n~',' ', 
     532          html::escapeHTML( 
     533          html::decodeEntities( 
     534          html::clean( 
     535               $str 
     536          ))))); 
     537           
     538          if ($len) { 
     539               return text::cutString($str,$len); 
     540          } 
     541          else { 
     542               return $str; 
     543          } 
    486544     } 
    487545} 
  • plugins/shareOn/release.txt

    r2218 r2222  
     10.4.2 20100506 
     2 * Added post sample to google buzz and fixed url 
     3 * Fixed Flattr description 
     4 
    150.4.1 20100505 
    26 * Added Google buzz button 
Note: See TracChangeset for help on using the changeset viewer.

Sites map