Changeset 2284975
- Timestamp:
- 04/16/2020 01:51:24 PM (6 years ago)
- Location:
- footer-design-for-elementor/trunk
- Files:
-
- 3 edited
-
includes/display_footer.class.php (modified) (2 diffs)
-
includes/settings.class.php (modified) (2 diffs)
-
index.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
footer-design-for-elementor/trunk/includes/display_footer.class.php
r2280253 r2284975 14 14 } 15 15 function display_footer() { 16 $footerId = get_option( 'wpmp -selected-footer' ,false );16 $footerId = get_option( 'wpmp_selected_footer' ,false ); 17 17 if ( $footerId === false ) { 18 18 return; … … 25 25 } 26 26 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' ); 28 28 array_push($class,$footer_class); 29 29 return $class; -
footer-design-for-elementor/trunk/includes/settings.class.php
r2280253 r2284975 7 7 class Wpmp_settings_footer{ 8 8 public function __construct(){ 9 add_action( 'admin_menu',[$this,' books_register_ref_page'] );9 add_action( 'admin_menu',[$this,'footer_register_page_settings'] ); 10 10 } 11 function books_register_ref_page() { 11 12 function footer_register_page_settings() { 12 13 add_submenu_page( 13 14 'edit.php?post_type='.WPMP_FOOTER_POST_TYPE, … … 18 19 [$this,'footer_page_settings'] 19 20 ); 21 add_action( 'admin_init', [$this,'register_settings'] ); 20 22 } 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 22 93 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 32 101 } 33 102 } -
footer-design-for-elementor/trunk/index.php
r2283319 r2284975 4 4 Plugin URI: 5 5 Description: Design the footer you want easily. 6 Version: 1. 06 Version: 1.1.0 7 7 Author: MagicPages 8 8 Author URI: https://magicpages.tech … … 11 11 die; 12 12 } 13 defined( 'WPMP_FOOTER_VERSION' ) or define('WPMP_FOOTER_VERSION','1. 0.0') ;13 defined( 'WPMP_FOOTER_VERSION' ) or define('WPMP_FOOTER_VERSION','1.1.0') ; 14 14 defined( 'WPMP_FOOTER_URL' ) or define('WPMP_FOOTER_URL', plugins_url( '/', __FILE__ )) ; 15 15 defined( 'WPMP_FOOTER_PATH' ) or define( 'WPMP_FOOTER_PATH', plugin_dir_path( __FILE__ ) ); 16 16 defined( 'WPMP_FOOTER_POST_TYPE' ) or define('WPMP_FOOTER_POST_TYPE','wpmp_footer_pt') ; 17 17 defined( 'WPMP_FOOTER_SETTINGS_SLUG' ) or define('WPMP_FOOTER_SETTINGS_SLUG','footer_settings') ; 18 defined( 'WPMP_FOOTER_SETTINGS_FIELD' ) or define('WPMP_FOOTER_SETTINGS_FIELD','wpmp_settings_footer_el') ; 19 18 20 if ( ! class_exists( 'Wpmp_Footer_Design' ) ) { 19 21
Note: See TracChangeset
for help on using the changeset viewer.