Changeset 2250336
- Timestamp:
- 02/26/2020 02:26:28 AM (6 years ago)
- Location:
- sudo-oauth
- Files:
-
- 17 added
- 3 edited
-
tags/sudo-oauth (added)
-
tags/sudo-oauth/SudoOauth.php (added)
-
tags/sudo-oauth/classes (added)
-
tags/sudo-oauth/classes/sudo-datetime.php (added)
-
tags/sudo-oauth/classes/sudo-rewrite.php (added)
-
tags/sudo-oauth/classes/sudo-walker.php (added)
-
tags/sudo-oauth/icon.png (added)
-
tags/sudo-oauth/includes (added)
-
tags/sudo-oauth/includes/admin.php (added)
-
tags/sudo-oauth/includes/data.php (added)
-
tags/sudo-oauth/includes/role.php (added)
-
tags/sudo-oauth/index.php (added)
-
tags/sudo-oauth/readme.txt (added)
-
tags/sudo-oauth/sudo-oauth.php (added)
-
trunk/includes/admin.php (modified) (5 diffs)
-
trunk/lib (added)
-
trunk/lib/main.js (added)
-
trunk/lib/style.css (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/sudo-oauth.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sudo-oauth/trunk/includes/admin.php
r1647028 r2250336 14 14 register_setting( 'sudooauth-settings-group', 'sudooauth_option_limitpost' ); 15 15 register_setting( 'sudooauth-settings-group', 'sudooauth_option_uploadfiles' ); 16 register_setting( 'sudooauth-settings-group', 'sudooauth_option_activeplugin' ); 17 register_setting( 'sudooauth-settings-group', 'sudooauth_option_link_number' ); 18 register_setting( 'sudooauth-settings-group', 'sudooauth_option_nofolow_number' ); 16 19 } 17 20 … … 19 22 ?> 20 23 <div class="wrap"> 21 <h2> Thông tin client kết nối với ID</h2>22 <p> Nhập thông tin được thống nhất và cấp bởi ID</p>24 <h2><?php _e('Thông tin client kết nối với ID'); ?></h2> 25 <p><?php _e('Nhập thông tin được thống nhất và cấp bởi ID'); ?></p> 23 26 <?php if( isset($_GET['settings-updated']) ) { ?> 24 27 <div id="message" class="updated"> … … 30 33 <table class="form-table"> 31 34 <tr> 32 <th scope="row"><label for="sudooauth_option_name"> Client name</label></th>35 <th scope="row"><label for="sudooauth_option_name"><?php _e('Client name'); ?></label></th> 33 36 <td><input type="text" id="sudooauth_option_name" name="sudooauth_option_name" value="<?php echo get_option('sudooauth_option_name');?>" class="regular-text"/></td> 34 37 </tr> 35 38 <tr> 36 <th scope="row"><label for="sudooauth_option_pwd"> Client key</label></th>39 <th scope="row"><label for="sudooauth_option_pwd"><?php _e('Client key'); ?></label></th> 37 40 <td><input type="text" id="sudooauth_option_pwd" name="sudooauth_option_pwd" value="<?php echo get_option('sudooauth_option_pwd');?>" class="regular-text"/></td> 38 41 </tr> 39 42 <tr> 40 <th scope="row"><label for="sudooauth_option_host"> Host</label></th>43 <th scope="row"><label for="sudooauth_option_host"><?php _e('Host'); ?></label></th> 41 44 <td><input type="text" id="sudooauth_option_host" name="sudooauth_option_host" value="<?php echo get_option('sudooauth_option_host') != '' ? get_option('sudooauth_option_host') : 'http://id.sudo.vn';?>" class="regular-text"/></td> 42 45 </tr> 43 46 <tr> 44 <th scope="row"><label for="sudooauth_option_uploadfiles"> Cho phép thành viên từ hệ thống upload ảnh</label></th>47 <th scope="row"><label for="sudooauth_option_uploadfiles"><?php _e('Cho phép thành viên từ hệ thống upload ảnh'); ?></label></th> 45 48 <td> 46 <input type="checkbox" id="sudooauth_option_uploadfiles" name="sudooauth_option_uploadfiles" value="1"<?php echo get_option('sudooauth_option_uploadfiles') == '1' ? ' checked="checked"' : ''; ?> /> Tick để cho phép49 <input type="checkbox" id="sudooauth_option_uploadfiles" name="sudooauth_option_uploadfiles" value="1"<?php echo get_option('sudooauth_option_uploadfiles') == '1' ? ' checked="checked"' : ''; ?> /> <?php _e('Tick để cho phép'); ?> 47 50 </td> 48 51 </tr> 49 52 <tr> 50 <th scope="row"><label for="sudooauth_option_limitpost">Tài khoản kết nối được đăng bao nhiêu bài một ngày</label></th> 51 <td><input type="number" min="1" max="20" id="sudooauth_option_limitpost" name="sudooauth_option_limitpost" value="<?php echo get_option('sudooauth_option_limitpost') != '' ? get_option('sudooauth_option_limitpost') : '1'; ?>" /></td> 53 <th scope="row"><label for="sudooauth_option_limitpost"><?php _e('Tài khoản kết nối được đăng bao nhiêu bài một ngày'); ?></label></th> 54 <td> 55 <div class="number-input"> 56 <span class="sub-number">-</span> 57 <input type="text" min="1" max="20" id="sudooauth_option_limitpost" name="sudooauth_option_limitpost" value="<?php echo get_option('sudooauth_option_limitpost') != '' ? get_option('sudooauth_option_limitpost') : '1'; ?>" /> 58 <span class="add-number">+</span> 59 </td> 52 60 </tr> 53 61 <tr> 54 <th scope="row"><label for="sudooauth_option_multicat"> Chọn danh mục tài khoản kết nối được phép post bài</label></th>62 <th scope="row"><label for="sudooauth_option_multicat"><?php _e('Chọn danh mục tài khoản kết nối được phép post bài'); ?></label></th> 55 63 <td> 56 64 <?php … … 64 72 <div id="side-sortables" class="metabox-holder" style="float:left; padding:5px;"> 65 73 <div class="postbox"> 66 <h3 class="hndle"><span> Giới hạn đa danh mục</span></h3>74 <h3 class="hndle"><span><?php _e('Giới hạn đa danh mục'); ?></span></h3> 67 75 68 76 <div class="inside" style="padding:0 10px;"> … … 89 97 </td> 90 98 </tr> 99 <tr> 100 <th scope="row"><label for="sudooauth_option_link_number"><?php _e('Số lượng link tối đa cho tài khoản liên kết viết bài sử dụng'); ?></label></th> 101 <td> 102 <div class="number-input"> 103 <span class="sub-number">-</span> 104 <input type="text" min="1" id="sudooauth_option_link_number" name="sudooauth_option_link_number" value="<?php echo get_option('sudooauth_option_link_number') != '' ? get_option('sudooauth_option_link_number') : '5'; ?>" /> 105 <span class="add-number">+</span> 106 </td> 107 </tr> 108 <tr> 109 <th scope="row"><label for="sudooauth_option_nofolow_number"><?php _e('Số lượng link tối đa sử dụng nofollow'); ?></label></th> 110 <td> 111 <div class="number-input"> 112 <span class="sub-number">-</span> 113 <input type="text" min="1" id="sudooauth_option_nofolow_number" name="sudooauth_option_nofolow_number" value="<?php echo get_option('sudooauth_option_nofolow_number') != '' ? get_option('sudooauth_option_nofolow_number') : '2'; ?>" /> 114 <span class="add-number">+</span> 115 </div> 116 </td> 117 </tr> 118 <tr> 119 <th scope="row"><label for="sudooauth_option_activeplugin"><?php _e('Bật tắt plugin'); ?></label></th> 120 <td> 121 <div class="input-active"> 122 <input type="radio" id="sudooauth_option_activeplugin" name="sudooauth_option_activeplugin" value="1"<?php echo get_option('sudooauth_option_activeplugin') == '1' ? ' checked="checked"' : ''; ?> /> <?php _e('Tick để tắt plugin'); ?> 123 <input type="radio" id="sudooauth_option_activeplugin_off" name="sudooauth_option_activeplugin" value="2"<?php echo get_option('sudooauth_option_activeplugin') == '2' ? ' checked="checked"' : ''; ?> /> 124 <?php _e('Tick để bật plugin'); ?> 125 </div> 126 <div class="check-plugin"> 127 <label for="sudooauth_option_activeplugin" class="<?php echo get_option('sudooauth_option_activeplugin') == '1' ? 'active' : ''; ?>"><?php _e('Đang Bật '); ?></label> 128 <label for="sudooauth_option_activeplugin_off" class="<?php echo get_option('sudooauth_option_activeplugin') == '2' ? 'active' : ''; ?>"><?php _e('Đang Tắt'); ?></label> 129 </div> 130 </td> 131 </tr> 91 132 </table> 92 133 <?php submit_button(); ?> -
sudo-oauth/trunk/readme.txt
r1735908 r2250336 4 4 Donate link: http://nguyencaotu.com/donate 5 5 Requires at least: 4.5 6 Tested up to: 4.8.16 Tested up to: 5.3 7 7 Stable tag: trunk 8 8 … … 35 35 36 36 == Changelog == 37 38 = 2.0.5 = 39 Big update: 40 - Create new function open/close plugin 41 - Update random link follow - nofollow using admin setting 42 - Update Restrict backlink per post using admin setting 43 - Update Accept upload media option 44 - Update Show user info in bottom of post 45 - Update limit post per day / user login 46 - Update new style 37 47 38 48 = 2.0.4 = -
sudo-oauth/trunk/sudo-oauth.php
r1735908 r2250336 5 5 * Description: Plugin support to connect to ID Sudo system - a management account system. If you want to build a management account system for SEO, Manager staff please contact me. 6 6 * Author: caotu 7 * Version: 2.0. 47 * Version: 2.0.5 8 8 * Author URI: http://sudo.vn 9 9 */ … … 115 115 function sudooauth_set_backlink( $data ) { 116 116 $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; 117 $link_number = get_option('sudooauth_option_link_number',1); 118 $nofollow_number = get_option('sudooauth_option_nofolow_number',1); 117 119 if(preg_match_all("/$regexp/siU", $data['post_content'], $matches, PREG_SET_ORDER)) { 118 120 /* … … 128 130 return $data; 129 131 } 130 //Restrict 5backlink131 if($total_link > 5) {132 //Restrict $link_number backlink 133 if($total_link > $link_number) { 132 134 foreach($matches as $key=>$value) { 133 if($key >= 5) {135 if($key >= $link_number) { 134 136 $data['post_content'] = str_replace($value[0],$value[3],$data['post_content']); 135 137 unset($matches[$key]); … … 151 153 } 152 154 153 if(($hrefs->length == 5 && $fil_nfl != 2) || ($hrefs->length == 4 && $fil_nfl != 1) || ($hrefs->length == 3 && $fil_nfl != 1)) { 155 // if(($hrefs->length == 5 && $fil_nfl != 2) || ($hrefs->length == 4 && $fil_nfl != 1) || ($hrefs->length == 3 && $fil_nfl != 1)) { 156 // return $hrefs->length; 157 if(($hrefs->length <= $link_number && $fil_nfl != $nofollow_number)) { 154 158 //Remove all rel 155 159 $data['post_content'] = preg_replace('/(<[^>]+) rel=".*?"/i', '$1', $data['post_content']); 156 160 157 161 //Random and add rel nofollow 158 $slot1 = rand(0,3);159 $slot2 = rand($slot1,4);162 // $slot1 = rand(0,3); 163 // $slot2 = rand($slot1,4); 160 164 foreach($matches as $key=>$value) { 161 if($key == $slot1 || $key == $slot2) {165 if($key < $nofollow_number) { 162 166 $nfl_add = str_replace('href', 'rel="nofollow" href',$value[0]); 163 167 $data['post_content'] = str_replace($value[0],$nfl_add,$data['post_content']); … … 206 210 return $content; 207 211 } 212 213 // decative or active plugin 214 function deactivate_plugin_conditional() { 215 $active_plugin = get_option('sudooauth_option_activeplugin',1); 216 if(empty($active_plugin)) update_option( 'sudooauth_option_activeplugin', 2 ); 217 if($active_plugin == 1 ){ 218 if(current_user_can('sudooauth_author')): 219 global $pagenow; 220 /* Check current admin page. */ 221 if($pagenow == 'post-new.php'){ 222 wp_logout(); 223 echo '<meta http-equiv="Content-Type" content="text/html"; charset="utf-8">'; 224 echo "<center>"; 225 echo '<br /><br />Sudo Oauth hiện đang ngừng sử dụng với website này.<br /><br />Hệ thống tự động trở về trang chủ sau 5 giây!</a>'; 226 echo "</center>"; 227 header( "refresh:5;url='".home_url()."'" ); 228 exit(); 229 } 230 endif; 231 } 232 233 } 234 add_action( 'admin_init', 'deactivate_plugin_conditional' ); 235 236 function add_stylesheet_plugin_to_admin() { 237 wp_enqueue_style( 'sudo-style', plugin_dir_url( __FILE__ ). 'lib/style.css' ); 238 } 239 add_action( 'admin_enqueue_scripts', 'add_stylesheet_plugin_to_admin' ); 240 241 function add_jquery_plugin_to_admin() { 242 wp_enqueue_script( 'sudo-scripts', plugin_dir_url( __FILE__ ). 'lib/main.js' ); 243 } 244 add_action( 'admin_enqueue_scripts', 'add_jquery_plugin_to_admin' );
Note: See TracChangeset
for help on using the changeset viewer.