Plugin Directory

Changeset 2605161

Timestamp:
09/26/2021 09:15:49 PM (3 years ago)
Author:
s4gor
Message:

fix php issue

Location:
disable-auto-updates/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • disable-auto-updates/trunk/disable-auto-updates.php

    r2605151 r2605161  
    55Plugin URI: https://wordpress.org/plugins/disable-auto-updates
    66Description: A simple plugin to disable plugin, theme or core auto updates
    7 Version: 1.2
     7Version: 1.2
    88Author: Imran Hossain Sagor
    99Author URI: https://imransagor.codes
     
    116116
    117117
    118     $dau_services = ['disable-all', 'disable-plugin', 'disable-theme', 'disable-core', 'hide-notification', 'disable-admin-notice'];
     118    $dau_services = ['disable-all', 'disable-plugin', 'disable-theme', 'disable-core', ''];
    119119
    120120    foreach ($dau_services as $service) {
  • disable-auto-updates/trunk/readme.txt

    r2605151 r2605161  
    44Requires at least: 4.7
    55Tested up to: 5.8
    6 Stable tag: 1.2
     6Stable tag: 1.2
    77Requires PHP: 5.0
    88License: GPLv3
     
    3939== Change Log ==
    4040
     41
     42
     43
     44
    4145= 1.2 =
    4246
  • disable-auto-updates/trunk/view/view.php

    r2605151 r2605161  
    2626
    2727global $dau_services;
    28 $dau_services = ['disable-all', 'disable-plugin', 'disable-theme', 'disable-core', 'hide-notification', 'disable-admin-notice'];
     28$dau_services = ['disable-all', 'disable-plugin', 'disable-theme', 'disable-core', ''];
    2929$submitted = [];
    3030
     
    8888                    $log_content = "Core auto update has been disabled - " . current_time('mysql') . " by $user<br />";
    8989                }
    90             }elseif($service === 'disable-admin-notice') {
     90            }elseif($service === 'disable-admin-notice') {
    9191                $content = '<?php
    9292                               
    93                 defined("ABSPATH") or die("Unauthorized Access");
     93defined("ABSPATH") or die("Unauthorized Access");
    9494               
    95                 add_action("admin_enqueue_scripts", "hide_notices");
    96                 add_action("login_enqueue_scripts", "hide_notices");
    97                 function hide_notices() {
    98                     if (!current_user_can( "manage_options" )) {
    99                         echo "<style>.update-nag, .updated, .error, .is-dismissible, .notice { display: none; }</style>";
    100                     }
    101                 }';
    102             }
    103            
    104             if(!file_exists($dau_dir.'/'.$service.'.php')) {
    105                 $log_content = 'Admin notice has been disabled - ' . current_time('mysql') . ' by ' . $user . '<br />';
     95add_action("admin_enqueue_scripts", "hide_notices");
     96add_action("login_enqueue_scripts", "hide_notices");
     97   
     98function hide_notices() {
     99    if (!current_user_can( "manage_options" )) {
     100        echo "<style>.update-nag, .updated, .error, .is-dismissible, .notice { display: none; }</style>";
     101    }
     102}';
     103
     104                if(!file_exists("$dau_dir/$service.php")) {
     105                    $log_content = "Admin notice has been disabled - " . current_time('mysql') . " by $user<br />";
     106                }
     107
     108
    106109            } else {
    107110                $content = '<?php
     
    140143                } elseif($service === "disable-core") {
    141144                    $log_content_delete = "Core auto update has been enabled - " . current_time('mysql') . " by $user<br />";
    142                 }elseif($service === "'disable-admin-notice'") {
     145                }") {
    143146                    $log_content_delete = "Admin notice has been enabled - " . current_time('mysql') . " by $user<br />";
    144                 } else {
     147                } else {
    145148                    $log_content_delete = "Update notifications have been enabled along with core, theme and plugin updates - " . current_time('mysql') . " by $user<br />";
    146149                }
     
    159162
    160163<div id="dau">
    161     <h1 id="dau-title">Disable Auto Updates <sub style="font-size: 12px">V 1.2</sub></h1>
     164    <h1 id="dau-title">Disable Auto Updates <sub style="font-size: 12px">V 1.2</sub></h1>
    162165    <hr align="left" width="600">
    163166
Note: See TracChangeset for help on using the changeset viewer.