PluginProbe
Lasso Lite – Affiliate Link Manager & Product Displays / 108
Lasso Lite – Affiliate Link Manager & Product Displays v108
157 155 156 154 153 152 151 150 149 148 trunk 0.9.9 104 105 106 107 108 109 110 111 112 113 114 115 116 All 56 releases
simple-urls / classes / class-shortcode.php

class-shortcode.php in Lasso Lite – Affiliate Link Manager & Product Displays 108, at classes/class-shortcode.php

62 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Declare class Shortcode
4 *
5 * @package Page
6 */
7
8 namespace LassoLite\Classes;
9
10 use LassoLite\Classes\Helper;
11 use Lasso_Shortcode;
12
13 /**
14 * Shortcode
15 */
16 class Shortcode {
17
18 const LASSO_PRO_POST_TYPE = 'lasso-urls';
19
20 /**
21 * Lasso Display Boxes
22 *
23 * @param array $attr Attributes of shortcode.
24 */
25 public function lasso_lite_core_shortcode( $attr ) {
26 $post_id = $attr['id'] ?? '';
27
28 // ? Lasso Lite must be having "id" parameter
29 if ( ! $post_id ) {
30 return false;
31 }
32
33 $post = get_post( $post_id );
34 // ? Check existing post
35 if ( is_null( $post ) ) {
36 return false;
37 }
38
39 // ? Check case Lasso Lite deleted
40 if ( 'trash' === $post->post_status ) {
41 return false;
42 }
43
44 // ? Check post_type is Lasso Lite or not
45 if ( SIMPLE_URLS_SLUG !== $post->post_type ) {
46 if ( class_exists( 'Lasso_Shortcode' ) ) {
47 $shortcode_pro = new Lasso_Shortcode();
48 return $shortcode_pro->lasso_core_shortcode( $attr );
49 }
50 return false;
51 }
52
53 // ? Check post_type surl to execute shortcode correctly
54 if ( SIMPLE_URLS_SLUG === $post->post_type ) {
55 // ? Default single-style display box
56 return Helper::include_with_variables( Helper::get_path_views_folder() . 'displays/single.php', array( 'post' => $post ) );
57 }
58
59 return false;
60 }
61 }
62