GravityMath_Report
Class GravityMath_Report
Source: includes/class-gravitymath-report.php:9
Details
- Kind:
class - Namespace:
(global)
Methods
| Method | Description |
|---|---|
get_instance() | Get the instance of the class. |
add_gf_logging() | Adds Math by GravityView to the plugins shown in the Logging screen. |
register_scripts() | Enqueue the script to enhance GV Math debugging output. |
add_report_links() | Add links to the reports. |
add_shortcode_debugging() | Add reporting for a shortcode. |
report_errors() | Include errors and warnings after the_content. |
log_from_action() | Add Errors to GFLogging and if debug is on, store for output. |
add_index() | Foreach gv_math shortcode on a post add it to the index. |
get_current_index() | Get current position for the debug index this fires early so later use will require -1. |
add_alert() | Add Errors to the Alert array only if debugging is on. |
get_error_message() | Get Error messages for supplied or current index. |
get_alert_messages() | Get all Errors, Notices and Warnings. |
get_warning_message() | Get Warning messages for supplied or current index. |
get_notice_messages() | Get Notice messages for supplied or current index. |
has_errors() | Are there errors? |
has_warnings() | Are there warnings? |
get_skip_flag() | Get the skip status for the current formula being processed. |
set_skip_flag() | Set a flag when a formula should not be processed. |
get_debug_link() | Get the link or signify a notice. |
is_debug_active() | Check if the supplied index has debugging on. |
filter_notices() | Only output final notice message if requested. |
suppress_alerts() | Should errors be suppressed? |
Method Reference
get_instance()
public static function get_instance()
Get the instance of the class.
Returns
Since: 1.0
Source: includes/class-gravitymath-report.php:70
add_gf_logging()
public function add_gf_logging( $plugins=[] )
Adds Math by GravityView to the plugins shown in the Logging screen.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$plugins | array | [] | Associative array, with key set to the logging key and value set to the displayed name. |
Returns
array
Since: 2.0
Source: includes/class-gravitymath-report.php:133
register_scripts()
public function register_scripts()
Enqueue the script to enhance GV Math debugging output.
Since: 1.0
Source: includes/class-gravitymath-report.php:144
add_report_links()
function add_report_links( $result, $atts, $content, $shortcode, $object, $nesting_level )
Add links to the reports.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$result | string | Shortcode output. | |
$atts | array | Shortcode parameters. | |
$content | string | Content passed to the shortcode. | |
$shortcode | string | gv_math | Shortcode used (default: gv_math). |
$object | |||
$nesting_level | int | Level of shortcode nesting. | |
$this | GravityMath_Shortcode | Current object. |
Returns
string— Original result with debugging links appended, if notices are enabled
Since: 1.0
Source: includes/class-gravitymath-report.php:162
add_shortcode_debugging()
public function add_shortcode_debugging( $formula, $atts, $content, $shortcode, $object )
Add reporting for a shortcode.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$formula | string | The math formula to modify. | |
$atts | array | Shortcode parameters. | |
$content | string | Content passed to the shortcode. | |
$shortcode | string | gv_math | Shortcode used (default: gv_math). |
$object | GravityMath_Shortcode | Current object. |
Returns
string— Original formula, not modified.
Since: 1.0
Source: includes/class-gravitymath-report.php:201
report_errors()
public function report_errors( $content )
Include errors and warnings after the_content.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$content | string | Existing post content. |
Returns
string— Post content with errors/warnings appended, if any.
Since: 1.0
Source: includes/class-gravitymath-report.php:309
log_from_action()
public function log_from_action( $message='', $data=[] )
Add Errors to GFLogging and if debug is on, store for output.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$message | string | '' | |
$data | array | [] |
Returns
void
Since: 1.0
Source: includes/class-gravitymath-report.php:376
add_index()
public function add_index( $debug_value=false )
Foreach gv_math shortcode on a post add it to the index.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$debug_value | bool | false |
Returns
void
Since: 1.0
Source: includes/class-gravitymath-report.php:579
get_current_index()
public function get_current_index( $already_advanced=false )
Get current position for the debug index this fires early so later use will require -1.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$already_advanced | false |
Returns
int
Since: 1.0
Source: includes/class-gravitymath-report.php:601
add_alert()
public function add_alert( $type, $alert, $line_number=0 )
Add Errors to the Alert array only if debugging is on.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$type | string | Type of alert to add: 'warnings', 'notices' or 'errors'. Default: 'warnings'. | |
$alert | WP_Error | array | The alert to add. | |
$line_number | int | 0 | The line number of the shortcode. |
Returns
void
Since:
1.02.0(Added 'notices' alert type, changed $alert parameter type to WP_Error|array, and removed requirement for debug to be enabled)
Source: includes/class-gravitymath-report.php:624
get_error_message()
public function get_error_message( $index )
Get Error messages for supplied or current index.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$index | int | requested shortcode. |
Returns
array— Errors, with stored errors added.
See Also
Since: 1.0
Source: includes/class-gravitymath-report.php:645
get_alert_messages()
public function get_alert_messages( $type='all' )
Get all Errors, Notices and Warnings.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$type | string | 'all' | Type of alerts to get. Options: 'all', 'errors', 'notices', 'warnings'. Default: 'all'. |
Returns
array
Since:
Source: includes/class-gravitymath-report.php:719
get_warning_message()
public function get_warning_message( $index )
Get Warning messages for supplied or current index.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$index | int | current shortcode being requested |
Returns
array
See Also
Since: 1.0
Source: includes/class-gravitymath-report.php:760
get_notice_messages()
public function get_notice_messages( $index )
Get Notice messages for supplied or current index.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$index | int | current shortcode being requested. |
Returns
array
See Also
Since: 2.0
Source: includes/class-gravitymath-report.php:793
has_errors()
public function has_errors()
Are there errors?
Returns
bool— true: Yes, there are. False: nope!
Since: 1.0
Source: includes/class-gravitymath-report.php:820
has_warnings()
public function has_warnings()
Are there warnings?
Returns
bool— true: Yes, there are. False: nope!
Since: 1.0
Source: includes/class-gravitymath-report.php:851
get_skip_flag()
public function get_skip_flag()
Get the skip status for the current formula being processed.
Returns
bool
Since: 1.0
Source: includes/class-gravitymath-report.php:864
set_skip_flag()
public function set_skip_flag( $flag=false )
Set a flag when a formula should not be processed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$flag | bool | false | True: don't process. False: process. |
Returns
bool
Since: 1.0
Source: includes/class-gravitymath-report.php:877
get_debug_link()
public function get_debug_link( $index, $debug_caps=false )
Get the link or signify a notice.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$index | int | The index of the shortcode. | |
$debug_caps | bool | false | Whether the user has debug capabilities. |
Returns
string
Since: 1.0
Source: includes/class-gravitymath-report.php:891
is_debug_active()
public function is_debug_active( $index=0 )
Check if the supplied index has debugging on.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$index | int | 0 | The index of the shortcode. |
Returns
bool
Since: 1.0
Source: includes/class-gravitymath-report.php:924
filter_notices()
public function filter_notices( $message=[] )
Only output final notice message if requested.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$message | array | [] |
Returns
array
Since: 2.0
Source: includes/class-gravitymath-report.php:949
suppress_alerts()
public function suppress_alerts()
Should errors be suppressed?
Returns
bool— True: don't show the errors. False: show the errors. Default: false
Since: 1.0
Source: includes/class-gravitymath-report.php:992