PluginProbe
RSFirewall! / trunk
RSFirewall! vtrunk
rsfirewall / controllers / diff.php

diff.php in RSFirewall! trunk, at controllers/diff.php

43 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package RSFirewall!
4 * @copyright (c) 2018 RSJoomla!
5 * @link https://www.rsjoomla.com
6 * @license GNU General Public License http://www.gnu.org/licenses/gpl-3.0.en.html
7 */
8
9 if ( ! defined( 'WPINC' ) ) {
10 die;
11 }
12
13 class RSFirewall_Controller_Diff extends RSFirewall_Controller
14 {
15 public function download_file() {
16 $model = $this->model;
17 $file = $this->model->get_file();
18
19 $result = $model->download_original_file( $file );
20 echo json_encode($result);
21
22 exit();
23 }
24
25 public function enqueue_scripts($pagenow){
26 // need to load this script also on the check page, because it is a dependency to the check script
27 if ($pagenow != 'rsfirewall_page_rsfirewall_diff' && $pagenow != 'rsfirewall_page_rsfirewall_check') {
28 return;
29 }
30 wp_register_script( 'rsfirewall_diff', RSFIREWALL_URL . 'assets/js/rsfirewall_diff.js', array( 'jquery' ), $this->version, false );
31 wp_localize_script( 'rsfirewall_diff', 'rsfirewall_diff_locale', RSFirewall_i18n::get_locale( 'rsfirewall_diff' ) );
32 wp_enqueue_script( 'rsfirewall_diff' );
33 }
34
35 public function view_differences(){
36 // Check the nonce for this action
37
38 RSFirewall_Helper::check_nonce('view_contents');
39
40 $this->display();
41 exit();
42 }
43 }