Class ShrimpTest_Variant_Shortcode

Description

ShrimpTest Shortcode variant type class

An object-oriented variant type specification. This class name is handed to register_shrimptest_variant_type() at the end of this file so it is registered.

Many of the properties in the resulting object are there as register_shrimptest_variant_type() expects them.

Located in /plugins/variant-shortcode.php (line 23)


	
			
Variable Summary
Method Summary
ShrimpTest_Variant_Shortcode ShrimpTest_Variant_Shortcode (ShrimpTest $shrimptest_instance)
void add_buttons ()
string add_id_to_shortcode (array $matches)
array add_tinymce_script (array $plugins)
void cleanup_experiments (int $meta_id, int $object_id, string $meta_key, string $meta_value)
string detection_filter (string $content)
void edit_helper ()
string process_detected_shortcode (array $args, string $content)
array register_button (array $buttons)
void setup_buttons ()
string shortcode_handler (array $args)
Variables
mixed (line 29)
array $detected_experiment_ids = array( ) (line 53)

An array of detected experiment ids

string $experiment_ids_meta_key = '_shrimptest_shortcode_experiments' (line 47)

A meta key for storing experiment ids attached to an experiment

string $label = __('Shortcode' (line 29)

The user-facing label for the variant

string $shortcode = 'ab' (line 41)

The shortcode string

bool $_programmatic = true (line 35)

This variant type can only be set programmatically

Methods
Constructor ShrimpTest_Variant_Shortcode (line 62)

Constructor

Registers a number of actions

ShrimpTest_Variant_Shortcode ShrimpTest_Variant_Shortcode (ShrimpTest $shrimptest_instance)
add_buttons (line 336)

Add A/B button in the editor

some code based on Ratings Shorttags by Joen Asmussen, GPL

void add_buttons ()
add_id_to_shortcode (line 127)

Take [ab] shortcodes found in the content and insert the appropriate experiment id

string add_id_to_shortcode (array $matches)
  • array $matches
add_tinymce_script (line 363)

Add JavaScript-importing code for tinymce

array add_tinymce_script (array $plugins)
  • array $plugins
admin_add_variant_extra (line 279)

Print a message in the variants extra of the 'Add new experiment' screen for experiments using this variant type

  • todo: add a real link to this message.
void admin_add_variant_extra ()
admin_script_and_style (line 288)

Print styling and JavaScript for the 'Add new experiment' screen

void admin_script_and_style ()
cleanup_experiments (line 254)

Cleanup experiment ids which have been removed

  • todo: only delete if this experiment isn't used elsewhere
void cleanup_experiments (int $meta_id, int $object_id, string $meta_key, string $meta_value)
  • int $meta_id
  • int $object_id
  • string $meta_key
  • string $meta_value
detection_filter (line 96)

Check to find [ab] shortcodes in the content and modify the content if necessary.

string detection_filter (string $content)
  • string $content
edit_helper (line 316)

Print a message at the top of edit post/page screens alerting the user to inactive [ab] shortcode experiments on the screen.

void edit_helper ()
process_detected_shortcode (line 175)

Registers and updates experiments based on detected shortcodes

string process_detected_shortcode (array $args, string $content)
  • array $args
  • string $content
register_button (line 374)

Register the abtest button with tinymce

array register_button (array $buttons)
  • array $buttons
setup_buttons (line 383)

Print the #shrimptest_variant_shortcode div which is displayed as an overlay when the button is pressed.

void setup_buttons ()
shortcode_handler (line 148)

Handle found [ab] shortcodes

string shortcode_handler (array $args)
  • array $args

Documentation generated on Sat, 04 Sep 2010 23:40:58 -0400 by phpDocumentor 1.4.3