Plugin Directory

Changeset 1507997


Ignore:
Timestamp:
10/04/2016 08:02:30 AM (9 years ago)
Author:
smartware.cc
Message:

Version 1.2

Location:
smart-user-slug-hider
Files:
12 added
5 edited

Legend:

Unmodified
Added
Removed
  • smart-user-slug-hider/trunk/readme.txt

    r1446485 r1507997  
    11=== smart User Slug Hider ===
    2 Contributors: smartware.cc, petersplugins
    3 Donate link:http://smartware.cc/make-a-donation/
     2Contributors: petersplugins, smartware.cc
     3Donate link:http://petersplugins.com/make-a-donation/
    44Tags: author, authors, user, users, url, link, security, secure, login, permalink, authorlink, author link, userlink, user link, authorpage, author page
    55Requires at least: 3.0
    6 Tested up to: 4.5
    7 Stable tag: 1.1
     6Tested up to: 4.6
     7Stable tag: 1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1515> This Plugin replaces user names with 16 digits coded strings.
    1616
    17 See also [Plugin Homepage](http://smartware.cc/wp-smart-user-slug-hider)
     17See also [Plugin Homepage](http://petersplugins.com/free-wordpress-plugins/smart-user-slug-hider/)
    1818
    19 For author page URLs WordPress uses the pattern www.example.com/author/name where 'name' represents the users login name. This means that the **login names from all your users are publicly visible**. This is the already half of the infomations needed to log in...
     19For author page URLs WordPress uses the pattern example.com/author/name where 'name' represents the users login name. This means that the **login names from all your users are publicly visible**. This is the already half of the infomations needed to log in...
    2020
    21 The smart User Slug Hider Plugin changes all author page URLs from e.g. www.example.com/author/admin to something like www.example.com/author/e9e716def73f76ac.
     21The smart User Slug Hider Plugin changes all author page URLs from e.g. example.com/author/admin to something like example.com/author/e9e716def73f76ac.
    2222
    23 The codes are generated automatically and its impossible to make conclusions about the user names. The WordPress default URLs (like www.example.com/author/admin) will cause a 404 (not found) error. The plugin does not make any changes to your database. Deactivating the Plugin restores the default WordPress behavior.
     23The codes are generated automatically and its impossible to make conclusions about the user names. The WordPress default URLs (like example.com/author/admin) will cause a 404 (not found) error. The plugin does not make any changes to your database. Deactivating the Plugin restores the default WordPress behavior.
    2424
    2525There are **no settings and no need to change anything**.
    2626
     27= Shortcodes =
     28
     29The plugin adds three shortcodes you can use in your posts:
     30
     31* **[smart_user_slug]** the user slug of the post author - e.g. e9e716def73f76ac
     32* **[smart_user_url]** the url of the post author's profile page - e.g. example.com/author/e9e716def73f76ac
     33* **[smart_user_link]** adds a link to the post author's profile page
     34
     35= Theme Functions =
     36
     37The plugin adds two functions that can be used in theme files:
     38
     39* `get_smart_user_slug( $author_id )` to **get** the user slug for the author - the parameter $author_id is optional, if omitted the author's ID of the current post is used
     40* `the_smart_user_slug( $author_id )` to **display** the user slug for the author - the parameter $author_id is optional, if omitted the author's ID of the current post is used
     41
    2742= Do you like the smart User Slug Hider Plugin? =
    2843
    29 Thanks, I appreciate that. You don't need to make a donation. No money, no beer, no coffee. Please, just [tell the world that you like what I'm doing](http://smartware.cc/make-a-donation/)! And that's all.
     44Thanks, I appreciate that. You don't need to make a donation. No money, no beer, no coffee. Please, just [tell the world that you like what I'm doing](http://petersplugins.com/make-a-donation/)! And that's all.
    3045
    31 = More plugins from smartware.cc =
     46= More plugins from Peter =
    3247
    3348* **[404page](https://wordpress.org/plugins/404page/)** - Define any of your WordPress pages as 404 error page
    3449* **[hashtagger](https://wordpress.org/plugins/hashtagger/)** - Tag your posts by using #hashtags
    3550* **[smart Custom Display Name](https://wordpress.org/plugins/smart-custom-display-name/)** - Set your Display Name to anything you like
    36 * [See all](https://profiles.wordpress.org/smartwarecc/#content-plugins)
     51* [See all](https://profiles.wordpress.org/petersplugins/#content-plugins)
    3752
    3853== Installation ==
     
    6075== Changelog ==
    6176
     77= 1.2 (2016-10-04) =
     78* Shortcodes added: `[smart_user_slug]`, `[smart_user_url]`, `[smart_user_link]`
     79* Theme Functions added: `get_smart_user_slug()`, `the_smart_user_slug()`
     80
    6281= 1.1 (2016-06-30) =
    6382* Code optimization
     
    6988== Upgrade Notice ==
    7089
     90= 1.2 =
     91Shortcodes and Theme Functions added
     92
    7193= 1.1 =
    7294* Code optimization, Plugin info page added, no functional changes
  • smart-user-slug-hider/trunk/smart-user-slug-hider.php

    r1446485 r1507997  
    22/*
    33Plugin Name: smart User Slug Hider
    4 Plugin URI: http://smartware.cc/wp-smart-user-slug-hider
     4Plugin URI: http://petersplugins.com/free-wordpress-plugins/smart-user-slug-hider
    55Description: Hide usernames in author pages URLs to enhance security
    6 Version: 1.1
    7 Author: smartware.cc, Peter's Plugins
    8 Author URI: http://smartware.cc
     6Version: 1.2
     7Author: Peter's Plugins, smartware.cc
     8Author URI: http://petersplugins.com
    99Text Domain: smart-user-slug-hider
    10 License: GPL2
     10License: GPL2+
     11License URI: http://www.gnu.org/licenses/gpl-2.0.txt
    1112*/
    1213
    13 /*  Copyright 2016 Peter Raschendorfer (email : [email protected])
    14 
    15     This program is free software; you can redistribute it and/or modify
    16     it under the terms of the GNU General Public License, version 2, as
    17     published by the Free Software Foundation.
    18 
    19     This program is distributed in the hope that it will be useful,
    20     but WITHOUT ANY WARRANTY; without even the implied warranty of
    21     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    22     GNU General Public License for more details.
    23 
    24     You should have received a copy of the GNU General Public License
    25     along with this program; if not, write to the Free Software
    26     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    27 */
    28 
    29 class Smart_User_Slug_Hider {
    30  
    31   public $plugin_name;
    32   public $plugin_slug;
    33   public $version;
    34   private $wp_url;
    35   private $my_url;
    36   private $dc_url;
    37  
    38   public function __construct() {
    39     $this->plugin_name = 'smart User Slug Hider';
    40     $this->plugin_slug = 'smart-user-slug-hider';
    41         $this->version = '1.1';
    42     $this->init();
    43   }
    44  
    45   function init() {
    46     add_action( 'pre_get_posts', array( $this, 'alter_query' ), 99 );
    47     add_filter( 'author_link', array( $this, 'alter_link' ), 99, 3 );
    48     if ( is_admin() ) {
    49       add_action( 'admin_init', array( $this, 'admin_init' ) );
    50       add_action( 'admin_menu', array( $this, 'add_info_page' ) );
    51       add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_link' ) );
    52     }
    53   }
    54  
    55   function admin_init() {
    56     $this->wp_url = 'https://wordpress.org/plugins/' . $this->plugin_slug;
    57     $this->my_url = 'http://smartware.cc/free-wordpress-plugins/' . $this->plugin_slug;
    58     $this->dc_url = 'http://smartware.cc/docs/' . $this->plugin_slug;
    59     load_plugin_textdomain( 'smart-user-slug-hider' );
    60   }
    61 
    62   private function encrypt( $id ) {
    63     return bin2hex( mcrypt_encrypt( MCRYPT_BLOWFISH, md5( $_SERVER['SERVER_ADDR'] . __FILE__ ), base_convert( $id, 10, 36 ), 'ecb' ) );
    64   }
    65 
    66   private function decrypt( $encid ) {
    67     return base_convert( mcrypt_decrypt( MCRYPT_BLOWFISH, md5( $_SERVER['SERVER_ADDR'] . __FILE__ ), pack('H*', $encid), 'ecb' ), 36, 10 );
    68   }
    69 
    70   function alter_query( $query ) {
    71     if ( $query->is_author() && $query->query_vars['author_name'] != '' ) {
    72       if ( ctype_xdigit( $query->query_vars['author_name'] ) ) {
    73         $user = get_user_by( 'id', $this->decrypt( $query->query_vars['author_name'] ) );
    74         if ( $user ) {
    75           $query->set( 'author_name', $user->user_nicename );
    76         } else {
    77           $query->is_404 = true;
    78           $query->is_author = false;
    79           $query->is_archive = false;
    80         }
    81       } else {
    82         $query->is_404 = true;
    83         $query->is_author = false;
    84         $query->is_archive = false;
    85       }
    86     }
    87     return;
    88   }
    89 
    90   function alter_link( $link, $author_id, $author_nicename ) {
    91     return str_replace ( '/' . $author_nicename, '/' . $this->encrypt( $author_id ), $link );
    92   }
    93  
    94    function add_link( $links ) {
    95     return array_merge( $links, array( '<a class="dashicons dashicons-editor-help" href="' . menu_page_url( $this->plugin_slug, false ) . '"></a>', '<a href="https://wordpress.org/plugins/' . $this->plugin_slug . '/">' . __( 'Please rate Plugin', 'smart-user-slug-hider' ) .'</a>' ) );
    96   }
    97  
    98   function add_info_page() {
    99     add_submenu_page( null, $this->plugin_name, $this->plugin_name, 'read', $this->plugin_slug, array( $this, 'show_info_page' ) );
    100   }
    101  
    102   function show_info_page() {
    103     ?>   
    104     <div class="wrap">
    105       <?php screen_icon(); ?>
    106       <h2 style="min-height: 32px; line-height: 32px; padding-left: 40px; background-image: url(<?php echo plugins_url( 'pluginicon.png', __FILE__ ); ?>); background-repeat: no-repeat; background-position: left center"><a href="<?php echo $this->my_url; ?>"><?php echo $this->plugin_name; ?></a></h2>
    107       <hr />
    108       <p>Plugin Version: <?php echo $this->version; ?> <a class="dashicons dashicons-editor-help" href="<?php echo $this->wp_url; ?>/changelog/"></a></p>
    109       <div id="poststuff">
    110         <div id="post-body" class="metabox-holder columns-2">
    111           <div id="post-body-content">
    112             <div class="meta-box-sortables ui-sortable">
    113               <div class="postbox">
    114                 <div class="inside">
    115                   <p><strong><?php _e( 'This Plugin replaces user names with 16 digits coded strings.', 'smart-user-slug-hider' ); ?></strong></p>
    116                   <p><?php _e( 'There are no settings.', 'smart-user-slug-hider' ); ?></p>
    117                 </div>
    118               </div>
    119               <div class="postbox">
    120                 <div class="inside">
    121                   <p><strong><?php _e( 'Do you like the smart User Slug Hider Plugin?', 'smart-user-slug-hider' ); ?></strong></p>
    122                   <p><a href="https://profiles.wordpress.org/smartwarecc/#content-plugins"><?php _e( 'Please take a look at my other plugins.', 'smart-user-slug-hider' ); ?></a></p>
    123                 </div>
    124               </div>
    125             </div>
    126           </div>
    127           <?php { $this->show_meta_boxes(); } ?>
    128         </div>
    129         <br class="clear">
    130       </div>   
    131     </div>
    132     <?php
    133   }
    134  
    135   // show meta boxes
    136   function show_meta_boxes() {
    137     ?>
    138     <div id="postbox-container-1" class="postbox-container">
    139       <div class="meta-box-sortables">
    140         <div class="postbox">
    141           <h3><span><?php _e( 'Like this Plugin?', 'smart-user-slug-hider' ); ?></span></h3>
    142           <div class="inside">
    143             <ul>
    144               <li><div class="dashicons dashicons-wordpress"></div>&nbsp;&nbsp;<a href="<?php echo $this->wp_url; ?>/"><?php _e( 'Please rate the plugin', 'smart-user-slug-hider' ); ?></a></li>
    145               <li><div class="dashicons dashicons-admin-home"></div>&nbsp;&nbsp;<a href="<?php echo $this->my_url; ?>/"><?php _e( 'Plugin homepage', 'smart-user-slug-hider'); ?></a></li>
    146               <li><div class="dashicons dashicons-admin-home"></div>&nbsp;&nbsp;<a href="http://smartware.cc/"><?php _e( 'Author homepage', 'smart-user-slug-hider' );?></a></li>
    147               <li><div class="dashicons dashicons-googleplus"></div>&nbsp;&nbsp;<a href="http://g.smartware.cc/"><?php _e( 'Authors Google+ Page', 'smart-user-slug-hider' ); ?></a></li>
    148               <li><div class="dashicons dashicons-facebook-alt"></div>&nbsp;&nbsp;<a href="http://f.smartware.cc/"><?php _e( 'Authors facebook Page', 'smart-user-slug-hider' ); ?></a></li>
    149             </ul>
    150           </div>
    151         </div>
    152         <div class="postbox">
    153           <h3><span><?php _e( 'Translate this Plugin', 'smart-user-slug-hider' ); ?></span></h3>
    154           <div class="inside">
    155             <p><?php _e( 'It would be great if you\'d support the smart User Slug Hider Plugin by adding a new translation or keeping an existing one up to date!', 'smart-user-slug-hider' ); ?></p>
    156             <p><a href="https://translate.wordpress.org/projects/wp-plugins/<?php echo $this->plugin_slug; ?>"><?php _e( 'Translate online', 'smart-user-slug-hider' ); ?></a></p>
    157           </div>
    158         </div>
    159       </div>
    160     </div>
    161     <?php
    162   }
    163  
    164  
     14if ( ! defined( 'WPINC' ) ) {
     15    die;
    16516}
    16617
    167 $smart_user_slug_hider = new Smart_User_Slug_Hider();
     18require_once( plugin_dir_path( __FILE__ ) . '/inc/class-smart-user-slug-hider.php' );
     19
     20$smart_user_slug_hider = new Smart_User_Slug_Hider( __FILE__ );
     21
     22// theme functions
     23
     24function get_smart_user_slug( $user_id = false ) {
     25  $smart_user_slug_hider = new Smart_User_Slug_Hider( __FILE__ );
     26  return $smart_user_slug_hider->get_smart_user_slug( $user_id );
     27}
     28
     29function the_smart_user_slug( $user_id = false ) {
     30  $smart_user_slug_hider = new Smart_User_Slug_Hider( __FILE__ );
     31  $smart_user_slug_hider->the_smart_user_slug( $user_id );
     32}
     33
     34?>
Note: See TracChangeset for help on using the changeset viewer.