html-filemanager-language.php
2 years ago
html-filemanager-list-operations.php
2 years ago
html-filemanager-settings.php
2 years ago
html-filemanager-user-role-restrictions.php
2 years ago
html-filemanager.php
2 years ago
index.php
2 years ago
html-filemanager-settings.php
149 lines
| 1 | <?php |
| 2 | defined('ABSPATH') || exit; |
| 3 | $viewPathLanguage = NJT_FS_BN_PLUGIN_PATH . 'views/pages/html-filemanager-language.php'; |
| 4 | $viewUserRoleRestrictions = NJT_FS_BN_PLUGIN_PATH . 'views/pages/html-filemanager-user-role-restrictions.php'; |
| 5 | global $wp_roles; |
| 6 | if( isset( $_POST ) && !empty( $_POST ) && !empty($_POST['njt-settings-form-submit'])){ |
| 7 | if( ! wp_verify_nonce( $_POST['njt-fs-settings-security-token'] ,'njt-fs-settings-security-token')) wp_die(); |
| 8 | |
| 9 | $this->options['njt_fs_file_manager_settings']['root_folder_path'] = filter_var($_POST['root_folder_path'], FILTER_SANITIZE_STRING) ? str_replace("\\\\", "/", trim($_POST['root_folder_path'])) : ''; |
| 10 | $this->options['njt_fs_file_manager_settings']['enable_htaccess'] = isset($_POST['enable_htaccess']) ? sanitize_text_field($_POST['enable_htaccess']) : 0; |
| 11 | $this->options['njt_fs_file_manager_settings']['enable_trash'] = isset($_POST['enable_trash']) ? sanitize_text_field($_POST['enable_trash']) : 0; |
| 12 | $this->options['njt_fs_file_manager_settings']['upload_max_size'] = filter_var($_POST['upload_max_size'], FILTER_SANITIZE_STRING) ? sanitize_text_field(trim($_POST['upload_max_size'])) : 0; |
| 13 | $this->options['njt_fs_file_manager_settings']['fm_locale'] = filter_var($_POST['fm_locale'], FILTER_SANITIZE_STRING) ? sanitize_text_field($_POST['fm_locale']) : 'en'; |
| 14 | $this->options['njt_fs_file_manager_settings']['list_user_alow_access'] = filter_var($_POST['list_user_alow_access'], FILTER_SANITIZE_STRING) ? explode(',',$_POST['list_user_alow_access']) : array(); |
| 15 | } |
| 16 | |
| 17 | ?> |
| 18 | <div class="njt-fs-settings njt-fs-file-manager"> |
| 19 | <h1 id="njt-plugin-tabs" class="nav-tab-wrapper hide-if-no-js"> |
| 20 | <a href="javascript:void(0)" class="nav-tab nav-tab-active" data-tab="njt_fs_setting"><?php _e("Settings", NJT_FS_BN_DOMAIN); ?></a> |
| 21 | <a href="javascript:void(0)" class="nav-tab" data-tab="njt_fs_roles"><?php _e("User Role Restrictions", NJT_FS_BN_DOMAIN); ?></a> |
| 22 | </h1> |
| 23 | <div class="njt-fs-settings-content"> |
| 24 | <form action="" class="njt-plugin-setting settings-form" method="POST"> |
| 25 | <!-- creat token --> |
| 26 | <input type='hidden' name='njt-fs-settings-security-token' |
| 27 | value='<?php echo wp_create_nonce('njt-fs-settings-security-token'); ?>'> |
| 28 | |
| 29 | <table class="form-table"> |
| 30 | <tr> |
| 31 | <th><?php _e("Select User Roles to access", NJT_FS_BN_DOMAIN); ?></th> |
| 32 | <td> |
| 33 | <div class="njt-fs-list-user njt-settting-width njt-fs-list-col4" style="line-height:2"> |
| 34 | <?php foreach ( $wp_roles->roles as $key=>$value ): ?> |
| 35 | <?php if ($key != 'administrator') {?> |
| 36 | <span class="list-col4-item"> |
| 37 | <input type="checkbox" class="fm-list-user-item" id="<?php echo $key; ?>" name="<?php echo $key; ?>" |
| 38 | data-name="<?php echo $value['name'];?>" value="<?php echo $key; ?>"> |
| 39 | <label for="<?php echo $key; ?>"> <?php echo $value['name']; ?></label> |
| 40 | </span> |
| 41 | <?php }?> |
| 42 | <?php endforeach; ?> |
| 43 | <!-- Value to submit data --> |
| 44 | <input type="hidden" name="list_user_alow_access" id="list_user_alow_access"> |
| 45 | <!-- Data saved after submit --> |
| 46 | <input type="hidden" name="list_user_has_approved" id="list_user_has_approved" |
| 47 | value="<?php echo implode(",", !empty($this->options['njt_fs_file_manager_settings']['list_user_alow_access']) ? $this->options['njt_fs_file_manager_settings']['list_user_alow_access'] : array());?>"> |
| 48 | </div> |
| 49 | </td> |
| 50 | </tr> |
| 51 | <!-- root Path --> |
| 52 | <tr> |
| 53 | <th><?php _e("Root Path", NJT_FS_BN_DOMAIN); ?></th> |
| 54 | <td> |
| 55 | <textarea type='text' name='root_folder_path' id='root_folder_path' class="njt-settting-width" |
| 56 | placeholder="ex: <?php echo (str_replace("\\", "/", ABSPATH)."wp-content");?>"> <?php if( isset( $this->options['njt_fs_file_manager_settings']['root_folder_path'] ) && !empty( $this->options['njt_fs_file_manager_settings']['root_folder_path'] ) ) echo str_replace("\\", "/",esc_attr($this->options['njt_fs_file_manager_settings']['root_folder_path'])); ?></textarea> |
| 57 | <div> |
| 58 | <p class="description njt-settting-width"> |
| 59 | <?php _e("Default path is: "."<code>". str_replace("\\", "/", ABSPATH)."</code>", NJT_FS_BN_DOMAIN); ?> |
| 60 | </p> |
| 61 | <p class="description njt-settting-width"> |
| 62 | <?php _e("Eg: If you want to set root path access is ". "<strong>wp-content</strong>". " folder. Just enter ", NJT_FS_BN_DOMAIN); ?> |
| 63 | <?php echo (str_replace("\\", "/", ABSPATH));?>wp-content |
| 64 | </p> |
| 65 | </div> |
| 66 | </td> |
| 67 | </tr> |
| 68 | <!-- url Path --> |
| 69 | <tr> |
| 70 | <th><?php _e("Files URL", NJT_FS_BN_DOMAIN); ?></th> |
| 71 | <td> |
| 72 | <textarea type='text' name='root_folder_url' id='root_folder_url' class="njt-settting-width" |
| 73 | placeholder="ex: <?php echo (site_url());?>"> <?php if( isset( $this->options['njt_fs_file_manager_settings']['root_folder_url'] ) && !empty( $this->options['njt_fs_file_manager_settings']['root_folder_url'] ) ) echo str_replace("\\", "/",esc_attr($this->options['njt_fs_file_manager_settings']['root_folder_url'])); ?></textarea> |
| 74 | <div> |
| 75 | <p class="description njt-settting-width"> |
| 76 | <?php _e("Default path is: "."<code>". str_replace("\\", "/", site_url())."</code>", NJT_FS_BN_DOMAIN); ?> |
| 77 | </p> |
| 78 | </div> |
| 79 | </td> |
| 80 | </tr> |
| 81 | <!-- Maximum Upload Size --> |
| 82 | <tr> |
| 83 | <th><?php _e("Maximum Upload Size", NJT_FS_BN_DOMAIN); ?></th> |
| 84 | <td> |
| 85 | <input type="number" name="upload_max_size" id="upload_max_size" class="njt-fs-settting-width-half" |
| 86 | value="<?php if( isset( $this->options['njt_fs_file_manager_settings']['upload_max_size'] ) && !empty( $this->options['njt_fs_file_manager_settings']['upload_max_size'] )) echo esc_attr($this->options['njt_fs_file_manager_settings']['upload_max_size']); ?>"> |
| 87 | <strong><?php _e("MB", NJT_FS_BN_DOMAIN); ?></strong> |
| 88 | <div class="des-path njt-settting-width"> |
| 89 | <small> |
| 90 | <?php _e("Default:", NJT_FS_BN_DOMAIN); ?> |
| 91 | <b><?php _e("0 means unlimited upload.", NJT_FS_BN_DOMAIN); ?></b> |
| 92 | </small> |
| 93 | </div> |
| 94 | </td> |
| 95 | </tr> |
| 96 | <!-- Select language --> |
| 97 | <tr> |
| 98 | <th><?php _e("Select language", NJT_FS_BN_DOMAIN); ?></th> |
| 99 | <td> |
| 100 | <?php include_once $viewPathLanguage; ?> |
| 101 | </td> |
| 102 | </tr> |
| 103 | <!-- .htaccess --> |
| 104 | <tr> |
| 105 | <th><?php _e("Hide .htaccess?", NJT_FS_BN_DOMAIN); ?></th> |
| 106 | <td> |
| 107 | <label class="shortcode-switch" for="enable_htaccess"> |
| 108 | <input name="enable_htaccess" type="checkbox" id="enable_htaccess" value="1" |
| 109 | <?php echo isset($this->options['njt_fs_file_manager_settings']['enable_htaccess']) && ($this->options['njt_fs_file_manager_settings']['enable_htaccess'] == '1') ? 'checked="checked"' : '';?>> |
| 110 | |
| 111 | <div class="slider round"></div> |
| 112 | </label> |
| 113 | |
| 114 | |
| 115 | <p class="description njt-settting-width"> |
| 116 | <?php _e("Will Hide .htaccess file (if exists) in file manager.", NJT_FS_BN_DOMAIN); ?> |
| 117 | </p> |
| 118 | </td> |
| 119 | </tr> |
| 120 | <!-- Enable Trash? --> |
| 121 | <tr> |
| 122 | <th><?php _e("Enable Trash?", NJT_FS_BN_DOMAIN); ?></th> |
| 123 | <td> |
| 124 | <label class="shortcode-switch" for="enable_trash"> |
| 125 | <input name="enable_trash" type="checkbox" id="enable_trash" value="1" |
| 126 | <?php echo isset($this->options['njt_fs_file_manager_settings']['enable_trash']) && ($this->options['njt_fs_file_manager_settings']['enable_trash'] == '1') ? 'checked="checked"' : '';?>> |
| 127 | <div class="slider round"></div> |
| 128 | </label> |
| 129 | |
| 130 | <p class="description njt-settting-width"> |
| 131 | <?php _e("After enable trash, after delete your files will go to trash folder.", NJT_FS_BN_DOMAIN); ?></p> |
| 132 | </td> |
| 133 | </tr> |
| 134 | <!-- button submit --> |
| 135 | <tr> |
| 136 | <td></td> |
| 137 | <td> |
| 138 | <p class="submit"> |
| 139 | <button type="button" name="njt-settings-form-submit" id="submit" |
| 140 | class="button button-primary njt-settings-form-submit"><?php _e("Save Changes", NJT_FS_BN_DOMAIN); ?></button> |
| 141 | </p> |
| 142 | </td> |
| 143 | </tr> |
| 144 | </table> |
| 145 | </form> |
| 146 | <!-- include html User Role Restrictions --> |
| 147 | <?php include_once $viewUserRoleRestrictions; ?> |
| 148 | </div> |
| 149 | </div> |