Changeset 331831
- Timestamp:
- 01/12/2011 06:10:52 PM (15 years ago)
- Location:
- graceful-sidebar-plugin
- Files:
-
- 4 edited
- 1 copied
-
tags/1.0.10 (copied) (copied from graceful-sidebar-plugin/trunk)
-
tags/1.0.10/graceful_sidebar.php (modified) (5 diffs)
-
tags/1.0.10/readme.txt (modified) (3 diffs)
-
trunk/graceful_sidebar.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
graceful-sidebar-plugin/tags/1.0.10/graceful_sidebar.php
r328418 r331831 5 5 Tags: custom sidebar, pages sidebar, custom sidebar 6 6 Description: Creates a custom sidebar widget to display a custom field from a page. Create a page or post, enable the widget in your sidebar and add content. Create custom fields called graceful_title and graceful_content. <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KKFYUAMPCQHXQ">Donate</a> 7 Version: 1.0. 87 Version: 1.0.10 8 8 Author: Michael Lynn 9 9 Author URI: http://www.mlynn.org/ … … 13 13 add_action("admin_init", "gs_widget_admininit"); 14 14 add_action('save_post','gs_save_meta'); 15 register_activation_hook( __FILE__, 'gs_activation' );16 15 17 function gs_activation() { 18 19 } 20 21 function gs_save_meta(){ 16 function gs_save_meta($post_id){ 22 17 global $post; 23 18 // Clean up legacy 24 $custom = get_post_custom($post->ID);25 $graceful_title_legacy = $custom["graceful_title"][0];26 $graceful_content_legacy = $custom["graceful_content"][0];27 // version 1.07 hides graceful variables from custom fields28 19 29 if ($graceful_title_legacy!='') { 30 // this means we have a legacy custom field - need to move it to the new '_graceful' field to hide it from custom fields 31 delete_post_meta($post->ID, "graceful_title"); 32 } 20 if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { 21 return $post_id; 22 } 33 23 34 if ($graceful_content_legacy!='') { 35 // this means we have a legacy custom field - need to move it to the new '_graceful' field to hide it from custom fields 36 delete_post_meta($post->ID, "graceful_content"); 37 } 38 update_post_meta($post->ID, "_graceful_title", $_POST["_graceful_title"]); 39 update_post_meta($post->ID, "_graceful_content", $_POST["_graceful_content"]); 24 if ('page' == $_POST['post_type']) { 25 if (!current_user_can('edit_page', $post_id)) { 26 return $post_id; 27 } 28 } elseif (!current_user_can('edit_post', $post_id)) { 29 return $post_id; 30 } 31 32 $title_current= get_post_meta($post_id,'_graceful_title',true); 33 $content_current= get_post_meta($post_id,'_graceful_content',true); 34 35 $title_new = $_POST['graceful_title']; 36 $content_new = $_POST['graceful_content']; 37 if ($title_new != $title_current) { 38 update_post_meta($post_id, "_graceful_title", $title_new); 39 } 40 if ($content_new != $content_current) { 41 update_post_meta($post_id, "_graceful_content", $content_new); 42 } 40 43 } 41 44 42 45 function gs_widget_init() { 43 46 44 register_sidebar_widget('Graceful Sidebar Widget', 'gs_widget');45 register_widget_control('Graceful Sidebar Widget', 'gs_widget_control', '500', '500');47 wp_register_sidebar_widget('graceful_sidebar','Graceful Sidebar Widget', 'gs_widget',''); 48 wp_register_widget_control('graceful_sidebar','Graceful Sidebar Widget', 'gs_widget_control', '500', '500'); 46 49 47 50 } … … 55 58 56 59 function gs_meta() { 57 global $post;60 global $post; 58 61 59 $custom = get_post_custom($post->ID); 60 $graceful_title_legacy = $custom["graceful_title"][0]; 61 $graceful_content_legacy = $custom["graceful_content"][0]; 62 // version 1.07 hides graceful variables from custom fields 63 $graceful_title = $custom["_graceful_title"][0]; 64 $graceful_content = $custom["_graceful_content"][0]; 62 $title_current= get_post_meta($post->ID,'_graceful_title',true); 63 $content_current= get_post_meta($post->ID,'_graceful_content',true); 64 65 $title_legacy= get_post_meta($post->ID,'graceful_title',true); 66 $content_legacy= get_post_meta($post->ID,'graceful_content',true); 65 67 66 68 // Clean up legacy 67 if ($ graceful_title_legacy!='' && $graceful_title=='') {69 if ($title_legacy!='' && $title_current=='') { 68 70 // this means we have a legacy custom field - need to move it to the new '_graceful' field to hide it from custom fields 69 70 update_post_meta($post->ID, "_graceful_title", $graceful_title_legacy); 71 update_post_meta($post->ID, "_graceful_title", $title_legacy); 71 72 delete_post_meta($post->ID, "graceful_title"); 72 $graceful_title = $graceful_title_legacy; 73 $title = $title_legacy; 74 } else { 75 $title = $title_current; 73 76 } 74 if ($ graceful_content_legacy!='' && $graceful_content=='') {77 if ($content_legacy!='' && $content=='') { 75 78 // this means we have a legacy custom field - need to move it to the new '_graceful' field to hide it from custom fields 76 77 update_post_meta($post->ID, "_graceful_content", $graceful_content_legacy); 79 update_post_meta($post->ID, "_graceful_content", $content_legacy); 78 80 delete_post_meta($post->ID, "graceful_content"); 79 $graceful_content = $graceful_content_legacy; 81 $graceful_content = $content_legacy; 82 } else { 83 $content = $content_current; 80 84 } 81 85 … … 83 87 <p>This content will be displayed in the sidebar for this post or page - ONLY for this post or page. Be certain that you enable the Graceful Sidebar Widget by dragging it to a sidebar area in your theme from the Appearances->Widgets administration panel. <a href=http://www.mlynn.org/graceful-sidebar-plugin>More Information</a><p> 84 88 <table class='widefat settings post'> 85 <thead> 86 <tr> 87 <th>Graceful Sidebar Title</th> 88 <th>Graceful Sidebar Content</th> 89 </tr> 90 </thead> 91 <tbody> 92 <tr> 93 <td><input name='_graceful_title' type=text size=40 value='<?php echo $graceful_title;?>'></td> 94 <td><div id=editorcontainer><textarea id="content" name='_graceful_content' rows=8 cols=90><?php echo $graceful_content;?></textarea></div></td> 95 </tr> 89 <tr> 90 <thead> 91 <th valign=top><b>Graceful Sidebar Title:</b></th> 92 </thead> 93 <tbody> 94 <td><input name='graceful_title' type=text size=80 value='<?php echo $title;?>'></td> 95 </tbody> 96 </tr> 97 <tr> 98 <thead> 99 <th valign=top><b>Graceful Sidebar Content:</b></th> 100 </thead> 101 <tbody> 102 <td><div id=editorcontainer><textarea id="content" name='graceful_content' rows=8 cols=90><?php echo $content;?></textarea></div></td> 103 </tbody> 104 </tr> 96 105 </tbody> 97 106 </table> … … 109 118 110 119 global $post; 120 121 $title= get_post_meta($post->ID,'_graceful_title',true); 122 $content= get_post_meta($post->ID,'_graceful_content',true); 123 111 124 if (is_single() || is_page()) { 112 125 extract($args); 113 126 $gs_widget_options = unserialize(get_option('gs_widget_options')); 114 127 115 $title_legacy = get_post_meta($post->ID, 'graceful_title', true);116 $content_legacy = get_post_meta($post->ID, 'graceful_content', true);117 118 $title = get_post_meta($post->ID, '_graceful_title', true);119 $content = get_post_meta($post->ID, '_graceful_content', true);120 121 122 $custom = get_post_custom($post->ID);123 124 $graceful_title_legacy = $custom["graceful_title"][0];125 $graceful_content_legacy = $custom["graceful_content"][0];126 $graceful_title = $custom["_graceful_title"][0];127 $graceful_content = $custom["_graceful_content"][0];128 129 if ($title_legacy!='' && $title == '') {130 // still have legacy custom fields - move them to new fields with _'s to hide them from custom field display131 $title = $title_legacy;132 }133 if ($content_legacy!='' && $content == '') {134 // still have legacy custom fields - move them to new fields with _'s to hide them from custom field display135 $content = $content_legacy;136 }137 128 if ( $title || $content ) { 138 129 -
graceful-sidebar-plugin/tags/1.0.10/readme.txt
r326976 r331831 7 7 Requires at least: 2.8 8 8 Tested up to: 3.0.3 9 Stable tag: 1.0. 89 Stable tag: 1.0.10 10 10 11 11 Create custom sidebars for your posts or pages. … … 38 38 39 39 == Changelog == 40 41 = Version 1.0.10 = 42 * Found a bug related to post revisions 43 44 = Version 1.0.9 = 45 * Fixed intermittent failures in save 40 46 41 47 = Version 1.0.8 = … … 70 76 == Upgrade Notice == 71 77 78 = 1.0.10 = 79 * Back up your data! You will need to redrag the widget to your sidebar after upgrading and you may lose the sidebar content of your previous versions. 80 81 = 1.0.9 = 82 * Fixed Intermittent failures saving 83 72 84 = 1.0.8 = 73 85 * Bugfix in save routine - fixed. -
graceful-sidebar-plugin/trunk/graceful_sidebar.php
r328418 r331831 5 5 Tags: custom sidebar, pages sidebar, custom sidebar 6 6 Description: Creates a custom sidebar widget to display a custom field from a page. Create a page or post, enable the widget in your sidebar and add content. Create custom fields called graceful_title and graceful_content. <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KKFYUAMPCQHXQ">Donate</a> 7 Version: 1.0. 87 Version: 1.0.10 8 8 Author: Michael Lynn 9 9 Author URI: http://www.mlynn.org/ … … 13 13 add_action("admin_init", "gs_widget_admininit"); 14 14 add_action('save_post','gs_save_meta'); 15 register_activation_hook( __FILE__, 'gs_activation' );16 15 17 function gs_activation() { 18 19 } 20 21 function gs_save_meta(){ 16 function gs_save_meta($post_id){ 22 17 global $post; 23 18 // Clean up legacy 24 $custom = get_post_custom($post->ID);25 $graceful_title_legacy = $custom["graceful_title"][0];26 $graceful_content_legacy = $custom["graceful_content"][0];27 // version 1.07 hides graceful variables from custom fields28 19 29 if ($graceful_title_legacy!='') { 30 // this means we have a legacy custom field - need to move it to the new '_graceful' field to hide it from custom fields 31 delete_post_meta($post->ID, "graceful_title"); 32 } 20 if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { 21 return $post_id; 22 } 33 23 34 if ($graceful_content_legacy!='') { 35 // this means we have a legacy custom field - need to move it to the new '_graceful' field to hide it from custom fields 36 delete_post_meta($post->ID, "graceful_content"); 37 } 38 update_post_meta($post->ID, "_graceful_title", $_POST["_graceful_title"]); 39 update_post_meta($post->ID, "_graceful_content", $_POST["_graceful_content"]); 24 if ('page' == $_POST['post_type']) { 25 if (!current_user_can('edit_page', $post_id)) { 26 return $post_id; 27 } 28 } elseif (!current_user_can('edit_post', $post_id)) { 29 return $post_id; 30 } 31 32 $title_current= get_post_meta($post_id,'_graceful_title',true); 33 $content_current= get_post_meta($post_id,'_graceful_content',true); 34 35 $title_new = $_POST['graceful_title']; 36 $content_new = $_POST['graceful_content']; 37 if ($title_new != $title_current) { 38 update_post_meta($post_id, "_graceful_title", $title_new); 39 } 40 if ($content_new != $content_current) { 41 update_post_meta($post_id, "_graceful_content", $content_new); 42 } 40 43 } 41 44 42 45 function gs_widget_init() { 43 46 44 register_sidebar_widget('Graceful Sidebar Widget', 'gs_widget');45 register_widget_control('Graceful Sidebar Widget', 'gs_widget_control', '500', '500');47 wp_register_sidebar_widget('graceful_sidebar','Graceful Sidebar Widget', 'gs_widget',''); 48 wp_register_widget_control('graceful_sidebar','Graceful Sidebar Widget', 'gs_widget_control', '500', '500'); 46 49 47 50 } … … 55 58 56 59 function gs_meta() { 57 global $post;60 global $post; 58 61 59 $custom = get_post_custom($post->ID); 60 $graceful_title_legacy = $custom["graceful_title"][0]; 61 $graceful_content_legacy = $custom["graceful_content"][0]; 62 // version 1.07 hides graceful variables from custom fields 63 $graceful_title = $custom["_graceful_title"][0]; 64 $graceful_content = $custom["_graceful_content"][0]; 62 $title_current= get_post_meta($post->ID,'_graceful_title',true); 63 $content_current= get_post_meta($post->ID,'_graceful_content',true); 64 65 $title_legacy= get_post_meta($post->ID,'graceful_title',true); 66 $content_legacy= get_post_meta($post->ID,'graceful_content',true); 65 67 66 68 // Clean up legacy 67 if ($ graceful_title_legacy!='' && $graceful_title=='') {69 if ($title_legacy!='' && $title_current=='') { 68 70 // this means we have a legacy custom field - need to move it to the new '_graceful' field to hide it from custom fields 69 70 update_post_meta($post->ID, "_graceful_title", $graceful_title_legacy); 71 update_post_meta($post->ID, "_graceful_title", $title_legacy); 71 72 delete_post_meta($post->ID, "graceful_title"); 72 $graceful_title = $graceful_title_legacy; 73 $title = $title_legacy; 74 } else { 75 $title = $title_current; 73 76 } 74 if ($ graceful_content_legacy!='' && $graceful_content=='') {77 if ($content_legacy!='' && $content=='') { 75 78 // this means we have a legacy custom field - need to move it to the new '_graceful' field to hide it from custom fields 76 77 update_post_meta($post->ID, "_graceful_content", $graceful_content_legacy); 79 update_post_meta($post->ID, "_graceful_content", $content_legacy); 78 80 delete_post_meta($post->ID, "graceful_content"); 79 $graceful_content = $graceful_content_legacy; 81 $graceful_content = $content_legacy; 82 } else { 83 $content = $content_current; 80 84 } 81 85 … … 83 87 <p>This content will be displayed in the sidebar for this post or page - ONLY for this post or page. Be certain that you enable the Graceful Sidebar Widget by dragging it to a sidebar area in your theme from the Appearances->Widgets administration panel. <a href=http://www.mlynn.org/graceful-sidebar-plugin>More Information</a><p> 84 88 <table class='widefat settings post'> 85 <thead> 86 <tr> 87 <th>Graceful Sidebar Title</th> 88 <th>Graceful Sidebar Content</th> 89 </tr> 90 </thead> 91 <tbody> 92 <tr> 93 <td><input name='_graceful_title' type=text size=40 value='<?php echo $graceful_title;?>'></td> 94 <td><div id=editorcontainer><textarea id="content" name='_graceful_content' rows=8 cols=90><?php echo $graceful_content;?></textarea></div></td> 95 </tr> 89 <tr> 90 <thead> 91 <th valign=top><b>Graceful Sidebar Title:</b></th> 92 </thead> 93 <tbody> 94 <td><input name='graceful_title' type=text size=80 value='<?php echo $title;?>'></td> 95 </tbody> 96 </tr> 97 <tr> 98 <thead> 99 <th valign=top><b>Graceful Sidebar Content:</b></th> 100 </thead> 101 <tbody> 102 <td><div id=editorcontainer><textarea id="content" name='graceful_content' rows=8 cols=90><?php echo $content;?></textarea></div></td> 103 </tbody> 104 </tr> 96 105 </tbody> 97 106 </table> … … 109 118 110 119 global $post; 120 121 $title= get_post_meta($post->ID,'_graceful_title',true); 122 $content= get_post_meta($post->ID,'_graceful_content',true); 123 111 124 if (is_single() || is_page()) { 112 125 extract($args); 113 126 $gs_widget_options = unserialize(get_option('gs_widget_options')); 114 127 115 $title_legacy = get_post_meta($post->ID, 'graceful_title', true);116 $content_legacy = get_post_meta($post->ID, 'graceful_content', true);117 118 $title = get_post_meta($post->ID, '_graceful_title', true);119 $content = get_post_meta($post->ID, '_graceful_content', true);120 121 122 $custom = get_post_custom($post->ID);123 124 $graceful_title_legacy = $custom["graceful_title"][0];125 $graceful_content_legacy = $custom["graceful_content"][0];126 $graceful_title = $custom["_graceful_title"][0];127 $graceful_content = $custom["_graceful_content"][0];128 129 if ($title_legacy!='' && $title == '') {130 // still have legacy custom fields - move them to new fields with _'s to hide them from custom field display131 $title = $title_legacy;132 }133 if ($content_legacy!='' && $content == '') {134 // still have legacy custom fields - move them to new fields with _'s to hide them from custom field display135 $content = $content_legacy;136 }137 128 if ( $title || $content ) { 138 129 -
graceful-sidebar-plugin/trunk/readme.txt
r326976 r331831 7 7 Requires at least: 2.8 8 8 Tested up to: 3.0.3 9 Stable tag: 1.0. 89 Stable tag: 1.0.10 10 10 11 11 Create custom sidebars for your posts or pages. … … 38 38 39 39 == Changelog == 40 41 = Version 1.0.10 = 42 * Found a bug related to post revisions 43 44 = Version 1.0.9 = 45 * Fixed intermittent failures in save 40 46 41 47 = Version 1.0.8 = … … 70 76 == Upgrade Notice == 71 77 78 = 1.0.10 = 79 * Back up your data! You will need to redrag the widget to your sidebar after upgrading and you may lose the sidebar content of your previous versions. 80 81 = 1.0.9 = 82 * Fixed Intermittent failures saving 83 72 84 = 1.0.8 = 73 85 * Bugfix in save routine - fixed.
Note: See TracChangeset
for help on using the changeset viewer.