The Lab
The Lab:Software:Word Press:Easy Dev for Word Press
Last updated at Sat Oct 05 00:38, by Sharron Denice

Description  ⇑ top

The Software People's (TSP) Easy Dev for WordPress is an application programming interface (API) for WordPress plugin development. Easy Dev makes OOD hot again and it's the engine that powers all WordPress plugins created by The Software People!

All the hard work is done for you (see features below) The only thing you have to do is process the information returned to you and display your data to the screen.

Extending Easy Dev for Functionality  ⇑ top

Using Easy Dev for Convenience  ⇑ top

Powering Your Plugins with Easy Dev  ⇑ top

  • For standard functionalities (maintained only - see features below) use the TSP_Easy_Dev class
  1. $my_plugin = new TSP_Easy_Dev( MY_PLUGIN_FILE, MY_PLUGIN_REQ_VERSION );
  • For extended functionalities (constantly upgraded - see features below) use the TSP_Easy_Dev_Pro class
  1. $my_plugin = new TSP_Easy_Dev_Pro( MY_PLUGIN_FILE, MY_PLUGIN_REQ_VERSION );


Features  ⇑ top

Upgrades will include fixes only, no new functionality

  • Create functional plugins in as little as 5 lines of code
  • Add additional `external URL links` to your plugins description
  • Use on as many plugin projects as necessary
  • Add a `settings page` menu for your plugin, and for future plugins
  • Supports the usage of your own `custom shortcodes`
  • Verify user `uses correct version of WordPress` for your plugin
  • When ready to deploy, require users to install THIS plugin or bundle the code into YOUR plugin
  • `Smarty` bundled into package (display html easily)
  • Smarty `form field templates` included for creating forms on the fly

Pro Version Features  ⇑ top

Includes all of the features of the standard version AND…

  • Checks for browser type and version (currently supports Chrome, Firefox, Safari, Opera and IE detection)
  • Add form fields (metadata) to posts
  • Add form fields (metadata) to categories
  • Check for `incompatible plugins` on activate
  • Check for `required plugins` on activate
  • Deregister annoying scripts
  • Display `favicons` (ie Twitter, Facebook, GitHub, thumbs, folders, etc) easily in your html
  • `Format your html` into columns on the fly
  • Additional images and resources
  • `Upgrades includes fixes and new functionality from our community of developers`

Pro Version Documentation  ⇑ top

For instructions specific to Easy Dev Pro visit it's documentation page. To take full advantage of all the features of Easy Dev, please visit Easy Dev API page.

Installation  ⇑ top



Usage  ⇑ top

There are three steps to using the Easy Dev API. First you will need to create a configuration file, extend classes as necessary and create your plugin's main php file.

API  ⇑ top

To take full advantage of all the features of Easy Dev, please visit Easy Dev API page.

Create Config File  ⇑ top

If your plugin requires any of the following options to be stored in the database, you will need to create an advanced settings file:
  1. Widget - Fields that will display on every widget for the plugin
  2. Settings - Fields that will display on the settings page
  3. Shortcodes - Fields that will display on the settings page for setting default values for shortcodes
  4. Post Fields - Fields that will display upon editing and creating posts
  5. Category Fields - Fields that will display upon editing and creating post categories
  Remember: You can name your config file any name you want and store it in any location, as long as your main plugin file has access to it and requires it.
  The recommended name for the config file is '''TSP_Easy_Dev.config.php''' and it should be placed in the save directory level as your plugin file.


Basic Config File  ⇑ top

If none of the above is required, your config file can look like the following:

  1. <?php
  2. // Get the plugin path
  3. if (!defined('WP_CONTENT_DIR')) define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
  4.  
  5. if (!defined('DS')) {
  6. if (strpos(php_uname('s') , 'Win') !== false) define('DS', '\\');
  7. else define('DS', '/');
  8. }//endif
  9.  
  10. $easy_dev_settings = get_plugin_data( YOUR_PLUGIN_FILE, false, false ); // TODO: Define YOUR_PLUGIN_FILE global in main plugin file
  11. $easy_dev_settings['name'] = YOUR_PLUGIN_NAME;
  12. $easy_dev_settings['title'] = YOUR_PLUGIN_TITLE;
  13. $easy_dev_settings['file'] = YOUR_PLUGIN_FILE;
  14. $easy_dev_settings['base_name'] = YOUR_PLUGIN_NAME;
  15. );
  16.  
  17. ?>


AND the following values need to be set as follows in your plugin file ONLY IF you are not extending the `TSP_Easy_Dev_Options` or `TSP_Easy_Dev_Pro_Options` classes:
  1. // If the plugin does not require settings the following three variables must be set
  2. $easy_dev->plugin_title = $easy_dev_settings['title'];
  3. $easy_dev->plugin_name = $easy_dev_settings['name'];
  4. $easy_dev->plugin_file = $easy_dev_settings['file'];
  5. $easy_dev->plugin_base_name = $easy_dev_settings['base_name'];
  Yeah it's a bit redundant but the above four (4) values must be set if you are not extending the `TSP_Easy_Dev_Options` or `TSP_Easy_Dev_Pro_Options` classes.


Advanced Config File  ⇑ top

In addition to the basic config file the following configurations will need to be added based on what your plugin needs.

Plugins that Requires Smarty  ⇑ top

Smarty is a template engine for PHP that allows you to send data to template files for display. If your plugin needs to display HTML to the screen then you will need to define the following settings:
  1. // Globals defined in main template file
  2. $easy_dev_settings['smarty_template_dirs'] = array( MY_PLUGIN_PATH . 'templates', TSP_EASY_DEV_ASSETS_TEMPLATES_PATH ); // Array of absolute path locations to look for templates
  3. $easy_dev_settings['smarty_compiled_dir'] = TSP_EASY_DEV_TMP_PATH . $easy_dev_settings['name'] . DS . 'compiled'; // The compiled directory
  4. $easy_dev_settings['smarty_cache_dir'] = TSP_EASY_DEV_TMP_PATH . $easy_dev_settings['name'] . DS . 'cache'; // The cache directory


Plugins that Requires a Widget  ⇑ top

If your plugin will uses a widget or shortcodes then you are required to define the following settings (fyi Smarty will automatically be required to generate pages):

  1. $easy_dev_settings['widget_width'] = 300;
  2. $easy_dev_settings['widget_height'] = 350;


Plugins that Requires a Options Menu  ⇑ top

If your plugin will uses a settings menu then you are required to define the following settings (fyi Smarty will automatically be required to generate pages):

  1. $easy_dev_settings['parent_name'] = "my_parent_menu"; // The main menu to ID your settings will be placed under, leave BLANK/NULL if the plugin has no menu to be nested under
  2. $easy_dev_settings['parent_title'] = "Parent Menu"; // The title of the menu your settings will appear under, leave BLANK/NULL if the plugin has no menu to be nested under
  3. $easy_dev_settings['menu_pos'] = "2833.23"; // A menu position where your menu will be placed, adding decimals decreases the chances that other plugins will have the same menu position
  4.  
  5. $easy_dev_settings['option_prefix'] = $easy_dev_settings['name'] . "-option"; // The option name, where your settings will be stored in the database
  6. $easy_dev_settings['option_prefix_old'] = $easy_dev_settings['TextDomain']."_options"; // For cleanup from previous versions, If you have renamed your option name, specify the name here and it will be removed automatically


Storing User Fields & Data  ⇑ top

If your plugin stores data of any kind, you will need to supply the fields that will be displayed to the user based on where they will be displayed. For example, if the user can add a widget to their side menu, then you will need to define the widget fields that the user will need to update.

  • If you need to save Widget data: widget_fields will need to be added to the array `$easy_dev_settings('plugin_options')`
  • If you need to save Settings data: settings_fields will need to be added to the array `$easy_dev_settings('plugin_options')`
  • If you need to save Post data: post_fields will need to be added to the array `$easy_dev_settings('plugin_options')`
  • If you need to save Category data: category_fields will need to be added to the array `$easy_dev_settings('plugin_options')`
  • If you need to save Shortcode data: shortcode_fields will need to be added to the array `$easy_dev_settings('plugin_options')`


All data fields have the following options, new types are being added so be sure to update often.

  Format:
      'type'        // the field type, available INPUT, TEXT, SELECT, TEXTAREA [Pro Version includes IMAGE]
      'label'       // the field's label text, not required for TEXT
      'value'       // the default value of the field
      'old_labels'  // If this is NOT your first version of your plugin and you have renamed a field in this version, place the old field name value in this array, FOR SHORTCODE USE
      'options'     // array of values used for SELECT, Label => Value format
      'html'        // true or false, allow HTML, default false


Below is an example of a plugin that uses a widget to display a title (`title`), description (`desc`) and whether or not to hide the description (`hide_desc`). It also has a settings page that simply displays instructions to the user.

  1. $easy_dev_settings['plugin_options'] = array(
  2. 'settings_fields' => array(
  3. 'info' => array(
  4. 'type' => 'TEXT',
  5. 'label' => '',
  6. 'value' => 'To display the description, all add the widget to the side menu.',
  7. )
  8. )
  9. 'widget_fields' => array(
  10. 'title' => array(
  11. 'type' => 'INPUT',
  12. 'label' => 'Title',
  13. 'value' => 'My Widget',
  14. ),
  15. 'desc' => array(
  16. 'type' => 'TEXTAREA',
  17. 'label' => 'Description',
  18. 'value' => '',
  19. 'old_labels' => array ('description'),
  20. ),
  21. 'hide_desc' => array(
  22. 'type' => 'SELECT',
  23. 'label' => 'Hide Description?',
  24. 'value' => 'N',
  25. 'options' => array ('Yes' => 'Y', 'No' => 'N'),
  26. ),
  27. 'before_title' => array(
  28. 'type' => 'INPUT',
  29. 'label' => 'HTML Before Title',
  30. 'value' => '<h3 class="widget-title">',
  31. 'html' => true,
  32. ),
  33. 'after_title' => array(
  34. 'type' => 'INPUT',
  35. 'label' => 'HTML After Title',
  36. 'value' => '</h3>',
  37. 'html' => true,
  38. )
  39. )
  40. );


Create Extends File: Extend Easy Dev Classes  ⇑ top

The only reason why there is a need to extend Easy Dev is to perform some logic that your plugin requires. We have no way of knowing what that logic is so in order for Easy Dev to work for you, you MAY need to extend classes in order to perform some logic for your plugin.

  • Extend the `TSP_Easy_Dev_Options` or `TSP_Easy_Dev_Pro_Options`(Pro) class if your plugin needs an options menu.
  • Extend the TSP_Easy_Dev_Widget class if your plugin requires a widget or shortcode.
If you don't require any of these then you will not need to create an extends file.

  Remember: You can name your extends file any name you want and store it in any location, as long as your main plugin file has access to it and requires it ('''config file must be required first before the extends file''').
  The recommended name for the extends file is '''TSP_Easy_Dev.extend.php''' and it should be placed in the save directory level as your plugin file.


Extending the TSP_Easy_Dev_Options Class  ⇑ top

If your plugin requires options you will need AT LEAST implement the `display_parent_page` and `display_plugin_options_page` methods. Below is sample code that implements these methods. Remember the class names must be unique.

  1. /**
  2.  * Extends the TSP_Easy_Dev_Options Class
  3.  */
  4. class TSP_Easy_Dev_Options_MY_PLUGIN extends TSP_Easy_Dev_Options
  5. {
  6. /**
  7. * Display the settings page
  8. *
  9. * @since 1.1.0
  10. *
  11. * @param none
  12. *
  13. * @return output to stdout
  14. */
  15. public function display_parent_page()
  16. {
  17. // Display settings to screen
  18. $smarty = new TSP_Easy_Dev_Smarty( $this->get_value('smarty_template_dirs'),
  19. $this->get_value('smarty_cache_dir'),
  20. $this->get_value('smarty_compiled_dir'), true );
  21.  
  22. $smarty->assign( 'html', "Hello World");
  23. $smarty->display( 'MY_PLUGIN_html.tpl');
  24. }//end ad_menu
  25.  
  26. /**
  27. * Implements the display_plugin_options_page to display settings specific to this plugin
  28. *
  29. * @since 1.1.0
  30. *
  31. * @param none
  32. *
  33. * @return output to screen
  34. */
  35. function display_plugin_options_page()
  36. {
  37. $message = "";
  38.  
  39. $error = "";
  40.  
  41. // get settings from database
  42. $settings_fields = get_option( $this->get_value('settings-fields-option-name') );
  43. $defaults = new TSP_Easy_Dev_Data ( $settings_fields );
  44.  
  45. $form = null;
  46. if ( array_key_exists( $this->get_value('name') . '_form_submit', $_REQUEST ))
  47. {
  48. $form = $_REQUEST[ $this->get_value('name') . '_form_submit'];
  49. }//endif
  50.  
  51. // Save data for settings page
  52. if( isset( $form ) && check_admin_referer( $this->get_value('name'), $this->get_value('name') . '_nonce_name' ) )
  53. {
  54. $defaults->set_values( $_POST );
  55. $settings_fields = $defaults->get();
  56.  
  57. update_option( $this->get_value('settings-fields-option-name'), $settings_fields );
  58.  
  59. $message = __( "Options saved.", $this->get_value('name') );
  60. }
  61.  
  62. $form_fields = $defaults->get_values( true );
  63.  
  64. // Display settings to screen
  65. $smarty = new TSP_Easy_Dev_Smarty( $this->get_value('smarty_template_dirs'),
  66. $this->get_value('smarty_cache_dir'),
  67. $this->get_value('smarty_compiled_dir'), true );
  68.  
  69. $smarty->assign( 'form_fields', $form_fields);
  70. $smarty->assign( 'message', $message);
  71. $smarty->assign( 'error', $error);
  72. $smarty->assign( 'form', $form);
  73. $smarty->assign( 'plugin_name', $this->get_value('name'));
  74. $smarty->assign( 'nonce_name', wp_nonce_field( $this->get_value('name'), $this->get_value('name').'_nonce_name' ));
  75. $smarty->display( $this->get_value('name') . '_shortcode_settings.tpl');
  76. }//end settings_page
  77. }//end TSP_Easy_Dev_Options_MY_PLUGIN


Extending the TSP_Easy_Dev_Widget Class  ⇑ top

If your plugin requires a widget you will need to AT LEAST implement the `__construct`, `init`, `display_form` and `display_widget` methods. Below is sample code that implements these methods. Remember the class names must be unique.
  Remember: Take note of the REQUIRED comments below
  1. /**
  2.  * Extends the TSP_Easy_Dev_Widget Class
  3.  */
  4. class TSP_Easy_Dev_Widget_MY_PLUGIN extends TSP_Easy_Dev_Widget
  5. {
  6. /**
  7. * Constructor - The following filter is required inside of this constructor. WordPress makes a call to this class statically and in order to
  8.   * initialize it we have to add a filter. The filter will be applied inside the main plugin file.
  9. */
  10. public function __construct()
  11. {
  12. add_filter( get_class() .'-init', array($this, 'init'), 10, 1 ); // REQUIRED, add exactly as-is
  13. }//end __construct
  14.  
  15.  
  16. /**
  17. * Function added to filter to allow initialization of widget
  18. *
  19. * @since 1.1.0
  20. *
  21. * @param object $options Required - pass in reference to TSP_Easy_Dev_Options/TSP_Easy_Dev_Pro_Options class
  22. *
  23. * @return none
  24. */
  25. public function init( $options )
  26. {
  27. // Create the widget
  28. parent::__construct( $options ); // REQUIRED, add exactly as-is
  29. }
  30.  
  31. /**
  32. * Override required of form function to display widget information
  33. *
  34. * @since 1.1.0
  35. *
  36. * @param array $instance Required - array of current values
  37. *
  38. * @return display to widget box
  39. */
  40. public function display_form( $fields )
  41. {
  42. /* Do some other things here */
  43.  
  44. $smarty = new TSP_Easy_Dev_Smarty( $this->options->get_value('smarty_template_dirs'),
  45. $this->options->get_value('smarty_cache_dir'),
  46. $this->options->get_value('smarty_compiled_dir'), true );
  47.  
  48. $smarty->assign( 'form_fields', $fields );
  49. $smarty->assign( 'class', 'widefat' );
  50. $smarty->display( 'default_form.tpl' );
  51. }//end form
  52.  
  53. /**
  54. * Implementation (required) to print widget & shortcode information to screen
  55. *
  56. * @since 1.1.0
  57. *
  58. * @param array $fields - the settings to display
  59. * @param boolean $echo Optional - if false returns output instead of displaying to screen
  60. *
  61. * @return string $output if echo is true displays to screen else returns string
  62. */
  63. public function display_widget( $fields, $echo = true )
  64. {
  65. extract ( $fields );
  66.  
  67. $return_HTML = "";
  68.  
  69. // If there is a title insert before/after title tags
  70. if (!empty($title)) {
  71. $return_HTML .= $before_title . $title . $after_title;
  72. }
  73.  
  74. /* Do some other things here */
  75.  
  76. $smarty = new TSP_Easy_Dev_Smarty( $this->options->get_value('smarty_template_dirs'),
  77. $this->options->get_value('smarty_cache_dir'),
  78. $this->options->get_value('smarty_compiled_dir'), true );
  79.  
  80. $smarty->assign("title", $title, true);
  81. $smarty->assign("url", $url, true);
  82. $smarty->assign("image", $image, true);
  83. $smarty->assign("target", $target, true);
  84. $smarty->assign("desc", $desc, true);
  85. $smarty->assign("cat_term", $category->term_id, true);
  86. $smarty->assign("cat_width", $cat_width, true);
  87. $smarty->assign("first_cat", ($cat_cnt == 1) ? true : null, true);
  88. $smarty->assign("last_cat", ($cat_cnt == $num_cats) ? true : null, true);
  89.  
  90. $return_HTML .= $smarty->fetch( $this->settings['name'] . '_layout'.$layout.'.tpl' );
  91.  
  92. if ($echo)
  93. echo $return_HTML;
  94.  
  95. return $return_HTML;
  96. }//end display
  97.  
  98. }//end TSP_Easy_Dev_Widget_MY_PLUGIN


Create Your Plugin Using Easy Dev FINALLY!  ⇑ top

Now that you have created your configuration (TSP_Easy_Dev.config.php) and extends file (TSP_Easy_Dev.extend.php) you can now create your main plugin file. You can always go back to your extends file and add in more logic later.

Below is an actual plugin implementation that uses Easy Dev. As you can see, there is only ONE unavoidable call, the rest is handled by Easy Dev.

To take full advantage of all the features of Easy Dev, please visit Easy Dev API page.

  Remember: Take note of the REQUIRED comments below


  1. <?php
  2. /*
  3. Plugin Name: TSP Featured Categories
  4. Plugin URI: http://www.thesoftwarepeople.com/software/plugins/wordpress/featured-categories-for-wordpress.html
  5. Description: Featured Categories allows you to add featured categories with images to your blog's website.
  6. Author: The Software People
  7. Author URI: http://www.thesoftwarepeople.com/
  8. Version: 1.1.5
  9. Text Domain: tspfc
  10. Copyright: Copyright © 2013 The Software People, LLC (www.thesoftwarepeople.com). All rights reserved
  11. License: APACHE v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
  12. */
  13.  
  14. require_once(ABSPATH . 'wp-admin/includes/plugin.php' ); // REQUIRED, require the plugin functions from WordPress
  15.  
  16. define('TSPFC_PLUGIN_FILE', __FILE__ ); // REQUIRED, set UNIQUE constant to store plugin file
  17. define('TSPFC_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); // REQUIRED, set UNIQUE constant to store plugin file path
  18. define('TSPFC_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); // REQUIRED, set UNIQUE constant to store plugin url
  19. define('TSPFC_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) ); // REQUIRED, set UNIQUE constant to store plugin basename
  20. define('TSPFC_PLUGIN_NAME', 'tsp-featured-categories'); // REQUIRED, set UNIQUE constant to store plugin name
  21. define('TSPFC_PLUGIN_TITLE', 'TSP Featured Categories'); // REQUIRED, set UNIQUE constant to store plugin title
  22. define('TSPFC_PLUGIN_REQ_VERSION', "3.5.1"); // REQUIRED, set UNIQUE constant to store plugin's required version
  23.  
  24. // The recommended option would be to require the installation of the standard version and
  25. // bundle the Pro classes into your plugin if needed, this plugin requires both the Easy Dev plugin installation
  26. // and looks for the existence of the Easy Dev Pro libraries
  27. if ( !file_exists ( WP_PLUGIN_DIR . "/tsp-easy-dev/TSP_Easy_Dev.register.php" ) || !file_exists( TSPFC_PLUGIN_PATH . "lib/TSP_Easy_Dev_Pro/TSP_Easy_Dev_Pro.register.php" ) )
  28. {
  29. function display_tspfc_notice()
  30. {
  31. $message = TSPFC_PLUGIN_TITLE . ' <strong>was not installed</strong>, plugin requires the installation of <strong><a href="plugin-install.php?tab=search&type=term&s=TSP+Easy+Dev">TSP Easy Dev</a></strong>.';
  32. ?>
  33. <div class="error">
  34. <p><?php echo $message; ?></p>
  35. </div>
  36. <?php
  37. }//end display_tspfc_notice
  38.  
  39. add_action( 'admin_notices', 'display_tspfc_notice' );
  40. deactivate_plugins( TSPFC_PLUGIN_BASE_NAME );
  41. return;
  42. }//endif
  43. else
  44. {
  45. if (file_exists( WP_PLUGIN_DIR . "/tsp-easy-dev/TSP_Easy_Dev.register.php" ))
  46. {
  47. include_once WP_PLUGIN_DIR . "/tsp-easy-dev/TSP_Easy_Dev.register.php";
  48. }//end else
  49.  
  50. if (file_exists( TSPFC_PLUGIN_PATH . "lib/TSP_Easy_Dev_Pro/TSP_Easy_Dev_Pro.register.php" ))
  51. {
  52. include_once TSPFC_PLUGIN_PATH . "lib/TSP_Easy_Dev_Pro/TSP_Easy_Dev_Pro.register.php";
  53. }//end if
  54. }//end else
  55.  
  56. global $easy_dev_settings;
  57.  
  58. require( TSPFC_PLUGIN_PATH . 'TSP_Easy_Dev.config.php'); // REQUIRE config file FIRST
  59. require( TSPFC_PLUGIN_PATH . 'TSP_Easy_Dev.extend.php');
  60. //--------------------------------------------------------
  61. // initialize the plugin
  62. //--------------------------------------------------------
  63. $featured_categories = new TSP_Easy_Dev_Pro( TSPFC_PLUGIN_FILE, TSPFC_PLUGIN_REQ_VERSION ); // REQUIRED, Pass in the plugin file AND the required version for ALL versions of Easy Dev
  64.  
  65. // Once the options handler is set your extended TSP_Easy_Dev_Options will have access to the plugin options. See API for functions available to you from the TSP_Easy_Dev_Options class
  66. $featured_categories->set_options_handler( new TSP_Easy_Dev_Options_Featured_Categories( $easy_dev_settings ), false, true ); // The TSP_Easy_Dev_Options class handles settings, See API docs for further param explanations
  67.  
  68. $featured_categories->set_widget_handler( 'TSP_Easy_Dev_Widget_Featured_Categories'); // We hate doing this but there is no workaround, supply the text name of your extended TSP_Easy_Dev_Widget class here
  69.  
  70. $featured_categories->uses_smarty = true;
  71.  
  72. $featured_categories->uses_shortcodes = true;
  73.  
  74. // Queue User styles
  75. $featured_categories->add_css( TSPFC_PLUGIN_URL . TSPFC_PLUGIN_NAME . '.css' ); // See API docs for further param explanations
  76.  
  77. // Queue User Scripts
  78. $featured_categories->add_script( TSPFC_PLUGIN_URL . 'js' . DS . 'jquery.smoothDivScroll-1.1.js', array('jquery','jquery-ui-widget') ); // See API docs for further param explanations
  79. $featured_categories->add_script( TSPFC_PLUGIN_URL . 'js' . DS . 'gallery-scripts.js', array('jquery','jquery-ui-widget') );
  80. $featured_categories->add_script( TSP_EASY_DEV_ASSETS_JS_URL . 'pro-skel-min.js' );
  81.  
  82. // Queue Admin Styles
  83. $featured_categories->add_css( includes_url() . 'js' . DS . 'thickbox' . DS . 'thickbox.css', true );
  84.  
  85. // Queue Admin Scripts
  86. $featured_categories->add_script( TSP_EASY_DEV_PRO_ASSETS_JS_URL . 'pro-media-upload.js', array('jquery','thickbox','media-upload','quicktags'), true );
  87.  
  88. $featured_categories->set_plugin_icon( TSPFC_PLUGIN_URL . 'images' . DS . 'tsp_icon_16.png' );
  89.  
  90. $featured_categories->add_shortcode ( TSPFC_PLUGIN_NAME );
  91. $featured_categories->add_shortcode ( 'tsp_featured_categories' ); //backwards compatibility
  92.  
  93. $featured_categories->run( TSPFC_PLUGIN_FILE );
  94.  
  95. // Initialize widget - Required by WordPress
  96. // We hate doing this but there is no workaround, you must include the following action implementation to pass the TSP_Easy_Dev_Options class reference to the widget
  97. // The widget NEEDS to know some basic information about your plugin
  98. function tspfc_widgets_init()
  99. {
  100. global $featured_categories;
  101.  
  102. register_widget ( $featured_categories->get_widget_handler() );
  103. apply_filters( $featured_categories->get_widget_handler().'-init', $featured_categories->get_options_handler() );
  104. }// end tspfc_widgets_init
  105.  
  106. // Initialize widget - Required by WordPress
  107. add_action('widgets_init', 'tspfc_widgets_init');
  108. ?>


In this example the Easy Dev Pro libraries are bundled in the lib/ directory of this plugin's main directory:

  • lib/TSP_Easy_Dev_Pro/TSP_Easy_Dev_Pro.register.php
  • lib/TSP_Easy_Dev_Pro/assets (entire folder)
  • lib/TSP_Easy_Dev_Pro/classes (entire folder)



Article comments (0)

There are no comments