Changeset 1278839
- Timestamp:
- 11/03/2015 06:05:09 PM (10 years ago)
- Location:
- my-custom-css/tags/2.0
- Files:
-
- 2 edited
- 1 copied
-
. (copied) (copied from my-custom-css/tags/1.9)
-
my-custom-css.php (modified) (11 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
my-custom-css/tags/2.0/my-custom-css.php
r1278547 r1278839 7 7 You can see in action (source code) here: http://vegamami.altervista.org/ :) 8 8 Author: Salvatore Noschese - DarkWolf 9 Version: 1.99 Version: 2.0 10 10 Author URI: https://laltroweb.it/ 11 11 Text Domain: my-custom-css … … 25 25 } 26 26 27 // Fix no backup folder 28 $dirpath = plugin_dir_path(__FILE__).'_backup/'; 29 if (!is_dir($dirpath)) 30 { 31 mkdir($dirpath, 0755, true); 32 } 27 // Fix old backup folder or no exist 28 $dirpath = plugin_dir_path(__FILE__).'hidden/bkk/'; 29 $old_dirpath = plugin_dir_path(__FILE__).'_backup/'; 30 if (!is_dir($old_dirpath) && !is_dir($dirpath)) 31 { 32 wp_mkdir_p($dirpath); 33 } 34 else if (is_dir($old_dirpath)) 35 { 36 wp_mkdir_p($dirpath); 37 rename($old_dirpath, $dirpath); 38 } 39 33 40 34 41 // Make backup when save! … … 37 44 38 45 $blog_id = get_current_blog_id(); $cssid = ( $blog_id > "1" ) ? $cssid = "_id-".$blog_id : $cssid = null; 39 $directory = plugin_dir_path(__FILE__) . " _backup/*.css";46 $directory = plugin_dir_path(__FILE__) . "hidden/bkk/*.css"; 40 47 if (glob($directory) != false) 41 48 { … … 47 54 } 48 55 $oldname = plugin_dir_path(__FILE__)."my_style".$cssid.".css"; 49 $newname = plugin_dir_path(__FILE__).' _backup/' . ( $filecount ++ ) . $cssid . '_' . filemtime($oldname) .'.css';56 $newname = plugin_dir_path(__FILE__).'hidden/bkk/' . ( $filecount ++ ) . $cssid . '_' . filemtime($oldname) .'.css'; 50 57 rename($oldname, $newname); 51 58 } … … 54 61 if(isset($_POST['viewbackup'])) 55 62 { 56 $directory = plugin_dir_path(__FILE__)." _backup/";63 $directory = plugin_dir_path(__FILE__)."hidden/bkk/"; 57 64 $files=array(); 58 65 if ($dh=opendir($directory)) … … 66 73 krsort($files); 67 74 reset($files); 68 $href = plugin_dir_url(__FILE__)." _backup/";75 $href = plugin_dir_url(__FILE__)."hidden/bkk/"; 69 76 date_default_timezone_set(ini_get('date.timezone') ? ini_get('date.timezone') : 'UTC'); 70 77 … … 119 126 </head> 120 127 <body style=\"background: #F1F1F1; padding: 20px; width: 90%; margin: 20px auto; border: 1px 0 dotted gray\">"; 121 $glob = glob(plugin_dir_path(__FILE__)." _backup/*.css");128 $glob = glob(plugin_dir_path(__FILE__)."hidden/bkk/*.css"); 122 129 if ($glob == false) 123 130 { … … 134 141 <input type=\"button\" value=\"Close now!\" onclick=\"self.close()\" style=\"margin: 0px 20px; float: right\" /> 135 142 <br />"; 136 foreach (glob(plugin_dir_path(__FILE__)." _backup/*.css") as $filename)143 foreach (glob(plugin_dir_path(__FILE__)."hidden/bkk/*.css") as $filename) 137 144 { 138 145 echo " … … 179 186 // make my_style.css and write write css code! 180 187 $mycustomcss = mycustomcss(); 181 $makecss = file_put_contents(css_path(), "/********* Do not edit this file *********/\n/*\nMy Custom CSS - Maked by Salvatore Noschese\na.k.a. DarkWolf - http://www://darkwolf.it/\n*/\n\n".mycustomcss()); 188 global $wp_filesystem; 189 if (empty($wp_filesystem)) 190 { 191 require_once (ABSPATH . '/wp-admin/includes/file.php'); 192 WP_Filesystem(); 193 } 194 $makecss = $wp_filesystem->put_contents(css_path(), "/********* Do not edit this file *********/\n/*\nMy Custom CSS - Maked by Salvatore Noschese\na.k.a. DarkWolf - http://www://darkwolf.it/\n*/\n\n".mycustomcss(), 0644); 182 195 return $makecss; 183 196 } … … 295 308 $plugin_version = $plugin_data['Version']; 296 309 297 $glob = glob(plugin_dir_path(__FILE__)." _backup/*.css");310 $glob = glob(plugin_dir_path(__FILE__)."hidden/bkk/*.css"); 298 311 if ($glob == false) 299 312 { … … 334 347 makecss(); 335 348 } 336 elseif (empty($mycustomcss) && file_exists(css_path()))337 {338 unlink(css_path());339 }340 349 } 341 350 -
my-custom-css/tags/2.0/readme.txt
r1278547 r1278839 5 5 Requires at least: 3.0 6 6 Tested up to: 4.3.1 7 Stable tag: 1.97 Stable tag: 2.0 8 8 9 9 Enable to add Custom CSS Code via admin panel (with syntax and tab support by CodeMirror) … … 47 47 == Upgrade Notice == 48 48 49 = 1.9=49 = 2.0 = 50 50 51 * Some fix in multisite network (disable view/erase backup except for blog_id 1)!51 * Now use "$wp_filesystem->put_contents" and "wp_mkdir_p" instead of "file_put_contents" and "mkdir" (fix issue permission)... 52 52 53 53 == Changelog == 54 55 = 2.0 = 56 57 * Now use "$wp_filesystem->put_contents" and "wp_mkdir_p" instead of "file_put_contents" and "mkdir" (fix issue permission)... 58 * Move backup in "hidden directory" - with old backup migration (prevent long css list in wordpress plugin editor)... 54 59 55 60 = 1.9 =
Note: See TracChangeset
for help on using the changeset viewer.