Skip to content

Commit

Permalink
Add more notices when using precode or page code
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Sep 28, 2024
1 parent e2912e0 commit 86ef953
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions components/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,22 @@ public function register_config() {
'label' => __( 'Page Title', 'pods' ),
'type' => 'text',
],
[
'name' => 'code_php_notice',
'type' => 'html',
'html_content' => sprintf(
'<p>⚠️&nbsp;&nbsp;%1s - <a href="%2$s" target="_blank" rel="noopener noreferrer">%3$s</a></p>',
__( 'PHP detected, this feature is deprecated', 'pods' ),
'https://docs.pods.io/displaying-pods/pod-page-template-hierarchy-for-themes/',
__( 'Switch to file-based Pod Pages', 'pods' )
),
'wildcard-on' => [
'code' => [
'\?>',
'<\?',
],
],
],
[
'name' => 'code',
'label' => __( 'Page Code', 'pods' ),
Expand All @@ -213,6 +229,19 @@ public function register_config() {
],
],
],
[
'name' => 'precode_notice',
'type' => 'html',
'html_content' => sprintf(
'<p>⚠️&nbsp;&nbsp;%1s - <a href="%2$s" target="_blank" rel="noopener noreferrer">%3$s</a></p>',
__( 'Precode detected, this feature is deprecated', 'pods' ),
'https://docs.pods.io/displaying-pods/pod-page-template-hierarchy-for-themes/',
__( 'Switch to file-based Pod Pages', 'pods' )
),
'excludes-on' => [
'precode' => '',
],
],
[
'name' => 'precode',
'label' => __( 'Page Precode', 'pods' ),
Expand All @@ -226,7 +255,7 @@ public function register_config() {
'type' => 'pick',
'pick_object' => 'custom-simple',
'pick_format_type' => 'single',
'pick_format_single' => 'dropdown',
'pick_format_single' => 'dropdown',
'data' => $page_templates,
'override_object_field' => true,
],
Expand Down Expand Up @@ -691,14 +720,14 @@ public function edit_page_form() {
}

if ( $has_precode ) {
pods_deprecated( 'Pod Page PHP precode has been deprecated, please use WP Page Templates or hook into the pods_content filter instead of embedding PHP.', '2.1' );
pods_deprecated( 'Pod Page precode has been deprecated, please use WP Page Templates or hook into the pods_content filter instead of embedding PHP.', '2.1' );

if ( PODS_DISABLE_EVAL ) {
pods_message(
sprintf(
'<p><strong>%1$s:</strong> %2$s</p><p><a href="%3$s" target="_blank" rel="noopener noreferrer">%4$s</a></p>',
__( 'Pod Page Error', 'pods' ),
__( 'This Pod Page contains PHP precode that will not run due to security restrictions in Pods. To enable PHP code, you must configure your website to allow PHP by setting the constant PODS_DISABLE_EVAL to false.', 'pods' ),
__( 'This Pod Page contains precode (deprecated) that will not run due to security restrictions in Pods. To enable PHP code, you must configure your website to allow PHP by setting the constant PODS_DISABLE_EVAL to false.', 'pods' ),
'https://docs.pods.io/displaying-pods/pod-page-template-hierarchy-for-themes/',
__( 'Switch to file-based Pod Pages', 'pods' )
),
Expand All @@ -711,7 +740,7 @@ public function edit_page_form() {
sprintf(
'<p><strong>%1$s:</strong> %2$s</p><p><a href="%3$s" target="_blank" rel="noopener noreferrer">%4$s</a></p>',
__( 'Pod Page Warning', 'pods' ),
__( 'This Pod Page contains PHP precode that will no longer run in Pods 3.3+.', 'pods' ),
__( 'This Pod Page contains precode which is deprecated -- it will no longer run in Pods 3.3+.', 'pods' ),
'https://docs.pods.io/displaying-pods/pod-page-template-hierarchy-for-themes/',
__( 'Switch to file-based Pod Pages', 'pods' )
),
Expand Down

0 comments on commit 86ef953

Please sign in to comment.