Changeset 2344191
- Timestamp:
- 07/21/2020 03:59:42 PM (6 years ago)
- File:
-
- 1 edited
-
cyklodev-wp-settings/trunk/index.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cyklodev-wp-settings/trunk/index.php
r2337112 r2344191 11 11 12 12 defined('ABSPATH') or die("Cannot access pages directly."); 13 14 15 16 function cyklodev_settings_js_form() { 17 $filename = esc_url( plugins_url( 'js/ckd_settings_form.js', __FILE__ ) ); 18 wp_register_script('cyklodev_settings', $filename, array( 'jquery' ), true, rand(), true); 19 wp_enqueue_script( 'cyklodev_settings'); 20 wp_enqueue_style('cyklodev_settings', esc_url( plugins_url( 'css/switch.css', __FILE__ ) )); 21 22 } 23 add_action( 'admin_enqueue_scripts', 'cyklodev_settings_js_form' ); 24 25 13 26 14 27 … … 26 39 */ 27 40 28 $options_list = array ( 29 'cyklodev_settings_rss' => 'Rss', 30 'cyklodev_settings_login_email' => 'Login with email', 31 'cyklodev_settings_update_notification' => 'Update notification', 32 'cyklodev_settings_update_auto' => 'Automatic update', 33 'cyklodev_settings_disable_gutemberg' => 'Disable Gutemberg' 34 ); 35 41 $options_list = array ( 42 'cyklodev_settings_rss' => 'Disable Rss', 43 'cyklodev_settings_auto_update_plugin' => 'Auto update plugins', 44 'cyklodev_settings_update_notification' => 'Disable update notification', 45 'cyklodev_settings_update_auto' => 'Disable automatic update', 46 'cyklodev_settings_disable_gutemberg' => 'Disable Gutemberg' 47 ); 36 48 37 49 /* … … 42 54 echo '<div class="wrap"><h2>'.__('Settings','cyklodev').'</h2>'; 43 55 include_once 'views/settings.php'; 44 }45 46 47 /*48 * Include function login with email49 */50 51 function cyklodev_login_with_email($username) {52 $user = get_user_by_email($username);53 if(!empty($user->user_login))54 $username = $user->user_login;55 return $username;56 56 } 57 57 … … 97 97 */ 98 98 99 if(get_option('cyklodev_settings_update_notification') == ' disable' || get_option('cyklodev_settings_update_notification') == false){99 if(get_option('cyklodev_settings_update_notification') == 'on'){ 100 100 add_action('admin_menu','cyklodev_remove_update_notification'); 101 101 } 102 102 103 if(get_option('cyklodev_settings_login_email') == ' enable'){103 if(get_option('cyklodev_settings_login_email') == 'on'){ 104 104 add_action('wp_authenticate','cyklodev_login_with_email'); 105 105 } 106 106 107 if(get_option('cyklodev_settings_rss') == ' disable' || get_option('cyklodev_settings_rss') == false){107 if(get_option('cyklodev_settings_rss') == 'on' ){ 108 108 add_action('init', 'cyklodev_disable_rss_links'); 109 109 } 110 110 111 if(get_option('cyklodev_settings_disable_gutemberg') == ' enable'){111 if(get_option('cyklodev_settings_disable_gutemberg') == 'on'){ 112 112 add_action('init', 'cyklodev_disable_gutemberg'); 113 113 } 114 114 115 if(get_option('cyklodev_settings_update_auto') == 'enable'){ 115 if(get_option('cyklodev_settings_update_auto') == 'on'){ 116 define( 'AUTOMATIC_UPDATER_DISABLED', true ); 116 117 define ('WP_AUTO_UPDATE_CORE',true); 117 } else {118 define ('WP_AUTO_UPDATE_CORE',false);119 118 } 119 120 if(get_option('cyklodev_settings_auto_update_plugin') == 'on'){ 121 define( 'AUTOMATIC_UPDATER_DISABLED', false ); 122 add_filter( 'auto_update_plugin', '__return_true' ); 123 } 124 120 125 ?>
Note: See TracChangeset
for help on using the changeset viewer.