Esempio n. 1
0
 value="1" />
                            <?php 
_e('When a new user is registered');
?>
                        </label>
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-label"> <?php 
_e('Username blacklist');
?>
</div>
                    <div class="form-controls">
                        <label id="username_blacklist" class="form-label-input">
                            <input type="text" id="username_blacklist" name="username_blacklist" value="<?php 
echo osc_esc_html(osc_username_blacklist());
?>
" />
                            <span class="help-box"><?php 
_e('List of terms not allowed in usernames, separated by commas');
?>
</span>
                        </label>
                    </div>
                </div>
                <div class="form-actions">
                    <input type="submit" id="save_changes" value="<?php 
echo osc_esc_html(__('Save changes'));
?>
" class="btn btn-submit" />
                </div>
Esempio n. 2
0
 /**
  * Check is an username is blacklisted
  *
  * @param string $username
  * @since 3.1
  * @return boolean
  */
 function osc_is_username_blacklisted($username) {
     // Avoid numbers only usernames, this will collide with future users leaving the username field empty
     if(preg_replace('|(\d+)|', '', $username)=='') {
      return true;
     }
     $blacklist = explode(",", osc_username_blacklist());
     foreach($blacklist as $bl) {
         if(stripos($username, $bl)!==false) {
             return true;
         }
     }
     return false;
 }