Changeset 194466
- Timestamp:
- 01/16/2010 04:05:51 PM (16 years ago)
- Location:
- hidepost
- Files:
-
- 13 added
- 3 edited
-
tags/2.3.8 (added)
-
tags/2.3.8/hidepost.php (added)
-
tags/2.3.8/option_init.php (added)
-
tags/2.3.8/options.php (added)
-
tags/2.3.8/readme.txt (added)
-
tags/2.3.8/tinymce (added)
-
tags/2.3.8/tinymce/plugins (added)
-
tags/2.3.8/tinymce/plugins/hidepost (added)
-
tags/2.3.8/tinymce/plugins/hidepost/editor_plugin.js (added)
-
tags/2.3.8/tinymce/plugins/hidepost/img (added)
-
tags/2.3.8/tinymce/plugins/hidepost/img/hidepost.gif (added)
-
tags/2.3.8/tinymce/plugins/hidepost/langs (added)
-
tags/2.3.8/tinymce/plugins/hidepost/langs/en.js (added)
-
trunk/hidepost.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/tinymce/plugins/hidepost/editor_plugin.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
hidepost/trunk/hidepost.php
r118934 r194466 4 4 Plugin URI: http://nguyenthanhcong.com/hidepost-plugin-for-wordpress/ 5 5 Description: Protect a part of your post by using [hidepost] and [/hidepost] between the protected content. 6 Version: 2.3. 76 Version: 2.3.8 7 7 Author: Fu4ny 8 8 Author URI: http://nguyenthanhcong.com … … 39 39 } 40 40 41 function hidepost_text_content() { 42 global $hidepost_content_text, $hidepost_content_text_hide; 43 if ($hidepost_content_text_hide != 1) return $hidepost_content_text; 44 else return ''; 45 } 46 47 function hidepost_role_text($hidepost_max_level) { 48 global $hidepost_role_text, $hidepost_role_text_hide; 49 switch ($hidepost_max_level): 50 case 0: $show = 'Subscriber'; 51 break; 52 case 1: $show = 'Contributor'; 53 break; 54 case 2: $show = 'Author'; 55 break; 56 case 3: 57 case 4: 58 case 5: 59 case 6: 60 case 7: $show = 'Editor'; 61 break; 62 case 8: 63 case 9: $show = 'Administrator'; 64 break; 65 endswitch; 66 $hidepost_role_text = str_replace('%role%',$show,$hidepost_role_text); 67 if ($hidepost_role_text_hide != 1) return $hidepost_role_text; 68 else return ''; 69 } 70 71 if(!function_exists('hidethis')) { 72 73 function hidethis( $content, $level=0,$display = true ) { 74 global $current_user, $user_ID, $user_level; 75 get_currentuserinfo(); 76 if ($user_ID == '') {//If not logged in 77 if ( $display ) { echo hidepost_text_content(); } 78 else return hidepost_text_content(); 79 } else if ($user_level < $level){ //Not meet the require level 80 if ( $display ) { echo hidepost_role_text($level); } 81 else return hidepost_role_text($level); 82 } else { 83 if ( $display ) { echo $content; } 84 else return $content; 85 } 86 } 87 88 } 89 41 90 function hidepost_replace_hide($content) { 42 global $current_user, $user_ID, $hidepost_content_text,$user_level, $m_id, $hidepost_role_text, $hidepost_role_text_hide, $hidepost_content_text_hide;91 global $current_user, $user_ID,$user_level, $m_id; 43 92 $m_id++; 44 93 preg_match_all('#\[hidepost(.*?)\](.*?)\[/hidepost\]#sie', $content, $matches);//Find the hidepost tag … … 58 107 get_currentuserinfo(); 59 108 if ($user_ID == ''){//If not logged in 60 if ($hidepost_content_text_hide != 1) return $hidepost_content_text; 61 else return ''; 109 return hidepost_text_content(); 62 110 } 63 111 if ($user_level < $hidepost_max_level) {//Not meet the require level 64 switch ($hidepost_max_level): 65 case 0: $show = 'Subscriber'; 66 break; 67 case 1: $show = 'Contributor'; 68 break; 69 case 2: $show = 'Author'; 70 break; 71 case 3: 72 case 4: 73 case 5: 74 case 6: 75 case 7: $show = 'Editor'; 76 break; 77 case 8: 78 case 9: $show = 'Administrator'; 79 break; 80 endswitch; 81 $hidepost_role_text = str_replace('%role%',$show,$hidepost_role_text); 82 if ($hidepost_role_text_hide != 1) return $hidepost_role_text; else return ''; 112 return hidepost_role_text($hidepost_max_level); 83 113 } 84 114 return $matches[2][$m_id]; //Return the content if user can see … … 90 120 preg_match_all('#\<a(.*?)\>(.*?)\</a\>#sie', $content, $matches); //Find all the link 91 121 get_currentuserinfo(); 122 if ( strpos($matches[0][$m_id],"class=\"more-link\"") != false ) {//Hacked 123 return $matches[0][$m_id]; 124 } 92 125 if ($user_ID == ''){//If not logged in 93 126 if ($hidepost_link_text_hide != 1) return $hidepost_link_text; else return ''; … … 110 143 return $content; 111 144 } 145 146 112 147 113 148 //Add the Option Page … … 165 200 add_action('admin_menu', 'hidepost_options'); 166 201 add_filter('the_content', 'hidepost_filter_post'); 167 add_filter('the_exceprt', 'hidepost_filter_post'); 202 add_filter('the_excerpt', 'hidepost_filter_post'); 203 add_filter('the_excerpt_rss', 'hidepost_filter_post'); 168 204 169 205 //Function: Add Quick Tag For HidePost In TinyMCE >= WordPress 2.5 … … 191 227 function hidepost_quicktag_footer(){ 192 228 echo '<script type="text/javascript">'."\n"; 229 echo "\t".'function insertLevel() {'."\n"; 230 echo "\t".'var hidepost_level = prompt(" Enter the lowest user level that can read the content ( default is 0 )","0");'."\n"; 231 echo "\t".'return hidepost_level;'."\n"; 232 echo "\t".'}'."\n"; 193 233 echo "\t".'function insertHidepost_qt( myField ) {'."\n"; 194 234 echo "\t\t".'var hidepost_startPos = myField.selectionStart;'."\n"; -
hidepost/trunk/readme.txt
r167874 r194466 1 1 === HidePost === 2 2 Contributors: Funnnny 3 Tags: protect, hidepost, post , restrict, restriction3 Tags: protect, hidepost, post 4 4 Requires at least: 1.5 5 Tested up to: 2.9 6 Stable tag: 2.3.7 7 Donate link: http://nguyenthanhcong.com/donations/ 5 Tested up to: 2.8 6 Stable tag: 2.3.8 8 7 9 8 Protect your post or your link by using [hidepost] and [/hidepost] between the protected content. … … 20 19 2. Activate it 21 20 3. Go to Option -> Hidepost and check "Enable HidePost" 22 4. Use [hidepost] tag to protect the content 21 4.1 Use [hidepost=level] tag to protect the content 22 4.2 Or put the function <?php hidethis($string,$level); ?> in the template 23 23 24 24 = Upgrade = … … 133 133 134 134 =2.3.6 (11/02/2009)= 135 135 136 Fixed error with exceprt and wrong user level. 137 136 138 Some changes in option page 137 139 138 140 =2.3.7 (19/05/2009)= 141 139 142 Add quick button to add Hidepost's tag in TinyMCE editor 143 144 =2.3.8 (16/01/2010)= 145 146 Fixed bug with RSS and Readmore link 147 148 Added a template call -
hidepost/trunk/tinymce/plugins/hidepost/editor_plugin.js
r118934 r194466 36 36 } 37 37 38 function insertLevel() {39 var hidepost_level = prompt(" Enter the lowest user level that can read the content ( default is 0 )","0");40 return hidepost_level;41 }42 43 38 //returns the selected text from the editor 44 39 function TinyMCE_getSelectedText(){
Note: See TracChangeset
for help on using the changeset viewer.