'

MKP Base Argument Tester

Shortcode arguments can take multiple forms:

  • As a single value
  • As code=value
  • As a list of code-value pairs ‘option=verbose,log_file+’my.log’

Single Value

Single values like “verbose” have an implied value of “true”; so ‘verbose’ is treated as ‘verbose=true’. All action codes are expressed as a single value (e.g. list or class=”mkp_u”>clear_diagnostics).

Code=Value

When a code requires a value like the message code, it must be expressed as message=”some message”

List of Code/Value pairs

There is one particularly complex code that processes multiple sets of code=value pairs in a single code. That is the option shortcode. Here is an example of it:

mkp_base option=show_all_igroups+false,function+’my_handler’ set_option show_options

Same as:
mkp_base option=show_all_igroups+false set_option
mkp_base option=function+’my_handler’ set_option show_options

In this example, we set the ‘show_all_igroups’ option to false and the handler function value to ‘my_handler’.


Output:

MKP Plugins: Setting Option option = [verbose]


Diagnostic Logfile Contents

Logfile: /nas/content/live/mkpusaws/wp-content/MKP Plugins_29.log

12/15/19 11:40:38->MKP Plugins: Logfile [/nas/content/live/mkpusaws/wp-content/MKP Plugins_29.log] cleared
12/15/19 11:40:38->MKP Plugins: Getting name=[show_diagnostics] code=[show_diagnostics] value=[true]
12/15/19 11:40:38->MKP Plugins: Doing code=[show_diagnostics] name=[show_diagnostics] value=[true]


MKP Plugins: my message

Diagnostic Logfile Contents

Logfile: /nas/content/live/mkpusaws/wp-content/MKP Plugins_29.log

12/15/19 11:40:38->MKP Plugins: Logfile [/nas/content/live/mkpusaws/wp-content/MKP Plugins_29.log] cleared
12/15/19 11:40:38->MKP Plugins: Getting name=[show_diagnostics] code=[show_diagnostics] value=[true]
12/15/19 11:40:38->MKP Plugins: Doing code=[show_diagnostics] name=[show_diagnostics] value=[true]


MKP Plugins: Setting Option show_all_igroups = [false]

MKP Plugins: Setting Option function = [my_handler]

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 = AIzaSyCWAeHwGr8pb9CnYoI-Ws34ju6oZ9yz6Zo
  • loaded =
  • option = verbose

MKP Plugins: Options reset to their defualt values

MKP Plugins: Setting Option option = [verbose]