close

Plugin Directory

Changeset 569472


Ignore:
Timestamp:
07/09/2012 03:28:48 PM (14 years ago)
Author:
klay
Message:

tagging version 0.1.3

Location:
opera-share-button
Files:
6 edited
1 copied

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
    118(function() {
    219    function share () {
  • opera-share-button/tags/0.1.3/osb.php

    r569134 r569472  
    22/*
    33Plugin Name: Opera Share Button
    4 Version: 0.1.2
     4Version: 0.1.3
    55Plugin URI: http://wordpress.org/extend/plugins/opera-share-button/
    66Description: Put Opera Buttons in to your post.
     
    116116      $this->text_domain  = 'osb';
    117117      $this->plugin_url   = plugin_dir_url(__FILE__);
    118       $this->version      = '0.1.2';
     118      $this->version      = '0.1.3';
    119119
    120120      // Get options if they exist, else set default
    121121      if( ! $this->options = get_option( 'osb_options' ) ) {
    122122        $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' ),
    125125          'user_name'       =>  '',
    126126          'plugin_version'  =>  $this->version
     
    160160      // Add shortcode
    161161      add_shortcode( 'opera_buttons', array( &$this, 'osb_shortcode' ) );
     162
     163      // Ability to add css file
     164      add_action( 'wp_head', array( &$this, 'load_style' ) );
    162165    }
    163166
     
    281284
    282285         // 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'] ) )
    287288            $this->messages['error'][] = __( 'User Page Button must be enabled.', $this->text_domain );
    288289          else
    289290            $this->options['user_name'] = $_POST['user_name'];
    290291        }
     292        else
     293          if( in_array( 'user_page_button', $_POST['buttons'] ) )
     294            $this->messages['error'][] = __( 'Please enter your user name.', $this->text_domain );
    291295
    292296        // If we have any error messages to display don't go any further with the function execution.
     
    311315     */
    312316    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 ) {
    313377      global $post;
    314378      if( $this->options = get_option( 'osb_options' ) ) {
     
    333397        $osb_html .= '</div>';
    334398
    335         // Indication where show Opera Buttons depending on selected item in admin page
    336         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 shortcode
    359      *
    360      * Function are using to add Opera Share Button shortcode to the content
    361      *
    362      * @access  public
    363      * @param   string   $content   Is a string containing the enclosed content
    364      * @return  string              Prepared string like HTML
    365      */
    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 Button
    373         if( in_array( 'user_page_button', $this->options['button_list'] ) && $this->options['user_name'] ) {
    374           $osb_html .= '&nbsp;<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 Button
    380         if( in_array( 'share_button', $this->options['button_list'] ) ) {
    381           $osb_html .= '&nbsp;<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 
    389399        return $osb_html;
    390400      }
     
    399409    private function get_messages_html() {
    400410      $html = '';
    401       foreach( array_keys( $this->messages) as $type ) {
     411      foreach($this->messages as $type => $messages){
    402412        $html .= '<div class="' . $type . '">';
    403         foreach( $this->messages[$type] as $message )
     413        foreach( $messages as $message )
    404414          $html .= '<p>' . $message . '</p>';
    405415        $html .= '</div>';
  • opera-share-button/tags/0.1.3/readme.txt

    r569137 r569472  
    55Requires at least: 3.0
    66Tested up to: 3.4.1
    7 Stable tag: 0.1.2
     7Stable tag: 0.1.3
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    2222* Actions: Ability to add My Opera Share button in the most easiest and flexible way.
    2323* 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.
    2425
    2526= Translation =
     
    6768No. Plugin not work with Wordpress versions prior to 3.0.
    6869
     70= Can I use custom CSS file? =
     71
     72Yes! You can use CSS in the plugin directory: `osb/css/opera-buttons.css`.
     73
    6974== Screenshots ==
    7075
     
    7378
    7479== 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
    7586
    7687= 0.1.2 =
     
    89100== Upgrade Notice ==
    90101
     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
    91108= 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 mechanism
    96 * BUGFIX: Minor buxfixes
     109* 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
    118(function() {
    219    function share () {
  • opera-share-button/trunk/osb.php

    r569134 r569472  
    22/*
    33Plugin Name: Opera Share Button
    4 Version: 0.1.2
     4Version: 0.1.3
    55Plugin URI: http://wordpress.org/extend/plugins/opera-share-button/
    66Description: Put Opera Buttons in to your post.
     
    116116      $this->text_domain  = 'osb';
    117117      $this->plugin_url   = plugin_dir_url(__FILE__);
    118       $this->version      = '0.1.2';
     118      $this->version      = '0.1.3';
    119119
    120120      // Get options if they exist, else set default
    121121      if( ! $this->options = get_option( 'osb_options' ) ) {
    122122        $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' ),
    125125          'user_name'       =>  '',
    126126          'plugin_version'  =>  $this->version
     
    160160      // Add shortcode
    161161      add_shortcode( 'opera_buttons', array( &$this, 'osb_shortcode' ) );
     162
     163      // Ability to add css file
     164      add_action( 'wp_head', array( &$this, 'load_style' ) );
    162165    }
    163166
     
    281284
    282285         // 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'] ) )
    287288            $this->messages['error'][] = __( 'User Page Button must be enabled.', $this->text_domain );
    288289          else
    289290            $this->options['user_name'] = $_POST['user_name'];
    290291        }
     292        else
     293          if( in_array( 'user_page_button', $_POST['buttons'] ) )
     294            $this->messages['error'][] = __( 'Please enter your user name.', $this->text_domain );
    291295
    292296        // If we have any error messages to display don't go any further with the function execution.
     
    311315     */
    312316    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 ) {
    313377      global $post;
    314378      if( $this->options = get_option( 'osb_options' ) ) {
     
    333397        $osb_html .= '</div>';
    334398
    335         // Indication where show Opera Buttons depending on selected item in admin page
    336         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 shortcode
    359      *
    360      * Function are using to add Opera Share Button shortcode to the content
    361      *
    362      * @access  public
    363      * @param   string   $content   Is a string containing the enclosed content
    364      * @return  string              Prepared string like HTML
    365      */
    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 Button
    373         if( in_array( 'user_page_button', $this->options['button_list'] ) && $this->options['user_name'] ) {
    374           $osb_html .= '&nbsp;<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 Button
    380         if( in_array( 'share_button', $this->options['button_list'] ) ) {
    381           $osb_html .= '&nbsp;<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 
    389399        return $osb_html;
    390400      }
     
    399409    private function get_messages_html() {
    400410      $html = '';
    401       foreach( array_keys( $this->messages) as $type ) {
     411      foreach($this->messages as $type => $messages){
    402412        $html .= '<div class="' . $type . '">';
    403         foreach( $this->messages[$type] as $message )
     413        foreach( $messages as $message )
    404414          $html .= '<p>' . $message . '</p>';
    405415        $html .= '</div>';
  • opera-share-button/trunk/readme.txt

    r569137 r569472  
    55Requires at least: 3.0
    66Tested up to: 3.4.1
    7 Stable tag: 0.1.2
     7Stable tag: 0.1.3
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    2222* Actions: Ability to add My Opera Share button in the most easiest and flexible way.
    2323* 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.
    2425
    2526= Translation =
     
    6768No. Plugin not work with Wordpress versions prior to 3.0.
    6869
     70= Can I use custom CSS file? =
     71
     72Yes! You can use CSS in the plugin directory: `osb/css/opera-buttons.css`.
     73
    6974== Screenshots ==
    7075
     
    7378
    7479== 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
    7586
    7687= 0.1.2 =
     
    89100== Upgrade Notice ==
    90101
     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
    91108= 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 mechanism
    96 * BUGFIX: Minor buxfixes
     109* 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.