Constants.php
113 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Pods\Integrations\Query_Monitor\Collectors; |
| 4 | |
| 5 | // Don't load directly. |
| 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | die( '-1' ); |
| 8 | } |
| 9 | |
| 10 | use QM_DataCollector; |
| 11 | |
| 12 | /** |
| 13 | * Class Constants |
| 14 | * |
| 15 | * @since 3.2.7 |
| 16 | */ |
| 17 | class Constants extends QM_DataCollector { |
| 18 | |
| 19 | public $id = 'pods-constants'; |
| 20 | |
| 21 | public function process() { |
| 22 | $defined_constants = []; |
| 23 | $undefined_constants = []; |
| 24 | |
| 25 | $constants = [ |
| 26 | 'PODS_ACCESS_HIDE_NOTICES', |
| 27 | 'PODS_ALLOW_FULL_META', |
| 28 | 'PODS_API_CACHE', |
| 29 | 'PODS_COMPATIBILITY', |
| 30 | 'PODS_DB_VERSION', |
| 31 | 'PODS_DEBUG_LOGGING', |
| 32 | 'PODS_DEPRECATED', |
| 33 | 'PODS_DEVELOPER', |
| 34 | 'PODS_DIR', |
| 35 | 'PODS_DISABLE_ADMIN_MENU', |
| 36 | 'PODS_DISABLE_CONTENT_MENU', |
| 37 | 'PODS_DISABLE_DYNAMIC_TEMPLATE', |
| 38 | 'PODS_DISABLE_EVAL', |
| 39 | 'PODS_DISABLE_FILE_BROWSER', |
| 40 | 'PODS_DISABLE_FILE_UPLOAD', |
| 41 | 'PODS_DISABLE_META', |
| 42 | 'PODS_DISABLE_META_BODY_CLASSES', |
| 43 | 'PODS_DISABLE_POD_PAGE_CHECK', |
| 44 | 'PODS_DISABLE_SHORTCODE', |
| 45 | 'PODS_DISABLE_SHORTCODE_SQL', |
| 46 | 'PODS_DISABLE_VERSION_OUTPUT', |
| 47 | 'PODS_DISPLAY_CALLBACKS', |
| 48 | 'PODS_DISPLAY_CALLBACKS_ALLOWED', |
| 49 | 'PODS_DYNAMIC_FEATURES_ALLOW', |
| 50 | 'PODS_DYNAMIC_FEATURES_ALLOW_SQL_CLAUSES', |
| 51 | 'PODS_DYNAMIC_FEATURES_ENABLED', |
| 52 | 'PODS_DYNAMIC_FEATURES_RESTRICT', |
| 53 | 'PODS_DYNAMIC_FEATURES_RESTRICTED', |
| 54 | 'PODS_DYNAMIC_FEATURES_RESTRICTED_FORMS', |
| 55 | 'PODS_FIELD_STRICT', |
| 56 | 'PODS_FILE', |
| 57 | 'PODS_FILE_DIRECTORY', |
| 58 | 'PODS_FILES_REQUIRE_LOGIN', |
| 59 | 'PODS_GLOBAL_POD_PAGINATION', |
| 60 | 'PODS_GLOBAL_POD_SEARCH', |
| 61 | 'PODS_GLOBAL_POD_SEARCH_MODE', |
| 62 | 'PODS_LIGHT', |
| 63 | 'PODS_MEDIA', |
| 64 | 'PODS_META_TYPES_ONLY', |
| 65 | 'PODS_MYSQL_VERSION_MINIMUM', |
| 66 | 'PODS_PHP_VERSION_MINIMUM', |
| 67 | 'PODS_PRELOAD_CONFIG_AFTER_FLUSH', |
| 68 | 'PODS_REMOTE_VIEWS', |
| 69 | 'PODS_SESSION_AUTO_START', |
| 70 | 'PODS_SHORTCODE_ALLOW_BLOG_SWITCHING', |
| 71 | 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS', |
| 72 | 'PODS_SHORTCODE_ALLOW_SUB_SHORTCODES', |
| 73 | 'PODS_SHORTCODE_ALLOW_USER_EDIT', |
| 74 | 'PODS_SHORTCODE_ALLOW_VIEWS', |
| 75 | 'PODS_SLUG', |
| 76 | 'PODS_STATS_TRACKING', |
| 77 | 'PODS_STRICT', |
| 78 | 'PODS_STRICT_MODE', |
| 79 | 'PODS_TABLELESS', |
| 80 | 'PODS_TEMPLATES_ALLOW_OTHER_SHORTCODES', |
| 81 | 'PODS_TEXTDOMAIN', |
| 82 | 'PODS_UPLOAD_REQUIRE_LOGIN', |
| 83 | 'PODS_URL', |
| 84 | 'PODS_VERSION', |
| 85 | 'PODS_WP_VERSION_MINIMUM', |
| 86 | ]; |
| 87 | |
| 88 | $undefined_text = __( 'undefined', 'pods' ); |
| 89 | |
| 90 | foreach ( $constants as $constant ) { |
| 91 | if ( defined( $constant ) ) { |
| 92 | $constant_value = constant( $constant ); |
| 93 | |
| 94 | if ( is_bool( $constant_value ) ) { |
| 95 | $constant_value = parent::format_bool_constant( $constant ); |
| 96 | } elseif ( ! is_scalar( $constant_value ) && null !== $constant_value ) { |
| 97 | $constant_value = json_encode( $constant_value, JSON_PRETTY_PRINT ); |
| 98 | } else { |
| 99 | $constant_value = (string) $constant_value; |
| 100 | } |
| 101 | |
| 102 | $defined_constants[ $constant ] = $constant_value; |
| 103 | } else { |
| 104 | $undefined_constants[ $constant ] = $undefined_text; |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | $data = array_merge( $defined_constants, $undefined_constants ); |
| 109 | |
| 110 | $this->data['constants'] = $data; |
| 111 | } |
| 112 | } |
| 113 |