| @@ 101-113 (lines=13) @@ | ||
| 98 | * @param mixed $context Data about the context in which the call is made. |
|
| 99 | * @return boolean Whether the shortcode UI is needed or not. |
|
| 100 | */ |
|
| 101 | protected function is_needed( $context = null ) { |
|
| 102 | ||
| 103 | $is_needed = $this->hasConfigKey( 'is_needed' ) |
|
| 104 | ? $this->getConfigKey( 'is_needed' ) |
|
| 105 | : true; |
|
| 106 | ||
| 107 | // Return true if a callable 'is_needed' evaluates to true. |
|
| 108 | if ( is_callable( $is_needed ) ) { |
|
| 109 | return $is_needed( $context ); |
|
| 110 | } |
|
| 111 | ||
| 112 | return (bool) $is_needed; |
|
| 113 | } |
|
| 114 | } |
|
| 115 | ||
| @@ 127-138 (lines=12) @@ | ||
| 124 | * @param mixed $context Data about the context in which the call is made. |
|
| 125 | * @return boolean Whether the shortcode is needed or not. |
|
| 126 | */ |
|
| 127 | protected function is_needed( $context = null ) {
|
|
| 128 | ||
| 129 | $is_needed = $this->hasConfigKey( 'is_needed' ) |
|
| 130 | ? $this->getConfigKey( 'is_needed' ) |
|
| 131 | : true; |
|
| 132 | ||
| 133 | if ( is_callable( $is_needed ) ) {
|
|
| 134 | return $is_needed( $context ); |
|
| 135 | } |
|
| 136 | ||
| 137 | return (bool) $is_needed; |
|
| 138 | } |
|
| 139 | ||
| 140 | /** |
|
| 141 | * Get the shortcode tag. |
|