-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathController_Shortcodes.php
More file actions
100 lines (85 loc) · 2.46 KB
/
Copy pathController_Shortcodes.php
File metadata and controls
100 lines (85 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
namespace GFPDF\Controller;
use GFPDF\Helper\Helper_Abstract_Controller;
use GFPDF\Helper\Helper_Abstract_Model;
use GFPDF\Helper\Helper_Abstract_View;
use GFPDF\Helper\Helper_Interface_Filters;
use GFPDF\Model\Model_Shortcodes;
use GFPDF\View\View_Shortcodes;
use GFPDF_Vendor\Psr\Log\LoggerInterface;
/**
* @package Gravity PDF
* @copyright Copyright (c) 2026, Blue Liquid Designs
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*/
/* Exit if accessed directly */
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Controller_PDF
* Handles the PDF display and authentication
*
* @since 4.0
*/
class Controller_Shortcodes extends Helper_Abstract_Controller implements Helper_Interface_Filters {
/**
* Holds our log class
*
* @var LoggerInterface
* @since 4.0
*/
protected $log;
/**
* Setup our class by injecting all our dependencies
*
* @param Helper_Abstract_Model|Model_Shortcodes $model Our Shortcodes Model the controller will manage
* @param Helper_Abstract_View|View_Shortcodes $view Our Shortcodes View the controller will manage
* @param LoggerInterface $log Our logger class
*
* @since 4.0
*/
public function __construct( Helper_Abstract_Model $model, Helper_Abstract_View $view, LoggerInterface $log ) {
/* Assign our internal variables */
$this->log = $log;
/* Load our model and view */
$this->model = $model;
$this->model->setController( $this );
$this->view = $view;
$this->view->setController( $this );
}
/**
* Initialise our class defaults
*
* @return void
* @since 4.0
*
*/
public function init() {
$this->add_filters();
$this->add_shortcodes();
}
/**
* Apply any filters needed for the settings page
*
* @return void
* @since 4.0
*/
public function add_filters() {
add_filter( 'gform_admin_pre_render', [ $this->model, 'gravitypdf_redirect_confirmation' ] );
add_filter( 'gform_confirmation', [ $this->model, 'gravitypdf_redirect_confirmation_shortcode_processing' ], 10, 3 );
add_filter( 'gform_pre_replace_merge_tags', [ $this->model, 'gravitypdf_process_during_merge_tag_replacement' ], 10, 3 );
/* Basic GravityView Support */
add_filter( 'gravityview/fields/custom/content_before', [ $this->model, 'gravitypdf_gravityview_custom' ], 10 );
}
/**
* Register our shortcodes
*
* @return void
* @since 4.0
*
*/
public function add_shortcodes() {
add_shortcode( 'gravitypdf', [ $this->model, 'process' ] );
}
}