| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
if( ! class_exists( 'MywpControllerAbstractModule' ) ) { |
| 8 |
return false; |
| 9 |
} |
| 10 |
|
| 11 |
if ( ! class_exists( 'MywpControllerModuleSiteGeneral' ) ) : |
| 12 |
|
| 13 |
final class MywpControllerModuleSiteGeneral extends MywpControllerAbstractModule { |
| 14 |
|
| 15 |
static protected $network = true; |
| 16 |
|
| 17 |
static protected $id = 'site_general'; |
| 18 |
|
| 19 |
public static function mywp_controller_initial_data( $initial_data ) { |
| 20 |
|
| 21 |
$initial_data['disable_file_edit'] = ''; |
| 22 |
|
| 23 |
return $initial_data; |
| 24 |
|
| 25 |
} |
| 26 |
|
| 27 |
public static function mywp_controller_default_data( $default_data ) { |
| 28 |
|
| 29 |
$default_data['disable_file_edit'] = false; |
| 30 |
|
| 31 |
return $default_data; |
| 32 |
|
| 33 |
} |
| 34 |
|
| 35 |
protected static function after_init() { |
| 36 |
|
| 37 |
if( ! self::is_do_controller() ) { |
| 38 |
|
| 39 |
return false; |
| 40 |
|
| 41 |
} |
| 42 |
|
| 43 |
self::disable_file_edit(); |
| 44 |
|
| 45 |
} |
| 46 |
|
| 47 |
private static function disable_file_edit() { |
| 48 |
|
| 49 |
if( ! self::is_do_function( __FUNCTION__ ) ) { |
| 50 |
|
| 51 |
return false; |
| 52 |
|
| 53 |
} |
| 54 |
|
| 55 |
$setting_data = self::get_setting_data(); |
| 56 |
|
| 57 |
if( empty( $setting_data['disable_file_edit'] ) ) { |
| 58 |
|
| 59 |
return false; |
| 60 |
|
| 61 |
} |
| 62 |
|
| 63 |
if( ! defined( 'DISALLOW_FILE_EDIT' ) ) { |
| 64 |
|
| 65 |
define( 'DISALLOW_FILE_EDIT' , true ); |
| 66 |
|
| 67 |
} |
| 68 |
|
| 69 |
self::after_do_function( __FUNCTION__ ); |
| 70 |
|
| 71 |
} |
| 72 |
|
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
MywpControllerModuleSiteGeneral::init(); |
| 77 |
|
| 78 |
endif; |
| 79 |
|