Plugin Directory

Changeset 1835225


Ignore:
Timestamp:
03/07/2018 11:12:10 AM (8 years ago)
Author:
frankschrijvers
Message:

update for Genesis 2.6

Location:
genesis-slide-in-widget/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • genesis-slide-in-widget/trunk/genesis-slide-in-widget.php

    r1524809 r1835225  
    11<?php
    2 /*
    3  Plugin Name: Genesis Slide-in Widget
    4  Plugin URI: http://wpstud.io/plugins
    5  Description: Create a slide-in widget area
    6  Version: 1.4.3
    7  Author: Frank Schrijvers
    8  Author URI: http://www.wpstud.io
    9  Text Domain: : genesis-slide-widget
    10  License: GPLv2
     2/**
     3 * Plugin Name: Genesis Slide-in Widget
     4 * Plugin URI: http://wpstud.io/plugins
     5 * Description: Create a slide-in widget area
     6 * Version: 1.4.4
     7 * Author: Frank Schrijvers
     8 * Author URI: http://www.wpstud.io
     9 * Text Domain: : genesis-slide-widget
     10 * License: GPLv2
     11 *
     12 * This program is free software; you can redistribute it and/or modify
     13 * it under the terms of the GNU General Public License, version 2, as
     14 * published by the Free Software Foundation.
     15 *
     16 * This program is distributed in the hope that it will be useful,
     17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     19 * GNU General Public License for more details.
     20 *
     21 * You should have received a copy of the GNU General Public License
     22 * along with this program; if not, write to the Free Software
     23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     24 */
    1125
    12     This program is free software; you can redistribute it and/or modify
    13     it under the terms of the GNU General Public License, version 2, as
    14     published by the Free Software Foundation.
    15 
    16     This program is distributed in the hope that it will be useful,
    17     but WITHOUT ANY WARRANTY; without even the implied warranty of
    18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    19     GNU General Public License for more details.
    20 
    21     You should have received a copy of the GNU General Public License
    22     along with this program; if not, write to the Free Software
    23     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    24 */
    25 
    26 defined( 'WPINC' ) or die;
     26// If this file is called directly, abort.
     27if ( ! defined( 'WPINC' ) ) {
     28    die;
     29}
    2730
    2831register_activation_hook( __FILE__, 'wpstudio_gsw_activation_check' );
     
    3336function wpstudio_gsw_activation_check() {
    3437
    35     $latest = '2.0';
     38    $latest     = '2.0';
    3639    $theme_info = wp_get_theme( 'genesis' );
    3740
    38     if ( ! function_exists('genesis_pre') ) {
    39         deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate plugin
     41    if ( ! function_exists( 'genesis_pre' ) ) {
     42        deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate plugin.
     43        /* translators: Genesis Framework version check. */
    4044        wp_die( sprintf( __( 'Sorry, you can\'t activate %1$sGenesis Slide-in Widget unless you have installed the %3$sGenesis Framework%4$s. Go back to the %5$sPlugins Page%4$s.', 'genesis-overlay-widget' ), '<em>', '</em>', '<a href="http://www.studiopress.com/themes/genesis" target="_blank">', '</a>', '<a href="javascript:history.back()">' ) );
    4145    }
    4246
    4347    if ( version_compare( $theme_info['Version'], $latest, '<' ) ) {
    44         deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate plugin
     48        deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate plugin.
     49        /* translators: Genesis Framework version check. */
    4550        wp_die( sprintf( __( 'Sorry, you can\'t activate %1$sGenesis Slide-in Widget unless you have installed the %3$sGenesis %4$s%5$s. Go back to the %6$sPlugins Page%5$s.', 'genesis-overlay-widget' ), '<em>', '</em>', '<a href="http://www.studiopress.com/themes/genesis" target="_blank">', $latest, '</a>', '<a href="javascript:history.back()">' ) );
    4651    }
     
    4853}
    4954
    50 add_action('after_switch_theme', 'wpstudio_gsw_deactivate_check');
     55add_action( 'after_switch_theme', 'wpstudio_gsw_deactivate_check' );
    5156function wpstudio_gsw_deactivate_check() {
    5257
    53     if ( ! function_exists('genesis_pre') ) {
    54         deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate plugin
    55     }
     58    if ( ! function_exists( 'genesis_pre' ) ) {
     59        deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate plugin.
     60    }
    5661
    5762}
    5863
    59 //* Enqueue scripts
    60 add_action( 'wp_enqueue_scripts', 'wpstudio_gsw_load_scripts', 99);
     64add_action( 'wp_enqueue_scripts', 'wpstudio_gsw_load_scripts', 99 );
     65/**
     66 * Enqueue scripts.
     67 */
    6168function wpstudio_gsw_load_scripts() {
    6269
    63     if ( function_exists('genesis_get_option')) {
    64         if ( genesis_get_option( 'gsw_css', 'gsw-settings') == 1 ) {
     70    if ( function_exists( 'genesis_get_option' ) ) {
     71        if ( genesis_get_option( 'gsw_css', 'gsw-settings' ) == 1 ) {
    6572            wp_enqueue_style( 'wpstudio-gsw-style', plugin_dir_url( __FILE__ ) . '/assets/css/wpstudio-gsw-style.css' );
    6673        }
    67         if ( !genesis_get_option( 'gsw_button', 'gsw-settings' ) ) {
     74        if ( ! genesis_get_option( 'gsw_button', 'gsw-settings' ) ) {
    6875            wp_enqueue_style( 'wpstudio-style-btn', plugin_dir_url( __FILE__ ) . '/assets/css/wpstudio-gsw-btn.css' );
    6976        }
     
    7582
    7683
    77 add_action( 'genesis_admin_init', 'wpstudio_gsw_init');
     84add_action( 'after_setup_theme', 'wpstudio_gsw_init' );
    7885function wpstudio_gsw_init() {
    7986
    80     require( dirname( __FILE__ )  . '/inc/gsw-admin.php');
    81     include( dirname( __FILE__ ) . '/inc/gsw-frontend.php');
     87    require dirname( __FILE__ ) . '/inc/gsw-admin.php';
     88    include dirname( __FILE__ ) . '/inc/gsw-frontend.php';
    8289    new WPSTUDIO_gsw_Settings();
    83 
    8490}
  • genesis-slide-in-widget/trunk/inc/gsw-admin.php

    r1210944 r1835225  
    1010 */
    1111
    12 // Exit if accessed directly
     12// Exit if accessed directly.
    1313defined( 'WPINC' ) or die;
     14
    1415/**
    1516 * Register a metabox and default settings for the Genesis Simple Logo.
     
    1718 * @package Genesis\Admin
    1819 */
     20class WPSTUDIO_gsw_Settings extends Genesis_Admin_Boxes {
     21    /**
     22     * Create an archive settings admin menu item and settings page for relevant custom post types.
     23     *
     24     * @since 1.0.0
     25     */
     26    public function __construct() {
     27        $settings_field   = 'gsw-settings';
     28        $page_id          = 'genesis-slide-widget';
     29        $menu_ops         = array(
     30            'submenu' => array(
     31                'parent_slug' => 'genesis',
     32                'page_title'  => __( 'Genesis Slide-in Widget Settings', 'genesis-slide-widget' ),
     33                'menu_title'  => __( 'Slide-in Widget', 'genesis-slide-widget' ),
     34            ),
     35        );
     36        $page_ops         = array(); // use defaults.
     37        $center           = current_theme_supports( 'genesis-responsive-viewport' ) ? 'mobile' : 'never';
     38        $default_settings = apply_filters(
     39            'gsw_settings_defaults',
     40            array(
     41                'gsw_background' => '#FFFFFF',
     42                'gsw_button'     => '',
     43                'gsw_color'      => '#404040',
     44                'gsw_css'        => '1',
     45                'gsw_fixed'      => 'trigger-fixed',
     46                'gsw_position'   => 'trigger-left',
     47                'gsw_show'       => '1',
     48                'gsw_width'      => 'gsw-30',
     49                'text_color'     => '#000000',
     50            )
     51        );
     52        $this->create( $page_id, $menu_ops, $page_ops, $settings_field, $default_settings );
     53        add_action( 'genesis_settings_sanitizer_init', array( $this, 'sanitizer_filters' ) );
     54    }
     55    /**
     56     * Register each of the settings with a sanitization filter type.
     57     *
     58     * @since 1.0.0
     59     *
     60     * @uses genesis_add_option_filter() Assign filter to array of settings.
     61     *
     62     * @see \Genesis_Settings_Sanitizer::add_filter()
     63     */
     64    public function sanitizer_filters() {
     65        genesis_add_option_filter(
     66            'no_html',
     67            $this->settings_field,
     68            array(
     69                'gsw_background',
     70                'gsw_button',
     71                'gsw_color',
     72                'gsw_fixed',
     73                'gsw_position',
     74                'gsw_width',
     75                'text_color',
     76            )
     77        );
     78        genesis_add_option_filter(
     79            'one_zero',
     80            $this->settings_field,
     81            array(
     82                'gsw_css',
     83                'gsw_show',
     84            )
     85        );
     86    }
     87    /**
     88     * Register Metabox for the Genesis Simple Logo.
     89     *
     90     * @param string $_genesis_theme_settings_pagehook
     91     * @uses  add_meta_box()
     92     * @since 1.0.0
     93     */
     94    public function metaboxes() {
     95        add_meta_box( 'gsw-settings', __( 'Plugin Settings', 'genesis-slide-widget' ), array( $this, 'gsw_settings' ), $this->pagehook, 'main', 'high' );
     96    }
     97    /**
     98     * Create Metabox which links to and explains the WordPress customizer.
     99     *
     100     * @uses  wp_customize_url()
     101     * @since 1.0.0
     102     */
     103    public function gsw_settings() {
     104
     105        ?>
     106
     107        <p>
     108            <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_id( 'gsw_css' ); ?>"><?php _e( 'Load plugin styling?', 'genesis-slide-widget' ); ?></label>
     109            <input type = "checkbox" name="<?php echo $this->get_field_name( 'gsw_css' ); ?>" id="<?php echo $this->get_field_id( 'gsw_css' ); ?>" value="1"<?php checked( $this->get_field_value( 'gsw_css' ) ); ?> />
     110        </p>
     111
     112        <hr class="div">
     113
     114        <h4><?php _e( 'Settings Button', 'genesis-slide-widget' ); ?></h4>
     115
     116        <p>
     117            <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_id( 'gsw_show' ); ?>"><?php _e( 'Show button', 'genesis-slide-widget' ); ?></label>
     118            <input type = "checkbox" name="<?php echo $this->get_field_name( 'gsw_show' ); ?>" id="<?php echo $this->get_field_id( 'gsw_show' ); ?>" value="1"<?php checked( $this->get_field_value( 'gsw_show' ) ); ?> />
     119        </p>
     120
     121        <p>
     122            <label style="width: 180px; margin: 0 40px 20px 0; display: inline-block;" for="<?php echo $this->get_field_name( 'gsw_button' ); ?>"><?php _e( 'Button Text', 'genesis-slide-widget' ); ?></label>
     123            <input type="text" data-default-color="#ffffff" name="<?php echo $this->get_field_name( 'gsw_button' ); ?>" id="<?php echo $this->get_field_id( 'gsw_button' ); ?>?" value="<?php echo $this->get_field_value( 'gsw_button' ); ?>" />
     124        </p>
     125
     126        <p>
     127            <label style="width: 180px; margin: 0 40px 20px 0; display: inline-block;" for="<?php echo $this->get_field_name( 'gsw_color' ); ?>"><?php _e( 'Button Color', 'genesis-slide-widget' ); ?></label>
     128            <input type="text" data-default-color="#ffffff" name="<?php echo $this->get_field_name( 'gsw_color' ); ?>" id="<?php echo $this->get_field_id( 'gsw_color' ); ?>?" value="<?php echo $this->get_field_value( 'gsw_color' ); ?>" />
     129        </p>
     130        <p>
     131            <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_name( 'gsw_fixed' ); ?>"><?php _e( 'Position Fixed', 'genesis-slide-widget' ); ?></label>
     132            <input type="radio" name="<?php echo $this->get_field_name( 'gsw_fixed' ); ?>" value="trigger-fixed" <?php checked( $this->get_field_value( 'gsw_fixed' ), 'trigger-fixed' ); ?> />
     133        </p>
     134
     135        <p>
     136            <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_name( 'gsw_fixed' ); ?>"><?php _e( 'Position Absolute', 'genesis-slide-widget' ); ?></label>
     137            <input type="radio" name="<?php echo $this->get_field_name( 'gsw_fixed' ); ?>" value="trigger-absolute" <?php checked( $this->get_field_value( 'gsw_fixed' ), 'trigger-absolute' ); ?> />
     138        </p>
    19139
    20140
    21 class WPSTUDIO_gsw_Settings extends Genesis_Admin_Boxes {
    22     /**
    23      * Create an archive settings admin menu item and settings page for relevant custom post types.
    24      *
    25      * @since 1.0.0
    26      */
    27     public function __construct() {
    28         $settings_field = 'gsw-settings';
    29         $page_id = 'genesis-slide-widget';
    30         $menu_ops = array(
    31                 'submenu' => array(
    32                 'parent_slug' => 'genesis',
    33                 'page_title'  => __( 'Genesis Slide-in Widget Settings', 'genesis-slide-widget' ),
    34                 'menu_title'  => __( 'Slide-in Widget', 'genesis-slide-widget' )
    35             )
    36         );
    37         $page_ops = array(); // use defaults
    38         $center = current_theme_supports( 'genesis-responsive-viewport' ) ? 'mobile' : 'never';
    39         $default_settings = apply_filters(
    40             'gsw_settings_defaults',
    41             array(
    42                 'gsw_background'    => '#FFFFFF',
    43                 'gsw_button'        => '',
    44                 'gsw_color'         => '#404040',
    45                 'gsw_css'           => '1',
    46                 'gsw_fixed'         => 'trigger-fixed',
    47                 'gsw_position'      => 'trigger-left',
    48                 'gsw_show'          => '1',
    49                 'gsw_width'         => 'gsw-30',
    50                 'text_color'        => '#000000',
    51             )
    52         );
    53         $this->create( $page_id, $menu_ops, $page_ops, $settings_field, $default_settings );
    54         add_action( 'genesis_settings_sanitizer_init', array( $this, 'sanitizer_filters' ) );
    55     }
    56     /**
    57      * Register each of the settings with a sanitization filter type.
    58      *
    59      * @since 1.0.0
    60      *
    61      * @uses genesis_add_option_filter() Assign filter to array of settings.
    62      *
    63      * @see \Genesis_Settings_Sanitizer::add_filter()
    64      */
    65     public function sanitizer_filters() {
    66         genesis_add_option_filter(
    67             'no_html',
    68             $this->settings_field,
    69             array(
    70                 'gsw_background',
    71                 'gsw_button',
    72                 'gsw_color',
    73                 'gsw_fixed',
    74                 'gsw_position',
    75                 'gsw_width',
    76                 'text_color',
    77             )
    78         );
    79         genesis_add_option_filter(
    80             'one_zero',
    81             $this->settings_field,
    82             array(
    83                 'gsw_css',
    84                 'gsw_show'
    85             )
    86         );
    87     }
    88     /**
    89      * Register Metabox for the Genesis Simple Logo.
    90      *
    91      * @param string $_genesis_theme_settings_pagehook
    92      * @uses  add_meta_box()
    93      * @since 1.0.0
    94      */
    95     function metaboxes() {
    96         add_meta_box( 'gsw-settings', __( 'Plugin Settings', 'genesis-slide-widget' ), array( $this, 'gsw_settings' ), $this->pagehook, 'main', 'high' );
    97     }
    98     /**
    99      * Create Metabox which links to and explains the WordPress customizer.
    100      *
    101      * @uses  wp_customize_url()
    102      * @since 1.0.0
    103      */
    104     function gsw_settings() {
     141        <hr class="div">
    105142
    106         ?>
     143        <h4><?php _e( 'Settings panel', 'genesis-slide-widget' ); ?></h4>
    107144
    108         <p>
    109             <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_id( 'gsw_css' ); ?>"><?php _e( 'Load plugin styling?', 'genesis-slide-widget' ); ?></label>
    110             <input type = "checkbox" name="<?php echo $this->get_field_name( 'gsw_css' ); ?>" id="<?php echo $this->get_field_id( 'gsw_css' ); ?>" value="1"<?php checked( $this->get_field_value( 'gsw_css' ) ); ?> />
    111         </p>
     145        <p>
     146            <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_name( 'gsw_position' ); ?>"><?php _e( 'Slide-in from the:', 'genesis-slide-widget' ); ?></label>
     147            <select name="<?php echo $this->get_field_name( 'gsw_position' ); ?>">
     148                <?php
     149                $positions = array( left, right );
     150                foreach ( $positions as $position ) {
    112151
    113         <hr class="div">
     152                    echo '<option value="trigger-' . $position . '"' . selected( $this->get_field_value( 'gsw_position' ), 'trigger-' . $position ) . '>' . $position . '</option>';
    114153
    115         <h4><?php _e( 'Settings Button', 'genesis-slide-widget' );?></h4>
     154                }
     155                ?>
     156            </select>
    116157
    117         <p>
    118             <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_id( 'gsw_show' ); ?>"><?php _e( 'Show button', 'genesis-slide-widget' ); ?></label>
    119             <input type = "checkbox" name="<?php echo $this->get_field_name( 'gsw_show' ); ?>" id="<?php echo $this->get_field_id( 'gsw_show' ); ?>" value="1"<?php checked( $this->get_field_value( 'gsw_show' ) ); ?> />
    120         </p>
     158        </p>
     159        <p>
     160            <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_id( 'gsw_width' ); ?>"><?php _e( 'Width Widget', 'genesis-slide-widget' ); ?></label>
     161            <select name="<?php echo $this->get_field_name( 'gsw_width' ); ?>">
     162                <?php
     163                $widths = array( 10, 20, 30, 40, 50, 100 );
     164                foreach ( $widths as $width ) {
    121165
    122         <p>
    123             <label style="width: 180px; margin: 0 40px 20px 0; display: inline-block;" for="<?php echo $this->get_field_name( 'gsw_button' ); ?>"><?php _e( 'Button Text', 'genesis-slide-widget' ); ?></label>
    124             <input type="text" data-default-color="#ffffff" name="<?php echo $this->get_field_name( 'gsw_button' );?>" id="<?php echo $this->get_field_id( 'gsw_button' );?>?" value="<?php echo $this->get_field_value( 'gsw_button' ); ?>" />
    125         </p>
     166                    echo '<option value="gsw-' . $width . '"' . selected( $this->get_field_value( 'gsw_width' ), 'gsw-' . $width ) . '>' . $width . '%' . '</option>';
    126167
    127         <p>
    128             <label style="width: 180px; margin: 0 40px 20px 0; display: inline-block;" for="<?php echo $this->get_field_name( 'gsw_color' ); ?>"><?php _e( 'Button Color', 'genesis-slide-widget' ); ?></label>
    129             <input type="text" data-default-color="#ffffff" name="<?php echo $this->get_field_name( 'gsw_color' );?>" id="<?php echo $this->get_field_id( 'gsw_color' );?>?" value="<?php echo $this->get_field_value( 'gsw_color' ); ?>" />
    130         </p>
    131         <p>
    132             <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_name( 'gsw_fixed' ); ?>"><?php _e( 'Position Fixed', 'genesis-slide-widget' ); ?></label>
    133             <input type="radio" name="<?php echo $this->get_field_name( 'gsw_fixed' ); ?>" value="trigger-fixed" <?php checked( $this->get_field_value( 'gsw_fixed' ), "trigger-fixed" ); ?> />
    134         </p>
     168                }
     169                ?>
     170            </select>
     171        </p>
    135172
    136         <p>
    137             <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_name( 'gsw_fixed' ); ?>"><?php _e( 'Position Absolute', 'genesis-slide-widget' ); ?></label>
    138             <input type="radio" name="<?php echo $this->get_field_name( 'gsw_fixed' ); ?>" value="trigger-absolute" <?php checked( $this->get_field_value( 'gsw_fixed' ), "trigger-absolute" ); ?> />
    139         </p>
     173        <hr class="div">
    140174
     175        <h4><?php _e( 'Color settings', 'genesis-slide-widget' ); ?></h4>
    141176
    142          <hr class="div">
     177        <p>
     178            <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_name( 'gsw_background' ); ?>"><?php _e( 'Background color', 'genesis-slide-widget' ); ?></label>
     179            <input type="text" data-default-color="#333333" name="<?php echo $this->get_field_name( 'gsw_background' ); ?>" id="<?php echo $this->get_field_id( 'gsw_background' ); ?>" value="<?php echo $this->get_field_value( 'gsw_background' ); ?>" />
     180        </p>
    143181
    144         <h4><?php _e( 'Settings panel', 'genesis-slide-widget' );?></h4>
     182        <p>
     183            <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_name( 'text_color' ); ?>"><?php _e( 'Text color', 'genesis-slide-widget' ); ?></label>
     184            <input type="text" data-default-color="#aaaaaa" name="<?php echo $this->get_field_name( 'text_color' ); ?>" id="<?php echo $this->get_field_id( 'text_color' ); ?>"  value="<?php echo $this->get_field_value( 'text_color' ); ?>" />
     185        </p>
    145186
    146         <p>
    147             <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_name( 'gsw_position' ); ?>"><?php _e( 'Slide-in from the:', 'genesis-slide-widget' ); ?></label>
    148             <select name="<?php echo $this->get_field_name( 'gsw_position' ); ?>">
    149                 <?php
    150                 $positions = array(left, right);
    151                 foreach ($positions as $position)
    152                 {
    153                     echo '<option value="trigger-' . $position . '"' . selected( $this->get_field_value( 'gsw_position' ), 'trigger-' . $position ) . '>' . $position . '</option>';
    154                 }
    155                 ?>
    156             </select>
    157            
    158         </p>
    159         <p>
    160             <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_id( 'gsw_width' ); ?>"><?php _e( 'Width Widget', 'genesis-slide-widget' ); ?></label>
    161             <select name="<?php echo $this->get_field_name( 'gsw_width' ); ?>">
    162                 <?php
    163                 $widths = array(10, 20, 30, 40, 50, 100);
    164                 foreach ($widths as $width)
    165                 {
    166                     echo '<option value="gsw-' . $width . '"' . selected( $this->get_field_value( 'gsw_width' ), 'gsw-' . $width ) . '>' . $width . '%' . '</option>';
    167                 }
    168                 ?>
    169             </select>
    170         </p>
     187        <hr class="div">
    171188
    172         <hr class="div">
    173 
    174         <h4><?php _e( 'Color settings', 'genesis-slide-widget' );?></h4>
    175 
    176         <p>
    177             <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_name( 'gsw_background' ); ?>"><?php _e( 'Background color', 'genesis-slide-widget' ); ?></label>
    178             <input type="text" data-default-color="#333333" name="<?php echo $this->get_field_name( 'gsw_background' );?>" id="<?php echo $this->get_field_id( 'gsw_background' );?>" value="<?php echo $this->get_field_value( 'gsw_background' ); ?>" />
    179         </p>
    180 
    181         <p>
    182             <label style="width: 180px; margin: 0 40px 0 0; display: inline-block;" for="<?php echo $this->get_field_name( 'text_color' ); ?>"><?php _e( 'Text color', 'genesis-slide-widget' ); ?></label>
    183             <input type="text" data-default-color="#aaaaaa" name="<?php echo $this->get_field_name( 'text_color' );?>" id="<?php echo $this->get_field_id( 'text_color' );?>"  value="<?php echo $this->get_field_value( 'text_color' ); ?>" />
    184         </p>
    185 
    186         <hr class="div">
    187 
    188         <?php
    189     }
     189        <?php
     190    }
    190191
    191192}
  • genesis-slide-in-widget/trunk/inc/gsw-frontend.php

    r1369535 r1835225  
    33defined( 'WPINC' ) or die;
    44
    5 
     5add_action( 'widgets_init', 'wpstudio_gsw_add_widget_area' );
     6/**
     7 * Add widget area.
     8 */
    69function wpstudio_gsw_add_widget_area() {
    710    genesis_register_sidebar( array(
    8         'id'            => 'slide-in-widget',
    9         'name'          => __( 'Slide-in Widget', 'genesis-slide-widget' ),
    10         'description'   => __( 'This is the slide-in widget area', 'genesis-slide-widget' ),
     11        'id'          => 'slide-in-widget',
     12        'name'        => __( 'Slide-in Widget', 'genesis-slide-widget' ),
     13        'description' => __( 'This is the slide-in widget area', 'genesis-slide-widget' ),
    1114    ) );
    1215}
    1316
    14 add_action( 'widgets_init', 'wpstudio_gsw_add_widget_area');
     17add_action( 'genesis_after_footer', 'wpstudio_gsw_add_widget' );
     18/**
     19 * Add widget area to front.
     20 */
     21function wpstudio_gsw_add_widget() {
     22    if ( is_active_sidebar( 'slide-in-widget' ) ) {
    1523
    16 
    17 function wpstudio_gsw_add_widget() {
    18     if (is_active_sidebar( 'slide-in-widget' )) {
    19 
    20         if ( genesis_get_option( 'gsw_position', 'gsw-settings') === 'trigger-left' ) {
     24        if ( genesis_get_option( 'gsw_position', 'gsw-settings' ) === 'trigger-left' ) {
    2125            echo '<div class="wpstudio-panel from-left">';
    2226        }
    23         if ( genesis_get_option( 'gsw_position', 'gsw-settings') === 'trigger-right' ) {
     27        if ( genesis_get_option( 'gsw_position', 'gsw-settings' ) === 'trigger-right' ) {
    2428            echo '<div class="wpstudio-panel from-right">';
    2529        }
    26         echo '<header class="wpstudio-panel-header' . ' ' . genesis_get_option( 'gsw_width', 'gsw-settings' ) .'">';
     30        echo '<header class="wpstudio-panel-header' . ' ' . genesis_get_option( 'gsw_width', 'gsw-settings' ) . '">';
    2731        echo '<a href="#0" class="wpstudio-panel-close">Close</a>';
    2832        echo '</header>';
    2933        if ( genesis_get_option( 'gsw_background', 'gsw-settings' ) ) {
     34
    3035            echo '<div class="wpstudio-panel-container' . ' ' . genesis_get_option( 'gsw_width', 'gsw-settings' ) . '" ';
    31             echo ' style="background-color: '. genesis_get_option( 'gsw_background' , 'gsw-settings') .';';
    32             echo 'color: '. genesis_get_option( 'text_color' , 'gsw-settings') .';">';
     36            echo ' style="background-color: ' . genesis_get_option( 'gsw_background', 'gsw-settings' ) . ';';
     37            echo 'color: ' . genesis_get_option( 'text_color', 'gsw-settings' ) . ';">';
     38
    3339        }
    34             genesis_widget_area( 'slide-in-widget', array());
     40
     41        genesis_widget_area( 'slide-in-widget', array() );
     42
    3543        echo '</div>';
    36 
    37 
    3844        echo '</div>';
    3945
     
    4248}
    4349
    44 add_action( 'genesis_after_footer', 'wpstudio_gsw_add_widget' );
    45 
    46 
    47 // Add fire button
    4850add_filter( 'genesis_before', 'wpstudio_gsw_fire' );
     51/**
     52 * Add fire button.
     53 */
    4954function wpstudio_gsw_fire() {
    50     if (is_active_sidebar( 'slide-in-widget' )) {
    51         if ( genesis_get_option( 'gsw_show', 'gsw-settings') == 1 ) {
     55    if ( is_active_sidebar( 'slide-in-widget' ) ) {
     56        if ( genesis_get_option( 'gsw_show', 'gsw-settings' ) == 1 ) {
    5257
    5358            $classes = array(
    54             genesis_get_option( 'gsw_position' , 'gsw-settings' ),
    55             genesis_get_option( 'gsw_fixed' , 'gsw-settings' )
     59                genesis_get_option( 'gsw_position', 'gsw-settings' ),
     60                genesis_get_option( 'gsw_fixed', 'gsw-settings' ),
    5661            );
    5762
    58             $classes = implode(' ', $classes);
     63            $classes = implode( ' ', $classes );
    5964
    60             echo '<a href="#" style="background-color:'. genesis_get_option( 'gsw_color' , 'gsw-settings')  .'" id="wpstudio-panel-open" class="' . $classes . '">' . genesis_get_option( 'gsw_button', 'gsw-settings' ) . '</a>';
     65            echo '<a href="#" style="background-color:' . genesis_get_option( 'gsw_color', 'gsw-settings' ) . '" id="wpstudio-panel-open" class="' . $classes . '">' . genesis_get_option( 'gsw_button', 'gsw-settings' ) . '</a>';
    6166        }
    6267    }
    6368}
    6469
    65 //Shortcode
     70add_shortcode( 'slide-widget', 'wpstudio_add_shortcode' );
     71/**
     72 * Create a Shortcode.
     73 *
     74 * @param [type] $atts
     75 * @param string $content
     76 * @return html shortcode
     77 */
    6678function wpstudio_add_shortcode( $atts, $content = "" ) {
     79
    6780    return '<a href="#" class="wpstudio-shortcode">' . $content . '</a>';
     81
    6882}
    69 
    70 add_shortcode('slide-widget', 'wpstudio_add_shortcode');
    71 
    72 
  • genesis-slide-in-widget/trunk/readme.txt

    r1598739 r1835225  
    33Tags: overlay, genesis, widget, featured content, Genesis Framework, genesiswp, slide, widget-only, widgets, slide-in
    44Requires at least: 3.6
    5 Tested up to: 4.7.2
    6 Stable tag: 1.4.3
     5Tested up to: 4.9.4
     6Stable tag: 1.4.4
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4949
    5050== Changelog ==
     51= 1.4.4 =
     52* Update: fix for Genesis 2.6
     53
    5154= 1.4.3 =
    5255* Bug fix for close button and body overlay.
Note: See TracChangeset for help on using the changeset viewer.