| 1 |
<?php |
| 2 |
/** |
| 3 |
* The framework shortcode fields file. |
| 4 |
* |
| 5 |
* @package Smart_Post_Show |
| 6 |
* @subpackage Smart_Post_Show/admin |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
die; |
| 11 |
} // Cannot access directly. |
| 12 |
|
| 13 |
if ( ! class_exists( 'SP_PC_Field_shortcode' ) ) { |
| 14 |
/** |
| 15 |
* SP_PC_Field_shortcode |
| 16 |
*/ |
| 17 |
class SP_PC_Field_shortcode extends SP_PC_Fields { |
| 18 |
/** |
| 19 |
* Field constructor. |
| 20 |
* |
| 21 |
* @param array $field The field type. |
| 22 |
* @param string $value The values of the field. |
| 23 |
* @param string $unique The unique ID for the field. |
| 24 |
* @param string $where To where show the output CSS. |
| 25 |
* @param string $parent The parent args. |
| 26 |
*/ |
| 27 |
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) { |
| 28 |
parent::__construct( $field, $value, $unique, $where, $parent ); |
| 29 |
} |
| 30 |
/** |
| 31 |
* Render method. |
| 32 |
* |
| 33 |
* @return void |
| 34 |
*/ |
| 35 |
public function render() { |
| 36 |
// Get the Post ID. |
| 37 |
$post_id = get_the_ID(); |
| 38 |
if ( ! empty( $this->field['shortcode'] ) && 'manage_view' === $this->field['shortcode'] ) { |
| 39 |
echo ( ! empty( $post_id ) ) ? '<div class="pcp-scode-wrap-side"><p>To display your show or view, add the following shortcode into your post, custom post types, page, widget or block editor. If adding the show to your theme files, additionally include the surrounding PHP code, <a href="https://docs.shapedplugin.com/docs/post-carousel/create-your-first-post-show/add-new-post-show/#faq" target="_blank">see how</a>.</p><span class="pcp-shortcode-selectable">[smart_post_show id="' . esc_attr( $post_id ) . '"]</span></div> <div class="pcp-live-editor-promo"><h4 class="pcp-live-editor-promo__title">Want a Live Visual Editor?</h4><p class="pcp-live-editor-promo__desc">Design visually and see every change instantly. <a class="pcp-live-editor-promo__link" href="' . esc_url( admin_url( 'post-new.php?post_type=sp_post_template&spblock_inserter=true' ) ) . '">Try Block Editor ↗</a></p></div><div class="pcp-after-copy-text"><i class="fa fa-check-circle"></i> Shortcode Copied to Clipboard! </div>' : ''; |
| 40 |
} elseif ( ! empty( $this->field['shortcode'] ) && 'pro_notice' === $this->field['shortcode'] ) { |
| 41 |
if ( ! empty( $post_id ) ) { |
| 42 |
|
| 43 |
$features = array( |
| 44 |
array( |
| 45 |
'label' => __( 'Advanced Posts Query Builder', 'post-carousel' ), |
| 46 |
), |
| 47 |
array( |
| 48 |
'label' => __( 'Smart Frontend Live Filter & Search', 'post-carousel' ), |
| 49 |
'url' => 'https://wpsmartpost.com/blocks/#demoId3647', |
| 50 |
), |
| 51 |
array( |
| 52 |
'label' => __( 'Custom Archive & Single Post Builder', 'post-carousel' ), |
| 53 |
), |
| 54 |
array( |
| 55 |
'label' => __( 'Saved Templates for Post, Page, Builders', 'post-carousel' ), |
| 56 |
), |
| 57 |
array( |
| 58 |
'label' => __( '250+ Ready Designs/Patterns Library', 'post-carousel' ), |
| 59 |
'url' => 'https://wpsmartpost.com/patterns/', |
| 60 |
), |
| 61 |
array( |
| 62 |
'label' => __( '60+ Gutenberg Blocks', 'post-carousel' ), |
| 63 |
'url' => 'https://wpsmartpost.com/blocks/', |
| 64 |
), |
| 65 |
array( |
| 66 |
'label' => __( 'Modern Post Grid, List & Slider Layouts', 'post-carousel' ), |
| 67 |
'url' => 'https://wpsmartpost.com/blocks/#demoId3511', |
| 68 |
), |
| 69 |
array( |
| 70 |
'label' => __( 'Post Featured Video & Gallery Images', 'post-carousel' ), |
| 71 |
'url' => 'https://wpsmartpost.com/blocks/#demoId3514', |
| 72 |
), |
| 73 |
array( |
| 74 |
'label' => __( 'Post Highlights & Badges', 'post-carousel' ), |
| 75 |
'url' => 'https://wpsmartpost.com/blocks/#demoId3514', |
| 76 |
), |
| 77 |
array( |
| 78 |
'label' => __( 'Custom Taxonomy Image & Color', 'post-carousel' ), |
| 79 |
'url' => 'https://wpsmartpost.com/blocks/#demoId3604', |
| 80 |
), |
| 81 |
array( |
| 82 |
'label' => __( 'Post Content Drag & Drop Sorting', 'post-carousel' ), |
| 83 |
), |
| 84 |
); |
| 85 |
|
| 86 |
echo '<div class="sp_wpcp_shortcode-area pcp-pro-notice-wrapper">'; |
| 87 |
|
| 88 |
echo '<div class="pcp-pro-notice-heading">' . sprintf( |
| 89 |
/* translators: 1: start span tag wrapping the product name, 2: close tag. */ |
| 90 |
esc_html__( 'Go Pro & Unlock More! 🚀', 'post-carousel' ), |
| 91 |
) . '</div>'; |
| 92 |
|
| 93 |
echo '<p>Unlock the full potential of Smart Post Pro and build beautiful blog & news layouts in minutes.</p>'; |
| 94 |
|
| 95 |
echo '<ul class="pcp-pro-notice-features">'; |
| 96 |
foreach ( $features as $feature ) { |
| 97 |
echo '<li>'; |
| 98 |
echo '<span class="pcp-pro-feature__icon">'; |
| 99 |
echo '<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.47461 1.24707C6.85097 3.76847 8.83144 5.7481 11.3525 6.125L12.5225 6.2998L11.3525 6.47461C8.83157 6.85179 6.85112 8.83112 6.47461 11.3525L6.2998 12.5225L6.125 11.3525C5.74845 8.83092 3.76819 6.85166 1.24707 6.47461L0.0761719 6.2998L1.24707 6.125C3.76832 5.74824 5.7486 3.76856 6.125 1.24707L6.2998 0.0761719L6.47461 1.24707Z" fill="#641DD7" stroke="#641DD7" stroke-width="0.0224423"/></svg>'; // phpcs:ignore -- No user input. |
| 100 |
echo '</span>'; |
| 101 |
|
| 102 |
if ( ! empty( $feature['url'] ) ) { |
| 103 |
echo '<a class="pcp-pro-feature__link" href="' . esc_url( $feature['url'] ) . '" target="_blank" rel="noopener">'; |
| 104 |
echo esc_html( $feature['label'] ); |
| 105 |
echo '<svg class="pcp-pro-feature__arrow" width="9" height="9" viewBox="0 0 9 9" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M.75 7.417 7.417.75m0 5.128V.75H2.288" stroke="#2f2f2f" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>'; |
| 106 |
echo '</a>'; |
| 107 |
} else { |
| 108 |
echo '<span class="pcp-pro-feature__label">' . esc_html( $feature['label'] ) . '</span>'; |
| 109 |
} |
| 110 |
echo '</li>'; |
| 111 |
} |
| 112 |
echo '</ul>'; |
| 113 |
|
| 114 |
echo '<div class="pcp-pro-notice-button">'; |
| 115 |
echo '<a class="pcp-open-live-demo" href="https://wpsmartpost.com/pricing/?ref=1" target="_blank" rel="noopener">'; |
| 116 |
echo '<span class="sp-go-pro-icon"></span>'; |
| 117 |
echo '<span>' . esc_html__( 'Upgrade to Pro Now', 'post-carousel' ) . '</span>'; |
| 118 |
echo '</a>'; |
| 119 |
echo '</div>'; |
| 120 |
|
| 121 |
echo '</div>'; |
| 122 |
} |
| 123 |
} else { |
| 124 |
echo ( ! empty( $post_id ) ) ? '<div class="pcp-scode-wrap-side"><p>Smart Post Show has seamless integration with Gutenberg, Classic Editor, <strong>Elementor,</strong> Divi, Bricks, Beaver, Oxygen, WPBakery Builder, etc.</p></div>' : ''; |
| 125 |
} |
| 126 |
} |
| 127 |
} |
| 128 |
} |
| 129 |
|