Plugin Directory

Changeset 2250336


Ignore:
Timestamp:
02/26/2020 02:26:28 AM (6 years ago)
Author:
caotu
Message:

update new version

Location:
sudo-oauth
Files:
17 added
3 edited

Legend:

Unmodified
Added
Removed
  • sudo-oauth/trunk/includes/admin.php

    r1647028 r2250336  
    1414    register_setting( 'sudooauth-settings-group', 'sudooauth_option_limitpost' );
    1515    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' );
    1619}
    1720
     
    1922?>
    2023<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>
    2326<?php if( isset($_GET['settings-updated']) ) { ?>
    2427    <div id="message" class="updated">
     
    3033    <table class="form-table">
    3134        <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>
    3336            <td><input type="text" id="sudooauth_option_name" name="sudooauth_option_name" value="<?php echo get_option('sudooauth_option_name');?>" class="regular-text"/></td>
    3437        </tr>
    3538        <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>
    3740            <td><input type="text" id="sudooauth_option_pwd" name="sudooauth_option_pwd" value="<?php echo get_option('sudooauth_option_pwd');?>" class="regular-text"/></td>
    3841        </tr>
    3942        <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>
    4144            <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>
    4245        </tr>
    4346        <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>
    4548            <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ép
     49                <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'); ?>
    4750            </td>
    4851        </tr>
    4952        <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>
    5260        </tr>
    5361        <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>
    5563             <td>
    5664             <?php
     
    6472                <div id="side-sortables" class="metabox-holder" style="float:left; padding:5px;">
    6573                    <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>
    6775       
    6876                    <div class="inside" style="padding:0 10px;">
     
    8997             </td>
    9098        </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>
    91132    </table>
    92133    <?php submit_button(); ?>
  • sudo-oauth/trunk/readme.txt

    r1735908 r2250336  
    44Donate link: http://nguyencaotu.com/donate
    55Requires at least: 4.5
    6 Tested up to: 4.8.1
     6Tested up to: 5.3
    77Stable tag: trunk
    88
     
    3535
    3636== Changelog ==
     37
     38= 2.0.5 =
     39Big 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
    3747
    3848= 2.0.4 =
  • sudo-oauth/trunk/sudo-oauth.php

    r1735908 r2250336  
    55 * 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.
    66 * Author: caotu
    7  * Version: 2.0.4
     7 * Version: 2.0.5
    88 * Author URI: http://sudo.vn
    99*/
     
    115115function sudooauth_set_backlink( $data ) {   
    116116    $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);
    117119    if(preg_match_all("/$regexp/siU", $data['post_content'], $matches, PREG_SET_ORDER)) {
    118120        /*
     
    128130            return $data;
    129131        }
    130         //Restrict 5 backlink
    131         if($total_link > 5) {
     132        //Restrict $link_number backlink
     133        if($total_link > $link_number) {
    132134            foreach($matches as $key=>$value) {
    133                 if($key >= 5) {
     135                if($key >= $link_number) {
    134136                    $data['post_content'] = str_replace($value[0],$value[3],$data['post_content']);
    135137                    unset($matches[$key]);
     
    151153        }
    152154       
    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)) {
    154158            //Remove all rel
    155159            $data['post_content'] = preg_replace('/(<[^>]+) rel=".*?"/i', '$1', $data['post_content']);
    156160           
    157161            //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);
    160164            foreach($matches as $key=>$value) {
    161                 if($key == $slot1 || $key == $slot2) {
     165                if($key < $nofollow_number) {
    162166                    $nfl_add = str_replace('href', 'rel="nofollow" href',$value[0]);
    163167                    $data['post_content'] = str_replace($value[0],$nfl_add,$data['post_content']);
     
    206210    return $content;
    207211}
     212
     213// decative or active plugin
     214function 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}
     234add_action( 'admin_init', 'deactivate_plugin_conditional' );
     235
     236function add_stylesheet_plugin_to_admin() {
     237  wp_enqueue_style( 'sudo-style', plugin_dir_url( __FILE__ ). 'lib/style.css' );
     238}
     239add_action( 'admin_enqueue_scripts', 'add_stylesheet_plugin_to_admin' );
     240
     241function add_jquery_plugin_to_admin() {
     242  wp_enqueue_script( 'sudo-scripts', plugin_dir_url( __FILE__ ). 'lib/main.js' );
     243}
     244add_action( 'admin_enqueue_scripts', 'add_jquery_plugin_to_admin' ); 
Note: See TracChangeset for help on using the changeset viewer.