| @@ -1,6 +1,50 @@ | ||
| 1 | 1 | <?php |
| 2 | -if (!defined('WP_UNINSTALL_PLUGIN')) exit; | |
| 2 | +if (!defined('WP_UNINSTALL_PLUGIN')) { | |
| 3 | + exit; | |
| 4 | +} | |
| 3 | 5 | |
| 4 | 6 | delete_option('photonic_options'); |
| 5 | 7 | delete_option('photonic_authentication'); |
| 8 | +delete_option('photonic_css'); | |
| 6 | 9 | |
| 10 | +$photonic_token_monitor_timestamp = wp_next_scheduled('photonic_token_monitor'); | |
| 11 | +wp_unschedule_event($photonic_token_monitor_timestamp, 'photonic_token_monitor'); | |
| 12 | + | |
| 13 | +/* | |
| 14 | +$url = wp_nonce_url('plugins.php?page=photonic-options-manager'); | |
| 15 | +if (false === ($creds = request_filesystem_credentials($url, '', false, false))) { | |
| 16 | + return true; | |
| 17 | +} | |
| 18 | + | |
| 19 | +if (!WP_Filesystem($creds)) { | |
| 20 | + request_filesystem_credentials($url, '', true, false); | |
| 21 | + return true; | |
| 22 | +} | |
| 23 | + | |
| 24 | +global $wp_filesystem; | |
| 25 | +if (!is_dir(PHOTONIC_UPLOAD_DIR)) { | |
| 26 | + if (!$wp_filesystem->mkdir(PHOTONIC_UPLOAD_DIR)) { | |
| 27 | + echo "<div class='error'><p>Failed to create directory ".PHOTONIC_UPLOAD_DIR.". Please check your folder permissions.</p></div>"; | |
| 28 | + return false; | |
| 29 | + } | |
| 30 | +} | |
| 31 | + | |
| 32 | +$filename = trailingslashit(PHOTONIC_UPLOAD_DIR).'custom-styles.css'; | |
| 33 | + | |
| 34 | +if (empty($custom_css)) { | |
| 35 | + return false; | |
| 36 | +} | |
| 37 | + | |
| 38 | +if (!$wp_filesystem->put_contents($filename, $custom_css, FS_CHMOD_FILE)) { | |
| 39 | + echo "<div class='error'><p>Failed to save file $filename. Please check your folder permissions.</p></div>"; | |
| 40 | + return false; | |
| 41 | +} | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | +$upload_dir = wp_upload_dir(); | |
| 46 | +$photonic_dir = trailingslashit($upload_dir['basedir']).'photonic'; | |
| 47 | +if (@file_exists($photonic_dir)) { | |
| 48 | + WP_Filesystem_Direct::delete($upload_dir, true); | |
| 49 | +} | |
| 50 | +*/ | |