Plugin Directory

Changeset 2284975


Ignore:
Timestamp:
04/16/2020 01:51:24 PM (6 years ago)
Author:
magicpages
Message:

update 1.1.0

Location:
footer-design-for-elementor/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • footer-design-for-elementor/trunk/includes/display_footer.class.php

    r2280253 r2284975  
    1414        }
    1515        function display_footer() {
    16             $footerId = get_option( 'wpmp-selected-footer' ,false );
     16            $footerId = get_option( 'wpmp_selected_footer' ,false );
    1717            if ( $footerId === false ) {
    1818                return;
     
    2525        }
    2626        function add_class($class) {
    27             $footer_class = 'wpmp-style-footer-'. get_option( 'wpmp-footer-style' ,'default' );
     27            $footer_class = 'wpmp-style-footer-'. get_option( 'wpmp_footer_style' ,'default' );
    2828            array_push($class,$footer_class);
    2929            return $class;
  • footer-design-for-elementor/trunk/includes/settings.class.php

    r2280253 r2284975  
    77    class Wpmp_settings_footer{
    88        public function __construct(){
    9             add_action( 'admin_menu',[$this,'books_register_ref_page'] );
     9            add_action( 'admin_menu',[$this,'footer_register_page_settings'] );
    1010        }
    11         function books_register_ref_page() {
     11       
     12        function footer_register_page_settings() {
    1213            add_submenu_page(
    1314                'edit.php?post_type='.WPMP_FOOTER_POST_TYPE,
     
    1819                [$this,'footer_page_settings']
    1920            );
     21            add_action( 'admin_init', [$this,'register_settings'] );
    2022        }
    21          
     23       
     24        function register_settings() {
     25
     26            add_settings_section(
     27                'general_settings_section',
     28                'General Settings',
     29                [$this,'general_settings_section_cb'],
     30                WPMP_FOOTER_SETTINGS_FIELD
     31            );
     32
     33            $allowed_settings = [
     34               __('Select Default Footer') => 'wpmp_selected_footer',
     35               __('Footer Style') => 'wpmp_footer_style',
     36            ];
     37
     38            foreach ( $allowed_settings as $key => $value) {
     39                register_setting( WPMP_FOOTER_SETTINGS_FIELD , $value );
     40                add_settings_field(
     41                    $value,
     42                    $key,
     43                    [$this, $value],
     44                    WPMP_FOOTER_SETTINGS_FIELD,
     45                    'general_settings_section'
     46                );
     47            }
     48        }
     49
     50        function general_settings_section_cb($args){
     51        }
     52       
     53        function wpmp_selected_footer(){
     54           
     55            $setting = get_option('wpmp_selected_footer',false);
     56            $all_footers = get_posts([ 'numberposts' => -1,'post_type'   => WPMP_FOOTER_POST_TYPE]);
     57            if (empty($all_footers)){
     58                ?>
     59                    <p> <?php esc_html_e('No footer found'); ?>  </p>
     60                <?php
     61                return;
     62            }
     63            ?>
     64                <select name="wpmp_selected_footer">
     65                    <?php
     66                        foreach ($all_footers as $key => $footer) {
     67                        ?>
     68                        <option
     69                        <?php if( $setting == $footer->ID ) echo esc_html('selected="selected"'); ?>
     70                        value="<?php echo esc_html( $footer->ID); ?>"  >
     71                       
     72                            <?php echo esc_html(  $footer->post_title.'—'.$footer->ID ); ?>
     73
     74                        </option>
     75                        <?php
     76                        }
     77                    ?>
     78                </select>
     79            <?php
     80        }
     81
     82        function wpmp_footer_style(){
     83            $setting = get_option('wpmp_footer_style',false);
     84            ?>
     85             <select name="wpmp_footer_style">
     86                <option value="default" <?php if( 'default'== $setting ) echo esc_html('selected="selected"'); ?> >Default</option>
     87                <option value="parallax" <?php if( 'parallax'== $setting ) echo esc_html('selected="selected"'); ?>>Parallax</option>
     88                <option value="sticky" <?php if( 'sticky'== $setting ) echo esc_html('selected="selected"'); ?>>Sticky</option>
     89            </select>
     90            <?php
     91        }
     92
    2293        function footer_page_settings() {
    23             if ( !empty($_POST) ) {
    24                 $allowed_settings = ['wpmp-footer-style','wpmp-selected-footer'];
    25                 foreach ( $_POST as $key => $value) {
    26                     if ( in_array($key, $allowed_settings) ){
    27                         update_option(  $key , sanitize_text_field($value ) );
    28                     }
    29                 }
    30             }
    31             include_once "views/settings.views.php";
     94            ?>
     95            <form method="post" action="options.php">
     96                <?php settings_fields( WPMP_FOOTER_SETTINGS_FIELD ); ?>
     97                <?php do_settings_sections( WPMP_FOOTER_SETTINGS_FIELD ); ?>
     98                <?php submit_button(); ?>
     99            </form>
     100            <?php
    32101        }
    33102    }
  • footer-design-for-elementor/trunk/index.php

    r2283319 r2284975  
    44Plugin URI:
    55Description: Design the footer you want easily.
    6 Version: 1.0
     6Version: 1.1.0
    77Author: MagicPages
    88Author URI: https://magicpages.tech
     
    1111    die;
    1212}
    13 defined( 'WPMP_FOOTER_VERSION' ) or define('WPMP_FOOTER_VERSION','1.0.0') ;
     13defined( 'WPMP_FOOTER_VERSION' ) or define('WPMP_FOOTER_VERSION','1.1.0') ;
    1414defined( 'WPMP_FOOTER_URL' ) or define('WPMP_FOOTER_URL', plugins_url( '/', __FILE__ )) ;
    1515defined( 'WPMP_FOOTER_PATH' ) or define( 'WPMP_FOOTER_PATH', plugin_dir_path( __FILE__ ) );
    1616defined( 'WPMP_FOOTER_POST_TYPE' ) or define('WPMP_FOOTER_POST_TYPE','wpmp_footer_pt') ;
    1717defined( 'WPMP_FOOTER_SETTINGS_SLUG' ) or define('WPMP_FOOTER_SETTINGS_SLUG','footer_settings') ;
     18defined( 'WPMP_FOOTER_SETTINGS_FIELD' ) or define('WPMP_FOOTER_SETTINGS_FIELD','wpmp_settings_footer_el') ;
     19
    1820if ( ! class_exists( 'Wpmp_Footer_Design' ) ) {
    1921   
Note: See TracChangeset for help on using the changeset viewer.