auto-template
4 months ago
element-pod_reference-content.php
4 months ago
element-pod_reference.php
4 months ago
element-view_template.php
4 months ago
functions-pod_reference.php
4 months ago
functions-view_template.php
4 months ago
element-view_template.php
59 lines
| 1 | <?php |
| 2 | |
| 3 | // Don't load directly. |
| 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | die( '-1' ); |
| 6 | } |
| 7 | |
| 8 | // phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound |
| 9 | |
| 10 | /** |
| 11 | * Frontier Template code editor metabox |
| 12 | * |
| 13 | * @package Pods_templates |
| 14 | */ |
| 15 | |
| 16 | $has_php = false; |
| 17 | |
| 18 | $pods_output = ''; |
| 19 | |
| 20 | if ( isset( $content ) && is_string( $content ) ) { |
| 21 | $has_php = false !== strpos( $content, '<?' ); |
| 22 | |
| 23 | // WordPress will already call esc_textarea() if richedit is off, don't escape twice (see #3462) |
| 24 | if ( ! user_can_richedit() ) { |
| 25 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 26 | $pods_output = $content; |
| 27 | } else { |
| 28 | $pods_output = esc_textarea( $content ); |
| 29 | } |
| 30 | } |
| 31 | ?> |
| 32 | <?php if ( $has_php && pods_eval_show_errors() ) : ?> |
| 33 | <?php |
| 34 | pods_deprecated( 'Pod Template PHP code has been deprecated, please use WP Templates instead of embedding PHP.', '2.3' ); |
| 35 | |
| 36 | pods_message( |
| 37 | sprintf( |
| 38 | ' |
| 39 | <p><strong>%1$s:</strong> %2$s</p> |
| 40 | <p><a href="%3$s" target="_blank" rel="noopener noreferrer">%4$s</a> | <a href="%5$s" target="_blank" rel="noopener noreferrer">%6$s</a></p> |
| 41 | ', |
| 42 | esc_html__( 'Pod Template Error', 'pods' ), |
| 43 | esc_html__( 'This template contains PHP code that will not run due to security restrictions in Pods.', 'pods' ), |
| 44 | 'https://docs.pods.io/displaying-pods/pod-template-hierarchy-for-themes/', |
| 45 | esc_html__( 'Read more about file-based templates', 'pods' ), |
| 46 | admin_url( 'admin.php?page=pods-components' ), |
| 47 | esc_html__( 'Switch to file-based Pod Templates using our Migrate PHP into File-based templates component', 'pods' ) |
| 48 | ), |
| 49 | 'error', |
| 50 | false, |
| 51 | false |
| 52 | ); |
| 53 | ?> |
| 54 | <?php endif; ?> |
| 55 | |
| 56 | <div class="pods-compat-container"> |
| 57 | <textarea id="content" name="content"><?php echo $pods_output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></textarea> |
| 58 | </div> |
| 59 |