First of all we must have a idea what we want to develop, in this case:

  1. We want to develop a password generator.
  2. Generator must be useable in front and backend of the website.
  3. Shortcodes has to be for frontend available.
  4. User can choose which type of  encryption he or she want to use.
  5. User can set how many repeats the plugin use.
  6. Documentation available in menu.

 

WordPress plugin Initialisation:

/*
  Plugin Name: opasswords
  Plugin URI : http://www.abs-hosting.nl/cms/new-password/
  Description: Encrypted Passwords plugin.
  Author     : CS ABS-Hosting.nl
  Author     : CS  : ABS-Hosting.nl / Walchum.net
  Version    : 1.0
  Author URI : http://www.abs-hosting.nl
 */

Password Plugin

Thats all !,

if the above text is saved as passwords.php and installed as plugin it will do nothing only it will show your information. In WordPress it is a valid plugin and will apear in the plugin list.

  • Pluginname is now called opasswords.
  • Url to plugin form or download file.
  • Short description
  • Author
  • Version is of your choice, 1, 0.1 etc.etc.
  • Author Url, link to your own website

A litle strange is it that the file-name and class-name do not have to be the same!

The actual class :

class oPasswords {

    public $options;

    public function __construct() {
        add_action('init', array($this, 'init'));
    }

    /**
     * Initiate plugin
     */
    public function init() {
        //set install hook, for adding of removing options
        register_activation_hook(__FILE__, array($this, 'passwords_install'));
        //* Runs on plugin deactivation*/
        register_activation_hook(__FILE__, array($this, 'passwords_remove'));
        //register_deactivation_hook( __FILE__, $this->passwords_remove());
        //get some CONSTANT values
        $this->defenitions();

        $ok = load_plugin_textdomain('passwords', false, dirname(plugin_basename(__FILE__)) . '/languages');

        add_action('admin_menu', array($this, 'pw_actions'));

        add_shortcode('passwords-new', array($this, 'wp_passwords_new'));
        add_shortcode('passwords-ex', array($this, 'wp_passwords_explain'));

        $this->wp_passwords_add_css_files();
        //$this->wp_passwords_add_javascript_files();

        $this->get_option();
    }
}

This class is center point of the plugin. All functions, who are called in this class, must be available and give correct responses otherwise the plugin will not be INSTALLED by WordPress.

Previous

Next

BATCHtools licentie 15 €
Programming pays my bills. Selling files yours? Come on, give me a fair share!
Koop nu een licentie en steun ons in de verdere ontwikkeling en onderhoud van BATCHTools
Hot Offers

Webshop.

Neem nu ook een webshop en vergroot uw verkoopmogelijkheden.


Vraag offerte aan.

Vraag vrijblijvend een offerte, laat u door onze adviseurs, adviseren en begeleiden.


Van start tot finish.

Van start tot finish begeleiden wij u bij het opzetten van uw webshop.

Online Facturatie