Exemplo n.º 1
0
 function TS_VCSC_DeleteCustomPack()
 {
     $dest = wp_upload_dir();
     $dest_path = $dest['path'];
     $this_year = date('Y');
     $this_month = date('m');
     $the_date_string = $this_year . '/' . $this_month . '/';
     $customFontPackPath = $dest_path . '/ts-vcsc-icons/';
     $newCustomFontPackPath = str_replace($the_date_string, '', $customFontPackPath);
     $fileName = 'ts-vcsc-custom-pack.zip';
     $deleteZip = TS_VCSC_RemoveDirectory($newCustomFontPackPath);
     TS_VCSC_RemoveDirectory($newCustomFontPackPath);
 }
 function TS_VCSC_DeleteCustomPack_Ajax()
 {
     $dest = wp_upload_dir();
     $dest_path = $dest['path'];
     $this_year = date('Y');
     $this_month = date('m');
     $the_date_string = $this_year . '/' . $this_month . '/';
     $customFontPackPath = $dest_path . '/ts-vcsc-icons/custom-pack/';
     $newCustomFontPackPath = str_replace($the_date_string, '', $customFontPackPath);
     $fileName = 'ts-vcsc-custom-pack.zip';
     $deleteZip = TS_VCSC_RemoveDirectory($newCustomFontPackPath, false);
     TS_VCSC_RemoveDirectory($newCustomFontPackPath, false);
     TS_VCSC_ResetCustomFont();
     $this->TS_VCSC_tinymceCustomCount = 0;
     $this->TS_VCSC_Icons_Custom = array();
 }
 function TS_VCSC_RemoveDirectory($directory, $empty = false)
 {
     if (substr($directory, -1) == "/") {
         $directory = substr($directory, 0, -1);
     }
     if (!file_exists($directory) || !is_dir($directory)) {
         return false;
     } elseif (!is_readable($directory)) {
         return false;
     } else {
         $directoryHandle = opendir($directory);
         while ($contents = readdir($directoryHandle)) {
             if ($contents != '.' && $contents != '..') {
                 $path = $directory . "/" . $contents;
                 if (is_dir($path)) {
                     TS_VCSC_RemoveDirectory($path);
                 } else {
                     unlink($path);
                 }
             }
         }
         closedir($directoryHandle);
         if ($empty == false) {
             if (!rmdir($directory)) {
                 return false;
             }
         }
         return true;
     }
 }
Exemplo n.º 4
0
         if (strpos($dest_url, '/ts-vcsc-icons/custom-pack') !== false) {
             $newStyles = str_replace("url('fonts/", "url('" . $dest_url . "/fonts/", $currentStyles);
         } else {
             $newStyles = str_replace("url('fonts/", "url('" . $dest_url . "/ts-vcsc-icons/custom-pack/fonts/", $currentStyles);
         }
         // Write the contents back to the file
         $file_put_contents = file_put_contents($styleCSS, $newStyles);
     }
 } else {
     if ($upload_replace == 'on') {
         $basicCheck = false;
     }
 }
 // Delete unecessary files / add error checking
 if (file_exists($dest_path . '/demo-files')) {
     TS_VCSC_RemoveDirectory($dest_path . '/demo-files');
 }
 if (file_exists($dest_path . '/demo.html')) {
     unlink($dest_path . '/demo.html');
 }
 if (file_exists($dest_path . '/Read Me.txt')) {
     unlink($dest_path . '/Read Me.txt');
 }
 if ($basicCheck == true) {
     // Process JSON File to create and store Font Array
     $Custom_JSON_URL = $dest_url . '/ts-vcsc-custom-pack.json';
     if (ini_get('allow_url_fopen') == '1') {
         $Custom_JSON = file_get_contents($Custom_JSON_URL);
     } else {
         if (function_exists('curl_init')) {
             $ch = curl_init();