From 663f5b67e16a320c39452a5c970dddfd6a8072ed Mon Sep 17 00:00:00 2001 From: Yogesh Sambare Date: Sat, 3 Sep 2022 10:05:57 +0530 Subject: [PATCH 1/2] Plugin updated with lot's of changes --- admin.php | 242 +++++++++----------------------- coming-soon-mode-by-spectra.php | 12 +- css/admin1.css | 3 - css/admin2.css | 3 - css/admin3.css | 7 - css/admin4.css | 7 - css/public.css | 20 +++ js/custom.js | 106 +++++++------- 8 files changed, 151 insertions(+), 249 deletions(-) delete mode 100644 css/admin1.css delete mode 100644 css/admin2.css delete mode 100644 css/admin3.css delete mode 100644 css/admin4.css create mode 100644 css/public.css diff --git a/admin.php b/admin.php index 7e83fae..70b737b 100644 --- a/admin.php +++ b/admin.php @@ -13,13 +13,8 @@ /* add admin menu for plugin */ -function csm_admin_menu1() -{ - // add_menu_page(__('Coming Soon Mode', 'csm'), __('Coming Soon Mode - Settings', 'csm'), 'activate_plugins', 'csm-settings', 'csm_settings'); - -} add_action('admin_menu', 'csm_admin_menu'); -add_action('wp_footer', 'showfooter'); +add_filter('body_class', 'showfooter'); /* end */ /*dd code*/ add_action("admin_menu", "csm_admin_menu"); @@ -52,47 +47,35 @@ function csm_admin_menu() * @since 1.0.0 * @return void */ -function showfooter() +function showfooter($classes) { global $post; + $dis_header = get_option('dis_header'); - $dis_more_option= get_option('dis_more_option');$dis_footer = get_option('dis_footer'); + $dis_more_option= get_option('dis_more_option'); + $dis_footer = get_option('dis_footer'); $dis_sidebar = get_option('dis_sidebar'); $loadonly_content = get_option('csm_appearance'); $getpage = get_option('csm_show_page'); $pageid = $post->ID; - $selected=(array) get_option('csm_show_page'); $selected1=(array)get_option('csm_page'); $csm_page = array_merge($selected, $selected1); - - - if ($dis_header == "on" && !is_user_logged_in() && in_array($pageid, $csm_page)) { - ?> - - - - - - - -

Select the users who can access the live site even Coming Soon mode is activated.

+ + + Page Appearance + + + +

+ +
+ + + + +
+ + +
+ +
+

Make the selected page more interactive by controlling the website components.

+ - - - -Page Appearance - - - -

- -
- - - - -
- - -
- -
-

Make the selected page more interactive by controlling the website components.

- - - - - + - - + - - - - + - .postbox{ - border: none !important; - background: none !important; - box-shadow: none !important; - } - .csm-option-form label { - display: inline-block; - margin: 0 0 8px 0; - } - .select2{ -width: 200px !important; -max-width:100%; -} - - "; -} -add_action('admin_head', 'cms_admin_style');*/ \ No newline at end of file +} \ No newline at end of file diff --git a/coming-soon-mode-by-spectra.php b/coming-soon-mode-by-spectra.php index 197553d..c0017fd 100644 --- a/coming-soon-mode-by-spectra.php +++ b/coming-soon-mode-by-spectra.php @@ -7,15 +7,15 @@ * * @category Components * @package Components - * @author Brainstrom Force + * @author brainstormforce * @license GPLv2 or later * @link https://brainstormforce.com/ */ /** -Plugin Name: Coming Soon Mode by Spectra +Plugin Name: Coming Soon Mode By Spectra Plugin URI: https://brainstormforce.com/ -Description: Most lightweight Coming soon mode plugin ever by Spectra. +Description: Most lightweight Coming soon mode. Version: 1.0 Author: Brainstorm Force Author URI: https://brainstormforce.com @@ -104,4 +104,8 @@ function dd_Add_Plugin_Page_Settings_link($links) admin_url('admin.php?page=csm-settings') . '">' . __('Settings') . ''; return $links; -} \ No newline at end of file +} +function dd_scripts() { + wp_enqueue_style( 'public', plugin_dir_url( __FILE__ ) . 'css/public.css' ); +} +add_action( 'wp_enqueue_scripts', 'dd_scripts' ); \ No newline at end of file diff --git a/css/admin1.css b/css/admin1.css deleted file mode 100644 index 8599d0f..0000000 --- a/css/admin1.css +++ /dev/null @@ -1,3 +0,0 @@ -.site-header,#site-header, #header,header{ - display:none !important; - } \ No newline at end of file diff --git a/css/admin2.css b/css/admin2.css deleted file mode 100644 index 69c5caf..0000000 --- a/css/admin2.css +++ /dev/null @@ -1,3 +0,0 @@ -.site-footer,#site-footer, #footer,footer{ - display:none !important; - } \ No newline at end of file diff --git a/css/admin3.css b/css/admin3.css deleted file mode 100644 index ab0f28d..0000000 --- a/css/admin3.css +++ /dev/null @@ -1,7 +0,0 @@ -.sidebar-main,.sidebar,#sidebar .site-sidebar,#site-sidebar{ - display:none !important; - } - .content-area,#main,#primary{ - width:100% !important; - margin:0px !important; - } \ No newline at end of file diff --git a/css/admin4.css b/css/admin4.css deleted file mode 100644 index 463e768..0000000 --- a/css/admin4.css +++ /dev/null @@ -1,7 +0,0 @@ -.site-header,#site-header,.sidebar-main, #header,header,#footer,footer,.sidebar,#sidebar .site-sidebar,#site-sidebar ,.site-footer,#site-footer{ - display:none !important; - } - .content-area,#main,#primary{ - width:100% !important; - margin:0px !important; - } \ No newline at end of file diff --git a/css/public.css b/css/public.css new file mode 100644 index 0000000..d6ac3c8 --- /dev/null +++ b/css/public.css @@ -0,0 +1,20 @@ +.header-hide header{ + display:none; + } + .footer-hide footer{ + display:none; + } + .siderbar-hide sidebar{ + display:none; + } + .content-only header{ + display:none; + } + + .content-only footer{ + display:none; + } + + .content-only sidebar{ + display:none; + } \ No newline at end of file diff --git a/js/custom.js b/js/custom.js index 771e8c5..8bc555e 100644 --- a/js/custom.js +++ b/js/custom.js @@ -1,51 +1,55 @@ -jQuery(document).ready(function(){ - if(jQuery('input[name="csm_appearance"]').prop('checked') == true){ - var inputValue1 = jQuery('input[name="csm_appearance"]').attr("value"); - if(inputValue1 == 'dis_more_option'){ - jQuery(".chk_con").show(); - - }else{ - jQuery('.chk_con').hide(); - } - } - jQuery('input[name="csm_appearance"]').click(function(){ - var inputValue = jQuery(this).attr("value"); - if(inputValue == 'dis_more_option'){ - jQuery(".chk_con").show(); - }else{ - jQuery(".chk_con").hide(); - } - }); - jQuery('input[name="csm_mode"]').change(function(){ - let mode = jQuery(this).val(); - - if(mode == 'live'){ - jQuery('.csm-choose-page').hide(); - jQuery('.csm-who-can-access').hide(); - jQuery('.theme-compatibility').hide(); - } - else{ - jQuery('.csm-choose-page').css('display','table-row'); - jQuery('.csm-who-can-access').css('display','table-row'); - jQuery('.theme-compatibility').css('display','table-row'); - } - }) - }) - jQuery(document).ready(function(){ - jQuery('input[name="csm_who_can_access"]').change(function(){ - let csm_who_can_access = jQuery(this).val(); - - if(csm_who_can_access == 'logged'){ - jQuery('.csm-custom-roles').hide(); - } - else{ - jQuery('.csm-custom-roles').show(); - } - }) - }) - // In your Javascript (external .js resource or - - -"> + + + * @author Brainstorm Force * @license GPLv2 or later * @link https://brainstormforce.com/ */ @@ -30,16 +30,16 @@ * @return void */ define('CSM_PLUGIN_DIR', plugin_dir_path(__FILE__)); -require_once(CSM_PLUGIN_DIR . '/admin.php'); +require_once CSM_PLUGIN_DIR . '/admin.php'; -add_action('template_redirect', 'csm_redirect'); +add_action('template_redirect', 'Csm_redirect'); /** * Check if in admin panel or current page = page need redirect => do nothing * * @return void **/ -function csm_redirect() +function Csm_redirect() { global $post; $redirect_page_id = get_option('csm_show_page'); /* get option */ @@ -95,7 +95,8 @@ function csm_redirect() /** * Define constants * - * @since 1.0.0 + * @param object $links links object. + * * @return void */ function dd_Add_Plugin_Page_Settings_link($links) @@ -105,7 +106,14 @@ function dd_Add_Plugin_Page_Settings_link($links) '">' . __('Settings') . ''; return $links; } -function dd_scripts() { - wp_enqueue_style( 'public', plugin_dir_url( __FILE__ ) . 'css/public.css' ); + +/** + * Define constants + * + * @return void + */ +function Css_add() +{ + wp_enqueue_style('public', plugin_dir_url(__FILE__) . 'css/public.css'); } -add_action( 'wp_enqueue_scripts', 'dd_scripts' ); \ No newline at end of file +add_action('wp_enqueue_scripts', 'css_add'); \ No newline at end of file