Changeset 1278942
- Timestamp:
- 11/03/2015 08:32:03 PM (10 years ago)
- Location:
- my-custom-css
- Files:
-
- 4 edited
- 1 copied
-
tags/2.1 (copied) (copied from my-custom-css/tags/2.0)
-
tags/2.1/my-custom-css.php (modified) (12 diffs)
-
tags/2.1/readme.txt (modified) (2 diffs)
-
trunk/my-custom-css.php (modified) (12 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
my-custom-css/tags/2.1/my-custom-css.php
r1278839 r1278942 7 7 You can see in action (source code) here: http://vegamami.altervista.org/ :) 8 8 Author: Salvatore Noschese - DarkWolf 9 Version: 2. 09 Version: 2.1 10 10 Author URI: https://laltroweb.it/ 11 11 Text Domain: my-custom-css … … 26 26 27 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)) 28 $dirpath = WP_CONTENT_DIR.'/my_custom_css/bkk'; 29 if (!is_dir($dirpath)) 31 30 { 32 31 wp_mkdir_p($dirpath); 33 32 } 34 else if (is_dir($old_dirpath))35 {36 wp_mkdir_p($dirpath);37 rename($old_dirpath, $dirpath);38 }39 40 33 41 34 // Make backup when save! … … 44 37 45 38 $blog_id = get_current_blog_id(); $cssid = ( $blog_id > "1" ) ? $cssid = "_id-".$blog_id : $cssid = null; 46 $directory = plugin_dir_path(__FILE__) . "hidden/bkk/*.css";39 $directory = WP_CONTENT_DIR."/my_custom_css/bkk/*.css"; 47 40 if (glob($directory) != false) 48 41 { … … 53 46 $filecount = 1; 54 47 } 55 $oldname = plugin_dir_path(__FILE__)."my_style".$cssid.".css";56 $newname = plugin_dir_path(__FILE__).'hidden/bkk/' . ( $filecount ++ ) . $cssid . '_' . filemtime($oldname) .'.css';48 $oldname = WP_CONTENT_DIR."/my_custom_css/my_style".$cssid.".css"; 49 $newname = WP_CONTENT_DIR.'/my_custom_css/bkk/' . ( $filecount ++ ) . $cssid . '_' . filemtime($oldname) .'.css'; 57 50 rename($oldname, $newname); 58 51 } … … 61 54 if(isset($_POST['viewbackup'])) 62 55 { 63 $directory = plugin_dir_path(__FILE__)."hidden/bkk/";56 $directory = WP_CONTENT_DIR."/my_custom_css/bkk/"; 64 57 $files=array(); 65 58 if ($dh=opendir($directory)) … … 73 66 krsort($files); 74 67 reset($files); 75 $href = plugin_dir_url(__FILE__)."hidden/bkk/";68 $href = WP_CONTENT_URL."/my_custom_css/bkk/"; 76 69 date_default_timezone_set(ini_get('date.timezone') ? ini_get('date.timezone') : 'UTC'); 77 70 … … 126 119 </head> 127 120 <body style=\"background: #F1F1F1; padding: 20px; width: 90%; margin: 20px auto; border: 1px 0 dotted gray\">"; 128 $glob = glob( plugin_dir_path(__FILE__)."hidden/bkk/*.css");121 $glob = glob(WP_CONTENT_DIR."/my_custom_css/bkk/*.css"); 129 122 if ($glob == false) 130 123 { … … 141 134 <input type=\"button\" value=\"Close now!\" onclick=\"self.close()\" style=\"margin: 0px 20px; float: right\" /> 142 135 <br />"; 143 foreach (glob( plugin_dir_path(__FILE__)."hidden/bkk/*.css") as $filename)136 foreach (glob(WP_CONTENT_DIR."/my_custom_css/bkk/*.css") as $filename) 144 137 { 145 138 echo " … … 158 151 { 159 152 $blog_id = get_current_blog_id(); $cssid = ( $blog_id > "1" ) ? $cssid = "_id-".$blog_id : $cssid = null; 160 $css_path = plugin_dir_path(__FILE__)."my_style".$cssid.".css";153 $css_path = WP_CONTENT_DIR."/my_custom_css/my_style".$cssid.".css"; 161 154 return $css_path; 162 155 } … … 165 158 { 166 159 $blog_id = get_current_blog_id(); $cssid = ( $blog_id > "1" ) ? $cssid = "_id-".$blog_id : $cssid = null; 167 $css_url = plugin_dir_url(__FILE__)."my_style".$cssid.".css";160 $css_url = WP_CONTENT_URL."/my_custom_css/my_style".$cssid.".css"; 168 161 return $css_url; 169 162 } … … 282 275 function mycustomcss_syntax() 283 276 { 284 $plugdir = plugin_dir_url(__FILE__);285 277 ?> 286 278 <!-- Syntax Support Start --> 287 <link type="text/css" rel="stylesheet" href="<?php echo $plugdir; ?>syntax/codemirror.css" />288 <script language="javascript" src="<?php echo $plugdir; ?>syntax/codemirror.js"></script>289 <script language="javascript" src="<?php echo $plugdir; ?>syntax/css.js"></script>279 <link type="text/css" rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__); ?>syntax/codemirror.css" /> 280 <script language="javascript" src="<?php echo plugin_dir_url(__FILE__); ?>syntax/codemirror.js"></script> 281 <script language="javascript" src="<?php echo plugin_dir_url(__FILE__); ?>syntax/css.js"></script> 290 282 <!-- Syntax Support End --> 291 283 <?php … … 308 300 $plugin_version = $plugin_data['Version']; 309 301 310 $glob = glob( plugin_dir_path(__FILE__)."hidden/bkk/*.css");302 $glob = glob(WP_CONTENT_DIR."/my_custom_css/bkk/*.css"); 311 303 if ($glob == false) 312 304 { -
my-custom-css/tags/2.1/readme.txt
r1278839 r1278942 5 5 Requires at least: 3.0 6 6 Tested up to: 4.3.1 7 Stable tag: 2. 07 Stable tag: 2.1 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 = 2. 0=49 = 2.1 = 50 50 51 * Now use "$wp_filesystem->put_contents" and "wp_mkdir_p" instead of "file_put_contents" and "mkdir" (fix issue permission)... 51 * Now my_style.css and backup will be saved in content directory! (no more delete on upgrade)! 52 * More other change in code... 52 53 53 54 == Changelog == 55 56 = 2.1 = 57 58 * Now my_style.css and backup will be saved in content directory! (no more delete on upgrade)! 59 * More other change in code... 54 60 55 61 = 2.0 = -
my-custom-css/trunk/my-custom-css.php
r1278834 r1278942 7 7 You can see in action (source code) here: http://vegamami.altervista.org/ :) 8 8 Author: Salvatore Noschese - DarkWolf 9 Version: 2. 09 Version: 2.1 10 10 Author URI: https://laltroweb.it/ 11 11 Text Domain: my-custom-css … … 26 26 27 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)) 28 $dirpath = WP_CONTENT_DIR.'/my_custom_css/bkk'; 29 if (!is_dir($dirpath)) 31 30 { 32 31 wp_mkdir_p($dirpath); 33 32 } 34 else if (is_dir($old_dirpath))35 {36 wp_mkdir_p($dirpath);37 rename($old_dirpath, $dirpath);38 }39 40 33 41 34 // Make backup when save! … … 44 37 45 38 $blog_id = get_current_blog_id(); $cssid = ( $blog_id > "1" ) ? $cssid = "_id-".$blog_id : $cssid = null; 46 $directory = plugin_dir_path(__FILE__) . "hidden/bkk/*.css";39 $directory = WP_CONTENT_DIR."/my_custom_css/bkk/*.css"; 47 40 if (glob($directory) != false) 48 41 { … … 53 46 $filecount = 1; 54 47 } 55 $oldname = plugin_dir_path(__FILE__)."my_style".$cssid.".css";56 $newname = plugin_dir_path(__FILE__).'hidden/bkk/' . ( $filecount ++ ) . $cssid . '_' . filemtime($oldname) .'.css';48 $oldname = WP_CONTENT_DIR."/my_custom_css/my_style".$cssid.".css"; 49 $newname = WP_CONTENT_DIR.'/my_custom_css/bkk/' . ( $filecount ++ ) . $cssid . '_' . filemtime($oldname) .'.css'; 57 50 rename($oldname, $newname); 58 51 } … … 61 54 if(isset($_POST['viewbackup'])) 62 55 { 63 $directory = plugin_dir_path(__FILE__)."hidden/bkk/";56 $directory = WP_CONTENT_DIR."/my_custom_css/bkk/"; 64 57 $files=array(); 65 58 if ($dh=opendir($directory)) … … 73 66 krsort($files); 74 67 reset($files); 75 $href = plugin_dir_url(__FILE__)."hidden/bkk/";68 $href = WP_CONTENT_URL."/my_custom_css/bkk/"; 76 69 date_default_timezone_set(ini_get('date.timezone') ? ini_get('date.timezone') : 'UTC'); 77 70 … … 126 119 </head> 127 120 <body style=\"background: #F1F1F1; padding: 20px; width: 90%; margin: 20px auto; border: 1px 0 dotted gray\">"; 128 $glob = glob( plugin_dir_path(__FILE__)."hidden/bkk/*.css");121 $glob = glob(WP_CONTENT_DIR."/my_custom_css/bkk/*.css"); 129 122 if ($glob == false) 130 123 { … … 141 134 <input type=\"button\" value=\"Close now!\" onclick=\"self.close()\" style=\"margin: 0px 20px; float: right\" /> 142 135 <br />"; 143 foreach (glob( plugin_dir_path(__FILE__)."hidden/bkk/*.css") as $filename)136 foreach (glob(WP_CONTENT_DIR."/my_custom_css/bkk/*.css") as $filename) 144 137 { 145 138 echo " … … 158 151 { 159 152 $blog_id = get_current_blog_id(); $cssid = ( $blog_id > "1" ) ? $cssid = "_id-".$blog_id : $cssid = null; 160 $css_path = plugin_dir_path(__FILE__)."my_style".$cssid.".css";153 $css_path = WP_CONTENT_DIR."/my_custom_css/my_style".$cssid.".css"; 161 154 return $css_path; 162 155 } … … 165 158 { 166 159 $blog_id = get_current_blog_id(); $cssid = ( $blog_id > "1" ) ? $cssid = "_id-".$blog_id : $cssid = null; 167 $css_url = plugin_dir_url(__FILE__)."my_style".$cssid.".css";160 $css_url = WP_CONTENT_URL."/my_custom_css/my_style".$cssid.".css"; 168 161 return $css_url; 169 162 } … … 282 275 function mycustomcss_syntax() 283 276 { 284 $plugdir = plugin_dir_url(__FILE__);285 277 ?> 286 278 <!-- Syntax Support Start --> 287 <link type="text/css" rel="stylesheet" href="<?php echo $plugdir; ?>syntax/codemirror.css" />288 <script language="javascript" src="<?php echo $plugdir; ?>syntax/codemirror.js"></script>289 <script language="javascript" src="<?php echo $plugdir; ?>syntax/css.js"></script>279 <link type="text/css" rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__); ?>syntax/codemirror.css" /> 280 <script language="javascript" src="<?php echo plugin_dir_url(__FILE__); ?>syntax/codemirror.js"></script> 281 <script language="javascript" src="<?php echo plugin_dir_url(__FILE__); ?>syntax/css.js"></script> 290 282 <!-- Syntax Support End --> 291 283 <?php … … 308 300 $plugin_version = $plugin_data['Version']; 309 301 310 $glob = glob( plugin_dir_path(__FILE__)."hidden/bkk/*.css");302 $glob = glob(WP_CONTENT_DIR."/my_custom_css/bkk/*.css"); 311 303 if ($glob == false) 312 304 { -
my-custom-css/trunk/readme.txt
r1278941 r1278942 5 5 Requires at least: 3.0 6 6 Tested up to: 4.3.1 7 Stable tag: 2. 07 Stable tag: 2.1 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 = 2. 0=49 = 2.1 = 50 50 51 * Now use "$wp_filesystem->put_contents" and "wp_mkdir_p" instead of "file_put_contents" and "mkdir" (fix issue permission)... 51 * Now my_style.css and backup will be saved in content directory! (no more delete on upgrade)! 52 * More other change in code... 52 53 53 54 == Changelog == 55 56 = 2.1 = 57 58 * Now my_style.css and backup will be saved in content directory! (no more delete on upgrade)! 59 * More other change in code... 54 60 55 61 = 2.0 =
Note: See TracChangeset
for help on using the changeset viewer.