Changeset 222443
- Timestamp:
- 03/28/2010 02:31:41 PM (16 years ago)
- Location:
- easyjscss/trunk
- Files:
-
- 2 edited
-
easyjscss.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easyjscss/trunk/easyjscss.php
r135453 r222443 3 3 Plugin Name: Easy JS and CSS support. 4 4 Plugin URI: http://huuah.com/easyjscss 5 Version: 1. 35 Version: 1.4 6 6 Description: Adds the options to setup post/page specific javascript and css. 7 7 */ … … 16 16 $css = stripcslashes(get_post_meta($post->ID, 'easyjscss_css', true)); 17 17 $cssfile = stripcslashes(get_post_meta($post->ID, 'easyjscss_cssfile', true)); 18 if ($js == "") { 19 $js = stripcslashes(get_post_meta($post->ID, '_easyjscss_js', true)); 20 } 21 if ($jsfile == "") { 22 $jsfile = stripcslashes(get_post_meta($post->ID, '_easyjscss_jsfile', true)); 23 } 24 if ($css == "") { 25 $css = stripcslashes(get_post_meta($post->ID, '_easyjscss_css', true)); 26 } 27 if ($cssfile == "") { 28 $cssfile = stripcslashes(get_post_meta($post->ID, '_easyjscss_cssfile', true)); 29 } 18 30 } 19 31 if (trim($jsfile) != "") { … … 40 52 41 53 function easyjscss_meta_box_add() { 42 add_meta_box('easyjscss','Easy JS/CSS', array($this, 'easyjscss_meta'),'post'); 43 add_meta_box('easyjscss','Easy JS/CSS', array($this, 'easyjscss_meta'),'page'); 54 add_meta_box('_easyjscss','Easy JS/CSS', array($this, 'easyjscss_meta'),'post'); 55 add_meta_box('_easyjscss','Easy JS/CSS', array($this, 'easyjscss_meta'),'page'); 56 } 57 58 function convert_old($post_id, $name) { 59 $_temp = get_post_meta($post_id, $name, true); 60 delete_post_meta($post_id, $name); 61 delete_post_meta($post_id,'_'.$name); 62 add_post_meta($post_id, '_'.$name, $_temp); 44 63 } 45 64 46 65 function easyjscss_meta() { 47 66 global $post; 48 $js = stripcslashes(get_post_meta($post->ID, 'easyjscss_js', true)); 49 $jsfile = stripcslashes(get_post_meta($post->ID, 'easyjscss_jsfile', true)); 50 $css = stripcslashes(get_post_meta($post->ID, 'easyjscss_css', true)); 51 $cssfile = stripcslashes(get_post_meta($post->ID, 'easyjscss_cssfile', true)); 67 68 if ( get_post_meta($post->ID, 'easyjscss_js', true) || get_post_meta($post->ID, 'easyjscss_jsfile', true) || get_post_meta($post->ID, 'easyjscss_css', true) || get_post_meta($post->ID, 'easyjscss_cssfile', true) ) { 69 $this->convert_old($post->ID, "easyjscss_js"); 70 $this->convert_old($post->ID, "easyjscss_jsfile"); 71 $this->convert_old($post->ID, "easyjscss_css"); 72 $this->convert_old($post->ID, "easyjscss_cssfile"); 73 } 74 75 $js = stripcslashes(get_post_meta($post->ID, '_easyjscss_js', true)); 76 $jsfile = stripcslashes(get_post_meta($post->ID, '_easyjscss_jsfile', true)); 77 $css = stripcslashes(get_post_meta($post->ID, '_easyjscss_css', true)); 78 $cssfile = stripcslashes(get_post_meta($post->ID, '_easyjscss_cssfile', true)); 52 79 echo "Javascript include. (insert 1 file pr line, that should be included in the head-tag):<br>"; 53 80 echo "<textarea style=\"width: 90%; height: 50px;\" name=\"easyjscss_jsfile\">$jsfile</textarea><br>"; … … 61 88 62 89 function update_tags($id) { 63 $js = $_POST["easyjscss_js"]; 64 $jsfile = $_POST["easyjscss_jsfile"]; 65 $css = $_POST["easyjscss_css"]; 66 $cssfile = $_POST["easyjscss_cssfile"]; 67 delete_post_meta($id, 'easyjscss_js'); 68 delete_post_meta($id, 'easyjscss_jsfile'); 69 delete_post_meta($id, 'easyjscss_css'); 70 delete_post_meta($id, 'easyjscss_cssfile'); 71 add_post_meta($id, 'easyjscss_js', $js); 72 add_post_meta($id, 'easyjscss_jsfile', $jsfile); 73 add_post_meta($id, 'easyjscss_css', $css); 74 add_post_meta($id, 'easyjscss_cssfile', $cssfile); 90 if (isset($_POST["easyjscss_js"])) { 91 $js = $_POST["easyjscss_js"]; 92 $jsfile = $_POST["easyjscss_jsfile"]; 93 $css = $_POST["easyjscss_css"]; 94 $cssfile = $_POST["easyjscss_cssfile"]; 95 delete_post_meta($id, '_easyjscss_js'); 96 delete_post_meta($id, '_easyjscss_jsfile'); 97 delete_post_meta($id, '_easyjscss_css'); 98 delete_post_meta($id, '_easyjscss_cssfile'); 99 add_post_meta($id, '_easyjscss_js', $js); 100 add_post_meta($id, '_easyjscss_jsfile', $jsfile); 101 add_post_meta($id, '_easyjscss_css', $css); 102 add_post_meta($id, '_easyjscss_cssfile', $cssfile); 103 } 75 104 } 76 105 … … 81 110 add_action('admin_menu', array($easyjscss, 'easyjscss_meta_box_add')); 82 111 add_action('wp_head', array($easyjscss, 'add_content_to_header'), 15); 83 add_action('edit_post', array($easyjscss, 'update_tags' ));112 add_action('edit_post', array($easyjscss, 'update_tags',),5); 84 113 85 114 ?> -
easyjscss/trunk/readme.txt
r175872 r222443 3 3 Tags: easy, css, js, stylesheet, javascript 4 4 Requires at least: 2.8.0 5 Tested up to: 2. 8.66 Stable tag: 1. 35 Tested up to: 2.9.2 6 Stable tag: 1.4 7 7 8 8 Adds the options to insert page/post specific javascript and css. … … 33 33 * First stable upload 34 34 35 36 37 35 = 1.4 = 36 * Bugfix: fields got remove on comment update. 37 * Meta-fields are now prefixed with _ to make them hidden.
Note: See TracChangeset
for help on using the changeset viewer.