Plugin Directory

Changeset 902244


Ignore:
Timestamp:
04/25/2014 05:40:25 AM (12 years ago)
Author:
shibyville
Message:

new jquery, show only on single pages option

Location:
send-a-wow-dogecoin-donation/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • send-a-wow-dogecoin-donation/trunk/options.php

    r901622 r902244  
    5151        $update = false;
    5252        //override if not set or empty
     53        //fullpageonly
     54        if(!(isset( $this->options['fullpageonly'] )) || $this->options['fullpageonly'] == "") {
     55            $this->options['fullpageonly'] = "0";
     56            $update = true;
     57        }
    5358        //button
    5459        if(!(isset( $this->options['button_text'] )) || $this->options['button_text'] == "") {
     
    138143            array( $this, 'sanitize' ) // Sanitize
    139144        );
    140 
     145       
    141146        add_settings_section(
    142147            'setting_section_id', // ID
     
    144149            array( $this, 'print_section_info' ), // Callback
    145150            'saw-setting-admin' // Page
    146         ); 
     151        );
     152        add_settings_section(
     153            'saw-setting-admin-pluginbehaviour', // ID
     154            'Plugin Behaviour', // Title
     155            array( $this, 'print_section_info_pluginbehaviour' ), // Callback
     156            'saw-setting-admin' // Page
     157        );
     158        //fullpageonly
     159        add_settings_field(
     160            'fullpageonly', // ID
     161            'Show on Full Page Only', // Title
     162            array( $this, 'fullpageonly_callback' ), // Callback
     163            'saw-setting-admin', // Page
     164            'saw-setting-admin-pluginbehaviour' // Section
     165        );
     166       
    147167        //button text
    148168        add_settings_field(
     
    244264    {
    245265        $new_input = array();
     266        if( isset( $input['fullpageonly'] ) )
     267            $new_input['fullpageonly'] = sanitize_text_field( $input['fullpageonly'] );
     268       
    246269        if( isset( $input['button_text'] ) )
    247270            $new_input['button_text'] = sanitize_text_field( $input['button_text'] );
     
    285308     * Print the Section text
    286309     */
     310    public function print_section_info_pluginbehaviour()
     311    {
     312        print '<p>This section is for Wordpress related behaviour.</p>';
     313    }
    287314    public function print_section_info()
    288315    {
     
    297324     * Get the settings option array and print one of its values
    298325     */
     326     //fullpageonly
     327    public function fullpageonly_callback()
     328    {
     329        //get option first (yes/no)
     330        $selectedyes='';
     331        $selectedno='';
     332        $fullpageonly = esc_attr( $this->options['fullpageonly']);
     333        if($fullpageonly) { //yes
     334            $selectedyes=' selected="selected"';
     335        } else {
     336            $selectedno=' selected="selected"';
     337        }
     338        //build the selectbox
     339        printf(
     340            '
     341            <select size="1" class="regular-text" type="text" id="fullpageonly" name="saw_options_general[fullpageonly]" value="%s" />
     342                <option'.$selectedyes.' value="1">Yes</option>
     343                <option'.$selectedno.' value="0">No</option>
     344            </select>
     345            ',
     346            esc_attr( $this->options['fullpageonly'])
     347        );
     348        print '<p class="description">If set to yes the button will only be shown on full blog pages, not at the topic sentence on the frontpage, etc.!</p>';
     349    }
     350   
     351    // button_text callback
    299352    public function button_text_callback()
    300353    {
  • send-a-wow-dogecoin-donation/trunk/readme.txt

    r902029 r902244  
    44Requires at least: 3.8.3
    55Tested up to: 3.9
    6 Stable tag: 0.2.1
     6Stable tag: 0.2.2
    77License: GPLv2
    88
     
    3434
    3535== Changelog ==
     36= 0.2.2 =
     37* Added new Send a Wow! jQuery version - normalize css for homogeneous view on different templates
     38* Added new option Show on Full Page Only (say yes if you do not want it on the frontpage)
     39
    3640= 0.2.1 =
    3741* Added new send a wow jquery version - a bigger qrcode pops up if you hover the perhaps too small qrcode
  • send-a-wow-dogecoin-donation/trunk/sendawow.jquery/sendawow.min.css

    r902029 r902244  
    1 .saw-button,.saw-button:hover,.saw-button:active{background-color:#f90;background:linear-gradient(#ffa621,#f90) repeat scroll 0 0 rgba(0,0,0,0);border:medium none;border-radius:2px;color:#fff;cursor:pointer;font-weight:bold;height:20px;line-height:20px;padding:0 5px;text-shadow:0 -1px 0 #e58900;white-space:nowrap;text-transform:none;font-family:'Helvetica Neue',Helvetica,Arial,'lucida grande',tahoma,verdana,arial,sans-serif;font-size:12px;margin:0 .5em}.saw-button:hover{background:linear-gradient(#f90,#ffa621) repeat scroll 0 0 rgba(0,0,0,0);color:#fff}.saw-button:active,.saw-button:focus{box-shadow:0 0 8px 2px #ffd089 inset,0 1px 0 0 #e08600}.saw-button .saw-logo{padding-right:.5em;padding-left:.25em}.saw-container{display:inline-block;float:right;font-family:Arial,sans-serif;font-size:16px}.saw-container a{color:#f90}.saw-container a:hover{color:#ffa621}.saw-container.visible .saw-info-wrapper{visibility:visible}.saw-info-wrapper{position:relative;z-index:9998;visibility:hidden}.saw-info{background-color:#fff;border:2px solid #ffa621;border-radius:2px;padding:5px;position:absolute;bottom:0;width:300px;box-shadow:15px -15px 15px #fff,-15px -15px 15px #fff,15px 0 5px #fff,-15px 0 5px #fff}.saw-qrcode{display:inline-block;float:left;width:75px;height:75px;border:1px solid #ffa621;padding:5px;vertical-align:top;background-color:#fff}.saw-qrcode img,.saw-qrcode-big img{width:100%}.saw-qrcode.saw-waiting img,.saw-qrcode-big.saw-waiting img{opacity:.1}.saw-qrcode-big{display:inline-block;position:absolute;width:150px;height:150px;border:2px solid #ffa621;padding:10px;vertical-align:top;background-color:#fff;bottom:.25em;left:-160px;box-shadow:0 0 10px #FFF;display:none}.saw-qrcode-big.visible{display:inline-block}.saw-moreinfo{display:inline-block;width:200px;margin-left:10px;text-align:justify;line-height:105%}.saw-readmore{display:block;text-align:right;float:right}.saw-address,.saw-amount{font-size:70%}.saw-address-c{font-weight:bold}.saw-address{float:right;line-height:160%}.saw-big-logo{display:none}.saw-amount{display:inline-block;vertical-align:bottom}.saw-amount input{width:3em;padding:2px;text-align:center}.saw-clear{clear:both}
     1.saw-button,.saw-button:hover,.saw-button:active{background-color:#f90;background:linear-gradient(#ffa621,#f90) repeat scroll 0 0 rgba(0,0,0,0);border:medium none;border-radius:2px;color:#fff;cursor:pointer;font-weight:bold;height:20px;line-height:20px;padding:0 5px;text-shadow:0 -1px 0 #e58900;white-space:nowrap;text-transform:none;font-family:'Helvetica Neue',Helvetica,Arial,'lucida grande',tahoma,verdana,arial,sans-serif;font-size:12px;margin:0 .5em}.saw-button:hover{background:linear-gradient(#f90,#ffa621) repeat scroll 0 0 rgba(0,0,0,0);color:#fff}.saw-button:active,.saw-button:focus{box-shadow:0 0 8px 2px #ffd089 inset,0 1px 0 0 #e08600}.saw-button .saw-logo{padding-right:.5em;padding-left:.25em}.saw-container,.saw-container *{box-sizing:content-box;-moz-box-sizing:content-box}.saw-container{display:inline-block;float:right;font-family:Arial,sans-serif;font-size:16px;line-height:1.42857;color:#333}.saw-container a{color:#f90;text-decoration:none;background:none repeat scroll 0 0 rgba(0,0,0,0)}.saw-container a:hover{color:#ffa621}.saw-container input,.saw-container input[type="text"]{color:inherit;margin:0;line-height:normal;padding:2px;letter-spacing:normal;line-height:normal;text-indent:0;text-shadow:none;text-transform:none;word-spacing:normal;display:inline-block}.saw-container.visible .saw-info-wrapper{visibility:visible}.saw-info-wrapper{position:relative;z-index:9998;visibility:hidden}.saw-info{background-color:#fff;border:2px solid #ffa621;border-radius:2px;padding:5px;position:absolute;bottom:0;width:300px;box-shadow:15px -15px 15px #fff,-15px -15px 15px #fff,15px 0 5px #fff,-15px 0 5px #fff}.saw-qrcode{display:inline-block;float:left;width:75px;height:75px;border:1px solid #ffa621;padding:5px;vertical-align:top;background-color:#fff}.saw-qrcode img,.saw-qrcode-big img{width:100%}.saw-qrcode.saw-waiting img,.saw-qrcode-big.saw-waiting img{opacity:.1}.saw-qrcode-big{display:inline-block;position:absolute;width:150px;height:150px;border:2px solid #ffa621;padding:10px;vertical-align:top;background-color:#fff;bottom:.25em;left:-180px;box-shadow:0 0 10px #FFF;display:none}.saw-qrcode-big.visible{display:inline-block}.saw-moreinfo{display:inline-block;width:200px;margin-left:10px;text-align:justify;line-height:105%}.saw-readmore{display:block;text-align:right;float:right}.saw-address,.saw-amount{font-size:70%}.saw-address-c{font-weight:bold}.saw-address{float:right;line-height:160%}.saw-big-logo{display:none}.saw-amount{display:inline-block;vertical-align:bottom}.saw-amount input{width:3em;text-align:center}.saw-clear{clear:both}
  • send-a-wow-dogecoin-donation/trunk/sendawow.php

    r902029 r902244  
    22/**
    33 * @package Send_A_Wow
    4  * @version 0.2.1
     4 * @version 0.2.2
    55 */
    66/*
     
    99Description: Shows a Button for cryptocoin donations e.g. Dogecoin under each article. Similar Facebooks Like-Button but for donations. If the user clicks on one of the button a popup with the coin-address and a QR-Link pops up. The user can easily donate some coins.
    1010Author: shibyville
    11 Version: 0.2.1
     11Version: 0.2.2
    1212Author URI: undefinded
    1313*/
    14 
     14//set version for reloading
     15$ver = "0.2.2";
    1516// Take the template
    1617function get_sendawow_template($content) {
     
    1819    //get the template
    1920    $template='<div class="wp-saw-button"></div>';
    20     $content = $content.$template;
     21
     22    //TODO: NEW OPTION
     23    //if show only on full single pages true, than show it only there
     24    $options = get_option( "saw_options_general");
     25   
     26    if((boolean)$options['fullpageonly']) {
     27        //show it only on full pages
     28        if(is_single()) {
     29            $content = $content.$template;
     30        }
     31    } else { // if show it everywhere
     32        $content = $content.$template;
     33    }
     34   
    2135   
    2236    return $content;
     
    2842 */
    2943function add_js_and_css() {
    30     //load css file
    31     wp_enqueue_style( 'sendawow_defaultstyle', plugins_url( 'sendawow.jquery/sendawow.min.css' , __FILE__ ));
    3244
    33     //load qrcode generator first
    34     wp_enqueue_script( 'qrcode-generator', plugins_url( 'sendawow.jquery/lib/qrcode.min.js', __FILE__ ), false, false, true);
    35    
    36     //then load the send a wow plugin, but load qrgenerator and jquery first
    37     wp_enqueue_script( 'sendawow-plugin', plugins_url( 'sendawow.jquery/sendawow.jquery.min.js' , __FILE__ ), array('qrcode-generator','jquery') ,false,true);
    38    
    39    
    40     //at last load our javascript which creates the sendawow buttons
    41     //register it, but do not enqueue it yet - we have to modify it
    42     wp_register_script( 'sendawow-script', plugins_url( 'sendawow-wpscript.js' , __FILE__ ), 'sendawow-plugin' ,false,true);
    43    
    44     //give the script the configuration data
    45     $options = get_option( "saw_options_general");
    46     //add blogname
    47     $options["blogname"] = get_option("blogname");
    48     //give script the options
    49     wp_localize_script( 'sendawow-script', 'sawdata', $options );
    50    
    51     //enque script now
    52     wp_enqueue_script('sendawow-script');
     45        //load css file
     46        wp_enqueue_style( 'sendawow_defaultstyle', plugins_url( 'sendawow.jquery/sendawow.min.css' , __FILE__ ));
    5347
     48        //load qrcode generator first
     49        wp_enqueue_script( 'qrcode-generator', plugins_url( 'sendawow.jquery/lib/qrcode.min.js', __FILE__ ), false, $ver, true);
     50       
     51        //then load the send a wow plugin, but load qrgenerator and jquery first
     52        wp_enqueue_script( 'sendawow-plugin', plugins_url( 'sendawow.jquery/sendawow.jquery.min.js' , __FILE__ ), array('qrcode-generator','jquery') ,$ver,true);
     53       
     54       
     55        //at last load our javascript which creates the sendawow buttons
     56        //register it, but do not enqueue it yet - we have to modify it
     57        wp_register_script( 'sendawow-script', plugins_url( 'sendawow-wpscript.js' , __FILE__ ), 'sendawow-plugin' ,$ver,true);
     58       
     59        //give the script the configuration data
     60        $options = get_option( "saw_options_general");
     61        //add blogname
     62        $options["blogname"] = get_option("blogname");
     63        //give script the options
     64        wp_localize_script( 'sendawow-script', 'sawdata', $options );
     65       
     66        //enque script now
     67        wp_enqueue_script('sendawow-script');
    5468
    5569}
    5670
    57 add_action( 'wp_enqueue_scripts', 'add_js_and_css' );
     71add_action( 'wp_enqueue_scripts', 'add_js_and_css' ); //add all the needed js and css stuff
     72
    5873add_filter( 'the_content', 'get_sendawow_template');
    5974
Note: See TracChangeset for help on using the changeset viewer.