'

MKP Base Core Concepts

Core Concepts

The MKP_Base plugin is based on several core concepts. Understanding these concepts will make using this shortcode handler much easier.

Object Types

This plugin implements a collection of classes that work together to provide power, extensibility and simplicity:

    • MKP_Base provides a large collection of services which are called upon by the other classes. These services include:
      • Generation of diagnostic messages which are written to a text log file
      • Generation of notification messages which appear as popups on the screen
      • Parsing and validating shortcodes
    • The AJAX Handler class extends MKP_Base and manages AJAX calls from the front end
    • The Location Manager also extends MKP_Base and provides functions that convert address information into latitude and longitude.
    • The Data Loader class:
      • Loads the Contacts, Communities and I-Group classes when a shortcode is invoked that uses that code
      • Pulls XML Data from MKP Connect
      • Filters that data according to requests from the other classes
    • The Contact class displays contact lists for regions, areas and communities
    • The Communities class displays community information for regions, areas and communities
    • The I-Group class displays I-Group lists and maps for regions, areas and communities

These classes are shown visually in this diagram:
Each shortcode must begin with the name of the class it is expressing. For example, to display an I-Group map, you must use the mkp_igroups object:

mkp_igroups community=”Puget Sound” map

where mkp_igroups is the object, community=”Puget Sound” is a modifier and map is the action.

Output:

22 I-Groups in the Puget Sound Community

Options:

Options define behavioral values that persist across page turns. For example, if the “verbose” option is set to true, extensive diagnostic information will be written to the corresponding log file on the current and on all subsequent pages. Options are set with the shortcode:

mkp_base option=verbose+true set_option show_options

Output:

MKP Plugins: Setting Option verbose = [true]

MKP Base Options:
  • enabled = true
  • verbose = true
  • do_backtrace = 0
  • logfile = MKP Plugins.log
  • handler = handler
    • class = MKP_Base
    • method = file_logger
  • show_all_igroups = false
  • show_loggedin_igroups = false
  • source = MKP Plugins:
  • autoload = autoload
    • communities = false
    • contacts = false
    • igroups = false
    • mapper = false
  • table_name_prefix = mkpusa_
  • options_name_prefix = mkpusa_29_
  • google_api_key_name = mkp_google_api_key
  • google_api_key_value = AIzaSyCi8B3Z5SICnMBSYnhoNgZ3BaG8Lr_Of1k
  • loaded = loaded
    • igroups = true
    • mapper = true
  • option = function

Actions & Modifiers

The remainder of each shortcode is a list of modifiers followed by the action they modify. For example, to display a notification message, you would use the message=”contents of the message” type=NOTIFICATION_TYPE_CONFIRMATION sticky=false modifiers followed by the notify action:

mkp_base message=”This is a notification message” type=NOTIFICATION_TYPE_CONFIRMATION sticky=true notify

Output:

Note that the text of the message does not appear on the page, but it does (or at least should) appear as a popup message in the bottom right corner of the screen.

mkp_base shortcodes <– display shortcodes supported by the MKP Base class
MKP Base Shortcodes:
All modifiers must precede actions they modify.
  • Shortcode Actions:
    • shortcodes = bool, action: Display list of plugin shortcodes
    • do_shortcode = string, action: Execute a shortcode
  • Diagnostic Modifiers:
    • verbose = bool, modifier: Display diagnostic messages and long form of notification types
    • message = string, modifier: Message text for use by log and notify codes
    • source = string, modifier: Prefix diagnostic messages with this text
  • Diagnostic Actions:
    • report = bool, action: requires: [message] Log a diagnostic message.
    • log = bool, action: requires: [message] optional: [source] Log a diagnostic message
    • show_diagnostics = bool, action: Display the contents of the log file
    • clear_diagnostics = bool, action: Delete the log file
  • Notification Modifiers:
    • notification_type = bool, modifier: Message notification type}
    • type = bool, modifier: Message otification type}
    • show_types = bool, action: show notification types
    • enabled = bool, modifier: If true, show only enabled notification types
    • sticky = bool, modifier: Set notification sticky values
    • echo = bool, modifier: Echo notifications in output stream
  • Notification Actions:
    • notify = bool, action: requires: [message] optional: [type,sticky,echo] Create notification message.
    • show_notifications = bool, action: Display pending notification messages
    • clear_notifications = bool, action: Delete pending notifications
    • notifications_tool = bool, action: Load and show interactive notifications tool
  • Option Management Modifiers:
    • option = string, modifier: option name+
    • option_name = string, modifier: option name to be set
    • option_value = string, modifier: new option value
    • options = bool, modifier: Display current option values
    • filter = string, modifier: SQL LIKE value to use as filter on Option Names
  • Option Management Actions:
    • option_test = bool, action: requires: [option_name,option_value] Perform test of getting and updating a specific option name and value
    • options_test = bool, action: Perform test of getting and updating various types of options
    • save = bool, action: Make current option values persistent by saving in wp_options table
    • set_option = array, action: Set current option value
    • show_options = array, action: send current options to log file
    • show_site_options = bool, action: optional: [filter] Show options for current site
    • reset_options = bool, action: Reset options to their default values
  • Manage loading of extension classes:
    • autoload = bool, action: Automatically load specific extensions - simpler
    • unload = bool, action: Disable autoloading
    • show_loaded = bool, action: Show which extensions are currently loaded
    • show_autoloaded = bool, action: Show which extensions are automatically loaded
    • clear_autoload = bool, action: Disable autoloading of any extensions
  • Extensions:
    • communities = bool, modifier: Load or Autoload the Communities module
    • contacts = bool, modifier: Load or Autoload the Contacts module
    • igroups = bool, modifier: Load or Autoload the I-Groups module
    • mapper = bool, modifier: Load or Autoload the Mapper module
    • reload = bool, action: reload XML data
  • Area Name
    • area_name = bool, modifier: Current area name
    • set_area = bool, action: requires: [area_name] Set current area name
    • get_area = bool, action: Get current area name
  • Site Information Actions:
    • site_name = bool, action: Show current multisite name
    • site_url = bool, action: Show URL of curent site
    • site_info = bool, action: Show current multisite information
    • show_version = bool, action: Show current code version
    • php_version = bool, action: Show PHP version