Plugin Directory

Changeset 875562


Ignore:
Timestamp:
03/14/2014 06:32:58 PM (12 years ago)
Author:
hintsolutions
Message:

Show menu for both types of button settings

Location:
profit-button/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • profit-button/trunk/probtn.php

    r869984 r875562  
    44 * Plugin URI: http://probtn.com
    55 * Description: Floating Button is an interactive element that used to show custom content inside your application. If the button is tapped then the popup with Browser would open. The url in the Browser is set using settings on our server.
    6  * Version: 1.9.3
     6 * Version: 1.9.4
    77 * Author: hintsolutions
    88 * Author URI: http://probtn.com
     
    392392    </div>
    393393    <!-- END SETTINGS MENU -->
     394
     395        <!--START SELECT MENU ITEMS -->
     396        <h3 style="cursor: pointer;" id="">Menu assignment <small>&#9660;</small></h3>
     397        <p>You can select menu items, where button would be shown\hidden, or by default it would be shown at all pages.</p>
     398
     399       <form method="post" action="options.php">
     400            <?php
     401                settings_fields( 'probtn_settings' );
     402                do_settings_sections( __FILE__ );
     403                //get the older values, wont work the first time
     404                $options = get_option( 'probtn_settings' );
     405                //print_r($menu_options);
     406            ?>
     407           <input type="checkbox" name="probtn_settings[menu_show]" value="on" <?php checked( 'on' == $options["menu_show"]); ?> />
     408                <span>Show button only at selected menu pages</span><br/>
     409           <br/>
     410           <input type="submit" value="Save" class="button-primary"/>
     411           </form>
     412
     413        <?php
     414        // Get the nav menu based on $menu_name (same as 'theme_location' or 'menu' arg to wp_nav_menu)
     415        // This code based on wp_nav_menu's code to get Menu ID from menu slug
     416
     417        $menu_name = 'custom_menu_slug';
     418        $locations = get_terms( 'nav_menu', array( 'hide_empty' => true ) );
     419        //print_r($locations);       
     420
     421        foreach ($locations as $menu) {
     422            ?>
     423            <form method="post" action="options.php">
     424            <?php
     425                settings_fields( 'probtn_menu_settings' );
     426                do_settings_sections( __FILE__ );
     427                //get the older values, wont work the first time
     428                $menu_options = get_option( 'probtn_menu_settings' );
     429                //print_r($menu_options);
     430            ?>           
     431            <h4><?php echo $menu->name; ?></h4>
     432                <input type="checkbox" name="probtn_menu_settings[<?php echo $menu->slug; ?>_all]" value="on" <?php checked( 'on' == $menu_options[$menu->slug."_all"]); ?> />
     433                <span>All items</span><br/>
     434            <?php               
     435            $items = wp_get_nav_menu_items($menu->slug); 
     436            //print_r($items);
     437            foreach ($items as $item) {
     438                ?>
     439                <input type="checkbox" name=probtn_menu_settings[<?php echo $menu->slug; ?>_<?php echo $item->ID; ?>]" value="<?php echo $item->ID; ?>" <?php checked( $item->ID == $menu_options[$menu->slug."_".$item->ID]); ?>/>
     440                <span><?php echo $item->title; ?></span><br/>
     441                <?php
     442            }
     443            ?>
     444                <br/>
     445                <input type="submit" value="Save" class="button-primary"/>
     446            </form>
     447            <?php
     448        }       
     449        ?>
     450       
     451        <!--END SELECT MENU -->
     452
    394453
    395454    <!-- START LAUNCH DEMO BUTTON -->
     
    533592        <script src='https://admin.probtn.com/1/functions/logWPplugin?X-ProBtn-Token=b04bb84b22cdacb0d57fd8f8fd3bfeb8ad430d1b&callback=&server=<?php echo $_SERVER['SERVER_NAME']; ?>&email=<?php echo $current_user->user_email; ?>'></script>
    534593
    535        
    536         <!--START SELECT MENU ITEMS -->
    537         <h3 style="cursor: pointer;" id="">Menu assignment <small>&#9660;</small></h3>
    538         <p>You can select menu items, where button would be shown\hidden, or by default it would be shown at all pages.</p>
    539 
    540        <form method="post" action="options.php">
    541             <?php
    542                 settings_fields( 'probtn_settings' );
    543                 do_settings_sections( __FILE__ );
    544                 //get the older values, wont work the first time
    545                 $options = get_option( 'probtn_settings' );
    546                 //print_r($menu_options);
    547             ?>
    548            <input type="checkbox" name="probtn_settings[menu_show]" value="on" <?php checked( 'on' == $options["menu_show"]); ?> />
    549                 <span>Show button only at selected menu pages</span><br/>
    550            <br/>
    551            <input type="submit" value="Save" class="button-primary"/>
    552            </form>
    553 
    554         <?php
    555         // Get the nav menu based on $menu_name (same as 'theme_location' or 'menu' arg to wp_nav_menu)
    556         // This code based on wp_nav_menu's code to get Menu ID from menu slug
    557 
    558         $menu_name = 'custom_menu_slug';
    559         $locations = get_terms( 'nav_menu', array( 'hide_empty' => true ) );
    560         //print_r($locations);       
    561 
    562         foreach ($locations as $menu) {
    563             ?>
    564             <form method="post" action="options.php">
    565             <?php
    566                 settings_fields( 'probtn_menu_settings' );
    567                 do_settings_sections( __FILE__ );
    568                 //get the older values, wont work the first time
    569                 $menu_options = get_option( 'probtn_menu_settings' );
    570                 //print_r($menu_options);
    571             ?>           
    572             <h4><?php echo $menu->name; ?></h4>
    573                 <input type="checkbox" name="probtn_menu_settings[<?php echo $menu->slug; ?>_all]" value="on" <?php checked( 'on' == $menu_options[$menu->slug."_all"]); ?> />
    574                 <span>All items</span><br/>
    575             <?php               
    576             $items = wp_get_nav_menu_items($menu->slug); 
    577             //print_r($items);
    578             foreach ($items as $item) {
    579                 ?>
    580                 <input type="checkbox" name=probtn_menu_settings[<?php echo $menu->slug; ?>_<?php echo $item->ID; ?>]" value="<?php echo $item->ID; ?>" <?php checked( $item->ID == $menu_options[$menu->slug."_".$item->ID]); ?>/>
    581                 <span><?php echo $item->title; ?></span><br/>
    582                 <?php
    583             }
    584             ?>
    585                 <br/>
    586                 <input type="submit" value="Save" class="button-primary"/>
    587             </form>
    588             <?php
    589         }       
    590         ?>
    591        
    592         <!--END SELECT MENU -->
    593594
    594595        <!-- START SETUP TUTORIAL -->
  • profit-button/trunk/readme.txt

    r875542 r875562  
    55Requires at least: 3.3
    66Tested up to: 3.5.1
    7 Stable tag: 1.9.3
     7Stable tag: 1.9.4
    88License: Licenced under LGPL
    99License URI: http://opensource.org/licenses/LGPL-3.0
     
    7676== Changelog ==
    7777
     78= 1.9.4 =
     79Menu settings are shown and for local, and for remote settings.
     80
    7881= 1.9.3 =
    7982Added timeout before button would be shown to prevent some conflicts with other users plugins.
Note: See TracChangeset for help on using the changeset viewer.