Changeset 569472
- Timestamp:
- 07/09/2012 03:28:48 PM (14 years ago)
- Location:
- opera-share-button
- Files:
-
- 6 edited
- 1 copied
-
tags/0.1.3 (copied) (copied from opera-share-button/trunk)
-
tags/0.1.3/js/share.js (modified) (1 diff)
-
tags/0.1.3/osb.php (modified) (7 diffs)
-
tags/0.1.3/readme.txt (modified) (5 diffs)
-
trunk/js/share.js (modified) (1 diff)
-
trunk/osb.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
opera-share-button/tags/0.1.3/js/share.js
r569044 r569472 1 /* Copyright 2012 Sergey Yakovlev (email : sadhooklay@gmail.com) 2 3 This file is part of Opera Share Button. 4 5 Opera Share Button is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License, version 3, as 7 published by the Free Software Foundation. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with Opera Share Button. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 1 18 (function() { 2 19 function share () { -
opera-share-button/tags/0.1.3/osb.php
r569134 r569472 2 2 /* 3 3 Plugin Name: Opera Share Button 4 Version: 0.1. 24 Version: 0.1.3 5 5 Plugin URI: http://wordpress.org/extend/plugins/opera-share-button/ 6 6 Description: Put Opera Buttons in to your post. … … 116 116 $this->text_domain = 'osb'; 117 117 $this->plugin_url = plugin_dir_url(__FILE__); 118 $this->version = '0.1. 2';118 $this->version = '0.1.3'; 119 119 120 120 // Get options if they exist, else set default 121 121 if( ! $this->options = get_option( 'osb_options' ) ) { 122 122 $this->options = array( 123 'button_list' => array( ' user_page_button', 'share_button' ),124 'position' => array( ' before', 'after', 'beforeandafter', 'shortcode' ),123 'button_list' => array( 'share_button' ), 124 'position' => array( 'after' ), 125 125 'user_name' => '', 126 126 'plugin_version' => $this->version … … 160 160 // Add shortcode 161 161 add_shortcode( 'opera_buttons', array( &$this, 'osb_shortcode' ) ); 162 163 // Ability to add css file 164 add_action( 'wp_head', array( &$this, 'load_style' ) ); 162 165 } 163 166 … … 281 284 282 285 // Handle user name change. 283 if( isset( $_POST['user_name'] ) ) { 284 if( empty( $_POST['user_name'] ) ) 285 $this->messages['error'][] = __( 'Please enter your user name.', $this->text_domain ); 286 else if( ! in_array( 'user_page_button', $_POST['buttons'] ) ) 286 if( ! empty( $_POST['user_name'] ) ) { 287 if( ! in_array( 'user_page_button', $_POST['buttons'] ) ) 287 288 $this->messages['error'][] = __( 'User Page Button must be enabled.', $this->text_domain ); 288 289 else 289 290 $this->options['user_name'] = $_POST['user_name']; 290 291 } 292 else 293 if( in_array( 'user_page_button', $_POST['buttons'] ) ) 294 $this->messages['error'][] = __( 'Please enter your user name.', $this->text_domain ); 291 295 292 296 // If we have any error messages to display don't go any further with the function execution. … … 311 315 */ 312 316 public function display_buttons( $content ) { 317 global $post; 318 if( $this->options = get_option( 'osb_options' ) ) { 319 320 $osb_html = '<div class="opera-buttons">'; 321 322 // User Page Button 323 if( in_array( 'user_page_button', $this->options['button_list'] ) && $this->options['user_name'] ) { 324 $osb_html .= '<a class="osb-page" href="http://my.opera.com/' . $this->options['user_name'] . '/">'; 325 $osb_html .= '<img src="' . $this->plugin_url . 'img/myopera20-1.png" alt="' . __( 'Go to My Opera Page', $this->text_domain ) . '" />'; 326 $osb_html .= '</a>'; 327 } 328 329 // Share Button 330 if( in_array( 'share_button', $this->options['button_list'] ) ) { 331 $osb_html .= '<a class="osb-share">'; 332 $osb_html .= '<img src="' . $this->plugin_url . 'img/operashare20-2.png" alt="' . __( 'Share this post', $this->text_domain ) . '" />'; 333 $osb_html .= '<script type="text/javascript" src="' . $this->plugin_url . 'js/share.js"></script>'; 334 $osb_html .= '</a>'; 335 } 336 337 $osb_html .= '</div>'; 338 339 // Indication where show Opera Buttons depending on selected item in admin page 340 // Set the internal pointer of an array to its first element 341 $pos_name = reset( $this->options['position'] ); 342 switch( $pos_name ) { 343 case 'before' : 344 return $osb_html . $content; 345 case 'after' : 346 return $content . $osb_html; 347 case 'beforeandafter' : 348 return $osb_html . $content . $osb_html; 349 case 'shortcode' : 350 default : 351 return $content; 352 } 353 } 354 else 355 return $content; 356 } 357 358 /** 359 * Action - Adds ability to load CSS 360 * 361 * @access public 362 */ 363 public function load_style() { 364 echo '<link rel="stylesheet" type="text/css" media="screen" href="' . $this->plugin_url . 'css/opera-buttons.css" />' . "\n"; 365 } 366 367 /** 368 * Action - Create shortcode 369 * 370 * Function are using to add Opera Share Button shortcode to the content 371 * 372 * @access public 373 * @param string $content Is a string containing the enclosed content 374 * @return string Prepared string like HTML 375 */ 376 public function osb_shortcode( $content ) { 313 377 global $post; 314 378 if( $this->options = get_option( 'osb_options' ) ) { … … 333 397 $osb_html .= '</div>'; 334 398 335 // Indication where show Opera Buttons depending on selected item in admin page336 foreach( $this->options['position'] as $pos_name ) {337 switch( $pos_name ) {338 case 'before' :339 return $osb_html . $content;340 break;341 case 'after' :342 return $content . $osb_html;343 break;344 case 'beforeandafter' :345 return $osb_html . $content . $osb_html;346 break;347 case 'shortcode' :348 return $content;349 break;350 default :351 return $content;352 }353 }354 }355 }356 357 /**358 * Action - Create shortcode359 *360 * Function are using to add Opera Share Button shortcode to the content361 *362 * @access public363 * @param string $content Is a string containing the enclosed content364 * @return string Prepared string like HTML365 */366 public function osb_shortcode( $content ) {367 global $post;368 if( $this->options = get_option( 'osb_options' ) ) {369 370 $osb_html = '<div class="opera-buttons">';371 372 // User Page Button373 if( in_array( 'user_page_button', $this->options['button_list'] ) && $this->options['user_name'] ) {374 $osb_html .= ' <a href="http://my.opera.com/' . $this->options['user_name'] . '/">';375 $osb_html .= '<img src="' . $this->plugin_url . 'img/myopera20-1.png" alt="' . __( 'Go to My Opera Page', $this->text_domain ) . '" />';376 $osb_html .= '</a>';377 }378 379 // Share Button380 if( in_array( 'share_button', $this->options['button_list'] ) ) {381 $osb_html .= ' <a class="osb-share">';382 $osb_html .= '<img src="' . $this->plugin_url . 'img/operashare20-2.png" alt="' . __( 'Share this post', $this->text_domain ) . '" />';383 $osb_html .= '<script type="text/javascript" src="' . $this->plugin_url . 'js/share.js"></script>';384 $osb_html .= '</a>';385 }386 387 $osb_html .= '</div>';388 389 399 return $osb_html; 390 400 } … … 399 409 private function get_messages_html() { 400 410 $html = ''; 401 foreach( array_keys( $this->messages) as $type ){411 foreach($this->messages as $type => $messages){ 402 412 $html .= '<div class="' . $type . '">'; 403 foreach( $ this->messages[$type]as $message )413 foreach( $messages as $message ) 404 414 $html .= '<p>' . $message . '</p>'; 405 415 $html .= '</div>'; -
opera-share-button/tags/0.1.3/readme.txt
r569137 r569472 5 5 Requires at least: 3.0 6 6 Tested up to: 3.4.1 7 Stable tag: 0.1. 27 Stable tag: 0.1.3 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 22 22 * Actions: Ability to add My Opera Share button in the most easiest and flexible way. 23 23 * Display: This plugin allows you to select the position for the button: before, after, before and after or using shortcode. 24 * Display: Ability to use Cascading Style Sheets from the plugin directory. 24 25 25 26 = Translation = … … 67 68 No. Plugin not work with Wordpress versions prior to 3.0. 68 69 70 = Can I use custom CSS file? = 71 72 Yes! You can use CSS in the plugin directory: `osb/css/opera-buttons.css`. 73 69 74 == Screenshots == 70 75 … … 73 78 74 79 == Changelog == 80 81 = 0.1.3 = 82 * Added ability to use CSS form the plugin directory. 83 * Fixed localization. 84 * Changed the mechanism of busting positions of buttons. 85 * A more laconic code 75 86 76 87 = 0.1.2 = … … 89 100 == Upgrade Notice == 90 101 102 = 0.1.3 = 103 * Added ability to use CSS form the plugin directory. 104 * Fixed Russian Localization. 105 * Changed the mechanism of busting positions of buttons. 106 * Minor buxfixes 107 91 108 = 0.1.2 = 92 * NEW:Usability at the settings page of the plugin was improved.93 * NEW:Internationalization support.94 * NEW:Russian Localization.95 * NEW:Upgrading mechanism96 * BUGFIX:Minor buxfixes109 * Usability at the settings page of the plugin was improved. 110 * Internationalization support. 111 * Russian Localization. 112 * Upgrading mechanism 113 * Minor buxfixes -
opera-share-button/trunk/js/share.js
r569044 r569472 1 /* Copyright 2012 Sergey Yakovlev (email : sadhooklay@gmail.com) 2 3 This file is part of Opera Share Button. 4 5 Opera Share Button is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License, version 3, as 7 published by the Free Software Foundation. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with Opera Share Button. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 1 18 (function() { 2 19 function share () { -
opera-share-button/trunk/osb.php
r569134 r569472 2 2 /* 3 3 Plugin Name: Opera Share Button 4 Version: 0.1. 24 Version: 0.1.3 5 5 Plugin URI: http://wordpress.org/extend/plugins/opera-share-button/ 6 6 Description: Put Opera Buttons in to your post. … … 116 116 $this->text_domain = 'osb'; 117 117 $this->plugin_url = plugin_dir_url(__FILE__); 118 $this->version = '0.1. 2';118 $this->version = '0.1.3'; 119 119 120 120 // Get options if they exist, else set default 121 121 if( ! $this->options = get_option( 'osb_options' ) ) { 122 122 $this->options = array( 123 'button_list' => array( ' user_page_button', 'share_button' ),124 'position' => array( ' before', 'after', 'beforeandafter', 'shortcode' ),123 'button_list' => array( 'share_button' ), 124 'position' => array( 'after' ), 125 125 'user_name' => '', 126 126 'plugin_version' => $this->version … … 160 160 // Add shortcode 161 161 add_shortcode( 'opera_buttons', array( &$this, 'osb_shortcode' ) ); 162 163 // Ability to add css file 164 add_action( 'wp_head', array( &$this, 'load_style' ) ); 162 165 } 163 166 … … 281 284 282 285 // Handle user name change. 283 if( isset( $_POST['user_name'] ) ) { 284 if( empty( $_POST['user_name'] ) ) 285 $this->messages['error'][] = __( 'Please enter your user name.', $this->text_domain ); 286 else if( ! in_array( 'user_page_button', $_POST['buttons'] ) ) 286 if( ! empty( $_POST['user_name'] ) ) { 287 if( ! in_array( 'user_page_button', $_POST['buttons'] ) ) 287 288 $this->messages['error'][] = __( 'User Page Button must be enabled.', $this->text_domain ); 288 289 else 289 290 $this->options['user_name'] = $_POST['user_name']; 290 291 } 292 else 293 if( in_array( 'user_page_button', $_POST['buttons'] ) ) 294 $this->messages['error'][] = __( 'Please enter your user name.', $this->text_domain ); 291 295 292 296 // If we have any error messages to display don't go any further with the function execution. … … 311 315 */ 312 316 public function display_buttons( $content ) { 317 global $post; 318 if( $this->options = get_option( 'osb_options' ) ) { 319 320 $osb_html = '<div class="opera-buttons">'; 321 322 // User Page Button 323 if( in_array( 'user_page_button', $this->options['button_list'] ) && $this->options['user_name'] ) { 324 $osb_html .= '<a class="osb-page" href="http://my.opera.com/' . $this->options['user_name'] . '/">'; 325 $osb_html .= '<img src="' . $this->plugin_url . 'img/myopera20-1.png" alt="' . __( 'Go to My Opera Page', $this->text_domain ) . '" />'; 326 $osb_html .= '</a>'; 327 } 328 329 // Share Button 330 if( in_array( 'share_button', $this->options['button_list'] ) ) { 331 $osb_html .= '<a class="osb-share">'; 332 $osb_html .= '<img src="' . $this->plugin_url . 'img/operashare20-2.png" alt="' . __( 'Share this post', $this->text_domain ) . '" />'; 333 $osb_html .= '<script type="text/javascript" src="' . $this->plugin_url . 'js/share.js"></script>'; 334 $osb_html .= '</a>'; 335 } 336 337 $osb_html .= '</div>'; 338 339 // Indication where show Opera Buttons depending on selected item in admin page 340 // Set the internal pointer of an array to its first element 341 $pos_name = reset( $this->options['position'] ); 342 switch( $pos_name ) { 343 case 'before' : 344 return $osb_html . $content; 345 case 'after' : 346 return $content . $osb_html; 347 case 'beforeandafter' : 348 return $osb_html . $content . $osb_html; 349 case 'shortcode' : 350 default : 351 return $content; 352 } 353 } 354 else 355 return $content; 356 } 357 358 /** 359 * Action - Adds ability to load CSS 360 * 361 * @access public 362 */ 363 public function load_style() { 364 echo '<link rel="stylesheet" type="text/css" media="screen" href="' . $this->plugin_url . 'css/opera-buttons.css" />' . "\n"; 365 } 366 367 /** 368 * Action - Create shortcode 369 * 370 * Function are using to add Opera Share Button shortcode to the content 371 * 372 * @access public 373 * @param string $content Is a string containing the enclosed content 374 * @return string Prepared string like HTML 375 */ 376 public function osb_shortcode( $content ) { 313 377 global $post; 314 378 if( $this->options = get_option( 'osb_options' ) ) { … … 333 397 $osb_html .= '</div>'; 334 398 335 // Indication where show Opera Buttons depending on selected item in admin page336 foreach( $this->options['position'] as $pos_name ) {337 switch( $pos_name ) {338 case 'before' :339 return $osb_html . $content;340 break;341 case 'after' :342 return $content . $osb_html;343 break;344 case 'beforeandafter' :345 return $osb_html . $content . $osb_html;346 break;347 case 'shortcode' :348 return $content;349 break;350 default :351 return $content;352 }353 }354 }355 }356 357 /**358 * Action - Create shortcode359 *360 * Function are using to add Opera Share Button shortcode to the content361 *362 * @access public363 * @param string $content Is a string containing the enclosed content364 * @return string Prepared string like HTML365 */366 public function osb_shortcode( $content ) {367 global $post;368 if( $this->options = get_option( 'osb_options' ) ) {369 370 $osb_html = '<div class="opera-buttons">';371 372 // User Page Button373 if( in_array( 'user_page_button', $this->options['button_list'] ) && $this->options['user_name'] ) {374 $osb_html .= ' <a href="http://my.opera.com/' . $this->options['user_name'] . '/">';375 $osb_html .= '<img src="' . $this->plugin_url . 'img/myopera20-1.png" alt="' . __( 'Go to My Opera Page', $this->text_domain ) . '" />';376 $osb_html .= '</a>';377 }378 379 // Share Button380 if( in_array( 'share_button', $this->options['button_list'] ) ) {381 $osb_html .= ' <a class="osb-share">';382 $osb_html .= '<img src="' . $this->plugin_url . 'img/operashare20-2.png" alt="' . __( 'Share this post', $this->text_domain ) . '" />';383 $osb_html .= '<script type="text/javascript" src="' . $this->plugin_url . 'js/share.js"></script>';384 $osb_html .= '</a>';385 }386 387 $osb_html .= '</div>';388 389 399 return $osb_html; 390 400 } … … 399 409 private function get_messages_html() { 400 410 $html = ''; 401 foreach( array_keys( $this->messages) as $type ){411 foreach($this->messages as $type => $messages){ 402 412 $html .= '<div class="' . $type . '">'; 403 foreach( $ this->messages[$type]as $message )413 foreach( $messages as $message ) 404 414 $html .= '<p>' . $message . '</p>'; 405 415 $html .= '</div>'; -
opera-share-button/trunk/readme.txt
r569137 r569472 5 5 Requires at least: 3.0 6 6 Tested up to: 3.4.1 7 Stable tag: 0.1. 27 Stable tag: 0.1.3 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 22 22 * Actions: Ability to add My Opera Share button in the most easiest and flexible way. 23 23 * Display: This plugin allows you to select the position for the button: before, after, before and after or using shortcode. 24 * Display: Ability to use Cascading Style Sheets from the plugin directory. 24 25 25 26 = Translation = … … 67 68 No. Plugin not work with Wordpress versions prior to 3.0. 68 69 70 = Can I use custom CSS file? = 71 72 Yes! You can use CSS in the plugin directory: `osb/css/opera-buttons.css`. 73 69 74 == Screenshots == 70 75 … … 73 78 74 79 == Changelog == 80 81 = 0.1.3 = 82 * Added ability to use CSS form the plugin directory. 83 * Fixed localization. 84 * Changed the mechanism of busting positions of buttons. 85 * A more laconic code 75 86 76 87 = 0.1.2 = … … 89 100 == Upgrade Notice == 90 101 102 = 0.1.3 = 103 * Added ability to use CSS form the plugin directory. 104 * Fixed Russian Localization. 105 * Changed the mechanism of busting positions of buttons. 106 * Minor buxfixes 107 91 108 = 0.1.2 = 92 * NEW:Usability at the settings page of the plugin was improved.93 * NEW:Internationalization support.94 * NEW:Russian Localization.95 * NEW:Upgrading mechanism96 * BUGFIX:Minor buxfixes109 * Usability at the settings page of the plugin was improved. 110 * Internationalization support. 111 * Russian Localization. 112 * Upgrading mechanism 113 * Minor buxfixes
Note: See TracChangeset
for help on using the changeset viewer.