GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Static Public Member Functions | Data Fields | Private Member Functions | Static Private Attributes
GVLogic_Shortcode Class Reference

Shortcode to handle showing/hiding content in merge tags. More...

Public Member Functions

 add_hooks ()
 Register the shortcode. More...
 
 get_operators ($with_values=false)
 Get array of supported operators. More...
 
 set_operation ($operation= '')
 Set the operation for the shortcode. More...
 
 shortcode ($atts=array(), $content=NULL, $shortcode_tag= '')
 

Static Public Member Functions

static get_instance ()
 Instantiate! More...
 

Data Fields

 $atts = array()
 
 $comparison = ''
 
 $content = ''
 
 $else_content = ''
 
 $if = ''
 
 $is_match = false
 
 $operation = 'is'
 
 $passed_atts
 
 $passed_content
 
 $shortcode = 'gvlogic'
 

Private Member Functions

 __construct ()
 Add the WordPress hooks. More...
 
 get_output ()
 Get the output for the shortcode, based on whether there's a matched value. More...
 
 parse_atts ()
 Process the attributes passed to the shortcode. More...
 
 set_content_and_else_content ()
 Check for [else] tag inside the shortcode content. More...
 
 set_is_match ()
 Does the if and the comparison match? GVCommon::matches_operation. More...
 
 setup_operation_and_comparison ()
 Set the operation and comparison for the shortcode. More...
 

Static Private Attributes

static $instance
 
static $SUPPORTED_ARRAY_OPERATORS = array( 'in', 'not_in', 'isnot', 'contains' )
 
static $SUPPORTED_CUSTOM_OPERATORS = array( 'equals', 'greater_than_or_is', 'greater_than_or_equals', 'less_than_or_is', 'less_than_or_equals', 'not_contains' )
 
static $SUPPORTED_NUMERIC_OPERATORS = array( 'greater_than', 'less_than' )
 
static $SUPPORTED_SCALAR_OPERATORS = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' )
 

Detailed Description

Shortcode to handle showing/hiding content in merge tags.

Works great with GravityView Custom Content fields

Definition at line 6 of file class-gvlogic-shortcode.php.

Constructor & Destructor Documentation

__construct ( )
private

Add the WordPress hooks.

Returns
void

Definition at line 99 of file class-gvlogic-shortcode.php.

References add_hooks().

Member Function Documentation

add_hooks ( )

Register the shortcode.

Returns
void

Definition at line 107 of file class-gvlogic-shortcode.php.

Referenced by __construct().

static get_instance ( )
static

Instantiate!

Returns
GVLogic_Shortcode

Definition at line 86 of file class-gvlogic-shortcode.php.

Referenced by parse_atts().

get_operators (   $with_values = false)

Get array of supported operators.

Parameters
bool$with_values
Returns
array

Definition at line 117 of file class-gvlogic-shortcode.php.

Referenced by parse_atts(), and set_operation().

get_output ( )
private

Get the output for the shortcode, based on whether there's a matched value.

Returns
string HTML/Text output of the shortcode
Runs Filter:
gravityview/gvlogic/output Modify the [gvlogic] output
Parameters
string$outputHTML/text output
GVLogic_Shortcode$thisThis class

Definition at line 246 of file class-gvlogic-shortcode.php.

References $content, $else_content, and $output.

Referenced by shortcode().

parse_atts ( )
private

Process the attributes passed to the shortcode.

Make sure they're valid

Returns
void

Definition at line 291 of file class-gvlogic-shortcode.php.

References $atts, get_instance(), get_operators(), and shortcode().

Referenced by shortcode().

set_content_and_else_content ( )
private

Check for [else] tag inside the shortcode content.

If exists, set the else_content variable. If not, use the else attribute passed by the shortcode, if exists.

Returns
void

Definition at line 276 of file class-gvlogic-shortcode.php.

Referenced by shortcode().

set_is_match ( )
private

Does the if and the comparison match? GVCommon::matches_operation.

Returns
boolean True: yep; false: nope

Definition at line 237 of file class-gvlogic-shortcode.php.

References GVCommon\matches_operation().

Referenced by shortcode().

set_operation (   $operation = '')

Set the operation for the shortcode.

Parameters
string$operation
Returns
bool True: it's an allowed operation type and was added. False: invalid operation type

Definition at line 138 of file class-gvlogic-shortcode.php.

References $operation, and get_operators().

Referenced by setup_operation_and_comparison().

setup_operation_and_comparison ( )
private

Set the operation and comparison for the shortcode.

Loop through each attribute passed to the shortcode and see if it's a valid operator. If so, set it. Example: [gvlogic if="{example}" greater_than="5"] greater_than will be set as the operator 5 will be set as the comparison value

Returns
bool True: we've got an operation and comparison value; False: no, we don't

Definition at line 165 of file class-gvlogic-shortcode.php.

References $value, and set_operation().

Referenced by shortcode().

shortcode (   $atts = array(),
  $content = NULL,
  $shortcode_tag = '' 
)
Parameters
array$attsUser defined attributes in shortcode tag.
null$content
string$shortcode_tag
Returns
string|null

Definition at line 187 of file class-gvlogic-shortcode.php.

References $atts, $content, $output, get_output(), GravityView_Plugin\is_admin(), parse_atts(), set_content_and_else_content(), set_is_match(), and setup_operation_and_comparison().

Referenced by parse_atts().

Field Documentation

$atts = array()

Definition at line 32 of file class-gvlogic-shortcode.php.

Referenced by parse_atts(), and shortcode().

$comparison = ''

Definition at line 63 of file class-gvlogic-shortcode.php.

$content = ''

Definition at line 38 of file class-gvlogic-shortcode.php.

Referenced by get_output(), and shortcode().

$else_content = ''

Definition at line 45 of file class-gvlogic-shortcode.php.

Referenced by get_output().

$if = ''

Definition at line 57 of file class-gvlogic-shortcode.php.

$instance
staticprivate

Definition at line 80 of file class-gvlogic-shortcode.php.

$is_match = false

Definition at line 75 of file class-gvlogic-shortcode.php.

$operation = 'is'

Definition at line 69 of file class-gvlogic-shortcode.php.

Referenced by set_operation().

$passed_atts

Definition at line 20 of file class-gvlogic-shortcode.php.

$passed_content

Definition at line 26 of file class-gvlogic-shortcode.php.

$shortcode = 'gvlogic'

Definition at line 51 of file class-gvlogic-shortcode.php.

$SUPPORTED_ARRAY_OPERATORS = array( 'in', 'not_in', 'isnot', 'contains' )
staticprivate

Definition at line 12 of file class-gvlogic-shortcode.php.

$SUPPORTED_CUSTOM_OPERATORS = array( 'equals', 'greater_than_or_is', 'greater_than_or_equals', 'less_than_or_is', 'less_than_or_equals', 'not_contains' )
staticprivate

Definition at line 14 of file class-gvlogic-shortcode.php.

$SUPPORTED_NUMERIC_OPERATORS = array( 'greater_than', 'less_than' )
staticprivate

Definition at line 10 of file class-gvlogic-shortcode.php.

$SUPPORTED_SCALAR_OPERATORS = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' )
staticprivate

Definition at line 8 of file class-gvlogic-shortcode.php.


The documentation for this class was generated from the following file: