Plugin Directory

Changeset 885131


Ignore:
Timestamp:
03/31/2014 03:21:55 PM (12 years ago)
Author:
hintsolutions
Message:

Added shortcode surveymonkey_button 1.1

Location:
surveymonkey-button/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • surveymonkey-button/trunk/readme.txt

    r882899 r885131  
    55Requires at least: 3.3
    66Tested up to: 3.5.1
    7 Stable tag: 1.0
     7Stable tag: 1.1
    88License: Licenced under LGPL
    99License URI: http://opensource.org/licenses/LGPL-3.0
     
    6262Yes, you can select menu items where survey button would be shown.
    6363
     64= How to show button only on some nessesary pages? =
     65
     66You need to set "Button state" to off and add shortcode [surveymonkey_button] at nessesary pages, where you'd like to see button.
     67
    6468== Screenshots ==
    6569
     
    7074== Changelog ==
    7175
     76= 1.1 =
     77Added shortcode [surveymonkey_button] (require button state set to off) to add button only on nessesary pages.
     78
    7279= 1.0 =
    7380Initial release
  • surveymonkey-button/trunk/survey.php

    r882866 r885131  
    44 * Plugin URI: http://probtn.com
    55 * Description: Surveymonkey Button is the easiest way to add a Surveymonkey survey on your Wordpress blog. The survey is located inside a pop-up window that opens by clicking on the floating button. Using Surveymonkey Button, you can find out the opinions of users of your site and collect useful information
    6  * Version: 1.0
     6 * Version: 1.1
    77 * Author: hintsolutions
    88 * Author URI: http://probtn.com
     
    7373}
    7474
     75
     76function surveyinit_function() {
     77    $options = get_option( 'probtn_settings' );
     78    if (($options['state']==null) || ($options['state']=='')) {
     79        $options['state'] = 'on';
     80    };
     81    if (($options['probtn_image']==null) || ($options['probtn_image']=='')) {
     82        $options['probtn_image'] = 'http://admin.probtn.com/eqwid_btn_nonpress.png';
     83    };
     84                if (($options['probtn_contenturl']==null) || ($options['probtn_contenturl']=='')) {
     85                    $options['probtn_contenturl'] = 'https://www.surveymonkey.com/s/YQG8C2J';
     86                };
     87                if (($options['probtn_hinttext']==null) || ($options['probtn_hinttext']=='')) {
     88                    $options['probtn_hinttext'] = 'Survey';
     89                };
     90
     91    //$mainStyleCss = plugins_url('style.css');
     92    //$jqueryPepPath = plugins_url('jquery.form.min.js');
     93    $mainStyleCss = plugins_url('surveymonkey-button/style.css');
     94    $jqueryPepPath = plugins_url('surveymonkey-button/jquery.form.min.js');
     95    $fancyboxCss = plugins_url('surveymonkey-button/fancybox/jquery.fancybox-1.3.4.css');
     96
     97    if ($options['state']=="off") {
     98$output = '
     99<script>
     100FloatingButtonFunc();
     101
     102function runYourFunctionWhenJQueryIsLoaded() {
     103    if (window.$){
     104        FloatingButtonFunc();
     105    } else {
     106        setTimeout(runYourFunctionWhenJQueryIsLoaded, 50);
     107    }
     108}
     109
     110function FloatingButtonFunc() {   
     111    jQuery(document).ready(function() {
     112        setTimeout(InitButton, 2500);
     113    });
     114}
     115
     116function InitButton() {
     117    jQuery(document).StartButton({
     118            "mainStyleCss": "'.$mainStyleCss.'",
     119            "fancyboxCssPath": "'.$fancyboxCss.'",
     120            ';
     121                $output = $output. '
     122                "jqueryPepPath": "'.$jqueryPepPath.'",
     123                "ButtonImage": "'.$options['probtn_image'].'",
     124                "ButtonDragImage": "'.$options['probtn_image'].'",
     125                "ButtonOpenImage": "'.$options['probtn_image'].'",
     126                "ButtonInactiveImage": "'.$options['probtn_image'].'",
     127                "domain": "wordpress.plugin",
     128                "ContentURL": "'.$options['probtn_contenturl'].'",
     129                "HintText": "'.$options['probtn_hinttext'].'"
     130                ';
     131             $output = $output. '}); } </script>';
     132            return $output;
     133        } else {
     134            return "";
     135        }
     136}
     137
     138add_shortcode('surveymonkey_button', 'surveyinit_function');
     139
     140
    75141function survey_start_button_script() {
    76142    $mainStyleCss = plugins_url('surveymonkey-button/style.css');
     
    87153                };
    88154                if (($options['probtn_contenturl']==null) || ($options['probtn_contenturl']=='')) {
    89                     $options['probtn_contenturl'] = 'http://hint-survey.herokuapp.com/5278b54241624f0200000001';
     155                    $options['probtn_contenturl'] = 'https://www.surveymonkey.com/s/YQG8C2J';
    90156                };
    91157                if (($options['probtn_hinttext']==null) || ($options['probtn_hinttext']=='')) {
Note: See TracChangeset for help on using the changeset viewer.