Version Description
- Added index.php to directories to disable directory browsing.
- Fixed typo in popup action class name for receiving updates.
- Fixed extensions update process.
Download this release
Release Info
Developer | yuvalsabar |
Plugin | Contact Form 7 Redirection |
Version | 2.3.1 |
Comparing to | |
See all releases |
Code changes from version 2.3.0 to 2.3.1
- build/css/index.php +0 -0
- build/images/index.php +0 -0
- build/index.php +0 -0
- build/js/index.php +0 -0
- class-wpcf7-redirect.php +4 -0
- classes/actions/class-wpcf7r-action-firescript.php +83 -83
- classes/actions/class-wpcf7r-action-honeypot.php +163 -163
- classes/actions/class-wpcf7r-action-redirect.php +280 -280
- classes/actions/class-wpcf7r-action-save-lead.php +168 -168
- classes/actions/class-wpcf7r-action-send-to-api.php +409 -409
- classes/actions/class-wpcf7r-action-sendmail.php +180 -180
- classes/actions/html/html-action-redirect.php +13 -13
- classes/actions/html/html-action-send-to-email.php +13 -13
- classes/actions/html/html-page-settings.php +19 -19
- classes/actions/html/index.php +5 -5
- classes/actions/html/rule-title.php +23 -23
- classes/aff/class-ext-accessibe.php +627 -627
- classes/aff/index.php +0 -0
- classes/aff/templates/accesibie-content.php +165 -165
- classes/aff/templates/index.php +0 -0
- classes/class-qs-api.php +34 -8
- classes/class-wpcf7r-action.php +6 -0
- classes/class-wpcf7r-actions-list.php +102 -102
- classes/class-wpcf7r-extension.php +39 -4
- classes/class-wpcf7r-form-helper.php +98 -2
- classes/class-wpcf7r-form.php +651 -651
- classes/class-wpcf7r-html.php +11 -6
- classes/class-wpcf7r-lead.php +197 -197
- classes/class-wpcf7r-leads-manager.php +422 -422
- classes/class-wpcf7r-list-table.php +133 -133
- classes/class-wpcf7r-mailchimp-helper.php +1 -0
- classes/class-wpcf7r-module.php +77 -77
- classes/class-wpcf7r-post-types.php +221 -221
- classes/class-wpcf7r-settings.php +303 -303
- classes/class-wpcf7r-updates.php +146 -146
- classes/class-wpcf7r-user.php +117 -117
- classes/class-wpcf7r-utils.php +1080 -1080
- modules/cf7-shortcode-password-field.php +224 -224
- modules/cf7r-shortcode-get-param-field.php +29 -29
- readme.txt +6 -1
- templates/banner.php +16 -16
- templates/block-html.php +8 -8
- templates/block-title.php +16 -16
- templates/default-settings.php +69 -69
- templates/extensions.php +26 -26
- templates/extensions/extension-promo-box.php +81 -81
- templates/extensions/extensions-table.php +21 -21
- templates/extensions/index.php +0 -0
- templates/fields/field-button.php +18 -18
- templates/fields/field-checkbox.php +23 -23
- templates/fields/field-download.php +29 -29
- templates/fields/field-editor.php +37 -37
- templates/fields/field-json-editor.php +22 -22
- templates/fields/field-leads-mapping.php +73 -73
- templates/fields/field-media.php +30 -30
- templates/fields/field-notice.php +17 -17
- templates/fields/field-number.php +25 -25
- templates/fields/field-page-select.php +35 -35
- templates/fields/field-password.php +28 -28
- templates/fields/field-post-author-select.php +25 -25
- templates/fields/field-post-type-select.php +28 -28
- templates/fields/field-preview.php +11 -11
- templates/fields/field-repeater.php +90 -90
- templates/fields/field-rule-blocks.php +38 -38
- templates/fields/field-select.php +31 -31
- templates/fields/field-tags-map.php +76 -76
- templates/fields/field-taxonomy.php +26 -26
- templates/fields/field-text.php +41 -41
- templates/fields/field-textarea.php +33 -33
- templates/fields/field-url.php +23 -23
- templates/fields/index.php +2 -2
- templates/index.php +2 -2
- templates/popup-api-test.php +74 -74
- templates/save-form.php +21 -21
- templates/settings.php +28 -28
- vendor/composer/installed.json +49 -49
- vendor/index.php +0 -0
- vendor/jhut89/mailchimp3php/CODE_OF_CONDUCT.md +46 -46
- vendor/jhut89/mailchimp3php/PULL_REQUEST_TEMPLATE.md +12 -12
- vendor/jhut89/mailchimp3php/README.md +401 -401
- vendor/jhut89/mailchimp3php/composer.json +28 -28
- vendor/jhut89/mailchimp3php/composer.lock +1460 -1460
- wpcf7-redirect.php +2 -2
- wpcf7r-functions.php +10 -2
build/css/index.php
ADDED
File without changes
|
build/images/index.php
ADDED
File without changes
|
build/index.php
ADDED
File without changes
|
build/js/index.php
ADDED
File without changes
|
class-wpcf7-redirect.php
CHANGED
@@ -43,11 +43,15 @@ class Wpcf7_Redirect {
|
|
43 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_PAGE_URL', $base_url );
|
44 |
define( 'WPCF7_PRO_REDIRECT_DEBUG_URL', $base_url . 'wp-json/api-v1/debug' );
|
45 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_ACTIVATION_URL', $base_url . 'wp-admin/admin-ajax.php' );
|
|
|
46 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_UPDATES', $base_url . 'wp-json/api-v1/check-for-updates/' );
|
|
|
47 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_EXTENSIONS_LIST_URL', $base_url . 'wp-json/api-v1/extensions_list/' );
|
48 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_PROMOTIONS_URL', $base_url . 'wp-json/api-v1/promotions/' );
|
49 |
define( 'ACCESSIBE_API_URI', $base_url . 'wp-json/accesibe-api/activate' );
|
50 |
|
|
|
|
|
51 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_ID', '6XpU046EOVs7v6O' );
|
52 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_SKU', 'wpcfr-pro' );
|
53 |
define( 'WPCF7_PRO_REDIRECT_BASE_NAME', plugin_basename( __FILE__ ) );
|
43 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_PAGE_URL', $base_url );
|
44 |
define( 'WPCF7_PRO_REDIRECT_DEBUG_URL', $base_url . 'wp-json/api-v1/debug' );
|
45 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_ACTIVATION_URL', $base_url . 'wp-admin/admin-ajax.php' );
|
46 |
+
define( 'WPCF7_PRO_REDIRECT_PLUGIN_CHANGELOG_URL', $base_url . 'wp-json/api-v1/get_changelog/' );
|
47 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_UPDATES', $base_url . 'wp-json/api-v1/check-for-updates/' );
|
48 |
+
define( 'WPCF7_PRO_REDIRECT_EXTENSION_UPDATES', $base_url . 'wp-json/api-v1/get-extension-update/' );
|
49 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_EXTENSIONS_LIST_URL', $base_url . 'wp-json/api-v1/extensions_list/' );
|
50 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_PROMOTIONS_URL', $base_url . 'wp-json/api-v1/promotions/' );
|
51 |
define( 'ACCESSIBE_API_URI', $base_url . 'wp-json/accesibe-api/activate' );
|
52 |
|
53 |
+
define( 'WPCF7_PRO_REDIRECT_WP_REQUIRES', '5.3' );
|
54 |
+
define( 'WPCF7_PRO_REDIRECT_WP_TESTED', '5.6' );
|
55 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_ID', '6XpU046EOVs7v6O' );
|
56 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_SKU', 'wpcfr-pro' );
|
57 |
define( 'WPCF7_PRO_REDIRECT_BASE_NAME', plugin_basename( __FILE__ ) );
|
classes/actions/class-wpcf7r-action-firescript.php
CHANGED
@@ -1,83 +1,83 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7R_Action_FireScript file - handles JavaScript actions
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
register_wpcf7r_actions(
|
9 |
-
'FireScript',
|
10 |
-
__( 'Fire JavaScript', 'wpcf7-redirect' ),
|
11 |
-
'WPCF7R_Action_FireScript',
|
12 |
-
2
|
13 |
-
);
|
14 |
-
|
15 |
-
class WPCF7R_Action_FireScript extends WPCF7R_Action {
|
16 |
-
|
17 |
-
public function __construct( $post ) {
|
18 |
-
parent::__construct( $post );
|
19 |
-
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Get the fields relevant for this action
|
24 |
-
*/
|
25 |
-
public function get_action_fields() {
|
26 |
-
return array_merge(
|
27 |
-
array(
|
28 |
-
'script' => array(
|
29 |
-
'name' => 'script',
|
30 |
-
'type' => 'textarea',
|
31 |
-
'label' => __( 'Paste your JavaScript here.', 'wpcf7-redirect' ),
|
32 |
-
'sub_title' => esc_html( __( '(Don\'t use <script> tags)', 'wpcf7-redirect' ) ),
|
33 |
-
'placeholder' => __( 'Paste your JavaScript here', 'wpcf7-redirect' ),
|
34 |
-
'value' => $this->get( 'script' ),
|
35 |
-
),
|
36 |
-
'short-tags-usage' => array(
|
37 |
-
'name' => 'general-alert',
|
38 |
-
'type' => 'notice',
|
39 |
-
'label' => __( 'Notice!', 'wpcf7-redirect' ),
|
40 |
-
/* Translators: available mail tags */
|
41 |
-
'sub_title' => sprintf( __( 'You can use the following tags.<div>%s</div>', 'wpcf7-redirect' ), $this->get_formatted_mail_tags() ),
|
42 |
-
'placeholder' => '',
|
43 |
-
'class' => 'field-notice-alert',
|
44 |
-
'show_selector' => '',
|
45 |
-
),
|
46 |
-
'general-alert' => array(
|
47 |
-
'name' => 'general-alert',
|
48 |
-
'type' => 'notice',
|
49 |
-
'label' => __( 'Warning!', 'wpcf7-redirect' ),
|
50 |
-
'sub_title' => __(
|
51 |
-
'This option is for developers only - use with caution. If the plugin does not redirect after you have added scripts,
|
52 |
-
it means you have a problem with your script. Either fix the script, or remove it.',
|
53 |
-
'wpcf7-redirect'
|
54 |
-
),
|
55 |
-
'placeholder' => '',
|
56 |
-
'class' => 'field-warning-alert',
|
57 |
-
'show_selector' => '',
|
58 |
-
),
|
59 |
-
),
|
60 |
-
parent::get_default_fields()
|
61 |
-
);
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Get settings page
|
66 |
-
*/
|
67 |
-
public function get_action_settings() {
|
68 |
-
$this->get_settings_template( 'html-action-send-to-email.php' );
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Handle a simple redirect rule
|
73 |
-
*/
|
74 |
-
public function process( $submission ) {
|
75 |
-
|
76 |
-
$script = $this->get( 'script' );
|
77 |
-
|
78 |
-
$script = $this->replace_tags( $script, array() );
|
79 |
-
|
80 |
-
return $script;
|
81 |
-
}
|
82 |
-
|
83 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7R_Action_FireScript file - handles JavaScript actions
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
register_wpcf7r_actions(
|
9 |
+
'FireScript',
|
10 |
+
__( 'Fire JavaScript', 'wpcf7-redirect' ),
|
11 |
+
'WPCF7R_Action_FireScript',
|
12 |
+
2
|
13 |
+
);
|
14 |
+
|
15 |
+
class WPCF7R_Action_FireScript extends WPCF7R_Action {
|
16 |
+
|
17 |
+
public function __construct( $post ) {
|
18 |
+
parent::__construct( $post );
|
19 |
+
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Get the fields relevant for this action
|
24 |
+
*/
|
25 |
+
public function get_action_fields() {
|
26 |
+
return array_merge(
|
27 |
+
array(
|
28 |
+
'script' => array(
|
29 |
+
'name' => 'script',
|
30 |
+
'type' => 'textarea',
|
31 |
+
'label' => __( 'Paste your JavaScript here.', 'wpcf7-redirect' ),
|
32 |
+
'sub_title' => esc_html( __( '(Don\'t use <script> tags)', 'wpcf7-redirect' ) ),
|
33 |
+
'placeholder' => __( 'Paste your JavaScript here', 'wpcf7-redirect' ),
|
34 |
+
'value' => $this->get( 'script' ),
|
35 |
+
),
|
36 |
+
'short-tags-usage' => array(
|
37 |
+
'name' => 'general-alert',
|
38 |
+
'type' => 'notice',
|
39 |
+
'label' => __( 'Notice!', 'wpcf7-redirect' ),
|
40 |
+
/* Translators: available mail tags */
|
41 |
+
'sub_title' => sprintf( __( 'You can use the following tags.<div>%s</div>', 'wpcf7-redirect' ), $this->get_formatted_mail_tags() ),
|
42 |
+
'placeholder' => '',
|
43 |
+
'class' => 'field-notice-alert',
|
44 |
+
'show_selector' => '',
|
45 |
+
),
|
46 |
+
'general-alert' => array(
|
47 |
+
'name' => 'general-alert',
|
48 |
+
'type' => 'notice',
|
49 |
+
'label' => __( 'Warning!', 'wpcf7-redirect' ),
|
50 |
+
'sub_title' => __(
|
51 |
+
'This option is for developers only - use with caution. If the plugin does not redirect after you have added scripts,
|
52 |
+
it means you have a problem with your script. Either fix the script, or remove it.',
|
53 |
+
'wpcf7-redirect'
|
54 |
+
),
|
55 |
+
'placeholder' => '',
|
56 |
+
'class' => 'field-warning-alert',
|
57 |
+
'show_selector' => '',
|
58 |
+
),
|
59 |
+
),
|
60 |
+
parent::get_default_fields()
|
61 |
+
);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get settings page
|
66 |
+
*/
|
67 |
+
public function get_action_settings() {
|
68 |
+
$this->get_settings_template( 'html-action-send-to-email.php' );
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Handle a simple redirect rule
|
73 |
+
*/
|
74 |
+
public function process( $submission ) {
|
75 |
+
|
76 |
+
$script = $this->get( 'script' );
|
77 |
+
|
78 |
+
$script = $this->replace_tags( $script, array() );
|
79 |
+
|
80 |
+
return $script;
|
81 |
+
}
|
82 |
+
|
83 |
+
}
|
classes/actions/class-wpcf7r-action-honeypot.php
CHANGED
@@ -1,163 +1,163 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7R_Action_Honeypot
|
4 |
-
* A Class that handles javascript actions
|
5 |
-
*/
|
6 |
-
|
7 |
-
defined( 'ABSPATH' ) || exit;
|
8 |
-
|
9 |
-
register_wpcf7r_actions(
|
10 |
-
'honeypot',
|
11 |
-
__( 'Honeypot', 'wpcf7-redirect' ),
|
12 |
-
'WPCF7R_Action_Honeypot',
|
13 |
-
5
|
14 |
-
);
|
15 |
-
|
16 |
-
class WPCF7R_Action_Honeypot extends WPCF7R_Action {
|
17 |
-
public function __construct( $post ) {
|
18 |
-
parent::__construct( $post );
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Get the fields relevant for this action
|
23 |
-
*/
|
24 |
-
public function get_action_fields() {
|
25 |
-
return array_merge(
|
26 |
-
array(
|
27 |
-
'general-alert' => array(
|
28 |
-
'name' => 'general-alert',
|
29 |
-
'type' => 'notice',
|
30 |
-
'label' => __( 'Notice!', 'wpcf7-redirect' ),
|
31 |
-
'sub_title' => __(
|
32 |
-
'Honeypot creates a random number of anti-spam fields on your form. If a robot fills out one of these fields the submission is marked as spam.<br/>
|
33 |
-
<a href="https://en.wikipedia.org/wiki/Honeypot_(computing)" target="_blank">Learn More</a>',
|
34 |
-
'wpcf7-redirect'
|
35 |
-
),
|
36 |
-
'placeholder' => '',
|
37 |
-
'class' => 'field-warning-notice',
|
38 |
-
'show_selector' => '',
|
39 |
-
),
|
40 |
-
),
|
41 |
-
parent::get_default_fields()
|
42 |
-
);
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Create the honeypot field names
|
47 |
-
*
|
48 |
-
* @param integer $length
|
49 |
-
*/
|
50 |
-
function readable_random_string( $length = 6 ) {
|
51 |
-
$string = '';
|
52 |
-
$vowels = array( 'a', 'e', 'i', 'o', 'u' );
|
53 |
-
$consonants = array(
|
54 |
-
'b',
|
55 |
-
'c',
|
56 |
-
'd',
|
57 |
-
'f',
|
58 |
-
'g',
|
59 |
-
'h',
|
60 |
-
'j',
|
61 |
-
'k',
|
62 |
-
'l',
|
63 |
-
'm',
|
64 |
-
'n',
|
65 |
-
'p',
|
66 |
-
'r',
|
67 |
-
's',
|
68 |
-
't',
|
69 |
-
'v',
|
70 |
-
'w',
|
71 |
-
'x',
|
72 |
-
'y',
|
73 |
-
'z',
|
74 |
-
);
|
75 |
-
$max = $length / 2;
|
76 |
-
|
77 |
-
for ( $i = 1; $i <= $max; $i++ ) {
|
78 |
-
$string .= $consonants[ rand( 0, 19 ) ];
|
79 |
-
$string .= $vowels[ rand( 0, 4 ) ];
|
80 |
-
}
|
81 |
-
|
82 |
-
return $string;
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Get the honeypot fields names
|
87 |
-
*/
|
88 |
-
private function get_honeypot_names() {
|
89 |
-
return get_post_meta( $this->get_id(), 'honeypot_names', true );
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Render callback
|
94 |
-
*/
|
95 |
-
public function render_callback_once( $properties ) {
|
96 |
-
add_action(
|
97 |
-
'wp_footer',
|
98 |
-
function() {
|
99 |
-
$honeypot_names = $this->get_honeypot_names();
|
100 |
-
|
101 |
-
foreach ( $honeypot_names as $honeypot_name ) {
|
102 |
-
echo "<style>.{$honeypot_name}{transform:scale(0);position: absolute;z-index: -10;}</style>";
|
103 |
-
}
|
104 |
-
}
|
105 |
-
);
|
106 |
-
|
107 |
-
return $properties;
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Render an element on the form frontend.
|
112 |
-
*
|
113 |
-
* @param array $properties
|
114 |
-
* @param object $form
|
115 |
-
*/
|
116 |
-
public function render_callback( $properties, $form ) {
|
117 |
-
$honeypot_names = $this->get_honeypot_names();
|
118 |
-
|
119 |
-
if ( ! $honeypot_names ) {
|
120 |
-
$rand = rand( 1, 4 );
|
121 |
-
$honeypot_names = array();
|
122 |
-
|
123 |
-
for ( $i = 1;$i <= $rand;$i++ ) {
|
124 |
-
$honeypot_names[] = $this->readable_random_string();
|
125 |
-
}
|
126 |
-
|
127 |
-
update_post_meta( $this->get_id(), 'honeypot_names', $honeypot_names );
|
128 |
-
}
|
129 |
-
|
130 |
-
if ( isset( $properties['form'] ) ) {
|
131 |
-
foreach ( $honeypot_names as $honeypot_name ) {
|
132 |
-
$properties['form'] .= "<p class='{$honeypot_name}'>[text {$honeypot_name}]</p>";
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
return $properties;
|
137 |
-
}
|
138 |
-
|
139 |
-
/**
|
140 |
-
* Process the honeypot validations
|
141 |
-
*/
|
142 |
-
public function process_validation( $submission ) {
|
143 |
-
$response = array();
|
144 |
-
$posted_data = $submission->get_posted_data();
|
145 |
-
$honeypot_names = $this->get_honeypot_names();
|
146 |
-
|
147 |
-
if ( $honeypot_names ) {
|
148 |
-
foreach ( $honeypot_names as $honeypot_name ) {
|
149 |
-
if ( isset( $posted_data[ $honeypot_name ] ) && $posted_data[ $honeypot_name ] ) {
|
150 |
-
$error = array(
|
151 |
-
'tag' => $honeypot_name,
|
152 |
-
'error_message' => __( 'Something went wrong', 'wpcf7-redirect' ),
|
153 |
-
);
|
154 |
-
$response['invalid_tags'][] = new WP_error( 'tag_invalid', $error );
|
155 |
-
} else {
|
156 |
-
$response['ignored_tags'][] = $honeypot_name;
|
157 |
-
}
|
158 |
-
}
|
159 |
-
}
|
160 |
-
|
161 |
-
return $response;
|
162 |
-
}
|
163 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7R_Action_Honeypot
|
4 |
+
* A Class that handles javascript actions
|
5 |
+
*/
|
6 |
+
|
7 |
+
defined( 'ABSPATH' ) || exit;
|
8 |
+
|
9 |
+
register_wpcf7r_actions(
|
10 |
+
'honeypot',
|
11 |
+
__( 'Honeypot', 'wpcf7-redirect' ),
|
12 |
+
'WPCF7R_Action_Honeypot',
|
13 |
+
5
|
14 |
+
);
|
15 |
+
|
16 |
+
class WPCF7R_Action_Honeypot extends WPCF7R_Action {
|
17 |
+
public function __construct( $post ) {
|
18 |
+
parent::__construct( $post );
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get the fields relevant for this action
|
23 |
+
*/
|
24 |
+
public function get_action_fields() {
|
25 |
+
return array_merge(
|
26 |
+
array(
|
27 |
+
'general-alert' => array(
|
28 |
+
'name' => 'general-alert',
|
29 |
+
'type' => 'notice',
|
30 |
+
'label' => __( 'Notice!', 'wpcf7-redirect' ),
|
31 |
+
'sub_title' => __(
|
32 |
+
'Honeypot creates a random number of anti-spam fields on your form. If a robot fills out one of these fields the submission is marked as spam.<br/>
|
33 |
+
<a href="https://en.wikipedia.org/wiki/Honeypot_(computing)" target="_blank">Learn More</a>',
|
34 |
+
'wpcf7-redirect'
|
35 |
+
),
|
36 |
+
'placeholder' => '',
|
37 |
+
'class' => 'field-warning-notice',
|
38 |
+
'show_selector' => '',
|
39 |
+
),
|
40 |
+
),
|
41 |
+
parent::get_default_fields()
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Create the honeypot field names
|
47 |
+
*
|
48 |
+
* @param integer $length
|
49 |
+
*/
|
50 |
+
function readable_random_string( $length = 6 ) {
|
51 |
+
$string = '';
|
52 |
+
$vowels = array( 'a', 'e', 'i', 'o', 'u' );
|
53 |
+
$consonants = array(
|
54 |
+
'b',
|
55 |
+
'c',
|
56 |
+
'd',
|
57 |
+
'f',
|
58 |
+
'g',
|
59 |
+
'h',
|
60 |
+
'j',
|
61 |
+
'k',
|
62 |
+
'l',
|
63 |
+
'm',
|
64 |
+
'n',
|
65 |
+
'p',
|
66 |
+
'r',
|
67 |
+
's',
|
68 |
+
't',
|
69 |
+
'v',
|
70 |
+
'w',
|
71 |
+
'x',
|
72 |
+
'y',
|
73 |
+
'z',
|
74 |
+
);
|
75 |
+
$max = $length / 2;
|
76 |
+
|
77 |
+
for ( $i = 1; $i <= $max; $i++ ) {
|
78 |
+
$string .= $consonants[ rand( 0, 19 ) ];
|
79 |
+
$string .= $vowels[ rand( 0, 4 ) ];
|
80 |
+
}
|
81 |
+
|
82 |
+
return $string;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Get the honeypot fields names
|
87 |
+
*/
|
88 |
+
private function get_honeypot_names() {
|
89 |
+
return get_post_meta( $this->get_id(), 'honeypot_names', true );
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Render callback
|
94 |
+
*/
|
95 |
+
public function render_callback_once( $properties ) {
|
96 |
+
add_action(
|
97 |
+
'wp_footer',
|
98 |
+
function() {
|
99 |
+
$honeypot_names = $this->get_honeypot_names();
|
100 |
+
|
101 |
+
foreach ( $honeypot_names as $honeypot_name ) {
|
102 |
+
echo "<style>.{$honeypot_name}{transform:scale(0);position: absolute;z-index: -10;}</style>";
|
103 |
+
}
|
104 |
+
}
|
105 |
+
);
|
106 |
+
|
107 |
+
return $properties;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Render an element on the form frontend.
|
112 |
+
*
|
113 |
+
* @param array $properties
|
114 |
+
* @param object $form
|
115 |
+
*/
|
116 |
+
public function render_callback( $properties, $form ) {
|
117 |
+
$honeypot_names = $this->get_honeypot_names();
|
118 |
+
|
119 |
+
if ( ! $honeypot_names ) {
|
120 |
+
$rand = rand( 1, 4 );
|
121 |
+
$honeypot_names = array();
|
122 |
+
|
123 |
+
for ( $i = 1;$i <= $rand;$i++ ) {
|
124 |
+
$honeypot_names[] = $this->readable_random_string();
|
125 |
+
}
|
126 |
+
|
127 |
+
update_post_meta( $this->get_id(), 'honeypot_names', $honeypot_names );
|
128 |
+
}
|
129 |
+
|
130 |
+
if ( isset( $properties['form'] ) ) {
|
131 |
+
foreach ( $honeypot_names as $honeypot_name ) {
|
132 |
+
$properties['form'] .= "<p class='{$honeypot_name}'>[text {$honeypot_name}]</p>";
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
return $properties;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Process the honeypot validations
|
141 |
+
*/
|
142 |
+
public function process_validation( $submission ) {
|
143 |
+
$response = array();
|
144 |
+
$posted_data = $submission->get_posted_data();
|
145 |
+
$honeypot_names = $this->get_honeypot_names();
|
146 |
+
|
147 |
+
if ( $honeypot_names ) {
|
148 |
+
foreach ( $honeypot_names as $honeypot_name ) {
|
149 |
+
if ( isset( $posted_data[ $honeypot_name ] ) && $posted_data[ $honeypot_name ] ) {
|
150 |
+
$error = array(
|
151 |
+
'tag' => $honeypot_name,
|
152 |
+
'error_message' => __( 'Something went wrong', 'wpcf7-redirect' ),
|
153 |
+
);
|
154 |
+
$response['invalid_tags'][] = new WP_error( 'tag_invalid', $error );
|
155 |
+
} else {
|
156 |
+
$response['ignored_tags'][] = $honeypot_name;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
return $response;
|
162 |
+
}
|
163 |
+
}
|
classes/actions/class-wpcf7r-action-redirect.php
CHANGED
@@ -1,280 +1,280 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7R_Action_Redirect file.
|
4 |
-
*/
|
5 |
-
|
6 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
-
exit;
|
8 |
-
}
|
9 |
-
|
10 |
-
register_wpcf7r_actions(
|
11 |
-
'redirect',
|
12 |
-
__( 'Redirect', 'wpcf7-redirect' ),
|
13 |
-
'WPCF7R_Action_Redirect',
|
14 |
-
1
|
15 |
-
);
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Class WPCF7R_Action_Redirect
|
19 |
-
* A Class that handles redirect actions
|
20 |
-
*/
|
21 |
-
class WPCF7R_Action_Redirect extends WPCF7R_Action {
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Init the parent action class
|
25 |
-
*
|
26 |
-
* @param $post
|
27 |
-
*/
|
28 |
-
public function __construct( $post ) {
|
29 |
-
parent::__construct( $post );
|
30 |
-
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Get the action admin fields
|
35 |
-
*/
|
36 |
-
public function get_action_fields() {
|
37 |
-
|
38 |
-
$parent_fields = parent::get_default_fields();
|
39 |
-
|
40 |
-
unset( $parent_fields['action_status'] );
|
41 |
-
|
42 |
-
return array_merge(
|
43 |
-
array(
|
44 |
-
array(
|
45 |
-
'name' => 'use_external_url',
|
46 |
-
'type' => 'checkbox',
|
47 |
-
'label' => __( 'Use custom URL', 'wpcf7-redirect' ),
|
48 |
-
'sub_title' => '',
|
49 |
-
'placeholder' => '',
|
50 |
-
'show_selector' => '.field-wrap-external_url,.field-wrap-page_id',
|
51 |
-
'value' => $this->get( 'use_external_url' ),
|
52 |
-
),
|
53 |
-
array(
|
54 |
-
'name' => 'page_id',
|
55 |
-
'type' => 'page_select',
|
56 |
-
'label' => __( 'Select a page', 'wpcf7-redirect' ),
|
57 |
-
'placeholder' => __( 'Select a page', 'wpcf7-redirect' ),
|
58 |
-
'value' => $this->get( 'page_id' ),
|
59 |
-
'class' => $this->get( 'use_external_url' ) ? 'field-hidden' : '',
|
60 |
-
),
|
61 |
-
array(
|
62 |
-
'name' => 'external_url',
|
63 |
-
'type' => 'url',
|
64 |
-
'label' => __( 'Use external URL', 'wpcf7-redirect' ),
|
65 |
-
'placeholder' => __( 'Use external URL', 'wpcf7-redirect' ),
|
66 |
-
'tooltip' => __( 'You can build a custom url like this https://example.com/[your-name]?[your-email]&[your-tel]', 'wpcf7-redirect' ),
|
67 |
-
'footer' => '<div>' . $this->get_formatted_mail_tags() . '</div><div class="wpcf7-redirect-butify-wrap"></div>',
|
68 |
-
'value' => $this->get( 'external_url' ),
|
69 |
-
'class' => $this->get( 'use_external_url' ) ? '' : 'field-hidden',
|
70 |
-
),
|
71 |
-
array(
|
72 |
-
'name' => 'redirect_as_x_form_encoded_url',
|
73 |
-
'type' => 'checkbox',
|
74 |
-
'label' => __( 'Redirect as X-WWW-FORM-URLENCODED (Form Post)', 'wpcf7-redirect' ),
|
75 |
-
'sub_title' => '',
|
76 |
-
'placeholder' => '',
|
77 |
-
'value' => $this->get( 'redirect_as_x_form_encoded_url' ),
|
78 |
-
),
|
79 |
-
array(
|
80 |
-
'name' => 'open_in_new_tab',
|
81 |
-
'type' => 'checkbox',
|
82 |
-
'label' => __( 'Open page in a new tab', 'wpcf7-redirect' ),
|
83 |
-
'sub_title' => '',
|
84 |
-
'placeholder' => '',
|
85 |
-
'show_selector' => '.field-wrap-open_in_new_tab_notice',
|
86 |
-
'value' => $this->get( 'open_in_new_tab' ),
|
87 |
-
),
|
88 |
-
array(
|
89 |
-
'name' => 'open_in_new_tab_notice',
|
90 |
-
'type' => 'notice',
|
91 |
-
'label' => '<strong>' . __( 'Notice!', 'wpcf7-redirect' ) . '</strong>',
|
92 |
-
'sub_title' => __( 'This option might not work as expected, since browsers often block popup windows. This option depends on the browser settings.', 'wpcf7-redirect' ),
|
93 |
-
'placeholder' => '',
|
94 |
-
'class' => $this->get( 'open_in_new_tab' ) ? 'field-notice-alert' : 'field-hidden field-notice-alert',
|
95 |
-
'show_selector' => '',
|
96 |
-
),
|
97 |
-
array(
|
98 |
-
'name' => 'http_build_query',
|
99 |
-
'type' => 'checkbox',
|
100 |
-
'label' => __( 'Pass all the fields from the form as URL query parameters', 'wpcf7-redirect' ),
|
101 |
-
'sub_title' => '',
|
102 |
-
'placeholder' => '',
|
103 |
-
'show_selector' => '.field-wrap-get_param_shortcode',
|
104 |
-
'value' => $this->get( 'http_build_query' ),
|
105 |
-
),
|
106 |
-
array(
|
107 |
-
'name' => 'http_build_query_selectively',
|
108 |
-
'type' => 'checkbox',
|
109 |
-
'label' => __( 'Pass specific fields from the form as URL query parameters', 'wpcf7-redirect' ),
|
110 |
-
'sub_title' => '',
|
111 |
-
'placeholder' => '',
|
112 |
-
'show_selector' => '.field-wrap-http_build_query_selectively_fields,.field-wrap-get_param_shortcode',
|
113 |
-
'value' => $this->get( 'http_build_query_selectively' ),
|
114 |
-
),
|
115 |
-
array(
|
116 |
-
'name' => 'url_encode',
|
117 |
-
'type' => 'checkbox',
|
118 |
-
'label' => __( 'Encode passed query parameters', 'wpcf7-redirect' ),
|
119 |
-
'sub_title' => '',
|
120 |
-
'placeholder' => '',
|
121 |
-
'value' => $this->get( 'url_encode' ),
|
122 |
-
),
|
123 |
-
array(
|
124 |
-
'name' => 'http_build_query_selectively_fields',
|
125 |
-
'type' => 'text',
|
126 |
-
'label' => __( 'Fields to pass as URL query parameters, separated by commas:', 'wpcf7-redirect' ),
|
127 |
-
'footer' => '<div>' . $this->get_formatted_mail_tags( true ) . '</div><div class="wpcf7-redirect-butify-wrap"></div>',
|
128 |
-
'placeholder' => '',
|
129 |
-
'value' => $this->get( 'http_build_query_selectively_fields' ),
|
130 |
-
'class' => $this->get( 'http_build_query_selectively' ) ? '' : 'field-hidden',
|
131 |
-
),
|
132 |
-
array(
|
133 |
-
'name' => 'get_param_shortcode',
|
134 |
-
'type' => 'notice',
|
135 |
-
'label' => '<strong>' . __( '[get_param]!', 'wpcf7-redirect' ) . '</strong>',
|
136 |
-
'sub_title' => __( 'You can use this tag on the target page to collect the data transerred [get_param param="your-name"].', 'wpcf7-redirect' ),
|
137 |
-
'placeholder' => '',
|
138 |
-
'class' => $this->get( 'http_build_query_selectively' ) ? 'field-notice-alert' : 'field-hidden field-notice-alert',
|
139 |
-
'show_selector' => '',
|
140 |
-
),
|
141 |
-
array(
|
142 |
-
'name' => 'delay_redirect_seconds',
|
143 |
-
'type' => 'number',
|
144 |
-
'label' => __( 'How many seconds to delay', 'wpcf7-redirect' ),
|
145 |
-
'placeholder' => __( 'Number of seconds', 'wpcf7-redirect' ),
|
146 |
-
'value' => $this->get( 'delay_redirect_seconds' ),
|
147 |
-
'class' => '',
|
148 |
-
),
|
149 |
-
'action_status' => array(
|
150 |
-
'name' => 'action_status',
|
151 |
-
'type' => 'checkbox',
|
152 |
-
'label' => $this->get_action_status_label(),
|
153 |
-
'sub_title' => __( 'if this is off the rule will not be applied', 'wpcf7-redirect' ),
|
154 |
-
'placeholder' => '',
|
155 |
-
'show_selector' => '.field-wrap-disable_default_email',
|
156 |
-
'toggle-label' => json_encode(
|
157 |
-
array(
|
158 |
-
'.field-wrap-action_status .checkbox-label,.column-status a' => array(
|
159 |
-
__( 'Enabled', 'wpcf7-redirect' ),
|
160 |
-
__( 'Disabled', 'wpcf7-redirect' ),
|
161 |
-
),
|
162 |
-
)
|
163 |
-
),
|
164 |
-
'value' => $this->get( 'action_status' ),
|
165 |
-
),
|
166 |
-
'disable_default_email' => array(
|
167 |
-
'name' => 'disable_default_email',
|
168 |
-
'type' => 'notice',
|
169 |
-
'label' => __( '<strong>NOTICE!</strong><br/>', 'wpcf7-redirect' ),
|
170 |
-
'sub_title' => __( 'Redirection will always be the last action regardless of the actions order.', 'wpcf7-redirect' ),
|
171 |
-
'placeholder' => '',
|
172 |
-
'class' => $this->get( 'action_status' ) ? 'field-notice-alert' : 'field-hidden field-notice-alert',
|
173 |
-
'show_selector' => '',
|
174 |
-
),
|
175 |
-
),
|
176 |
-
$parent_fields
|
177 |
-
);
|
178 |
-
}
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Get an HTML of the
|
182 |
-
*/
|
183 |
-
public function get_action_settings() {
|
184 |
-
$this->get_settings_template( 'html-action-redirect.php' );
|
185 |
-
}
|
186 |
-
|
187 |
-
/**
|
188 |
-
* Handle a simple redirect rule
|
189 |
-
*
|
190 |
-
* @param $submission
|
191 |
-
*/
|
192 |
-
public function process( $submission ) {
|
193 |
-
$response = array();
|
194 |
-
|
195 |
-
$this->posted_data = $submission->get_posted_data();
|
196 |
-
|
197 |
-
foreach ( $this->posted_data as $posted_data_key => $posted_data_value ) {
|
198 |
-
if ( is_array( $posted_data_value ) ) {
|
199 |
-
$this->posted_data[ $posted_data_key ] = implode( ',', $posted_data_value );
|
200 |
-
} elseif ( $this->get( 'url_encode' ) ) {
|
201 |
-
$this->posted_data[ $posted_data_key ] = rawurlencode( $posted_data_value );
|
202 |
-
}
|
203 |
-
}
|
204 |
-
|
205 |
-
if ( $this->get( 'use_external_url' ) === 'on' && $this->get( 'external_url' ) ) {
|
206 |
-
$response = array(
|
207 |
-
'type' => 'redirect',
|
208 |
-
'redirect_url' => $this->replace_tags( $this->get( 'external_url' ) ),
|
209 |
-
'delay' => $this->get( 'delay_redirect_seconds' ) ? (int) $this->get( 'delay_redirect_seconds' ) : 0,
|
210 |
-
);
|
211 |
-
} elseif ( $this->get( 'page_id' ) ) {
|
212 |
-
$response = array(
|
213 |
-
'type' => 'redirect',
|
214 |
-
'redirect_url' => get_permalink( $this->get( 'page_id' ) ),
|
215 |
-
'delay' => $this->get( 'delay_redirect_seconds' ) ? (int) $this->get( 'delay_redirect_seconds' ) : 0,
|
216 |
-
);
|
217 |
-
}
|
218 |
-
|
219 |
-
if ( $this->get( 'redirect_as_x_form_encoded_url' ) && isset( $response['redirect_url'] ) && $response['redirect_url'] ) {
|
220 |
-
|
221 |
-
ob_start();
|
222 |
-
|
223 |
-
$params = parse_url( $response['redirect_url'] );
|
224 |
-
|
225 |
-
parse_str( $params['query'], $fields );
|
226 |
-
|
227 |
-
if ( isset( $fields['sum'] ) && isset( $fields['qty'] ) ) {
|
228 |
-
$fields['sum'] = $fields['sum'] * $fields['qty'];
|
229 |
-
}
|
230 |
-
|
231 |
-
if ( $this->get( 'http_build_query_selectively' ) === 'on' ) {
|
232 |
-
$fields_to_add = explode( ',', $this->get( 'http_build_query_selectively_fields' ) );
|
233 |
-
|
234 |
-
foreach ( $fields_to_add as $field_to_add ) {
|
235 |
-
$field_to_add = trim( $field_to_add );
|
236 |
-
$fields[ $field_to_add ] = isset( $this->posted_data[ $field_to_add ] ) ? $this->posted_data[ $field_to_add ] : '';
|
237 |
-
}
|
238 |
-
} elseif ( $this->get( 'http_build_query' ) === 'on' ) {
|
239 |
-
$fields = array_merge( $this->posted_data, $fields );
|
240 |
-
}
|
241 |
-
|
242 |
-
?>
|
243 |
-
<form id="cf7r-result-form" action="<?php echo $response['redirect_url']; ?>" method="post">
|
244 |
-
<?php foreach ( $fields as $field_key => $field_value ) : ?>
|
245 |
-
<input type="hidden" name="<?php echo $field_key; ?>" value="<?php echo $field_value; ?>">
|
246 |
-
<?php endforeach; ?>
|
247 |
-
</form>
|
248 |
-
<?php
|
249 |
-
$response['form'] = ob_get_clean();
|
250 |
-
|
251 |
-
} elseif ( $this->get( 'http_build_query' ) === 'on' ) {
|
252 |
-
|
253 |
-
$response['http_build_query'] = true;
|
254 |
-
|
255 |
-
$response['redirect_url'] = add_query_arg( $this->posted_data, $response['redirect_url'] );
|
256 |
-
|
257 |
-
} elseif ( $this->get( 'http_build_query_selectively' ) === 'on' ) {
|
258 |
-
|
259 |
-
$fields_to_add = explode( ',', $this->get( 'http_build_query_selectively_fields' ) );
|
260 |
-
$fields_to_add_args = array();
|
261 |
-
|
262 |
-
foreach ( $fields_to_add as $field_to_add ) {
|
263 |
-
$field_to_add = trim( $field_to_add );
|
264 |
-
$fields_to_add_args[ $field_to_add ] = isset( $this->posted_data[ $field_to_add ] ) ? $this->posted_data[ $field_to_add ] : '';
|
265 |
-
}
|
266 |
-
|
267 |
-
$response['redirect_url'] = add_query_arg( $fields_to_add_args, $response['redirect_url'] );
|
268 |
-
}
|
269 |
-
|
270 |
-
if ( $this->get( 'after_sent_script' ) ) {
|
271 |
-
$response['after_sent_script'] = $this->get( 'after_sent_script' );
|
272 |
-
}
|
273 |
-
|
274 |
-
if ( $this->get( 'open_in_new_tab' ) === 'on' ) {
|
275 |
-
$response['type'] = 'new_tab';
|
276 |
-
}
|
277 |
-
|
278 |
-
return $response;
|
279 |
-
}
|
280 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7R_Action_Redirect file.
|
4 |
+
*/
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
+
exit;
|
8 |
+
}
|
9 |
+
|
10 |
+
register_wpcf7r_actions(
|
11 |
+
'redirect',
|
12 |
+
__( 'Redirect', 'wpcf7-redirect' ),
|
13 |
+
'WPCF7R_Action_Redirect',
|
14 |
+
1
|
15 |
+
);
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Class WPCF7R_Action_Redirect
|
19 |
+
* A Class that handles redirect actions
|
20 |
+
*/
|
21 |
+
class WPCF7R_Action_Redirect extends WPCF7R_Action {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Init the parent action class
|
25 |
+
*
|
26 |
+
* @param $post
|
27 |
+
*/
|
28 |
+
public function __construct( $post ) {
|
29 |
+
parent::__construct( $post );
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get the action admin fields
|
35 |
+
*/
|
36 |
+
public function get_action_fields() {
|
37 |
+
|
38 |
+
$parent_fields = parent::get_default_fields();
|
39 |
+
|
40 |
+
unset( $parent_fields['action_status'] );
|
41 |
+
|
42 |
+
return array_merge(
|
43 |
+
array(
|
44 |
+
array(
|
45 |
+
'name' => 'use_external_url',
|
46 |
+
'type' => 'checkbox',
|
47 |
+
'label' => __( 'Use custom URL', 'wpcf7-redirect' ),
|
48 |
+
'sub_title' => '',
|
49 |
+
'placeholder' => '',
|
50 |
+
'show_selector' => '.field-wrap-external_url,.field-wrap-page_id',
|
51 |
+
'value' => $this->get( 'use_external_url' ),
|
52 |
+
),
|
53 |
+
array(
|
54 |
+
'name' => 'page_id',
|
55 |
+
'type' => 'page_select',
|
56 |
+
'label' => __( 'Select a page', 'wpcf7-redirect' ),
|
57 |
+
'placeholder' => __( 'Select a page', 'wpcf7-redirect' ),
|
58 |
+
'value' => $this->get( 'page_id' ),
|
59 |
+
'class' => $this->get( 'use_external_url' ) ? 'field-hidden' : '',
|
60 |
+
),
|
61 |
+
array(
|
62 |
+
'name' => 'external_url',
|
63 |
+
'type' => 'url',
|
64 |
+
'label' => __( 'Use external URL', 'wpcf7-redirect' ),
|
65 |
+
'placeholder' => __( 'Use external URL', 'wpcf7-redirect' ),
|
66 |
+
'tooltip' => __( 'You can build a custom url like this https://example.com/[your-name]?[your-email]&[your-tel]', 'wpcf7-redirect' ),
|
67 |
+
'footer' => '<div>' . $this->get_formatted_mail_tags() . '</div><div class="wpcf7-redirect-butify-wrap"></div>',
|
68 |
+
'value' => $this->get( 'external_url' ),
|
69 |
+
'class' => $this->get( 'use_external_url' ) ? '' : 'field-hidden',
|
70 |
+
),
|
71 |
+
array(
|
72 |
+
'name' => 'redirect_as_x_form_encoded_url',
|
73 |
+
'type' => 'checkbox',
|
74 |
+
'label' => __( 'Redirect as X-WWW-FORM-URLENCODED (Form Post)', 'wpcf7-redirect' ),
|
75 |
+
'sub_title' => '',
|
76 |
+
'placeholder' => '',
|
77 |
+
'value' => $this->get( 'redirect_as_x_form_encoded_url' ),
|
78 |
+
),
|
79 |
+
array(
|
80 |
+
'name' => 'open_in_new_tab',
|
81 |
+
'type' => 'checkbox',
|
82 |
+
'label' => __( 'Open page in a new tab', 'wpcf7-redirect' ),
|
83 |
+
'sub_title' => '',
|
84 |
+
'placeholder' => '',
|
85 |
+
'show_selector' => '.field-wrap-open_in_new_tab_notice',
|
86 |
+
'value' => $this->get( 'open_in_new_tab' ),
|
87 |
+
),
|
88 |
+
array(
|
89 |
+
'name' => 'open_in_new_tab_notice',
|
90 |
+
'type' => 'notice',
|
91 |
+
'label' => '<strong>' . __( 'Notice!', 'wpcf7-redirect' ) . '</strong>',
|
92 |
+
'sub_title' => __( 'This option might not work as expected, since browsers often block popup windows. This option depends on the browser settings.', 'wpcf7-redirect' ),
|
93 |
+
'placeholder' => '',
|
94 |
+
'class' => $this->get( 'open_in_new_tab' ) ? 'field-notice-alert' : 'field-hidden field-notice-alert',
|
95 |
+
'show_selector' => '',
|
96 |
+
),
|
97 |
+
array(
|
98 |
+
'name' => 'http_build_query',
|
99 |
+
'type' => 'checkbox',
|
100 |
+
'label' => __( 'Pass all the fields from the form as URL query parameters', 'wpcf7-redirect' ),
|
101 |
+
'sub_title' => '',
|
102 |
+
'placeholder' => '',
|
103 |
+
'show_selector' => '.field-wrap-get_param_shortcode',
|
104 |
+
'value' => $this->get( 'http_build_query' ),
|
105 |
+
),
|
106 |
+
array(
|
107 |
+
'name' => 'http_build_query_selectively',
|
108 |
+
'type' => 'checkbox',
|
109 |
+
'label' => __( 'Pass specific fields from the form as URL query parameters', 'wpcf7-redirect' ),
|
110 |
+
'sub_title' => '',
|
111 |
+
'placeholder' => '',
|
112 |
+
'show_selector' => '.field-wrap-http_build_query_selectively_fields,.field-wrap-get_param_shortcode',
|
113 |
+
'value' => $this->get( 'http_build_query_selectively' ),
|
114 |
+
),
|
115 |
+
array(
|
116 |
+
'name' => 'url_encode',
|
117 |
+
'type' => 'checkbox',
|
118 |
+
'label' => __( 'Encode passed query parameters', 'wpcf7-redirect' ),
|
119 |
+
'sub_title' => '',
|
120 |
+
'placeholder' => '',
|
121 |
+
'value' => $this->get( 'url_encode' ),
|
122 |
+
),
|
123 |
+
array(
|
124 |
+
'name' => 'http_build_query_selectively_fields',
|
125 |
+
'type' => 'text',
|
126 |
+
'label' => __( 'Fields to pass as URL query parameters, separated by commas:', 'wpcf7-redirect' ),
|
127 |
+
'footer' => '<div>' . $this->get_formatted_mail_tags( true ) . '</div><div class="wpcf7-redirect-butify-wrap"></div>',
|
128 |
+
'placeholder' => '',
|
129 |
+
'value' => $this->get( 'http_build_query_selectively_fields' ),
|
130 |
+
'class' => $this->get( 'http_build_query_selectively' ) ? '' : 'field-hidden',
|
131 |
+
),
|
132 |
+
array(
|
133 |
+
'name' => 'get_param_shortcode',
|
134 |
+
'type' => 'notice',
|
135 |
+
'label' => '<strong>' . __( '[get_param]!', 'wpcf7-redirect' ) . '</strong>',
|
136 |
+
'sub_title' => __( 'You can use this tag on the target page to collect the data transerred [get_param param="your-name"].', 'wpcf7-redirect' ),
|
137 |
+
'placeholder' => '',
|
138 |
+
'class' => $this->get( 'http_build_query_selectively' ) ? 'field-notice-alert' : 'field-hidden field-notice-alert',
|
139 |
+
'show_selector' => '',
|
140 |
+
),
|
141 |
+
array(
|
142 |
+
'name' => 'delay_redirect_seconds',
|
143 |
+
'type' => 'number',
|
144 |
+
'label' => __( 'How many seconds to delay', 'wpcf7-redirect' ),
|
145 |
+
'placeholder' => __( 'Number of seconds', 'wpcf7-redirect' ),
|
146 |
+
'value' => $this->get( 'delay_redirect_seconds' ),
|
147 |
+
'class' => '',
|
148 |
+
),
|
149 |
+
'action_status' => array(
|
150 |
+
'name' => 'action_status',
|
151 |
+
'type' => 'checkbox',
|
152 |
+
'label' => $this->get_action_status_label(),
|
153 |
+
'sub_title' => __( 'if this is off the rule will not be applied', 'wpcf7-redirect' ),
|
154 |
+
'placeholder' => '',
|
155 |
+
'show_selector' => '.field-wrap-disable_default_email',
|
156 |
+
'toggle-label' => json_encode(
|
157 |
+
array(
|
158 |
+
'.field-wrap-action_status .checkbox-label,.column-status a' => array(
|
159 |
+
__( 'Enabled', 'wpcf7-redirect' ),
|
160 |
+
__( 'Disabled', 'wpcf7-redirect' ),
|
161 |
+
),
|
162 |
+
)
|
163 |
+
),
|
164 |
+
'value' => $this->get( 'action_status' ),
|
165 |
+
),
|
166 |
+
'disable_default_email' => array(
|
167 |
+
'name' => 'disable_default_email',
|
168 |
+
'type' => 'notice',
|
169 |
+
'label' => __( '<strong>NOTICE!</strong><br/>', 'wpcf7-redirect' ),
|
170 |
+
'sub_title' => __( 'Redirection will always be the last action regardless of the actions order.', 'wpcf7-redirect' ),
|
171 |
+
'placeholder' => '',
|
172 |
+
'class' => $this->get( 'action_status' ) ? 'field-notice-alert' : 'field-hidden field-notice-alert',
|
173 |
+
'show_selector' => '',
|
174 |
+
),
|
175 |
+
),
|
176 |
+
$parent_fields
|
177 |
+
);
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Get an HTML of the
|
182 |
+
*/
|
183 |
+
public function get_action_settings() {
|
184 |
+
$this->get_settings_template( 'html-action-redirect.php' );
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Handle a simple redirect rule
|
189 |
+
*
|
190 |
+
* @param $submission
|
191 |
+
*/
|
192 |
+
public function process( $submission ) {
|
193 |
+
$response = array();
|
194 |
+
|
195 |
+
$this->posted_data = $submission->get_posted_data();
|
196 |
+
|
197 |
+
foreach ( $this->posted_data as $posted_data_key => $posted_data_value ) {
|
198 |
+
if ( is_array( $posted_data_value ) ) {
|
199 |
+
$this->posted_data[ $posted_data_key ] = implode( ',', $posted_data_value );
|
200 |
+
} elseif ( $this->get( 'url_encode' ) ) {
|
201 |
+
$this->posted_data[ $posted_data_key ] = rawurlencode( $posted_data_value );
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
if ( $this->get( 'use_external_url' ) === 'on' && $this->get( 'external_url' ) ) {
|
206 |
+
$response = array(
|
207 |
+
'type' => 'redirect',
|
208 |
+
'redirect_url' => $this->replace_tags( $this->get( 'external_url' ) ),
|
209 |
+
'delay' => $this->get( 'delay_redirect_seconds' ) ? (int) $this->get( 'delay_redirect_seconds' ) : 0,
|
210 |
+
);
|
211 |
+
} elseif ( $this->get( 'page_id' ) ) {
|
212 |
+
$response = array(
|
213 |
+
'type' => 'redirect',
|
214 |
+
'redirect_url' => get_permalink( $this->get( 'page_id' ) ),
|
215 |
+
'delay' => $this->get( 'delay_redirect_seconds' ) ? (int) $this->get( 'delay_redirect_seconds' ) : 0,
|
216 |
+
);
|
217 |
+
}
|
218 |
+
|
219 |
+
if ( $this->get( 'redirect_as_x_form_encoded_url' ) && isset( $response['redirect_url'] ) && $response['redirect_url'] ) {
|
220 |
+
|
221 |
+
ob_start();
|
222 |
+
|
223 |
+
$params = parse_url( $response['redirect_url'] );
|
224 |
+
|
225 |
+
parse_str( $params['query'], $fields );
|
226 |
+
|
227 |
+
if ( isset( $fields['sum'] ) && isset( $fields['qty'] ) ) {
|
228 |
+
$fields['sum'] = $fields['sum'] * $fields['qty'];
|
229 |
+
}
|
230 |
+
|
231 |
+
if ( $this->get( 'http_build_query_selectively' ) === 'on' ) {
|
232 |
+
$fields_to_add = explode( ',', $this->get( 'http_build_query_selectively_fields' ) );
|
233 |
+
|
234 |
+
foreach ( $fields_to_add as $field_to_add ) {
|
235 |
+
$field_to_add = trim( $field_to_add );
|
236 |
+
$fields[ $field_to_add ] = isset( $this->posted_data[ $field_to_add ] ) ? $this->posted_data[ $field_to_add ] : '';
|
237 |
+
}
|
238 |
+
} elseif ( $this->get( 'http_build_query' ) === 'on' ) {
|
239 |
+
$fields = array_merge( $this->posted_data, $fields );
|
240 |
+
}
|
241 |
+
|
242 |
+
?>
|
243 |
+
<form id="cf7r-result-form" action="<?php echo $response['redirect_url']; ?>" method="post">
|
244 |
+
<?php foreach ( $fields as $field_key => $field_value ) : ?>
|
245 |
+
<input type="hidden" name="<?php echo $field_key; ?>" value="<?php echo $field_value; ?>">
|
246 |
+
<?php endforeach; ?>
|
247 |
+
</form>
|
248 |
+
<?php
|
249 |
+
$response['form'] = ob_get_clean();
|
250 |
+
|
251 |
+
} elseif ( $this->get( 'http_build_query' ) === 'on' ) {
|
252 |
+
|
253 |
+
$response['http_build_query'] = true;
|
254 |
+
|
255 |
+
$response['redirect_url'] = add_query_arg( $this->posted_data, $response['redirect_url'] );
|
256 |
+
|
257 |
+
} elseif ( $this->get( 'http_build_query_selectively' ) === 'on' ) {
|
258 |
+
|
259 |
+
$fields_to_add = explode( ',', $this->get( 'http_build_query_selectively_fields' ) );
|
260 |
+
$fields_to_add_args = array();
|
261 |
+
|
262 |
+
foreach ( $fields_to_add as $field_to_add ) {
|
263 |
+
$field_to_add = trim( $field_to_add );
|
264 |
+
$fields_to_add_args[ $field_to_add ] = isset( $this->posted_data[ $field_to_add ] ) ? $this->posted_data[ $field_to_add ] : '';
|
265 |
+
}
|
266 |
+
|
267 |
+
$response['redirect_url'] = add_query_arg( $fields_to_add_args, $response['redirect_url'] );
|
268 |
+
}
|
269 |
+
|
270 |
+
if ( $this->get( 'after_sent_script' ) ) {
|
271 |
+
$response['after_sent_script'] = $this->get( 'after_sent_script' );
|
272 |
+
}
|
273 |
+
|
274 |
+
if ( $this->get( 'open_in_new_tab' ) === 'on' ) {
|
275 |
+
$response['type'] = 'new_tab';
|
276 |
+
}
|
277 |
+
|
278 |
+
return $response;
|
279 |
+
}
|
280 |
+
}
|
classes/actions/class-wpcf7r-action-save-lead.php
CHANGED
@@ -1,168 +1,168 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7R_Action_Save_Lead file - handles send send to api process
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
register_wpcf7r_actions( 'save_lead', __( 'Save Lead', 'wpcf7-redirect' ), 'WPCF7R_Action_Save_Lead', 3 );
|
9 |
-
|
10 |
-
class WPCF7R_Action_Save_Lead extends WPCF7R_Action {
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Init the parent action class
|
14 |
-
*/
|
15 |
-
public function __construct( $post ) {
|
16 |
-
parent::__construct( $post );
|
17 |
-
$this->priority = 1;
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Get the action admin fields
|
22 |
-
*/
|
23 |
-
public function get_action_fields() {
|
24 |
-
|
25 |
-
$parent_fields = parent::get_default_fields();
|
26 |
-
|
27 |
-
unset( $parent_fields['action_status'] );
|
28 |
-
|
29 |
-
return array_merge(
|
30 |
-
array(
|
31 |
-
'tags_map_mapping_section' => array(
|
32 |
-
'name' => 'tags_map_mapping_section',
|
33 |
-
'type' => 'section',
|
34 |
-
'title' => __( 'Tags mapping', 'wpcf7-redirect' ),
|
35 |
-
'fields' => array(
|
36 |
-
array(
|
37 |
-
'name' => 'leads_map',
|
38 |
-
'type' => 'leads_map',
|
39 |
-
'label' => '',
|
40 |
-
'sub_title' => '',
|
41 |
-
'placeholder' => '',
|
42 |
-
'show_selector' => '',
|
43 |
-
'value' => maybe_unserialize( $this->get( 'leads_map' ) ),
|
44 |
-
'tags' => WPCF7R_Form::get_mail_tags(),
|
45 |
-
),
|
46 |
-
),
|
47 |
-
),
|
48 |
-
'action_status' => array(
|
49 |
-
'name' => 'action_status',
|
50 |
-
'type' => 'checkbox',
|
51 |
-
'label' => $this->get_action_status_label(),
|
52 |
-
'sub_title' => __( 'if this is off the rule will not be applied', 'wpcf7-redirect' ),
|
53 |
-
'placeholder' => '',
|
54 |
-
'show_selector' => '',
|
55 |
-
'toggle-label' => json_encode(
|
56 |
-
array(
|
57 |
-
'.field-wrap-action_status .checkbox-label,.column-status a' => array(
|
58 |
-
__( 'Enabled', 'wpcf7-redirect' ),
|
59 |
-
__( 'Disabled', 'wpcf7-redirect' ),
|
60 |
-
),
|
61 |
-
)
|
62 |
-
),
|
63 |
-
'value' => $this->get( 'action_status' ),
|
64 |
-
),
|
65 |
-
),
|
66 |
-
$parent_fields
|
67 |
-
);
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Get an HTML of the
|
72 |
-
*/
|
73 |
-
public function get_action_settings() {
|
74 |
-
|
75 |
-
$this->get_settings_template( 'html-action-redirect.php' );
|
76 |
-
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Connected to manage_columns hooks.
|
81 |
-
*
|
82 |
-
* @param [string] $column - key of the column.
|
83 |
-
* @param [int] $lead_id - the id of the relevant post.
|
84 |
-
* @return void
|
85 |
-
*/
|
86 |
-
public function display_action_column_content( $column, $lead_id ) {
|
87 |
-
switch ( $column ) {
|
88 |
-
case 'form':
|
89 |
-
echo $this->get_cf7_link_html();
|
90 |
-
break;
|
91 |
-
case 'data_preview':
|
92 |
-
echo $this->display_columns_values( $lead_id );
|
93 |
-
break;
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Display the values that were selected on the action.
|
99 |
-
*
|
100 |
-
* @return void
|
101 |
-
*/
|
102 |
-
private function display_columns_values( $lead_id ) {
|
103 |
-
$mapped_fields = maybe_unserialize( $this->get( 'leads_map' ) );
|
104 |
-
$none_selected = true;
|
105 |
-
if ( $mapped_fields ) {
|
106 |
-
foreach ( $mapped_fields as $field_key => $mapped_field ) {
|
107 |
-
if ( isset( $mapped_field['appear'] ) && $mapped_field['appear'] ) {
|
108 |
-
$label = $mapped_field['tag'] ? $mapped_field['tag'] : $field_key;
|
109 |
-
|
110 |
-
$string = $label . ': ' . get_post_meta( $lead_id, $field_key, true );
|
111 |
-
|
112 |
-
echo sprintf( "<div class='preview-data'>%s</div>", $string );
|
113 |
-
|
114 |
-
$none_selected = false;
|
115 |
-
}
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
if ( $none_selected ) {
|
120 |
-
echo __( 'No preview defined', 'wpcf7-redirect' );
|
121 |
-
}
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Handle a simple redirect rule
|
126 |
-
*
|
127 |
-
* @param $submission
|
128 |
-
*/
|
129 |
-
public function process( $submission ) {
|
130 |
-
$contact_form = $submission->get_contact_form();
|
131 |
-
|
132 |
-
// insert the lead to the DB
|
133 |
-
$files = $submission->uploaded_files();
|
134 |
-
|
135 |
-
$submitted_files = array();
|
136 |
-
|
137 |
-
$posted_values = $submission->get_posted_data();
|
138 |
-
|
139 |
-
if ( $files ) {
|
140 |
-
foreach ( $files as $file_key => $file_path ) {
|
141 |
-
|
142 |
-
$type = pathinfo( $file_path, PATHINFO_EXTENSION );
|
143 |
-
|
144 |
-
$submitted_files[ $file_key ] = array(
|
145 |
-
'type' => $type,
|
146 |
-
'name' => basename( $file_path ),
|
147 |
-
'base64_file' => wpcf7r_base_64_file( $file_path ),
|
148 |
-
'path' => $file_path,
|
149 |
-
);
|
150 |
-
unset( $posted_values[ $file_key ] );
|
151 |
-
}
|
152 |
-
}
|
153 |
-
|
154 |
-
$lead = WPCF7R_Leads_Manager::insert_lead( $contact_form->id(), $posted_values, $submitted_files, 'contact', $this->get_id() );
|
155 |
-
|
156 |
-
self::set_lead_id( $lead->post_id );
|
157 |
-
|
158 |
-
$response = array(
|
159 |
-
'type' => 'save_lead',
|
160 |
-
'data' => array(
|
161 |
-
'lead_id' => $lead->post_id,
|
162 |
-
),
|
163 |
-
);
|
164 |
-
|
165 |
-
return $response;
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7R_Action_Save_Lead file - handles send send to api process
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
register_wpcf7r_actions( 'save_lead', __( 'Save Lead', 'wpcf7-redirect' ), 'WPCF7R_Action_Save_Lead', 3 );
|
9 |
+
|
10 |
+
class WPCF7R_Action_Save_Lead extends WPCF7R_Action {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Init the parent action class
|
14 |
+
*/
|
15 |
+
public function __construct( $post ) {
|
16 |
+
parent::__construct( $post );
|
17 |
+
$this->priority = 1;
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Get the action admin fields
|
22 |
+
*/
|
23 |
+
public function get_action_fields() {
|
24 |
+
|
25 |
+
$parent_fields = parent::get_default_fields();
|
26 |
+
|
27 |
+
unset( $parent_fields['action_status'] );
|
28 |
+
|
29 |
+
return array_merge(
|
30 |
+
array(
|
31 |
+
'tags_map_mapping_section' => array(
|
32 |
+
'name' => 'tags_map_mapping_section',
|
33 |
+
'type' => 'section',
|
34 |
+
'title' => __( 'Tags mapping', 'wpcf7-redirect' ),
|
35 |
+
'fields' => array(
|
36 |
+
array(
|
37 |
+
'name' => 'leads_map',
|
38 |
+
'type' => 'leads_map',
|
39 |
+
'label' => '',
|
40 |
+
'sub_title' => '',
|
41 |
+
'placeholder' => '',
|
42 |
+
'show_selector' => '',
|
43 |
+
'value' => maybe_unserialize( $this->get( 'leads_map' ) ),
|
44 |
+
'tags' => WPCF7R_Form::get_mail_tags(),
|
45 |
+
),
|
46 |
+
),
|
47 |
+
),
|
48 |
+
'action_status' => array(
|
49 |
+
'name' => 'action_status',
|
50 |
+
'type' => 'checkbox',
|
51 |
+
'label' => $this->get_action_status_label(),
|
52 |
+
'sub_title' => __( 'if this is off the rule will not be applied', 'wpcf7-redirect' ),
|
53 |
+
'placeholder' => '',
|
54 |
+
'show_selector' => '',
|
55 |
+
'toggle-label' => json_encode(
|
56 |
+
array(
|
57 |
+
'.field-wrap-action_status .checkbox-label,.column-status a' => array(
|
58 |
+
__( 'Enabled', 'wpcf7-redirect' ),
|
59 |
+
__( 'Disabled', 'wpcf7-redirect' ),
|
60 |
+
),
|
61 |
+
)
|
62 |
+
),
|
63 |
+
'value' => $this->get( 'action_status' ),
|
64 |
+
),
|
65 |
+
),
|
66 |
+
$parent_fields
|
67 |
+
);
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Get an HTML of the
|
72 |
+
*/
|
73 |
+
public function get_action_settings() {
|
74 |
+
|
75 |
+
$this->get_settings_template( 'html-action-redirect.php' );
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Connected to manage_columns hooks.
|
81 |
+
*
|
82 |
+
* @param [string] $column - key of the column.
|
83 |
+
* @param [int] $lead_id - the id of the relevant post.
|
84 |
+
* @return void
|
85 |
+
*/
|
86 |
+
public function display_action_column_content( $column, $lead_id ) {
|
87 |
+
switch ( $column ) {
|
88 |
+
case 'form':
|
89 |
+
echo $this->get_cf7_link_html();
|
90 |
+
break;
|
91 |
+
case 'data_preview':
|
92 |
+
echo $this->display_columns_values( $lead_id );
|
93 |
+
break;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Display the values that were selected on the action.
|
99 |
+
*
|
100 |
+
* @return void
|
101 |
+
*/
|
102 |
+
private function display_columns_values( $lead_id ) {
|
103 |
+
$mapped_fields = maybe_unserialize( $this->get( 'leads_map' ) );
|
104 |
+
$none_selected = true;
|
105 |
+
if ( $mapped_fields ) {
|
106 |
+
foreach ( $mapped_fields as $field_key => $mapped_field ) {
|
107 |
+
if ( isset( $mapped_field['appear'] ) && $mapped_field['appear'] ) {
|
108 |
+
$label = $mapped_field['tag'] ? $mapped_field['tag'] : $field_key;
|
109 |
+
|
110 |
+
$string = $label . ': ' . get_post_meta( $lead_id, $field_key, true );
|
111 |
+
|
112 |
+
echo sprintf( "<div class='preview-data'>%s</div>", $string );
|
113 |
+
|
114 |
+
$none_selected = false;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
if ( $none_selected ) {
|
120 |
+
echo __( 'No preview defined', 'wpcf7-redirect' );
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Handle a simple redirect rule
|
126 |
+
*
|
127 |
+
* @param $submission
|
128 |
+
*/
|
129 |
+
public function process( $submission ) {
|
130 |
+
$contact_form = $submission->get_contact_form();
|
131 |
+
|
132 |
+
// insert the lead to the DB
|
133 |
+
$files = $submission->uploaded_files();
|
134 |
+
|
135 |
+
$submitted_files = array();
|
136 |
+
|
137 |
+
$posted_values = $submission->get_posted_data();
|
138 |
+
|
139 |
+
if ( $files ) {
|
140 |
+
foreach ( $files as $file_key => $file_path ) {
|
141 |
+
|
142 |
+
$type = pathinfo( $file_path, PATHINFO_EXTENSION );
|
143 |
+
|
144 |
+
$submitted_files[ $file_key ] = array(
|
145 |
+
'type' => $type,
|
146 |
+
'name' => basename( $file_path ),
|
147 |
+
'base64_file' => wpcf7r_base_64_file( $file_path ),
|
148 |
+
'path' => $file_path,
|
149 |
+
);
|
150 |
+
unset( $posted_values[ $file_key ] );
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
$lead = WPCF7R_Leads_Manager::insert_lead( $contact_form->id(), $posted_values, $submitted_files, 'contact', $this->get_id() );
|
155 |
+
|
156 |
+
self::set_lead_id( $lead->post_id );
|
157 |
+
|
158 |
+
$response = array(
|
159 |
+
'type' => 'save_lead',
|
160 |
+
'data' => array(
|
161 |
+
'lead_id' => $lead->post_id,
|
162 |
+
),
|
163 |
+
);
|
164 |
+
|
165 |
+
return $response;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
classes/actions/class-wpcf7r-action-send-to-api.php
CHANGED
@@ -1,409 +1,409 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7R_Action_api_url_request file
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
class WPCF7R_Action_Send_To_Api extends WPCF7R_Action {
|
9 |
-
|
10 |
-
public function __construct( $post ) {
|
11 |
-
$this->action_id = $post->ID;
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* The handler that will send the data to the api
|
16 |
-
*
|
17 |
-
* @param $args
|
18 |
-
*/
|
19 |
-
public function qs_cf7_send_data_to_api( $args ) {
|
20 |
-
$this->defaults = $args['tags_defaults'];
|
21 |
-
$this->functions = $args['tags_functions'];
|
22 |
-
$this->headers = $args['api_headers'];
|
23 |
-
$this->headers = array_filter( $this->headers );
|
24 |
-
|
25 |
-
$tags_map = $args['tags'];
|
26 |
-
$record_type = $args['record_type'];
|
27 |
-
$input_type = $args['input_type'];
|
28 |
-
$base_url = $args['base_url'];
|
29 |
-
$submission = isset( $args['submission'] ) ? $args['submission'] : '';
|
30 |
-
$template = $args['request_template'];
|
31 |
-
|
32 |
-
if ( 'xml' === $record_type ) {
|
33 |
-
$this->headers['Content-Type'] = 'text/xml';
|
34 |
-
} elseif ( 'json' === $record_type ) {
|
35 |
-
$this->headers['Content-Type'] = 'application/json';
|
36 |
-
}
|
37 |
-
|
38 |
-
$submission = WPCF7_Submission::get_instance();
|
39 |
-
$wpcf7 = $submission->get_contact_form();
|
40 |
-
|
41 |
-
$this->post = $wpcf7;
|
42 |
-
$this->clear_error_log( $this->post->id() );
|
43 |
-
|
44 |
-
$submission_url = $submission->get_meta( 'url' );
|
45 |
-
|
46 |
-
//always save last call results for debugging
|
47 |
-
|
48 |
-
$record = $this->get_record( $submission, $tags_map, $record_type, $template );
|
49 |
-
$record['url'] = $base_url;
|
50 |
-
|
51 |
-
if ( isset( $record['url'] ) && $record['url'] ) {
|
52 |
-
do_action( 'qs_cf7_api_before_sent_to_api', $record );
|
53 |
-
$response = $this->send_lead( $record, true, $input_type, $record_type, $tags_map );
|
54 |
-
do_action( 'qs_cf7_api_after_sent_to_api', $record, $response );
|
55 |
-
|
56 |
-
} else {
|
57 |
-
$this->log_result( __( 'Missing url' ), '' );
|
58 |
-
}
|
59 |
-
|
60 |
-
return array( $response, $record );
|
61 |
-
}
|
62 |
-
|
63 |
-
public function log_result( $record, $response ) {
|
64 |
-
if ( isset( $record['url'] ) ) {
|
65 |
-
update_post_meta( $this->action_id, 'api_debug_url', $record['url'] );
|
66 |
-
}
|
67 |
-
|
68 |
-
if ( is_wp_error( $response ) || is_wp_error( $record ) ) {
|
69 |
-
update_post_meta( $this->action_id, 'api_debug_result', $response );
|
70 |
-
update_post_meta( $this->action_id, 'api_debug_params', $record );
|
71 |
-
} else {
|
72 |
-
update_post_meta( $this->action_id, 'api_debug_params', $record );
|
73 |
-
update_post_meta( $this->action_id, 'api_debug_result', $response );
|
74 |
-
}
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Clear error log
|
79 |
-
*/
|
80 |
-
function clear_error_log( $post_id ) {
|
81 |
-
delete_post_meta( $post_id, 'api_errors' );
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Convert the form keys to the API keys according to the mapping instructions
|
86 |
-
*
|
87 |
-
* @param $submission
|
88 |
-
* @param $tags_map
|
89 |
-
* @param string $type
|
90 |
-
* @param string $template
|
91 |
-
*/
|
92 |
-
function get_record( $submission, $tags_map, $type = 'params', $template = '' ) {
|
93 |
-
$submited_data = $submission->get_posted_data();
|
94 |
-
|
95 |
-
if ( 'xml' === $type || 'json' === $type ) {
|
96 |
-
$template = $this->replace_lead_id_tag( $template );
|
97 |
-
|
98 |
-
foreach ( $tags_map as $form_key => $qs_cf7_form_key ) {
|
99 |
-
if ( is_array( $qs_cf7_form_key ) ) {
|
100 |
-
|
101 |
-
//arrange checkbox arrays
|
102 |
-
if ( isset( $submited_data[ $form_key ] ) ) {
|
103 |
-
$value = apply_filters( 'set_record_value', $submited_data[ $form_key ], $qs_cf7_form_key, $form_key );
|
104 |
-
$value = is_array( $value ) ? implode( ',', $value ) : $value;
|
105 |
-
}
|
106 |
-
} else {
|
107 |
-
$value = isset( $submited_data[ $form_key ] ) ? $submited_data[ $form_key ] : '';
|
108 |
-
$value = apply_filters( 'set_record_value', $value, $qs_cf7_form_key, $form_key );
|
109 |
-
|
110 |
-
//flattan radio
|
111 |
-
if ( is_array( $value ) ) {
|
112 |
-
$value = reset( $value );
|
113 |
-
}
|
114 |
-
}
|
115 |
-
|
116 |
-
//set defaults
|
117 |
-
|
118 |
-
if ( ! $value ) {
|
119 |
-
if ( isset( $this->defaults[ $form_key ] ) ) {
|
120 |
-
if ( is_array( $this->defaults[ $form_key ] ) ) {
|
121 |
-
$value = array();
|
122 |
-
|
123 |
-
foreach ( $this->defaults[ $form_key ] as $key => $sub_value ) {
|
124 |
-
if ( isset( $this->functions[ $key ] ) && $this->functions[ $key ] ) {
|
125 |
-
$sub_value = $this->run_function( $this->functions[ $key ], $sub_value );
|
126 |
-
}
|
127 |
-
|
128 |
-
if ( $sub_value ) {
|
129 |
-
$value[] = $sub_value;
|
130 |
-
}
|
131 |
-
|
132 |
-
$template = str_replace( "[{$key}]", $sub_value, $template );
|
133 |
-
}
|
134 |
-
|
135 |
-
$value = implode( ',', $value );
|
136 |
-
|
137 |
-
} else {
|
138 |
-
$value = $this->defaults[ $form_key ];
|
139 |
-
}
|
140 |
-
}
|
141 |
-
}
|
142 |
-
|
143 |
-
if ( isset( $this->functions[ $form_key ] ) && $this->functions[ $form_key ] ) {
|
144 |
-
|
145 |
-
//dont call the function again on arrays (checkvoxes)
|
146 |
-
|
147 |
-
if ( ! is_array( $this->functions[ $form_key ] ) ) {
|
148 |
-
$value = $this->run_function( $this->functions[ $form_key ], $value );
|
149 |
-
}
|
150 |
-
}
|
151 |
-
|
152 |
-
$value = trim( preg_replace( '/(\r\n)|\n|\r/', '\\n', $value ) );
|
153 |
-
$template = str_replace( "[{$form_key}]", $value, $template );
|
154 |
-
}
|
155 |
-
|
156 |
-
//replace special mail tags
|
157 |
-
|
158 |
-
foreach ( WPCF7R_Form::get_special_mail_tags() as $mail_tag ) {
|
159 |
-
$special = apply_filters( 'wpcf7_special_mail_tags', null, $mail_tag->field_name(), $template, $mail_tag );
|
160 |
-
$template = str_replace( "[{$mail_tag->field_name()}]", $special, $template );
|
161 |
-
}
|
162 |
-
|
163 |
-
//clean unchanged tags
|
164 |
-
|
165 |
-
$template = $this->replace_tags( $template );
|
166 |
-
$record['fields'] = $template;
|
167 |
-
|
168 |
-
} else {
|
169 |
-
$record = $this->get_record_by_tag_map( $submited_data, $tags_map );
|
170 |
-
$record = $this->set_defaults_and_run_functions( $record, $tags_map );
|
171 |
-
}
|
172 |
-
|
173 |
-
$record = apply_filters( 'cf7api_create_record', $record, $submited_data, $tags_map, $type, $template );
|
174 |
-
|
175 |
-
return $record;
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Create a record object
|
180 |
-
*
|
181 |
-
* @param $submited_data
|
182 |
-
* @param $tags_map
|
183 |
-
*/
|
184 |
-
public function get_record_by_tag_map( $submited_data, $tags_map ) {
|
185 |
-
|
186 |
-
$record = array();
|
187 |
-
|
188 |
-
foreach ( $tags_map as $form_key => $qs_cf7_form_key ) {
|
189 |
-
if ( $qs_cf7_form_key ) {
|
190 |
-
if ( is_array( $qs_cf7_form_key ) ) {
|
191 |
-
|
192 |
-
//arrange checkbox arrays
|
193 |
-
foreach ( $submited_data[ $form_key ] as $value ) {
|
194 |
-
if ( $value ) {
|
195 |
-
if ( 'lead_id' === $form_key ) {
|
196 |
-
$record['fields'][ $qs_cf7_form_key[ $value ] ] = apply_filters( 'set_record_value', self::get_lead_id(), $qs_cf7_form_key );
|
197 |
-
} else {
|
198 |
-
$record['fields'][ $qs_cf7_form_key[ $value ] ] = apply_filters( 'set_record_value', $value, $qs_cf7_form_key );
|
199 |
-
}
|
200 |
-
}
|
201 |
-
}
|
202 |
-
} else {
|
203 |
-
$value = isset( $submited_data[ $form_key ] ) ? $submited_data[ $form_key ] : '';
|
204 |
-
|
205 |
-
//flattan radio
|
206 |
-
if ( is_array( $value ) && count( $value ) === 1 ) {
|
207 |
-
$value = reset( $value );
|
208 |
-
}
|
209 |
-
|
210 |
-
if ( 'lead_id' === $form_key ) {
|
211 |
-
$record['fields'][ $qs_cf7_form_key ] = apply_filters( 'set_record_value', self::get_lead_id(), $qs_cf7_form_key );
|
212 |
-
} else {
|
213 |
-
$record['fields'][ $qs_cf7_form_key ] = apply_filters( 'set_record_value', $value, $qs_cf7_form_key );
|
214 |
-
}
|
215 |
-
}
|
216 |
-
}
|
217 |
-
}
|
218 |
-
|
219 |
-
return $record;
|
220 |
-
}
|
221 |
-
|
222 |
-
/**
|
223 |
-
* Set the fields defaults
|
224 |
-
*/
|
225 |
-
public function set_defaults_and_run_functions( $record, $tags_map ) {
|
226 |
-
|
227 |
-
//set default values
|
228 |
-
|
229 |
-
if ( $this->defaults && array_values( $this->defaults ) ) {
|
230 |
-
foreach ( $this->defaults as $default_field_key => $default_value ) {
|
231 |
-
if ( $default_value ) {
|
232 |
-
$api_key = $tags_map[ $default_field_key ];
|
233 |
-
$record['fields'][ $api_key ] = isset( $record['fields'][ $api_key ] ) && $record['fields'][ $api_key ] ? $record['fields'][ $api_key ] : $default_value;
|
234 |
-
}
|
235 |
-
}
|
236 |
-
}
|
237 |
-
|
238 |
-
//run functions on values
|
239 |
-
|
240 |
-
if ( $this->functions && array_values( $this->functions ) ) {
|
241 |
-
foreach ( $this->functions as $field_key => $function ) {
|
242 |
-
$api_key = $tags_map[ $field_key ];
|
243 |
-
$field_value = $record['fields'][ $api_key ];
|
244 |
-
|
245 |
-
if ( $function && $field_value ) {
|
246 |
-
$record['fields'][ $api_key ] = $this->run_function( $function, $field_value );
|
247 |
-
}
|
248 |
-
}
|
249 |
-
}
|
250 |
-
|
251 |
-
return $record;
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Run custom functions on user submission
|
256 |
-
*
|
257 |
-
* @param $function
|
258 |
-
* @param $field_value
|
259 |
-
*/
|
260 |
-
public function run_function( $function, $field_value ) {
|
261 |
-
|
262 |
-
$function = WPCF7r_Utils::get_available_text_functions( $function, 'all' );
|
263 |
-
|
264 |
-
if ( $function ) {
|
265 |
-
$class = $function[0];
|
266 |
-
$method = $function[1];
|
267 |
-
|
268 |
-
return call_user_func( array( $class, $method ), $field_value );
|
269 |
-
}
|
270 |
-
|
271 |
-
return $field_value;
|
272 |
-
}
|
273 |
-
|
274 |
-
/**
|
275 |
-
* Send the lead using wp_remote
|
276 |
-
*
|
277 |
-
* @param $record
|
278 |
-
* @param boolean $debug
|
279 |
-
* @param string $method
|
280 |
-
* @param string $record_type
|
281 |
-
*/
|
282 |
-
private function send_lead( $record, $debug = false, $method = 'GET', $record_type = 'params' ) {
|
283 |
-
|
284 |
-
global $wp_version;
|
285 |
-
|
286 |
-
$lead = $record['fields'];
|
287 |
-
$url = $record['url'];
|
288 |
-
|
289 |
-
if ( ( 'get' === $method || 'GET' === $method ) && ( 'params' === $record_type || 'json' === $record_type ) ) {
|
290 |
-
$args = array(
|
291 |
-
'timeout' => 100,
|
292 |
-
'redirection' => 5,
|
293 |
-
'httpversion' => '1.0',
|
294 |
-
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url(),
|
295 |
-
'blocking' => true,
|
296 |
-
'headers' => $this->headers,
|
297 |
-
'cookies' => array(),
|
298 |
-
'body' => null,
|
299 |
-
'compress' => false,
|
300 |
-
'decompress' => true,
|
301 |
-
'sslverify' => true,
|
302 |
-
'stream' => false,
|
303 |
-
'filename' => null,
|
304 |
-
);
|
305 |
-
|
306 |
-
if ( 'xml' === $record_type ) {
|
307 |
-
$xml = $this->get_xml( $lead );
|
308 |
-
if ( is_wp_error( $xml ) ) {
|
309 |
-
return $xml;
|
310 |
-
}
|
311 |
-
|
312 |
-
$args['body'] = $xml->asXML();
|
313 |
-
} elseif ( 'json' === $record_type ) {
|
314 |
-
$json = wp_json_encode( $lead );
|
315 |
-
if ( is_wp_error( $json ) ) {
|
316 |
-
return $json;
|
317 |
-
} else {
|
318 |
-
$args['body'] = $json;
|
319 |
-
}
|
320 |
-
} else {
|
321 |
-
$lead_string = http_build_query( $lead );
|
322 |
-
$url = strpos( '?', $url ) ? $url . '&' . $lead_string : $url . '?' . $lead_string;
|
323 |
-
}
|
324 |
-
|
325 |
-
$args = apply_filters( 'qs_cf7_api_get_args', $args );
|
326 |
-
$url = apply_filters( 'qs_cf7_api_get_url', $url, $record );
|
327 |
-
$url = $this->replace_tags( $url );
|
328 |
-
|
329 |
-
$result = wp_remote_get( $url, $args );
|
330 |
-
} else {
|
331 |
-
$args = array(
|
332 |
-
'timeout' => 100,
|
333 |
-
'redirection' => 5,
|
334 |
-
'method' => strtoupper( $method ),
|
335 |
-
'httpversion' => '1.0',
|
336 |
-
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url(),
|
337 |
-
'blocking' => true,
|
338 |
-
'headers' => $this->headers,
|
339 |
-
'cookies' => array(),
|
340 |
-
'body' => $lead,
|
341 |
-
'compress' => false,
|
342 |
-
'decompress' => true,
|
343 |
-
'sslverify' => true,
|
344 |
-
'stream' => false,
|
345 |
-
'filename' => null,
|
346 |
-
);
|
347 |
-
|
348 |
-
if ( 'xml' === $record_type ) {
|
349 |
-
$xml = $this->get_xml( $lead );
|
350 |
-
|
351 |
-
if ( is_wp_error( $xml ) ) {
|
352 |
-
return $xml;
|
353 |
-
}
|
354 |
-
|
355 |
-
$args['body'] = $xml->asXML();
|
356 |
-
} elseif ( 'json' === $record_type ) {
|
357 |
-
$json = wp_json_encode( json_decode( $lead ) );
|
358 |
-
if ( is_wp_error( $json ) ) {
|
359 |
-
return $json;
|
360 |
-
} else {
|
361 |
-
$args['body'] = $json;
|
362 |
-
}
|
363 |
-
}
|
364 |
-
|
365 |
-
$args = apply_filters( 'qs_cf7_api_get_args', $args );
|
366 |
-
$url = apply_filters( 'qs_cf7_api_post_url', $url );
|
367 |
-
$url = $this->replace_tags( $url );
|
368 |
-
|
369 |
-
$result = wp_remote_request( $url, $args );
|
370 |
-
}
|
371 |
-
|
372 |
-
$this->log_result( $args, $result );
|
373 |
-
|
374 |
-
do_action( 'after_qs_cf7_api_send_lead', $result, $record, $args );
|
375 |
-
|
376 |
-
if ( ! is_wp_error( $result ) ) {
|
377 |
-
$results['response_raw'] = $result;
|
378 |
-
$results['response'] = wp_remote_retrieve_body( $result );
|
379 |
-
}
|
380 |
-
|
381 |
-
return $result;
|
382 |
-
}
|
383 |
-
|
384 |
-
/**
|
385 |
-
* Get XML
|
386 |
-
*
|
387 |
-
* @param $lead
|
388 |
-
*/
|
389 |
-
private function get_xml( $lead ) {
|
390 |
-
|
391 |
-
$xml = '';
|
392 |
-
|
393 |
-
if ( function_exists( 'simplexml_load_string' ) ) {
|
394 |
-
libxml_use_internal_errors( true );
|
395 |
-
$xml = simplexml_load_string( $lead );
|
396 |
-
|
397 |
-
if ( false === $xml ) {
|
398 |
-
$xml = new WP_Error(
|
399 |
-
'xml',
|
400 |
-
__( 'XML Structure is incorrect', 'wpcf7-redirect' )
|
401 |
-
);
|
402 |
-
|
403 |
-
}
|
404 |
-
}
|
405 |
-
|
406 |
-
return $xml;
|
407 |
-
}
|
408 |
-
}
|
409 |
-
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7R_Action_api_url_request file
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
class WPCF7R_Action_Send_To_Api extends WPCF7R_Action {
|
9 |
+
|
10 |
+
public function __construct( $post ) {
|
11 |
+
$this->action_id = $post->ID;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* The handler that will send the data to the api
|
16 |
+
*
|
17 |
+
* @param $args
|
18 |
+
*/
|
19 |
+
public function qs_cf7_send_data_to_api( $args ) {
|
20 |
+
$this->defaults = $args['tags_defaults'];
|
21 |
+
$this->functions = $args['tags_functions'];
|
22 |
+
$this->headers = $args['api_headers'];
|
23 |
+
$this->headers = array_filter( $this->headers );
|
24 |
+
|
25 |
+
$tags_map = $args['tags'];
|
26 |
+
$record_type = $args['record_type'];
|
27 |
+
$input_type = $args['input_type'];
|
28 |
+
$base_url = $args['base_url'];
|
29 |
+
$submission = isset( $args['submission'] ) ? $args['submission'] : '';
|
30 |
+
$template = $args['request_template'];
|
31 |
+
|
32 |
+
if ( 'xml' === $record_type ) {
|
33 |
+
$this->headers['Content-Type'] = 'text/xml';
|
34 |
+
} elseif ( 'json' === $record_type ) {
|
35 |
+
$this->headers['Content-Type'] = 'application/json';
|
36 |
+
}
|
37 |
+
|
38 |
+
$submission = WPCF7_Submission::get_instance();
|
39 |
+
$wpcf7 = $submission->get_contact_form();
|
40 |
+
|
41 |
+
$this->post = $wpcf7;
|
42 |
+
$this->clear_error_log( $this->post->id() );
|
43 |
+
|
44 |
+
$submission_url = $submission->get_meta( 'url' );
|
45 |
+
|
46 |
+
//always save last call results for debugging
|
47 |
+
|
48 |
+
$record = $this->get_record( $submission, $tags_map, $record_type, $template );
|
49 |
+
$record['url'] = $base_url;
|
50 |
+
|
51 |
+
if ( isset( $record['url'] ) && $record['url'] ) {
|
52 |
+
do_action( 'qs_cf7_api_before_sent_to_api', $record );
|
53 |
+
$response = $this->send_lead( $record, true, $input_type, $record_type, $tags_map );
|
54 |
+
do_action( 'qs_cf7_api_after_sent_to_api', $record, $response );
|
55 |
+
|
56 |
+
} else {
|
57 |
+
$this->log_result( __( 'Missing url' ), '' );
|
58 |
+
}
|
59 |
+
|
60 |
+
return array( $response, $record );
|
61 |
+
}
|
62 |
+
|
63 |
+
public function log_result( $record, $response ) {
|
64 |
+
if ( isset( $record['url'] ) ) {
|
65 |
+
update_post_meta( $this->action_id, 'api_debug_url', $record['url'] );
|
66 |
+
}
|
67 |
+
|
68 |
+
if ( is_wp_error( $response ) || is_wp_error( $record ) ) {
|
69 |
+
update_post_meta( $this->action_id, 'api_debug_result', $response );
|
70 |
+
update_post_meta( $this->action_id, 'api_debug_params', $record );
|
71 |
+
} else {
|
72 |
+
update_post_meta( $this->action_id, 'api_debug_params', $record );
|
73 |
+
update_post_meta( $this->action_id, 'api_debug_result', $response );
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Clear error log
|
79 |
+
*/
|
80 |
+
function clear_error_log( $post_id ) {
|
81 |
+
delete_post_meta( $post_id, 'api_errors' );
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Convert the form keys to the API keys according to the mapping instructions
|
86 |
+
*
|
87 |
+
* @param $submission
|
88 |
+
* @param $tags_map
|
89 |
+
* @param string $type
|
90 |
+
* @param string $template
|
91 |
+
*/
|
92 |
+
function get_record( $submission, $tags_map, $type = 'params', $template = '' ) {
|
93 |
+
$submited_data = $submission->get_posted_data();
|
94 |
+
|
95 |
+
if ( 'xml' === $type || 'json' === $type ) {
|
96 |
+
$template = $this->replace_lead_id_tag( $template );
|
97 |
+
|
98 |
+
foreach ( $tags_map as $form_key => $qs_cf7_form_key ) {
|
99 |
+
if ( is_array( $qs_cf7_form_key ) ) {
|
100 |
+
|
101 |
+
//arrange checkbox arrays
|
102 |
+
if ( isset( $submited_data[ $form_key ] ) ) {
|
103 |
+
$value = apply_filters( 'set_record_value', $submited_data[ $form_key ], $qs_cf7_form_key, $form_key );
|
104 |
+
$value = is_array( $value ) ? implode( ',', $value ) : $value;
|
105 |
+
}
|
106 |
+
} else {
|
107 |
+
$value = isset( $submited_data[ $form_key ] ) ? $submited_data[ $form_key ] : '';
|
108 |
+
$value = apply_filters( 'set_record_value', $value, $qs_cf7_form_key, $form_key );
|
109 |
+
|
110 |
+
//flattan radio
|
111 |
+
if ( is_array( $value ) ) {
|
112 |
+
$value = reset( $value );
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
//set defaults
|
117 |
+
|
118 |
+
if ( ! $value ) {
|
119 |
+
if ( isset( $this->defaults[ $form_key ] ) ) {
|
120 |
+
if ( is_array( $this->defaults[ $form_key ] ) ) {
|
121 |
+
$value = array();
|
122 |
+
|
123 |
+
foreach ( $this->defaults[ $form_key ] as $key => $sub_value ) {
|
124 |
+
if ( isset( $this->functions[ $key ] ) && $this->functions[ $key ] ) {
|
125 |
+
$sub_value = $this->run_function( $this->functions[ $key ], $sub_value );
|
126 |
+
}
|
127 |
+
|
128 |
+
if ( $sub_value ) {
|
129 |
+
$value[] = $sub_value;
|
130 |
+
}
|
131 |
+
|
132 |
+
$template = str_replace( "[{$key}]", $sub_value, $template );
|
133 |
+
}
|
134 |
+
|
135 |
+
$value = implode( ',', $value );
|
136 |
+
|
137 |
+
} else {
|
138 |
+
$value = $this->defaults[ $form_key ];
|
139 |
+
}
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
if ( isset( $this->functions[ $form_key ] ) && $this->functions[ $form_key ] ) {
|
144 |
+
|
145 |
+
//dont call the function again on arrays (checkvoxes)
|
146 |
+
|
147 |
+
if ( ! is_array( $this->functions[ $form_key ] ) ) {
|
148 |
+
$value = $this->run_function( $this->functions[ $form_key ], $value );
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
$value = trim( preg_replace( '/(\r\n)|\n|\r/', '\\n', $value ) );
|
153 |
+
$template = str_replace( "[{$form_key}]", $value, $template );
|
154 |
+
}
|
155 |
+
|
156 |
+
//replace special mail tags
|
157 |
+
|
158 |
+
foreach ( WPCF7R_Form::get_special_mail_tags() as $mail_tag ) {
|
159 |
+
$special = apply_filters( 'wpcf7_special_mail_tags', null, $mail_tag->field_name(), $template, $mail_tag );
|
160 |
+
$template = str_replace( "[{$mail_tag->field_name()}]", $special, $template );
|
161 |
+
}
|
162 |
+
|
163 |
+
//clean unchanged tags
|
164 |
+
|
165 |
+
$template = $this->replace_tags( $template );
|
166 |
+
$record['fields'] = $template;
|
167 |
+
|
168 |
+
} else {
|
169 |
+
$record = $this->get_record_by_tag_map( $submited_data, $tags_map );
|
170 |
+
$record = $this->set_defaults_and_run_functions( $record, $tags_map );
|
171 |
+
}
|
172 |
+
|
173 |
+
$record = apply_filters( 'cf7api_create_record', $record, $submited_data, $tags_map, $type, $template );
|
174 |
+
|
175 |
+
return $record;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Create a record object
|
180 |
+
*
|
181 |
+
* @param $submited_data
|
182 |
+
* @param $tags_map
|
183 |
+
*/
|
184 |
+
public function get_record_by_tag_map( $submited_data, $tags_map ) {
|
185 |
+
|
186 |
+
$record = array();
|
187 |
+
|
188 |
+
foreach ( $tags_map as $form_key => $qs_cf7_form_key ) {
|
189 |
+
if ( $qs_cf7_form_key ) {
|
190 |
+
if ( is_array( $qs_cf7_form_key ) ) {
|
191 |
+
|
192 |
+
//arrange checkbox arrays
|
193 |
+
foreach ( $submited_data[ $form_key ] as $value ) {
|
194 |
+
if ( $value ) {
|
195 |
+
if ( 'lead_id' === $form_key ) {
|
196 |
+
$record['fields'][ $qs_cf7_form_key[ $value ] ] = apply_filters( 'set_record_value', self::get_lead_id(), $qs_cf7_form_key );
|
197 |
+
} else {
|
198 |
+
$record['fields'][ $qs_cf7_form_key[ $value ] ] = apply_filters( 'set_record_value', $value, $qs_cf7_form_key );
|
199 |
+
}
|
200 |
+
}
|
201 |
+
}
|
202 |
+
} else {
|
203 |
+
$value = isset( $submited_data[ $form_key ] ) ? $submited_data[ $form_key ] : '';
|
204 |
+
|
205 |
+
//flattan radio
|
206 |
+
if ( is_array( $value ) && count( $value ) === 1 ) {
|
207 |
+
$value = reset( $value );
|
208 |
+
}
|
209 |
+
|
210 |
+
if ( 'lead_id' === $form_key ) {
|
211 |
+
$record['fields'][ $qs_cf7_form_key ] = apply_filters( 'set_record_value', self::get_lead_id(), $qs_cf7_form_key );
|
212 |
+
} else {
|
213 |
+
$record['fields'][ $qs_cf7_form_key ] = apply_filters( 'set_record_value', $value, $qs_cf7_form_key );
|
214 |
+
}
|
215 |
+
}
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
return $record;
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Set the fields defaults
|
224 |
+
*/
|
225 |
+
public function set_defaults_and_run_functions( $record, $tags_map ) {
|
226 |
+
|
227 |
+
//set default values
|
228 |
+
|
229 |
+
if ( $this->defaults && array_values( $this->defaults ) ) {
|
230 |
+
foreach ( $this->defaults as $default_field_key => $default_value ) {
|
231 |
+
if ( $default_value ) {
|
232 |
+
$api_key = $tags_map[ $default_field_key ];
|
233 |
+
$record['fields'][ $api_key ] = isset( $record['fields'][ $api_key ] ) && $record['fields'][ $api_key ] ? $record['fields'][ $api_key ] : $default_value;
|
234 |
+
}
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
//run functions on values
|
239 |
+
|
240 |
+
if ( $this->functions && array_values( $this->functions ) ) {
|
241 |
+
foreach ( $this->functions as $field_key => $function ) {
|
242 |
+
$api_key = $tags_map[ $field_key ];
|
243 |
+
$field_value = $record['fields'][ $api_key ];
|
244 |
+
|
245 |
+
if ( $function && $field_value ) {
|
246 |
+
$record['fields'][ $api_key ] = $this->run_function( $function, $field_value );
|
247 |
+
}
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
return $record;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Run custom functions on user submission
|
256 |
+
*
|
257 |
+
* @param $function
|
258 |
+
* @param $field_value
|
259 |
+
*/
|
260 |
+
public function run_function( $function, $field_value ) {
|
261 |
+
|
262 |
+
$function = WPCF7r_Utils::get_available_text_functions( $function, 'all' );
|
263 |
+
|
264 |
+
if ( $function ) {
|
265 |
+
$class = $function[0];
|
266 |
+
$method = $function[1];
|
267 |
+
|
268 |
+
return call_user_func( array( $class, $method ), $field_value );
|
269 |
+
}
|
270 |
+
|
271 |
+
return $field_value;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Send the lead using wp_remote
|
276 |
+
*
|
277 |
+
* @param $record
|
278 |
+
* @param boolean $debug
|
279 |
+
* @param string $method
|
280 |
+
* @param string $record_type
|
281 |
+
*/
|
282 |
+
private function send_lead( $record, $debug = false, $method = 'GET', $record_type = 'params' ) {
|
283 |
+
|
284 |
+
global $wp_version;
|
285 |
+
|
286 |
+
$lead = $record['fields'];
|
287 |
+
$url = $record['url'];
|
288 |
+
|
289 |
+
if ( ( 'get' === $method || 'GET' === $method ) && ( 'params' === $record_type || 'json' === $record_type ) ) {
|
290 |
+
$args = array(
|
291 |
+
'timeout' => 100,
|
292 |
+
'redirection' => 5,
|
293 |
+
'httpversion' => '1.0',
|
294 |
+
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url(),
|
295 |
+
'blocking' => true,
|
296 |
+
'headers' => $this->headers,
|
297 |
+
'cookies' => array(),
|
298 |
+
'body' => null,
|
299 |
+
'compress' => false,
|
300 |
+
'decompress' => true,
|
301 |
+
'sslverify' => true,
|
302 |
+
'stream' => false,
|
303 |
+
'filename' => null,
|
304 |
+
);
|
305 |
+
|
306 |
+
if ( 'xml' === $record_type ) {
|
307 |
+
$xml = $this->get_xml( $lead );
|
308 |
+
if ( is_wp_error( $xml ) ) {
|
309 |
+
return $xml;
|
310 |
+
}
|
311 |
+
|
312 |
+
$args['body'] = $xml->asXML();
|
313 |
+
} elseif ( 'json' === $record_type ) {
|
314 |
+
$json = wp_json_encode( $lead );
|
315 |
+
if ( is_wp_error( $json ) ) {
|
316 |
+
return $json;
|
317 |
+
} else {
|
318 |
+
$args['body'] = $json;
|
319 |
+
}
|
320 |
+
} else {
|
321 |
+
$lead_string = http_build_query( $lead );
|
322 |
+
$url = strpos( '?', $url ) ? $url . '&' . $lead_string : $url . '?' . $lead_string;
|
323 |
+
}
|
324 |
+
|
325 |
+
$args = apply_filters( 'qs_cf7_api_get_args', $args );
|
326 |
+
$url = apply_filters( 'qs_cf7_api_get_url', $url, $record );
|
327 |
+
$url = $this->replace_tags( $url );
|
328 |
+
|
329 |
+
$result = wp_remote_get( $url, $args );
|
330 |
+
} else {
|
331 |
+
$args = array(
|
332 |
+
'timeout' => 100,
|
333 |
+
'redirection' => 5,
|
334 |
+
'method' => strtoupper( $method ),
|
335 |
+
'httpversion' => '1.0',
|
336 |
+
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url(),
|
337 |
+
'blocking' => true,
|
338 |
+
'headers' => $this->headers,
|
339 |
+
'cookies' => array(),
|
340 |
+
'body' => $lead,
|
341 |
+
'compress' => false,
|
342 |
+
'decompress' => true,
|
343 |
+
'sslverify' => true,
|
344 |
+
'stream' => false,
|
345 |
+
'filename' => null,
|
346 |
+
);
|
347 |
+
|
348 |
+
if ( 'xml' === $record_type ) {
|
349 |
+
$xml = $this->get_xml( $lead );
|
350 |
+
|
351 |
+
if ( is_wp_error( $xml ) ) {
|
352 |
+
return $xml;
|
353 |
+
}
|
354 |
+
|
355 |
+
$args['body'] = $xml->asXML();
|
356 |
+
} elseif ( 'json' === $record_type ) {
|
357 |
+
$json = wp_json_encode( json_decode( $lead ) );
|
358 |
+
if ( is_wp_error( $json ) ) {
|
359 |
+
return $json;
|
360 |
+
} else {
|
361 |
+
$args['body'] = $json;
|
362 |
+
}
|
363 |
+
}
|
364 |
+
|
365 |
+
$args = apply_filters( 'qs_cf7_api_get_args', $args );
|
366 |
+
$url = apply_filters( 'qs_cf7_api_post_url', $url );
|
367 |
+
$url = $this->replace_tags( $url );
|
368 |
+
|
369 |
+
$result = wp_remote_request( $url, $args );
|
370 |
+
}
|
371 |
+
|
372 |
+
$this->log_result( $args, $result );
|
373 |
+
|
374 |
+
do_action( 'after_qs_cf7_api_send_lead', $result, $record, $args );
|
375 |
+
|
376 |
+
if ( ! is_wp_error( $result ) ) {
|
377 |
+
$results['response_raw'] = $result;
|
378 |
+
$results['response'] = wp_remote_retrieve_body( $result );
|
379 |
+
}
|
380 |
+
|
381 |
+
return $result;
|
382 |
+
}
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Get XML
|
386 |
+
*
|
387 |
+
* @param $lead
|
388 |
+
*/
|
389 |
+
private function get_xml( $lead ) {
|
390 |
+
|
391 |
+
$xml = '';
|
392 |
+
|
393 |
+
if ( function_exists( 'simplexml_load_string' ) ) {
|
394 |
+
libxml_use_internal_errors( true );
|
395 |
+
$xml = simplexml_load_string( $lead );
|
396 |
+
|
397 |
+
if ( false === $xml ) {
|
398 |
+
$xml = new WP_Error(
|
399 |
+
'xml',
|
400 |
+
__( 'XML Structure is incorrect', 'wpcf7-redirect' )
|
401 |
+
);
|
402 |
+
|
403 |
+
}
|
404 |
+
}
|
405 |
+
|
406 |
+
return $xml;
|
407 |
+
}
|
408 |
+
}
|
409 |
+
|
classes/actions/class-wpcf7r-action-sendmail.php
CHANGED
@@ -1,180 +1,180 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7R_Action_SendMail file - handles send mail action
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
register_wpcf7r_actions(
|
9 |
-
'SendMail',
|
10 |
-
__( 'Send Email', 'wpcf7-redirect' ),
|
11 |
-
'WPCF7R_Action_SendMail',
|
12 |
-
4
|
13 |
-
);
|
14 |
-
|
15 |
-
class WPCF7R_Action_SendMail extends WPCF7R_Action {
|
16 |
-
public function __construct( $post ) {
|
17 |
-
parent::__construct( $post );
|
18 |
-
}
|
19 |
-
/**
|
20 |
-
* Get the fields relevant for this action
|
21 |
-
*/
|
22 |
-
public function get_action_fields() {
|
23 |
-
$parent_fields = parent::get_default_fields();
|
24 |
-
|
25 |
-
unset( $parent_fields['action_status'] );
|
26 |
-
|
27 |
-
$fields = array_merge(
|
28 |
-
array(
|
29 |
-
'send_to_emails_values' => array(
|
30 |
-
'name' => 'send_to_emails_values',
|
31 |
-
'type' => 'text',
|
32 |
-
'label' => __( 'To:', 'wpcf7-redirect' ),
|
33 |
-
'placeholder' => __( 'Email addresses seperated by comma (,)', 'wpcf7-redirect' ),
|
34 |
-
'value' => $this->get( 'send_to_emails_values' ),
|
35 |
-
),
|
36 |
-
'email_sender' => array(
|
37 |
-
'name' => 'email_sender',
|
38 |
-
'type' => 'text',
|
39 |
-
'label' => __( 'From:', 'wpcf7-redirect' ),
|
40 |
-
'placeholder' => __( 'name <address>', 'wpcf7-redirect' ),
|
41 |
-
'value' => $this->get( 'email_sender' ),
|
42 |
-
),
|
43 |
-
'email_subject' => array(
|
44 |
-
'name' => 'email_subject',
|
45 |
-
'type' => 'text',
|
46 |
-
'label' => __( 'Subject:', 'wpcf7-redirect' ),
|
47 |
-
'value' => $this->get( 'email_subject' ),
|
48 |
-
),
|
49 |
-
'email_format' => array(
|
50 |
-
'name' => 'email_format',
|
51 |
-
'type' => 'editor',
|
52 |
-
'label' => __( 'Email Format (use the same structure used on Contact Form 7)', 'wpcf7-redirect' ),
|
53 |
-
'footer' => $this->get_formatted_mail_tags(),
|
54 |
-
'value' => $this->get( 'email_format' ),
|
55 |
-
),
|
56 |
-
'email_attachments' => array(
|
57 |
-
'name' => 'email_attachments',
|
58 |
-
'type' => 'text',
|
59 |
-
'label' => __( 'Add your form attachments shortcodes here', 'wpcf7-redirect' ),
|
60 |
-
'value' => $this->get( 'email_attachments' ),
|
61 |
-
),
|
62 |
-
'plain_text' => array(
|
63 |
-
'name' => 'plain_text',
|
64 |
-
'type' => 'checkbox',
|
65 |
-
'label' => __( 'Use plain text email', 'wpcf7-redirect' ),
|
66 |
-
'placeholder' => '',
|
67 |
-
'show_selector' => '.field-wrap-plain_text',
|
68 |
-
'value' => $this->get( 'plain_text' ),
|
69 |
-
),
|
70 |
-
// 'disable_cf7_mail' => array(
|
71 |
-
// 'name' => 'disable_cf7_mail',
|
72 |
-
// 'type' => 'checkbox',
|
73 |
-
// 'label' => __( 'Disable contact form 7 default email', 'wpcf7-redirect' ),
|
74 |
-
// 'placeholder' => '',
|
75 |
-
// 'value' => $this->get( 'disable_cf7_mail' ),
|
76 |
-
// ),
|
77 |
-
'action_status' => array(
|
78 |
-
'name' => 'action_status',
|
79 |
-
'type' => 'checkbox',
|
80 |
-
'label' => $this->get_action_status_label(),
|
81 |
-
'sub_title' => __( 'if this is off the rule will not be applied', 'wpcf7-redirect' ),
|
82 |
-
'placeholder' => '',
|
83 |
-
'show_selector' => '.field-wrap-disable_default_email',
|
84 |
-
'toggle-label' => json_encode(
|
85 |
-
array(
|
86 |
-
'.field-wrap-action_status .checkbox-label,.column-status a' => array(
|
87 |
-
__( 'Enabled', 'wpcf7-redirect' ),
|
88 |
-
__( 'Disabled', 'wpcf7-redirect' ),
|
89 |
-
),
|
90 |
-
)
|
91 |
-
),
|
92 |
-
'value' => $this->get( 'action_status' ),
|
93 |
-
),
|
94 |
-
'disable_default_email' => array(
|
95 |
-
'name' => 'disable_default_email',
|
96 |
-
'type' => 'notice',
|
97 |
-
'label' => '<strong>' . __( 'Notice!', 'wpcf7-redirect' ) . '</strong>',
|
98 |
-
'sub_title' => __( 'When email action is enabled the default Contact Form 7 mailing feature will be disabled.', 'wpcf7-redirect' ),
|
99 |
-
'placeholder' => '',
|
100 |
-
'class' => $this->get( 'action_status' ) ? 'field-notice-alert' : 'field-hidden field-notice-alert',
|
101 |
-
'show_selector' => '',
|
102 |
-
),
|
103 |
-
),
|
104 |
-
$parent_fields
|
105 |
-
);
|
106 |
-
return $fields;
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Get settings page
|
111 |
-
*/
|
112 |
-
public function get_action_settings() {
|
113 |
-
$this->get_settings_template( 'html-action-send-to-email.php' );
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Handle a simple redirect rule
|
118 |
-
*
|
119 |
-
* @param $rules
|
120 |
-
* @param $response
|
121 |
-
*/
|
122 |
-
public function process( $submission ) {
|
123 |
-
$response = array();
|
124 |
-
$email_to = $this->get( 'send_to_emails_values' );
|
125 |
-
$email_sender = $this->get( 'email_sender' );
|
126 |
-
$email_format = $this->get( 'email_format' );
|
127 |
-
$email_subject = $this->get( 'email_subject' );
|
128 |
-
$email_attachments = $this->get( 'email_attachments' );
|
129 |
-
$plain_text = $this->get( 'plain_text' );
|
130 |
-
|
131 |
-
// set the email address to recipient
|
132 |
-
$mail_settings = $this->cf7r_form->cf7_post->get_properties( 'mail' );
|
133 |
-
|
134 |
-
if ( $email_to ) {
|
135 |
-
$mail_settings['mail']['recipient'] = $email_to;
|
136 |
-
}
|
137 |
-
|
138 |
-
if ( $email_sender ) {
|
139 |
-
$mail_settings['mail']['sender'] = $email_sender;
|
140 |
-
}
|
141 |
-
|
142 |
-
if ( $email_format ) {
|
143 |
-
$mail_settings['mail']['body'] = $email_format;
|
144 |
-
}
|
145 |
-
|
146 |
-
if ( $email_subject ) {
|
147 |
-
$mail_settings['mail']['subject'] = $email_subject;
|
148 |
-
}
|
149 |
-
|
150 |
-
if ( $email_attachments ) {
|
151 |
-
$mail_settings['mail']['attachments'] = $email_attachments;
|
152 |
-
}
|
153 |
-
|
154 |
-
$mail_settings['mail']['use_html'] = ! $plain_text;
|
155 |
-
|
156 |
-
$result = $this->send_mail( $mail_settings['mail'] );
|
157 |
-
|
158 |
-
return $result;
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* Maybe perform actions before sending results to the user
|
163 |
-
*/
|
164 |
-
public function maybe_perform_pre_result_action() {
|
165 |
-
if ( $this->get( 'disable_cf7_mail' ) ) {
|
166 |
-
add_filter( 'wpcf7_skip_mail', '__return_false' );
|
167 |
-
}
|
168 |
-
}
|
169 |
-
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Use contact form 7 function to send the email
|
173 |
-
*
|
174 |
-
* @param $mail
|
175 |
-
*/
|
176 |
-
public function send_mail( $mail ) {
|
177 |
-
$result = WPCF7_Mail::send( $mail, 'mail' );
|
178 |
-
return $result;
|
179 |
-
}
|
180 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7R_Action_SendMail file - handles send mail action
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
register_wpcf7r_actions(
|
9 |
+
'SendMail',
|
10 |
+
__( 'Send Email', 'wpcf7-redirect' ),
|
11 |
+
'WPCF7R_Action_SendMail',
|
12 |
+
4
|
13 |
+
);
|
14 |
+
|
15 |
+
class WPCF7R_Action_SendMail extends WPCF7R_Action {
|
16 |
+
public function __construct( $post ) {
|
17 |
+
parent::__construct( $post );
|
18 |
+
}
|
19 |
+
/**
|
20 |
+
* Get the fields relevant for this action
|
21 |
+
*/
|
22 |
+
public function get_action_fields() {
|
23 |
+
$parent_fields = parent::get_default_fields();
|
24 |
+
|
25 |
+
unset( $parent_fields['action_status'] );
|
26 |
+
|
27 |
+
$fields = array_merge(
|
28 |
+
array(
|
29 |
+
'send_to_emails_values' => array(
|
30 |
+
'name' => 'send_to_emails_values',
|
31 |
+
'type' => 'text',
|
32 |
+
'label' => __( 'To:', 'wpcf7-redirect' ),
|
33 |
+
'placeholder' => __( 'Email addresses seperated by comma (,)', 'wpcf7-redirect' ),
|
34 |
+
'value' => $this->get( 'send_to_emails_values' ),
|
35 |
+
),
|
36 |
+
'email_sender' => array(
|
37 |
+
'name' => 'email_sender',
|
38 |
+
'type' => 'text',
|
39 |
+
'label' => __( 'From:', 'wpcf7-redirect' ),
|
40 |
+
'placeholder' => __( 'name <address>', 'wpcf7-redirect' ),
|
41 |
+
'value' => $this->get( 'email_sender' ),
|
42 |
+
),
|
43 |
+
'email_subject' => array(
|
44 |
+
'name' => 'email_subject',
|
45 |
+
'type' => 'text',
|
46 |
+
'label' => __( 'Subject:', 'wpcf7-redirect' ),
|
47 |
+
'value' => $this->get( 'email_subject' ),
|
48 |
+
),
|
49 |
+
'email_format' => array(
|
50 |
+
'name' => 'email_format',
|
51 |
+
'type' => 'editor',
|
52 |
+
'label' => __( 'Email Format (use the same structure used on Contact Form 7)', 'wpcf7-redirect' ),
|
53 |
+
'footer' => $this->get_formatted_mail_tags(),
|
54 |
+
'value' => $this->get( 'email_format' ),
|
55 |
+
),
|
56 |
+
'email_attachments' => array(
|
57 |
+
'name' => 'email_attachments',
|
58 |
+
'type' => 'text',
|
59 |
+
'label' => __( 'Add your form attachments shortcodes here', 'wpcf7-redirect' ),
|
60 |
+
'value' => $this->get( 'email_attachments' ),
|
61 |
+
),
|
62 |
+
'plain_text' => array(
|
63 |
+
'name' => 'plain_text',
|
64 |
+
'type' => 'checkbox',
|
65 |
+
'label' => __( 'Use plain text email', 'wpcf7-redirect' ),
|
66 |
+
'placeholder' => '',
|
67 |
+
'show_selector' => '.field-wrap-plain_text',
|
68 |
+
'value' => $this->get( 'plain_text' ),
|
69 |
+
),
|
70 |
+
// 'disable_cf7_mail' => array(
|
71 |
+
// 'name' => 'disable_cf7_mail',
|
72 |
+
// 'type' => 'checkbox',
|
73 |
+
// 'label' => __( 'Disable contact form 7 default email', 'wpcf7-redirect' ),
|
74 |
+
// 'placeholder' => '',
|
75 |
+
// 'value' => $this->get( 'disable_cf7_mail' ),
|
76 |
+
// ),
|
77 |
+
'action_status' => array(
|
78 |
+
'name' => 'action_status',
|
79 |
+
'type' => 'checkbox',
|
80 |
+
'label' => $this->get_action_status_label(),
|
81 |
+
'sub_title' => __( 'if this is off the rule will not be applied', 'wpcf7-redirect' ),
|
82 |
+
'placeholder' => '',
|
83 |
+
'show_selector' => '.field-wrap-disable_default_email',
|
84 |
+
'toggle-label' => json_encode(
|
85 |
+
array(
|
86 |
+
'.field-wrap-action_status .checkbox-label,.column-status a' => array(
|
87 |
+
__( 'Enabled', 'wpcf7-redirect' ),
|
88 |
+
__( 'Disabled', 'wpcf7-redirect' ),
|
89 |
+
),
|
90 |
+
)
|
91 |
+
),
|
92 |
+
'value' => $this->get( 'action_status' ),
|
93 |
+
),
|
94 |
+
'disable_default_email' => array(
|
95 |
+
'name' => 'disable_default_email',
|
96 |
+
'type' => 'notice',
|
97 |
+
'label' => '<strong>' . __( 'Notice!', 'wpcf7-redirect' ) . '</strong>',
|
98 |
+
'sub_title' => __( 'When email action is enabled the default Contact Form 7 mailing feature will be disabled.', 'wpcf7-redirect' ),
|
99 |
+
'placeholder' => '',
|
100 |
+
'class' => $this->get( 'action_status' ) ? 'field-notice-alert' : 'field-hidden field-notice-alert',
|
101 |
+
'show_selector' => '',
|
102 |
+
),
|
103 |
+
),
|
104 |
+
$parent_fields
|
105 |
+
);
|
106 |
+
return $fields;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Get settings page
|
111 |
+
*/
|
112 |
+
public function get_action_settings() {
|
113 |
+
$this->get_settings_template( 'html-action-send-to-email.php' );
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Handle a simple redirect rule
|
118 |
+
*
|
119 |
+
* @param $rules
|
120 |
+
* @param $response
|
121 |
+
*/
|
122 |
+
public function process( $submission ) {
|
123 |
+
$response = array();
|
124 |
+
$email_to = $this->get( 'send_to_emails_values' );
|
125 |
+
$email_sender = $this->get( 'email_sender' );
|
126 |
+
$email_format = $this->get( 'email_format' );
|
127 |
+
$email_subject = $this->get( 'email_subject' );
|
128 |
+
$email_attachments = $this->get( 'email_attachments' );
|
129 |
+
$plain_text = $this->get( 'plain_text' );
|
130 |
+
|
131 |
+
// set the email address to recipient
|
132 |
+
$mail_settings = $this->cf7r_form->cf7_post->get_properties( 'mail' );
|
133 |
+
|
134 |
+
if ( $email_to ) {
|
135 |
+
$mail_settings['mail']['recipient'] = $email_to;
|
136 |
+
}
|
137 |
+
|
138 |
+
if ( $email_sender ) {
|
139 |
+
$mail_settings['mail']['sender'] = $email_sender;
|
140 |
+
}
|
141 |
+
|
142 |
+
if ( $email_format ) {
|
143 |
+
$mail_settings['mail']['body'] = $email_format;
|
144 |
+
}
|
145 |
+
|
146 |
+
if ( $email_subject ) {
|
147 |
+
$mail_settings['mail']['subject'] = $email_subject;
|
148 |
+
}
|
149 |
+
|
150 |
+
if ( $email_attachments ) {
|
151 |
+
$mail_settings['mail']['attachments'] = $email_attachments;
|
152 |
+
}
|
153 |
+
|
154 |
+
$mail_settings['mail']['use_html'] = ! $plain_text;
|
155 |
+
|
156 |
+
$result = $this->send_mail( $mail_settings['mail'] );
|
157 |
+
|
158 |
+
return $result;
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Maybe perform actions before sending results to the user
|
163 |
+
*/
|
164 |
+
public function maybe_perform_pre_result_action() {
|
165 |
+
if ( $this->get( 'disable_cf7_mail' ) ) {
|
166 |
+
add_filter( 'wpcf7_skip_mail', '__return_false' );
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Use contact form 7 function to send the email
|
173 |
+
*
|
174 |
+
* @param $mail
|
175 |
+
*/
|
176 |
+
public function send_mail( $mail ) {
|
177 |
+
$result = WPCF7_Mail::send( $mail, 'mail' );
|
178 |
+
return $result;
|
179 |
+
}
|
180 |
+
}
|
classes/actions/html/html-action-redirect.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* HTML action redirect
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* HTML itterator to display redirect actions fields.
|
10 |
-
*/
|
11 |
-
foreach ( $this->get_action_fields() as $field ) {
|
12 |
-
$this->render_field( $field, $prefix );
|
13 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* HTML action redirect
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* HTML itterator to display redirect actions fields.
|
10 |
+
*/
|
11 |
+
foreach ( $this->get_action_fields() as $field ) {
|
12 |
+
$this->render_field( $field, $prefix );
|
13 |
+
}
|
classes/actions/html/html-action-send-to-email.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* html-action-send-to-email file.
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Send to mail action html fields
|
10 |
-
*/
|
11 |
-
foreach ( $this->get_action_fields() as $field ) {
|
12 |
-
$this->render_field( $field, $prefix );
|
13 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* html-action-send-to-email file.
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Send to mail action html fields
|
10 |
+
*/
|
11 |
+
foreach ( $this->get_action_fields() as $field ) {
|
12 |
+
$this->render_field( $field, $prefix );
|
13 |
+
}
|
classes/actions/html/html-page-settings.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* HTML action-send-to-email file.
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<section class="page-settings">
|
10 |
-
|
11 |
-
<?php
|
12 |
-
// Send to mail action html fields
|
13 |
-
foreach ( $this->get_action_fields() as $field ) {
|
14 |
-
$this->render_field( $field, $prefix );
|
15 |
-
}
|
16 |
-
?>
|
17 |
-
|
18 |
-
</section>
|
19 |
-
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* HTML action-send-to-email file.
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<section class="page-settings">
|
10 |
+
|
11 |
+
<?php
|
12 |
+
// Send to mail action html fields
|
13 |
+
foreach ( $this->get_action_fields() as $field ) {
|
14 |
+
$this->render_field( $field, $prefix );
|
15 |
+
}
|
16 |
+
?>
|
17 |
+
|
18 |
+
</section>
|
19 |
+
|
classes/actions/html/index.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
exit;
|
5 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
+
exit;
|
5 |
+
}
|
classes/actions/html/rule-title.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* rule-title.php file.
|
4 |
-
*
|
5 |
-
* @package cf7r
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
-
exit;
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Display the block title
|
14 |
-
*
|
15 |
-
* @version 1.0.0
|
16 |
-
*/
|
17 |
-
?>
|
18 |
-
<div class="field-wrap field-wrap-post-title">
|
19 |
-
<label for="wpcf7-redirect-post-title">
|
20 |
-
<strong><?php esc_html_e( 'Rule Title', 'wpcf7-redirect' );?></strong>
|
21 |
-
</label>
|
22 |
-
<input type="text" class="wpcf7-redirect-post-title-fields" placeholder="<?php esc_html_e( 'Rule title', 'wpcf7-redirect' );?>" name="wpcf7-redirect<?php echo $prefix;?>[post_title]" value="<?php echo $this->get_title();?>">
|
23 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* rule-title.php file.
|
4 |
+
*
|
5 |
+
* @package cf7r
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Display the block title
|
14 |
+
*
|
15 |
+
* @version 1.0.0
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
<div class="field-wrap field-wrap-post-title">
|
19 |
+
<label for="wpcf7-redirect-post-title">
|
20 |
+
<strong><?php esc_html_e( 'Rule Title', 'wpcf7-redirect' );?></strong>
|
21 |
+
</label>
|
22 |
+
<input type="text" class="wpcf7-redirect-post-title-fields" placeholder="<?php esc_html_e( 'Rule title', 'wpcf7-redirect' );?>" name="wpcf7-redirect<?php echo $prefix;?>[post_title]" value="<?php echo $this->get_title();?>">
|
23 |
+
</div>
|
classes/aff/class-ext-accessibe.php
CHANGED
@@ -1,627 +1,627 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Accesibe Extension Class
|
4 |
-
*
|
5 |
-
* @category Ext_Accessibe
|
6 |
-
* @package Ext_Accessibe
|
7 |
-
* @author Author <info@querysol.com>
|
8 |
-
* @license https://opensource.org/licenses/MIT MIT License
|
9 |
-
* @link http://querysol.com/
|
10 |
-
*/
|
11 |
-
class Ext_Accessibe extends WPCF7R_Action {
|
12 |
-
public $ver = '1.0';
|
13 |
-
private $api_url = ACCESSIBE_API_URI;
|
14 |
-
private $ext_name = 'accessibe';
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Class constructor
|
18 |
-
*/
|
19 |
-
public function __construct() {
|
20 |
-
if ( isset( $_GET['scan'] ) ) {
|
21 |
-
$this->reset_scan_results();
|
22 |
-
}
|
23 |
-
if ( is_admin() ) {
|
24 |
-
$this->admin_init();
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Get the extension name
|
30 |
-
*/
|
31 |
-
public function get_name() {
|
32 |
-
$name = $this->ext_name;
|
33 |
-
return $name;
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Get the option key that will store the widget settings
|
38 |
-
*/
|
39 |
-
public function get_widget_option_key() {
|
40 |
-
$key = 'accesibe_widget_options';
|
41 |
-
if ( defined( 'ICL_LANGUAGE_CODE' ) ) {
|
42 |
-
$key .= '_' . ICL_LANGUAGE_CODE;
|
43 |
-
}
|
44 |
-
return $key;
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Initiate admin scripts
|
49 |
-
*/
|
50 |
-
public function admin_init() {
|
51 |
-
if ( isset( $_GET['page'] ) && qs_get_plugin_display_name() === $_GET['page'] ) {
|
52 |
-
$response = $this->acctivate_acccesbe_menu();
|
53 |
-
}
|
54 |
-
if ( isset( $_REQUEST['start-free-trial'] ) && qs_get_plugin_display_name() === $_REQUEST['start-free-trial'] ) {
|
55 |
-
$response = $this->mark_scan_completed();
|
56 |
-
}
|
57 |
-
if ( isset( $_POST['activate-accesibe'] ) && $_POST['activate-accesibe'] ) {
|
58 |
-
$response = $this->activate();
|
59 |
-
if ( is_wp_error( $response ) ) {
|
60 |
-
WPCF7r_Utils::add_admin_notice( 'alert', $response->get_error_message() );
|
61 |
-
} else {
|
62 |
-
WPCF7r_Utils::add_admin_notice( 'notice', __( 'Successfully activated' ) );
|
63 |
-
}
|
64 |
-
}
|
65 |
-
if ( isset( $_GET['deactivate'] ) && qs_get_plugin_display_name() === $_GET['deactivate'] ) {
|
66 |
-
$this->deactivate();
|
67 |
-
}
|
68 |
-
if ( isset( $_REQUEST['save_ext_settings'] ) && qs_get_plugin_display_name() === $_REQUEST['save_ext_settings'] ) {
|
69 |
-
$this->save();
|
70 |
-
}
|
71 |
-
$this->init();
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Save widget settings
|
76 |
-
*/
|
77 |
-
private function save() {
|
78 |
-
$name = $this->get_name();
|
79 |
-
$key = $this->get_widget_option_key();
|
80 |
-
if ( isset( $_REQUEST['wpcf7-redirect'][ $key ][ $name ] ) && $_REQUEST['wpcf7-redirect'][ $key ][ $name ] ) {
|
81 |
-
$data = $_REQUEST['wpcf7-redirect'][ $key ][ $name ];
|
82 |
-
update_option( $key, $data );
|
83 |
-
} elseif ( isset( $_REQUEST['save_ext_settings'] ) ) {
|
84 |
-
update_option( $key, array() );
|
85 |
-
}
|
86 |
-
$this->init();
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Get this extension settings page url
|
91 |
-
*/
|
92 |
-
public function get_settings_url() {
|
93 |
-
return admin_url( '/admin.php?page=' . qs_get_plugin_display_name() );
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* The link will reset the scan data to allow a new scan to process
|
98 |
-
*/
|
99 |
-
public function get_scan_link() {
|
100 |
-
$url = $this->get_settings_url();
|
101 |
-
$url = add_query_arg(
|
102 |
-
array(
|
103 |
-
'scan' => true,
|
104 |
-
)
|
105 |
-
);
|
106 |
-
return $url;
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Check if scan was commited and saved
|
111 |
-
*/
|
112 |
-
public function get_scan_results() {
|
113 |
-
return get_option( 'accesibe_scan_results' );
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Get the widget settings
|
118 |
-
*/
|
119 |
-
public function get_widget_settings() {
|
120 |
-
$key = $this->get_widget_option_key();
|
121 |
-
return get_option( $key );
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Check if the plugin is active
|
126 |
-
*/
|
127 |
-
public function is_active() {
|
128 |
-
$settings = $this->get_settings();
|
129 |
-
return $settings ? true : false;
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Check if the current screen is a registration form
|
134 |
-
* @return boolean
|
135 |
-
*/
|
136 |
-
public function is_registration_form() {
|
137 |
-
return ! $this->is_scan() && ! $this->is_active();
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Check if the plugin is active
|
142 |
-
*
|
143 |
-
* @return boolean
|
144 |
-
*/
|
145 |
-
public function is_scan() {
|
146 |
-
$results = $this->get_scan_results();
|
147 |
-
return $results ? false : true;
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Set a flag that a scan was completed
|
152 |
-
*/
|
153 |
-
public function mark_scan_completed() {
|
154 |
-
update_option( 'accesibe_scan_results', true );
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Allow the user to rescan the website
|
159 |
-
*/
|
160 |
-
public function reset_scan_results() {
|
161 |
-
delete_option( 'accesibe_scan_results' );
|
162 |
-
}
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Init extension
|
166 |
-
*/
|
167 |
-
public function init() {
|
168 |
-
if ( ! get_option( 'hide_accessibie_menu' ) && get_option( 'show_accessibie_menu' ) ) {
|
169 |
-
add_action( 'admin_menu', array( $this, 'accessibie_menu' ) );
|
170 |
-
}
|
171 |
-
$this->accesibe_widget_options = $this->get_widget_settings();
|
172 |
-
}
|
173 |
-
|
174 |
-
/**
|
175 |
-
* Deactivate the extension
|
176 |
-
*/
|
177 |
-
public function deactivate() {
|
178 |
-
delete_option( 'show_accessibie_menu' );
|
179 |
-
delete_option( 'accesibe_options' );
|
180 |
-
delete_option( 'accesibe_scan_results' );
|
181 |
-
update_option( 'hide_accessibie_menu', true );
|
182 |
-
}
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Get the value of a specific field
|
186 |
-
*/
|
187 |
-
public function get_field_value( $field ) {
|
188 |
-
if ( $this->accesibe_widget_options ) {
|
189 |
-
return isset( $this->accesibe_widget_options[ $field ] ) ? $this->accesibe_widget_options[ $field ] : '';
|
190 |
-
}
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Get the template to display on the admin field
|
195 |
-
*
|
196 |
-
* @param $template
|
197 |
-
*/
|
198 |
-
public function get_settings_template( $template ) {
|
199 |
-
$name = $this->get_name();
|
200 |
-
$prefix = "[accesibe_widget_options][{$name}]";
|
201 |
-
include WPCF7_PRO_REDIRECT_ACTIONS_TEMPLATE_PATH . $template;
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* General function to retrieve meta
|
206 |
-
*
|
207 |
-
* @param $key
|
208 |
-
*/
|
209 |
-
public function get( $key ) {
|
210 |
-
return isset( $this->accesibe_widget_options[ $key ] ) ? $this->accesibe_widget_options[ $key ] : '';
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Get the accessibe settings form
|
215 |
-
*/
|
216 |
-
public function get_settings_form() {
|
217 |
-
$this->get_settings_template( 'html-page-settings.php' );
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Display settings fields for active users
|
222 |
-
*/
|
223 |
-
public function get_accesibe_settings() {
|
224 |
-
$this->html = new WPCF7R_html( '' );
|
225 |
-
include( WPCF7_PRO_REDIRECT_TEMPLATE_PATH . 'settings.php' );
|
226 |
-
}
|
227 |
-
|
228 |
-
/**
|
229 |
-
* Get the fields relevant for this action
|
230 |
-
*/
|
231 |
-
public function get_action_fields() {
|
232 |
-
return
|
233 |
-
array(
|
234 |
-
array(
|
235 |
-
'name' => 'hideMobile',
|
236 |
-
'type' => 'checkbox',
|
237 |
-
'label' => __( 'Hide On Mobile', 'wpcf7-redirect' ),
|
238 |
-
'sub_title' => '',
|
239 |
-
'placeholder' => '',
|
240 |
-
'value' => $this->get( 'hideMobile' ),
|
241 |
-
),
|
242 |
-
array(
|
243 |
-
'name' => 'hideTrigger',
|
244 |
-
'type' => 'checkbox',
|
245 |
-
'label' => __( 'Hide Trigger', 'wpcf7-redirect' ),
|
246 |
-
'sub_title' => '',
|
247 |
-
'placeholder' => '',
|
248 |
-
'value' => $this->get( 'hideTrigger' ),
|
249 |
-
),
|
250 |
-
array(
|
251 |
-
'name' => 'leadColor',
|
252 |
-
'type' => 'text',
|
253 |
-
'input_class' => 'colorpicker',
|
254 |
-
'label' => __( 'Main Color', 'wpcf7-redirect' ),
|
255 |
-
'class' => 'qs-col qs-col-6',
|
256 |
-
'sub_title' => '',
|
257 |
-
'placeholder' => '',
|
258 |
-
'value' => $this->get( 'leadColor' ) ? $this->get( 'leadColor' ) : '#146FF8',
|
259 |
-
),
|
260 |
-
array(
|
261 |
-
'name' => 'triggerColor',
|
262 |
-
'type' => 'text',
|
263 |
-
'input_class' => 'colorpicker',
|
264 |
-
'label' => __( 'Trigger Color', 'wpcf7-redirect' ),
|
265 |
-
'class' => 'qs-col qs-col-6',
|
266 |
-
'sub_title' => '',
|
267 |
-
'placeholder' => '',
|
268 |
-
'value' => $this->get( 'triggerColor' ) ? $this->get( 'triggerColor' ) : '#146FF8',
|
269 |
-
),
|
270 |
-
array(
|
271 |
-
'name' => 'triggerIcon',
|
272 |
-
'type' => 'media',
|
273 |
-
'label' => __( 'Trigger Icon', 'wpcf7-redirect' ),
|
274 |
-
'class' => '',
|
275 |
-
'sub_title' => '',
|
276 |
-
'placeholder' => '',
|
277 |
-
'value' => $this->get( 'triggerIcon' ) ? $this->get( 'triggerIcon' ) : 'default',
|
278 |
-
),
|
279 |
-
array(
|
280 |
-
'name' => 'triggerSize',
|
281 |
-
'type' => 'select',
|
282 |
-
'label' => __( 'Trigger Size', 'wpcf7-redirect' ),
|
283 |
-
'class' => '',
|
284 |
-
'sub_title' => '',
|
285 |
-
'placeholder' => '',
|
286 |
-
'options' => array(
|
287 |
-
'small' => __( 'Small' ),
|
288 |
-
'medium' => __( 'Medium' ),
|
289 |
-
'large' => __( 'Large' ),
|
290 |
-
),
|
291 |
-
'value' => $this->get( 'triggerSize' ) ? $this->get( 'triggerSize' ) : 'medium',
|
292 |
-
),
|
293 |
-
array(
|
294 |
-
'name' => 'statementLink',
|
295 |
-
'type' => 'url',
|
296 |
-
'label' => __( 'Link To Statment', 'wpcf7-redirect' ),
|
297 |
-
'sub_title' => '',
|
298 |
-
'placeholder' => '',
|
299 |
-
'value' => $this->get( 'statementLink' ),
|
300 |
-
),
|
301 |
-
array(
|
302 |
-
'name' => 'feedbackLink',
|
303 |
-
'type' => 'url',
|
304 |
-
'label' => __( 'Link To Feedback', 'wpcf7-redirect' ),
|
305 |
-
'sub_title' => '',
|
306 |
-
'placeholder' => '',
|
307 |
-
'value' => $this->get( 'feedbackLink' ),
|
308 |
-
),
|
309 |
-
array(
|
310 |
-
'name' => 'language',
|
311 |
-
'type' => 'select',
|
312 |
-
'label' => __( 'Widget Language', 'wpcf7-redirect' ),
|
313 |
-
'class' => 'select2-field',
|
314 |
-
'sub_title' => '',
|
315 |
-
'placeholder' => '',
|
316 |
-
'options' => $this->get_available_languages(),
|
317 |
-
'value' => $this->get( 'language' ),
|
318 |
-
),
|
319 |
-
array(
|
320 |
-
'name' => 'position',
|
321 |
-
'type' => 'select',
|
322 |
-
'label' => __( 'Widget Position', 'wpcf7-redirect' ),
|
323 |
-
'class' => '',
|
324 |
-
'options' => array(
|
325 |
-
'right' => __( 'Right' ),
|
326 |
-
'left' => __( 'Left' ),
|
327 |
-
),
|
328 |
-
'sub_title' => '',
|
329 |
-
'placeholder' => '',
|
330 |
-
'value' => $this->get( 'position' ),
|
331 |
-
),
|
332 |
-
array(
|
333 |
-
'name' => 'triggerRadius',
|
334 |
-
'type' => 'number',
|
335 |
-
'label' => __( 'Trigger Border Radius (%)', 'wpcf7-redirect' ),
|
336 |
-
'class' => '',
|
337 |
-
'sub_title' => '',
|
338 |
-
'placeholder' => '',
|
339 |
-
'value' => $this->get( 'triggerRadius' ) ? $this->get( 'triggerRadius' ) : '50%',
|
340 |
-
),
|
341 |
-
array(
|
342 |
-
'name' => 'triggerPositionX',
|
343 |
-
'type' => 'select',
|
344 |
-
'label' => __( 'Trigger Position (X)', 'wpcf7-redirect' ),
|
345 |
-
'class' => '',
|
346 |
-
'sub_title' => '',
|
347 |
-
'placeholder' => '',
|
348 |
-
'options' => array(
|
349 |
-
'right' => __( 'Right' ),
|
350 |
-
'left' => __( 'Left' ),
|
351 |
-
),
|
352 |
-
'value' => $this->get( 'triggerPositionX' ) ? $this->get( 'triggerPositionX' ) : 'left',
|
353 |
-
),
|
354 |
-
array(
|
355 |
-
'name' => 'triggerOffsetX',
|
356 |
-
'type' => 'number',
|
357 |
-
'label' => __( 'Trigger Offset X (Pixels)', 'wpcf7-redirect' ),
|
358 |
-
'class' => '',
|
359 |
-
'sub_title' => '',
|
360 |
-
'placeholder' => '',
|
361 |
-
'value' => $this->get( 'triggerOffsetX' ) ? $this->get( 'triggerOffsetX' ) : 0,
|
362 |
-
),
|
363 |
-
array(
|
364 |
-
'name' => 'triggerPositionY',
|
365 |
-
'type' => 'select',
|
366 |
-
'label' => __( 'Trigger Position (X)', 'wpcf7-redirect' ),
|
367 |
-
'class' => '',
|
368 |
-
'sub_title' => '',
|
369 |
-
'placeholder' => '',
|
370 |
-
'options' => array(
|
371 |
-
'top' => __( 'Top' ),
|
372 |
-
'bottom' => __( 'Bottom' ),
|
373 |
-
),
|
374 |
-
'value' => $this->get( 'triggerPositionY' ) ? $this->get( 'triggerPositionY' ) : 'bottom',
|
375 |
-
),
|
376 |
-
array(
|
377 |
-
'name' => 'triggerOffsetY',
|
378 |
-
'type' => 'number',
|
379 |
-
'label' => __( 'Trigger Offset Y (Pixels)', 'wpcf7-redirect' ),
|
380 |
-
'class' => '',
|
381 |
-
'sub_title' => '',
|
382 |
-
'placeholder' => '',
|
383 |
-
'value' => $this->get( 'triggerOffsetY' ) ? $this->get( 'triggerOffsetY' ) : 0,
|
384 |
-
),
|
385 |
-
array(
|
386 |
-
'name' => 'triggerSizeMobile',
|
387 |
-
'type' => 'select',
|
388 |
-
'label' => __( 'Trigger Size Mobile', 'wpcf7-redirect' ),
|
389 |
-
'class' => '',
|
390 |
-
'sub_title' => '',
|
391 |
-
'placeholder' => '',
|
392 |
-
'options' => array(
|
393 |
-
'small' => __( 'Small' ),
|
394 |
-
'medium' => __( 'Medium' ),
|
395 |
-
'large' => __( 'Large' ),
|
396 |
-
),
|
397 |
-
'value' => $this->get( 'triggerSizeMobile' ) ? $this->get( 'triggerSizeMobile' ) : 'medium',
|
398 |
-
),
|
399 |
-
array(
|
400 |
-
'name' => 'triggerPositionXMobile',
|
401 |
-
'type' => 'select',
|
402 |
-
'label' => __( 'Trigger Position (X) Mobile', 'wpcf7-redirect' ),
|
403 |
-
'class' => '',
|
404 |
-
'sub_title' => '',
|
405 |
-
'placeholder' => '',
|
406 |
-
'options' => array(
|
407 |
-
'right' => __( 'Right' ),
|
408 |
-
'left' => __( 'Left' ),
|
409 |
-
),
|
410 |
-
'value' => $this->get( 'triggerPositionXMobile' ) ? $this->get( 'triggerPositionXMobile' ) : 'left',
|
411 |
-
),
|
412 |
-
array(
|
413 |
-
'name' => 'triggerOffsetXMobile',
|
414 |
-
'type' => 'number',
|
415 |
-
'label' => __( 'Trigger Offset X (Pixels) Mobile', 'wpcf7-redirect' ),
|
416 |
-
'class' => '',
|
417 |
-
'sub_title' => '',
|
418 |
-
'placeholder' => '',
|
419 |
-
'value' => $this->get( 'triggerOffsetXMobile' ) ? $this->get( 'triggerOffsetXMobile' ) : 0,
|
420 |
-
),
|
421 |
-
array(
|
422 |
-
'name' => 'triggerPositionYMobile',
|
423 |
-
'type' => 'select',
|
424 |
-
'label' => __( 'Trigger Position (X) Mobile', 'wpcf7-redirect' ),
|
425 |
-
'class' => '',
|
426 |
-
'sub_title' => '',
|
427 |
-
'placeholder' => '',
|
428 |
-
'options' => array(
|
429 |
-
'top' => __( 'Top' ),
|
430 |
-
'bottom' => __( 'Bottom' ),
|
431 |
-
),
|
432 |
-
'value' => $this->get( 'triggerPositionYMobile' ) ? $this->get( 'triggerPositionYMobile' ) : 'bottom',
|
433 |
-
),
|
434 |
-
array(
|
435 |
-
'name' => 'triggerOffsetYMobile',
|
436 |
-
'type' => 'number',
|
437 |
-
'label' => __( 'Trigger Offset Y (Pixels)', 'wpcf7-redirect' ),
|
438 |
-
'class' => '',
|
439 |
-
'sub_title' => '',
|
440 |
-
'placeholder' => '',
|
441 |
-
'value' => $this->get( 'triggerOffsetYMobile' ) ? $this->get( 'triggerOffsetYMobile' ) : 0,
|
442 |
-
),
|
443 |
-
array(
|
444 |
-
'name' => 'triggerRadiusMobile',
|
445 |
-
'type' => 'number',
|
446 |
-
'label' => __( 'Trigger Border Radius (%) Mobile', 'wpcf7-redirect' ),
|
447 |
-
'class' => '',
|
448 |
-
'sub_title' => '',
|
449 |
-
'placeholder' => '',
|
450 |
-
'value' => $this->get( 'triggerRadiusMobile' ) ? $this->get( 'triggerRadiusMobile' ) : '50%',
|
451 |
-
),
|
452 |
-
array(
|
453 |
-
'name' => 'footerHtml',
|
454 |
-
'type' => 'editor',
|
455 |
-
'label' => __( 'Footer Html', 'wpcf7-redirect' ),
|
456 |
-
'sub_title' => '',
|
457 |
-
'placeholder' => '',
|
458 |
-
'value' => $this->get( 'footerHtml' ),
|
459 |
-
),
|
460 |
-
);
|
461 |
-
}
|
462 |
-
|
463 |
-
/**
|
464 |
-
* Get a list of available widget languages
|
465 |
-
*/
|
466 |
-
public function get_available_languages() {
|
467 |
-
return wpcf7_get_languages_list();
|
468 |
-
}
|
469 |
-
|
470 |
-
/**
|
471 |
-
* Display accesibe menu
|
472 |
-
*/
|
473 |
-
public function acctivate_acccesbe_menu() {
|
474 |
-
update_option( 'show_accessibie_menu', true );
|
475 |
-
delete_option( 'hide_accessibie_menu' );
|
476 |
-
}
|
477 |
-
|
478 |
-
/**
|
479 |
-
* Activate the extension
|
480 |
-
*/
|
481 |
-
public function activate() {
|
482 |
-
$args = array(
|
483 |
-
'email' => sanitize_email( $_POST['email'] ),
|
484 |
-
'name' => sanitize_text_field( $_POST['fullname'] ),
|
485 |
-
'password' => sanitize_text_field( $_POST['password'] ),
|
486 |
-
'domain' => str_replace( array( 'http://', 'https://' ), '', home_url() ),
|
487 |
-
'ip_address' => $_SERVER['SERVER_ADDR'],
|
488 |
-
'contactCountry' => isset( $_POST['user-country'] ) ? sanitize_text_field( $_POST['user-country'] ) : '',
|
489 |
-
'contactPhone' => isset( $_POST['phone-number'] ) ? sanitize_text_field( $_POST['phone-number'] ) : '',
|
490 |
-
);
|
491 |
-
$post_args = array(
|
492 |
-
'method' => 'POST',
|
493 |
-
'timeout' => 45,
|
494 |
-
'redirection' => 5,
|
495 |
-
'httpversion' => '1.0',
|
496 |
-
'sslverify' => false,
|
497 |
-
'headers' => array(
|
498 |
-
'Content-Type' => 'application/json',
|
499 |
-
),
|
500 |
-
'body' => wp_json_encode( $args ),
|
501 |
-
'cookies' => array(),
|
502 |
-
);
|
503 |
-
$response = wp_remote_post( $this->api_url, $post_args );
|
504 |
-
|
505 |
-
if ( ! is_wp_error( $response ) ) {
|
506 |
-
$response = wp_remote_retrieve_body( $response );
|
507 |
-
$response = (object) json_decode( $response, true );
|
508 |
-
if ( 1 === $response->status ) {
|
509 |
-
$options_args = array(
|
510 |
-
'accessibe_plugin_active' => $this->ver,
|
511 |
-
'accessibe_plugin_domain' => $args['domain'],
|
512 |
-
'accessibe_plugin_dativation_date' => current_time( 'Ymd' ),
|
513 |
-
);
|
514 |
-
update_option( 'accesibe_options', $options_args );
|
515 |
-
} else {
|
516 |
-
$options_args = array(
|
517 |
-
'accessibe_plugin_active' => $this->ver,
|
518 |
-
'accessibe_plugin_domain' => $args['domain'],
|
519 |
-
'accessibe_plugin_dativation_date' => current_time( 'Ymd' ),
|
520 |
-
);
|
521 |
-
update_option( 'accesibe_options', $options_args );
|
522 |
-
$response = new WP_Error( 'activate', __( 'This Domain Is Already Registered' ) );
|
523 |
-
}
|
524 |
-
}
|
525 |
-
return $response;
|
526 |
-
}
|
527 |
-
|
528 |
-
/**
|
529 |
-
* Get accesibe options
|
530 |
-
*/
|
531 |
-
public function get_settings() {
|
532 |
-
return get_option( 'accesibe_options' );
|
533 |
-
}
|
534 |
-
|
535 |
-
/**
|
536 |
-
* Create Accesibie Menu
|
537 |
-
*/
|
538 |
-
public function accessibie_menu() {
|
539 |
-
// Add the menu item and page!
|
540 |
-
$page_title = qs_get_plugin_display_name();
|
541 |
-
$capability = 'manage_options';
|
542 |
-
$callback = array( $this, 'accesibie_settings_page_content' );
|
543 |
-
$icon = WPCF7_PRO_REDIRECT_BUILD_PATH . '/images/accesibie-logo.png';
|
544 |
-
add_menu_page(
|
545 |
-
$page_title,
|
546 |
-
$page_title,
|
547 |
-
$capability,
|
548 |
-
$page_title,
|
549 |
-
$callback,
|
550 |
-
$icon
|
551 |
-
);
|
552 |
-
}
|
553 |
-
|
554 |
-
/**
|
555 |
-
* Extension page Content
|
556 |
-
*/
|
557 |
-
public function accesibie_settings_page_content() {
|
558 |
-
do_action( 'before_settings_fields' );
|
559 |
-
?>
|
560 |
-
|
561 |
-
<div class="wrap wrap-accesibe">
|
562 |
-
<div class="postbox">
|
563 |
-
<div class="padbox">
|
564 |
-
<div class="content">
|
565 |
-
<?php include 'templates/accesibie-content.php'; ?>
|
566 |
-
</div>
|
567 |
-
</div>
|
568 |
-
</div>
|
569 |
-
</div>
|
570 |
-
<?php
|
571 |
-
}
|
572 |
-
|
573 |
-
/**
|
574 |
-
* Echo the script in the footer
|
575 |
-
*/
|
576 |
-
public function footer_script() {
|
577 |
-
$params = array(
|
578 |
-
'statementLink' => $this->get( 'statementLink' ),
|
579 |
-
'feedbackLink' => $this->get( 'feedbackLink' ),
|
580 |
-
'footerHtml' => $this->get( 'footerHtml' ),
|
581 |
-
'hideMobile' => $this->get( 'hideMobile' ),
|
582 |
-
'hideTrigger' => $this->get( 'hideTrigger' ),
|
583 |
-
'language' => $this->get( 'language' ) ? $this->get( 'language' ) : 'en',
|
584 |
-
'position' => $this->get( 'position' ) ? $this->get( 'position' ) : 'right',
|
585 |
-
'leadColor' => $this->get( 'leadColor' ) ? $this->get( 'leadColor' ) : '#146FF8',
|
586 |
-
'triggerColor' => $this->get( 'triggerColor' ) ? $this->get( 'triggerColor' ) : '#146FF8',
|
587 |
-
'triggerRadius' => $this->get( 'triggerRadius' ) ? $this->get( 'triggerRadius' ) : '50%',
|
588 |
-
'triggerPositionX' => $this->get( 'triggerPositionX' ) ? $this->get( 'triggerPositionX' ) : 'right',
|
589 |
-
'triggerPositionY' => $this->get( 'triggerPositionY' ) ? $this->get( 'triggerPositionY' ) : 'bottom',
|
590 |
-
'triggerIcon' => $this->get( 'triggerIcon' ) ? $this->get( 'triggerIcon' ) : 'default',
|
591 |
-
'triggerSize' => $this->get( 'triggerSize' ) ? $this->get( 'triggerSize' ) : 'medium',
|
592 |
-
'triggerOffsetX' => $this->get( 'triggerOffsetX' ) ? $this->get( 'triggerOffsetX' ) : 20,
|
593 |
-
'triggerOffsetY' => $this->get( 'triggerOffsetY' ) ? $this->get( 'triggerOffsetY' ) : 20,
|
594 |
-
'mobile' => (object) array(
|
595 |
-
'triggerSize' => $this->get( 'triggerSizeMobile' ) ? $this->get( 'triggerSizeMobile' ) : 'small',
|
596 |
-
'triggerPositionX' => $this->get( 'triggerPositionXMobile' ) ? $this->get( 'triggerPositionXMobile' ) : 'right',
|
597 |
-
'triggerPositionY' => $this->get( 'triggerPositionYMobile' ) ? $this->get( 'triggerPositionYMobile' ) : 'center',
|
598 |
-
'triggerOffsetX' => $this->get( 'triggerOffsetXMobile' ) ? $this->get( 'triggerOffsetXMobile' ) : 0,
|
599 |
-
'triggerOffsetY' => $this->get( 'triggerOffsetYMobile' ) ? $this->get( 'triggerOffsetYMobile' ) : 0,
|
600 |
-
'triggerRadius' => $this->get( 'triggerRadiusMobile' ) ? $this->get( 'triggerRadiusMobile' ) : '50%',
|
601 |
-
),
|
602 |
-
);
|
603 |
-
$options = json_encode( $params, JSON_UNESCAPED_UNICODE );
|
604 |
-
?>
|
605 |
-
<script>(function(){var s = document.createElement('script'),e = ! document.body ? document.querySelector('head') : document.body;s.src = 'https://acsbapp.com/apps/app/assets/js/acsb.js';s.async = s.defer = true;s.onload = function(){acsbJS.init(<?php echo $options; ?>);};e.appendChild(s);}());</script>
|
606 |
-
<?php
|
607 |
-
}
|
608 |
-
|
609 |
-
/**
|
610 |
-
* Enqueue script if the plugin is active
|
611 |
-
*/
|
612 |
-
public static function enqueue_script() {
|
613 |
-
if ( ! is_admin() ) {
|
614 |
-
$instance = new self();
|
615 |
-
$instance->init();
|
616 |
-
if ( $instance->is_active() ) {
|
617 |
-
add_action( 'wp_footer', array( $instance, 'footer_script' ) );
|
618 |
-
}
|
619 |
-
}
|
620 |
-
}
|
621 |
-
}
|
622 |
-
|
623 |
-
function qs_get_plugin_display_name() {
|
624 |
-
return apply_filters( 'qs_get_plugin_display_name', 'Accessibility' );
|
625 |
-
}
|
626 |
-
|
627 |
-
Ext_Accessibe::enqueue_script();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Accesibe Extension Class
|
4 |
+
*
|
5 |
+
* @category Ext_Accessibe
|
6 |
+
* @package Ext_Accessibe
|
7 |
+
* @author Author <info@querysol.com>
|
8 |
+
* @license https://opensource.org/licenses/MIT MIT License
|
9 |
+
* @link http://querysol.com/
|
10 |
+
*/
|
11 |
+
class Ext_Accessibe extends WPCF7R_Action {
|
12 |
+
public $ver = '1.0';
|
13 |
+
private $api_url = ACCESSIBE_API_URI;
|
14 |
+
private $ext_name = 'accessibe';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Class constructor
|
18 |
+
*/
|
19 |
+
public function __construct() {
|
20 |
+
if ( isset( $_GET['scan'] ) ) {
|
21 |
+
$this->reset_scan_results();
|
22 |
+
}
|
23 |
+
if ( is_admin() ) {
|
24 |
+
$this->admin_init();
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Get the extension name
|
30 |
+
*/
|
31 |
+
public function get_name() {
|
32 |
+
$name = $this->ext_name;
|
33 |
+
return $name;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Get the option key that will store the widget settings
|
38 |
+
*/
|
39 |
+
public function get_widget_option_key() {
|
40 |
+
$key = 'accesibe_widget_options';
|
41 |
+
if ( defined( 'ICL_LANGUAGE_CODE' ) ) {
|
42 |
+
$key .= '_' . ICL_LANGUAGE_CODE;
|
43 |
+
}
|
44 |
+
return $key;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Initiate admin scripts
|
49 |
+
*/
|
50 |
+
public function admin_init() {
|
51 |
+
if ( isset( $_GET['page'] ) && qs_get_plugin_display_name() === $_GET['page'] ) {
|
52 |
+
$response = $this->acctivate_acccesbe_menu();
|
53 |
+
}
|
54 |
+
if ( isset( $_REQUEST['start-free-trial'] ) && qs_get_plugin_display_name() === $_REQUEST['start-free-trial'] ) {
|
55 |
+
$response = $this->mark_scan_completed();
|
56 |
+
}
|
57 |
+
if ( isset( $_POST['activate-accesibe'] ) && $_POST['activate-accesibe'] ) {
|
58 |
+
$response = $this->activate();
|
59 |
+
if ( is_wp_error( $response ) ) {
|
60 |
+
WPCF7r_Utils::add_admin_notice( 'alert', $response->get_error_message() );
|
61 |
+
} else {
|
62 |
+
WPCF7r_Utils::add_admin_notice( 'notice', __( 'Successfully activated' ) );
|
63 |
+
}
|
64 |
+
}
|
65 |
+
if ( isset( $_GET['deactivate'] ) && qs_get_plugin_display_name() === $_GET['deactivate'] ) {
|
66 |
+
$this->deactivate();
|
67 |
+
}
|
68 |
+
if ( isset( $_REQUEST['save_ext_settings'] ) && qs_get_plugin_display_name() === $_REQUEST['save_ext_settings'] ) {
|
69 |
+
$this->save();
|
70 |
+
}
|
71 |
+
$this->init();
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Save widget settings
|
76 |
+
*/
|
77 |
+
private function save() {
|
78 |
+
$name = $this->get_name();
|
79 |
+
$key = $this->get_widget_option_key();
|
80 |
+
if ( isset( $_REQUEST['wpcf7-redirect'][ $key ][ $name ] ) && $_REQUEST['wpcf7-redirect'][ $key ][ $name ] ) {
|
81 |
+
$data = $_REQUEST['wpcf7-redirect'][ $key ][ $name ];
|
82 |
+
update_option( $key, $data );
|
83 |
+
} elseif ( isset( $_REQUEST['save_ext_settings'] ) ) {
|
84 |
+
update_option( $key, array() );
|
85 |
+
}
|
86 |
+
$this->init();
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get this extension settings page url
|
91 |
+
*/
|
92 |
+
public function get_settings_url() {
|
93 |
+
return admin_url( '/admin.php?page=' . qs_get_plugin_display_name() );
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* The link will reset the scan data to allow a new scan to process
|
98 |
+
*/
|
99 |
+
public function get_scan_link() {
|
100 |
+
$url = $this->get_settings_url();
|
101 |
+
$url = add_query_arg(
|
102 |
+
array(
|
103 |
+
'scan' => true,
|
104 |
+
)
|
105 |
+
);
|
106 |
+
return $url;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Check if scan was commited and saved
|
111 |
+
*/
|
112 |
+
public function get_scan_results() {
|
113 |
+
return get_option( 'accesibe_scan_results' );
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Get the widget settings
|
118 |
+
*/
|
119 |
+
public function get_widget_settings() {
|
120 |
+
$key = $this->get_widget_option_key();
|
121 |
+
return get_option( $key );
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Check if the plugin is active
|
126 |
+
*/
|
127 |
+
public function is_active() {
|
128 |
+
$settings = $this->get_settings();
|
129 |
+
return $settings ? true : false;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Check if the current screen is a registration form
|
134 |
+
* @return boolean
|
135 |
+
*/
|
136 |
+
public function is_registration_form() {
|
137 |
+
return ! $this->is_scan() && ! $this->is_active();
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Check if the plugin is active
|
142 |
+
*
|
143 |
+
* @return boolean
|
144 |
+
*/
|
145 |
+
public function is_scan() {
|
146 |
+
$results = $this->get_scan_results();
|
147 |
+
return $results ? false : true;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Set a flag that a scan was completed
|
152 |
+
*/
|
153 |
+
public function mark_scan_completed() {
|
154 |
+
update_option( 'accesibe_scan_results', true );
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Allow the user to rescan the website
|
159 |
+
*/
|
160 |
+
public function reset_scan_results() {
|
161 |
+
delete_option( 'accesibe_scan_results' );
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Init extension
|
166 |
+
*/
|
167 |
+
public function init() {
|
168 |
+
if ( ! get_option( 'hide_accessibie_menu' ) && get_option( 'show_accessibie_menu' ) ) {
|
169 |
+
add_action( 'admin_menu', array( $this, 'accessibie_menu' ) );
|
170 |
+
}
|
171 |
+
$this->accesibe_widget_options = $this->get_widget_settings();
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Deactivate the extension
|
176 |
+
*/
|
177 |
+
public function deactivate() {
|
178 |
+
delete_option( 'show_accessibie_menu' );
|
179 |
+
delete_option( 'accesibe_options' );
|
180 |
+
delete_option( 'accesibe_scan_results' );
|
181 |
+
update_option( 'hide_accessibie_menu', true );
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Get the value of a specific field
|
186 |
+
*/
|
187 |
+
public function get_field_value( $field ) {
|
188 |
+
if ( $this->accesibe_widget_options ) {
|
189 |
+
return isset( $this->accesibe_widget_options[ $field ] ) ? $this->accesibe_widget_options[ $field ] : '';
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Get the template to display on the admin field
|
195 |
+
*
|
196 |
+
* @param $template
|
197 |
+
*/
|
198 |
+
public function get_settings_template( $template ) {
|
199 |
+
$name = $this->get_name();
|
200 |
+
$prefix = "[accesibe_widget_options][{$name}]";
|
201 |
+
include WPCF7_PRO_REDIRECT_ACTIONS_TEMPLATE_PATH . $template;
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* General function to retrieve meta
|
206 |
+
*
|
207 |
+
* @param $key
|
208 |
+
*/
|
209 |
+
public function get( $key ) {
|
210 |
+
return isset( $this->accesibe_widget_options[ $key ] ) ? $this->accesibe_widget_options[ $key ] : '';
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Get the accessibe settings form
|
215 |
+
*/
|
216 |
+
public function get_settings_form() {
|
217 |
+
$this->get_settings_template( 'html-page-settings.php' );
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Display settings fields for active users
|
222 |
+
*/
|
223 |
+
public function get_accesibe_settings() {
|
224 |
+
$this->html = new WPCF7R_html( '' );
|
225 |
+
include( WPCF7_PRO_REDIRECT_TEMPLATE_PATH . 'settings.php' );
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Get the fields relevant for this action
|
230 |
+
*/
|
231 |
+
public function get_action_fields() {
|
232 |
+
return
|
233 |
+
array(
|
234 |
+
array(
|
235 |
+
'name' => 'hideMobile',
|
236 |
+
'type' => 'checkbox',
|
237 |
+
'label' => __( 'Hide On Mobile', 'wpcf7-redirect' ),
|
238 |
+
'sub_title' => '',
|
239 |
+
'placeholder' => '',
|
240 |
+
'value' => $this->get( 'hideMobile' ),
|
241 |
+
),
|
242 |
+
array(
|
243 |
+
'name' => 'hideTrigger',
|
244 |
+
'type' => 'checkbox',
|
245 |
+
'label' => __( 'Hide Trigger', 'wpcf7-redirect' ),
|
246 |
+
'sub_title' => '',
|
247 |
+
'placeholder' => '',
|
248 |
+
'value' => $this->get( 'hideTrigger' ),
|
249 |
+
),
|
250 |
+
array(
|
251 |
+
'name' => 'leadColor',
|
252 |
+
'type' => 'text',
|
253 |
+
'input_class' => 'colorpicker',
|
254 |
+
'label' => __( 'Main Color', 'wpcf7-redirect' ),
|
255 |
+
'class' => 'qs-col qs-col-6',
|
256 |
+
'sub_title' => '',
|
257 |
+
'placeholder' => '',
|
258 |
+
'value' => $this->get( 'leadColor' ) ? $this->get( 'leadColor' ) : '#146FF8',
|
259 |
+
),
|
260 |
+
array(
|
261 |
+
'name' => 'triggerColor',
|
262 |
+
'type' => 'text',
|
263 |
+
'input_class' => 'colorpicker',
|
264 |
+
'label' => __( 'Trigger Color', 'wpcf7-redirect' ),
|
265 |
+
'class' => 'qs-col qs-col-6',
|
266 |
+
'sub_title' => '',
|
267 |
+
'placeholder' => '',
|
268 |
+
'value' => $this->get( 'triggerColor' ) ? $this->get( 'triggerColor' ) : '#146FF8',
|
269 |
+
),
|
270 |
+
array(
|
271 |
+
'name' => 'triggerIcon',
|
272 |
+
'type' => 'media',
|
273 |
+
'label' => __( 'Trigger Icon', 'wpcf7-redirect' ),
|
274 |
+
'class' => '',
|
275 |
+
'sub_title' => '',
|
276 |
+
'placeholder' => '',
|
277 |
+
'value' => $this->get( 'triggerIcon' ) ? $this->get( 'triggerIcon' ) : 'default',
|
278 |
+
),
|
279 |
+
array(
|
280 |
+
'name' => 'triggerSize',
|
281 |
+
'type' => 'select',
|
282 |
+
'label' => __( 'Trigger Size', 'wpcf7-redirect' ),
|
283 |
+
'class' => '',
|
284 |
+
'sub_title' => '',
|
285 |
+
'placeholder' => '',
|
286 |
+
'options' => array(
|
287 |
+
'small' => __( 'Small' ),
|
288 |
+
'medium' => __( 'Medium' ),
|
289 |
+
'large' => __( 'Large' ),
|
290 |
+
),
|
291 |
+
'value' => $this->get( 'triggerSize' ) ? $this->get( 'triggerSize' ) : 'medium',
|
292 |
+
),
|
293 |
+
array(
|
294 |
+
'name' => 'statementLink',
|
295 |
+
'type' => 'url',
|
296 |
+
'label' => __( 'Link To Statment', 'wpcf7-redirect' ),
|
297 |
+
'sub_title' => '',
|
298 |
+
'placeholder' => '',
|
299 |
+
'value' => $this->get( 'statementLink' ),
|
300 |
+
),
|
301 |
+
array(
|
302 |
+
'name' => 'feedbackLink',
|
303 |
+
'type' => 'url',
|
304 |
+
'label' => __( 'Link To Feedback', 'wpcf7-redirect' ),
|
305 |
+
'sub_title' => '',
|
306 |
+
'placeholder' => '',
|
307 |
+
'value' => $this->get( 'feedbackLink' ),
|
308 |
+
),
|
309 |
+
array(
|
310 |
+
'name' => 'language',
|
311 |
+
'type' => 'select',
|
312 |
+
'label' => __( 'Widget Language', 'wpcf7-redirect' ),
|
313 |
+
'class' => 'select2-field',
|
314 |
+
'sub_title' => '',
|
315 |
+
'placeholder' => '',
|
316 |
+
'options' => $this->get_available_languages(),
|
317 |
+
'value' => $this->get( 'language' ),
|
318 |
+
),
|
319 |
+
array(
|
320 |
+
'name' => 'position',
|
321 |
+
'type' => 'select',
|
322 |
+
'label' => __( 'Widget Position', 'wpcf7-redirect' ),
|
323 |
+
'class' => '',
|
324 |
+
'options' => array(
|
325 |
+
'right' => __( 'Right' ),
|
326 |
+
'left' => __( 'Left' ),
|
327 |
+
),
|
328 |
+
'sub_title' => '',
|
329 |
+
'placeholder' => '',
|
330 |
+
'value' => $this->get( 'position' ),
|
331 |
+
),
|
332 |
+
array(
|
333 |
+
'name' => 'triggerRadius',
|
334 |
+
'type' => 'number',
|
335 |
+
'label' => __( 'Trigger Border Radius (%)', 'wpcf7-redirect' ),
|
336 |
+
'class' => '',
|
337 |
+
'sub_title' => '',
|
338 |
+
'placeholder' => '',
|
339 |
+
'value' => $this->get( 'triggerRadius' ) ? $this->get( 'triggerRadius' ) : '50%',
|
340 |
+
),
|
341 |
+
array(
|
342 |
+
'name' => 'triggerPositionX',
|
343 |
+
'type' => 'select',
|
344 |
+
'label' => __( 'Trigger Position (X)', 'wpcf7-redirect' ),
|
345 |
+
'class' => '',
|
346 |
+
'sub_title' => '',
|
347 |
+
'placeholder' => '',
|
348 |
+
'options' => array(
|
349 |
+
'right' => __( 'Right' ),
|
350 |
+
'left' => __( 'Left' ),
|
351 |
+
),
|
352 |
+
'value' => $this->get( 'triggerPositionX' ) ? $this->get( 'triggerPositionX' ) : 'left',
|
353 |
+
),
|
354 |
+
array(
|
355 |
+
'name' => 'triggerOffsetX',
|
356 |
+
'type' => 'number',
|
357 |
+
'label' => __( 'Trigger Offset X (Pixels)', 'wpcf7-redirect' ),
|
358 |
+
'class' => '',
|
359 |
+
'sub_title' => '',
|
360 |
+
'placeholder' => '',
|
361 |
+
'value' => $this->get( 'triggerOffsetX' ) ? $this->get( 'triggerOffsetX' ) : 0,
|
362 |
+
),
|
363 |
+
array(
|
364 |
+
'name' => 'triggerPositionY',
|
365 |
+
'type' => 'select',
|
366 |
+
'label' => __( 'Trigger Position (X)', 'wpcf7-redirect' ),
|
367 |
+
'class' => '',
|
368 |
+
'sub_title' => '',
|
369 |
+
'placeholder' => '',
|
370 |
+
'options' => array(
|
371 |
+
'top' => __( 'Top' ),
|
372 |
+
'bottom' => __( 'Bottom' ),
|
373 |
+
),
|
374 |
+
'value' => $this->get( 'triggerPositionY' ) ? $this->get( 'triggerPositionY' ) : 'bottom',
|
375 |
+
),
|
376 |
+
array(
|
377 |
+
'name' => 'triggerOffsetY',
|
378 |
+
'type' => 'number',
|
379 |
+
'label' => __( 'Trigger Offset Y (Pixels)', 'wpcf7-redirect' ),
|
380 |
+
'class' => '',
|
381 |
+
'sub_title' => '',
|
382 |
+
'placeholder' => '',
|
383 |
+
'value' => $this->get( 'triggerOffsetY' ) ? $this->get( 'triggerOffsetY' ) : 0,
|
384 |
+
),
|
385 |
+
array(
|
386 |
+
'name' => 'triggerSizeMobile',
|
387 |
+
'type' => 'select',
|
388 |
+
'label' => __( 'Trigger Size Mobile', 'wpcf7-redirect' ),
|
389 |
+
'class' => '',
|
390 |
+
'sub_title' => '',
|
391 |
+
'placeholder' => '',
|
392 |
+
'options' => array(
|
393 |
+
'small' => __( 'Small' ),
|
394 |
+
'medium' => __( 'Medium' ),
|
395 |
+
'large' => __( 'Large' ),
|
396 |
+
),
|
397 |
+
'value' => $this->get( 'triggerSizeMobile' ) ? $this->get( 'triggerSizeMobile' ) : 'medium',
|
398 |
+
),
|
399 |
+
array(
|
400 |
+
'name' => 'triggerPositionXMobile',
|
401 |
+
'type' => 'select',
|
402 |
+
'label' => __( 'Trigger Position (X) Mobile', 'wpcf7-redirect' ),
|
403 |
+
'class' => '',
|
404 |
+
'sub_title' => '',
|
405 |
+
'placeholder' => '',
|
406 |
+
'options' => array(
|
407 |
+
'right' => __( 'Right' ),
|
408 |
+
'left' => __( 'Left' ),
|
409 |
+
),
|
410 |
+
'value' => $this->get( 'triggerPositionXMobile' ) ? $this->get( 'triggerPositionXMobile' ) : 'left',
|
411 |
+
),
|
412 |
+
array(
|
413 |
+
'name' => 'triggerOffsetXMobile',
|
414 |
+
'type' => 'number',
|
415 |
+
'label' => __( 'Trigger Offset X (Pixels) Mobile', 'wpcf7-redirect' ),
|
416 |
+
'class' => '',
|
417 |
+
'sub_title' => '',
|
418 |
+
'placeholder' => '',
|
419 |
+
'value' => $this->get( 'triggerOffsetXMobile' ) ? $this->get( 'triggerOffsetXMobile' ) : 0,
|
420 |
+
),
|
421 |
+
array(
|
422 |
+
'name' => 'triggerPositionYMobile',
|
423 |
+
'type' => 'select',
|
424 |
+
'label' => __( 'Trigger Position (X) Mobile', 'wpcf7-redirect' ),
|
425 |
+
'class' => '',
|
426 |
+
'sub_title' => '',
|
427 |
+
'placeholder' => '',
|
428 |
+
'options' => array(
|
429 |
+
'top' => __( 'Top' ),
|
430 |
+
'bottom' => __( 'Bottom' ),
|
431 |
+
),
|
432 |
+
'value' => $this->get( 'triggerPositionYMobile' ) ? $this->get( 'triggerPositionYMobile' ) : 'bottom',
|
433 |
+
),
|
434 |
+
array(
|
435 |
+
'name' => 'triggerOffsetYMobile',
|
436 |
+
'type' => 'number',
|
437 |
+
'label' => __( 'Trigger Offset Y (Pixels)', 'wpcf7-redirect' ),
|
438 |
+
'class' => '',
|
439 |
+
'sub_title' => '',
|
440 |
+
'placeholder' => '',
|
441 |
+
'value' => $this->get( 'triggerOffsetYMobile' ) ? $this->get( 'triggerOffsetYMobile' ) : 0,
|
442 |
+
),
|
443 |
+
array(
|
444 |
+
'name' => 'triggerRadiusMobile',
|
445 |
+
'type' => 'number',
|
446 |
+
'label' => __( 'Trigger Border Radius (%) Mobile', 'wpcf7-redirect' ),
|
447 |
+
'class' => '',
|
448 |
+
'sub_title' => '',
|
449 |
+
'placeholder' => '',
|
450 |
+
'value' => $this->get( 'triggerRadiusMobile' ) ? $this->get( 'triggerRadiusMobile' ) : '50%',
|
451 |
+
),
|
452 |
+
array(
|
453 |
+
'name' => 'footerHtml',
|
454 |
+
'type' => 'editor',
|
455 |
+
'label' => __( 'Footer Html', 'wpcf7-redirect' ),
|
456 |
+
'sub_title' => '',
|
457 |
+
'placeholder' => '',
|
458 |
+
'value' => $this->get( 'footerHtml' ),
|
459 |
+
),
|
460 |
+
);
|
461 |
+
}
|
462 |
+
|
463 |
+
/**
|
464 |
+
* Get a list of available widget languages
|
465 |
+
*/
|
466 |
+
public function get_available_languages() {
|
467 |
+
return wpcf7_get_languages_list();
|
468 |
+
}
|
469 |
+
|
470 |
+
/**
|
471 |
+
* Display accesibe menu
|
472 |
+
*/
|
473 |
+
public function acctivate_acccesbe_menu() {
|
474 |
+
update_option( 'show_accessibie_menu', true );
|
475 |
+
delete_option( 'hide_accessibie_menu' );
|
476 |
+
}
|
477 |
+
|
478 |
+
/**
|
479 |
+
* Activate the extension
|
480 |
+
*/
|
481 |
+
public function activate() {
|
482 |
+
$args = array(
|
483 |
+
'email' => sanitize_email( $_POST['email'] ),
|
484 |
+
'name' => sanitize_text_field( $_POST['fullname'] ),
|
485 |
+
'password' => sanitize_text_field( $_POST['password'] ),
|
486 |
+
'domain' => str_replace( array( 'http://', 'https://' ), '', home_url() ),
|
487 |
+
'ip_address' => $_SERVER['SERVER_ADDR'],
|
488 |
+
'contactCountry' => isset( $_POST['user-country'] ) ? sanitize_text_field( $_POST['user-country'] ) : '',
|
489 |
+
'contactPhone' => isset( $_POST['phone-number'] ) ? sanitize_text_field( $_POST['phone-number'] ) : '',
|
490 |
+
);
|
491 |
+
$post_args = array(
|
492 |
+
'method' => 'POST',
|
493 |
+
'timeout' => 45,
|
494 |
+
'redirection' => 5,
|
495 |
+
'httpversion' => '1.0',
|
496 |
+
'sslverify' => false,
|
497 |
+
'headers' => array(
|
498 |
+
'Content-Type' => 'application/json',
|
499 |
+
),
|
500 |
+
'body' => wp_json_encode( $args ),
|
501 |
+
'cookies' => array(),
|
502 |
+
);
|
503 |
+
$response = wp_remote_post( $this->api_url, $post_args );
|
504 |
+
|
505 |
+
if ( ! is_wp_error( $response ) ) {
|
506 |
+
$response = wp_remote_retrieve_body( $response );
|
507 |
+
$response = (object) json_decode( $response, true );
|
508 |
+
if ( 1 === $response->status ) {
|
509 |
+
$options_args = array(
|
510 |
+
'accessibe_plugin_active' => $this->ver,
|
511 |
+
'accessibe_plugin_domain' => $args['domain'],
|
512 |
+
'accessibe_plugin_dativation_date' => current_time( 'Ymd' ),
|
513 |
+
);
|
514 |
+
update_option( 'accesibe_options', $options_args );
|
515 |
+
} else {
|
516 |
+
$options_args = array(
|
517 |
+
'accessibe_plugin_active' => $this->ver,
|
518 |
+
'accessibe_plugin_domain' => $args['domain'],
|
519 |
+
'accessibe_plugin_dativation_date' => current_time( 'Ymd' ),
|
520 |
+
);
|
521 |
+
update_option( 'accesibe_options', $options_args );
|
522 |
+
$response = new WP_Error( 'activate', __( 'This Domain Is Already Registered' ) );
|
523 |
+
}
|
524 |
+
}
|
525 |
+
return $response;
|
526 |
+
}
|
527 |
+
|
528 |
+
/**
|
529 |
+
* Get accesibe options
|
530 |
+
*/
|
531 |
+
public function get_settings() {
|
532 |
+
return get_option( 'accesibe_options' );
|
533 |
+
}
|
534 |
+
|
535 |
+
/**
|
536 |
+
* Create Accesibie Menu
|
537 |
+
*/
|
538 |
+
public function accessibie_menu() {
|
539 |
+
// Add the menu item and page!
|
540 |
+
$page_title = qs_get_plugin_display_name();
|
541 |
+
$capability = 'manage_options';
|
542 |
+
$callback = array( $this, 'accesibie_settings_page_content' );
|
543 |
+
$icon = WPCF7_PRO_REDIRECT_BUILD_PATH . '/images/accesibie-logo.png';
|
544 |
+
add_menu_page(
|
545 |
+
$page_title,
|
546 |
+
$page_title,
|
547 |
+
$capability,
|
548 |
+
$page_title,
|
549 |
+
$callback,
|
550 |
+
$icon
|
551 |
+
);
|
552 |
+
}
|
553 |
+
|
554 |
+
/**
|
555 |
+
* Extension page Content
|
556 |
+
*/
|
557 |
+
public function accesibie_settings_page_content() {
|
558 |
+
do_action( 'before_settings_fields' );
|
559 |
+
?>
|
560 |
+
|
561 |
+
<div class="wrap wrap-accesibe">
|
562 |
+
<div class="postbox">
|
563 |
+
<div class="padbox">
|
564 |
+
<div class="content">
|
565 |
+
<?php include 'templates/accesibie-content.php'; ?>
|
566 |
+
</div>
|
567 |
+
</div>
|
568 |
+
</div>
|
569 |
+
</div>
|
570 |
+
<?php
|
571 |
+
}
|
572 |
+
|
573 |
+
/**
|
574 |
+
* Echo the script in the footer
|
575 |
+
*/
|
576 |
+
public function footer_script() {
|
577 |
+
$params = array(
|
578 |
+
'statementLink' => $this->get( 'statementLink' ),
|
579 |
+
'feedbackLink' => $this->get( 'feedbackLink' ),
|
580 |
+
'footerHtml' => $this->get( 'footerHtml' ),
|
581 |
+
'hideMobile' => $this->get( 'hideMobile' ),
|
582 |
+
'hideTrigger' => $this->get( 'hideTrigger' ),
|
583 |
+
'language' => $this->get( 'language' ) ? $this->get( 'language' ) : 'en',
|
584 |
+
'position' => $this->get( 'position' ) ? $this->get( 'position' ) : 'right',
|
585 |
+
'leadColor' => $this->get( 'leadColor' ) ? $this->get( 'leadColor' ) : '#146FF8',
|
586 |
+
'triggerColor' => $this->get( 'triggerColor' ) ? $this->get( 'triggerColor' ) : '#146FF8',
|
587 |
+
'triggerRadius' => $this->get( 'triggerRadius' ) ? $this->get( 'triggerRadius' ) : '50%',
|
588 |
+
'triggerPositionX' => $this->get( 'triggerPositionX' ) ? $this->get( 'triggerPositionX' ) : 'right',
|
589 |
+
'triggerPositionY' => $this->get( 'triggerPositionY' ) ? $this->get( 'triggerPositionY' ) : 'bottom',
|
590 |
+
'triggerIcon' => $this->get( 'triggerIcon' ) ? $this->get( 'triggerIcon' ) : 'default',
|
591 |
+
'triggerSize' => $this->get( 'triggerSize' ) ? $this->get( 'triggerSize' ) : 'medium',
|
592 |
+
'triggerOffsetX' => $this->get( 'triggerOffsetX' ) ? $this->get( 'triggerOffsetX' ) : 20,
|
593 |
+
'triggerOffsetY' => $this->get( 'triggerOffsetY' ) ? $this->get( 'triggerOffsetY' ) : 20,
|
594 |
+
'mobile' => (object) array(
|
595 |
+
'triggerSize' => $this->get( 'triggerSizeMobile' ) ? $this->get( 'triggerSizeMobile' ) : 'small',
|
596 |
+
'triggerPositionX' => $this->get( 'triggerPositionXMobile' ) ? $this->get( 'triggerPositionXMobile' ) : 'right',
|
597 |
+
'triggerPositionY' => $this->get( 'triggerPositionYMobile' ) ? $this->get( 'triggerPositionYMobile' ) : 'center',
|
598 |
+
'triggerOffsetX' => $this->get( 'triggerOffsetXMobile' ) ? $this->get( 'triggerOffsetXMobile' ) : 0,
|
599 |
+
'triggerOffsetY' => $this->get( 'triggerOffsetYMobile' ) ? $this->get( 'triggerOffsetYMobile' ) : 0,
|
600 |
+
'triggerRadius' => $this->get( 'triggerRadiusMobile' ) ? $this->get( 'triggerRadiusMobile' ) : '50%',
|
601 |
+
),
|
602 |
+
);
|
603 |
+
$options = json_encode( $params, JSON_UNESCAPED_UNICODE );
|
604 |
+
?>
|
605 |
+
<script>(function(){var s = document.createElement('script'),e = ! document.body ? document.querySelector('head') : document.body;s.src = 'https://acsbapp.com/apps/app/assets/js/acsb.js';s.async = s.defer = true;s.onload = function(){acsbJS.init(<?php echo $options; ?>);};e.appendChild(s);}());</script>
|
606 |
+
<?php
|
607 |
+
}
|
608 |
+
|
609 |
+
/**
|
610 |
+
* Enqueue script if the plugin is active
|
611 |
+
*/
|
612 |
+
public static function enqueue_script() {
|
613 |
+
if ( ! is_admin() ) {
|
614 |
+
$instance = new self();
|
615 |
+
$instance->init();
|
616 |
+
if ( $instance->is_active() ) {
|
617 |
+
add_action( 'wp_footer', array( $instance, 'footer_script' ) );
|
618 |
+
}
|
619 |
+
}
|
620 |
+
}
|
621 |
+
}
|
622 |
+
|
623 |
+
function qs_get_plugin_display_name() {
|
624 |
+
return apply_filters( 'qs_get_plugin_display_name', 'Accessibility' );
|
625 |
+
}
|
626 |
+
|
627 |
+
Ext_Accessibe::enqueue_script();
|
classes/aff/index.php
ADDED
File without changes
|
classes/aff/templates/accesibie-content.php
CHANGED
@@ -1,165 +1,165 @@
|
|
1 |
-
<?php defined( 'ABSPATH' ) || exit; ?>
|
2 |
-
|
3 |
-
<?php $user = wp_get_current_user(); ?>
|
4 |
-
|
5 |
-
<section class="home-hero hero-standard hero-standard-full">
|
6 |
-
<div class="wrapper flex <?php echo ! $this->is_scan() && ! $this->is_active() ? 'reg-form' : ''; ?> ">
|
7 |
-
<?php if ( ! $this->is_registration_form() ) : ?>
|
8 |
-
<div class="logo-row flex top-logo">
|
9 |
-
<div class="accessibe-logo">
|
10 |
-
<img class="hero-cover-image" data-lazyload-ignore="true" src="<?php echo WPCF7_PRO_REDIRECT_BUILD_PATH . 'images/accessibe-full-logo.svg'; ?>" alt="Blind person hero image">
|
11 |
-
</div>
|
12 |
-
<?php if ( $this->is_scan() ) : ?>
|
13 |
-
<form action="<?php echo $this->get_settings_url(); ?>" method="post" class="accesibe-settings-form">
|
14 |
-
<button type="submit" class="site-button js-active site-button-animate site-button-right-icon site-button-full" data-element="signup-button">
|
15 |
-
<span class="align-middle">
|
16 |
-
<?php _e( 'Create a Free Account!', 'wpcf7-redirect' ); ?> <span class="dashicons dashicons-arrow-right-alt2"></span>
|
17 |
-
</span>
|
18 |
-
</button>
|
19 |
-
<input type="hidden" name="start-free-trial" value="<?php echo qs_get_plugin_display_name(); ?>" />
|
20 |
-
</form>
|
21 |
-
<?php endif; ?>
|
22 |
-
</div>
|
23 |
-
<?php endif; ?>
|
24 |
-
<?php
|
25 |
-
if ( $this->is_registration_form() ) :
|
26 |
-
?>
|
27 |
-
<div class="main-form-wrap">
|
28 |
-
<div class="home-hero-content hero-left">
|
29 |
-
<div class="hero-left-inner">
|
30 |
-
<h3 class="home-hero-title">The #1 <em>Fully</em> <em>Automated</em> <br> Web Accessibility Solution <br> for ADA & WCAG Compliance</h3>
|
31 |
-
<ul class="home-hero-checkmarks">
|
32 |
-
<li class="home-hero-checkmark">
|
33 |
-
<i class="icon icon-checkmark icon-pack-icomoon ">
|
34 |
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
35 |
-
<title>checkmark</title>
|
36 |
-
<path d="M13.5 2l-7.5 7.5-3.5-3.5-2.5 2.5 6 6 10-10z"></path>
|
37 |
-
</svg>
|
38 |
-
</i>
|
39 |
-
<strong>Affordable.</strong> $49/month, free trial, no credit card required
|
40 |
-
</li>
|
41 |
-
<li class="home-hero-checkmark">
|
42 |
-
<i class="icon icon-checkmark icon-pack-icomoon ">
|
43 |
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
44 |
-
<title>checkmark</title>
|
45 |
-
<path d="M13.5 2l-7.5 7.5-3.5-3.5-2.5 2.5 6 6 10-10z"></path>
|
46 |
-
</svg>
|
47 |
-
</i>
|
48 |
-
<strong>Effortless.</strong> Add a single line of code for 24/7 automated compliance
|
49 |
-
</li>
|
50 |
-
<li class="home-hero-checkmark">
|
51 |
-
<i class="icon icon-checkmark icon-pack-icomoon ">
|
52 |
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
53 |
-
<title>checkmark</title>
|
54 |
-
<path d="M13.5 2l-7.5 7.5-3.5-3.5-2.5 2.5 6 6 10-10z"></path>
|
55 |
-
</svg>
|
56 |
-
</i>
|
57 |
-
<strong>Compliant.</strong> Accessibility statement and certificate of performance
|
58 |
-
</li>
|
59 |
-
</ul>
|
60 |
-
</div>
|
61 |
-
</div>
|
62 |
-
<div class="hero-right">
|
63 |
-
<div class="hero-right-inner">
|
64 |
-
<div class="accessibe-logo">
|
65 |
-
<img class="hero-cover-image" data-lazyload-ignore="true" src="<?php echo WPCF7_PRO_REDIRECT_BUILD_PATH . 'images/accessibe-full-logo.svg'; ?>" alt="Blind person hero image">
|
66 |
-
</div>
|
67 |
-
<h4>Create A 30-Day Trial Account</h4>
|
68 |
-
<form name="accesibe-registration" action="" method="post" class="accesibe-registration-form-fields">
|
69 |
-
<div class="home-hero-cta">
|
70 |
-
<div class="field-wrap">
|
71 |
-
<label for="email"><?php _e( 'Your Email Address', 'wpcf7-redirect' ); ?></label>
|
72 |
-
<input type="email" name="email" value="<?php echo get_option( 'admin_email' ); ?>" required placeholder="example@example.com"/>
|
73 |
-
</div>
|
74 |
-
<div class="field-wrap">
|
75 |
-
<label for="fullname"><?php _e( 'Your Full Name', 'wpcf7-redirect' ); ?></label>
|
76 |
-
<input type="text" name="fullname" minlength="3" value="<?php echo $user->first_name . ' ' . $user->last_name; ?>" required placeholder="John Smith"/>
|
77 |
-
</div>
|
78 |
-
<div class="field-wrap">
|
79 |
-
<label for="password"><?php _e( 'Your Password', 'wpcf7-redirect' ); ?></label>
|
80 |
-
<input type="password" name="password" minlength="8" value="" required placeholder="<?php _e( '8+ Charachters', 'wpcf7-redirect' ); ?>"/>
|
81 |
-
</div>
|
82 |
-
|
83 |
-
<span class="loader-spinner-container spinner-light" data-loader="spinner">
|
84 |
-
<span class="loader-spinner"></span></span>
|
85 |
-
</button>
|
86 |
-
</div>
|
87 |
-
<div class="agreement">
|
88 |
-
<div class="highlight">
|
89 |
-
<input type="checkbox" name="tos" id="tos" checked="" data-activate-on-check="signup-button" required>
|
90 |
-
<label for="tos"><?php _e( 'By signing up you agree to our', 'wpcf7-redirect' ); ?> <a href="https://accessibe.com/terms-of-service" target="_blank"><?php _e( 'Terms of Service', 'wpcf7-redirect' ); ?></a></label>
|
91 |
-
</div>
|
92 |
-
</div>
|
93 |
-
<div class="field-wrap">
|
94 |
-
<button type="submit" class="site-button js-active site-button-animate site-button-right-icon site-button-full" data-element="signup-button">
|
95 |
-
<span class="align-middle">
|
96 |
-
<?php _e( 'Create a Free Account!', 'wpcf7-redirect' ); ?> <span class="dashicons dashicons-arrow-right-alt2"></span>
|
97 |
-
</span>
|
98 |
-
</button>
|
99 |
-
</div>
|
100 |
-
<input type="hidden" name="activate-accesibe" value="1" />
|
101 |
-
<div class="footer-wrap">
|
102 |
-
<a class=" align-middle" href="<?php echo admin_url( '?deactivate=' . qs_get_plugin_display_name() ); ?>">
|
103 |
-
<?php _e( 'Hide this special offer', 'wpcf7-redirect' ); ?>
|
104 |
-
</a>
|
105 |
-
<a href="<?php echo $this->get_scan_link(); ?>" class="scan-again"><?php _e( 'Scan my website again.', 'wpcf7-redirect' ); ?></a>
|
106 |
-
</div>
|
107 |
-
</form>
|
108 |
-
</div>
|
109 |
-
</div>
|
110 |
-
|
111 |
-
</div>
|
112 |
-
</form>
|
113 |
-
<?php elseif ( $this->is_scan() ) : ?>
|
114 |
-
<div class="qs-row">
|
115 |
-
<div class="qs-col">
|
116 |
-
<div class="scanning">
|
117 |
-
Please wait a few seconds while we process your website accessibility report.
|
118 |
-
</div>
|
119 |
-
<div class="scanning-tip">
|
120 |
-
<strong>Results guide:</strong> <strong>Compliant</strong> - You're all good. <strong>Semi/Not Compliant</strong> - We recommend you to install accessiBe
|
121 |
-
</div>
|
122 |
-
</div>
|
123 |
-
</div>
|
124 |
-
<?php $url = add_query_arg( 'accesibedomainscan', str_replace( 'http:', 'https:', home_url() ), 'https://querysol.com/scan' ); ?>
|
125 |
-
<iframe src="<?php echo $url; ?>" scrolling="no" style=" width: 100%; height: 100vh; overflow: hidden;" ></iframe>
|
126 |
-
<form action="<?php echo $this->get_settings_url(); ?>" method="post" class="accesibe-settings-form-footer">
|
127 |
-
<button type="submit" class="site-button js-active site-button-animate site-button-right-icon site-button-full" data-element="signup-button">
|
128 |
-
<span class="align-middle">
|
129 |
-
<?php _e( 'Create a Free Account!', 'wpcf7-redirect' ); ?> <span class="dashicons dashicons-arrow-right-alt2"></span>
|
130 |
-
</span>
|
131 |
-
</button>
|
132 |
-
<input type="hidden" name="start-free-trial" value="<?php echo qs_get_plugin_display_name(); ?>" />
|
133 |
-
</form>
|
134 |
-
<div class="footer-wrap">
|
135 |
-
<a class=" align-middle" href="<?php echo admin_url( '?deactivate=' . qs_get_plugin_display_name() ); ?>">
|
136 |
-
<?php _e( 'Hide This Special Offer', 'wpcf7-redirect' ); ?>
|
137 |
-
</a>
|
138 |
-
</div>
|
139 |
-
<?php else : ?>
|
140 |
-
<form name="accesibe-registration" action="<?php echo $this->get_settings_url(); ?>" method="post" class="accesibe-settings-form">
|
141 |
-
<div class="success-message">
|
142 |
-
<h3>
|
143 |
-
Thank you for installing accessibe!
|
144 |
-
</h3>
|
145 |
-
<div class="success-message-subtitle">
|
146 |
-
The plugin is now active on your website.
|
147 |
-
</div>
|
148 |
-
<div class="success-content">
|
149 |
-
If you want to customize the widget settings you can do it here: <br/>
|
150 |
-
To deactivate the plugin you can <a class=" align-middle" href="<?php echo admin_url( '?deactivate=' . qs_get_plugin_display_name() ); ?>">Click Here.</a>
|
151 |
-
</div>
|
152 |
-
</div>
|
153 |
-
<?php $this->get_settings_form(); ?>
|
154 |
-
|
155 |
-
<div class="qs-row">
|
156 |
-
<div class="qs-col">
|
157 |
-
<button type="submit" class="site-button js-active site-button-animate site-button-right-icon site-button-full" data-element="signup-button">
|
158 |
-
<span class="align-middle"><?php _e( 'Save', 'wpcf7-redirect' ); ?></span>
|
159 |
-
</button>
|
160 |
-
</div>
|
161 |
-
</div>
|
162 |
-
<input type="hidden" name="save_ext_settings" value="<?php echo qs_get_plugin_display_name(); ?>" />
|
163 |
-
</form>
|
164 |
-
<?php endif; ?>
|
165 |
-
</section>
|
1 |
+
<?php defined( 'ABSPATH' ) || exit; ?>
|
2 |
+
|
3 |
+
<?php $user = wp_get_current_user(); ?>
|
4 |
+
|
5 |
+
<section class="home-hero hero-standard hero-standard-full">
|
6 |
+
<div class="wrapper flex <?php echo ! $this->is_scan() && ! $this->is_active() ? 'reg-form' : ''; ?> ">
|
7 |
+
<?php if ( ! $this->is_registration_form() ) : ?>
|
8 |
+
<div class="logo-row flex top-logo">
|
9 |
+
<div class="accessibe-logo">
|
10 |
+
<img class="hero-cover-image" data-lazyload-ignore="true" src="<?php echo WPCF7_PRO_REDIRECT_BUILD_PATH . 'images/accessibe-full-logo.svg'; ?>" alt="Blind person hero image">
|
11 |
+
</div>
|
12 |
+
<?php if ( $this->is_scan() ) : ?>
|
13 |
+
<form action="<?php echo $this->get_settings_url(); ?>" method="post" class="accesibe-settings-form">
|
14 |
+
<button type="submit" class="site-button js-active site-button-animate site-button-right-icon site-button-full" data-element="signup-button">
|
15 |
+
<span class="align-middle">
|
16 |
+
<?php _e( 'Create a Free Account!', 'wpcf7-redirect' ); ?> <span class="dashicons dashicons-arrow-right-alt2"></span>
|
17 |
+
</span>
|
18 |
+
</button>
|
19 |
+
<input type="hidden" name="start-free-trial" value="<?php echo qs_get_plugin_display_name(); ?>" />
|
20 |
+
</form>
|
21 |
+
<?php endif; ?>
|
22 |
+
</div>
|
23 |
+
<?php endif; ?>
|
24 |
+
<?php
|
25 |
+
if ( $this->is_registration_form() ) :
|
26 |
+
?>
|
27 |
+
<div class="main-form-wrap">
|
28 |
+
<div class="home-hero-content hero-left">
|
29 |
+
<div class="hero-left-inner">
|
30 |
+
<h3 class="home-hero-title">The #1 <em>Fully</em> <em>Automated</em> <br> Web Accessibility Solution <br> for ADA & WCAG Compliance</h3>
|
31 |
+
<ul class="home-hero-checkmarks">
|
32 |
+
<li class="home-hero-checkmark">
|
33 |
+
<i class="icon icon-checkmark icon-pack-icomoon ">
|
34 |
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
35 |
+
<title>checkmark</title>
|
36 |
+
<path d="M13.5 2l-7.5 7.5-3.5-3.5-2.5 2.5 6 6 10-10z"></path>
|
37 |
+
</svg>
|
38 |
+
</i>
|
39 |
+
<strong>Affordable.</strong> $49/month, free trial, no credit card required
|
40 |
+
</li>
|
41 |
+
<li class="home-hero-checkmark">
|
42 |
+
<i class="icon icon-checkmark icon-pack-icomoon ">
|
43 |
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
44 |
+
<title>checkmark</title>
|
45 |
+
<path d="M13.5 2l-7.5 7.5-3.5-3.5-2.5 2.5 6 6 10-10z"></path>
|
46 |
+
</svg>
|
47 |
+
</i>
|
48 |
+
<strong>Effortless.</strong> Add a single line of code for 24/7 automated compliance
|
49 |
+
</li>
|
50 |
+
<li class="home-hero-checkmark">
|
51 |
+
<i class="icon icon-checkmark icon-pack-icomoon ">
|
52 |
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
53 |
+
<title>checkmark</title>
|
54 |
+
<path d="M13.5 2l-7.5 7.5-3.5-3.5-2.5 2.5 6 6 10-10z"></path>
|
55 |
+
</svg>
|
56 |
+
</i>
|
57 |
+
<strong>Compliant.</strong> Accessibility statement and certificate of performance
|
58 |
+
</li>
|
59 |
+
</ul>
|
60 |
+
</div>
|
61 |
+
</div>
|
62 |
+
<div class="hero-right">
|
63 |
+
<div class="hero-right-inner">
|
64 |
+
<div class="accessibe-logo">
|
65 |
+
<img class="hero-cover-image" data-lazyload-ignore="true" src="<?php echo WPCF7_PRO_REDIRECT_BUILD_PATH . 'images/accessibe-full-logo.svg'; ?>" alt="Blind person hero image">
|
66 |
+
</div>
|
67 |
+
<h4>Create A 30-Day Trial Account</h4>
|
68 |
+
<form name="accesibe-registration" action="" method="post" class="accesibe-registration-form-fields">
|
69 |
+
<div class="home-hero-cta">
|
70 |
+
<div class="field-wrap">
|
71 |
+
<label for="email"><?php _e( 'Your Email Address', 'wpcf7-redirect' ); ?></label>
|
72 |
+
<input type="email" name="email" value="<?php echo get_option( 'admin_email' ); ?>" required placeholder="example@example.com"/>
|
73 |
+
</div>
|
74 |
+
<div class="field-wrap">
|
75 |
+
<label for="fullname"><?php _e( 'Your Full Name', 'wpcf7-redirect' ); ?></label>
|
76 |
+
<input type="text" name="fullname" minlength="3" value="<?php echo $user->first_name . ' ' . $user->last_name; ?>" required placeholder="John Smith"/>
|
77 |
+
</div>
|
78 |
+
<div class="field-wrap">
|
79 |
+
<label for="password"><?php _e( 'Your Password', 'wpcf7-redirect' ); ?></label>
|
80 |
+
<input type="password" name="password" minlength="8" value="" required placeholder="<?php _e( '8+ Charachters', 'wpcf7-redirect' ); ?>"/>
|
81 |
+
</div>
|
82 |
+
|
83 |
+
<span class="loader-spinner-container spinner-light" data-loader="spinner">
|
84 |
+
<span class="loader-spinner"></span></span>
|
85 |
+
</button>
|
86 |
+
</div>
|
87 |
+
<div class="agreement">
|
88 |
+
<div class="highlight">
|
89 |
+
<input type="checkbox" name="tos" id="tos" checked="" data-activate-on-check="signup-button" required>
|
90 |
+
<label for="tos"><?php _e( 'By signing up you agree to our', 'wpcf7-redirect' ); ?> <a href="https://accessibe.com/terms-of-service" target="_blank"><?php _e( 'Terms of Service', 'wpcf7-redirect' ); ?></a></label>
|
91 |
+
</div>
|
92 |
+
</div>
|
93 |
+
<div class="field-wrap">
|
94 |
+
<button type="submit" class="site-button js-active site-button-animate site-button-right-icon site-button-full" data-element="signup-button">
|
95 |
+
<span class="align-middle">
|
96 |
+
<?php _e( 'Create a Free Account!', 'wpcf7-redirect' ); ?> <span class="dashicons dashicons-arrow-right-alt2"></span>
|
97 |
+
</span>
|
98 |
+
</button>
|
99 |
+
</div>
|
100 |
+
<input type="hidden" name="activate-accesibe" value="1" />
|
101 |
+
<div class="footer-wrap">
|
102 |
+
<a class=" align-middle" href="<?php echo admin_url( '?deactivate=' . qs_get_plugin_display_name() ); ?>">
|
103 |
+
<?php _e( 'Hide this special offer', 'wpcf7-redirect' ); ?>
|
104 |
+
</a>
|
105 |
+
<a href="<?php echo $this->get_scan_link(); ?>" class="scan-again"><?php _e( 'Scan my website again.', 'wpcf7-redirect' ); ?></a>
|
106 |
+
</div>
|
107 |
+
</form>
|
108 |
+
</div>
|
109 |
+
</div>
|
110 |
+
|
111 |
+
</div>
|
112 |
+
</form>
|
113 |
+
<?php elseif ( $this->is_scan() ) : ?>
|
114 |
+
<div class="qs-row">
|
115 |
+
<div class="qs-col">
|
116 |
+
<div class="scanning">
|
117 |
+
Please wait a few seconds while we process your website accessibility report.
|
118 |
+
</div>
|
119 |
+
<div class="scanning-tip">
|
120 |
+
<strong>Results guide:</strong> <strong>Compliant</strong> - You're all good. <strong>Semi/Not Compliant</strong> - We recommend you to install accessiBe
|
121 |
+
</div>
|
122 |
+
</div>
|
123 |
+
</div>
|
124 |
+
<?php $url = add_query_arg( 'accesibedomainscan', str_replace( 'http:', 'https:', home_url() ), 'https://querysol.com/scan' ); ?>
|
125 |
+
<iframe src="<?php echo $url; ?>" scrolling="no" style=" width: 100%; height: 100vh; overflow: hidden;" ></iframe>
|
126 |
+
<form action="<?php echo $this->get_settings_url(); ?>" method="post" class="accesibe-settings-form-footer">
|
127 |
+
<button type="submit" class="site-button js-active site-button-animate site-button-right-icon site-button-full" data-element="signup-button">
|
128 |
+
<span class="align-middle">
|
129 |
+
<?php _e( 'Create a Free Account!', 'wpcf7-redirect' ); ?> <span class="dashicons dashicons-arrow-right-alt2"></span>
|
130 |
+
</span>
|
131 |
+
</button>
|
132 |
+
<input type="hidden" name="start-free-trial" value="<?php echo qs_get_plugin_display_name(); ?>" />
|
133 |
+
</form>
|
134 |
+
<div class="footer-wrap">
|
135 |
+
<a class=" align-middle" href="<?php echo admin_url( '?deactivate=' . qs_get_plugin_display_name() ); ?>">
|
136 |
+
<?php _e( 'Hide This Special Offer', 'wpcf7-redirect' ); ?>
|
137 |
+
</a>
|
138 |
+
</div>
|
139 |
+
<?php else : ?>
|
140 |
+
<form name="accesibe-registration" action="<?php echo $this->get_settings_url(); ?>" method="post" class="accesibe-settings-form">
|
141 |
+
<div class="success-message">
|
142 |
+
<h3>
|
143 |
+
Thank you for installing accessibe!
|
144 |
+
</h3>
|
145 |
+
<div class="success-message-subtitle">
|
146 |
+
The plugin is now active on your website.
|
147 |
+
</div>
|
148 |
+
<div class="success-content">
|
149 |
+
If you want to customize the widget settings you can do it here: <br/>
|
150 |
+
To deactivate the plugin you can <a class=" align-middle" href="<?php echo admin_url( '?deactivate=' . qs_get_plugin_display_name() ); ?>">Click Here.</a>
|
151 |
+
</div>
|
152 |
+
</div>
|
153 |
+
<?php $this->get_settings_form(); ?>
|
154 |
+
|
155 |
+
<div class="qs-row">
|
156 |
+
<div class="qs-col">
|
157 |
+
<button type="submit" class="site-button js-active site-button-animate site-button-right-icon site-button-full" data-element="signup-button">
|
158 |
+
<span class="align-middle"><?php _e( 'Save', 'wpcf7-redirect' ); ?></span>
|
159 |
+
</button>
|
160 |
+
</div>
|
161 |
+
</div>
|
162 |
+
<input type="hidden" name="save_ext_settings" value="<?php echo qs_get_plugin_display_name(); ?>" />
|
163 |
+
</form>
|
164 |
+
<?php endif; ?>
|
165 |
+
</section>
|
classes/aff/templates/index.php
ADDED
File without changes
|
classes/class-qs-api.php
CHANGED
@@ -10,6 +10,7 @@ class Qs_Api {
|
|
10 |
|
11 |
public function __construct() {
|
12 |
$this->activation_url = WPCF7_PRO_REDIRECT_PLUGIN_ACTIVATION_URL;
|
|
|
13 |
$this->api_url = WPCF7_PRO_REDIRECT_PLUGIN_UPDATES;
|
14 |
$this->store_id = WPCF7_PRO_REDIRECT_PLUGIN_ID;
|
15 |
$this->sku = WPCF7_PRO_REDIRECT_PLUGIN_SKU;
|
@@ -19,7 +20,8 @@ class Qs_Api {
|
|
19 |
|
20 |
public function extension_has_update( $extension ) {
|
21 |
$current_ver = $extension->get_extension_ver();
|
22 |
-
|
|
|
23 |
'action' => 'license_key_validate',
|
24 |
'store_code' => $this->store_id,
|
25 |
'license_key' => $extension->get_serial(),
|
@@ -27,12 +29,27 @@ class Qs_Api {
|
|
27 |
'sku' => $extension->get_name(),
|
28 |
'activation_id' => $extension->get_activation_id(),
|
29 |
);
|
30 |
-
|
|
|
|
|
31 |
if ( ! is_wp_error( $results ) && isset( $results->data->version ) ) {
|
32 |
-
return floatval( $results->data->version ) > floatval( $current_ver );
|
33 |
}
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* Get a list of all extensions available on the server.
|
38 |
*
|
@@ -205,7 +222,7 @@ class Qs_Api {
|
|
205 |
return $results;
|
206 |
}
|
207 |
|
208 |
-
public function
|
209 |
$params = array(
|
210 |
'action' => 'get_extension_file',
|
211 |
'store_code' => $this->store_id,
|
@@ -239,11 +256,9 @@ class Qs_Api {
|
|
239 |
|
240 |
$results = wp_remote_retrieve_body( $results );
|
241 |
|
242 |
-
|
243 |
-
$results = json_decode( $results );
|
244 |
|
245 |
-
|
246 |
-
}
|
247 |
} elseif ( ! $results ) {
|
248 |
$results = new WP_Error( 'get_extension_file', __( 'Cannot download the file', 'wpcf7-redirect' ) );
|
249 |
}
|
@@ -251,6 +266,17 @@ class Qs_Api {
|
|
251 |
return $results;
|
252 |
}
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
/**
|
255 |
* Activate the serial
|
256 |
*
|
10 |
|
11 |
public function __construct() {
|
12 |
$this->activation_url = WPCF7_PRO_REDIRECT_PLUGIN_ACTIVATION_URL;
|
13 |
+
$this->changelog_url = WPCF7_PRO_REDIRECT_PLUGIN_CHANGELOG_URL;
|
14 |
$this->api_url = WPCF7_PRO_REDIRECT_PLUGIN_UPDATES;
|
15 |
$this->store_id = WPCF7_PRO_REDIRECT_PLUGIN_ID;
|
16 |
$this->sku = WPCF7_PRO_REDIRECT_PLUGIN_SKU;
|
20 |
|
21 |
public function extension_has_update( $extension ) {
|
22 |
$current_ver = $extension->get_extension_ver();
|
23 |
+
|
24 |
+
$params = array(
|
25 |
'action' => 'license_key_validate',
|
26 |
'store_code' => $this->store_id,
|
27 |
'license_key' => $extension->get_serial(),
|
29 |
'sku' => $extension->get_name(),
|
30 |
'activation_id' => $extension->get_activation_id(),
|
31 |
);
|
32 |
+
|
33 |
+
$results = $this->api_call( $this->activation_url, $params );
|
34 |
+
|
35 |
if ( ! is_wp_error( $results ) && isset( $results->data->version ) ) {
|
36 |
+
return floatval( $results->data->version ) > floatval( $current_ver ) ? $results->data->version : '';
|
37 |
}
|
38 |
}
|
39 |
|
40 |
+
/**
|
41 |
+
* Get action extension changelog
|
42 |
+
*/
|
43 |
+
public function get_action_changelog( $sku ) {
|
44 |
+
|
45 |
+
$params = array(
|
46 |
+
'ignore_unknown' => true,
|
47 |
+
);
|
48 |
+
|
49 |
+
$res = $this->api_call( $this->changelog_url . $sku, $params );
|
50 |
+
|
51 |
+
return $res;
|
52 |
+
}
|
53 |
/**
|
54 |
* Get a list of all extensions available on the server.
|
55 |
*
|
222 |
return $results;
|
223 |
}
|
224 |
|
225 |
+
public function get_extension_download_url( $activation_data, $sku ) {
|
226 |
$params = array(
|
227 |
'action' => 'get_extension_file',
|
228 |
'store_code' => $this->store_id,
|
256 |
|
257 |
$results = wp_remote_retrieve_body( $results );
|
258 |
|
259 |
+
$results = json_decode( $results );
|
|
|
260 |
|
261 |
+
$results = $results->download_link;
|
|
|
262 |
} elseif ( ! $results ) {
|
263 |
$results = new WP_Error( 'get_extension_file', __( 'Cannot download the file', 'wpcf7-redirect' ) );
|
264 |
}
|
266 |
return $results;
|
267 |
}
|
268 |
|
269 |
+
public function get_extension_file( $activation_data, $sku ) {
|
270 |
+
|
271 |
+
$results = $this->get_extension_download_url( $activation_data, $sku );
|
272 |
+
|
273 |
+
if ( ! is_wp_error( $results ) ) {
|
274 |
+
$results = download_url( $download_link, 1000 );
|
275 |
+
}
|
276 |
+
|
277 |
+
return $results;
|
278 |
+
}
|
279 |
+
|
280 |
/**
|
281 |
* Activate the serial
|
282 |
*
|
classes/class-wpcf7r-action.php
CHANGED
@@ -502,6 +502,12 @@ class WPCF7R_Action {
|
|
502 |
|
503 |
foreach ( $fields as $field ) {
|
504 |
delete_post_meta( $this->action_post_id, $field['name'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
}
|
506 |
}
|
507 |
|
502 |
|
503 |
foreach ( $fields as $field ) {
|
504 |
delete_post_meta( $this->action_post_id, $field['name'] );
|
505 |
+
|
506 |
+
if( isset( $field['fields'] ) && $field['fields'] ){
|
507 |
+
foreach( $field['fields'] as $sub_field_key => $sub_field ){
|
508 |
+
delete_post_meta( $this->action_post_id, $sub_field_key );
|
509 |
+
}
|
510 |
+
}
|
511 |
}
|
512 |
}
|
513 |
|
classes/class-wpcf7r-actions-list.php
CHANGED
@@ -1,102 +1,102 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit;
|
3 |
-
|
4 |
-
class Wpcf7r_Actions_List {
|
5 |
-
public static $action_posts;
|
6 |
-
|
7 |
-
public function __construct( $actions_posts = '' ) {
|
8 |
-
|
9 |
-
self::$action_posts = $actions_posts;
|
10 |
-
|
11 |
-
parent::__construct(
|
12 |
-
array(
|
13 |
-
'singular' => __( 'Action', 'wpcf7-redirect' ), // singular name of the listed records
|
14 |
-
'plural' => __( 'Actions', 'wpcf7-redirect' ), // plural name of the listed records
|
15 |
-
'ajax' => false, // should this table support ajax?
|
16 |
-
)
|
17 |
-
);
|
18 |
-
}
|
19 |
-
|
20 |
-
public function record_count() {
|
21 |
-
return count( self::$action_posts );
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Text diwpcf7-redirect layed when no customer data is available
|
26 |
-
*/
|
27 |
-
public function no_items() {
|
28 |
-
_e( 'No Actions Avaliable.', 'wpcf7-redirect' );
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Return an associative array containing the bulk action
|
33 |
-
*
|
34 |
-
* @return array
|
35 |
-
*/
|
36 |
-
public function get_bulk_actions() {
|
37 |
-
$actions = array(
|
38 |
-
'bulk-delete' => 'Delete',
|
39 |
-
);
|
40 |
-
|
41 |
-
return $actions;
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Handles data query and filter, sorting, and pagination.
|
46 |
-
*/
|
47 |
-
public function prepare_items() {
|
48 |
-
$this->_column_headers = $this->get_column_info();
|
49 |
-
|
50 |
-
/** Process bulk action */
|
51 |
-
$this->process_bulk_action();
|
52 |
-
|
53 |
-
$per_page = 10;
|
54 |
-
$current_page = $this->get_pagenum();
|
55 |
-
$total_items = $this->record_count();
|
56 |
-
|
57 |
-
$this->set_pagination_args(
|
58 |
-
array(
|
59 |
-
'total_items' => $total_items, //WE have to calculate the total number of items
|
60 |
-
'per_page' => $per_page, //WE have to determine how many items to show on a page
|
61 |
-
)
|
62 |
-
);
|
63 |
-
|
64 |
-
$this->items = self::$action_posts;
|
65 |
-
}
|
66 |
-
|
67 |
-
public function process_bulk_action() {
|
68 |
-
|
69 |
-
//Detect when a bulk action is being triggered...
|
70 |
-
if ( 'delete' === $this->current_action() ) {
|
71 |
-
|
72 |
-
// In our file that handles the request, verify the nonce.
|
73 |
-
$nonce = esc_attr( $_REQUEST['_wpnonce'] );
|
74 |
-
|
75 |
-
if ( ! wp_verify_nonce( $nonce, 'sp_delete_customer' ) ) {
|
76 |
-
die( 'Go get a life script kiddies' );
|
77 |
-
} else {
|
78 |
-
self::delete_customer( absint( $_GET['customer'] ) );
|
79 |
-
|
80 |
-
wp_redirect( esc_url( add_query_arg() ) );
|
81 |
-
exit;
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
// If the delete bulk action is triggered
|
86 |
-
if ( ( isset( $_POST['action'] ) && 'bulk-delete' === $_POST['action'] )
|
87 |
-
|| ( isset( $_POST['action2'] ) && 'bulk-delete' === $_POST['action2'] )
|
88 |
-
) {
|
89 |
-
|
90 |
-
$delete_ids = esc_sql( $_POST['bulk-delete'] );
|
91 |
-
|
92 |
-
// loop over the array of record IDs and delete them
|
93 |
-
foreach ( $delete_ids as $id ) {
|
94 |
-
self::delete_customer( $id );
|
95 |
-
|
96 |
-
}
|
97 |
-
|
98 |
-
wp_redirect( esc_url( add_query_arg() ) );
|
99 |
-
exit;
|
100 |
-
}
|
101 |
-
}
|
102 |
-
}
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit;
|
3 |
+
|
4 |
+
class Wpcf7r_Actions_List {
|
5 |
+
public static $action_posts;
|
6 |
+
|
7 |
+
public function __construct( $actions_posts = '' ) {
|
8 |
+
|
9 |
+
self::$action_posts = $actions_posts;
|
10 |
+
|
11 |
+
parent::__construct(
|
12 |
+
array(
|
13 |
+
'singular' => __( 'Action', 'wpcf7-redirect' ), // singular name of the listed records
|
14 |
+
'plural' => __( 'Actions', 'wpcf7-redirect' ), // plural name of the listed records
|
15 |
+
'ajax' => false, // should this table support ajax?
|
16 |
+
)
|
17 |
+
);
|
18 |
+
}
|
19 |
+
|
20 |
+
public function record_count() {
|
21 |
+
return count( self::$action_posts );
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Text diwpcf7-redirect layed when no customer data is available
|
26 |
+
*/
|
27 |
+
public function no_items() {
|
28 |
+
_e( 'No Actions Avaliable.', 'wpcf7-redirect' );
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Return an associative array containing the bulk action
|
33 |
+
*
|
34 |
+
* @return array
|
35 |
+
*/
|
36 |
+
public function get_bulk_actions() {
|
37 |
+
$actions = array(
|
38 |
+
'bulk-delete' => 'Delete',
|
39 |
+
);
|
40 |
+
|
41 |
+
return $actions;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Handles data query and filter, sorting, and pagination.
|
46 |
+
*/
|
47 |
+
public function prepare_items() {
|
48 |
+
$this->_column_headers = $this->get_column_info();
|
49 |
+
|
50 |
+
/** Process bulk action */
|
51 |
+
$this->process_bulk_action();
|
52 |
+
|
53 |
+
$per_page = 10;
|
54 |
+
$current_page = $this->get_pagenum();
|
55 |
+
$total_items = $this->record_count();
|
56 |
+
|
57 |
+
$this->set_pagination_args(
|
58 |
+
array(
|
59 |
+
'total_items' => $total_items, //WE have to calculate the total number of items
|
60 |
+
'per_page' => $per_page, //WE have to determine how many items to show on a page
|
61 |
+
)
|
62 |
+
);
|
63 |
+
|
64 |
+
$this->items = self::$action_posts;
|
65 |
+
}
|
66 |
+
|
67 |
+
public function process_bulk_action() {
|
68 |
+
|
69 |
+
//Detect when a bulk action is being triggered...
|
70 |
+
if ( 'delete' === $this->current_action() ) {
|
71 |
+
|
72 |
+
// In our file that handles the request, verify the nonce.
|
73 |
+
$nonce = esc_attr( $_REQUEST['_wpnonce'] );
|
74 |
+
|
75 |
+
if ( ! wp_verify_nonce( $nonce, 'sp_delete_customer' ) ) {
|
76 |
+
die( 'Go get a life script kiddies' );
|
77 |
+
} else {
|
78 |
+
self::delete_customer( absint( $_GET['customer'] ) );
|
79 |
+
|
80 |
+
wp_redirect( esc_url( add_query_arg() ) );
|
81 |
+
exit;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
// If the delete bulk action is triggered
|
86 |
+
if ( ( isset( $_POST['action'] ) && 'bulk-delete' === $_POST['action'] )
|
87 |
+
|| ( isset( $_POST['action2'] ) && 'bulk-delete' === $_POST['action2'] )
|
88 |
+
) {
|
89 |
+
|
90 |
+
$delete_ids = esc_sql( $_POST['bulk-delete'] );
|
91 |
+
|
92 |
+
// loop over the array of record IDs and delete them
|
93 |
+
foreach ( $delete_ids as $id ) {
|
94 |
+
self::delete_customer( $id );
|
95 |
+
|
96 |
+
}
|
97 |
+
|
98 |
+
wp_redirect( esc_url( add_query_arg() ) );
|
99 |
+
exit;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
classes/class-wpcf7r-extension.php
CHANGED
@@ -19,10 +19,12 @@ class WPCF7R_Extension {
|
|
19 |
$this->classname = '';
|
20 |
$this->extension_file_name = '';
|
21 |
$this->sku = $this->get_sku();
|
|
|
22 |
|
23 |
if ( 'affiliate' !== $this->type ) {
|
24 |
$this->serial = $this->get_serial();
|
25 |
$this->extension_file_name = isset( $extension['filename'] ) ? $extension['filename'] : '';
|
|
|
26 |
$this->extension_ver = $this->get_ver();
|
27 |
$this->classname = $extension['classname'];
|
28 |
|
@@ -41,6 +43,15 @@ class WPCF7R_Extension {
|
|
41 |
return isset( $this->external_url ) ? $this->external_url : '';
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
/**
|
45 |
* Get the btn label
|
46 |
*/
|
@@ -147,11 +158,18 @@ class WPCF7R_Extension {
|
|
147 |
return get_option( 'wpcf7r_extension-needs-update-' . $this->get_name() ) && $this->is_active();
|
148 |
}
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
/**
|
151 |
* Set the required update flag
|
152 |
*/
|
153 |
-
public function set_needs_update() {
|
154 |
-
update_option( 'wpcf7r_extension-needs-update-' . $this->get_name(),
|
155 |
}
|
156 |
|
157 |
/**
|
@@ -240,10 +258,17 @@ class WPCF7R_Extension {
|
|
240 |
);
|
241 |
|
242 |
} else {
|
243 |
-
|
244 |
//serial was valid, update the activation key for future validation
|
245 |
$this->set_activation( $is_valid->data, $serial );
|
246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
$response = $this->save_extension_file();
|
248 |
|
249 |
if ( ! isset( $response['error'] ) ) {
|
@@ -277,6 +302,16 @@ class WPCF7R_Extension {
|
|
277 |
return WPCF7_PRO_REDIRECT_PLUGINS_PATH . $this->get_name();
|
278 |
}
|
279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
/**
|
281 |
* Save the Newly downloaded file to the plugins dir
|
282 |
*/
|
@@ -284,7 +319,7 @@ class WPCF7R_Extension {
|
|
284 |
global $wp_filesystem;
|
285 |
|
286 |
$this->api = isset( $this->api ) && $this->api ? $this->api : new Qs_Api();
|
287 |
-
|
288 |
$response = array();
|
289 |
|
290 |
$file_path = $this->api->get_extension_file( $this->get_activation_data(), $this->get_sku() );
|
19 |
$this->classname = '';
|
20 |
$this->extension_file_name = '';
|
21 |
$this->sku = $this->get_sku();
|
22 |
+
$this->slug = '';
|
23 |
|
24 |
if ( 'affiliate' !== $this->type ) {
|
25 |
$this->serial = $this->get_serial();
|
26 |
$this->extension_file_name = isset( $extension['filename'] ) ? $extension['filename'] : '';
|
27 |
+
$this->slug = str_replace( '.php', '', $this->extension_file_name );
|
28 |
$this->extension_ver = $this->get_ver();
|
29 |
$this->classname = $extension['classname'];
|
30 |
|
43 |
return isset( $this->external_url ) ? $this->external_url : '';
|
44 |
}
|
45 |
|
46 |
+
public function get_extension_file_name() {
|
47 |
+
return $this->extension_file_name;
|
48 |
+
}
|
49 |
+
/**
|
50 |
+
* Get the extension slug
|
51 |
+
*/
|
52 |
+
public function get_slug() {
|
53 |
+
return $this->slug;
|
54 |
+
}
|
55 |
/**
|
56 |
* Get the btn label
|
57 |
*/
|
158 |
return get_option( 'wpcf7r_extension-needs-update-' . $this->get_name() ) && $this->is_active();
|
159 |
}
|
160 |
|
161 |
+
/**
|
162 |
+
* Get the version of the update
|
163 |
+
*/
|
164 |
+
public function update_version() {
|
165 |
+
return get_option( 'wpcf7r_extension-needs-update-' . $this->get_name() );
|
166 |
+
}
|
167 |
+
|
168 |
/**
|
169 |
* Set the required update flag
|
170 |
*/
|
171 |
+
public function set_needs_update( $new_ver ) {
|
172 |
+
update_option( 'wpcf7r_extension-needs-update-' . $this->get_name(), $new_ver );
|
173 |
}
|
174 |
|
175 |
/**
|
258 |
);
|
259 |
|
260 |
} else {
|
|
|
261 |
//serial was valid, update the activation key for future validation
|
262 |
$this->set_activation( $is_valid->data, $serial );
|
263 |
|
264 |
+
if ( $this->extension_file_exists() ) {
|
265 |
+
$response['extension_html'] = $this->ajax_extension_html();
|
266 |
+
|
267 |
+
return $response;
|
268 |
+
}
|
269 |
+
|
270 |
+
deactivate_plugins( $this->get_extension_relative_path() );
|
271 |
+
|
272 |
$response = $this->save_extension_file();
|
273 |
|
274 |
if ( ! isset( $response['error'] ) ) {
|
302 |
return WPCF7_PRO_REDIRECT_PLUGINS_PATH . $this->get_name();
|
303 |
}
|
304 |
|
305 |
+
/**
|
306 |
+
* Get the extension download link
|
307 |
+
*/
|
308 |
+
public function get_extension_remote_file() {
|
309 |
+
$this->api = isset( $this->api ) && $this->api ? $this->api : new Qs_Api();
|
310 |
+
|
311 |
+
$download_link = $this->api->get_extension_download_url( $this->get_activation_data(), $this->get_sku() );
|
312 |
+
|
313 |
+
return $download_link;
|
314 |
+
}
|
315 |
/**
|
316 |
* Save the Newly downloaded file to the plugins dir
|
317 |
*/
|
319 |
global $wp_filesystem;
|
320 |
|
321 |
$this->api = isset( $this->api ) && $this->api ? $this->api : new Qs_Api();
|
322 |
+
|
323 |
$response = array();
|
324 |
|
325 |
$file_path = $this->api->get_extension_file( $this->get_activation_data(), $this->get_sku() );
|
classes/class-wpcf7r-form-helper.php
CHANGED
@@ -49,8 +49,104 @@ class WPCF7r_Form_Helper {
|
|
49 |
add_action( 'wp_ajax_get_coupon', array( $this, 'get_coupon' ) );
|
50 |
add_action( 'wpcf7_admin_notices', array( $this, 'render_discount_banner' ), 15, 3 );
|
51 |
add_action( 'admin_init', array( $this, 'dismiss_ads' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
/**
|
55 |
* Check if an extension requires an update
|
56 |
*
|
@@ -79,6 +175,7 @@ class WPCF7r_Form_Helper {
|
|
79 |
* @return void
|
80 |
*/
|
81 |
public function maybe_update_extensions_check() {
|
|
|
82 |
|
83 |
$current = get_transient( 'update_wpcf7r_extensions' );
|
84 |
|
@@ -116,7 +213,7 @@ class WPCF7r_Form_Helper {
|
|
116 |
|
117 |
if ( $has_update ) {
|
118 |
|
119 |
-
$extension->set_needs_update();
|
120 |
|
121 |
} else {
|
122 |
|
@@ -125,7 +222,6 @@ class WPCF7r_Form_Helper {
|
|
125 |
}
|
126 |
}
|
127 |
}
|
128 |
-
|
129 |
}
|
130 |
|
131 |
/**
|
49 |
add_action( 'wp_ajax_get_coupon', array( $this, 'get_coupon' ) );
|
50 |
add_action( 'wpcf7_admin_notices', array( $this, 'render_discount_banner' ), 15, 3 );
|
51 |
add_action( 'admin_init', array( $this, 'dismiss_ads' ) );
|
52 |
+
|
53 |
+
// define the alternative API for updating checking
|
54 |
+
add_filter( 'pre_set_site_transient_update_plugins', array( &$this, 'check_update' ) );
|
55 |
+
|
56 |
+
add_filter( 'plugins_api', array( &$this, 'check_info' ), 10, 3 );
|
57 |
+
|
58 |
}
|
59 |
|
60 |
+
/**
|
61 |
+
* Add our self-hosted description to the filter
|
62 |
+
*
|
63 |
+
* @param boolean $false
|
64 |
+
* @param array $action
|
65 |
+
* @param object $arg
|
66 |
+
* @return bool|object
|
67 |
+
*
|
68 |
+
* @version 1.0.0
|
69 |
+
*/
|
70 |
+
public function check_info( $false, $action, $arg ) {
|
71 |
+
$action_plugin = false;
|
72 |
+
|
73 |
+
$api = new Qs_Api();
|
74 |
+
|
75 |
+
foreach ( $this->extensions as $extension_type => $extension_details ) {
|
76 |
+
|
77 |
+
$extension = new WPCF7R_Extension( $extension_details );
|
78 |
+
|
79 |
+
if ( $arg->slug === $extension->get_slug() ) {
|
80 |
+
$action_plugin = $extension->get_sku();
|
81 |
+
break;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
if ( ( $action == 'query_plugins' || $action == 'plugin_information' ) && $action_plugin ) {
|
86 |
+
|
87 |
+
$array_pattern = array(
|
88 |
+
'/^([\*\s])*(\d\d\.\d\d\.\d\d\d\d[^\n]*)/m',
|
89 |
+
'/^\n+|^[\t\s]*\n+/m',
|
90 |
+
'/\n/',
|
91 |
+
);
|
92 |
+
|
93 |
+
$array_replace = array(
|
94 |
+
'<h4>$2</h4>',
|
95 |
+
'</div><div>',
|
96 |
+
'</div><div>',
|
97 |
+
);
|
98 |
+
|
99 |
+
$changelog = $api->get_action_changelog( $action_plugin );
|
100 |
+
|
101 |
+
$information = new stdClass;
|
102 |
+
|
103 |
+
$information->sections['changelog'] = '<div>' . $changelog->changelog . '</div>';
|
104 |
+
|
105 |
+
return $information;
|
106 |
+
}
|
107 |
+
|
108 |
+
return $false;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Add our self-hosted autoupdate plugin to the filter transient
|
113 |
+
*
|
114 |
+
* @param $transient
|
115 |
+
* @return object $ transient
|
116 |
+
*
|
117 |
+
* @version 1.0.0
|
118 |
+
*/
|
119 |
+
public function check_update( $transient ) {
|
120 |
+
if ( empty( $transient->checked ) ) {
|
121 |
+
return $transient;
|
122 |
+
}
|
123 |
+
|
124 |
+
foreach ( $this->extensions as $extension_type => $extension_details ) {
|
125 |
+
|
126 |
+
$extension = new WPCF7R_Extension( $extension_details );
|
127 |
+
|
128 |
+
if ( $extension->has_update() ) {
|
129 |
+
|
130 |
+
$update_url = add_query_arg( 'update', true, $extension->get_extension_remote_file() );
|
131 |
+
$obj = new stdClass();
|
132 |
+
$obj->id = $extension->get_slug();
|
133 |
+
$obj->slug = $extension->get_slug();
|
134 |
+
$obj->new_version = $extension->update_version();
|
135 |
+
$obj->url = $update_url;
|
136 |
+
$obj->plugin = $extension->get_extension_relative_path();
|
137 |
+
$obj->package = $update_url;
|
138 |
+
$obj->tested = WPCF7_PRO_REDIRECT_WP_TESTED;
|
139 |
+
$obj->icons = array(
|
140 |
+
'2x' => $extension->get_icon(),
|
141 |
+
'1x' => $extension->get_icon(),
|
142 |
+
);
|
143 |
+
|
144 |
+
$transient->response[ $extension->get_extension_relative_path() ] = $obj;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
return $transient;
|
149 |
+
}
|
150 |
/**
|
151 |
* Check if an extension requires an update
|
152 |
*
|
175 |
* @return void
|
176 |
*/
|
177 |
public function maybe_update_extensions_check() {
|
178 |
+
global $wp_version;
|
179 |
|
180 |
$current = get_transient( 'update_wpcf7r_extensions' );
|
181 |
|
213 |
|
214 |
if ( $has_update ) {
|
215 |
|
216 |
+
$extension->set_needs_update( $has_update );
|
217 |
|
218 |
} else {
|
219 |
|
222 |
}
|
223 |
}
|
224 |
}
|
|
|
225 |
}
|
226 |
|
227 |
/**
|
classes/class-wpcf7r-form.php
CHANGED
@@ -1,651 +1,651 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7R_Form - Container class that wraps the CF7 form object and adds functionality
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
class WPCF7R_Form {
|
9 |
-
// Refrence to the mail tags
|
10 |
-
public static $mail_tags;
|
11 |
-
|
12 |
-
// Refrence to the current contact form 7 form
|
13 |
-
public static $cf7_form;
|
14 |
-
|
15 |
-
// Save refrence to the current instance
|
16 |
-
public static $instance;
|
17 |
-
public static $action_to_submit;
|
18 |
-
|
19 |
-
// holds an array of items remove from $_POST for security reasons
|
20 |
-
public static $removed_data;
|
21 |
-
|
22 |
-
// Save proceesed actions from validation stage
|
23 |
-
public static $processed_actions;
|
24 |
-
|
25 |
-
// Refrence to the current submitted torm validation obj
|
26 |
-
public static $wpcf_validation_obj;
|
27 |
-
|
28 |
-
// Reference to the current submitted form
|
29 |
-
public static $submission;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Main class Constructor
|
33 |
-
*
|
34 |
-
* @param $cf7
|
35 |
-
* @param $submission
|
36 |
-
* @param $validation_obj
|
37 |
-
*/
|
38 |
-
public function __construct( $cf7, $submission = '', $validation_obj = '' ) {
|
39 |
-
if ( is_int( $cf7 ) ) {
|
40 |
-
$this->post_id = $cf7;
|
41 |
-
$cf7 = WPCF7_ContactForm::get_instance( $this->post_id );
|
42 |
-
} elseif ( $cf7 ) {
|
43 |
-
$this->post_id = $cf7->id();
|
44 |
-
} else {
|
45 |
-
return;
|
46 |
-
}
|
47 |
-
|
48 |
-
// Keep refrences.
|
49 |
-
if ( $cf7 ) {
|
50 |
-
self::$cf7_form = $cf7;
|
51 |
-
}
|
52 |
-
if ( $validation_obj ) {
|
53 |
-
self::$wpcf_validation_obj = $validation_obj;
|
54 |
-
}
|
55 |
-
if ( $submission ) {
|
56 |
-
self::$submission = $submission;
|
57 |
-
}
|
58 |
-
|
59 |
-
$this->redirect_actions = new WPCF7R_Actions( $this->post_id, $this );
|
60 |
-
$this->cf7_post = $cf7;
|
61 |
-
|
62 |
-
// Avoid creating 2 instances of the same form.
|
63 |
-
if ( self::$instance && self::$instance->post_id === $this->post_id ) {
|
64 |
-
return self::$instance;
|
65 |
-
}
|
66 |
-
|
67 |
-
add_action( 'admin_footer', array( $this->redirect_actions, 'html_fregments' ) );
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Get submission refrerence
|
72 |
-
*/
|
73 |
-
public function get_submission() {
|
74 |
-
return self::$submission;
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Get the form submission status
|
79 |
-
*/
|
80 |
-
public function get_submission_status() {
|
81 |
-
return self::get_submission()->get_status();
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Disable all form actions except the requested one
|
86 |
-
*
|
87 |
-
* @param $action_id
|
88 |
-
*/
|
89 |
-
public function enable_action( $action_id ) {
|
90 |
-
self::$action_to_submit = $action_id;
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* In case a specific action was required (used for testing)
|
95 |
-
*/
|
96 |
-
public function get_action_to_submit() {
|
97 |
-
return self::$action_to_submit;
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Get an instance of wpcf7 object
|
102 |
-
*/
|
103 |
-
public function get_cf7_form_instance() {
|
104 |
-
return $this->cf7_post;
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Get old redirection plugin rules
|
109 |
-
*/
|
110 |
-
public function get_cf7_redirection_settings() {
|
111 |
-
$custom_data = get_post_custom( $this->post_id );
|
112 |
-
$old_settings = array();
|
113 |
-
if ( isset( $custom_data['_wpcf7_redirect_redirect_type'] ) ) {
|
114 |
-
$old_settings['_wpcf7_redirect_redirect_type'] = maybe_unserialize( $custom_data['_wpcf7_redirect_redirect_type'][0] );
|
115 |
-
}
|
116 |
-
if ( isset( $custom_data['_wpcf7_redirect_page_id'] ) ) {
|
117 |
-
$old_settings['page_id'] = maybe_unserialize( $custom_data['_wpcf7_redirect_page_id'][0] );
|
118 |
-
}
|
119 |
-
if ( isset( $custom_data['_wpcf7_redirect_external_url'] ) ) {
|
120 |
-
$old_settings['external_url'] = maybe_unserialize( $custom_data['_wpcf7_redirect_external_url'][0] );
|
121 |
-
}
|
122 |
-
if ( isset( $custom_data['_wpcf7_redirect_use_external_url'] ) ) {
|
123 |
-
$old_settings['use_external_url'] = maybe_unserialize( $custom_data['_wpcf7_redirect_use_external_url'][0] );
|
124 |
-
}
|
125 |
-
if ( isset( $custom_data['_wpcf7_redirect_open_in_new_tab'] ) ) {
|
126 |
-
$old_settings['open_in_new_tab'] = maybe_unserialize( $custom_data['_wpcf7_redirect_open_in_new_tab'][0] );
|
127 |
-
}
|
128 |
-
if ( isset( $custom_data['_wpcf7_redirect_http_build_query'] ) ) {
|
129 |
-
$old_settings['http_build_query'] = maybe_unserialize( $custom_data['_wpcf7_redirect_http_build_query'][0] );
|
130 |
-
}
|
131 |
-
if ( isset( $custom_data['_wpcf7_redirect_http_build_query_selectively'] ) ) {
|
132 |
-
$old_settings['http_build_query_selectively'] = maybe_unserialize( $custom_data['_wpcf7_redirect_http_build_query_selectively'][0] );
|
133 |
-
}
|
134 |
-
if ( isset( $custom_data['_wpcf7_redirect_http_build_query_selectively_fields'] ) ) {
|
135 |
-
$old_settings['http_build_query_selectively_fields'] = maybe_unserialize( $custom_data['_wpcf7_redirect_http_build_query_selectively_fields'][0] );
|
136 |
-
}
|
137 |
-
if ( isset( $custom_data['_wpcf7_redirect_after_sent_script'] ) ) {
|
138 |
-
$old_settings['fire_sctipt'] = maybe_unserialize( $custom_data['_wpcf7_redirect_after_sent_script'][0] );
|
139 |
-
}
|
140 |
-
|
141 |
-
if ( isset( $custom_data['_wpcf7_redirect_delay_redirect'] ) && (int) $custom_data['_wpcf7_redirect_delay_redirect'] > 0 ) {
|
142 |
-
$old_settings['delay_redirect_seconds'] = $custom_data['_wpcf7_redirect_delay_redirect'][0] / 1000;
|
143 |
-
}
|
144 |
-
|
145 |
-
return $old_settings;
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Get the old contact form 7 to api settings
|
150 |
-
*/
|
151 |
-
public function get_cf7_api_settings() {
|
152 |
-
$custom_data = get_post_custom( $this->post_id );
|
153 |
-
$old_settings = array();
|
154 |
-
if ( isset( $custom_data['_wpcf7_api_data'] ) ) {
|
155 |
-
$old_settings['_wpcf7_api_data'] = maybe_unserialize( $custom_data['_wpcf7_api_data'][0] );
|
156 |
-
}
|
157 |
-
if ( isset( $custom_data['_wpcf7_api_data_map'] ) ) {
|
158 |
-
$old_settings['_wpcf7_api_data_map'] = maybe_unserialize( $custom_data['_wpcf7_api_data_map'][0] );
|
159 |
-
}
|
160 |
-
if ( isset( $custom_data['_template'] ) ) {
|
161 |
-
$old_settings['_template'] = maybe_unserialize( $custom_data['_template'][0] );
|
162 |
-
}
|
163 |
-
if ( isset( $custom_data['_json_template'] ) ) {
|
164 |
-
$old_settings['_json_template'] = maybe_unserialize( $custom_data['_json_template'][0] );
|
165 |
-
}
|
166 |
-
return $old_settings;
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Check if a form has a specific action type
|
171 |
-
*
|
172 |
-
* @param $type
|
173 |
-
* @return boolean
|
174 |
-
*/
|
175 |
-
public function has_action( $type ) {
|
176 |
-
$args = array();
|
177 |
-
$meta_query = array(
|
178 |
-
array(
|
179 |
-
'key' => 'action_type',
|
180 |
-
'value' => $type,
|
181 |
-
),
|
182 |
-
);
|
183 |
-
|
184 |
-
$args['meta_query'] = $meta_query;
|
185 |
-
$actions = $this->get_actions( 'default', 1, true, $args );
|
186 |
-
|
187 |
-
return $actions ? $actions : false;
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
* Update the plugin has migrated
|
192 |
-
*
|
193 |
-
* @param $migration_type
|
194 |
-
*/
|
195 |
-
public function update_migration( $migration_type ) {
|
196 |
-
update_post_meta( $this->post_id, $migration_type, true );
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Check if a form was migrated from old version
|
201 |
-
*
|
202 |
-
* @param $migration_type
|
203 |
-
* @return boolean
|
204 |
-
*/
|
205 |
-
public function has_migrated( $migration_type ) {
|
206 |
-
return get_post_meta( $this->post_id, $migration_type, true );
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* Check if there is old data on the DB
|
211 |
-
*
|
212 |
-
* @param $type
|
213 |
-
* @return boolean
|
214 |
-
*/
|
215 |
-
public function has_old_data( $type ) {
|
216 |
-
if ( 'migrate_from_cf7_api' === $type ) {
|
217 |
-
return $this->get_cf7_api_settings();
|
218 |
-
} else {
|
219 |
-
return $this->get_cf7_redirection_settings();
|
220 |
-
}
|
221 |
-
}
|
222 |
-
|
223 |
-
/**
|
224 |
-
* Get a singelton
|
225 |
-
*
|
226 |
-
* @param string $post_id
|
227 |
-
*/
|
228 |
-
public static function get_instance( $post_id = '' ) {
|
229 |
-
if ( null === self::$instance || ( self::$cf7_form->id() !== $post_id && $post_id ) ) {
|
230 |
-
self::$instance = new self( $post_id );
|
231 |
-
}
|
232 |
-
return self::$instance;
|
233 |
-
}
|
234 |
-
|
235 |
-
public function is_new_form() {
|
236 |
-
return isset( $this->post_id ) && $this->post_id ? false : true;
|
237 |
-
}
|
238 |
-
|
239 |
-
/**
|
240 |
-
* Initialize form
|
241 |
-
*/
|
242 |
-
public function init() {
|
243 |
-
// Check if this is a new form
|
244 |
-
if ( $this->is_new_form() ) {
|
245 |
-
self::$mail_tags = __( 'You need to save your form', 'wpcf7-redirect' );
|
246 |
-
include WPCF7_PRO_REDIRECT_TEMPLATE_PATH . 'save-form.php';
|
247 |
-
} else {
|
248 |
-
self::$mail_tags = $this->get_cf7_fields();
|
249 |
-
$fields = $this->get_fields_values();
|
250 |
-
$redirect_type = isset( $fields['redirect_type'] ) && $fields['redirect_type'] ? $fields['redirect_type'] : '';
|
251 |
-
$active_tab_title = 'active';
|
252 |
-
$active_tab = 'active';
|
253 |
-
$this->html = new WPCF7R_html( self::$mail_tags );
|
254 |
-
include WPCF7_PRO_REDIRECT_TEMPLATE_PATH . 'settings.php';
|
255 |
-
}
|
256 |
-
}
|
257 |
-
|
258 |
-
/**
|
259 |
-
* Get all posts relevant to this contact form
|
260 |
-
* returns posts object
|
261 |
-
*
|
262 |
-
* @param $rule
|
263 |
-
*/
|
264 |
-
public function get_action_posts( $rule ) {
|
265 |
-
return $this->redirect_actions->get_action_posts( $rule );
|
266 |
-
}
|
267 |
-
|
268 |
-
/**
|
269 |
-
* Get all actions relevant for this contact form
|
270 |
-
* Returns action classes
|
271 |
-
*
|
272 |
-
* @param $rule
|
273 |
-
* @param integer $count
|
274 |
-
* @param boolean $is_active
|
275 |
-
* @param array $args
|
276 |
-
*/
|
277 |
-
public function get_actions( $rule, $count = -1, $is_active = false, $args = array() ) {
|
278 |
-
$action_id = $this->get_action_to_submit();
|
279 |
-
|
280 |
-
if ( $action_id ) {
|
281 |
-
$args['post__in'] = array( $action_id );
|
282 |
-
}
|
283 |
-
|
284 |
-
$actions = isset( $this->redirect_actions ) && $this->redirect_actions ? $this->redirect_actions->get_actions( $rule, -1, $is_active, $args ) : array();
|
285 |
-
|
286 |
-
$this->actions = $actions;
|
287 |
-
|
288 |
-
return $actions;
|
289 |
-
}
|
290 |
-
|
291 |
-
/**
|
292 |
-
* Get all active actions
|
293 |
-
*/
|
294 |
-
public function get_active_actions() {
|
295 |
-
return $this->get_actions( 'default', -1, true );
|
296 |
-
}
|
297 |
-
|
298 |
-
/**
|
299 |
-
* Save reference for the items removed from the $_POST data
|
300 |
-
*
|
301 |
-
* @param $removed_data
|
302 |
-
*/
|
303 |
-
public function set_removed_posted_data( $removed_data ) {
|
304 |
-
if ( isset( self::$removed_data ) ) {
|
305 |
-
self::$removed_data = array_merge( $removed_data, self::$removed_data );
|
306 |
-
} else {
|
307 |
-
self::$removed_data = $removed_data;
|
308 |
-
}
|
309 |
-
}
|
310 |
-
|
311 |
-
/**
|
312 |
-
* Get all params removed from the $_POST
|
313 |
-
*/
|
314 |
-
public function get_removed_form_params() {
|
315 |
-
return isset( self::$removed_data ) ? self::$removed_data : '';
|
316 |
-
}
|
317 |
-
|
318 |
-
/**
|
319 |
-
* Validate and store meta data
|
320 |
-
*/
|
321 |
-
public function store_meta() {
|
322 |
-
if ( ! isset( $_POST ) || empty( $_POST['wpcf7-redirect'] ) ) {
|
323 |
-
return;
|
324 |
-
} else {
|
325 |
-
if ( ! wp_verify_nonce( $_POST['wpcf7_redirect_page_metaboxes_nonce'], 'wpcf7_redirect_page_metaboxes' ) ) {
|
326 |
-
return;
|
327 |
-
}
|
328 |
-
$form_id = $this->post_id;
|
329 |
-
$fields = $this->get_plugin_fields( $form_id );
|
330 |
-
$data = $_POST['wpcf7-redirect'];
|
331 |
-
$this->save_meta_fields( $form_id, $fields, $data );
|
332 |
-
if ( isset( $data['actions'] ) && $data['actions'] ) {
|
333 |
-
$this->save_actions( $data['actions'] );
|
334 |
-
}
|
335 |
-
}
|
336 |
-
}
|
337 |
-
|
338 |
-
/**
|
339 |
-
* Save all actions and actions data
|
340 |
-
*
|
341 |
-
* @param $actions
|
342 |
-
*/
|
343 |
-
public function save_actions( $actions ) {
|
344 |
-
foreach ( $actions as $post_id => $action_fields ) {
|
345 |
-
$action = WPCF7R_Action::get_action( $post_id );
|
346 |
-
if ( $action ) {
|
347 |
-
$action->delete_all_fields();
|
348 |
-
foreach ( $action_fields as $action_field_key => $action_field_value ) {
|
349 |
-
update_post_meta( $post_id, $action_field_key, $action_field_value );
|
350 |
-
}
|
351 |
-
if ( isset( $action_fields['post_title'] ) ) {
|
352 |
-
$update_post = array(
|
353 |
-
'ID' => $post_id,
|
354 |
-
'post_title' => $action_fields['post_title'],
|
355 |
-
);
|
356 |
-
wp_update_post( $update_post );
|
357 |
-
}
|
358 |
-
}
|
359 |
-
}
|
360 |
-
}
|
361 |
-
|
362 |
-
/**
|
363 |
-
* Save meta fields to cf7 post
|
364 |
-
* Save each action to its relevant action post
|
365 |
-
*
|
366 |
-
* @param $post_id
|
367 |
-
* @param $fields
|
368 |
-
* @param $data
|
369 |
-
*/
|
370 |
-
public function save_meta_fields( $post_id, $fields, $data ) {
|
371 |
-
unset( $data['actions'] );
|
372 |
-
if ( $data ) {
|
373 |
-
foreach ( $fields as $field ) {
|
374 |
-
$value = isset( $data[ $field['name'] ] ) ? $data[ $field['name'] ] : '';
|
375 |
-
switch ( $field['type'] ) {
|
376 |
-
case 'password':
|
377 |
-
case 'text':
|
378 |
-
case 'checkbox':
|
379 |
-
$value = sanitize_text_field( $value );
|
380 |
-
break;
|
381 |
-
case 'textarea':
|
382 |
-
$value = htmlspecialchars( $value );
|
383 |
-
break;
|
384 |
-
case 'number':
|
385 |
-
$value = intval( $value );
|
386 |
-
break;
|
387 |
-
case 'url':
|
388 |
-
$value = esc_url_raw( $value );
|
389 |
-
break;
|
390 |
-
}
|
391 |
-
update_post_meta( $post_id, '_wpcf7_redirect_' . $field['name'], $value );
|
392 |
-
}
|
393 |
-
}
|
394 |
-
}
|
395 |
-
|
396 |
-
/**
|
397 |
-
* Check if the form has active actions
|
398 |
-
*/
|
399 |
-
public function has_actions() {
|
400 |
-
$rule = 'default';
|
401 |
-
$count = 1;
|
402 |
-
$is_active = true;
|
403 |
-
$args = array();
|
404 |
-
$actions = $this->get_actions( $rule, $count, $is_active, $args ) ? true : false;
|
405 |
-
|
406 |
-
return $actions;
|
407 |
-
}
|
408 |
-
|
409 |
-
/**
|
410 |
-
* Get specific form fields
|
411 |
-
*
|
412 |
-
* @param $fields
|
413 |
-
*/
|
414 |
-
public function get_form_fields( $fields ) {
|
415 |
-
$forms = array();
|
416 |
-
foreach ( $fields as $field ) {
|
417 |
-
$forms[ $this->post_id ][ $field['name'] ] = get_post_meta( $this->post_id, '_wpcf7_redirect_' . $field['name'], true );
|
418 |
-
if ( 'textarea' === $field['type'] ) {
|
419 |
-
$forms[ $this->post_id ][ $field['name'] ] = $forms[ $this->post_id ][ $field['name'] ];
|
420 |
-
}
|
421 |
-
}
|
422 |
-
|
423 |
-
// Thank you page URL is a little bit different...
|
424 |
-
$forms[ $this->post_id ]['thankyou_page_url'] = $forms[ $this->post_id ]['page_id'] ? get_permalink( $forms[ $this->post_id ]['page_id'] ) : '';
|
425 |
-
return reset( $forms );
|
426 |
-
}
|
427 |
-
|
428 |
-
/**
|
429 |
-
* Get rules for a specific contact form
|
430 |
-
*/
|
431 |
-
public function get_redirect_rules() {
|
432 |
-
return get_post_meta( $this->post_id, '_wpcf7_redirect_' . $field['name'], true );
|
433 |
-
}
|
434 |
-
|
435 |
-
/**
|
436 |
-
* Get all fields values
|
437 |
-
*/
|
438 |
-
public function get_fields_values() {
|
439 |
-
$fields = $this->get_plugin_fields();
|
440 |
-
foreach ( $fields as $field ) {
|
441 |
-
$values[ $field['name'] ] = get_post_meta( $this->post_id, '_wpcf7_redirect_' . $field['name'], true );
|
442 |
-
}
|
443 |
-
return $values;
|
444 |
-
}
|
445 |
-
|
446 |
-
/**
|
447 |
-
* Create plugin fields
|
448 |
-
*/
|
449 |
-
public function get_plugin_fields() {
|
450 |
-
$fields = array_merge(
|
451 |
-
WPCF7r_Form_Helper::get_plugin_default_fields(),
|
452 |
-
array(
|
453 |
-
array(
|
454 |
-
'name' => 'blocks',
|
455 |
-
'type' => 'blocks',
|
456 |
-
),
|
457 |
-
)
|
458 |
-
);
|
459 |
-
return $fields;
|
460 |
-
}
|
461 |
-
|
462 |
-
/**
|
463 |
-
* Get the contact form id
|
464 |
-
*/
|
465 |
-
public function get_id() {
|
466 |
-
return $this->post_id;
|
467 |
-
}
|
468 |
-
|
469 |
-
/**
|
470 |
-
* Get the form fields for usage on the selectors
|
471 |
-
*/
|
472 |
-
public function get_cf7_fields() {
|
473 |
-
$tags = self::get_mail_tags();
|
474 |
-
return $tags;
|
475 |
-
}
|
476 |
-
|
477 |
-
/**
|
478 |
-
* Get special mail tags
|
479 |
-
*/
|
480 |
-
static function get_special_mail_tags() {
|
481 |
-
$mailtags = array();
|
482 |
-
$special_mail_tags = array(
|
483 |
-
'_remote_ip',
|
484 |
-
'_user_agent',
|
485 |
-
'_url',
|
486 |
-
'_date',
|
487 |
-
'_time',
|
488 |
-
'_post_id',
|
489 |
-
'_post_name',
|
490 |
-
'_post_title',
|
491 |
-
'_post_url',
|
492 |
-
'_post_author',
|
493 |
-
'_post_author_email',
|
494 |
-
'_site_title',
|
495 |
-
'_site_description',
|
496 |
-
'_site_url',
|
497 |
-
'_site_admin_email',
|
498 |
-
'user_login',
|
499 |
-
'user_email',
|
500 |
-
'user_url',
|
501 |
-
);
|
502 |
-
|
503 |
-
foreach ( $special_mail_tags as $special_mail_tag ) {
|
504 |
-
$tag = new WPCF7_MailTag( $special_mail_tag, $special_mail_tag, array() );
|
505 |
-
$mailtags[] = $tag;
|
506 |
-
}
|
507 |
-
|
508 |
-
return $mailtags;
|
509 |
-
}
|
510 |
-
|
511 |
-
/**
|
512 |
-
* Collect the mail tags from the form
|
513 |
-
*/
|
514 |
-
static function get_mail_tags() {
|
515 |
-
// If this is a new form there are no tags yet
|
516 |
-
if ( ! isset( self::$cf7_form ) || ! self::$cf7_form ) {
|
517 |
-
return;
|
518 |
-
}
|
519 |
-
|
520 |
-
$tags = apply_filters( 'wpcf7r_collect_mail_tags', self::$cf7_form->scan_form_tags() );
|
521 |
-
|
522 |
-
foreach ( (array) $tags as $tag ) {
|
523 |
-
$type = trim( $tag['type'], ' *' );
|
524 |
-
if ( empty( $type ) || empty( $tag['name'] ) ) {
|
525 |
-
continue;
|
526 |
-
} elseif ( ! empty( $args['include'] ) ) {
|
527 |
-
if ( ! in_array( $type, $args['include'], true ) ) {
|
528 |
-
continue;
|
529 |
-
}
|
530 |
-
} elseif ( ! empty( $args['exclude'] ) ) {
|
531 |
-
if ( in_array( $type, $args['exclude'], true ) ) {
|
532 |
-
continue;
|
533 |
-
}
|
534 |
-
}
|
535 |
-
$mailtags[] = $tag;
|
536 |
-
}
|
537 |
-
|
538 |
-
// create an instance to get the current form instance
|
539 |
-
$instance = self::get_instance( self::$cf7_form );
|
540 |
-
|
541 |
-
// add a save lead tag in case save lead action is on
|
542 |
-
if ( $instance->has_action( 'save_lead' ) ) {
|
543 |
-
$scanned_tag = array(
|
544 |
-
'type' => 'lead_id',
|
545 |
-
'basetype' => trim( '[lead_id]', '*' ),
|
546 |
-
'name' => 'lead_id',
|
547 |
-
'options' => array(),
|
548 |
-
'raw_values' => array(),
|
549 |
-
'values' => array(
|
550 |
-
WPCF7R_Action::get_lead_id(),
|
551 |
-
),
|
552 |
-
'pipes' => null,
|
553 |
-
'labels' => array(),
|
554 |
-
'attr' => '',
|
555 |
-
'content' => '',
|
556 |
-
);
|
557 |
-
$mailtags[] = new WPCF7_FormTag( $scanned_tag );
|
558 |
-
}
|
559 |
-
|
560 |
-
return $mailtags;
|
561 |
-
}
|
562 |
-
|
563 |
-
/**
|
564 |
-
* Process actions that are relevant for validation process
|
565 |
-
*/
|
566 |
-
public function process_validation_actions() {
|
567 |
-
$actions = $this->get_active_actions();
|
568 |
-
$results = array();
|
569 |
-
|
570 |
-
if ( $actions ) {
|
571 |
-
foreach ( $actions as $action ) {
|
572 |
-
$action_result = $action->process_validation( self::get_submission() );
|
573 |
-
if ( $action_result ) {
|
574 |
-
$results[ $action->get_type() ][] = $action_result;
|
575 |
-
}
|
576 |
-
}
|
577 |
-
}
|
578 |
-
return $results;
|
579 |
-
}
|
580 |
-
|
581 |
-
/**
|
582 |
-
* Get validation object
|
583 |
-
*/
|
584 |
-
public static function get_validation_obj() {
|
585 |
-
return self::$wpcf_validation_obj;
|
586 |
-
}
|
587 |
-
|
588 |
-
/**
|
589 |
-
* Get validation object $tags
|
590 |
-
*/
|
591 |
-
public static function get_validation_obj_tags() {
|
592 |
-
$validation_obj = self::get_validation_obj();
|
593 |
-
return isset( $validation_obj->tags ) ? $validation_obj->tags : '';
|
594 |
-
}
|
595 |
-
|
596 |
-
/**
|
597 |
-
* Save a referrence to the validaiont object
|
598 |
-
* This will enable invalidating tags later on
|
599 |
-
*
|
600 |
-
* @param object $wpcf_validation_obj
|
601 |
-
*/
|
602 |
-
public function set_validation_obj( $wpcf_validation_obj ) {
|
603 |
-
self::$wpcf_validation_obj = $wpcf_validation_obj;
|
604 |
-
}
|
605 |
-
|
606 |
-
/**
|
607 |
-
* Handles submission actions
|
608 |
-
*/
|
609 |
-
public function process_actions() {
|
610 |
-
// get all active actions
|
611 |
-
$actions = $this->get_active_actions();
|
612 |
-
// prepeare the results array
|
613 |
-
$results = array();
|
614 |
-
// get removed fom data
|
615 |
-
self::$submission->removed_posted_data = $this->get_removed_form_params();
|
616 |
-
|
617 |
-
if ( $actions ) {// loop through actions and process
|
618 |
-
foreach ( $actions as $action ) {
|
619 |
-
// save the validation object in case this action manipulates validations
|
620 |
-
// do the action
|
621 |
-
$action_result = $action->process_action( $this );
|
622 |
-
// add the action to the results array
|
623 |
-
$results[ $action->get_type() ][] = $action_result;
|
624 |
-
self::$processed_actions[] = $action;
|
625 |
-
}
|
626 |
-
} else {
|
627 |
-
return false;
|
628 |
-
}
|
629 |
-
|
630 |
-
return $results;
|
631 |
-
}
|
632 |
-
|
633 |
-
/**
|
634 |
-
* Get all processed actions
|
635 |
-
*/
|
636 |
-
public function get_processed_actions() {
|
637 |
-
return isset( self::$processed_actions ) && self::$processed_actions ? self::$processed_actions : '';
|
638 |
-
}
|
639 |
-
|
640 |
-
/**
|
641 |
-
* Check if actions hold one last thing to do before returning result to the user
|
642 |
-
*/
|
643 |
-
public function maybe_perform_pre_result_action() {
|
644 |
-
$actions = $this->get_processed_actions();
|
645 |
-
if ( $actions ) {
|
646 |
-
foreach ( $actions as $action ) {
|
647 |
-
$action->maybe_perform_pre_result_action();
|
648 |
-
}
|
649 |
-
}
|
650 |
-
}
|
651 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7R_Form - Container class that wraps the CF7 form object and adds functionality
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
class WPCF7R_Form {
|
9 |
+
// Refrence to the mail tags
|
10 |
+
public static $mail_tags;
|
11 |
+
|
12 |
+
// Refrence to the current contact form 7 form
|
13 |
+
public static $cf7_form;
|
14 |
+
|
15 |
+
// Save refrence to the current instance
|
16 |
+
public static $instance;
|
17 |
+
public static $action_to_submit;
|
18 |
+
|
19 |
+
// holds an array of items remove from $_POST for security reasons
|
20 |
+
public static $removed_data;
|
21 |
+
|
22 |
+
// Save proceesed actions from validation stage
|
23 |
+
public static $processed_actions;
|
24 |
+
|
25 |
+
// Refrence to the current submitted torm validation obj
|
26 |
+
public static $wpcf_validation_obj;
|
27 |
+
|
28 |
+
// Reference to the current submitted form
|
29 |
+
public static $submission;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Main class Constructor
|
33 |
+
*
|
34 |
+
* @param $cf7
|
35 |
+
* @param $submission
|
36 |
+
* @param $validation_obj
|
37 |
+
*/
|
38 |
+
public function __construct( $cf7, $submission = '', $validation_obj = '' ) {
|
39 |
+
if ( is_int( $cf7 ) ) {
|
40 |
+
$this->post_id = $cf7;
|
41 |
+
$cf7 = WPCF7_ContactForm::get_instance( $this->post_id );
|
42 |
+
} elseif ( $cf7 ) {
|
43 |
+
$this->post_id = $cf7->id();
|
44 |
+
} else {
|
45 |
+
return;
|
46 |
+
}
|
47 |
+
|
48 |
+
// Keep refrences.
|
49 |
+
if ( $cf7 ) {
|
50 |
+
self::$cf7_form = $cf7;
|
51 |
+
}
|
52 |
+
if ( $validation_obj ) {
|
53 |
+
self::$wpcf_validation_obj = $validation_obj;
|
54 |
+
}
|
55 |
+
if ( $submission ) {
|
56 |
+
self::$submission = $submission;
|
57 |
+
}
|
58 |
+
|
59 |
+
$this->redirect_actions = new WPCF7R_Actions( $this->post_id, $this );
|
60 |
+
$this->cf7_post = $cf7;
|
61 |
+
|
62 |
+
// Avoid creating 2 instances of the same form.
|
63 |
+
if ( self::$instance && self::$instance->post_id === $this->post_id ) {
|
64 |
+
return self::$instance;
|
65 |
+
}
|
66 |
+
|
67 |
+
add_action( 'admin_footer', array( $this->redirect_actions, 'html_fregments' ) );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Get submission refrerence
|
72 |
+
*/
|
73 |
+
public function get_submission() {
|
74 |
+
return self::$submission;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Get the form submission status
|
79 |
+
*/
|
80 |
+
public function get_submission_status() {
|
81 |
+
return self::get_submission()->get_status();
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Disable all form actions except the requested one
|
86 |
+
*
|
87 |
+
* @param $action_id
|
88 |
+
*/
|
89 |
+
public function enable_action( $action_id ) {
|
90 |
+
self::$action_to_submit = $action_id;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* In case a specific action was required (used for testing)
|
95 |
+
*/
|
96 |
+
public function get_action_to_submit() {
|
97 |
+
return self::$action_to_submit;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Get an instance of wpcf7 object
|
102 |
+
*/
|
103 |
+
public function get_cf7_form_instance() {
|
104 |
+
return $this->cf7_post;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Get old redirection plugin rules
|
109 |
+
*/
|
110 |
+
public function get_cf7_redirection_settings() {
|
111 |
+
$custom_data = get_post_custom( $this->post_id );
|
112 |
+
$old_settings = array();
|
113 |
+
if ( isset( $custom_data['_wpcf7_redirect_redirect_type'] ) ) {
|
114 |
+
$old_settings['_wpcf7_redirect_redirect_type'] = maybe_unserialize( $custom_data['_wpcf7_redirect_redirect_type'][0] );
|
115 |
+
}
|
116 |
+
if ( isset( $custom_data['_wpcf7_redirect_page_id'] ) ) {
|
117 |
+
$old_settings['page_id'] = maybe_unserialize( $custom_data['_wpcf7_redirect_page_id'][0] );
|
118 |
+
}
|
119 |
+
if ( isset( $custom_data['_wpcf7_redirect_external_url'] ) ) {
|
120 |
+
$old_settings['external_url'] = maybe_unserialize( $custom_data['_wpcf7_redirect_external_url'][0] );
|
121 |
+
}
|
122 |
+
if ( isset( $custom_data['_wpcf7_redirect_use_external_url'] ) ) {
|
123 |
+
$old_settings['use_external_url'] = maybe_unserialize( $custom_data['_wpcf7_redirect_use_external_url'][0] );
|
124 |
+
}
|
125 |
+
if ( isset( $custom_data['_wpcf7_redirect_open_in_new_tab'] ) ) {
|
126 |
+
$old_settings['open_in_new_tab'] = maybe_unserialize( $custom_data['_wpcf7_redirect_open_in_new_tab'][0] );
|
127 |
+
}
|
128 |
+
if ( isset( $custom_data['_wpcf7_redirect_http_build_query'] ) ) {
|
129 |
+
$old_settings['http_build_query'] = maybe_unserialize( $custom_data['_wpcf7_redirect_http_build_query'][0] );
|
130 |
+
}
|
131 |
+
if ( isset( $custom_data['_wpcf7_redirect_http_build_query_selectively'] ) ) {
|
132 |
+
$old_settings['http_build_query_selectively'] = maybe_unserialize( $custom_data['_wpcf7_redirect_http_build_query_selectively'][0] );
|
133 |
+
}
|
134 |
+
if ( isset( $custom_data['_wpcf7_redirect_http_build_query_selectively_fields'] ) ) {
|
135 |
+
$old_settings['http_build_query_selectively_fields'] = maybe_unserialize( $custom_data['_wpcf7_redirect_http_build_query_selectively_fields'][0] );
|
136 |
+
}
|
137 |
+
if ( isset( $custom_data['_wpcf7_redirect_after_sent_script'] ) ) {
|
138 |
+
$old_settings['fire_sctipt'] = maybe_unserialize( $custom_data['_wpcf7_redirect_after_sent_script'][0] );
|
139 |
+
}
|
140 |
+
|
141 |
+
if ( isset( $custom_data['_wpcf7_redirect_delay_redirect'] ) && (int) $custom_data['_wpcf7_redirect_delay_redirect'] > 0 ) {
|
142 |
+
$old_settings['delay_redirect_seconds'] = $custom_data['_wpcf7_redirect_delay_redirect'][0] / 1000;
|
143 |
+
}
|
144 |
+
|
145 |
+
return $old_settings;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Get the old contact form 7 to api settings
|
150 |
+
*/
|
151 |
+
public function get_cf7_api_settings() {
|
152 |
+
$custom_data = get_post_custom( $this->post_id );
|
153 |
+
$old_settings = array();
|
154 |
+
if ( isset( $custom_data['_wpcf7_api_data'] ) ) {
|
155 |
+
$old_settings['_wpcf7_api_data'] = maybe_unserialize( $custom_data['_wpcf7_api_data'][0] );
|
156 |
+
}
|
157 |
+
if ( isset( $custom_data['_wpcf7_api_data_map'] ) ) {
|
158 |
+
$old_settings['_wpcf7_api_data_map'] = maybe_unserialize( $custom_data['_wpcf7_api_data_map'][0] );
|
159 |
+
}
|
160 |
+
if ( isset( $custom_data['_template'] ) ) {
|
161 |
+
$old_settings['_template'] = maybe_unserialize( $custom_data['_template'][0] );
|
162 |
+
}
|
163 |
+
if ( isset( $custom_data['_json_template'] ) ) {
|
164 |
+
$old_settings['_json_template'] = maybe_unserialize( $custom_data['_json_template'][0] );
|
165 |
+
}
|
166 |
+
return $old_settings;
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Check if a form has a specific action type
|
171 |
+
*
|
172 |
+
* @param $type
|
173 |
+
* @return boolean
|
174 |
+
*/
|
175 |
+
public function has_action( $type ) {
|
176 |
+
$args = array();
|
177 |
+
$meta_query = array(
|
178 |
+
array(
|
179 |
+
'key' => 'action_type',
|
180 |
+
'value' => $type,
|
181 |
+
),
|
182 |
+
);
|
183 |
+
|
184 |
+
$args['meta_query'] = $meta_query;
|
185 |
+
$actions = $this->get_actions( 'default', 1, true, $args );
|
186 |
+
|
187 |
+
return $actions ? $actions : false;
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Update the plugin has migrated
|
192 |
+
*
|
193 |
+
* @param $migration_type
|
194 |
+
*/
|
195 |
+
public function update_migration( $migration_type ) {
|
196 |
+
update_post_meta( $this->post_id, $migration_type, true );
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Check if a form was migrated from old version
|
201 |
+
*
|
202 |
+
* @param $migration_type
|
203 |
+
* @return boolean
|
204 |
+
*/
|
205 |
+
public function has_migrated( $migration_type ) {
|
206 |
+
return get_post_meta( $this->post_id, $migration_type, true );
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Check if there is old data on the DB
|
211 |
+
*
|
212 |
+
* @param $type
|
213 |
+
* @return boolean
|
214 |
+
*/
|
215 |
+
public function has_old_data( $type ) {
|
216 |
+
if ( 'migrate_from_cf7_api' === $type ) {
|
217 |
+
return $this->get_cf7_api_settings();
|
218 |
+
} else {
|
219 |
+
return $this->get_cf7_redirection_settings();
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Get a singelton
|
225 |
+
*
|
226 |
+
* @param string $post_id
|
227 |
+
*/
|
228 |
+
public static function get_instance( $post_id = '' ) {
|
229 |
+
if ( null === self::$instance || ( self::$cf7_form->id() !== $post_id && $post_id ) ) {
|
230 |
+
self::$instance = new self( $post_id );
|
231 |
+
}
|
232 |
+
return self::$instance;
|
233 |
+
}
|
234 |
+
|
235 |
+
public function is_new_form() {
|
236 |
+
return isset( $this->post_id ) && $this->post_id ? false : true;
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Initialize form
|
241 |
+
*/
|
242 |
+
public function init() {
|
243 |
+
// Check if this is a new form
|
244 |
+
if ( $this->is_new_form() ) {
|
245 |
+
self::$mail_tags = __( 'You need to save your form', 'wpcf7-redirect' );
|
246 |
+
include WPCF7_PRO_REDIRECT_TEMPLATE_PATH . 'save-form.php';
|
247 |
+
} else {
|
248 |
+
self::$mail_tags = $this->get_cf7_fields();
|
249 |
+
$fields = $this->get_fields_values();
|
250 |
+
$redirect_type = isset( $fields['redirect_type'] ) && $fields['redirect_type'] ? $fields['redirect_type'] : '';
|
251 |
+
$active_tab_title = 'active';
|
252 |
+
$active_tab = 'active';
|
253 |
+
$this->html = new WPCF7R_html( self::$mail_tags );
|
254 |
+
include WPCF7_PRO_REDIRECT_TEMPLATE_PATH . 'settings.php';
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Get all posts relevant to this contact form
|
260 |
+
* returns posts object
|
261 |
+
*
|
262 |
+
* @param $rule
|
263 |
+
*/
|
264 |
+
public function get_action_posts( $rule ) {
|
265 |
+
return $this->redirect_actions->get_action_posts( $rule );
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Get all actions relevant for this contact form
|
270 |
+
* Returns action classes
|
271 |
+
*
|
272 |
+
* @param $rule
|
273 |
+
* @param integer $count
|
274 |
+
* @param boolean $is_active
|
275 |
+
* @param array $args
|
276 |
+
*/
|
277 |
+
public function get_actions( $rule, $count = -1, $is_active = false, $args = array() ) {
|
278 |
+
$action_id = $this->get_action_to_submit();
|
279 |
+
|
280 |
+
if ( $action_id ) {
|
281 |
+
$args['post__in'] = array( $action_id );
|
282 |
+
}
|
283 |
+
|
284 |
+
$actions = isset( $this->redirect_actions ) && $this->redirect_actions ? $this->redirect_actions->get_actions( $rule, -1, $is_active, $args ) : array();
|
285 |
+
|
286 |
+
$this->actions = $actions;
|
287 |
+
|
288 |
+
return $actions;
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Get all active actions
|
293 |
+
*/
|
294 |
+
public function get_active_actions() {
|
295 |
+
return $this->get_actions( 'default', -1, true );
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Save reference for the items removed from the $_POST data
|
300 |
+
*
|
301 |
+
* @param $removed_data
|
302 |
+
*/
|
303 |
+
public function set_removed_posted_data( $removed_data ) {
|
304 |
+
if ( isset( self::$removed_data ) ) {
|
305 |
+
self::$removed_data = array_merge( $removed_data, self::$removed_data );
|
306 |
+
} else {
|
307 |
+
self::$removed_data = $removed_data;
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Get all params removed from the $_POST
|
313 |
+
*/
|
314 |
+
public function get_removed_form_params() {
|
315 |
+
return isset( self::$removed_data ) ? self::$removed_data : '';
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Validate and store meta data
|
320 |
+
*/
|
321 |
+
public function store_meta() {
|
322 |
+
if ( ! isset( $_POST ) || empty( $_POST['wpcf7-redirect'] ) ) {
|
323 |
+
return;
|
324 |
+
} else {
|
325 |
+
if ( ! wp_verify_nonce( $_POST['wpcf7_redirect_page_metaboxes_nonce'], 'wpcf7_redirect_page_metaboxes' ) ) {
|
326 |
+
return;
|
327 |
+
}
|
328 |
+
$form_id = $this->post_id;
|
329 |
+
$fields = $this->get_plugin_fields( $form_id );
|
330 |
+
$data = $_POST['wpcf7-redirect'];
|
331 |
+
$this->save_meta_fields( $form_id, $fields, $data );
|
332 |
+
if ( isset( $data['actions'] ) && $data['actions'] ) {
|
333 |
+
$this->save_actions( $data['actions'] );
|
334 |
+
}
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Save all actions and actions data
|
340 |
+
*
|
341 |
+
* @param $actions
|
342 |
+
*/
|
343 |
+
public function save_actions( $actions ) {
|
344 |
+
foreach ( $actions as $post_id => $action_fields ) {
|
345 |
+
$action = WPCF7R_Action::get_action( $post_id );
|
346 |
+
if ( $action ) {
|
347 |
+
$action->delete_all_fields();
|
348 |
+
foreach ( $action_fields as $action_field_key => $action_field_value ) {
|
349 |
+
update_post_meta( $post_id, $action_field_key, $action_field_value );
|
350 |
+
}
|
351 |
+
if ( isset( $action_fields['post_title'] ) ) {
|
352 |
+
$update_post = array(
|
353 |
+
'ID' => $post_id,
|
354 |
+
'post_title' => $action_fields['post_title'],
|
355 |
+
);
|
356 |
+
wp_update_post( $update_post );
|
357 |
+
}
|
358 |
+
}
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Save meta fields to cf7 post
|
364 |
+
* Save each action to its relevant action post
|
365 |
+
*
|
366 |
+
* @param $post_id
|
367 |
+
* @param $fields
|
368 |
+
* @param $data
|
369 |
+
*/
|
370 |
+
public function save_meta_fields( $post_id, $fields, $data ) {
|
371 |
+
unset( $data['actions'] );
|
372 |
+
if ( $data ) {
|
373 |
+
foreach ( $fields as $field ) {
|
374 |
+
$value = isset( $data[ $field['name'] ] ) ? $data[ $field['name'] ] : '';
|
375 |
+
switch ( $field['type'] ) {
|
376 |
+
case 'password':
|
377 |
+
case 'text':
|
378 |
+
case 'checkbox':
|
379 |
+
$value = sanitize_text_field( $value );
|
380 |
+
break;
|
381 |
+
case 'textarea':
|
382 |
+
$value = htmlspecialchars( $value );
|
383 |
+
break;
|
384 |
+
case 'number':
|
385 |
+
$value = intval( $value );
|
386 |
+
break;
|
387 |
+
case 'url':
|
388 |
+
$value = esc_url_raw( $value );
|
389 |
+
break;
|
390 |
+
}
|
391 |
+
update_post_meta( $post_id, '_wpcf7_redirect_' . $field['name'], $value );
|
392 |
+
}
|
393 |
+
}
|
394 |
+
}
|
395 |
+
|
396 |
+
/**
|
397 |
+
* Check if the form has active actions
|
398 |
+
*/
|
399 |
+
public function has_actions() {
|
400 |
+
$rule = 'default';
|
401 |
+
$count = 1;
|
402 |
+
$is_active = true;
|
403 |
+
$args = array();
|
404 |
+
$actions = $this->get_actions( $rule, $count, $is_active, $args ) ? true : false;
|
405 |
+
|
406 |
+
return $actions;
|
407 |
+
}
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Get specific form fields
|
411 |
+
*
|
412 |
+
* @param $fields
|
413 |
+
*/
|
414 |
+
public function get_form_fields( $fields ) {
|
415 |
+
$forms = array();
|
416 |
+
foreach ( $fields as $field ) {
|
417 |
+
$forms[ $this->post_id ][ $field['name'] ] = get_post_meta( $this->post_id, '_wpcf7_redirect_' . $field['name'], true );
|
418 |
+
if ( 'textarea' === $field['type'] ) {
|
419 |
+
$forms[ $this->post_id ][ $field['name'] ] = $forms[ $this->post_id ][ $field['name'] ];
|
420 |
+
}
|
421 |
+
}
|
422 |
+
|
423 |
+
// Thank you page URL is a little bit different...
|
424 |
+
$forms[ $this->post_id ]['thankyou_page_url'] = $forms[ $this->post_id ]['page_id'] ? get_permalink( $forms[ $this->post_id ]['page_id'] ) : '';
|
425 |
+
return reset( $forms );
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
* Get rules for a specific contact form
|
430 |
+
*/
|
431 |
+
public function get_redirect_rules() {
|
432 |
+
return get_post_meta( $this->post_id, '_wpcf7_redirect_' . $field['name'], true );
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Get all fields values
|
437 |
+
*/
|
438 |
+
public function get_fields_values() {
|
439 |
+
$fields = $this->get_plugin_fields();
|
440 |
+
foreach ( $fields as $field ) {
|
441 |
+
$values[ $field['name'] ] = get_post_meta( $this->post_id, '_wpcf7_redirect_' . $field['name'], true );
|
442 |
+
}
|
443 |
+
return $values;
|
444 |
+
}
|
445 |
+
|
446 |
+
/**
|
447 |
+
* Create plugin fields
|
448 |
+
*/
|
449 |
+
public function get_plugin_fields() {
|
450 |
+
$fields = array_merge(
|
451 |
+
WPCF7r_Form_Helper::get_plugin_default_fields(),
|
452 |
+
array(
|
453 |
+
array(
|
454 |
+
'name' => 'blocks',
|
455 |
+
'type' => 'blocks',
|
456 |
+
),
|
457 |
+
)
|
458 |
+
);
|
459 |
+
return $fields;
|
460 |
+
}
|
461 |
+
|
462 |
+
/**
|
463 |
+
* Get the contact form id
|
464 |
+
*/
|
465 |
+
public function get_id() {
|
466 |
+
return $this->post_id;
|
467 |
+
}
|
468 |
+
|
469 |
+
/**
|
470 |
+
* Get the form fields for usage on the selectors
|
471 |
+
*/
|
472 |
+
public function get_cf7_fields() {
|
473 |
+
$tags = self::get_mail_tags();
|
474 |
+
return $tags;
|
475 |
+
}
|
476 |
+
|
477 |
+
/**
|
478 |
+
* Get special mail tags
|
479 |
+
*/
|
480 |
+
static function get_special_mail_tags() {
|
481 |
+
$mailtags = array();
|
482 |
+
$special_mail_tags = array(
|
483 |
+
'_remote_ip',
|
484 |
+
'_user_agent',
|
485 |
+
'_url',
|
486 |
+
'_date',
|
487 |
+
'_time',
|
488 |
+
'_post_id',
|
489 |
+
'_post_name',
|
490 |
+
'_post_title',
|
491 |
+
'_post_url',
|
492 |
+
'_post_author',
|
493 |
+
'_post_author_email',
|
494 |
+
'_site_title',
|
495 |
+
'_site_description',
|
496 |
+
'_site_url',
|
497 |
+
'_site_admin_email',
|
498 |
+
'user_login',
|
499 |
+
'user_email',
|
500 |
+
'user_url',
|
501 |
+
);
|
502 |
+
|
503 |
+
foreach ( $special_mail_tags as $special_mail_tag ) {
|
504 |
+
$tag = new WPCF7_MailTag( $special_mail_tag, $special_mail_tag, array() );
|
505 |
+
$mailtags[] = $tag;
|
506 |
+
}
|
507 |
+
|
508 |
+
return $mailtags;
|
509 |
+
}
|
510 |
+
|
511 |
+
/**
|
512 |
+
* Collect the mail tags from the form
|
513 |
+
*/
|
514 |
+
static function get_mail_tags() {
|
515 |
+
// If this is a new form there are no tags yet
|
516 |
+
if ( ! isset( self::$cf7_form ) || ! self::$cf7_form ) {
|
517 |
+
return;
|
518 |
+
}
|
519 |
+
|
520 |
+
$tags = apply_filters( 'wpcf7r_collect_mail_tags', self::$cf7_form->scan_form_tags() );
|
521 |
+
|
522 |
+
foreach ( (array) $tags as $tag ) {
|
523 |
+
$type = trim( $tag['type'], ' *' );
|
524 |
+
if ( empty( $type ) || empty( $tag['name'] ) ) {
|
525 |
+
continue;
|
526 |
+
} elseif ( ! empty( $args['include'] ) ) {
|
527 |
+
if ( ! in_array( $type, $args['include'], true ) ) {
|
528 |
+
continue;
|
529 |
+
}
|
530 |
+
} elseif ( ! empty( $args['exclude'] ) ) {
|
531 |
+
if ( in_array( $type, $args['exclude'], true ) ) {
|
532 |
+
continue;
|
533 |
+
}
|
534 |
+
}
|
535 |
+
$mailtags[] = $tag;
|
536 |
+
}
|
537 |
+
|
538 |
+
// create an instance to get the current form instance
|
539 |
+
$instance = self::get_instance( self::$cf7_form );
|
540 |
+
|
541 |
+
// add a save lead tag in case save lead action is on
|
542 |
+
if ( $instance->has_action( 'save_lead' ) ) {
|
543 |
+
$scanned_tag = array(
|
544 |
+
'type' => 'lead_id',
|
545 |
+
'basetype' => trim( '[lead_id]', '*' ),
|
546 |
+
'name' => 'lead_id',
|
547 |
+
'options' => array(),
|
548 |
+
'raw_values' => array(),
|
549 |
+
'values' => array(
|
550 |
+
WPCF7R_Action::get_lead_id(),
|
551 |
+
),
|
552 |
+
'pipes' => null,
|
553 |
+
'labels' => array(),
|
554 |
+
'attr' => '',
|
555 |
+
'content' => '',
|
556 |
+
);
|
557 |
+
$mailtags[] = new WPCF7_FormTag( $scanned_tag );
|
558 |
+
}
|
559 |
+
|
560 |
+
return $mailtags;
|
561 |
+
}
|
562 |
+
|
563 |
+
/**
|
564 |
+
* Process actions that are relevant for validation process
|
565 |
+
*/
|
566 |
+
public function process_validation_actions() {
|
567 |
+
$actions = $this->get_active_actions();
|
568 |
+
$results = array();
|
569 |
+
|
570 |
+
if ( $actions ) {
|
571 |
+
foreach ( $actions as $action ) {
|
572 |
+
$action_result = $action->process_validation( self::get_submission() );
|
573 |
+
if ( $action_result ) {
|
574 |
+
$results[ $action->get_type() ][] = $action_result;
|
575 |
+
}
|
576 |
+
}
|
577 |
+
}
|
578 |
+
return $results;
|
579 |
+
}
|
580 |
+
|
581 |
+
/**
|
582 |
+
* Get validation object
|
583 |
+
*/
|
584 |
+
public static function get_validation_obj() {
|
585 |
+
return self::$wpcf_validation_obj;
|
586 |
+
}
|
587 |
+
|
588 |
+
/**
|
589 |
+
* Get validation object $tags
|
590 |
+
*/
|
591 |
+
public static function get_validation_obj_tags() {
|
592 |
+
$validation_obj = self::get_validation_obj();
|
593 |
+
return isset( $validation_obj->tags ) ? $validation_obj->tags : '';
|
594 |
+
}
|
595 |
+
|
596 |
+
/**
|
597 |
+
* Save a referrence to the validaiont object
|
598 |
+
* This will enable invalidating tags later on
|
599 |
+
*
|
600 |
+
* @param object $wpcf_validation_obj
|
601 |
+
*/
|
602 |
+
public function set_validation_obj( $wpcf_validation_obj ) {
|
603 |
+
self::$wpcf_validation_obj = $wpcf_validation_obj;
|
604 |
+
}
|
605 |
+
|
606 |
+
/**
|
607 |
+
* Handles submission actions
|
608 |
+
*/
|
609 |
+
public function process_actions() {
|
610 |
+
// get all active actions
|
611 |
+
$actions = $this->get_active_actions();
|
612 |
+
// prepeare the results array
|
613 |
+
$results = array();
|
614 |
+
// get removed fom data
|
615 |
+
self::$submission->removed_posted_data = $this->get_removed_form_params();
|
616 |
+
|
617 |
+
if ( $actions ) {// loop through actions and process
|
618 |
+
foreach ( $actions as $action ) {
|
619 |
+
// save the validation object in case this action manipulates validations
|
620 |
+
// do the action
|
621 |
+
$action_result = $action->process_action( $this );
|
622 |
+
// add the action to the results array
|
623 |
+
$results[ $action->get_type() ][] = $action_result;
|
624 |
+
self::$processed_actions[] = $action;
|
625 |
+
}
|
626 |
+
} else {
|
627 |
+
return false;
|
628 |
+
}
|
629 |
+
|
630 |
+
return $results;
|
631 |
+
}
|
632 |
+
|
633 |
+
/**
|
634 |
+
* Get all processed actions
|
635 |
+
*/
|
636 |
+
public function get_processed_actions() {
|
637 |
+
return isset( self::$processed_actions ) && self::$processed_actions ? self::$processed_actions : '';
|
638 |
+
}
|
639 |
+
|
640 |
+
/**
|
641 |
+
* Check if actions hold one last thing to do before returning result to the user
|
642 |
+
*/
|
643 |
+
public function maybe_perform_pre_result_action() {
|
644 |
+
$actions = $this->get_processed_actions();
|
645 |
+
if ( $actions ) {
|
646 |
+
foreach ( $actions as $action ) {
|
647 |
+
$action->maybe_perform_pre_result_action();
|
648 |
+
}
|
649 |
+
}
|
650 |
+
}
|
651 |
+
}
|
classes/class-wpcf7r-html.php
CHANGED
@@ -37,7 +37,7 @@ class WPCF7R_Html {
|
|
37 |
echo self::get_conditional_row_group_rows_start( $group_key, $group );
|
38 |
|
39 |
foreach ( $group as $group_row => $row_fields ) {
|
40 |
-
echo self::get_conditional_row_template( $block_key, $group_key, $group_row, $row_fields, $prefix );
|
41 |
}
|
42 |
|
43 |
echo self::get_conditional_row_group_rows_end();
|
@@ -102,14 +102,15 @@ class WPCF7R_Html {
|
|
102 |
/**
|
103 |
* Get an HTML template of a condition row
|
104 |
*/
|
105 |
-
public static function get_conditional_row_template( $block_key = '', $group_key = '', $group_row = '', $row_fields = array(), $prefix ) {
|
106 |
ob_start();
|
107 |
$condition = $row_fields['condition'];
|
108 |
$tags = WPCF7R_Form::get_mail_tags();
|
|
|
109 |
?>
|
110 |
<tr class="row-template">
|
111 |
<td>
|
112 |
-
<select class="wpcf7r-fields" name="wpcf7-redirect<?php echo $prefix; ?>[blocks][<?php echo $block_key; ?>][groups][<?php echo $group_key; ?>][<?php echo $group_row; ?>][if]" required
|
113 |
<option value="" <?php selected( $row_fields['if'], '' ); ?>><?php _e( 'Select' ); ?></option>
|
114 |
<?php
|
115 |
if ( $tags ) :
|
@@ -123,7 +124,7 @@ class WPCF7R_Html {
|
|
123 |
</select>
|
124 |
</td>
|
125 |
<td>
|
126 |
-
<select class="compare-options" name="wpcf7-redirect<?php echo $prefix; ?>[blocks][<?php echo $block_key; ?>][groups][<?php echo $group_key; ?>][<?php echo $group_row; ?>][condition]" required
|
127 |
<option value="" <?php selected( $condition, '' ); ?>><?php _e( 'Select', 'wpcf7-redirect' ); ?></option>
|
128 |
<option value="equal" <?php selected( $condition, 'equal' ); ?> data-comparetype="select"><?php _e( 'Equal', 'wpcf7-redirect' ); ?></option>
|
129 |
<option value="not-equal" <?php selected( $condition, 'not-equal' ); ?> data-comparetype="select"><?php _e( 'Non Equal', 'wpcf7-redirect' ); ?></option>
|
@@ -139,11 +140,14 @@ class WPCF7R_Html {
|
|
139 |
<?php
|
140 |
$select_visible = false;
|
141 |
$select_fields = array(
|
|
|
|
|
|
|
142 |
'select',
|
143 |
'radio',
|
144 |
'checkbox',
|
145 |
);
|
146 |
-
if( $tags ) :
|
147 |
foreach ( $tags as $mail_tag ) :
|
148 |
?>
|
149 |
<?php if ( in_array( $mail_tag->type, $select_fields, true ) ) : ?>
|
@@ -168,7 +172,8 @@ class WPCF7R_Html {
|
|
168 |
<?php endforeach; ?>
|
169 |
</select>
|
170 |
<?php endif; ?>
|
171 |
-
|
|
|
172 |
endif;
|
173 |
?>
|
174 |
<input type="text" class="group_row_value wpcf7-redirect-value" name="wpcf7-redirect<?php echo $prefix; ?>[blocks][<?php echo $block_key; ?>][groups][<?php echo $group_key; ?>][<?php echo $group_row; ?>][value]" value="<?php echo isset( $row_fields['value'] ) ? esc_html( $row_fields['value'] ) : ''; ?>" placeholder="<?php _e( 'Your value here' ); ?>" style="<?php echo $select_visible ? 'display:none;' : ''; ?>">
|
37 |
echo self::get_conditional_row_group_rows_start( $group_key, $group );
|
38 |
|
39 |
foreach ( $group as $group_row => $row_fields ) {
|
40 |
+
echo self::get_conditional_row_template( $block_key, $group_key, $group_row, $row_fields, $prefix, false );
|
41 |
}
|
42 |
|
43 |
echo self::get_conditional_row_group_rows_end();
|
102 |
/**
|
103 |
* Get an HTML template of a condition row
|
104 |
*/
|
105 |
+
public static function get_conditional_row_template( $block_key = '', $group_key = '', $group_row = '', $row_fields = array(), $prefix, $required = true ) {
|
106 |
ob_start();
|
107 |
$condition = $row_fields['condition'];
|
108 |
$tags = WPCF7R_Form::get_mail_tags();
|
109 |
+
$required = $required ? 'required' : '';
|
110 |
?>
|
111 |
<tr class="row-template">
|
112 |
<td>
|
113 |
+
<select class="wpcf7r-fields" name="wpcf7-redirect<?php echo $prefix; ?>[blocks][<?php echo $block_key; ?>][groups][<?php echo $group_key; ?>][<?php echo $group_row; ?>][if]" <?php echo $required; ?>>
|
114 |
<option value="" <?php selected( $row_fields['if'], '' ); ?>><?php _e( 'Select' ); ?></option>
|
115 |
<?php
|
116 |
if ( $tags ) :
|
124 |
</select>
|
125 |
</td>
|
126 |
<td>
|
127 |
+
<select class="compare-options" name="wpcf7-redirect<?php echo $prefix; ?>[blocks][<?php echo $block_key; ?>][groups][<?php echo $group_key; ?>][<?php echo $group_row; ?>][condition]" <?php echo $required; ?>>
|
128 |
<option value="" <?php selected( $condition, '' ); ?>><?php _e( 'Select', 'wpcf7-redirect' ); ?></option>
|
129 |
<option value="equal" <?php selected( $condition, 'equal' ); ?> data-comparetype="select"><?php _e( 'Equal', 'wpcf7-redirect' ); ?></option>
|
130 |
<option value="not-equal" <?php selected( $condition, 'not-equal' ); ?> data-comparetype="select"><?php _e( 'Non Equal', 'wpcf7-redirect' ); ?></option>
|
140 |
<?php
|
141 |
$select_visible = false;
|
142 |
$select_fields = array(
|
143 |
+
'select*',
|
144 |
+
'radio*',
|
145 |
+
'checkbox*',
|
146 |
'select',
|
147 |
'radio',
|
148 |
'checkbox',
|
149 |
);
|
150 |
+
if ( $tags ) :
|
151 |
foreach ( $tags as $mail_tag ) :
|
152 |
?>
|
153 |
<?php if ( in_array( $mail_tag->type, $select_fields, true ) ) : ?>
|
172 |
<?php endforeach; ?>
|
173 |
</select>
|
174 |
<?php endif; ?>
|
175 |
+
<?php
|
176 |
+
endforeach;
|
177 |
endif;
|
178 |
?>
|
179 |
<input type="text" class="group_row_value wpcf7-redirect-value" name="wpcf7-redirect<?php echo $prefix; ?>[blocks][<?php echo $block_key; ?>][groups][<?php echo $group_key; ?>][<?php echo $group_row; ?>][value]" value="<?php echo isset( $row_fields['value'] ) ? esc_html( $row_fields['value'] ) : ''; ?>" placeholder="<?php _e( 'Your value here' ); ?>" style="<?php echo $select_visible ? 'display:none;' : ''; ?>">
|
classes/class-wpcf7r-lead.php
CHANGED
@@ -1,197 +1,197 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7R_Lead - Container class that handles lead
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
class WPCF7R_Lead {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Create an instance
|
12 |
-
* Save the post id and post reference
|
13 |
-
*
|
14 |
-
* @param string $post_id
|
15 |
-
*/
|
16 |
-
public function __construct( $post_id = '' ) {
|
17 |
-
if ( is_object( $post_id ) ) {
|
18 |
-
$this->post_id = $post_id->ID;
|
19 |
-
$this->post = $post_id;
|
20 |
-
} else {
|
21 |
-
$this->post_id = $post_id;
|
22 |
-
$this->post = $post_id;
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Update submitted form data
|
28 |
-
*
|
29 |
-
* @param array $args
|
30 |
-
*/
|
31 |
-
public function update_lead_data( $args = array() ) {
|
32 |
-
if ( $args ) {
|
33 |
-
foreach ( $args as $meta_key => $meta_value ) {
|
34 |
-
update_post_meta( $this->post_id, $meta_key, $meta_value );
|
35 |
-
}
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Return the lead ID
|
41 |
-
*/
|
42 |
-
public function get_id() {
|
43 |
-
return $this->post_id;
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Get the post title
|
48 |
-
*/
|
49 |
-
public function get_title() {
|
50 |
-
return get_the_title( $this->get_id() );
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Update the type of lead
|
55 |
-
*
|
56 |
-
* @param $lead_type
|
57 |
-
*/
|
58 |
-
public function update_lead_type( $lead_type ) {
|
59 |
-
update_post_meta( $this->post_id, 'lead_type', $lead_type );
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Save the action reference and results
|
64 |
-
* @param $action_id
|
65 |
-
* @param $action_type
|
66 |
-
* @param $action_results
|
67 |
-
*/
|
68 |
-
public function add_action_debug( $action_id, $action_type, $action_results ) {
|
69 |
-
$action_details = array(
|
70 |
-
'action_id' => $action_id,
|
71 |
-
'results' => $action_results,
|
72 |
-
);
|
73 |
-
add_post_meta( $this->post_id, $action_type, $action_details );
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Get the creation post of the lead
|
78 |
-
*/
|
79 |
-
public function get_date() {
|
80 |
-
return get_the_date( get_option( 'date_format' ), $this->post_id );
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Get the creation post of the lead
|
85 |
-
*/
|
86 |
-
public function get_time() {
|
87 |
-
return get_the_date( get_option( 'time_format' ), $this->post_id );
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Get the lead type
|
92 |
-
*/
|
93 |
-
public function get_lead_type() {
|
94 |
-
return get_post_meta( $this->post_id, 'lead_type', true );
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Save the user submitted files
|
99 |
-
*
|
100 |
-
* @return void
|
101 |
-
*/
|
102 |
-
public function update_lead_files( $files ) {
|
103 |
-
update_post_meta( $this->post_id, 'files', $files );
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Get lead fields
|
108 |
-
*/
|
109 |
-
public function get_lead_fields() {
|
110 |
-
$action_id = get_post_meta( $this->post_id, 'cf7_action_id', true );
|
111 |
-
|
112 |
-
$custom_meta_fields = get_post_custom( $this->post_id );
|
113 |
-
$lead_fields = array();
|
114 |
-
|
115 |
-
$action = WPCF7R_Action::get_action( (int) $action_id );
|
116 |
-
|
117 |
-
if ( $action_id && $action ) {
|
118 |
-
|
119 |
-
$fields = maybe_unserialize( $action->get( 'leads_map' ) );
|
120 |
-
|
121 |
-
foreach ( $fields as $field_key => $field_value ) {
|
122 |
-
if ( 'lead_id' === $field_key ) {
|
123 |
-
continue;
|
124 |
-
} else {
|
125 |
-
if ( isset( $custom_meta_fields[ $field_key ] ) ) {
|
126 |
-
$value = maybe_unserialize( $custom_meta_fields[ $field_key ][0] );
|
127 |
-
} elseif ( isset( $custom_meta_fields['files'] ) && $custom_meta_fields['files'] ) {
|
128 |
-
$value = maybe_unserialize( $custom_meta_fields['files'][0] );
|
129 |
-
$value = isset( $value[ $field_key ] ) && $value[ $field_key ] ? $value[ $field_key ] : '';
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
if ( is_array( $value ) ) {
|
134 |
-
if ( isset( $value['path'] ) ) {
|
135 |
-
$lead_fields[ $field_key ] = array(
|
136 |
-
'type' => 'download',
|
137 |
-
'placeholder' => '',
|
138 |
-
'value' => $value['base64_file'],
|
139 |
-
'filetype' => $value['type'],
|
140 |
-
'filename' => $value['name'],
|
141 |
-
'label' => isset( $field_value['tag'] ) && $field_value['tag'] ? $field_value['tag'] : __( 'File', 'wpcf7-redirect' ),
|
142 |
-
'name' => $field_key,
|
143 |
-
'prefix' => '',
|
144 |
-
);
|
145 |
-
} else {
|
146 |
-
foreach ( $value as $value_field_key => $value_field_value ) {
|
147 |
-
$lead_fields[ $field_key . '-' . $value_field_key ] = array(
|
148 |
-
'type' => 'text',
|
149 |
-
'placeholder' => '',
|
150 |
-
'label' => isset( $field_value['tag'] ) && $field_value['tag'] ? $field_value['tag'] : $field_key,
|
151 |
-
'name' => $field_key,
|
152 |
-
'value' => maybe_unserialize( $value_field_value ),
|
153 |
-
'prefix' => '',
|
154 |
-
);
|
155 |
-
}
|
156 |
-
}
|
157 |
-
} else {
|
158 |
-
$lead_fields[ $field_key ] = array(
|
159 |
-
'type' => 'text',
|
160 |
-
'placeholder' => '',
|
161 |
-
'value' => $value,
|
162 |
-
'label' => isset( $field_value['tag'] ) && $field_value['tag'] ? $field_value['tag'] : $field_key,
|
163 |
-
'name' => $field_key,
|
164 |
-
'prefix' => '',
|
165 |
-
);
|
166 |
-
}
|
167 |
-
}
|
168 |
-
} else {
|
169 |
-
foreach ( $custom_meta_fields as $field_key => $field_value ) {
|
170 |
-
$value = maybe_unserialize( $field_value[0] );
|
171 |
-
if ( is_array( $value ) ) {
|
172 |
-
foreach ( $value as $value_field_key => $value_field_value ) {
|
173 |
-
$lead_fields[ $field_key . '-' . $value_field_key ] = array(
|
174 |
-
'type' => 'text',
|
175 |
-
'placeholder' => '',
|
176 |
-
'label' => $field_key,
|
177 |
-
'name' => $field_key,
|
178 |
-
'value' => maybe_unserialize( $value_field_value ),
|
179 |
-
'prefix' => '',
|
180 |
-
);
|
181 |
-
}
|
182 |
-
} else {
|
183 |
-
$lead_fields[ $field_key ] = array(
|
184 |
-
'type' => 'text',
|
185 |
-
'placeholder' => '',
|
186 |
-
'value' => $value,
|
187 |
-
'label' => $field_key,
|
188 |
-
'name' => $field_key,
|
189 |
-
'prefix' => '',
|
190 |
-
);
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
|
195 |
-
return apply_filters( 'wpcf7r_fields' , $lead_fields );
|
196 |
-
}
|
197 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7R_Lead - Container class that handles lead
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
class WPCF7R_Lead {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Create an instance
|
12 |
+
* Save the post id and post reference
|
13 |
+
*
|
14 |
+
* @param string $post_id
|
15 |
+
*/
|
16 |
+
public function __construct( $post_id = '' ) {
|
17 |
+
if ( is_object( $post_id ) ) {
|
18 |
+
$this->post_id = $post_id->ID;
|
19 |
+
$this->post = $post_id;
|
20 |
+
} else {
|
21 |
+
$this->post_id = $post_id;
|
22 |
+
$this->post = $post_id;
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Update submitted form data
|
28 |
+
*
|
29 |
+
* @param array $args
|
30 |
+
*/
|
31 |
+
public function update_lead_data( $args = array() ) {
|
32 |
+
if ( $args ) {
|
33 |
+
foreach ( $args as $meta_key => $meta_value ) {
|
34 |
+
update_post_meta( $this->post_id, $meta_key, $meta_value );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Return the lead ID
|
41 |
+
*/
|
42 |
+
public function get_id() {
|
43 |
+
return $this->post_id;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Get the post title
|
48 |
+
*/
|
49 |
+
public function get_title() {
|
50 |
+
return get_the_title( $this->get_id() );
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Update the type of lead
|
55 |
+
*
|
56 |
+
* @param $lead_type
|
57 |
+
*/
|
58 |
+
public function update_lead_type( $lead_type ) {
|
59 |
+
update_post_meta( $this->post_id, 'lead_type', $lead_type );
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Save the action reference and results
|
64 |
+
* @param $action_id
|
65 |
+
* @param $action_type
|
66 |
+
* @param $action_results
|
67 |
+
*/
|
68 |
+
public function add_action_debug( $action_id, $action_type, $action_results ) {
|
69 |
+
$action_details = array(
|
70 |
+
'action_id' => $action_id,
|
71 |
+
'results' => $action_results,
|
72 |
+
);
|
73 |
+
add_post_meta( $this->post_id, $action_type, $action_details );
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Get the creation post of the lead
|
78 |
+
*/
|
79 |
+
public function get_date() {
|
80 |
+
return get_the_date( get_option( 'date_format' ), $this->post_id );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Get the creation post of the lead
|
85 |
+
*/
|
86 |
+
public function get_time() {
|
87 |
+
return get_the_date( get_option( 'time_format' ), $this->post_id );
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Get the lead type
|
92 |
+
*/
|
93 |
+
public function get_lead_type() {
|
94 |
+
return get_post_meta( $this->post_id, 'lead_type', true );
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Save the user submitted files
|
99 |
+
*
|
100 |
+
* @return void
|
101 |
+
*/
|
102 |
+
public function update_lead_files( $files ) {
|
103 |
+
update_post_meta( $this->post_id, 'files', $files );
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Get lead fields
|
108 |
+
*/
|
109 |
+
public function get_lead_fields() {
|
110 |
+
$action_id = get_post_meta( $this->post_id, 'cf7_action_id', true );
|
111 |
+
|
112 |
+
$custom_meta_fields = get_post_custom( $this->post_id );
|
113 |
+
$lead_fields = array();
|
114 |
+
|
115 |
+
$action = WPCF7R_Action::get_action( (int) $action_id );
|
116 |
+
|
117 |
+
if ( $action_id && $action ) {
|
118 |
+
|
119 |
+
$fields = maybe_unserialize( $action->get( 'leads_map' ) );
|
120 |
+
|
121 |
+
foreach ( $fields as $field_key => $field_value ) {
|
122 |
+
if ( 'lead_id' === $field_key ) {
|
123 |
+
continue;
|
124 |
+
} else {
|
125 |
+
if ( isset( $custom_meta_fields[ $field_key ] ) ) {
|
126 |
+
$value = maybe_unserialize( $custom_meta_fields[ $field_key ][0] );
|
127 |
+
} elseif ( isset( $custom_meta_fields['files'] ) && $custom_meta_fields['files'] ) {
|
128 |
+
$value = maybe_unserialize( $custom_meta_fields['files'][0] );
|
129 |
+
$value = isset( $value[ $field_key ] ) && $value[ $field_key ] ? $value[ $field_key ] : '';
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
if ( is_array( $value ) ) {
|
134 |
+
if ( isset( $value['path'] ) ) {
|
135 |
+
$lead_fields[ $field_key ] = array(
|
136 |
+
'type' => 'download',
|
137 |
+
'placeholder' => '',
|
138 |
+
'value' => $value['base64_file'],
|
139 |
+
'filetype' => $value['type'],
|
140 |
+
'filename' => $value['name'],
|
141 |
+
'label' => isset( $field_value['tag'] ) && $field_value['tag'] ? $field_value['tag'] : __( 'File', 'wpcf7-redirect' ),
|
142 |
+
'name' => $field_key,
|
143 |
+
'prefix' => '',
|
144 |
+
);
|
145 |
+
} else {
|
146 |
+
foreach ( $value as $value_field_key => $value_field_value ) {
|
147 |
+
$lead_fields[ $field_key . '-' . $value_field_key ] = array(
|
148 |
+
'type' => 'text',
|
149 |
+
'placeholder' => '',
|
150 |
+
'label' => isset( $field_value['tag'] ) && $field_value['tag'] ? $field_value['tag'] : $field_key,
|
151 |
+
'name' => $field_key,
|
152 |
+
'value' => maybe_unserialize( $value_field_value ),
|
153 |
+
'prefix' => '',
|
154 |
+
);
|
155 |
+
}
|
156 |
+
}
|
157 |
+
} else {
|
158 |
+
$lead_fields[ $field_key ] = array(
|
159 |
+
'type' => 'text',
|
160 |
+
'placeholder' => '',
|
161 |
+
'value' => $value,
|
162 |
+
'label' => isset( $field_value['tag'] ) && $field_value['tag'] ? $field_value['tag'] : $field_key,
|
163 |
+
'name' => $field_key,
|
164 |
+
'prefix' => '',
|
165 |
+
);
|
166 |
+
}
|
167 |
+
}
|
168 |
+
} else {
|
169 |
+
foreach ( $custom_meta_fields as $field_key => $field_value ) {
|
170 |
+
$value = maybe_unserialize( $field_value[0] );
|
171 |
+
if ( is_array( $value ) ) {
|
172 |
+
foreach ( $value as $value_field_key => $value_field_value ) {
|
173 |
+
$lead_fields[ $field_key . '-' . $value_field_key ] = array(
|
174 |
+
'type' => 'text',
|
175 |
+
'placeholder' => '',
|
176 |
+
'label' => $field_key,
|
177 |
+
'name' => $field_key,
|
178 |
+
'value' => maybe_unserialize( $value_field_value ),
|
179 |
+
'prefix' => '',
|
180 |
+
);
|
181 |
+
}
|
182 |
+
} else {
|
183 |
+
$lead_fields[ $field_key ] = array(
|
184 |
+
'type' => 'text',
|
185 |
+
'placeholder' => '',
|
186 |
+
'value' => $value,
|
187 |
+
'label' => $field_key,
|
188 |
+
'name' => $field_key,
|
189 |
+
'prefix' => '',
|
190 |
+
);
|
191 |
+
}
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
return apply_filters( 'wpcf7r_fields' , $lead_fields );
|
196 |
+
}
|
197 |
+
}
|
classes/class-wpcf7r-leads-manager.php
CHANGED
@@ -1,422 +1,422 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7R_Leads_Manager - Container class that handles leads management
|
4 |
-
*/
|
5 |
-
defined( 'ABSPATH' ) || exit;
|
6 |
-
|
7 |
-
class WPCF7R_Leads_Manager {
|
8 |
-
/**
|
9 |
-
* Save a reference to the last lead inserted to the DB
|
10 |
-
*/
|
11 |
-
public static $new_lead_id;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Define the leads post type
|
15 |
-
*
|
16 |
-
* @var string $cf7_id - contact form id.
|
17 |
-
*/
|
18 |
-
public static $post_type = 'wpcf7r_leads';
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Main leads manager initializaition.
|
22 |
-
*
|
23 |
-
* @param [string] $cf7_id - contact form id.
|
24 |
-
*/
|
25 |
-
public function __construct( $cf7_id ) {
|
26 |
-
$this->cf7_id = $cf7_id;
|
27 |
-
|
28 |
-
$this->leads = array();
|
29 |
-
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Admin init hook.
|
34 |
-
*
|
35 |
-
* @return void
|
36 |
-
*/
|
37 |
-
public static function admin_init_scripts() {
|
38 |
-
add_filter( 'manage_wpcf7r_leads_posts_columns', array( 'WPCF7R_Leads_Manager', 'set_custom_edit_wpcf7r_leads_columns' ) );
|
39 |
-
add_action( 'manage_wpcf7r_leads_posts_custom_column', array( 'WPCF7R_Leads_Manager', 'custom_wpcf7r_leads_column' ), 10, 2 );
|
40 |
-
add_action( 'manage_posts_extra_tablenav', array( 'WPCF7R_Leads_Manager', 'display_export_button' ), 10, 2 );
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Display custom post type columns on edit list.
|
45 |
-
*
|
46 |
-
* @param [type] $column - the key of the column.
|
47 |
-
* @param [int] $post_id - the lead id.
|
48 |
-
* @return void
|
49 |
-
*/
|
50 |
-
public static function custom_wpcf7r_leads_column( $column, $lead_id ) {
|
51 |
-
$action_id = get_post_meta( $lead_id, 'cf7_action_id', true );
|
52 |
-
|
53 |
-
$action = WPCF7R_Action::get_action( (int) $action_id );
|
54 |
-
|
55 |
-
if ( $action ) {
|
56 |
-
$action->display_action_column_content( $column, $lead_id );
|
57 |
-
} else {
|
58 |
-
switch ( $column ) {
|
59 |
-
case 'data_preview':
|
60 |
-
echo __( 'Preview is not available: action does not exist', 'wpcf7-redirect' );
|
61 |
-
break;
|
62 |
-
case 'form':
|
63 |
-
$form_id = get_post_meta( $lead_id, 'cf7_form', true );
|
64 |
-
echo WPCF7r_Form_Helper::get_cf7_link_html( $form_id );
|
65 |
-
break;
|
66 |
-
}
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Adds an export button on the edit post list.
|
72 |
-
*
|
73 |
-
* @param [type] $which
|
74 |
-
* @return void
|
75 |
-
*/
|
76 |
-
public static function display_export_button( $which ) {
|
77 |
-
global $typenow;
|
78 |
-
|
79 |
-
if ( self::get_post_type() === $typenow && 'top' === $which ) {
|
80 |
-
?>
|
81 |
-
<input type="submit" name="export_leads" class="button button-primary" value="<?php _e( 'Export' ); ?>" />
|
82 |
-
<?php
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Export the current filtered list.
|
88 |
-
*
|
89 |
-
* @return void
|
90 |
-
*/
|
91 |
-
public static function export_current_filtered_view() {
|
92 |
-
|
93 |
-
if ( isset( $_GET['export_leads'] ) ) {
|
94 |
-
$meta_query = array();
|
95 |
-
|
96 |
-
$args = array(
|
97 |
-
'post_type' => self::get_post_type(),
|
98 |
-
'post_status' => 'any',
|
99 |
-
'posts_per_page' => -1,
|
100 |
-
);
|
101 |
-
|
102 |
-
if ( isset( $_GET['cf7_form'] ) && $_GET['cf7_form'] ) {
|
103 |
-
$meta_query[] = array(
|
104 |
-
'key' => 'cf7_form',
|
105 |
-
'value' => (int) $_GET['cf7_form'],
|
106 |
-
);
|
107 |
-
}
|
108 |
-
|
109 |
-
if ( isset( $_GET['m'] ) && $_GET['m'] ) {
|
110 |
-
|
111 |
-
$month = substr( $_GET['m'], 4, 2 );
|
112 |
-
$year = substr( $_GET['m'], 0, 4 );
|
113 |
-
|
114 |
-
$args['date_query'] = array(
|
115 |
-
array(
|
116 |
-
'year' => $year,
|
117 |
-
'month' => $month,
|
118 |
-
),
|
119 |
-
);
|
120 |
-
}
|
121 |
-
|
122 |
-
if ( $meta_query ) {
|
123 |
-
$args['meta_query'] = $meta_query;
|
124 |
-
}
|
125 |
-
|
126 |
-
$arr_post = get_posts( $args );
|
127 |
-
|
128 |
-
$forms = array();
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Order leads by form.
|
132 |
-
* Because the forms are dynamic we create diffrent headers for each form.
|
133 |
-
*/
|
134 |
-
foreach ( $arr_post as $lead ) {
|
135 |
-
$form_id = get_post_meta( $lead->ID, 'cf7_form', true );
|
136 |
-
|
137 |
-
$custom_fields = get_post_custom( $lead->ID );
|
138 |
-
|
139 |
-
foreach ( $custom_fields as $custom_field_key => $custom_field_value ) {
|
140 |
-
$value = maybe_unserialize( reset( $custom_field_value ) );
|
141 |
-
|
142 |
-
if ( ! is_array( $value ) && '_' !== substr( $custom_field_key, 0, 1 ) ) {
|
143 |
-
$forms[ $form_id ]['leads'][ $lead->ID ][ $custom_field_key ] = $value;
|
144 |
-
$forms[ $form_id ]['headers'][ $custom_field_key ] = $custom_field_key;
|
145 |
-
}
|
146 |
-
}
|
147 |
-
|
148 |
-
$forms[ $form_id ]['leads'][ $lead->ID ]['form_name'] = get_the_title( $form_id ) ? get_the_title( $form_id ) : __( 'Form does not exist', 'wpcf7-redirect' );
|
149 |
-
$forms[ $form_id ]['leads'][ $lead->ID ]['form_id'] = $form_id;
|
150 |
-
$forms[ $form_id ]['leads'][ $lead->ID ]['record_date'] = get_the_date( 'Y-m-d H:i', $lead->ID );
|
151 |
-
}
|
152 |
-
|
153 |
-
if ( $forms ) {
|
154 |
-
|
155 |
-
header( 'Content-type: text/csv' );
|
156 |
-
header( 'Content-Disposition: attachment; filename="wp-leads.csv"' );
|
157 |
-
header( 'Pragma: no-cache' );
|
158 |
-
header( 'Expires: 0' );
|
159 |
-
|
160 |
-
$file = fopen( 'php://output', 'w' );
|
161 |
-
|
162 |
-
// Print UTF8 encoding.
|
163 |
-
fprintf( $file, chr( 0xEF ) . chr( 0xBB ) . chr( 0xBF ) );
|
164 |
-
|
165 |
-
foreach ( $forms as $form_id => $form ) {
|
166 |
-
// Add default headers.
|
167 |
-
$form['headers']['form_name'] = 'form_name';
|
168 |
-
$form['headers']['form_id'] = 'form_id';
|
169 |
-
$form['headers']['record_date'] = 'record_date';
|
170 |
-
|
171 |
-
// Print headers.
|
172 |
-
fputcsv( $file, $form['headers'] );
|
173 |
-
|
174 |
-
foreach ( $form['leads'] as $lead ) {
|
175 |
-
$values_to_print = array();
|
176 |
-
|
177 |
-
foreach ( $form['headers'] as $header_key ) {
|
178 |
-
$values_to_print[ $header_key ] = isset( $lead[ $header_key ] ) ? $lead[ $header_key ] : '';
|
179 |
-
}
|
180 |
-
|
181 |
-
fputcsv( $file, $values_to_print );
|
182 |
-
}
|
183 |
-
|
184 |
-
fputcsv( $file, array() );
|
185 |
-
}
|
186 |
-
|
187 |
-
exit();
|
188 |
-
}
|
189 |
-
}
|
190 |
-
}
|
191 |
-
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Undocumented function
|
195 |
-
*
|
196 |
-
* @param [array] $columns - list of columns.
|
197 |
-
* @return [array] - the key of the column.
|
198 |
-
*/
|
199 |
-
public static function set_custom_edit_wpcf7r_leads_columns( $columns ) {
|
200 |
-
|
201 |
-
$columns['form'] = __( 'Form', 'wpcf7-redirect' );
|
202 |
-
$columns['data_preview'] = __( 'Preview', 'wpcf7-redirect' );
|
203 |
-
|
204 |
-
return $columns;
|
205 |
-
}
|
206 |
-
/**
|
207 |
-
* Get the leads post type
|
208 |
-
*/
|
209 |
-
public static function get_post_type() {
|
210 |
-
return self::$post_type;
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Add A select filter on edit.php screen to filter records by form
|
215 |
-
*/
|
216 |
-
public static function add_form_filter() {
|
217 |
-
|
218 |
-
$post_type = isset( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : '';
|
219 |
-
|
220 |
-
if ( $post_type && self::get_post_type() === $post_type ) {
|
221 |
-
$values = array();
|
222 |
-
|
223 |
-
$forms = get_posts(
|
224 |
-
array(
|
225 |
-
'post_status' => 'any',
|
226 |
-
'posts_per_page' => -1,
|
227 |
-
'post_type' => 'wpcf7_contact_form',
|
228 |
-
)
|
229 |
-
);
|
230 |
-
|
231 |
-
foreach ( $forms as $form ) :
|
232 |
-
$values[ $form->post_title ] = $form->ID;
|
233 |
-
endforeach;
|
234 |
-
|
235 |
-
?>
|
236 |
-
|
237 |
-
<select name="cf7_form">
|
238 |
-
<option value=""><?php _e( 'Form', 'wpcf7-redirect' ); ?></option>
|
239 |
-
<?php
|
240 |
-
$current_v = isset( $_GET['cf7_form'] ) ? (int) $_GET['cf7_form'] : '';
|
241 |
-
|
242 |
-
foreach ( $values as $label => $value ) {
|
243 |
-
printf(
|
244 |
-
'<option value="%s"%s>%s</option>',
|
245 |
-
$value,
|
246 |
-
$value === $current_v ? ' selected="selected"' : '',
|
247 |
-
$label
|
248 |
-
);
|
249 |
-
}
|
250 |
-
?>
|
251 |
-
</select>
|
252 |
-
<?php
|
253 |
-
}
|
254 |
-
}
|
255 |
-
|
256 |
-
/**
|
257 |
-
* Search by filters
|
258 |
-
*
|
259 |
-
* @param [object] $query - WP_Query object.
|
260 |
-
* @return [object] - WP_Query.
|
261 |
-
*/
|
262 |
-
public static function filter_request_query( $query ) {
|
263 |
-
// modify the query only if it admin and main query.
|
264 |
-
if ( ! ( is_admin() && $query->is_main_query() ) ) {
|
265 |
-
return $query;
|
266 |
-
}
|
267 |
-
|
268 |
-
// we want to modify the query for the targeted custom post and filter option.
|
269 |
-
if ( ! isset( $query->query['post_type'] ) || ( ! ( self::get_post_type() === $query->query['post_type'] && isset( $_REQUEST['cf7_form'] ) ) ) ) {
|
270 |
-
return $query;
|
271 |
-
}
|
272 |
-
|
273 |
-
// for the default value of our filter no modification is required.
|
274 |
-
if ( 0 === (int) $_REQUEST['cf7_form'] ) {
|
275 |
-
return $query;
|
276 |
-
}
|
277 |
-
|
278 |
-
// modify the query_vars.
|
279 |
-
$posted_value = isset( $_REQUEST['cf7_form'] ) && (int) $_REQUEST['cf7_form'] ? (int) $_REQUEST['cf7_form'] : '';
|
280 |
-
|
281 |
-
$meta_query = $query->get( 'meta_query' );
|
282 |
-
|
283 |
-
if ( ! $meta_query ) {
|
284 |
-
$meta_query = array();
|
285 |
-
}
|
286 |
-
|
287 |
-
$meta_query[] = array(
|
288 |
-
array(
|
289 |
-
'key' => 'cf7_form',
|
290 |
-
'value' => $posted_value,
|
291 |
-
'compare' => '=',
|
292 |
-
),
|
293 |
-
);
|
294 |
-
|
295 |
-
$query->set( 'meta_query', $meta_query );
|
296 |
-
|
297 |
-
return $query;
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Initialize leads table tab
|
302 |
-
*/
|
303 |
-
public function init() {
|
304 |
-
include WPCF7_PRO_REDIRECT_TEMPLATE_PATH . 'leads . php';
|
305 |
-
}
|
306 |
-
|
307 |
-
/**
|
308 |
-
* Get the url to the admin post type list
|
309 |
-
* Auto filter by selected action
|
310 |
-
*
|
311 |
-
* @param [int] $form_id - the contact form id.
|
312 |
-
* @return [string] - the new url.
|
313 |
-
*/
|
314 |
-
public static function get_admin_url( $form_id ) {
|
315 |
-
$url = admin_url( 'edit.php?post_type=' . self::get_post_type() );
|
316 |
-
|
317 |
-
return add_query_arg( 'cf7_form', $form_id, $url );
|
318 |
-
}
|
319 |
-
|
320 |
-
/**
|
321 |
-
* Get leads
|
322 |
-
*/
|
323 |
-
public function get_leads() {
|
324 |
-
$args = array(
|
325 |
-
'post_type' => self::get_post_type(),
|
326 |
-
'post_status' => 'private',
|
327 |
-
'posts_per_page' => 20,
|
328 |
-
'meta_query' => array(
|
329 |
-
array(
|
330 |
-
'key' => 'cf7_form',
|
331 |
-
'value' => $this->cf7_id,
|
332 |
-
),
|
333 |
-
),
|
334 |
-
);
|
335 |
-
|
336 |
-
$leads_posts = get_posts( $args );
|
337 |
-
|
338 |
-
if ( $leads_posts ) {
|
339 |
-
foreach ( $leads_posts as $leads_post ) {
|
340 |
-
$lead = new WPCF7R_Lead( $leads_post );
|
341 |
-
|
342 |
-
$this->leads[] = $lead;
|
343 |
-
}
|
344 |
-
}
|
345 |
-
|
346 |
-
return $this->leads;
|
347 |
-
}
|
348 |
-
|
349 |
-
/**
|
350 |
-
* Insert new lead
|
351 |
-
*/
|
352 |
-
public static function insert_lead( $cf7_form_id, $args, $files = array(), $lead_type, $action_id ) {
|
353 |
-
$args['cf7_form'] = $cf7_form_id;
|
354 |
-
$args['cf7_action_id'] = $action_id;
|
355 |
-
|
356 |
-
$contact_form_title = get_the_title( $cf7_form_id );
|
357 |
-
|
358 |
-
$new_post = array(
|
359 |
-
'post_type' => self::get_post_type(),
|
360 |
-
'post_status' => 'private',
|
361 |
-
'post_title' => __( 'Lead from contact form: ', 'wpcf7-redirect' ) . $contact_form_title,
|
362 |
-
);
|
363 |
-
|
364 |
-
self::$new_lead_id = wp_insert_post( $new_post );
|
365 |
-
|
366 |
-
$lead = new WPCF7R_Lead( self::$new_lead_id );
|
367 |
-
|
368 |
-
$lead->update_lead_data( $args );
|
369 |
-
|
370 |
-
$lead->update_lead_files( $files );
|
371 |
-
|
372 |
-
$lead->update_lead_type( $lead_type );
|
373 |
-
|
374 |
-
return $lead;
|
375 |
-
}
|
376 |
-
|
377 |
-
/**
|
378 |
-
* Save the action to the db lead
|
379 |
-
*
|
380 |
-
* @param $lead_id
|
381 |
-
* @param $action_name
|
382 |
-
* @param $details
|
383 |
-
*/
|
384 |
-
public static function save_action( $lead_id, $action_name, $details ) {
|
385 |
-
add_post_meta( $lead_id, 'action - ' . $action_name, $details );
|
386 |
-
}
|
387 |
-
|
388 |
-
/**
|
389 |
-
* Get a single action row
|
390 |
-
*/
|
391 |
-
public function get_lead_row( $lead ) {
|
392 |
-
ob_start();
|
393 |
-
do_action( 'before_wpcf7r_lead_row', $this );
|
394 |
-
?>
|
395 |
-
|
396 |
-
<tr class="primary" data-postid="<?php echo $lead->get_id(); ?>">
|
397 |
-
<td class="manage-column column-primary sortable desc edit column-id">
|
398 |
-
<?php echo $lead->get_id(); ?>
|
399 |
-
<div class="row-actions">
|
400 |
-
<span class="edit">
|
401 |
-
<a href="<?php echo get_edit_post_link( $lead->get_id() ); ?>" data-id="<?php echo $lead->get_id(); ?>" aria-label="<?php _e( 'View', 'wpcf7-redirect' ); ?>" target="_blank"><?php _e( 'View', 'wpcf7-redirect' ); ?></a> |
|
402 |
-
</span>
|
403 |
-
<span class="trash">
|
404 |
-
<a href="#" class="submitdelete" data-id="<?php echo $lead->get_id(); ?>" aria-label="<?php _e( 'Move to trash', 'wpcf7-redirect' ); ?>"><?php _e( 'Move to trash', 'wpcf7-redirect' ); ?></a> |
|
405 |
-
</span>
|
406 |
-
<?php do_action( 'wpcf7r_after_lead_links', $lead ); ?>
|
407 |
-
</div>
|
408 |
-
</td>
|
409 |
-
<td class="manage-column column-primary sortable desc edit column-date">
|
410 |
-
<?php echo $lead->get_date(); ?>
|
411 |
-
</td>
|
412 |
-
<td class="manage-column column-primary sortable desc edit column-time"><?php echo $lead->get_time(); ?></td>
|
413 |
-
<td class="manage-column column-primary sortable desc edit column-type"><?php echo $lead->get_lead_type(); ?></td>
|
414 |
-
<td></td>
|
415 |
-
</tr>
|
416 |
-
|
417 |
-
<?php
|
418 |
-
do_action( 'after_wpcf7r_lead_row', $this );
|
419 |
-
|
420 |
-
return apply_filters( 'wpcf7r_get_lead_row', ob_get_clean(), $this );
|
421 |
-
}
|
422 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7R_Leads_Manager - Container class that handles leads management
|
4 |
+
*/
|
5 |
+
defined( 'ABSPATH' ) || exit;
|
6 |
+
|
7 |
+
class WPCF7R_Leads_Manager {
|
8 |
+
/**
|
9 |
+
* Save a reference to the last lead inserted to the DB
|
10 |
+
*/
|
11 |
+
public static $new_lead_id;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Define the leads post type
|
15 |
+
*
|
16 |
+
* @var string $cf7_id - contact form id.
|
17 |
+
*/
|
18 |
+
public static $post_type = 'wpcf7r_leads';
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Main leads manager initializaition.
|
22 |
+
*
|
23 |
+
* @param [string] $cf7_id - contact form id.
|
24 |
+
*/
|
25 |
+
public function __construct( $cf7_id ) {
|
26 |
+
$this->cf7_id = $cf7_id;
|
27 |
+
|
28 |
+
$this->leads = array();
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Admin init hook.
|
34 |
+
*
|
35 |
+
* @return void
|
36 |
+
*/
|
37 |
+
public static function admin_init_scripts() {
|
38 |
+
add_filter( 'manage_wpcf7r_leads_posts_columns', array( 'WPCF7R_Leads_Manager', 'set_custom_edit_wpcf7r_leads_columns' ) );
|
39 |
+
add_action( 'manage_wpcf7r_leads_posts_custom_column', array( 'WPCF7R_Leads_Manager', 'custom_wpcf7r_leads_column' ), 10, 2 );
|
40 |
+
add_action( 'manage_posts_extra_tablenav', array( 'WPCF7R_Leads_Manager', 'display_export_button' ), 10, 2 );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Display custom post type columns on edit list.
|
45 |
+
*
|
46 |
+
* @param [type] $column - the key of the column.
|
47 |
+
* @param [int] $post_id - the lead id.
|
48 |
+
* @return void
|
49 |
+
*/
|
50 |
+
public static function custom_wpcf7r_leads_column( $column, $lead_id ) {
|
51 |
+
$action_id = get_post_meta( $lead_id, 'cf7_action_id', true );
|
52 |
+
|
53 |
+
$action = WPCF7R_Action::get_action( (int) $action_id );
|
54 |
+
|
55 |
+
if ( $action ) {
|
56 |
+
$action->display_action_column_content( $column, $lead_id );
|
57 |
+
} else {
|
58 |
+
switch ( $column ) {
|
59 |
+
case 'data_preview':
|
60 |
+
echo __( 'Preview is not available: action does not exist', 'wpcf7-redirect' );
|
61 |
+
break;
|
62 |
+
case 'form':
|
63 |
+
$form_id = get_post_meta( $lead_id, 'cf7_form', true );
|
64 |
+
echo WPCF7r_Form_Helper::get_cf7_link_html( $form_id );
|
65 |
+
break;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Adds an export button on the edit post list.
|
72 |
+
*
|
73 |
+
* @param [type] $which
|
74 |
+
* @return void
|
75 |
+
*/
|
76 |
+
public static function display_export_button( $which ) {
|
77 |
+
global $typenow;
|
78 |
+
|
79 |
+
if ( self::get_post_type() === $typenow && 'top' === $which ) {
|
80 |
+
?>
|
81 |
+
<input type="submit" name="export_leads" class="button button-primary" value="<?php _e( 'Export' ); ?>" />
|
82 |
+
<?php
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Export the current filtered list.
|
88 |
+
*
|
89 |
+
* @return void
|
90 |
+
*/
|
91 |
+
public static function export_current_filtered_view() {
|
92 |
+
|
93 |
+
if ( isset( $_GET['export_leads'] ) ) {
|
94 |
+
$meta_query = array();
|
95 |
+
|
96 |
+
$args = array(
|
97 |
+
'post_type' => self::get_post_type(),
|
98 |
+
'post_status' => 'any',
|
99 |
+
'posts_per_page' => -1,
|
100 |
+
);
|
101 |
+
|
102 |
+
if ( isset( $_GET['cf7_form'] ) && $_GET['cf7_form'] ) {
|
103 |
+
$meta_query[] = array(
|
104 |
+
'key' => 'cf7_form',
|
105 |
+
'value' => (int) $_GET['cf7_form'],
|
106 |
+
);
|
107 |
+
}
|
108 |
+
|
109 |
+
if ( isset( $_GET['m'] ) && $_GET['m'] ) {
|
110 |
+
|
111 |
+
$month = substr( $_GET['m'], 4, 2 );
|
112 |
+
$year = substr( $_GET['m'], 0, 4 );
|
113 |
+
|
114 |
+
$args['date_query'] = array(
|
115 |
+
array(
|
116 |
+
'year' => $year,
|
117 |
+
'month' => $month,
|
118 |
+
),
|
119 |
+
);
|
120 |
+
}
|
121 |
+
|
122 |
+
if ( $meta_query ) {
|
123 |
+
$args['meta_query'] = $meta_query;
|
124 |
+
}
|
125 |
+
|
126 |
+
$arr_post = get_posts( $args );
|
127 |
+
|
128 |
+
$forms = array();
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Order leads by form.
|
132 |
+
* Because the forms are dynamic we create diffrent headers for each form.
|
133 |
+
*/
|
134 |
+
foreach ( $arr_post as $lead ) {
|
135 |
+
$form_id = get_post_meta( $lead->ID, 'cf7_form', true );
|
136 |
+
|
137 |
+
$custom_fields = get_post_custom( $lead->ID );
|
138 |
+
|
139 |
+
foreach ( $custom_fields as $custom_field_key => $custom_field_value ) {
|
140 |
+
$value = maybe_unserialize( reset( $custom_field_value ) );
|
141 |
+
|
142 |
+
if ( ! is_array( $value ) && '_' !== substr( $custom_field_key, 0, 1 ) ) {
|
143 |
+
$forms[ $form_id ]['leads'][ $lead->ID ][ $custom_field_key ] = $value;
|
144 |
+
$forms[ $form_id ]['headers'][ $custom_field_key ] = $custom_field_key;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
$forms[ $form_id ]['leads'][ $lead->ID ]['form_name'] = get_the_title( $form_id ) ? get_the_title( $form_id ) : __( 'Form does not exist', 'wpcf7-redirect' );
|
149 |
+
$forms[ $form_id ]['leads'][ $lead->ID ]['form_id'] = $form_id;
|
150 |
+
$forms[ $form_id ]['leads'][ $lead->ID ]['record_date'] = get_the_date( 'Y-m-d H:i', $lead->ID );
|
151 |
+
}
|
152 |
+
|
153 |
+
if ( $forms ) {
|
154 |
+
|
155 |
+
header( 'Content-type: text/csv' );
|
156 |
+
header( 'Content-Disposition: attachment; filename="wp-leads.csv"' );
|
157 |
+
header( 'Pragma: no-cache' );
|
158 |
+
header( 'Expires: 0' );
|
159 |
+
|
160 |
+
$file = fopen( 'php://output', 'w' );
|
161 |
+
|
162 |
+
// Print UTF8 encoding.
|
163 |
+
fprintf( $file, chr( 0xEF ) . chr( 0xBB ) . chr( 0xBF ) );
|
164 |
+
|
165 |
+
foreach ( $forms as $form_id => $form ) {
|
166 |
+
// Add default headers.
|
167 |
+
$form['headers']['form_name'] = 'form_name';
|
168 |
+
$form['headers']['form_id'] = 'form_id';
|
169 |
+
$form['headers']['record_date'] = 'record_date';
|
170 |
+
|
171 |
+
// Print headers.
|
172 |
+
fputcsv( $file, $form['headers'] );
|
173 |
+
|
174 |
+
foreach ( $form['leads'] as $lead ) {
|
175 |
+
$values_to_print = array();
|
176 |
+
|
177 |
+
foreach ( $form['headers'] as $header_key ) {
|
178 |
+
$values_to_print[ $header_key ] = isset( $lead[ $header_key ] ) ? $lead[ $header_key ] : '';
|
179 |
+
}
|
180 |
+
|
181 |
+
fputcsv( $file, $values_to_print );
|
182 |
+
}
|
183 |
+
|
184 |
+
fputcsv( $file, array() );
|
185 |
+
}
|
186 |
+
|
187 |
+
exit();
|
188 |
+
}
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Undocumented function
|
195 |
+
*
|
196 |
+
* @param [array] $columns - list of columns.
|
197 |
+
* @return [array] - the key of the column.
|
198 |
+
*/
|
199 |
+
public static function set_custom_edit_wpcf7r_leads_columns( $columns ) {
|
200 |
+
|
201 |
+
$columns['form'] = __( 'Form', 'wpcf7-redirect' );
|
202 |
+
$columns['data_preview'] = __( 'Preview', 'wpcf7-redirect' );
|
203 |
+
|
204 |
+
return $columns;
|
205 |
+
}
|
206 |
+
/**
|
207 |
+
* Get the leads post type
|
208 |
+
*/
|
209 |
+
public static function get_post_type() {
|
210 |
+
return self::$post_type;
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Add A select filter on edit.php screen to filter records by form
|
215 |
+
*/
|
216 |
+
public static function add_form_filter() {
|
217 |
+
|
218 |
+
$post_type = isset( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : '';
|
219 |
+
|
220 |
+
if ( $post_type && self::get_post_type() === $post_type ) {
|
221 |
+
$values = array();
|
222 |
+
|
223 |
+
$forms = get_posts(
|
224 |
+
array(
|
225 |
+
'post_status' => 'any',
|
226 |
+
'posts_per_page' => -1,
|
227 |
+
'post_type' => 'wpcf7_contact_form',
|
228 |
+
)
|
229 |
+
);
|
230 |
+
|
231 |
+
foreach ( $forms as $form ) :
|
232 |
+
$values[ $form->post_title ] = $form->ID;
|
233 |
+
endforeach;
|
234 |
+
|
235 |
+
?>
|
236 |
+
|
237 |
+
<select name="cf7_form">
|
238 |
+
<option value=""><?php _e( 'Form', 'wpcf7-redirect' ); ?></option>
|
239 |
+
<?php
|
240 |
+
$current_v = isset( $_GET['cf7_form'] ) ? (int) $_GET['cf7_form'] : '';
|
241 |
+
|
242 |
+
foreach ( $values as $label => $value ) {
|
243 |
+
printf(
|
244 |
+
'<option value="%s"%s>%s</option>',
|
245 |
+
$value,
|
246 |
+
$value === $current_v ? ' selected="selected"' : '',
|
247 |
+
$label
|
248 |
+
);
|
249 |
+
}
|
250 |
+
?>
|
251 |
+
</select>
|
252 |
+
<?php
|
253 |
+
}
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Search by filters
|
258 |
+
*
|
259 |
+
* @param [object] $query - WP_Query object.
|
260 |
+
* @return [object] - WP_Query.
|
261 |
+
*/
|
262 |
+
public static function filter_request_query( $query ) {
|
263 |
+
// modify the query only if it admin and main query.
|
264 |
+
if ( ! ( is_admin() && $query->is_main_query() ) ) {
|
265 |
+
return $query;
|
266 |
+
}
|
267 |
+
|
268 |
+
// we want to modify the query for the targeted custom post and filter option.
|
269 |
+
if ( ! isset( $query->query['post_type'] ) || ( ! ( self::get_post_type() === $query->query['post_type'] && isset( $_REQUEST['cf7_form'] ) ) ) ) {
|
270 |
+
return $query;
|
271 |
+
}
|
272 |
+
|
273 |
+
// for the default value of our filter no modification is required.
|
274 |
+
if ( 0 === (int) $_REQUEST['cf7_form'] ) {
|
275 |
+
return $query;
|
276 |
+
}
|
277 |
+
|
278 |
+
// modify the query_vars.
|
279 |
+
$posted_value = isset( $_REQUEST['cf7_form'] ) && (int) $_REQUEST['cf7_form'] ? (int) $_REQUEST['cf7_form'] : '';
|
280 |
+
|
281 |
+
$meta_query = $query->get( 'meta_query' );
|
282 |
+
|
283 |
+
if ( ! $meta_query ) {
|
284 |
+
$meta_query = array();
|
285 |
+
}
|
286 |
+
|
287 |
+
$meta_query[] = array(
|
288 |
+
array(
|
289 |
+
'key' => 'cf7_form',
|
290 |
+
'value' => $posted_value,
|
291 |
+
'compare' => '=',
|
292 |
+
),
|
293 |
+
);
|
294 |
+
|
295 |
+
$query->set( 'meta_query', $meta_query );
|
296 |
+
|
297 |
+
return $query;
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Initialize leads table tab
|
302 |
+
*/
|
303 |
+
public function init() {
|
304 |
+
include WPCF7_PRO_REDIRECT_TEMPLATE_PATH . 'leads . php';
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Get the url to the admin post type list
|
309 |
+
* Auto filter by selected action
|
310 |
+
*
|
311 |
+
* @param [int] $form_id - the contact form id.
|
312 |
+
* @return [string] - the new url.
|
313 |
+
*/
|
314 |
+
public static function get_admin_url( $form_id ) {
|
315 |
+
$url = admin_url( 'edit.php?post_type=' . self::get_post_type() );
|
316 |
+
|
317 |
+
return add_query_arg( 'cf7_form', $form_id, $url );
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Get leads
|
322 |
+
*/
|
323 |
+
public function get_leads() {
|
324 |
+
$args = array(
|
325 |
+
'post_type' => self::get_post_type(),
|
326 |
+
'post_status' => 'private',
|
327 |
+
'posts_per_page' => 20,
|
328 |
+
'meta_query' => array(
|
329 |
+
array(
|
330 |
+
'key' => 'cf7_form',
|
331 |
+
'value' => $this->cf7_id,
|
332 |
+
),
|
333 |
+
),
|
334 |
+
);
|
335 |
+
|
336 |
+
$leads_posts = get_posts( $args );
|
337 |
+
|
338 |
+
if ( $leads_posts ) {
|
339 |
+
foreach ( $leads_posts as $leads_post ) {
|
340 |
+
$lead = new WPCF7R_Lead( $leads_post );
|
341 |
+
|
342 |
+
$this->leads[] = $lead;
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
+
return $this->leads;
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Insert new lead
|
351 |
+
*/
|
352 |
+
public static function insert_lead( $cf7_form_id, $args, $files = array(), $lead_type, $action_id ) {
|
353 |
+
$args['cf7_form'] = $cf7_form_id;
|
354 |
+
$args['cf7_action_id'] = $action_id;
|
355 |
+
|
356 |
+
$contact_form_title = get_the_title( $cf7_form_id );
|
357 |
+
|
358 |
+
$new_post = array(
|
359 |
+
'post_type' => self::get_post_type(),
|
360 |
+
'post_status' => 'private',
|
361 |
+
'post_title' => __( 'Lead from contact form: ', 'wpcf7-redirect' ) . $contact_form_title,
|
362 |
+
);
|
363 |
+
|
364 |
+
self::$new_lead_id = wp_insert_post( $new_post );
|
365 |
+
|
366 |
+
$lead = new WPCF7R_Lead( self::$new_lead_id );
|
367 |
+
|
368 |
+
$lead->update_lead_data( $args );
|
369 |
+
|
370 |
+
$lead->update_lead_files( $files );
|
371 |
+
|
372 |
+
$lead->update_lead_type( $lead_type );
|
373 |
+
|
374 |
+
return $lead;
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Save the action to the db lead
|
379 |
+
*
|
380 |
+
* @param $lead_id
|
381 |
+
* @param $action_name
|
382 |
+
* @param $details
|
383 |
+
*/
|
384 |
+
public static function save_action( $lead_id, $action_name, $details ) {
|
385 |
+
add_post_meta( $lead_id, 'action - ' . $action_name, $details );
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* Get a single action row
|
390 |
+
*/
|
391 |
+
public function get_lead_row( $lead ) {
|
392 |
+
ob_start();
|
393 |
+
do_action( 'before_wpcf7r_lead_row', $this );
|
394 |
+
?>
|
395 |
+
|
396 |
+
<tr class="primary" data-postid="<?php echo $lead->get_id(); ?>">
|
397 |
+
<td class="manage-column column-primary sortable desc edit column-id">
|
398 |
+
<?php echo $lead->get_id(); ?>
|
399 |
+
<div class="row-actions">
|
400 |
+
<span class="edit">
|
401 |
+
<a href="<?php echo get_edit_post_link( $lead->get_id() ); ?>" data-id="<?php echo $lead->get_id(); ?>" aria-label="<?php _e( 'View', 'wpcf7-redirect' ); ?>" target="_blank"><?php _e( 'View', 'wpcf7-redirect' ); ?></a> |
|
402 |
+
</span>
|
403 |
+
<span class="trash">
|
404 |
+
<a href="#" class="submitdelete" data-id="<?php echo $lead->get_id(); ?>" aria-label="<?php _e( 'Move to trash', 'wpcf7-redirect' ); ?>"><?php _e( 'Move to trash', 'wpcf7-redirect' ); ?></a> |
|
405 |
+
</span>
|
406 |
+
<?php do_action( 'wpcf7r_after_lead_links', $lead ); ?>
|
407 |
+
</div>
|
408 |
+
</td>
|
409 |
+
<td class="manage-column column-primary sortable desc edit column-date">
|
410 |
+
<?php echo $lead->get_date(); ?>
|
411 |
+
</td>
|
412 |
+
<td class="manage-column column-primary sortable desc edit column-time"><?php echo $lead->get_time(); ?></td>
|
413 |
+
<td class="manage-column column-primary sortable desc edit column-type"><?php echo $lead->get_lead_type(); ?></td>
|
414 |
+
<td></td>
|
415 |
+
</tr>
|
416 |
+
|
417 |
+
<?php
|
418 |
+
do_action( 'after_wpcf7r_lead_row', $this );
|
419 |
+
|
420 |
+
return apply_filters( 'wpcf7r_get_lead_row', ob_get_clean(), $this );
|
421 |
+
}
|
422 |
+
}
|
classes/class-wpcf7r-list-table.php
CHANGED
@@ -1,133 +1,133 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit;
|
3 |
-
|
4 |
-
if ( class_exists( 'WP_List_Table' ) ) {
|
5 |
-
class WPCF7R_List_Table extends WP_List_Table {
|
6 |
-
|
7 |
-
public $list_data = array();
|
8 |
-
/**
|
9 |
-
* Constructor will create the menu item
|
10 |
-
*/
|
11 |
-
public function __construct( $columns, $data ) {
|
12 |
-
|
13 |
-
parent::__construct();
|
14 |
-
|
15 |
-
$this->list_data = $data;
|
16 |
-
|
17 |
-
$this->columns = $columns;
|
18 |
-
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Display the list table page
|
23 |
-
*/
|
24 |
-
public function list_table_page() {
|
25 |
-
|
26 |
-
$this->prepare_items();
|
27 |
-
|
28 |
-
$this->display();
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Prepare the items for the table to process
|
33 |
-
*/
|
34 |
-
public function prepare_items() {
|
35 |
-
$columns = $this->get_columns();
|
36 |
-
$hidden = $this->get_hidden_columns();
|
37 |
-
$sortable = $this->get_sortable_columns();
|
38 |
-
$data = $this->list_data;
|
39 |
-
$per_page = 2;
|
40 |
-
$current_page = $this->get_pagenum();
|
41 |
-
|
42 |
-
usort( $data, array( &$this, 'sort_data' ) );
|
43 |
-
$total_items = count( $data );
|
44 |
-
|
45 |
-
$this->set_pagination_args(
|
46 |
-
array(
|
47 |
-
'total_items' => $total_items,
|
48 |
-
'per_page' => $per_page,
|
49 |
-
)
|
50 |
-
);
|
51 |
-
|
52 |
-
$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
|
53 |
-
|
54 |
-
$this->_column_headers = array( $columns, $hidden, $sortable );
|
55 |
-
$this->items = $data;
|
56 |
-
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Override the parent columns method. Defines the columns to use in your listing table
|
61 |
-
*/
|
62 |
-
public function get_columns() {
|
63 |
-
return $this->columns;
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Define which columns are hidden
|
68 |
-
*/
|
69 |
-
public function get_hidden_columns() {
|
70 |
-
return array();
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Define the sortable columns
|
75 |
-
*/
|
76 |
-
public function get_sortable_columns() {
|
77 |
-
return array( 'title' => array( 'title', false ) );
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Define what data to show on each column of the table
|
82 |
-
*
|
83 |
-
* @param $item
|
84 |
-
* @param $column_name
|
85 |
-
*/
|
86 |
-
public function column_default( $item, $column_name ) {
|
87 |
-
|
88 |
-
switch ( $column_name ) {
|
89 |
-
case 'id':
|
90 |
-
case 'title':
|
91 |
-
case 'description':
|
92 |
-
case 'year':
|
93 |
-
case 'director':
|
94 |
-
case 'rating':
|
95 |
-
return $item[ $column_name ];
|
96 |
-
|
97 |
-
default:
|
98 |
-
return print_r( $item, true );
|
99 |
-
}
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Allows you to sort the data by the variables set in the $_GET
|
104 |
-
*
|
105 |
-
* @param $a
|
106 |
-
* @param $b
|
107 |
-
*/
|
108 |
-
private function sort_data( $a, $b ) {
|
109 |
-
// Set defaults
|
110 |
-
$orderby = 'title';
|
111 |
-
$order = 'asc';
|
112 |
-
|
113 |
-
// If orderby is set, use this as the sort column
|
114 |
-
if ( ! empty( $_GET['orderby'] ) ) {
|
115 |
-
$orderby = $_GET['orderby'];
|
116 |
-
}
|
117 |
-
|
118 |
-
// If order is set use this as the order
|
119 |
-
if ( ! empty( $_GET['order'] ) ) {
|
120 |
-
$order = $_GET['order'];
|
121 |
-
}
|
122 |
-
|
123 |
-
$result = strcmp( $a[ $orderby ], $b[ $orderby ] );
|
124 |
-
|
125 |
-
if ( 'asc' === $order ) {
|
126 |
-
return $result;
|
127 |
-
}
|
128 |
-
|
129 |
-
return -$result;
|
130 |
-
}
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit;
|
3 |
+
|
4 |
+
if ( class_exists( 'WP_List_Table' ) ) {
|
5 |
+
class WPCF7R_List_Table extends WP_List_Table {
|
6 |
+
|
7 |
+
public $list_data = array();
|
8 |
+
/**
|
9 |
+
* Constructor will create the menu item
|
10 |
+
*/
|
11 |
+
public function __construct( $columns, $data ) {
|
12 |
+
|
13 |
+
parent::__construct();
|
14 |
+
|
15 |
+
$this->list_data = $data;
|
16 |
+
|
17 |
+
$this->columns = $columns;
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Display the list table page
|
23 |
+
*/
|
24 |
+
public function list_table_page() {
|
25 |
+
|
26 |
+
$this->prepare_items();
|
27 |
+
|
28 |
+
$this->display();
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Prepare the items for the table to process
|
33 |
+
*/
|
34 |
+
public function prepare_items() {
|
35 |
+
$columns = $this->get_columns();
|
36 |
+
$hidden = $this->get_hidden_columns();
|
37 |
+
$sortable = $this->get_sortable_columns();
|
38 |
+
$data = $this->list_data;
|
39 |
+
$per_page = 2;
|
40 |
+
$current_page = $this->get_pagenum();
|
41 |
+
|
42 |
+
usort( $data, array( &$this, 'sort_data' ) );
|
43 |
+
$total_items = count( $data );
|
44 |
+
|
45 |
+
$this->set_pagination_args(
|
46 |
+
array(
|
47 |
+
'total_items' => $total_items,
|
48 |
+
'per_page' => $per_page,
|
49 |
+
)
|
50 |
+
);
|
51 |
+
|
52 |
+
$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
|
53 |
+
|
54 |
+
$this->_column_headers = array( $columns, $hidden, $sortable );
|
55 |
+
$this->items = $data;
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Override the parent columns method. Defines the columns to use in your listing table
|
61 |
+
*/
|
62 |
+
public function get_columns() {
|
63 |
+
return $this->columns;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Define which columns are hidden
|
68 |
+
*/
|
69 |
+
public function get_hidden_columns() {
|
70 |
+
return array();
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Define the sortable columns
|
75 |
+
*/
|
76 |
+
public function get_sortable_columns() {
|
77 |
+
return array( 'title' => array( 'title', false ) );
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Define what data to show on each column of the table
|
82 |
+
*
|
83 |
+
* @param $item
|
84 |
+
* @param $column_name
|
85 |
+
*/
|
86 |
+
public function column_default( $item, $column_name ) {
|
87 |
+
|
88 |
+
switch ( $column_name ) {
|
89 |
+
case 'id':
|
90 |
+
case 'title':
|
91 |
+
case 'description':
|
92 |
+
case 'year':
|
93 |
+
case 'director':
|
94 |
+
case 'rating':
|
95 |
+
return $item[ $column_name ];
|
96 |
+
|
97 |
+
default:
|
98 |
+
return print_r( $item, true );
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Allows you to sort the data by the variables set in the $_GET
|
104 |
+
*
|
105 |
+
* @param $a
|
106 |
+
* @param $b
|
107 |
+
*/
|
108 |
+
private function sort_data( $a, $b ) {
|
109 |
+
// Set defaults
|
110 |
+
$orderby = 'title';
|
111 |
+
$order = 'asc';
|
112 |
+
|
113 |
+
// If orderby is set, use this as the sort column
|
114 |
+
if ( ! empty( $_GET['orderby'] ) ) {
|
115 |
+
$orderby = $_GET['orderby'];
|
116 |
+
}
|
117 |
+
|
118 |
+
// If order is set use this as the order
|
119 |
+
if ( ! empty( $_GET['order'] ) ) {
|
120 |
+
$order = $_GET['order'];
|
121 |
+
}
|
122 |
+
|
123 |
+
$result = strcmp( $a[ $orderby ], $b[ $orderby ] );
|
124 |
+
|
125 |
+
if ( 'asc' === $order ) {
|
126 |
+
return $result;
|
127 |
+
}
|
128 |
+
|
129 |
+
return -$result;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
classes/class-wpcf7r-mailchimp-helper.php
CHANGED
@@ -96,6 +96,7 @@ class WPCF7R_Mailchimp_Helper {
|
|
96 |
|
97 |
if ( $results->wasFailure() ) {
|
98 |
$res_object = json_decode( $results->getBody() );
|
|
|
99 |
$response = new WP_Error( 'create_mailchimp_user', $res_object->detail . " List:{$list_id}" );
|
100 |
|
101 |
return $response;
|
96 |
|
97 |
if ( $results->wasFailure() ) {
|
98 |
$res_object = json_decode( $results->getBody() );
|
99 |
+
|
100 |
$response = new WP_Error( 'create_mailchimp_user', $res_object->detail . " List:{$list_id}" );
|
101 |
|
102 |
return $response;
|
classes/class-wpcf7r-module.php
CHANGED
@@ -1,77 +1,77 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7R_Module - parent class for all wpcf7r Modules
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
class WPCF7R_Module {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Hold the active modules
|
12 |
-
*
|
13 |
-
* @var [type]
|
14 |
-
*/
|
15 |
-
private static $registered_modules;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* General init function for all child modules
|
19 |
-
*
|
20 |
-
* @return void
|
21 |
-
*/
|
22 |
-
public function init( $module ) {
|
23 |
-
$this->name = $module['name'];
|
24 |
-
$this->title = $module['title'];
|
25 |
-
|
26 |
-
//register global modules actions
|
27 |
-
if ( method_exists( get_class( $this ), 'add_panel' ) ) {
|
28 |
-
add_action( 'wpcf7_editor_panels', array( $this, 'add_panel' ) );
|
29 |
-
}
|
30 |
-
//enqueue required admin scripts or styles
|
31 |
-
if ( method_exists( get_class( $this ), 'enqueue_admin_scripts' ) ) {
|
32 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
|
33 |
-
}
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Add a new module
|
38 |
-
*
|
39 |
-
* @param [string] $name the module name
|
40 |
-
* @param [string] $title the module title
|
41 |
-
* @param [string] $class the name of the module main class
|
42 |
-
* @return void
|
43 |
-
*/
|
44 |
-
public static function register_module( $name, $title, $class ) {
|
45 |
-
self::$registered_modules[ $name ] = array(
|
46 |
-
'name' => $name,
|
47 |
-
'title' => $title,
|
48 |
-
'class' => $class,
|
49 |
-
);
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Initialize all registered modules
|
54 |
-
*
|
55 |
-
* @return void
|
56 |
-
*/
|
57 |
-
public static function init_modules() {
|
58 |
-
if ( self::get_active_modules() ) {
|
59 |
-
foreach ( self::get_active_modules() as $module ) {
|
60 |
-
$class_name = $module['class'];
|
61 |
-
$module_object = new $class_name;
|
62 |
-
|
63 |
-
//create an instance of the loaded module
|
64 |
-
$module_object->init( $module );
|
65 |
-
}
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Return the registered modules array
|
71 |
-
*
|
72 |
-
* @return void
|
73 |
-
*/
|
74 |
-
public static function get_active_modules() {
|
75 |
-
return self::$registered_modules;
|
76 |
-
}
|
77 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7R_Module - parent class for all wpcf7r Modules
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
class WPCF7R_Module {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Hold the active modules
|
12 |
+
*
|
13 |
+
* @var [type]
|
14 |
+
*/
|
15 |
+
private static $registered_modules;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* General init function for all child modules
|
19 |
+
*
|
20 |
+
* @return void
|
21 |
+
*/
|
22 |
+
public function init( $module ) {
|
23 |
+
$this->name = $module['name'];
|
24 |
+
$this->title = $module['title'];
|
25 |
+
|
26 |
+
//register global modules actions
|
27 |
+
if ( method_exists( get_class( $this ), 'add_panel' ) ) {
|
28 |
+
add_action( 'wpcf7_editor_panels', array( $this, 'add_panel' ) );
|
29 |
+
}
|
30 |
+
//enqueue required admin scripts or styles
|
31 |
+
if ( method_exists( get_class( $this ), 'enqueue_admin_scripts' ) ) {
|
32 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Add a new module
|
38 |
+
*
|
39 |
+
* @param [string] $name the module name
|
40 |
+
* @param [string] $title the module title
|
41 |
+
* @param [string] $class the name of the module main class
|
42 |
+
* @return void
|
43 |
+
*/
|
44 |
+
public static function register_module( $name, $title, $class ) {
|
45 |
+
self::$registered_modules[ $name ] = array(
|
46 |
+
'name' => $name,
|
47 |
+
'title' => $title,
|
48 |
+
'class' => $class,
|
49 |
+
);
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Initialize all registered modules
|
54 |
+
*
|
55 |
+
* @return void
|
56 |
+
*/
|
57 |
+
public static function init_modules() {
|
58 |
+
if ( self::get_active_modules() ) {
|
59 |
+
foreach ( self::get_active_modules() as $module ) {
|
60 |
+
$class_name = $module['class'];
|
61 |
+
$module_object = new $class_name;
|
62 |
+
|
63 |
+
//create an instance of the loaded module
|
64 |
+
$module_object->init( $module );
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Return the registered modules array
|
71 |
+
*
|
72 |
+
* @return void
|
73 |
+
*/
|
74 |
+
public static function get_active_modules() {
|
75 |
+
return self::$registered_modules;
|
76 |
+
}
|
77 |
+
}
|
classes/class-wpcf7r-post-types.php
CHANGED
@@ -1,221 +1,221 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7R_Post_Types
|
4 |
-
* Create a post type that will act as a container for the form actions
|
5 |
-
* This post type is invisible to all users and displayed only under Contact Form 7 tab
|
6 |
-
*/
|
7 |
-
|
8 |
-
defined( 'ABSPATH' ) || exit;
|
9 |
-
|
10 |
-
class WPCF7R_Post_Types {
|
11 |
-
|
12 |
-
public function __construct() {
|
13 |
-
add_action( 'init', array( $this, 'wpcf7r_post_type' ) );
|
14 |
-
add_action( 'add_meta_boxes', array( $this, 'wporg_add_custom_box' ) );
|
15 |
-
add_action( 'save_post', array( $this, 'save_changes' ) );
|
16 |
-
add_action( 'init', array( $this, 'wpcf7r_leads_post_type' ) );
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Register leads post type
|
21 |
-
*/
|
22 |
-
public function wpcf7r_leads_post_type() {
|
23 |
-
|
24 |
-
if ( class_exists( 'WPCF7R_Leads_Manager' ) && class_exists( 'WPCF7R_Action_Save_Lead' ) ) {
|
25 |
-
$labels = array(
|
26 |
-
'name' => _x( 'wpcf7r_lead', 'Post Type General Name', 'wpcf7-redirect' ),
|
27 |
-
'singular_name' => _x( 'wpcf7r_lead', 'Post Type Singular Name', 'wpcf7-redirect' ),
|
28 |
-
'menu_name' => __( 'Leads', 'wpcf7-redirect' ),
|
29 |
-
'name_admin_bar' => __( 'Post Type', 'wpcf7-redirect' ),
|
30 |
-
'archives' => __( 'Item Archives', 'wpcf7-redirect' ),
|
31 |
-
'attributes' => __( 'Item Attributes', 'wpcf7-redirect' ),
|
32 |
-
'parent_item_colon' => __( 'Parent Item:', 'wpcf7-redirect' ),
|
33 |
-
'all_items' => __( 'All Items', 'wpcf7-redirect' ),
|
34 |
-
'add_new_item' => __( 'Add New Item', 'wpcf7-redirect' ),
|
35 |
-
'add_new' => __( 'Add New', 'wpcf7-redirect' ),
|
36 |
-
'new_item' => __( 'New Item', 'wpcf7-redirect' ),
|
37 |
-
'edit_item' => __( 'Edit Item', 'wpcf7-redirect' ),
|
38 |
-
'update_item' => __( 'Update Item', 'wpcf7-redirect' ),
|
39 |
-
'view_item' => __( 'View Item', 'wpcf7-redirect' ),
|
40 |
-
'view_items' => __( 'View Items', 'wpcf7-redirect' ),
|
41 |
-
'search_items' => __( 'Search Item', 'wpcf7-redirect' ),
|
42 |
-
'not_found' => __( 'Not found', 'wpcf7-redirect' ),
|
43 |
-
'not_found_in_trash' => __( 'Not found in Trash', 'wpcf7-redirect' ),
|
44 |
-
'featured_image' => __( 'Featured Image', 'wpcf7-redirect' ),
|
45 |
-
'set_featured_image' => __( 'Set featured image', 'wpcf7-redirect' ),
|
46 |
-
'remove_featured_image' => __( 'Remove featured image', 'wpcf7-redirect' ),
|
47 |
-
'use_featured_image' => __( 'Use as featured image', 'wpcf7-redirect' ),
|
48 |
-
'insert_into_item' => __( 'Insert into item', 'wpcf7-redirect' ),
|
49 |
-
'uploaded_to_this_item' => __( 'Uploaded to this item', 'wpcf7-redirect' ),
|
50 |
-
'items_list' => __( 'Items list', 'wpcf7-redirect' ),
|
51 |
-
'items_list_navigation' => __( 'Items list navigation', 'wpcf7-redirect' ),
|
52 |
-
'filter_items_list' => __( 'Filter items list', 'wpcf7-redirect' ),
|
53 |
-
);
|
54 |
-
$args = array(
|
55 |
-
'label' => __( 'wpcf7r_leads', 'wpcf7-redirect' ),
|
56 |
-
'description' => __( 'wpcf7r_leads', 'wpcf7-redirect' ),
|
57 |
-
'labels' => $labels,
|
58 |
-
'supports' => array( 'title' ),
|
59 |
-
'hierarchical' => false,
|
60 |
-
'public' => false,
|
61 |
-
'show_ui' => true,
|
62 |
-
'show_in_menu' => 'admin.php?page=wpcf7',
|
63 |
-
'menu_position' => 5,
|
64 |
-
'show_in_admin_bar' => false,
|
65 |
-
'show_in_nav_menus' => false,
|
66 |
-
'can_export' => true,
|
67 |
-
'has_archive' => false,
|
68 |
-
'exclude_from_search' => false,
|
69 |
-
'publicly_queryable' => false,
|
70 |
-
'rewrite' => false,
|
71 |
-
'capability_type' => 'page',
|
72 |
-
'show_in_rest' => false,
|
73 |
-
);
|
74 |
-
register_post_type( 'wpcf7r_leads', $args );
|
75 |
-
|
76 |
-
if ( defined( 'CF7_REDIRECT_DEBUG' ) && CF7_REDIRECT_DEBUG ) {
|
77 |
-
add_post_type_support( 'wpcf7r_leads', 'custom-fields' );
|
78 |
-
}
|
79 |
-
|
80 |
-
add_action( 'admin_menu', 'my_admin_menu' );
|
81 |
-
}
|
82 |
-
|
83 |
-
function my_admin_menu() {
|
84 |
-
add_submenu_page( 'wpcf7', 'Leads', 'Leads', 'manage_options', 'edit.php?post_type=wpcf7r_leads' );
|
85 |
-
//add_submenu_page( 'wpcf7', 'New lead', 'New lead', 'manage_options', 'post-new.php?post_type=wpcf7r_leads' );
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
// Register Custom Post Type
|
90 |
-
function wpcf7r_post_type() {
|
91 |
-
$labels = array(
|
92 |
-
'name' => _x( 'wpcf7r_actions', 'Post Type General Name', 'wpcf7-redirect' ),
|
93 |
-
'singular_name' => _x( 'wpcf7r_action', 'Post Type Singular Name', 'wpcf7-redirect' ),
|
94 |
-
'menu_name' => __( 'wpcf7r_actions', 'wpcf7-redirect' ),
|
95 |
-
'name_admin_bar' => __( 'Post Type', 'wpcf7-redirect' ),
|
96 |
-
'archives' => __( 'Item Archives', 'wpcf7-redirect' ),
|
97 |
-
'attributes' => __( 'Item Attributes', 'wpcf7-redirect' ),
|
98 |
-
'parent_item_colon' => __( 'Parent Item:', 'wpcf7-redirect' ),
|
99 |
-
'all_items' => __( 'All Items', 'wpcf7-redirect' ),
|
100 |
-
'add_new_item' => __( 'Add New Item', 'wpcf7-redirect' ),
|
101 |
-
'add_new' => __( 'Add New', 'wpcf7-redirect' ),
|
102 |
-
'new_item' => __( 'New Item', 'wpcf7-redirect' ),
|
103 |
-
'edit_item' => __( 'Edit Item', 'wpcf7-redirect' ),
|
104 |
-
'update_item' => __( 'Update Item', 'wpcf7-redirect' ),
|
105 |
-
'view_item' => __( 'View Item', 'wpcf7-redirect' ),
|
106 |
-
'view_items' => __( 'View Items', 'wpcf7-redirect' ),
|
107 |
-
'search_items' => __( 'Search Item', 'wpcf7-redirect' ),
|
108 |
-
'not_found' => __( 'Not found', 'wpcf7-redirect' ),
|
109 |
-
'not_found_in_trash' => __( 'Not found in Trash', 'wpcf7-redirect' ),
|
110 |
-
'featured_image' => __( 'Featured Image', 'wpcf7-redirect' ),
|
111 |
-
'set_featured_image' => __( 'Set featured image', 'wpcf7-redirect' ),
|
112 |
-
'remove_featured_image' => __( 'Remove featured image', 'wpcf7-redirect' ),
|
113 |
-
'use_featured_image' => __( 'Use as featured image', 'wpcf7-redirect' ),
|
114 |
-
'insert_into_item' => __( 'Insert into item', 'wpcf7-redirect' ),
|
115 |
-
'uploaded_to_this_item' => __( 'Uploaded to this item', 'wpcf7-redirect' ),
|
116 |
-
'items_list' => __( 'Items list', 'wpcf7-redirect' ),
|
117 |
-
'items_list_navigation' => __( 'Items list navigation', 'wpcf7-redirect' ),
|
118 |
-
'filter_items_list' => __( 'Filter items list', 'wpcf7-redirect' ),
|
119 |
-
);
|
120 |
-
|
121 |
-
$args = array(
|
122 |
-
'label' => __( 'Redirection For Contact Form 7 Actions', 'wpcf7-redirect' ),
|
123 |
-
'description' => __( 'wpcf7r_actions', 'wpcf7-redirect' ),
|
124 |
-
'labels' => $labels,
|
125 |
-
'supports' => array( 'title', 'custom_fields', 'custom-fields' ),
|
126 |
-
'hierarchical' => true,
|
127 |
-
'public' => CF7_REDIRECT_DEBUG,
|
128 |
-
'show_ui' => CF7_REDIRECT_DEBUG,
|
129 |
-
'show_in_menu' => 'admin.php?page=wpcf7',
|
130 |
-
'menu_position' => 5,
|
131 |
-
'show_in_admin_bar' => CF7_REDIRECT_DEBUG,
|
132 |
-
'show_in_nav_menus' => CF7_REDIRECT_DEBUG,
|
133 |
-
'can_export' => CF7_REDIRECT_DEBUG,
|
134 |
-
'has_archive' => CF7_REDIRECT_DEBUG,
|
135 |
-
'exclude_from_search' => CF7_REDIRECT_DEBUG,
|
136 |
-
'publicly_queryable' => CF7_REDIRECT_DEBUG,
|
137 |
-
'rewrite' => CF7_REDIRECT_DEBUG,
|
138 |
-
'capability_type' => 'page',
|
139 |
-
'show_in_rest' => CF7_REDIRECT_DEBUG,
|
140 |
-
);
|
141 |
-
|
142 |
-
register_post_type( 'wpcf7r_action', $args );
|
143 |
-
add_post_type_support( 'wpcf7r_action', 'custom-fields' );
|
144 |
-
|
145 |
-
if ( defined( 'CF7_REDIRECT_DEBUG' ) && CF7_REDIRECT_DEBUG ) {
|
146 |
-
add_action( 'admin_menu', 'add_actions_menu' );
|
147 |
-
|
148 |
-
function add_actions_menu() {
|
149 |
-
add_submenu_page( 'wpcf7', __( 'Actions List', 'wpcf7-redirect' ), __( 'Actions List', 'wpcf7-redirect' ), 'manage_options', 'edit.php?post_type=wpcf7r_action' );
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
}
|
154 |
-
|
155 |
-
function wporg_add_custom_box() {
|
156 |
-
$screens = array( 'wpcf7r_action' );
|
157 |
-
if ( is_wpcf7r_debug() ) {
|
158 |
-
$screens[] = 'wpcf7r_leads';
|
159 |
-
}
|
160 |
-
|
161 |
-
foreach ( $screens as $screen ) {
|
162 |
-
add_meta_box(
|
163 |
-
'wpcf7r_action_meta',
|
164 |
-
__( 'Action Meta', 'wpcf7-redirect' ),
|
165 |
-
array( $this, 'debug_helper' ),
|
166 |
-
$screen
|
167 |
-
);
|
168 |
-
}
|
169 |
-
|
170 |
-
add_meta_box(
|
171 |
-
'wpcf7r_leads',
|
172 |
-
__( 'Lead Details', 'wpcf7-redirect' ),
|
173 |
-
array( $this, 'lead_fields_html' ),
|
174 |
-
'wpcf7r_leads'
|
175 |
-
);
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Get the meta html
|
180 |
-
*
|
181 |
-
* @param $post
|
182 |
-
*/
|
183 |
-
function lead_fields_html( $post ) {
|
184 |
-
$lead = new WPCF7R_Lead( $post->ID );
|
185 |
-
|
186 |
-
$fields = $lead->get_lead_fields();
|
187 |
-
|
188 |
-
foreach ( $fields as $field ) {
|
189 |
-
switch ( $field['name'] ) {
|
190 |
-
case 'action-save_lead':
|
191 |
-
$field['value'] = $field['value']['data']['lead_id'];
|
192 |
-
break;
|
193 |
-
case 'action-mailchimp':
|
194 |
-
if ( is_wp_error( $field['value'] ) ) {
|
195 |
-
$field['value'] = $field['value']->get_error_message();
|
196 |
-
}
|
197 |
-
break;
|
198 |
-
}
|
199 |
-
|
200 |
-
WPCF7R_Html::render_field( $field, $field['prefix'] );
|
201 |
-
}
|
202 |
-
}
|
203 |
-
|
204 |
-
public function save_changes( $post_id ) {
|
205 |
-
$post_type = get_post_type( $post_id );
|
206 |
-
|
207 |
-
if ( 'wpcf7r_leads' === $post_type ) {
|
208 |
-
if ( isset( $_POST['wpcf7-redirect'] ) ) {
|
209 |
-
foreach ( $_POST['wpcf7-redirect'] as $meta_key => $meta_value ) {
|
210 |
-
update_post_meta( $post_id, $meta_key, $meta_value );
|
211 |
-
}
|
212 |
-
}
|
213 |
-
}
|
214 |
-
}
|
215 |
-
|
216 |
-
function debug_helper() {
|
217 |
-
echo '<pre>';
|
218 |
-
print_r( get_post_custom() );
|
219 |
-
echo '</pre>';
|
220 |
-
}
|
221 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7R_Post_Types
|
4 |
+
* Create a post type that will act as a container for the form actions
|
5 |
+
* This post type is invisible to all users and displayed only under Contact Form 7 tab
|
6 |
+
*/
|
7 |
+
|
8 |
+
defined( 'ABSPATH' ) || exit;
|
9 |
+
|
10 |
+
class WPCF7R_Post_Types {
|
11 |
+
|
12 |
+
public function __construct() {
|
13 |
+
add_action( 'init', array( $this, 'wpcf7r_post_type' ) );
|
14 |
+
add_action( 'add_meta_boxes', array( $this, 'wporg_add_custom_box' ) );
|
15 |
+
add_action( 'save_post', array( $this, 'save_changes' ) );
|
16 |
+
add_action( 'init', array( $this, 'wpcf7r_leads_post_type' ) );
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Register leads post type
|
21 |
+
*/
|
22 |
+
public function wpcf7r_leads_post_type() {
|
23 |
+
|
24 |
+
if ( class_exists( 'WPCF7R_Leads_Manager' ) && class_exists( 'WPCF7R_Action_Save_Lead' ) ) {
|
25 |
+
$labels = array(
|
26 |
+
'name' => _x( 'wpcf7r_lead', 'Post Type General Name', 'wpcf7-redirect' ),
|
27 |
+
'singular_name' => _x( 'wpcf7r_lead', 'Post Type Singular Name', 'wpcf7-redirect' ),
|
28 |
+
'menu_name' => __( 'Leads', 'wpcf7-redirect' ),
|
29 |
+
'name_admin_bar' => __( 'Post Type', 'wpcf7-redirect' ),
|
30 |
+
'archives' => __( 'Item Archives', 'wpcf7-redirect' ),
|
31 |
+
'attributes' => __( 'Item Attributes', 'wpcf7-redirect' ),
|
32 |
+
'parent_item_colon' => __( 'Parent Item:', 'wpcf7-redirect' ),
|
33 |
+
'all_items' => __( 'All Items', 'wpcf7-redirect' ),
|
34 |
+
'add_new_item' => __( 'Add New Item', 'wpcf7-redirect' ),
|
35 |
+
'add_new' => __( 'Add New', 'wpcf7-redirect' ),
|
36 |
+
'new_item' => __( 'New Item', 'wpcf7-redirect' ),
|
37 |
+
'edit_item' => __( 'Edit Item', 'wpcf7-redirect' ),
|
38 |
+
'update_item' => __( 'Update Item', 'wpcf7-redirect' ),
|
39 |
+
'view_item' => __( 'View Item', 'wpcf7-redirect' ),
|
40 |
+
'view_items' => __( 'View Items', 'wpcf7-redirect' ),
|
41 |
+
'search_items' => __( 'Search Item', 'wpcf7-redirect' ),
|
42 |
+
'not_found' => __( 'Not found', 'wpcf7-redirect' ),
|
43 |
+
'not_found_in_trash' => __( 'Not found in Trash', 'wpcf7-redirect' ),
|
44 |
+
'featured_image' => __( 'Featured Image', 'wpcf7-redirect' ),
|
45 |
+
'set_featured_image' => __( 'Set featured image', 'wpcf7-redirect' ),
|
46 |
+
'remove_featured_image' => __( 'Remove featured image', 'wpcf7-redirect' ),
|
47 |
+
'use_featured_image' => __( 'Use as featured image', 'wpcf7-redirect' ),
|
48 |
+
'insert_into_item' => __( 'Insert into item', 'wpcf7-redirect' ),
|
49 |
+
'uploaded_to_this_item' => __( 'Uploaded to this item', 'wpcf7-redirect' ),
|
50 |
+
'items_list' => __( 'Items list', 'wpcf7-redirect' ),
|
51 |
+
'items_list_navigation' => __( 'Items list navigation', 'wpcf7-redirect' ),
|
52 |
+
'filter_items_list' => __( 'Filter items list', 'wpcf7-redirect' ),
|
53 |
+
);
|
54 |
+
$args = array(
|
55 |
+
'label' => __( 'wpcf7r_leads', 'wpcf7-redirect' ),
|
56 |
+
'description' => __( 'wpcf7r_leads', 'wpcf7-redirect' ),
|
57 |
+
'labels' => $labels,
|
58 |
+
'supports' => array( 'title' ),
|
59 |
+
'hierarchical' => false,
|
60 |
+
'public' => false,
|
61 |
+
'show_ui' => true,
|
62 |
+
'show_in_menu' => 'admin.php?page=wpcf7',
|
63 |
+
'menu_position' => 5,
|
64 |
+
'show_in_admin_bar' => false,
|
65 |
+
'show_in_nav_menus' => false,
|
66 |
+
'can_export' => true,
|
67 |
+
'has_archive' => false,
|
68 |
+
'exclude_from_search' => false,
|
69 |
+
'publicly_queryable' => false,
|
70 |
+
'rewrite' => false,
|
71 |
+
'capability_type' => 'page',
|
72 |
+
'show_in_rest' => false,
|
73 |
+
);
|
74 |
+
register_post_type( 'wpcf7r_leads', $args );
|
75 |
+
|
76 |
+
if ( defined( 'CF7_REDIRECT_DEBUG' ) && CF7_REDIRECT_DEBUG ) {
|
77 |
+
add_post_type_support( 'wpcf7r_leads', 'custom-fields' );
|
78 |
+
}
|
79 |
+
|
80 |
+
add_action( 'admin_menu', 'my_admin_menu' );
|
81 |
+
}
|
82 |
+
|
83 |
+
function my_admin_menu() {
|
84 |
+
add_submenu_page( 'wpcf7', 'Leads', 'Leads', 'manage_options', 'edit.php?post_type=wpcf7r_leads' );
|
85 |
+
//add_submenu_page( 'wpcf7', 'New lead', 'New lead', 'manage_options', 'post-new.php?post_type=wpcf7r_leads' );
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
// Register Custom Post Type
|
90 |
+
function wpcf7r_post_type() {
|
91 |
+
$labels = array(
|
92 |
+
'name' => _x( 'wpcf7r_actions', 'Post Type General Name', 'wpcf7-redirect' ),
|
93 |
+
'singular_name' => _x( 'wpcf7r_action', 'Post Type Singular Name', 'wpcf7-redirect' ),
|
94 |
+
'menu_name' => __( 'wpcf7r_actions', 'wpcf7-redirect' ),
|
95 |
+
'name_admin_bar' => __( 'Post Type', 'wpcf7-redirect' ),
|
96 |
+
'archives' => __( 'Item Archives', 'wpcf7-redirect' ),
|
97 |
+
'attributes' => __( 'Item Attributes', 'wpcf7-redirect' ),
|
98 |
+
'parent_item_colon' => __( 'Parent Item:', 'wpcf7-redirect' ),
|
99 |
+
'all_items' => __( 'All Items', 'wpcf7-redirect' ),
|
100 |
+
'add_new_item' => __( 'Add New Item', 'wpcf7-redirect' ),
|
101 |
+
'add_new' => __( 'Add New', 'wpcf7-redirect' ),
|
102 |
+
'new_item' => __( 'New Item', 'wpcf7-redirect' ),
|
103 |
+
'edit_item' => __( 'Edit Item', 'wpcf7-redirect' ),
|
104 |
+
'update_item' => __( 'Update Item', 'wpcf7-redirect' ),
|
105 |
+
'view_item' => __( 'View Item', 'wpcf7-redirect' ),
|
106 |
+
'view_items' => __( 'View Items', 'wpcf7-redirect' ),
|
107 |
+
'search_items' => __( 'Search Item', 'wpcf7-redirect' ),
|
108 |
+
'not_found' => __( 'Not found', 'wpcf7-redirect' ),
|
109 |
+
'not_found_in_trash' => __( 'Not found in Trash', 'wpcf7-redirect' ),
|
110 |
+
'featured_image' => __( 'Featured Image', 'wpcf7-redirect' ),
|
111 |
+
'set_featured_image' => __( 'Set featured image', 'wpcf7-redirect' ),
|
112 |
+
'remove_featured_image' => __( 'Remove featured image', 'wpcf7-redirect' ),
|
113 |
+
'use_featured_image' => __( 'Use as featured image', 'wpcf7-redirect' ),
|
114 |
+
'insert_into_item' => __( 'Insert into item', 'wpcf7-redirect' ),
|
115 |
+
'uploaded_to_this_item' => __( 'Uploaded to this item', 'wpcf7-redirect' ),
|
116 |
+
'items_list' => __( 'Items list', 'wpcf7-redirect' ),
|
117 |
+
'items_list_navigation' => __( 'Items list navigation', 'wpcf7-redirect' ),
|
118 |
+
'filter_items_list' => __( 'Filter items list', 'wpcf7-redirect' ),
|
119 |
+
);
|
120 |
+
|
121 |
+
$args = array(
|
122 |
+
'label' => __( 'Redirection For Contact Form 7 Actions', 'wpcf7-redirect' ),
|
123 |
+
'description' => __( 'wpcf7r_actions', 'wpcf7-redirect' ),
|
124 |
+
'labels' => $labels,
|
125 |
+
'supports' => array( 'title', 'custom_fields', 'custom-fields' ),
|
126 |
+
'hierarchical' => true,
|
127 |
+
'public' => CF7_REDIRECT_DEBUG,
|
128 |
+
'show_ui' => CF7_REDIRECT_DEBUG,
|
129 |
+
'show_in_menu' => 'admin.php?page=wpcf7',
|
130 |
+
'menu_position' => 5,
|
131 |
+
'show_in_admin_bar' => CF7_REDIRECT_DEBUG,
|
132 |
+
'show_in_nav_menus' => CF7_REDIRECT_DEBUG,
|
133 |
+
'can_export' => CF7_REDIRECT_DEBUG,
|
134 |
+
'has_archive' => CF7_REDIRECT_DEBUG,
|
135 |
+
'exclude_from_search' => CF7_REDIRECT_DEBUG,
|
136 |
+
'publicly_queryable' => CF7_REDIRECT_DEBUG,
|
137 |
+
'rewrite' => CF7_REDIRECT_DEBUG,
|
138 |
+
'capability_type' => 'page',
|
139 |
+
'show_in_rest' => CF7_REDIRECT_DEBUG,
|
140 |
+
);
|
141 |
+
|
142 |
+
register_post_type( 'wpcf7r_action', $args );
|
143 |
+
add_post_type_support( 'wpcf7r_action', 'custom-fields' );
|
144 |
+
|
145 |
+
if ( defined( 'CF7_REDIRECT_DEBUG' ) && CF7_REDIRECT_DEBUG ) {
|
146 |
+
add_action( 'admin_menu', 'add_actions_menu' );
|
147 |
+
|
148 |
+
function add_actions_menu() {
|
149 |
+
add_submenu_page( 'wpcf7', __( 'Actions List', 'wpcf7-redirect' ), __( 'Actions List', 'wpcf7-redirect' ), 'manage_options', 'edit.php?post_type=wpcf7r_action' );
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
}
|
154 |
+
|
155 |
+
function wporg_add_custom_box() {
|
156 |
+
$screens = array( 'wpcf7r_action' );
|
157 |
+
if ( is_wpcf7r_debug() ) {
|
158 |
+
$screens[] = 'wpcf7r_leads';
|
159 |
+
}
|
160 |
+
|
161 |
+
foreach ( $screens as $screen ) {
|
162 |
+
add_meta_box(
|
163 |
+
'wpcf7r_action_meta',
|
164 |
+
__( 'Action Meta', 'wpcf7-redirect' ),
|
165 |
+
array( $this, 'debug_helper' ),
|
166 |
+
$screen
|
167 |
+
);
|
168 |
+
}
|
169 |
+
|
170 |
+
add_meta_box(
|
171 |
+
'wpcf7r_leads',
|
172 |
+
__( 'Lead Details', 'wpcf7-redirect' ),
|
173 |
+
array( $this, 'lead_fields_html' ),
|
174 |
+
'wpcf7r_leads'
|
175 |
+
);
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Get the meta html
|
180 |
+
*
|
181 |
+
* @param $post
|
182 |
+
*/
|
183 |
+
function lead_fields_html( $post ) {
|
184 |
+
$lead = new WPCF7R_Lead( $post->ID );
|
185 |
+
|
186 |
+
$fields = $lead->get_lead_fields();
|
187 |
+
|
188 |
+
foreach ( $fields as $field ) {
|
189 |
+
switch ( $field['name'] ) {
|
190 |
+
case 'action-save_lead':
|
191 |
+
$field['value'] = $field['value']['data']['lead_id'];
|
192 |
+
break;
|
193 |
+
case 'action-mailchimp':
|
194 |
+
if ( is_wp_error( $field['value'] ) ) {
|
195 |
+
$field['value'] = $field['value']->get_error_message();
|
196 |
+
}
|
197 |
+
break;
|
198 |
+
}
|
199 |
+
|
200 |
+
WPCF7R_Html::render_field( $field, $field['prefix'] );
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
public function save_changes( $post_id ) {
|
205 |
+
$post_type = get_post_type( $post_id );
|
206 |
+
|
207 |
+
if ( 'wpcf7r_leads' === $post_type ) {
|
208 |
+
if ( isset( $_POST['wpcf7-redirect'] ) ) {
|
209 |
+
foreach ( $_POST['wpcf7-redirect'] as $meta_key => $meta_value ) {
|
210 |
+
update_post_meta( $post_id, $meta_key, $meta_value );
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
function debug_helper() {
|
217 |
+
echo '<pre>';
|
218 |
+
print_r( get_post_custom() );
|
219 |
+
echo '</pre>';
|
220 |
+
}
|
221 |
+
}
|
classes/class-wpcf7r-settings.php
CHANGED
@@ -1,303 +1,303 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7r_Settings file.
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Contact form 7 Redirect Settings panel
|
10 |
-
*/
|
11 |
-
class WPCF7r_Settings {
|
12 |
-
public $product_url = WPCF7_PRO_REDIRECT_PLUGIN_PAGE_URL;
|
13 |
-
|
14 |
-
public function __construct() {
|
15 |
-
$this->page_slug = 'wpc7_redirect';
|
16 |
-
$this->api = new Qs_Api();
|
17 |
-
|
18 |
-
add_action( 'admin_menu', array( $this, 'create_plugin_settings_page' ) );
|
19 |
-
add_action( 'admin_init', array( $this, 'wpcf7r_register_options' ) );
|
20 |
-
add_filter( 'plugin_row_meta', array( $this, 'register_plugin_links' ), 10, 2 );
|
21 |
-
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Deactivate the license - Disabled on v2.0
|
26 |
-
*/
|
27 |
-
public function deactivate_license() {
|
28 |
-
$serial = WPCF7r_Utils::get_serial_key();
|
29 |
-
$activation_id = WPCF7r_Utils::get_activation_id();
|
30 |
-
|
31 |
-
$this->api->deactivate_liscense( $activation_id, $serial );
|
32 |
-
$this->reset_activation();
|
33 |
-
|
34 |
-
wp_redirect( WPCF7r_Utils::get_plugin_settings_page_url() );
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Register plugin options
|
39 |
-
*/
|
40 |
-
public function wpcf7r_register_options() {
|
41 |
-
$this->fields = array();
|
42 |
-
// $this->add_license_section();
|
43 |
-
$this->add_settings_section();
|
44 |
-
|
45 |
-
foreach ( $this->fields as $field ) {
|
46 |
-
$args = array();
|
47 |
-
add_settings_field( $field['uid'], $field['label'], array( $this, 'field_callback' ), $this->page_slug, $field['section'], $field );
|
48 |
-
// $args['sanitize_callback'] = array($this, 'validate_serial_key');
|
49 |
-
register_setting( $this->page_slug, $field['uid'], $args );
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
public function add_settings_section() {
|
54 |
-
|
55 |
-
add_settings_section( 'settings_section', __( 'Global Settings', 'wpcf7-redirect' ), array( $this, 'section_callback' ), $this->page_slug );
|
56 |
-
|
57 |
-
$this->fields = array_merge(
|
58 |
-
$this->fields,
|
59 |
-
array(
|
60 |
-
array(
|
61 |
-
'uid' => 'wpcf_debug',
|
62 |
-
'label' => 'Debug',
|
63 |
-
'section' => 'settings_section',
|
64 |
-
'type' => 'checkbox',
|
65 |
-
'options' => false,
|
66 |
-
'placeholder' => '',
|
67 |
-
'helper' => '',
|
68 |
-
'supplemental' => __( 'This will open the actions post type and display debug feature.', 'wpcf7-redirect' ),
|
69 |
-
'default' => '',
|
70 |
-
),
|
71 |
-
)
|
72 |
-
);
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* add_license_section - Deprecated
|
77 |
-
*/
|
78 |
-
public function add_license_section() {
|
79 |
-
add_settings_section( 'serial_section', __( 'License Information', 'wpcf7-redirect' ), array( $this, 'section_callback' ), $this->page_slug );
|
80 |
-
|
81 |
-
$this->fields = array_merge(
|
82 |
-
$this->fields,
|
83 |
-
array(
|
84 |
-
array(
|
85 |
-
'uid' => 'wpcf7r_serial_number',
|
86 |
-
'label' => 'Serial Number',
|
87 |
-
'section' => 'serial_section',
|
88 |
-
'type' => 'text',
|
89 |
-
'options' => false,
|
90 |
-
'placeholder' => 'Type your serial here',
|
91 |
-
'helper' => '',
|
92 |
-
'supplemental' => __( 'This process will send your serial/domain to a 3rd party validation server to validate the key authenticity', 'wpcf7-redirect' ),
|
93 |
-
'default' => '',
|
94 |
-
),
|
95 |
-
)
|
96 |
-
);
|
97 |
-
|
98 |
-
return $fields;
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Validate serial key process
|
103 |
-
*
|
104 |
-
* @param $serial
|
105 |
-
*/
|
106 |
-
public function validate_serial_key( $serial ) {
|
107 |
-
if ( ! $serial ) {
|
108 |
-
return;
|
109 |
-
}
|
110 |
-
|
111 |
-
$activation_id = WPCF7r_Utils::get_activation_id();
|
112 |
-
|
113 |
-
if ( ! $activation_id ) {
|
114 |
-
$is_valid = $this->api->activate_serial( $serial );
|
115 |
-
} else {
|
116 |
-
$is_valid = $this->api->validate_serial( $activation_id, $serial );
|
117 |
-
}
|
118 |
-
|
119 |
-
// serial was not valid
|
120 |
-
if ( is_wp_error( $is_valid ) ) {
|
121 |
-
$message = $is_valid->get_error_message();
|
122 |
-
if ( is_object( $message ) && isset( $message->license_key ) ) {
|
123 |
-
$message = $message->license_key[0];
|
124 |
-
}
|
125 |
-
add_settings_error(
|
126 |
-
'wpcf7r_serial_number',
|
127 |
-
'not-valid-serial',
|
128 |
-
$message,
|
129 |
-
'error'
|
130 |
-
);
|
131 |
-
$this->reset_activation();
|
132 |
-
return false;
|
133 |
-
} elseif ( ! $activation_id ) {
|
134 |
-
// serial was valid, update the activation key for future validation
|
135 |
-
$this->set_activation( $is_valid->data );
|
136 |
-
}
|
137 |
-
|
138 |
-
if ( isset( $_GET['deactivate'] ) ) {
|
139 |
-
return '';
|
140 |
-
}
|
141 |
-
|
142 |
-
return $serial;
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Delete all activation data - use in case activation validation or activation returns an error
|
147 |
-
*/
|
148 |
-
public function reset_activation() {
|
149 |
-
delete_option( 'wpcf7r_activation_id' );
|
150 |
-
delete_option( 'wpcf7r_activation_expiration' );
|
151 |
-
delete_option( 'wpcf7r_activation_data' );
|
152 |
-
|
153 |
-
WPCF7r_Utils::delete_serial_key();
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Set all data related with the plugin activation
|
158 |
-
*
|
159 |
-
* @param $validation_data
|
160 |
-
*/
|
161 |
-
public function set_activation( $validation_data ) {
|
162 |
-
update_option( 'wpcf7r_activation_id', $validation_data->activation_id );
|
163 |
-
update_option( 'wpcf7r_activation_expiration', $validation_data->expire );
|
164 |
-
update_option( 'wpcf7r_activation_data', $validation_data );
|
165 |
-
}
|
166 |
-
|
167 |
-
/**
|
168 |
-
* A function for displaying a field on the admin settings page
|
169 |
-
*/
|
170 |
-
public function field_callback( $arguments ) {
|
171 |
-
$value = get_option( $arguments['uid'] ); // Get the current value, if there is one
|
172 |
-
if ( ! $value ) { // If no value exists
|
173 |
-
$value = $arguments['default']; // Set to our default
|
174 |
-
}
|
175 |
-
// Check which type of field we want
|
176 |
-
switch ( $arguments['type'] ) {
|
177 |
-
case 'text': // If it is a text field
|
178 |
-
case 'password':
|
179 |
-
printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" class="widefat" />', $arguments['uid'], $arguments['type'], $arguments['placeholder'], $value );
|
180 |
-
break;
|
181 |
-
case 'checkbox': // If it is a text field
|
182 |
-
$checked = checked( $value, '1', false );
|
183 |
-
printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" class="widefat" %5$s/>', $arguments['uid'], $arguments['type'], $arguments['placeholder'], '1', $checked );
|
184 |
-
break;
|
185 |
-
}
|
186 |
-
|
187 |
-
$helper = $arguments['helper'];
|
188 |
-
$supplimental = $arguments['supplemental'];
|
189 |
-
|
190 |
-
// If there is help text
|
191 |
-
if ( $helper ) {
|
192 |
-
printf( '<span class="helper"> %s</span>', $helper ); // Show it
|
193 |
-
}
|
194 |
-
|
195 |
-
// If there is supplemental text
|
196 |
-
if ( $supplimental ) {
|
197 |
-
printf( '<p class="description">%s</p>', $supplimental ); // Show it
|
198 |
-
}
|
199 |
-
}
|
200 |
-
|
201 |
-
/**
|
202 |
-
* Main call for creating the settings page
|
203 |
-
*/
|
204 |
-
public function create_plugin_settings_page() {
|
205 |
-
// Add the menu item and page
|
206 |
-
$page_title = 'Extensions';
|
207 |
-
$menu_title = 'Extensions';
|
208 |
-
$capability = 'manage_options';
|
209 |
-
$callback = array( $this, 'plugin_settings_page_content' );
|
210 |
-
$icon = 'dashicons-admin-plugins';
|
211 |
-
$position = 100;
|
212 |
-
|
213 |
-
add_submenu_page(
|
214 |
-
'wpcf7',
|
215 |
-
$page_title,
|
216 |
-
$page_title,
|
217 |
-
$capability,
|
218 |
-
$this->page_slug,
|
219 |
-
$callback
|
220 |
-
);
|
221 |
-
}
|
222 |
-
|
223 |
-
/**
|
224 |
-
* The setting page template HTML
|
225 |
-
*/
|
226 |
-
public function plugin_settings_page_content() {
|
227 |
-
$wpcf7_extensions = new WPCF7R_Extensions();
|
228 |
-
?>
|
229 |
-
<section class="padbox">
|
230 |
-
<div class="wrap wrap-wpcf7redirect">
|
231 |
-
<h2>
|
232 |
-
<span>
|
233 |
-
<?php _e( 'Redirection For Contact Form 7', 'wpcf7-redirect' ); ?>
|
234 |
-
</span>
|
235 |
-
</h2>
|
236 |
-
<div class="user-message">
|
237 |
-
<ul>
|
238 |
-
<li>The new and improved Submission Action System is how redirection for Contact Form 7 processes submission data.</li>
|
239 |
-
<li>Submission Actions are like modules which can be added to each form.</li>
|
240 |
-
<li>You can add multiple actions to a single form or a single action can be added to any form.</li>
|
241 |
-
<li>Create custom login/registration forms, manage your conversion pixels, set conditional rules and much more.</li>
|
242 |
-
</ul>
|
243 |
-
<form method="post">
|
244 |
-
<br/>
|
245 |
-
<input type="submit" value="Check For Updates" class="button-primary" name="extensions-updates-check"/>
|
246 |
-
<br/><br/>
|
247 |
-
<lable>
|
248 |
-
<input type="checkbox" checked="checked" name="update-banner" value="1">
|
249 |
-
<?php _e( 'Get available deals and sales (no spam of any kind).' ); ?>
|
250 |
-
</label>
|
251 |
-
</form>
|
252 |
-
</div>
|
253 |
-
<div class="postbox extensions-list-wrap">
|
254 |
-
<div class="padbox">
|
255 |
-
<?php $wpcf7_extensions->display(); ?>
|
256 |
-
</div>
|
257 |
-
</div>
|
258 |
-
<div class="postbox">
|
259 |
-
<div class="padbox">
|
260 |
-
<form method="POST" action="options.php" name="wpcfr7_settings">
|
261 |
-
<?php
|
262 |
-
do_action( 'before_settings_fields' );
|
263 |
-
settings_fields( $this->page_slug );
|
264 |
-
do_settings_sections( $this->page_slug );
|
265 |
-
submit_button();
|
266 |
-
?>
|
267 |
-
</form>
|
268 |
-
<?php if ( is_wpcf7r_debug() ) : ?>
|
269 |
-
<input type="button" name="migrate_again" value="<?php _e( 'Migrate Again from Old Settings', 'wpcf7-redirect' ); ?>" class="migrate_again button button-secondary" />
|
270 |
-
<input type="button" name="reset_all" value="<?php _e( 'Reset all Settings - BE CAREFUL! this will delete all Redirection for Contact Form 7 data.', 'wpcf7-redirect' ); ?>" class="cf7-redirect-reset button button-secondary" />
|
271 |
-
|
272 |
-
<h3><?php _e( 'Recreate from Debug', 'wpcf7-redirect' ); ?></h3>
|
273 |
-
<textarea id="debug-info" style="width:100%;"></textarea>
|
274 |
-
<button class="reacreate-from-debug button button-primary"><?php _e( 'Recreate From Debug', 'wpcf7-redirect' ); ?></button>
|
275 |
-
<?php endif; ?>
|
276 |
-
</div>
|
277 |
-
</div>
|
278 |
-
</div>
|
279 |
-
</section>
|
280 |
-
<?php
|
281 |
-
}
|
282 |
-
|
283 |
-
/**
|
284 |
-
* Create a section on the admin settings page
|
285 |
-
*/
|
286 |
-
public function section_callback( $arguments ) {
|
287 |
-
switch ( $arguments['id'] ) {
|
288 |
-
case 'serial_section':
|
289 |
-
echo sprintf( "In order to gain access to plugin updates, please enter your license key below. If you don't have a licence key, please <a href='%s' target='_blank'>click Here</a>.", $this->product_url );
|
290 |
-
break;
|
291 |
-
}
|
292 |
-
}
|
293 |
-
|
294 |
-
/**
|
295 |
-
* Add a link to the options page to the plugin description block.
|
296 |
-
*/
|
297 |
-
function register_plugin_links( $links, $file ) {
|
298 |
-
if ( WPCF7_PRO_REDIRECT_BASE_NAME === $file ) {
|
299 |
-
$links[] = WPCF7r_Utils::get_settings_link();
|
300 |
-
}
|
301 |
-
return $links;
|
302 |
-
}
|
303 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7r_Settings file.
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Contact form 7 Redirect Settings panel
|
10 |
+
*/
|
11 |
+
class WPCF7r_Settings {
|
12 |
+
public $product_url = WPCF7_PRO_REDIRECT_PLUGIN_PAGE_URL;
|
13 |
+
|
14 |
+
public function __construct() {
|
15 |
+
$this->page_slug = 'wpc7_redirect';
|
16 |
+
$this->api = new Qs_Api();
|
17 |
+
|
18 |
+
add_action( 'admin_menu', array( $this, 'create_plugin_settings_page' ) );
|
19 |
+
add_action( 'admin_init', array( $this, 'wpcf7r_register_options' ) );
|
20 |
+
add_filter( 'plugin_row_meta', array( $this, 'register_plugin_links' ), 10, 2 );
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Deactivate the license - Disabled on v2.0
|
26 |
+
*/
|
27 |
+
public function deactivate_license() {
|
28 |
+
$serial = WPCF7r_Utils::get_serial_key();
|
29 |
+
$activation_id = WPCF7r_Utils::get_activation_id();
|
30 |
+
|
31 |
+
$this->api->deactivate_liscense( $activation_id, $serial );
|
32 |
+
$this->reset_activation();
|
33 |
+
|
34 |
+
wp_redirect( WPCF7r_Utils::get_plugin_settings_page_url() );
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Register plugin options
|
39 |
+
*/
|
40 |
+
public function wpcf7r_register_options() {
|
41 |
+
$this->fields = array();
|
42 |
+
// $this->add_license_section();
|
43 |
+
$this->add_settings_section();
|
44 |
+
|
45 |
+
foreach ( $this->fields as $field ) {
|
46 |
+
$args = array();
|
47 |
+
add_settings_field( $field['uid'], $field['label'], array( $this, 'field_callback' ), $this->page_slug, $field['section'], $field );
|
48 |
+
// $args['sanitize_callback'] = array($this, 'validate_serial_key');
|
49 |
+
register_setting( $this->page_slug, $field['uid'], $args );
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
public function add_settings_section() {
|
54 |
+
|
55 |
+
add_settings_section( 'settings_section', __( 'Global Settings', 'wpcf7-redirect' ), array( $this, 'section_callback' ), $this->page_slug );
|
56 |
+
|
57 |
+
$this->fields = array_merge(
|
58 |
+
$this->fields,
|
59 |
+
array(
|
60 |
+
array(
|
61 |
+
'uid' => 'wpcf_debug',
|
62 |
+
'label' => 'Debug',
|
63 |
+
'section' => 'settings_section',
|
64 |
+
'type' => 'checkbox',
|
65 |
+
'options' => false,
|
66 |
+
'placeholder' => '',
|
67 |
+
'helper' => '',
|
68 |
+
'supplemental' => __( 'This will open the actions post type and display debug feature.', 'wpcf7-redirect' ),
|
69 |
+
'default' => '',
|
70 |
+
),
|
71 |
+
)
|
72 |
+
);
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* add_license_section - Deprecated
|
77 |
+
*/
|
78 |
+
public function add_license_section() {
|
79 |
+
add_settings_section( 'serial_section', __( 'License Information', 'wpcf7-redirect' ), array( $this, 'section_callback' ), $this->page_slug );
|
80 |
+
|
81 |
+
$this->fields = array_merge(
|
82 |
+
$this->fields,
|
83 |
+
array(
|
84 |
+
array(
|
85 |
+
'uid' => 'wpcf7r_serial_number',
|
86 |
+
'label' => 'Serial Number',
|
87 |
+
'section' => 'serial_section',
|
88 |
+
'type' => 'text',
|
89 |
+
'options' => false,
|
90 |
+
'placeholder' => 'Type your serial here',
|
91 |
+
'helper' => '',
|
92 |
+
'supplemental' => __( 'This process will send your serial/domain to a 3rd party validation server to validate the key authenticity', 'wpcf7-redirect' ),
|
93 |
+
'default' => '',
|
94 |
+
),
|
95 |
+
)
|
96 |
+
);
|
97 |
+
|
98 |
+
return $fields;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Validate serial key process
|
103 |
+
*
|
104 |
+
* @param $serial
|
105 |
+
*/
|
106 |
+
public function validate_serial_key( $serial ) {
|
107 |
+
if ( ! $serial ) {
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
$activation_id = WPCF7r_Utils::get_activation_id();
|
112 |
+
|
113 |
+
if ( ! $activation_id ) {
|
114 |
+
$is_valid = $this->api->activate_serial( $serial );
|
115 |
+
} else {
|
116 |
+
$is_valid = $this->api->validate_serial( $activation_id, $serial );
|
117 |
+
}
|
118 |
+
|
119 |
+
// serial was not valid
|
120 |
+
if ( is_wp_error( $is_valid ) ) {
|
121 |
+
$message = $is_valid->get_error_message();
|
122 |
+
if ( is_object( $message ) && isset( $message->license_key ) ) {
|
123 |
+
$message = $message->license_key[0];
|
124 |
+
}
|
125 |
+
add_settings_error(
|
126 |
+
'wpcf7r_serial_number',
|
127 |
+
'not-valid-serial',
|
128 |
+
$message,
|
129 |
+
'error'
|
130 |
+
);
|
131 |
+
$this->reset_activation();
|
132 |
+
return false;
|
133 |
+
} elseif ( ! $activation_id ) {
|
134 |
+
// serial was valid, update the activation key for future validation
|
135 |
+
$this->set_activation( $is_valid->data );
|
136 |
+
}
|
137 |
+
|
138 |
+
if ( isset( $_GET['deactivate'] ) ) {
|
139 |
+
return '';
|
140 |
+
}
|
141 |
+
|
142 |
+
return $serial;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Delete all activation data - use in case activation validation or activation returns an error
|
147 |
+
*/
|
148 |
+
public function reset_activation() {
|
149 |
+
delete_option( 'wpcf7r_activation_id' );
|
150 |
+
delete_option( 'wpcf7r_activation_expiration' );
|
151 |
+
delete_option( 'wpcf7r_activation_data' );
|
152 |
+
|
153 |
+
WPCF7r_Utils::delete_serial_key();
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Set all data related with the plugin activation
|
158 |
+
*
|
159 |
+
* @param $validation_data
|
160 |
+
*/
|
161 |
+
public function set_activation( $validation_data ) {
|
162 |
+
update_option( 'wpcf7r_activation_id', $validation_data->activation_id );
|
163 |
+
update_option( 'wpcf7r_activation_expiration', $validation_data->expire );
|
164 |
+
update_option( 'wpcf7r_activation_data', $validation_data );
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* A function for displaying a field on the admin settings page
|
169 |
+
*/
|
170 |
+
public function field_callback( $arguments ) {
|
171 |
+
$value = get_option( $arguments['uid'] ); // Get the current value, if there is one
|
172 |
+
if ( ! $value ) { // If no value exists
|
173 |
+
$value = $arguments['default']; // Set to our default
|
174 |
+
}
|
175 |
+
// Check which type of field we want
|
176 |
+
switch ( $arguments['type'] ) {
|
177 |
+
case 'text': // If it is a text field
|
178 |
+
case 'password':
|
179 |
+
printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" class="widefat" />', $arguments['uid'], $arguments['type'], $arguments['placeholder'], $value );
|
180 |
+
break;
|
181 |
+
case 'checkbox': // If it is a text field
|
182 |
+
$checked = checked( $value, '1', false );
|
183 |
+
printf( '<input name="%1$s" id="%1$s" type="%2$s" placeholder="%3$s" value="%4$s" class="widefat" %5$s/>', $arguments['uid'], $arguments['type'], $arguments['placeholder'], '1', $checked );
|
184 |
+
break;
|
185 |
+
}
|
186 |
+
|
187 |
+
$helper = $arguments['helper'];
|
188 |
+
$supplimental = $arguments['supplemental'];
|
189 |
+
|
190 |
+
// If there is help text
|
191 |
+
if ( $helper ) {
|
192 |
+
printf( '<span class="helper"> %s</span>', $helper ); // Show it
|
193 |
+
}
|
194 |
+
|
195 |
+
// If there is supplemental text
|
196 |
+
if ( $supplimental ) {
|
197 |
+
printf( '<p class="description">%s</p>', $supplimental ); // Show it
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Main call for creating the settings page
|
203 |
+
*/
|
204 |
+
public function create_plugin_settings_page() {
|
205 |
+
// Add the menu item and page
|
206 |
+
$page_title = 'Extensions';
|
207 |
+
$menu_title = 'Extensions';
|
208 |
+
$capability = 'manage_options';
|
209 |
+
$callback = array( $this, 'plugin_settings_page_content' );
|
210 |
+
$icon = 'dashicons-admin-plugins';
|
211 |
+
$position = 100;
|
212 |
+
|
213 |
+
add_submenu_page(
|
214 |
+
'wpcf7',
|
215 |
+
$page_title,
|
216 |
+
$page_title,
|
217 |
+
$capability,
|
218 |
+
$this->page_slug,
|
219 |
+
$callback
|
220 |
+
);
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* The setting page template HTML
|
225 |
+
*/
|
226 |
+
public function plugin_settings_page_content() {
|
227 |
+
$wpcf7_extensions = new WPCF7R_Extensions();
|
228 |
+
?>
|
229 |
+
<section class="padbox">
|
230 |
+
<div class="wrap wrap-wpcf7redirect">
|
231 |
+
<h2>
|
232 |
+
<span>
|
233 |
+
<?php _e( 'Redirection For Contact Form 7', 'wpcf7-redirect' ); ?>
|
234 |
+
</span>
|
235 |
+
</h2>
|
236 |
+
<div class="user-message">
|
237 |
+
<ul>
|
238 |
+
<li>The new and improved Submission Action System is how redirection for Contact Form 7 processes submission data.</li>
|
239 |
+
<li>Submission Actions are like modules which can be added to each form.</li>
|
240 |
+
<li>You can add multiple actions to a single form or a single action can be added to any form.</li>
|
241 |
+
<li>Create custom login/registration forms, manage your conversion pixels, set conditional rules and much more.</li>
|
242 |
+
</ul>
|
243 |
+
<form method="post">
|
244 |
+
<br/>
|
245 |
+
<input type="submit" value="Check For Updates" class="button-primary" name="extensions-updates-check"/>
|
246 |
+
<br/><br/>
|
247 |
+
<lable>
|
248 |
+
<input type="checkbox" checked="checked" name="update-banner" value="1">
|
249 |
+
<?php _e( 'Get available deals and sales (no spam of any kind).' ); ?>
|
250 |
+
</label>
|
251 |
+
</form>
|
252 |
+
</div>
|
253 |
+
<div class="postbox extensions-list-wrap">
|
254 |
+
<div class="padbox">
|
255 |
+
<?php $wpcf7_extensions->display(); ?>
|
256 |
+
</div>
|
257 |
+
</div>
|
258 |
+
<div class="postbox">
|
259 |
+
<div class="padbox">
|
260 |
+
<form method="POST" action="options.php" name="wpcfr7_settings">
|
261 |
+
<?php
|
262 |
+
do_action( 'before_settings_fields' );
|
263 |
+
settings_fields( $this->page_slug );
|
264 |
+
do_settings_sections( $this->page_slug );
|
265 |
+
submit_button();
|
266 |
+
?>
|
267 |
+
</form>
|
268 |
+
<?php if ( is_wpcf7r_debug() ) : ?>
|
269 |
+
<input type="button" name="migrate_again" value="<?php _e( 'Migrate Again from Old Settings', 'wpcf7-redirect' ); ?>" class="migrate_again button button-secondary" />
|
270 |
+
<input type="button" name="reset_all" value="<?php _e( 'Reset all Settings - BE CAREFUL! this will delete all Redirection for Contact Form 7 data.', 'wpcf7-redirect' ); ?>" class="cf7-redirect-reset button button-secondary" />
|
271 |
+
|
272 |
+
<h3><?php _e( 'Recreate from Debug', 'wpcf7-redirect' ); ?></h3>
|
273 |
+
<textarea id="debug-info" style="width:100%;"></textarea>
|
274 |
+
<button class="reacreate-from-debug button button-primary"><?php _e( 'Recreate From Debug', 'wpcf7-redirect' ); ?></button>
|
275 |
+
<?php endif; ?>
|
276 |
+
</div>
|
277 |
+
</div>
|
278 |
+
</div>
|
279 |
+
</section>
|
280 |
+
<?php
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Create a section on the admin settings page
|
285 |
+
*/
|
286 |
+
public function section_callback( $arguments ) {
|
287 |
+
switch ( $arguments['id'] ) {
|
288 |
+
case 'serial_section':
|
289 |
+
echo sprintf( "In order to gain access to plugin updates, please enter your license key below. If you don't have a licence key, please <a href='%s' target='_blank'>click Here</a>.", $this->product_url );
|
290 |
+
break;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Add a link to the options page to the plugin description block.
|
296 |
+
*/
|
297 |
+
function register_plugin_links( $links, $file ) {
|
298 |
+
if ( WPCF7_PRO_REDIRECT_BASE_NAME === $file ) {
|
299 |
+
$links[] = WPCF7r_Utils::get_settings_link();
|
300 |
+
}
|
301 |
+
return $links;
|
302 |
+
}
|
303 |
+
}
|
classes/class-wpcf7r-updates.php
CHANGED
@@ -1,146 +1,146 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class Wpcf7r_Updates
|
4 |
-
* A class used for updating the plugin using th QS API
|
5 |
-
*/
|
6 |
-
|
7 |
-
defined( 'ABSPATH' ) || exit;
|
8 |
-
|
9 |
-
class Wpcf7r_Updates {
|
10 |
-
// Plugin current version
|
11 |
-
private $current_version;
|
12 |
-
|
13 |
-
// Plugin remote update path
|
14 |
-
private $update_url;
|
15 |
-
|
16 |
-
// Plugin Slug (plugin_directory/plugin_file.php)
|
17 |
-
private $plugin_slug;
|
18 |
-
|
19 |
-
// Plugin name (plugin_file)
|
20 |
-
private $slug;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Initialize a new instance of the WordPress Auto-Update class
|
24 |
-
*
|
25 |
-
* @param $current_version
|
26 |
-
* @param $plugin_slug
|
27 |
-
*/
|
28 |
-
public function __construct( $current_version, $plugin_slug ) {
|
29 |
-
// Set the class public variables
|
30 |
-
$this->current_version = $current_version;
|
31 |
-
$this->update_url = add_query_arg( 'update', '', WPCF7_PRO_REDIRECT_PLUGIN_UPDATES );
|
32 |
-
|
33 |
-
// Set the Plugin Slug
|
34 |
-
$this->plugin_slug = $plugin_slug;
|
35 |
-
list ($t1, $t2) = explode( '/', $plugin_slug );
|
36 |
-
$this->slug = str_replace( '.php', '', $t2 );
|
37 |
-
|
38 |
-
$this->activation_id = WPCF7r_Utils::get_activation_id();
|
39 |
-
$this->serial = WPCF7r_Utils::get_serial_key();
|
40 |
-
$this->domain = $_SERVER['HTTP_HOST'];
|
41 |
-
// define the alternative API for updating checking
|
42 |
-
add_filter( 'pre_set_site_transient_update_plugins', array( &$this, 'check_update' ) );
|
43 |
-
|
44 |
-
// Define the alternative response for information checking
|
45 |
-
add_filter( 'plugins_api', array( &$this, 'check_info' ), 10, 3 );
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Add our self-hosted autoupdate plugin to the filter transient
|
50 |
-
*
|
51 |
-
* @param $transient
|
52 |
-
* @return 'self-hosted' autoupdate plugin to the filter transient
|
53 |
-
*/
|
54 |
-
public function check_update( $transient ) {
|
55 |
-
|
56 |
-
if ( empty( $transient->checked ) ) {
|
57 |
-
return $transient;
|
58 |
-
}
|
59 |
-
|
60 |
-
// Get the remote version
|
61 |
-
$remote_version = $this->get_remote( 'version' );
|
62 |
-
|
63 |
-
if ( $remote_version && ! is_wp_error( $remote_version ) ) {
|
64 |
-
// If a newer version is available, add the update
|
65 |
-
if ( version_compare( $this->current_version, $remote_version->new_version, '<' ) ) {
|
66 |
-
$obj = new stdClass();
|
67 |
-
$obj->slug = $this->slug;
|
68 |
-
$obj->new_version = $remote_version->new_version;
|
69 |
-
$obj->url = $remote_version->url;
|
70 |
-
$obj->requires = $remote_version->requires;
|
71 |
-
$obj->plugin = $this->plugin_slug;
|
72 |
-
$obj->package = $remote_version->package;
|
73 |
-
$obj->tested = $remote_version->tested;
|
74 |
-
$transient->response[ $this->plugin_slug ] = $obj;
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
return $transient;
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Add our self-hosted description to the filter
|
83 |
-
*
|
84 |
-
* @param $false
|
85 |
-
* @param $action
|
86 |
-
* @param $arg
|
87 |
-
* @return bool|object
|
88 |
-
*/
|
89 |
-
public function check_info( $false, $action, $arg ) {
|
90 |
-
if ( ( 'query_plugins' === $action || 'plugin_information' === $action ) &&
|
91 |
-
isset( $arg->slug ) && $arg->slug === $this->slug ) {
|
92 |
-
|
93 |
-
$information = $this->get_remote( 'info' );
|
94 |
-
|
95 |
-
$information->sections = (array) $information->sections;
|
96 |
-
$information->banners = (array) $information->banners;
|
97 |
-
|
98 |
-
$array_pattern = array(
|
99 |
-
'/^([\*\s])*(\d\d\.\d\d\.\d\d\d\d[^\n]*)/m',
|
100 |
-
'/^\n+|^[\t\s]*\n+/m',
|
101 |
-
'/\n/',
|
102 |
-
);
|
103 |
-
$array_replace = array(
|
104 |
-
'<h4>$2</h4>',
|
105 |
-
'</div><div>',
|
106 |
-
'</div><div>',
|
107 |
-
);
|
108 |
-
|
109 |
-
$information->sections['changelog'] = '<div>' . preg_replace( $array_pattern, $array_replace, $information->sections['changelog'] ) . '</div>';
|
110 |
-
|
111 |
-
return $information;
|
112 |
-
}
|
113 |
-
|
114 |
-
return $false;
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Return the remote version
|
119 |
-
*
|
120 |
-
* @param $action
|
121 |
-
* @return string $remote_version
|
122 |
-
*/
|
123 |
-
public function get_remote( $action = '' ) {
|
124 |
-
|
125 |
-
$params = array(
|
126 |
-
'body' => array(
|
127 |
-
'action' => $action,
|
128 |
-
'activation_id' => $this->activation_id,
|
129 |
-
'serial' => $this->serial,
|
130 |
-
'plugin' => $this->plugin_slug,
|
131 |
-
'domain' => $this->domain,
|
132 |
-
),
|
133 |
-
);
|
134 |
-
|
135 |
-
// Make the POST request
|
136 |
-
$response = wp_remote_post( $this->update_url, $params );
|
137 |
-
|
138 |
-
// Check if response is valid
|
139 |
-
if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
|
140 |
-
$response = json_decode( wp_remote_retrieve_body( $response ) );
|
141 |
-
|
142 |
-
}
|
143 |
-
|
144 |
-
return $response;
|
145 |
-
}
|
146 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class Wpcf7r_Updates
|
4 |
+
* A class used for updating the plugin using th QS API
|
5 |
+
*/
|
6 |
+
|
7 |
+
defined( 'ABSPATH' ) || exit;
|
8 |
+
|
9 |
+
class Wpcf7r_Updates {
|
10 |
+
// Plugin current version
|
11 |
+
private $current_version;
|
12 |
+
|
13 |
+
// Plugin remote update path
|
14 |
+
private $update_url;
|
15 |
+
|
16 |
+
// Plugin Slug (plugin_directory/plugin_file.php)
|
17 |
+
private $plugin_slug;
|
18 |
+
|
19 |
+
// Plugin name (plugin_file)
|
20 |
+
private $slug;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Initialize a new instance of the WordPress Auto-Update class
|
24 |
+
*
|
25 |
+
* @param $current_version
|
26 |
+
* @param $plugin_slug
|
27 |
+
*/
|
28 |
+
public function __construct( $current_version, $plugin_slug ) {
|
29 |
+
// Set the class public variables
|
30 |
+
$this->current_version = $current_version;
|
31 |
+
$this->update_url = add_query_arg( 'update', '', WPCF7_PRO_REDIRECT_PLUGIN_UPDATES );
|
32 |
+
|
33 |
+
// Set the Plugin Slug
|
34 |
+
$this->plugin_slug = $plugin_slug;
|
35 |
+
list ($t1, $t2) = explode( '/', $plugin_slug );
|
36 |
+
$this->slug = str_replace( '.php', '', $t2 );
|
37 |
+
|
38 |
+
$this->activation_id = WPCF7r_Utils::get_activation_id();
|
39 |
+
$this->serial = WPCF7r_Utils::get_serial_key();
|
40 |
+
$this->domain = $_SERVER['HTTP_HOST'];
|
41 |
+
// define the alternative API for updating checking
|
42 |
+
add_filter( 'pre_set_site_transient_update_plugins', array( &$this, 'check_update' ) );
|
43 |
+
|
44 |
+
// Define the alternative response for information checking
|
45 |
+
add_filter( 'plugins_api', array( &$this, 'check_info' ), 10, 3 );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Add our self-hosted autoupdate plugin to the filter transient
|
50 |
+
*
|
51 |
+
* @param $transient
|
52 |
+
* @return 'self-hosted' autoupdate plugin to the filter transient
|
53 |
+
*/
|
54 |
+
public function check_update( $transient ) {
|
55 |
+
|
56 |
+
if ( empty( $transient->checked ) ) {
|
57 |
+
return $transient;
|
58 |
+
}
|
59 |
+
|
60 |
+
// Get the remote version
|
61 |
+
$remote_version = $this->get_remote( 'version' );
|
62 |
+
|
63 |
+
if ( $remote_version && ! is_wp_error( $remote_version ) ) {
|
64 |
+
// If a newer version is available, add the update
|
65 |
+
if ( version_compare( $this->current_version, $remote_version->new_version, '<' ) ) {
|
66 |
+
$obj = new stdClass();
|
67 |
+
$obj->slug = $this->slug;
|
68 |
+
$obj->new_version = $remote_version->new_version;
|
69 |
+
$obj->url = $remote_version->url;
|
70 |
+
$obj->requires = $remote_version->requires;
|
71 |
+
$obj->plugin = $this->plugin_slug;
|
72 |
+
$obj->package = $remote_version->package;
|
73 |
+
$obj->tested = $remote_version->tested;
|
74 |
+
$transient->response[ $this->plugin_slug ] = $obj;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
return $transient;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Add our self-hosted description to the filter
|
83 |
+
*
|
84 |
+
* @param $false
|
85 |
+
* @param $action
|
86 |
+
* @param $arg
|
87 |
+
* @return bool|object
|
88 |
+
*/
|
89 |
+
public function check_info( $false, $action, $arg ) {
|
90 |
+
if ( ( 'query_plugins' === $action || 'plugin_information' === $action ) &&
|
91 |
+
isset( $arg->slug ) && $arg->slug === $this->slug ) {
|
92 |
+
|
93 |
+
$information = $this->get_remote( 'info' );
|
94 |
+
|
95 |
+
$information->sections = (array) $information->sections;
|
96 |
+
$information->banners = (array) $information->banners;
|
97 |
+
|
98 |
+
$array_pattern = array(
|
99 |
+
'/^([\*\s])*(\d\d\.\d\d\.\d\d\d\d[^\n]*)/m',
|
100 |
+
'/^\n+|^[\t\s]*\n+/m',
|
101 |
+
'/\n/',
|
102 |
+
);
|
103 |
+
$array_replace = array(
|
104 |
+
'<h4>$2</h4>',
|
105 |
+
'</div><div>',
|
106 |
+
'</div><div>',
|
107 |
+
);
|
108 |
+
|
109 |
+
$information->sections['changelog'] = '<div>' . preg_replace( $array_pattern, $array_replace, $information->sections['changelog'] ) . '</div>';
|
110 |
+
|
111 |
+
return $information;
|
112 |
+
}
|
113 |
+
|
114 |
+
return $false;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Return the remote version
|
119 |
+
*
|
120 |
+
* @param $action
|
121 |
+
* @return string $remote_version
|
122 |
+
*/
|
123 |
+
public function get_remote( $action = '' ) {
|
124 |
+
|
125 |
+
$params = array(
|
126 |
+
'body' => array(
|
127 |
+
'action' => $action,
|
128 |
+
'activation_id' => $this->activation_id,
|
129 |
+
'serial' => $this->serial,
|
130 |
+
'plugin' => $this->plugin_slug,
|
131 |
+
'domain' => $this->domain,
|
132 |
+
),
|
133 |
+
);
|
134 |
+
|
135 |
+
// Make the POST request
|
136 |
+
$response = wp_remote_post( $this->update_url, $params );
|
137 |
+
|
138 |
+
// Check if response is valid
|
139 |
+
if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
|
140 |
+
$response = json_decode( wp_remote_retrieve_body( $response ) );
|
141 |
+
|
142 |
+
}
|
143 |
+
|
144 |
+
return $response;
|
145 |
+
}
|
146 |
+
}
|
classes/class-wpcf7r-user.php
CHANGED
@@ -1,117 +1,117 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7R_user - Parent class that handles all redirect actions.
|
4 |
-
*/
|
5 |
-
defined( 'ABSPATH' ) || exit;
|
6 |
-
|
7 |
-
class WPCF7R_User {
|
8 |
-
|
9 |
-
public function __construct() {
|
10 |
-
add_action( 'show_user_profile', array( $this, 'additional_profile_fields' ) );
|
11 |
-
add_action( 'edit_user_profile', array( $this, 'additional_profile_fields' ) );
|
12 |
-
|
13 |
-
add_action( 'personal_options_update', array( $this, 'save_custom_user_fields' ) );
|
14 |
-
add_action( 'edit_user_profile_update', array( $this, 'save_custom_user_fields' ) );
|
15 |
-
|
16 |
-
}
|
17 |
-
|
18 |
-
private function get_all_forms_fields() {
|
19 |
-
$this->fields = array();
|
20 |
-
|
21 |
-
$cf7_forms = $this->get_cf7_forms();
|
22 |
-
|
23 |
-
if ( $cf7_forms ) {
|
24 |
-
foreach ( $cf7_forms as $cf7_form ) {
|
25 |
-
$wpcf7r_form = get_cf7r_form( $cf7_form->ID );
|
26 |
-
|
27 |
-
$actions = $wpcf7r_form->get_actions( 'default' );
|
28 |
-
|
29 |
-
foreach ( $actions as $action ) {
|
30 |
-
$action_type = $action->get( 'action_type' );
|
31 |
-
if ( 'register' === $action_type ) {
|
32 |
-
|
33 |
-
$fields_mapping = maybe_unserialize( $action->get( 'user_fields' ) );
|
34 |
-
|
35 |
-
if ( $fields_mapping ) {
|
36 |
-
$this->fields = array_merge( $fields_mapping, $this->fields );
|
37 |
-
}
|
38 |
-
}
|
39 |
-
}
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
return $this->fields;
|
44 |
-
}
|
45 |
-
|
46 |
-
private function get_cf7_forms() {
|
47 |
-
$args = array(
|
48 |
-
'post_type' => 'wpcf7_contact_form',
|
49 |
-
'posts_per_page' => -1,
|
50 |
-
);
|
51 |
-
|
52 |
-
$cf7_forms = get_posts( $args );
|
53 |
-
|
54 |
-
return $cf7_forms;
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Add new fields above 'Update' button.
|
59 |
-
*
|
60 |
-
* @param $user_id
|
61 |
-
*/
|
62 |
-
public function save_custom_user_fields( $user_id ) {
|
63 |
-
|
64 |
-
if ( ! current_user_can( 'edit_user', $user_id ) ) {
|
65 |
-
return false;
|
66 |
-
}
|
67 |
-
|
68 |
-
$fields = $this->get_all_forms_fields();
|
69 |
-
|
70 |
-
if ( ! $fields ) {
|
71 |
-
return;
|
72 |
-
}
|
73 |
-
|
74 |
-
foreach ( $fields as $field ) {
|
75 |
-
$value = isset( $_POST[ $field['user_field_key'] ] ) ? $_POST[ $field['user_field_key'] ] : '';
|
76 |
-
update_user_meta( $user_id, $field['user_field_key'], $value );
|
77 |
-
}
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Add new fields above 'Update' button.
|
82 |
-
*
|
83 |
-
* @param WP_User $user User object.
|
84 |
-
*/
|
85 |
-
public function additional_profile_fields( $user ) {
|
86 |
-
|
87 |
-
$fields = $this->get_all_forms_fields();
|
88 |
-
|
89 |
-
if ( ! $fields ) {
|
90 |
-
return;
|
91 |
-
}
|
92 |
-
|
93 |
-
?>
|
94 |
-
|
95 |
-
<h3><?php _e( 'Extra profile information', 'wpcf7-redirect' ); ?></h3>
|
96 |
-
|
97 |
-
<table class="form-table">
|
98 |
-
<?php foreach ( $fields as $field ) : ?>
|
99 |
-
<?php
|
100 |
-
if ( ! $field['user_field_key'] ) {
|
101 |
-
continue;}
|
102 |
-
?>
|
103 |
-
<?php $value = get_user_meta( $user->ID, $field['user_field_key'], true ); ?>
|
104 |
-
<tr>
|
105 |
-
<th>
|
106 |
-
<label for="<?php echo $field['user_field_key']; ?>"><?php echo $field['user_field_key']; ?></label>
|
107 |
-
</th>
|
108 |
-
<td>
|
109 |
-
<input type="text" name="<?php echo $field['user_field_key']; ?>" value="<?php echo $value; ?>">
|
110 |
-
</td>
|
111 |
-
</tr>
|
112 |
-
<?php endforeach; ?>
|
113 |
-
</table>
|
114 |
-
<?php
|
115 |
-
}
|
116 |
-
|
117 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7R_user - Parent class that handles all redirect actions.
|
4 |
+
*/
|
5 |
+
defined( 'ABSPATH' ) || exit;
|
6 |
+
|
7 |
+
class WPCF7R_User {
|
8 |
+
|
9 |
+
public function __construct() {
|
10 |
+
add_action( 'show_user_profile', array( $this, 'additional_profile_fields' ) );
|
11 |
+
add_action( 'edit_user_profile', array( $this, 'additional_profile_fields' ) );
|
12 |
+
|
13 |
+
add_action( 'personal_options_update', array( $this, 'save_custom_user_fields' ) );
|
14 |
+
add_action( 'edit_user_profile_update', array( $this, 'save_custom_user_fields' ) );
|
15 |
+
|
16 |
+
}
|
17 |
+
|
18 |
+
private function get_all_forms_fields() {
|
19 |
+
$this->fields = array();
|
20 |
+
|
21 |
+
$cf7_forms = $this->get_cf7_forms();
|
22 |
+
|
23 |
+
if ( $cf7_forms ) {
|
24 |
+
foreach ( $cf7_forms as $cf7_form ) {
|
25 |
+
$wpcf7r_form = get_cf7r_form( $cf7_form->ID );
|
26 |
+
|
27 |
+
$actions = $wpcf7r_form->get_actions( 'default' );
|
28 |
+
|
29 |
+
foreach ( $actions as $action ) {
|
30 |
+
$action_type = $action->get( 'action_type' );
|
31 |
+
if ( 'register' === $action_type ) {
|
32 |
+
|
33 |
+
$fields_mapping = maybe_unserialize( $action->get( 'user_fields' ) );
|
34 |
+
|
35 |
+
if ( $fields_mapping ) {
|
36 |
+
$this->fields = array_merge( $fields_mapping, $this->fields );
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
return $this->fields;
|
44 |
+
}
|
45 |
+
|
46 |
+
private function get_cf7_forms() {
|
47 |
+
$args = array(
|
48 |
+
'post_type' => 'wpcf7_contact_form',
|
49 |
+
'posts_per_page' => -1,
|
50 |
+
);
|
51 |
+
|
52 |
+
$cf7_forms = get_posts( $args );
|
53 |
+
|
54 |
+
return $cf7_forms;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Add new fields above 'Update' button.
|
59 |
+
*
|
60 |
+
* @param $user_id
|
61 |
+
*/
|
62 |
+
public function save_custom_user_fields( $user_id ) {
|
63 |
+
|
64 |
+
if ( ! current_user_can( 'edit_user', $user_id ) ) {
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
|
68 |
+
$fields = $this->get_all_forms_fields();
|
69 |
+
|
70 |
+
if ( ! $fields ) {
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
|
74 |
+
foreach ( $fields as $field ) {
|
75 |
+
$value = isset( $_POST[ $field['user_field_key'] ] ) ? $_POST[ $field['user_field_key'] ] : '';
|
76 |
+
update_user_meta( $user_id, $field['user_field_key'], $value );
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Add new fields above 'Update' button.
|
82 |
+
*
|
83 |
+
* @param WP_User $user User object.
|
84 |
+
*/
|
85 |
+
public function additional_profile_fields( $user ) {
|
86 |
+
|
87 |
+
$fields = $this->get_all_forms_fields();
|
88 |
+
|
89 |
+
if ( ! $fields ) {
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
|
93 |
+
?>
|
94 |
+
|
95 |
+
<h3><?php _e( 'Extra profile information', 'wpcf7-redirect' ); ?></h3>
|
96 |
+
|
97 |
+
<table class="form-table">
|
98 |
+
<?php foreach ( $fields as $field ) : ?>
|
99 |
+
<?php
|
100 |
+
if ( ! $field['user_field_key'] ) {
|
101 |
+
continue;}
|
102 |
+
?>
|
103 |
+
<?php $value = get_user_meta( $user->ID, $field['user_field_key'], true ); ?>
|
104 |
+
<tr>
|
105 |
+
<th>
|
106 |
+
<label for="<?php echo $field['user_field_key']; ?>"><?php echo $field['user_field_key']; ?></label>
|
107 |
+
</th>
|
108 |
+
<td>
|
109 |
+
<input type="text" name="<?php echo $field['user_field_key']; ?>" value="<?php echo $value; ?>">
|
110 |
+
</td>
|
111 |
+
</tr>
|
112 |
+
<?php endforeach; ?>
|
113 |
+
</table>
|
114 |
+
<?php
|
115 |
+
}
|
116 |
+
|
117 |
+
}
|
classes/class-wpcf7r-utils.php
CHANGED
@@ -1,1080 +1,1080 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class WPCF7r_Utils file.
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Contact form 7 redirect utilities
|
10 |
-
*/
|
11 |
-
class WPCF7r_Utils {
|
12 |
-
public $banner_version = 1.01;
|
13 |
-
public static $instance;
|
14 |
-
public static $actions_list = array();
|
15 |
-
public static $rendered_elements = array();
|
16 |
-
|
17 |
-
public function __construct() {
|
18 |
-
self::$instance = $this;
|
19 |
-
|
20 |
-
$this->api = new Qs_Api();
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Add a message to the session collector
|
25 |
-
*
|
26 |
-
* @param $type
|
27 |
-
* @param $message
|
28 |
-
*/
|
29 |
-
public static function add_admin_notice( $type, $message ) {
|
30 |
-
$_SESSION['wpcf7r_admin_notices'][ $type ] = $message;
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Register a new type of action
|
35 |
-
*
|
36 |
-
* @param $name
|
37 |
-
* @param $title
|
38 |
-
* @param $class
|
39 |
-
*/
|
40 |
-
public static function register_wpcf7r_actions( $name, $title, $class, $order ) {
|
41 |
-
self::$actions_list[ $name ] = array(
|
42 |
-
'label' => $title,
|
43 |
-
'attr' => '',
|
44 |
-
'handler' => $class,
|
45 |
-
'order' => $order,
|
46 |
-
);
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Get action name
|
51 |
-
*
|
52 |
-
* @param $action_type
|
53 |
-
*/
|
54 |
-
public static function get_action_name( $action_type ) {
|
55 |
-
return isset( self::$actions_list[ $action_type ] ) ? self::$actions_list[ $action_type ]['label'] : $action_type;
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Get the available actions
|
60 |
-
*/
|
61 |
-
public static function get_wpcf7r_actions() {
|
62 |
-
return self::$actions_list;
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Duplicate all action posts and connect it to the new created form
|
67 |
-
*
|
68 |
-
* @param $new_cf7
|
69 |
-
*/
|
70 |
-
public function duplicate_form_support( $new_cf7 ) {
|
71 |
-
|
72 |
-
if ( isset( $_POST['wpcf7-copy'] ) && 'Duplicate' === $_POST['wpcf7-copy'] || ( isset( $_GET['action'] ) && 'copy' === $_GET['action'] ) ) {
|
73 |
-
|
74 |
-
$original_post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : (int) $_GET['post'];
|
75 |
-
|
76 |
-
$original_cf7 = get_cf7r_form( $original_post_id );
|
77 |
-
|
78 |
-
$original_action_posts = $original_cf7->get_actions( 'default' );
|
79 |
-
|
80 |
-
if ( $original_action_posts ) {
|
81 |
-
foreach ( $original_action_posts as $original_action_post ) {
|
82 |
-
$new_post_id = $this->duplicate_post( $original_action_post->action_post );
|
83 |
-
|
84 |
-
update_post_meta( $new_post_id, 'wpcf7_id', $new_cf7->id() );
|
85 |
-
}
|
86 |
-
}
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* After form deletion delete all its actions
|
92 |
-
*
|
93 |
-
* @param int $post_id
|
94 |
-
*/
|
95 |
-
public function delete_all_form_actions( $post_id ) {
|
96 |
-
global $post_type;
|
97 |
-
|
98 |
-
if ( get_post_type( $post_id ) === 'wpcf7_contact_form' ) {
|
99 |
-
|
100 |
-
$wpcf7r = get_cf7r_form( $post_id );
|
101 |
-
|
102 |
-
$action_posts = $wpcf7r->get_actions( 'default' );
|
103 |
-
|
104 |
-
if ( $action_posts ) {
|
105 |
-
foreach ( $action_posts as $action_post ) {
|
106 |
-
wp_delete_post( $action_post->get_id() );
|
107 |
-
}
|
108 |
-
}
|
109 |
-
};
|
110 |
-
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Dupplicate contact form and all its actions
|
115 |
-
*
|
116 |
-
* @param $action
|
117 |
-
*/
|
118 |
-
public function duplicate_post( $action ) {
|
119 |
-
global $wpdb;
|
120 |
-
|
121 |
-
// if you don't want current user to be the new post author,
|
122 |
-
// then change next couple of lines to this: $new_post_author = $post->post_author;
|
123 |
-
$current_user = wp_get_current_user();
|
124 |
-
$new_post_author = $current_user->ID;
|
125 |
-
$post_id = $action->ID;
|
126 |
-
|
127 |
-
// if post data exists, create the post duplicate
|
128 |
-
if ( isset( $action ) && null !== $action ) {
|
129 |
-
// new post data array
|
130 |
-
$args = array(
|
131 |
-
'comment_status' => $action->comment_status,
|
132 |
-
'ping_status' => $action->ping_status,
|
133 |
-
'post_author' => $new_post_author,
|
134 |
-
'post_content' => $action->post_content,
|
135 |
-
'post_excerpt' => $action->post_excerpt,
|
136 |
-
'post_name' => $action->post_name,
|
137 |
-
'post_parent' => $action->post_parent,
|
138 |
-
'post_password' => $action->post_password,
|
139 |
-
'post_status' => 'private',
|
140 |
-
'post_title' => $action->post_title,
|
141 |
-
'post_type' => $action->post_type,
|
142 |
-
'to_ping' => $action->to_ping,
|
143 |
-
'menu_order' => $action->menu_order,
|
144 |
-
);
|
145 |
-
|
146 |
-
// insert the post by wp_insert_post() function
|
147 |
-
$new_post_id = wp_insert_post( $args );
|
148 |
-
|
149 |
-
// get all current post terms ad set them to the new post draft
|
150 |
-
$taxonomies = get_object_taxonomies( $action->post_type );
|
151 |
-
|
152 |
-
// returns array of taxonomy names for post type, ex array("category", "post_tag");
|
153 |
-
if ( $taxonomies ) {
|
154 |
-
foreach ( $taxonomies as $taxonomy ) {
|
155 |
-
$post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
|
156 |
-
wp_set_object_terms( $new_post_id, $post_terms, $taxonomy, false );
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
// duplicate all post meta just in two SQL queries
|
161 |
-
$sql = $wpdb->prepare( "SELECT meta_key, meta_value FROM {$wpdb->postmeta} WHERE post_id='%s'", $post_id );
|
162 |
-
|
163 |
-
$post_meta_infos = $wpdb->get_results( $sql );
|
164 |
-
|
165 |
-
if ( count( $post_meta_infos ) !== 0 ) {
|
166 |
-
$sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
|
167 |
-
|
168 |
-
foreach ( $post_meta_infos as $meta_info ) {
|
169 |
-
$meta_key = $meta_info->meta_key;
|
170 |
-
if ( '_wp_old_slug' === $meta_key ) {
|
171 |
-
continue;
|
172 |
-
}
|
173 |
-
$meta_value = addslashes( $meta_info->meta_value );
|
174 |
-
$sql_query_sel[] = "SELECT $new_post_id, '$meta_key', '$meta_value'";
|
175 |
-
}
|
176 |
-
|
177 |
-
$sql_query .= implode( ' UNION ALL ', $sql_query_sel );
|
178 |
-
|
179 |
-
$wpdb->query( $sql_query );
|
180 |
-
}
|
181 |
-
|
182 |
-
return $new_post_id;
|
183 |
-
}
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Set actions order
|
188 |
-
*/
|
189 |
-
public function set_action_menu_order() {
|
190 |
-
global $wpdb;
|
191 |
-
|
192 |
-
parse_str( $_POST['data']['order'], $data );
|
193 |
-
|
194 |
-
if ( ! is_array( $data ) ) {
|
195 |
-
return false;
|
196 |
-
}
|
197 |
-
|
198 |
-
// get objects per now page
|
199 |
-
$id_arr = array();
|
200 |
-
foreach ( $data as $key => $values ) {
|
201 |
-
foreach ( $values as $position => $id ) {
|
202 |
-
$id_arr[] = $id;
|
203 |
-
}
|
204 |
-
}
|
205 |
-
|
206 |
-
foreach ( $id_arr as $key => $post_id ) {
|
207 |
-
$menu_order = $key + 1;
|
208 |
-
$wpdb->update( $wpdb->posts, array( 'menu_order' => $menu_order ), array( 'ID' => intval( $post_id ) ) );
|
209 |
-
}
|
210 |
-
}
|
211 |
-
|
212 |
-
/**
|
213 |
-
* Render elements required by actions
|
214 |
-
*
|
215 |
-
* @return void
|
216 |
-
*/
|
217 |
-
public function render_actions_elements( $properties, $form ) {
|
218 |
-
|
219 |
-
$action_posts = wpcf7r_get_actions( 'wpcf7r_action', -1, $form->id(), 'default', array(), true );
|
220 |
-
|
221 |
-
if ( $action_posts ) {
|
222 |
-
foreach ( $action_posts as $action_post ) {
|
223 |
-
$action = WPCF7R_Action::get_action( $action_post );
|
224 |
-
|
225 |
-
if ( ! isset( self::$rendered_elements[ $action_post->ID ] ) ) {
|
226 |
-
// these actions will run once.
|
227 |
-
if ( is_object( $action ) && ! is_wp_error( $action ) && method_exists( $action, 'render_callback_once' ) ) {
|
228 |
-
$properties = $action->render_callback_once( $properties, $form );
|
229 |
-
}
|
230 |
-
|
231 |
-
self::$rendered_elements[ $action_post->ID ] = $action_post->ID;
|
232 |
-
}
|
233 |
-
|
234 |
-
// Render_callback will be called several times because of the way contact form 7 uses these properties.
|
235 |
-
// use state and db on the action to limit it to run only once.
|
236 |
-
if ( is_object( $action ) && ! is_wp_error( $action ) && method_exists( $action, 'render_callback' ) ) {
|
237 |
-
$properties = $action->render_callback( $properties, $form );
|
238 |
-
}
|
239 |
-
}
|
240 |
-
}
|
241 |
-
|
242 |
-
return $properties;
|
243 |
-
}
|
244 |
-
/**
|
245 |
-
* Delete an action
|
246 |
-
*/
|
247 |
-
public function delete_action_post() {
|
248 |
-
$data = isset( $_POST['data'] ) ? $_POST['data'] : '';
|
249 |
-
|
250 |
-
$response['status'] = 'failed';
|
251 |
-
|
252 |
-
if ( $data ) {
|
253 |
-
foreach ( $data as $post_to_delete ) {
|
254 |
-
if ( $post_to_delete ) {
|
255 |
-
wp_trash_post( $post_to_delete['post_id'] );
|
256 |
-
$response['status'] = 'deleted';
|
257 |
-
}
|
258 |
-
}
|
259 |
-
}
|
260 |
-
|
261 |
-
wp_send_json( $response );
|
262 |
-
}
|
263 |
-
|
264 |
-
/**
|
265 |
-
* Show notices on admin panel
|
266 |
-
*/
|
267 |
-
public function show_admin_notices() {
|
268 |
-
global $wp_sessions;
|
269 |
-
|
270 |
-
if ( ! isset( $_SESSION['wpcf7r_admin_notices'] ) ) {
|
271 |
-
return;
|
272 |
-
}
|
273 |
-
|
274 |
-
foreach ( $_SESSION['wpcf7r_admin_notices'] as $notice_type => $notice ) :
|
275 |
-
?>
|
276 |
-
|
277 |
-
<div class="notice notice-error is-dismissible <?php echo $notice_type; ?>">
|
278 |
-
<p><?php echo $notice; ?></p>
|
279 |
-
</div>
|
280 |
-
|
281 |
-
<?php
|
282 |
-
endforeach;
|
283 |
-
}
|
284 |
-
|
285 |
-
/**
|
286 |
-
* Send debug data to querysol support api
|
287 |
-
*
|
288 |
-
* @return void
|
289 |
-
*/
|
290 |
-
public function send_debug_info() {
|
291 |
-
$data = isset( $_POST['data'] ) ? $_POST['data'] : '';
|
292 |
-
|
293 |
-
if ( $data['form_id'] ) {
|
294 |
-
$debug_data = WPCF7r_Form_Helper::get_debug_data( $data['form_id'] );
|
295 |
-
|
296 |
-
$api = new Qs_Api();
|
297 |
-
|
298 |
-
$args = array(
|
299 |
-
'headers' => array( 'Content-Type' => 'application/json; charset=utf-8' ),
|
300 |
-
);
|
301 |
-
|
302 |
-
$url = add_query_arg( 'site_url', home_url(), WPCF7_PRO_REDIRECT_DEBUG_URL );
|
303 |
-
|
304 |
-
$api->api_call( $url, json_encode( array( 'debug_data' => $debug_data ) ), $args );
|
305 |
-
}
|
306 |
-
|
307 |
-
wp_send_json_success();
|
308 |
-
}
|
309 |
-
/**
|
310 |
-
* Auto function to migrate old plugin to the new one
|
311 |
-
*
|
312 |
-
* @param $migration_action migrate_from_cf7_redirect/migrate_from_cf7_api
|
313 |
-
* @param boolean $force
|
314 |
-
*/
|
315 |
-
public static function auto_migrate( $migration_action, $force = false ) {
|
316 |
-
|
317 |
-
$instance = self::get_instance();
|
318 |
-
|
319 |
-
$cf7_forms = self::get_all_cf7_forms();
|
320 |
-
|
321 |
-
foreach ( $cf7_forms as $cf7_form_id ) {
|
322 |
-
|
323 |
-
$cf7r_form = new WPCF7R_Form( $cf7_form_id );
|
324 |
-
|
325 |
-
$instance->delete_all_form_actions( $cf7_form_id );
|
326 |
-
|
327 |
-
if ( ! $cf7r_form->has_migrated( $migration_action ) || $force ) {
|
328 |
-
$instance->convert_to_action( $cf7r_form, $migration_action, $cf7_form_id, 'default' );
|
329 |
-
|
330 |
-
$cf7r_form->update_migration( $migration_action );
|
331 |
-
}
|
332 |
-
}
|
333 |
-
}
|
334 |
-
|
335 |
-
/**
|
336 |
-
* Create form and actions based on debug info
|
337 |
-
*
|
338 |
-
* @return void
|
339 |
-
*/
|
340 |
-
public function import_from_debug() {
|
341 |
-
$data = isset( $_POST['data'] ) && $_POST['data'] ? $_POST['data'] : '';
|
342 |
-
|
343 |
-
if ( $data ) {
|
344 |
-
$formdata = unserialize( base64_decode( $data['debug_info'] ) );
|
345 |
-
|
346 |
-
$this->install_plugins( json_decode( $formdata['plugins'] ) );
|
347 |
-
|
348 |
-
$form_id = $this->import_form( $formdata );
|
349 |
-
|
350 |
-
$this->import_actions( $form_id, $formdata['actions'] );
|
351 |
-
|
352 |
-
}
|
353 |
-
}
|
354 |
-
|
355 |
-
/**
|
356 |
-
* Import actions to post
|
357 |
-
*
|
358 |
-
* @return void
|
359 |
-
*/
|
360 |
-
private function import_actions( $form_id, $actions ) {
|
361 |
-
foreach ( $actions as $action ) {
|
362 |
-
$post = (array) $action->action_post;
|
363 |
-
unset( $post['ID'] );
|
364 |
-
|
365 |
-
$post_id = wp_insert_post( $post );
|
366 |
-
|
367 |
-
foreach ( $action->fields_values as $meta_key => $meta_values ) {
|
368 |
-
if ( 'wpcf7_id' === $meta_key ) {
|
369 |
-
continue;
|
370 |
-
}
|
371 |
-
foreach ( $meta_values as $meta_value ) {
|
372 |
-
add_post_meta( $post_id, $meta_key, maybe_unserialize( $meta_value ) );
|
373 |
-
}
|
374 |
-
}
|
375 |
-
|
376 |
-
update_post_meta( $post_id, 'wpcf7_id', $form_id );
|
377 |
-
|
378 |
-
}
|
379 |
-
}
|
380 |
-
/**
|
381 |
-
* Import form from debug info
|
382 |
-
*
|
383 |
-
* @return void
|
384 |
-
*/
|
385 |
-
private function import_form( $formdata ) {
|
386 |
-
|
387 |
-
$new_form_post = (array) $formdata['form_post'];
|
388 |
-
|
389 |
-
unset( $new_form_post['ID'] );
|
390 |
-
|
391 |
-
$form_id = wp_insert_post( $new_form_post );
|
392 |
-
|
393 |
-
foreach ( $formdata['form_meta'] as $meta_key => $meta_values ) {
|
394 |
-
foreach ( $meta_values as $meta_value ) {
|
395 |
-
add_post_meta( $form_id, $meta_key, maybe_unserialize( $meta_value ) );
|
396 |
-
}
|
397 |
-
}
|
398 |
-
|
399 |
-
return $form_id;
|
400 |
-
}
|
401 |
-
/**
|
402 |
-
* Install a list of plugins
|
403 |
-
*
|
404 |
-
* @return void
|
405 |
-
*/
|
406 |
-
private function install_plugins( $plugins ) {
|
407 |
-
|
408 |
-
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
409 |
-
include_once ABSPATH . 'wp-admin/includes/file.php';
|
410 |
-
include_once ABSPATH . 'wp-admin/includes/misc.php';
|
411 |
-
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
412 |
-
|
413 |
-
$results = array();
|
414 |
-
|
415 |
-
foreach ( $plugins as $slug => $plugin ) {
|
416 |
-
|
417 |
-
if ( ! is_plugin_active( $slug ) ) {
|
418 |
-
$results[ $slug ] = $this->install_plugin( $slug );
|
419 |
-
}
|
420 |
-
}
|
421 |
-
|
422 |
-
return $results;
|
423 |
-
}
|
424 |
-
|
425 |
-
/**
|
426 |
-
* Install and activate a plugin
|
427 |
-
*
|
428 |
-
* @return void
|
429 |
-
*/
|
430 |
-
public function install_plugin( $plugin_slug ) {
|
431 |
-
|
432 |
-
$api = plugins_api(
|
433 |
-
'plugin_information',
|
434 |
-
array(
|
435 |
-
'slug' => basename( $plugin_slug, '.php' ),
|
436 |
-
'fields' => array(
|
437 |
-
'short_description' => false,
|
438 |
-
'sections' => false,
|
439 |
-
'requires' => false,
|
440 |
-
'rating' => false,
|
441 |
-
'ratings' => false,
|
442 |
-
'downloaded' => false,
|
443 |
-
'last_updated' => false,
|
444 |
-
'added' => false,
|
445 |
-
'tags' => false,
|
446 |
-
'compatibility' => false,
|
447 |
-
'homepage' => false,
|
448 |
-
'donate_link' => false,
|
449 |
-
),
|
450 |
-
)
|
451 |
-
);
|
452 |
-
|
453 |
-
if ( ! is_wp_error( $api ) ) {
|
454 |
-
$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact( 'title', 'url', 'nonce', 'plugin', 'api' ) ) );
|
455 |
-
|
456 |
-
$upgrader->install( $api->download_link );
|
457 |
-
|
458 |
-
if ( ! is_wp_error( $upgrader->skin->api ) ) {
|
459 |
-
return activate_plugin( $plugin_slug );
|
460 |
-
} else {
|
461 |
-
return $upgrader->skin->api;
|
462 |
-
}
|
463 |
-
} else {
|
464 |
-
return $api;
|
465 |
-
}
|
466 |
-
|
467 |
-
}
|
468 |
-
|
469 |
-
/**
|
470 |
-
* Get all Contact Forms 7 forms
|
471 |
-
*/
|
472 |
-
public static function get_all_cf7_forms() {
|
473 |
-
$args = array(
|
474 |
-
'post_type' => 'wpcf7_contact_form',
|
475 |
-
'posts_per_page' => -1,
|
476 |
-
'fields' => 'ids',
|
477 |
-
'suppress_filters' => true,
|
478 |
-
);
|
479 |
-
|
480 |
-
$cf7_forms = get_posts( $args );
|
481 |
-
|
482 |
-
return $cf7_forms;
|
483 |
-
}
|
484 |
-
|
485 |
-
/**
|
486 |
-
* Duplicate an existing action and connect it with the form.
|
487 |
-
*
|
488 |
-
* @return void
|
489 |
-
*/
|
490 |
-
public function duplicate_action() {
|
491 |
-
$results['action_row'] = '';
|
492 |
-
|
493 |
-
if ( isset( $_POST['data'] ) ) {
|
494 |
-
$action_data = $_POST['data'];
|
495 |
-
|
496 |
-
$action_post_id = $action_data['post_id'];
|
497 |
-
|
498 |
-
$action_post = get_post( $action_post_id );
|
499 |
-
|
500 |
-
$new_action_post_id = $this->duplicate_post( $action_post );
|
501 |
-
|
502 |
-
update_post_meta( $new_action_post_id, 'wpcf7_id', $action_data['form_id'] );
|
503 |
-
|
504 |
-
$action = WPCF7R_Action::get_action( $new_action_post_id );
|
505 |
-
|
506 |
-
$results['action_row'] = $action->get_action_row();
|
507 |
-
}
|
508 |
-
|
509 |
-
wp_send_json( $results );
|
510 |
-
}
|
511 |
-
/**
|
512 |
-
* Create a new action post
|
513 |
-
*/
|
514 |
-
public function add_action_post() {
|
515 |
-
$results['action_row'] = '';
|
516 |
-
|
517 |
-
$post_id = isset( $_POST['data']['post_id'] ) ? (int) sanitize_text_field( $_POST['data']['post_id'] ) : '';
|
518 |
-
$rule_id = isset( $_POST['data']['rule_id'] ) ? sanitize_text_field( $_POST['data']['rule_id'] ) : '';
|
519 |
-
$action_type = isset( $_POST['data']['action_type'] ) ? sanitize_text_field( $_POST['data']['action_type'] ) : '';
|
520 |
-
|
521 |
-
$rule_name = __( 'New Action', 'wpcf7-redirect' );
|
522 |
-
|
523 |
-
$this->cf7r_form = get_cf7r_form( $post_id );
|
524 |
-
|
525 |
-
$actions = array();
|
526 |
-
|
527 |
-
// migrate from old api plugin
|
528 |
-
if ( 'migrate_from_cf7_api' === $action_type || 'migrate_from_cf7_redirect' === $action_type ) {
|
529 |
-
if ( ! $this->cf7r_form->has_migrated( $action_type ) ) {
|
530 |
-
$actions = $this->convert_to_action( $action_type, $post_id, $rule_name, $rule_id );
|
531 |
-
$this->cf7r_form->update_migration( $action_type );
|
532 |
-
}
|
533 |
-
} else {
|
534 |
-
$actions[] = $this->create_action( $post_id, $rule_name, $rule_id, $action_type );
|
535 |
-
}
|
536 |
-
|
537 |
-
if ( $actions ) {
|
538 |
-
foreach ( $actions as $action ) {
|
539 |
-
if ( ! is_wp_error( $action ) ) {
|
540 |
-
$results['action_row'] .= $action->get_action_row();
|
541 |
-
} else {
|
542 |
-
wp_send_json( $results );
|
543 |
-
}
|
544 |
-
}
|
545 |
-
} else {
|
546 |
-
$results['action_row'] = '';
|
547 |
-
}
|
548 |
-
|
549 |
-
wp_send_json( $results );
|
550 |
-
}
|
551 |
-
|
552 |
-
/**
|
553 |
-
* Convert old plugin data to new structure
|
554 |
-
*
|
555 |
-
* @param $required_conversion
|
556 |
-
* @param $post_id
|
557 |
-
* @param $rule_name
|
558 |
-
* @param $rule_id
|
559 |
-
* @return Actions
|
560 |
-
*
|
561 |
-
* @version 1.2
|
562 |
-
*/
|
563 |
-
|
564 |
-
private function convert_to_action( $cf7r_form, $required_conversion, $post_id, $rule_id ) {
|
565 |
-
$actions = array();
|
566 |
-
|
567 |
-
if ( 'migrate_from_cf7_redirect' === $required_conversion ) {
|
568 |
-
$old_api_action = $cf7r_form->get_cf7_redirection_settings();
|
569 |
-
|
570 |
-
if ( $old_api_action ) {
|
571 |
-
// CREATE JAVSCRIPT ACTION.
|
572 |
-
if ( $old_api_action['fire_sctipt'] ) {
|
573 |
-
$javscript_action = $this->create_action( $post_id, __( 'Migrated Javascript Action From Old Plugin', 'wpcf7-redirect' ), $rule_id, 'FireScript' );
|
574 |
-
|
575 |
-
$javscript_action->set( 'script', $old_api_action['fire_sctipt'] );
|
576 |
-
$javscript_action->set( 'action_status', 'on' );
|
577 |
-
|
578 |
-
unset( $old_api_action['fire_sctipt'] );
|
579 |
-
|
580 |
-
$actions[] = $javscript_action;
|
581 |
-
}
|
582 |
-
|
583 |
-
// CREATE REDIRECT ACTION.
|
584 |
-
$action = $this->create_action( $post_id, __( 'Migrated Redirect Action From Old Plugin', 'wpcf7-redirect' ), $rule_id, 'redirect' );
|
585 |
-
|
586 |
-
$action->set( 'action_status', 'on' );
|
587 |
-
|
588 |
-
foreach ( $old_api_action as $key => $value ) {
|
589 |
-
$action->set( $key, $value );
|
590 |
-
}
|
591 |
-
|
592 |
-
$actions[] = $action;
|
593 |
-
|
594 |
-
}
|
595 |
-
} elseif ( 'migrate_from_cf7_api' === $required_conversion ) {
|
596 |
-
$old_api_action = $cf7r_form->get_cf7_api_settings();
|
597 |
-
|
598 |
-
if ( $old_api_action ) {
|
599 |
-
|
600 |
-
$old_api__wpcf7_api_data = $old_api_action['_wpcf7_api_data'];
|
601 |
-
$old_tags_map = $old_api_action['_wpcf7_api_data_map'];
|
602 |
-
|
603 |
-
if ( 'params' === $old_api__wpcf7_api_data['input_type'] ) {
|
604 |
-
$action_type = 'api_url_request';
|
605 |
-
} elseif ( 'xml' === $old_api__wpcf7_api_data['input_type'] || 'json' === $old_api__wpcf7_api_data['input_type'] ) {
|
606 |
-
$action_type = 'api_json_xml_request';
|
607 |
-
}
|
608 |
-
|
609 |
-
$action = $this->create_action( $post_id, __( 'Migrated Data from Old Plugin', 'wpcf7-redirect' ), $rule_id, $action_type );
|
610 |
-
|
611 |
-
if ( ! is_wp_error( $action ) ) {
|
612 |
-
$action->set( 'base_url', $old_api__wpcf7_api_data['base_url'] );
|
613 |
-
$action->set( 'input_type', strtolower( $old_api__wpcf7_api_data['method'] ) );
|
614 |
-
$action->set( 'record_type', strtolower( $old_api__wpcf7_api_data['input_type'] ) );
|
615 |
-
$action->set( 'show_debug', '' );
|
616 |
-
$action->set( 'action_status', $old_api__wpcf7_api_data['send_to_api'] );
|
617 |
-
|
618 |
-
$tags_map = array();
|
619 |
-
|
620 |
-
if ( $old_tags_map ) {
|
621 |
-
foreach ( $old_tags_map as $tag_key => $tag_api_key ) {
|
622 |
-
$tags_map[ $tag_key ] = $tag_api_key;
|
623 |
-
}
|
624 |
-
|
625 |
-
$action->set( 'tags_map', $tags_map );
|
626 |
-
}
|
627 |
-
|
628 |
-
if ( isset( $old_api_action['_template'] ) && $old_api_action['_template'] ) {
|
629 |
-
$action->set( 'request_template', $old_api_action['_template'] );
|
630 |
-
} elseif ( isset( $old_api_action['_json_template'] ) && $old_api_action['_json_template'] ) {
|
631 |
-
$action->set( 'request_template', $old_api_action['_json_template'] );
|
632 |
-
}
|
633 |
-
|
634 |
-
$actions[] = $action;
|
635 |
-
}
|
636 |
-
}
|
637 |
-
}
|
638 |
-
|
639 |
-
return $actions;
|
640 |
-
}
|
641 |
-
|
642 |
-
/**
|
643 |
-
* Create new post that will hold the action
|
644 |
-
*
|
645 |
-
* @param $rule_name
|
646 |
-
* @param $rule_id
|
647 |
-
* @param $action_type
|
648 |
-
* @return Actions
|
649 |
-
*/
|
650 |
-
public function create_action( $post_id, $rule_name, $rule_id, $action_type ) {
|
651 |
-
$new_action_post = array(
|
652 |
-
'post_type' => 'wpcf7r_action',
|
653 |
-
'post_title' => $rule_name,
|
654 |
-
'post_status' => 'private',
|
655 |
-
'menu_order' => 1,
|
656 |
-
'meta_input' => array(
|
657 |
-
'wpcf7_id' => $post_id,
|
658 |
-
'wpcf7_rule_id' => $rule_id,
|
659 |
-
'action_type' => $action_type,
|
660 |
-
'action_status' => 'on',
|
661 |
-
),
|
662 |
-
);
|
663 |
-
|
664 |
-
$new_action_id = wp_insert_post( $new_action_post );
|
665 |
-
|
666 |
-
return WPCF7R_Action::get_action( $new_action_id, $post_id );
|
667 |
-
}
|
668 |
-
|
669 |
-
/**
|
670 |
-
* Get instance
|
671 |
-
*/
|
672 |
-
public static function get_instance() {
|
673 |
-
if ( null === self::$instance ) {
|
674 |
-
self::$instance = new self();
|
675 |
-
}
|
676 |
-
return self::$instance;
|
677 |
-
}
|
678 |
-
|
679 |
-
/**
|
680 |
-
* Get the banner template
|
681 |
-
*/
|
682 |
-
public function get_banner() {
|
683 |
-
if ( $this->get_option( 'last_banner_displayed' ) === $this->banner_version ) {
|
684 |
-
return;
|
685 |
-
}
|
686 |
-
ob_start();
|
687 |
-
|
688 |
-
include WPCF7_PRO_REDIRECT_TEMPLATE_PATH . 'banner.php';
|
689 |
-
|
690 |
-
$banner_html = ob_get_clean();
|
691 |
-
|
692 |
-
echo $banner_html;
|
693 |
-
}
|
694 |
-
|
695 |
-
/**
|
696 |
-
* Show a message containing the license details
|
697 |
-
*/
|
698 |
-
public function license_details_message() {
|
699 |
-
if ( ! self::get_activation_id() ) {
|
700 |
-
printf(
|
701 |
-
'<tr class="plugin-update-tr active" id="wpcf7-redirect-pro-update" data-slug="wpcf7-redirect-pro" data-plugin="contact-form-7-redirection-pro/wpcf7-redirect-pro.php"><td colspan="3" class="plugin-update colspanchange"><div class="update-message notice inline notice-warning notice-alt"><p><strong>%s</strong> %s</p></div></td></tr>',
|
702 |
-
__( 'Please activate plugin license for updates', 'wpcf7-redirect' ),
|
703 |
-
self::get_settings_link()
|
704 |
-
);
|
705 |
-
|
706 |
-
}
|
707 |
-
|
708 |
-
}
|
709 |
-
|
710 |
-
/**
|
711 |
-
* Get all data related with plugin activation
|
712 |
-
*/
|
713 |
-
public static function get_activation_data() {
|
714 |
-
return get_option( 'wpcf7r_activation_data' );
|
715 |
-
}
|
716 |
-
|
717 |
-
/**
|
718 |
-
* Get date of plugin license expiration
|
719 |
-
*/
|
720 |
-
public static function get_activation_expiration() {
|
721 |
-
return get_option( 'wpcf7r_activation_expiration' );
|
722 |
-
}
|
723 |
-
|
724 |
-
/**
|
725 |
-
* A validation function to test the serial key
|
726 |
-
*/
|
727 |
-
public static function validate_serial_key() {
|
728 |
-
$instance = self::get_instance();
|
729 |
-
|
730 |
-
$serial = self::get_serial_key();
|
731 |
-
$activation_id = self::get_activation_id();
|
732 |
-
|
733 |
-
return $instance->api->validate_serial( $activation_id, $serial );
|
734 |
-
}
|
735 |
-
|
736 |
-
/**
|
737 |
-
* Get the used serial key
|
738 |
-
*/
|
739 |
-
public static function get_serial_key() {
|
740 |
-
return get_option( 'wpcf7r_serial_number' );
|
741 |
-
}
|
742 |
-
|
743 |
-
/**
|
744 |
-
* Delete the used setial key
|
745 |
-
*/
|
746 |
-
public static function delete_serial_key() {
|
747 |
-
return delete_option( 'wpcf7r_serial_number' );
|
748 |
-
}
|
749 |
-
|
750 |
-
/**
|
751 |
-
* Get a url to deactivate plugin license
|
752 |
-
*/
|
753 |
-
public static function get_deactivation_link() {
|
754 |
-
$url = self::get_plugin_settings_page_url();
|
755 |
-
|
756 |
-
$url = add_query_arg( 'wpcf7r_deactivate_license', '', $url );
|
757 |
-
|
758 |
-
return $url;
|
759 |
-
}
|
760 |
-
|
761 |
-
/**
|
762 |
-
* Get the plugin settings link
|
763 |
-
*/
|
764 |
-
public static function get_plugin_settings_page_url() {
|
765 |
-
return get_admin_url( null, 'options-general.php?page=wpc7_redirect' );
|
766 |
-
}
|
767 |
-
|
768 |
-
/**
|
769 |
-
* Get the activation id
|
770 |
-
*/
|
771 |
-
public static function get_activation_id() {
|
772 |
-
return get_option( 'wpcf7r_activation_id' );
|
773 |
-
}
|
774 |
-
|
775 |
-
/**
|
776 |
-
* Get a link to the admin settings panel
|
777 |
-
*/
|
778 |
-
public static function get_settings_link() {
|
779 |
-
return '<a href="' . self::get_plugin_settings_page_url() . '">' . __( 'Settings', 'wpcf7-redirect' ) . '</a>';
|
780 |
-
}
|
781 |
-
|
782 |
-
/**
|
783 |
-
* Close banner
|
784 |
-
*/
|
785 |
-
public function close_banner() {
|
786 |
-
$this->update_option( 'last_banner_displayed', $this->banner_version );
|
787 |
-
}
|
788 |
-
|
789 |
-
/**
|
790 |
-
* Get specific option by key
|
791 |
-
*/
|
792 |
-
public function get_option( $key ) {
|
793 |
-
$options = $this->get_wpcf7_options();
|
794 |
-
|
795 |
-
return isset( $options[ $key ] ) ? $options[ $key ] : '';
|
796 |
-
}
|
797 |
-
|
798 |
-
/**
|
799 |
-
* Update specific option
|
800 |
-
*
|
801 |
-
* @param $key
|
802 |
-
* @param $value
|
803 |
-
*/
|
804 |
-
public function update_option( $key, $value ) {
|
805 |
-
$options = $this->get_wpcf7_options();
|
806 |
-
|
807 |
-
$options[ $key ] = $value;
|
808 |
-
|
809 |
-
$this->save_wpcf7_options( $options );
|
810 |
-
|
811 |
-
}
|
812 |
-
|
813 |
-
/**
|
814 |
-
* Get the plugin options
|
815 |
-
*/
|
816 |
-
public function get_wpcf7_options() {
|
817 |
-
return get_option( 'wpcf_redirect_options' );
|
818 |
-
}
|
819 |
-
|
820 |
-
/**
|
821 |
-
* Save the plugin options
|
822 |
-
*
|
823 |
-
* @param $options
|
824 |
-
*/
|
825 |
-
public function save_wpcf7_options( $options ) {
|
826 |
-
update_option( 'wpcf_redirect_options', $options );
|
827 |
-
}
|
828 |
-
|
829 |
-
/**
|
830 |
-
* Get a list of avaiable text functions and callbacks
|
831 |
-
*
|
832 |
-
* @param string $func
|
833 |
-
* @param string $field_type
|
834 |
-
*/
|
835 |
-
public static function get_available_text_functions( $func = '', $field_type = '' ) {
|
836 |
-
$functions = array(
|
837 |
-
'md5' => array( 'WPCF7r_Utils', 'func_md5' ),
|
838 |
-
'base64_encode' => array( 'WPCF7r_Utils', 'func_base64_encode' ),
|
839 |
-
'utf8_encode' => array( 'WPCF7r_Utils', 'func_utf8_encode' ),
|
840 |
-
'urlencode' => array( 'WPCF7r_Utils', 'func_urlencode' ),
|
841 |
-
'json_encode' => array( 'WPCF7r_Utils', 'func_json_encode' ),
|
842 |
-
'esc_html' => array( 'WPCF7r_Utils', 'func_esc_html' ),
|
843 |
-
'esc_attr' => array( 'WPCF7r_Utils', 'func_esc_attr' ),
|
844 |
-
);
|
845 |
-
|
846 |
-
if ( 'checkbox' === $field_type || 'checkbox*' === $field_type || 'all' === $field_type ) {
|
847 |
-
$functions['implode'] = array( 'WPCF7r_Utils', 'func_implode' );
|
848 |
-
}
|
849 |
-
|
850 |
-
$functions = apply_filters( 'get_available_text_functions', $functions );
|
851 |
-
|
852 |
-
if ( $func ) {
|
853 |
-
return isset( $functions[ $func ] ) ? $functions[ $func ] : '';
|
854 |
-
}
|
855 |
-
|
856 |
-
return $functions;
|
857 |
-
}
|
858 |
-
|
859 |
-
/**
|
860 |
-
* [func_utf8_encode description]
|
861 |
-
*
|
862 |
-
* @param $value
|
863 |
-
*/
|
864 |
-
public static function func_utf8_encode( $value ) {
|
865 |
-
return apply_filters( 'func_utf8_encode', utf8_encode( $value ), $value );
|
866 |
-
}
|
867 |
-
|
868 |
-
/**
|
869 |
-
* [func_base64_encode description]
|
870 |
-
*
|
871 |
-
* @param $value
|
872 |
-
*/
|
873 |
-
public static function func_base64_encode( $value ) {
|
874 |
-
return apply_filters( 'func_base64_encode', base64_encode( $value ), $value );
|
875 |
-
}
|
876 |
-
|
877 |
-
/**
|
878 |
-
* [func_base64_encode description]
|
879 |
-
*
|
880 |
-
* @param $value
|
881 |
-
*/
|
882 |
-
public static function func_urlencode( $value ) {
|
883 |
-
return apply_filters( 'func_urlencode', urlencode( $value ), $value );
|
884 |
-
}
|
885 |
-
|
886 |
-
/**
|
887 |
-
* Esc html callback
|
888 |
-
*
|
889 |
-
* @param $value
|
890 |
-
*/
|
891 |
-
public function func_esc_html( $value ) {
|
892 |
-
return apply_filters( 'func_esc_html', esc_html( $value ), $value );
|
893 |
-
}
|
894 |
-
|
895 |
-
/**
|
896 |
-
* Esc Attr callback
|
897 |
-
*
|
898 |
-
* @param $value
|
899 |
-
*/
|
900 |
-
public function func_esc_attr( $value ) {
|
901 |
-
return apply_filters( 'func_esc_attr', esc_attr( $value ), $value );
|
902 |
-
}
|
903 |
-
|
904 |
-
/**
|
905 |
-
* Json Encode callback
|
906 |
-
*
|
907 |
-
* @param $value
|
908 |
-
*/
|
909 |
-
public function func_json_encode( $value ) {
|
910 |
-
return apply_filters( 'func_json_encode', wp_json_encode( $value ), $value );
|
911 |
-
}
|
912 |
-
/**
|
913 |
-
* [func_base64_encode description]
|
914 |
-
*
|
915 |
-
* @param $value
|
916 |
-
*/
|
917 |
-
public static function func_implode( $value ) {
|
918 |
-
|
919 |
-
if ( is_array( $value ) ) {
|
920 |
-
$value = apply_filters( 'func_implode', implode( ',', $value ), $value );
|
921 |
-
}
|
922 |
-
|
923 |
-
return $value;
|
924 |
-
}
|
925 |
-
|
926 |
-
/**
|
927 |
-
* md5 function
|
928 |
-
*
|
929 |
-
* @param $value
|
930 |
-
*/
|
931 |
-
public static function func_md5( $value ) {
|
932 |
-
return apply_filters( 'func_md5', md5( $value ), $value );
|
933 |
-
}
|
934 |
-
|
935 |
-
public function make_api_test() {
|
936 |
-
parse_str( $_POST['data']['data'], $data );
|
937 |
-
|
938 |
-
if ( ! is_array( $data ) ) {
|
939 |
-
die( '-1' );
|
940 |
-
}
|
941 |
-
|
942 |
-
$action_id = isset( $_POST['data']['action_id'] ) ? (int) sanitize_text_field( $_POST['data']['action_id'] ) : '';
|
943 |
-
$cf7_id = isset( $_POST['data']['cf7_id'] ) ? (int) sanitize_text_field( $_POST['data']['cf7_id'] ) : '';
|
944 |
-
$rule_id = isset( $_POST['data']['rule_id'] ) ? $_POST['data']['rule_id'] : '';
|
945 |
-
|
946 |
-
add_filter( 'after_qs_cf7_api_send_lead', array( $this, 'after_fake_submission' ), 10, 3 );
|
947 |
-
|
948 |
-
if ( isset( $data['wpcf7-redirect']['actions'] ) ) {
|
949 |
-
$response = array();
|
950 |
-
|
951 |
-
$posted_action = reset( $data['wpcf7-redirect']['actions'] );
|
952 |
-
$posted_action = $posted_action['test_values'];
|
953 |
-
$_POST = $posted_action;
|
954 |
-
// this will create a fake form submission
|
955 |
-
$this->cf7r_form = get_cf7r_form( $cf7_id );
|
956 |
-
$this->cf7r_form->enable_action( $action_id );
|
957 |
-
|
958 |
-
$cf7_form = $this->cf7r_form->get_cf7_form_instance();
|
959 |
-
$submission = WPCF7_Submission::get_instance( $cf7_form );
|
960 |
-
|
961 |
-
if ( $submission->get_status() === 'validation_failed' ) {
|
962 |
-
$invalid_fields = $submission->get_invalid_fields();
|
963 |
-
$response['status'] = 'failed';
|
964 |
-
$response['invalid_fields'] = $invalid_fields;
|
965 |
-
} else {
|
966 |
-
$response['status'] = 'success';
|
967 |
-
$response['html'] = $this->get_test_api_results_html();
|
968 |
-
}
|
969 |
-
|
970 |
-
wp_send_json( $response );
|
971 |
-
}
|
972 |
-
}
|
973 |
-
/**
|
974 |
-
* Store the results from the API
|
975 |
-
*
|
976 |
-
* @param $result
|
977 |
-
* @param $record
|
978 |
-
*/
|
979 |
-
public function after_fake_submission( $result, $record, $args ) {
|
980 |
-
$this->results = $result;
|
981 |
-
$this->record = $record;
|
982 |
-
$this->request = $args;
|
983 |
-
|
984 |
-
return $result;
|
985 |
-
}
|
986 |
-
|
987 |
-
/**
|
988 |
-
* Show A preview for the action
|
989 |
-
*/
|
990 |
-
public function show_action_preview() {
|
991 |
-
if ( isset( $_GET['wpcf7r-preview'] ) ) {
|
992 |
-
$action_id = (int) $_GET['wpcf7r-preview'];
|
993 |
-
|
994 |
-
$action = WPCF7R_Action::get_action( $action_id );
|
995 |
-
|
996 |
-
$action->dynamic_params['popup-template'] = isset( $_GET['template'] ) ? sanitize_text_field( $_GET['template'] ) : '';
|
997 |
-
|
998 |
-
$action->preview();
|
999 |
-
}
|
1000 |
-
}
|
1001 |
-
|
1002 |
-
/**
|
1003 |
-
* Get action template in case field are dynamicaly changed
|
1004 |
-
*/
|
1005 |
-
public function get_action_template() {
|
1006 |
-
$data = isset( $_POST['data'] ) ? $_POST['data'] : '';
|
1007 |
-
|
1008 |
-
$response = array();
|
1009 |
-
|
1010 |
-
if ( isset( $data['action_id'] ) ) {
|
1011 |
-
$action_id = (int) $data['action_id'];
|
1012 |
-
$popup_template = sanitize_text_field( $data['template'] );
|
1013 |
-
|
1014 |
-
$action = WPCF7R_Action::get_action( $action_id );
|
1015 |
-
|
1016 |
-
ob_start();
|
1017 |
-
|
1018 |
-
$params = array(
|
1019 |
-
'popup-template' => $popup_template,
|
1020 |
-
);
|
1021 |
-
|
1022 |
-
$action->get_action_settings( $params );
|
1023 |
-
|
1024 |
-
$response['action_content'] = ob_get_clean();
|
1025 |
-
}
|
1026 |
-
|
1027 |
-
wp_send_json_success( $response );
|
1028 |
-
}
|
1029 |
-
|
1030 |
-
/**
|
1031 |
-
* Get the popup html
|
1032 |
-
*/
|
1033 |
-
public function get_test_api_results_html() {
|
1034 |
-
ob_start();
|
1035 |
-
|
1036 |
-
include WPCF7_PRO_REDIRECT_TEMPLATE_PATH . 'popup-api-test.php';
|
1037 |
-
|
1038 |
-
return ob_get_clean();
|
1039 |
-
}
|
1040 |
-
|
1041 |
-
/**
|
1042 |
-
* Get lists, maybe create new list
|
1043 |
-
*/
|
1044 |
-
public function get_mailchimp_lists() {
|
1045 |
-
$data = $_POST['data'];
|
1046 |
-
|
1047 |
-
$results = array();
|
1048 |
-
|
1049 |
-
if ( ! is_array( $data ) ) {
|
1050 |
-
die( '-1' );
|
1051 |
-
}
|
1052 |
-
|
1053 |
-
$api_key = $data['mailchimp_api_key'];
|
1054 |
-
|
1055 |
-
// A request to create a list
|
1056 |
-
if ( isset( $data['list_name'] ) && $data['list_name'] ) {
|
1057 |
-
$new_list_results = WPCF7R_Mailchimp_Helper::create_list( $api_key, $data['list_name'] );
|
1058 |
-
|
1059 |
-
if ( is_wp_error( $new_list_results ) ) {
|
1060 |
-
$results['error'] = $new_list_results->get_error_message();
|
1061 |
-
}
|
1062 |
-
}
|
1063 |
-
|
1064 |
-
// In the end return the lists
|
1065 |
-
if ( ! isset( $results['error'] ) ) {
|
1066 |
-
$lists = WPCF7R_Mailchimp_Helper::get_lists_clean( $api_key );
|
1067 |
-
|
1068 |
-
update_post_meta( $data['action_id'], 'mailchimp_lists', $lists );
|
1069 |
-
|
1070 |
-
if ( is_wp_error( $lists ) ) {
|
1071 |
-
$results['error'] = $lists->get_error_message();
|
1072 |
-
} else {
|
1073 |
-
$results['lists'] = $lists;
|
1074 |
-
}
|
1075 |
-
}
|
1076 |
-
|
1077 |
-
wp_send_json( $results );
|
1078 |
-
}
|
1079 |
-
|
1080 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class WPCF7r_Utils file.
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Contact form 7 redirect utilities
|
10 |
+
*/
|
11 |
+
class WPCF7r_Utils {
|
12 |
+
public $banner_version = 1.01;
|
13 |
+
public static $instance;
|
14 |
+
public static $actions_list = array();
|
15 |
+
public static $rendered_elements = array();
|
16 |
+
|
17 |
+
public function __construct() {
|
18 |
+
self::$instance = $this;
|
19 |
+
|
20 |
+
$this->api = new Qs_Api();
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Add a message to the session collector
|
25 |
+
*
|
26 |
+
* @param $type
|
27 |
+
* @param $message
|
28 |
+
*/
|
29 |
+
public static function add_admin_notice( $type, $message ) {
|
30 |
+
$_SESSION['wpcf7r_admin_notices'][ $type ] = $message;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Register a new type of action
|
35 |
+
*
|
36 |
+
* @param $name
|
37 |
+
* @param $title
|
38 |
+
* @param $class
|
39 |
+
*/
|
40 |
+
public static function register_wpcf7r_actions( $name, $title, $class, $order ) {
|
41 |
+
self::$actions_list[ $name ] = array(
|
42 |
+
'label' => $title,
|
43 |
+
'attr' => '',
|
44 |
+
'handler' => $class,
|
45 |
+
'order' => $order,
|
46 |
+
);
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Get action name
|
51 |
+
*
|
52 |
+
* @param $action_type
|
53 |
+
*/
|
54 |
+
public static function get_action_name( $action_type ) {
|
55 |
+
return isset( self::$actions_list[ $action_type ] ) ? self::$actions_list[ $action_type ]['label'] : $action_type;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Get the available actions
|
60 |
+
*/
|
61 |
+
public static function get_wpcf7r_actions() {
|
62 |
+
return self::$actions_list;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Duplicate all action posts and connect it to the new created form
|
67 |
+
*
|
68 |
+
* @param $new_cf7
|
69 |
+
*/
|
70 |
+
public function duplicate_form_support( $new_cf7 ) {
|
71 |
+
|
72 |
+
if ( isset( $_POST['wpcf7-copy'] ) && 'Duplicate' === $_POST['wpcf7-copy'] || ( isset( $_GET['action'] ) && 'copy' === $_GET['action'] ) ) {
|
73 |
+
|
74 |
+
$original_post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : (int) $_GET['post'];
|
75 |
+
|
76 |
+
$original_cf7 = get_cf7r_form( $original_post_id );
|
77 |
+
|
78 |
+
$original_action_posts = $original_cf7->get_actions( 'default' );
|
79 |
+
|
80 |
+
if ( $original_action_posts ) {
|
81 |
+
foreach ( $original_action_posts as $original_action_post ) {
|
82 |
+
$new_post_id = $this->duplicate_post( $original_action_post->action_post );
|
83 |
+
|
84 |
+
update_post_meta( $new_post_id, 'wpcf7_id', $new_cf7->id() );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* After form deletion delete all its actions
|
92 |
+
*
|
93 |
+
* @param int $post_id
|
94 |
+
*/
|
95 |
+
public function delete_all_form_actions( $post_id ) {
|
96 |
+
global $post_type;
|
97 |
+
|
98 |
+
if ( get_post_type( $post_id ) === 'wpcf7_contact_form' ) {
|
99 |
+
|
100 |
+
$wpcf7r = get_cf7r_form( $post_id );
|
101 |
+
|
102 |
+
$action_posts = $wpcf7r->get_actions( 'default' );
|
103 |
+
|
104 |
+
if ( $action_posts ) {
|
105 |
+
foreach ( $action_posts as $action_post ) {
|
106 |
+
wp_delete_post( $action_post->get_id() );
|
107 |
+
}
|
108 |
+
}
|
109 |
+
};
|
110 |
+
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Dupplicate contact form and all its actions
|
115 |
+
*
|
116 |
+
* @param $action
|
117 |
+
*/
|
118 |
+
public function duplicate_post( $action ) {
|
119 |
+
global $wpdb;
|
120 |
+
|
121 |
+
// if you don't want current user to be the new post author,
|
122 |
+
// then change next couple of lines to this: $new_post_author = $post->post_author;
|
123 |
+
$current_user = wp_get_current_user();
|
124 |
+
$new_post_author = $current_user->ID;
|
125 |
+
$post_id = $action->ID;
|
126 |
+
|
127 |
+
// if post data exists, create the post duplicate
|
128 |
+
if ( isset( $action ) && null !== $action ) {
|
129 |
+
// new post data array
|
130 |
+
$args = array(
|
131 |
+
'comment_status' => $action->comment_status,
|
132 |
+
'ping_status' => $action->ping_status,
|
133 |
+
'post_author' => $new_post_author,
|
134 |
+
'post_content' => $action->post_content,
|
135 |
+
'post_excerpt' => $action->post_excerpt,
|
136 |
+
'post_name' => $action->post_name,
|
137 |
+
'post_parent' => $action->post_parent,
|
138 |
+
'post_password' => $action->post_password,
|
139 |
+
'post_status' => 'private',
|
140 |
+
'post_title' => $action->post_title,
|
141 |
+
'post_type' => $action->post_type,
|
142 |
+
'to_ping' => $action->to_ping,
|
143 |
+
'menu_order' => $action->menu_order,
|
144 |
+
);
|
145 |
+
|
146 |
+
// insert the post by wp_insert_post() function
|
147 |
+
$new_post_id = wp_insert_post( $args );
|
148 |
+
|
149 |
+
// get all current post terms ad set them to the new post draft
|
150 |
+
$taxonomies = get_object_taxonomies( $action->post_type );
|
151 |
+
|
152 |
+
// returns array of taxonomy names for post type, ex array("category", "post_tag");
|
153 |
+
if ( $taxonomies ) {
|
154 |
+
foreach ( $taxonomies as $taxonomy ) {
|
155 |
+
$post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
|
156 |
+
wp_set_object_terms( $new_post_id, $post_terms, $taxonomy, false );
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
// duplicate all post meta just in two SQL queries
|
161 |
+
$sql = $wpdb->prepare( "SELECT meta_key, meta_value FROM {$wpdb->postmeta} WHERE post_id='%s'", $post_id );
|
162 |
+
|
163 |
+
$post_meta_infos = $wpdb->get_results( $sql );
|
164 |
+
|
165 |
+
if ( count( $post_meta_infos ) !== 0 ) {
|
166 |
+
$sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
|
167 |
+
|
168 |
+
foreach ( $post_meta_infos as $meta_info ) {
|
169 |
+
$meta_key = $meta_info->meta_key;
|
170 |
+
if ( '_wp_old_slug' === $meta_key ) {
|
171 |
+
continue;
|
172 |
+
}
|
173 |
+
$meta_value = addslashes( $meta_info->meta_value );
|
174 |
+
$sql_query_sel[] = "SELECT $new_post_id, '$meta_key', '$meta_value'";
|
175 |
+
}
|
176 |
+
|
177 |
+
$sql_query .= implode( ' UNION ALL ', $sql_query_sel );
|
178 |
+
|
179 |
+
$wpdb->query( $sql_query );
|
180 |
+
}
|
181 |
+
|
182 |
+
return $new_post_id;
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Set actions order
|
188 |
+
*/
|
189 |
+
public function set_action_menu_order() {
|
190 |
+
global $wpdb;
|
191 |
+
|
192 |
+
parse_str( $_POST['data']['order'], $data );
|
193 |
+
|
194 |
+
if ( ! is_array( $data ) ) {
|
195 |
+
return false;
|
196 |
+
}
|
197 |
+
|
198 |
+
// get objects per now page
|
199 |
+
$id_arr = array();
|
200 |
+
foreach ( $data as $key => $values ) {
|
201 |
+
foreach ( $values as $position => $id ) {
|
202 |
+
$id_arr[] = $id;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
foreach ( $id_arr as $key => $post_id ) {
|
207 |
+
$menu_order = $key + 1;
|
208 |
+
$wpdb->update( $wpdb->posts, array( 'menu_order' => $menu_order ), array( 'ID' => intval( $post_id ) ) );
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Render elements required by actions
|
214 |
+
*
|
215 |
+
* @return void
|
216 |
+
*/
|
217 |
+
public function render_actions_elements( $properties, $form ) {
|
218 |
+
|
219 |
+
$action_posts = wpcf7r_get_actions( 'wpcf7r_action', -1, $form->id(), 'default', array(), true );
|
220 |
+
|
221 |
+
if ( $action_posts ) {
|
222 |
+
foreach ( $action_posts as $action_post ) {
|
223 |
+
$action = WPCF7R_Action::get_action( $action_post );
|
224 |
+
|
225 |
+
if ( ! isset( self::$rendered_elements[ $action_post->ID ] ) ) {
|
226 |
+
// these actions will run once.
|
227 |
+
if ( is_object( $action ) && ! is_wp_error( $action ) && method_exists( $action, 'render_callback_once' ) ) {
|
228 |
+
$properties = $action->render_callback_once( $properties, $form );
|
229 |
+
}
|
230 |
+
|
231 |
+
self::$rendered_elements[ $action_post->ID ] = $action_post->ID;
|
232 |
+
}
|
233 |
+
|
234 |
+
// Render_callback will be called several times because of the way contact form 7 uses these properties.
|
235 |
+
// use state and db on the action to limit it to run only once.
|
236 |
+
if ( is_object( $action ) && ! is_wp_error( $action ) && method_exists( $action, 'render_callback' ) ) {
|
237 |
+
$properties = $action->render_callback( $properties, $form );
|
238 |
+
}
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
+
return $properties;
|
243 |
+
}
|
244 |
+
/**
|
245 |
+
* Delete an action
|
246 |
+
*/
|
247 |
+
public function delete_action_post() {
|
248 |
+
$data = isset( $_POST['data'] ) ? $_POST['data'] : '';
|
249 |
+
|
250 |
+
$response['status'] = 'failed';
|
251 |
+
|
252 |
+
if ( $data ) {
|
253 |
+
foreach ( $data as $post_to_delete ) {
|
254 |
+
if ( $post_to_delete ) {
|
255 |
+
wp_trash_post( $post_to_delete['post_id'] );
|
256 |
+
$response['status'] = 'deleted';
|
257 |
+
}
|
258 |
+
}
|
259 |
+
}
|
260 |
+
|
261 |
+
wp_send_json( $response );
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Show notices on admin panel
|
266 |
+
*/
|
267 |
+
public function show_admin_notices() {
|
268 |
+
global $wp_sessions;
|
269 |
+
|
270 |
+
if ( ! isset( $_SESSION['wpcf7r_admin_notices'] ) ) {
|
271 |
+
return;
|
272 |
+
}
|
273 |
+
|
274 |
+
foreach ( $_SESSION['wpcf7r_admin_notices'] as $notice_type => $notice ) :
|
275 |
+
?>
|
276 |
+
|
277 |
+
<div class="notice notice-error is-dismissible <?php echo $notice_type; ?>">
|
278 |
+
<p><?php echo $notice; ?></p>
|
279 |
+
</div>
|
280 |
+
|
281 |
+
<?php
|
282 |
+
endforeach;
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Send debug data to querysol support api
|
287 |
+
*
|
288 |
+
* @return void
|
289 |
+
*/
|
290 |
+
public function send_debug_info() {
|
291 |
+
$data = isset( $_POST['data'] ) ? $_POST['data'] : '';
|
292 |
+
|
293 |
+
if ( $data['form_id'] ) {
|
294 |
+
$debug_data = WPCF7r_Form_Helper::get_debug_data( $data['form_id'] );
|
295 |
+
|
296 |
+
$api = new Qs_Api();
|
297 |
+
|
298 |
+
$args = array(
|
299 |
+
'headers' => array( 'Content-Type' => 'application/json; charset=utf-8' ),
|
300 |
+
);
|
301 |
+
|
302 |
+
$url = add_query_arg( 'site_url', home_url(), WPCF7_PRO_REDIRECT_DEBUG_URL );
|
303 |
+
|
304 |
+
$api->api_call( $url, json_encode( array( 'debug_data' => $debug_data ) ), $args );
|
305 |
+
}
|
306 |
+
|
307 |
+
wp_send_json_success();
|
308 |
+
}
|
309 |
+
/**
|
310 |
+
* Auto function to migrate old plugin to the new one
|
311 |
+
*
|
312 |
+
* @param $migration_action migrate_from_cf7_redirect/migrate_from_cf7_api
|
313 |
+
* @param boolean $force
|
314 |
+
*/
|
315 |
+
public static function auto_migrate( $migration_action, $force = false ) {
|
316 |
+
|
317 |
+
$instance = self::get_instance();
|
318 |
+
|
319 |
+
$cf7_forms = self::get_all_cf7_forms();
|
320 |
+
|
321 |
+
foreach ( $cf7_forms as $cf7_form_id ) {
|
322 |
+
|
323 |
+
$cf7r_form = new WPCF7R_Form( $cf7_form_id );
|
324 |
+
|
325 |
+
$instance->delete_all_form_actions( $cf7_form_id );
|
326 |
+
|
327 |
+
if ( ! $cf7r_form->has_migrated( $migration_action ) || $force ) {
|
328 |
+
$instance->convert_to_action( $cf7r_form, $migration_action, $cf7_form_id, 'default' );
|
329 |
+
|
330 |
+
$cf7r_form->update_migration( $migration_action );
|
331 |
+
}
|
332 |
+
}
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Create form and actions based on debug info
|
337 |
+
*
|
338 |
+
* @return void
|
339 |
+
*/
|
340 |
+
public function import_from_debug() {
|
341 |
+
$data = isset( $_POST['data'] ) && $_POST['data'] ? $_POST['data'] : '';
|
342 |
+
|
343 |
+
if ( $data ) {
|
344 |
+
$formdata = unserialize( base64_decode( $data['debug_info'] ) );
|
345 |
+
|
346 |
+
$this->install_plugins( json_decode( $formdata['plugins'] ) );
|
347 |
+
|
348 |
+
$form_id = $this->import_form( $formdata );
|
349 |
+
|
350 |
+
$this->import_actions( $form_id, $formdata['actions'] );
|
351 |
+
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
/**
|
356 |
+
* Import actions to post
|
357 |
+
*
|
358 |
+
* @return void
|
359 |
+
*/
|
360 |
+
private function import_actions( $form_id, $actions ) {
|
361 |
+
foreach ( $actions as $action ) {
|
362 |
+
$post = (array) $action->action_post;
|
363 |
+
unset( $post['ID'] );
|
364 |
+
|
365 |
+
$post_id = wp_insert_post( $post );
|
366 |
+
|
367 |
+
foreach ( $action->fields_values as $meta_key => $meta_values ) {
|
368 |
+
if ( 'wpcf7_id' === $meta_key ) {
|
369 |
+
continue;
|
370 |
+
}
|
371 |
+
foreach ( $meta_values as $meta_value ) {
|
372 |
+
add_post_meta( $post_id, $meta_key, maybe_unserialize( $meta_value ) );
|
373 |
+
}
|
374 |
+
}
|
375 |
+
|
376 |
+
update_post_meta( $post_id, 'wpcf7_id', $form_id );
|
377 |
+
|
378 |
+
}
|
379 |
+
}
|
380 |
+
/**
|
381 |
+
* Import form from debug info
|
382 |
+
*
|
383 |
+
* @return void
|
384 |
+
*/
|
385 |
+
private function import_form( $formdata ) {
|
386 |
+
|
387 |
+
$new_form_post = (array) $formdata['form_post'];
|
388 |
+
|
389 |
+
unset( $new_form_post['ID'] );
|
390 |
+
|
391 |
+
$form_id = wp_insert_post( $new_form_post );
|
392 |
+
|
393 |
+
foreach ( $formdata['form_meta'] as $meta_key => $meta_values ) {
|
394 |
+
foreach ( $meta_values as $meta_value ) {
|
395 |
+
add_post_meta( $form_id, $meta_key, maybe_unserialize( $meta_value ) );
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
return $form_id;
|
400 |
+
}
|
401 |
+
/**
|
402 |
+
* Install a list of plugins
|
403 |
+
*
|
404 |
+
* @return void
|
405 |
+
*/
|
406 |
+
private function install_plugins( $plugins ) {
|
407 |
+
|
408 |
+
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
409 |
+
include_once ABSPATH . 'wp-admin/includes/file.php';
|
410 |
+
include_once ABSPATH . 'wp-admin/includes/misc.php';
|
411 |
+
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
412 |
+
|
413 |
+
$results = array();
|
414 |
+
|
415 |
+
foreach ( $plugins as $slug => $plugin ) {
|
416 |
+
|
417 |
+
if ( ! is_plugin_active( $slug ) ) {
|
418 |
+
$results[ $slug ] = $this->install_plugin( $slug );
|
419 |
+
}
|
420 |
+
}
|
421 |
+
|
422 |
+
return $results;
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Install and activate a plugin
|
427 |
+
*
|
428 |
+
* @return void
|
429 |
+
*/
|
430 |
+
public function install_plugin( $plugin_slug ) {
|
431 |
+
|
432 |
+
$api = plugins_api(
|
433 |
+
'plugin_information',
|
434 |
+
array(
|
435 |
+
'slug' => basename( $plugin_slug, '.php' ),
|
436 |
+
'fields' => array(
|
437 |
+
'short_description' => false,
|
438 |
+
'sections' => false,
|
439 |
+
'requires' => false,
|
440 |
+
'rating' => false,
|
441 |
+
'ratings' => false,
|
442 |
+
'downloaded' => false,
|
443 |
+
'last_updated' => false,
|
444 |
+
'added' => false,
|
445 |
+
'tags' => false,
|
446 |
+
'compatibility' => false,
|
447 |
+
'homepage' => false,
|
448 |
+
'donate_link' => false,
|
449 |
+
),
|
450 |
+
)
|
451 |
+
);
|
452 |
+
|
453 |
+
if ( ! is_wp_error( $api ) ) {
|
454 |
+
$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact( 'title', 'url', 'nonce', 'plugin', 'api' ) ) );
|
455 |
+
|
456 |
+
$upgrader->install( $api->download_link );
|
457 |
+
|
458 |
+
if ( ! is_wp_error( $upgrader->skin->api ) ) {
|
459 |
+
return activate_plugin( $plugin_slug );
|
460 |
+
} else {
|
461 |
+
return $upgrader->skin->api;
|
462 |
+
}
|
463 |
+
} else {
|
464 |
+
return $api;
|
465 |
+
}
|
466 |
+
|
467 |
+
}
|
468 |
+
|
469 |
+
/**
|
470 |
+
* Get all Contact Forms 7 forms
|
471 |
+
*/
|
472 |
+
public static function get_all_cf7_forms() {
|
473 |
+
$args = array(
|
474 |
+
'post_type' => 'wpcf7_contact_form',
|
475 |
+
'posts_per_page' => -1,
|
476 |
+
'fields' => 'ids',
|
477 |
+
'suppress_filters' => true,
|
478 |
+
);
|
479 |
+
|
480 |
+
$cf7_forms = get_posts( $args );
|
481 |
+
|
482 |
+
return $cf7_forms;
|
483 |
+
}
|
484 |
+
|
485 |
+
/**
|
486 |
+
* Duplicate an existing action and connect it with the form.
|
487 |
+
*
|
488 |
+
* @return void
|
489 |
+
*/
|
490 |
+
public function duplicate_action() {
|
491 |
+
$results['action_row'] = '';
|
492 |
+
|
493 |
+
if ( isset( $_POST['data'] ) ) {
|
494 |
+
$action_data = $_POST['data'];
|
495 |
+
|
496 |
+
$action_post_id = $action_data['post_id'];
|
497 |
+
|
498 |
+
$action_post = get_post( $action_post_id );
|
499 |
+
|
500 |
+
$new_action_post_id = $this->duplicate_post( $action_post );
|
501 |
+
|
502 |
+
update_post_meta( $new_action_post_id, 'wpcf7_id', $action_data['form_id'] );
|
503 |
+
|
504 |
+
$action = WPCF7R_Action::get_action( $new_action_post_id );
|
505 |
+
|
506 |
+
$results['action_row'] = $action->get_action_row();
|
507 |
+
}
|
508 |
+
|
509 |
+
wp_send_json( $results );
|
510 |
+
}
|
511 |
+
/**
|
512 |
+
* Create a new action post
|
513 |
+
*/
|
514 |
+
public function add_action_post() {
|
515 |
+
$results['action_row'] = '';
|
516 |
+
|
517 |
+
$post_id = isset( $_POST['data']['post_id'] ) ? (int) sanitize_text_field( $_POST['data']['post_id'] ) : '';
|
518 |
+
$rule_id = isset( $_POST['data']['rule_id'] ) ? sanitize_text_field( $_POST['data']['rule_id'] ) : '';
|
519 |
+
$action_type = isset( $_POST['data']['action_type'] ) ? sanitize_text_field( $_POST['data']['action_type'] ) : '';
|
520 |
+
|
521 |
+
$rule_name = __( 'New Action', 'wpcf7-redirect' );
|
522 |
+
|
523 |
+
$this->cf7r_form = get_cf7r_form( $post_id );
|
524 |
+
|
525 |
+
$actions = array();
|
526 |
+
|
527 |
+
// migrate from old api plugin
|
528 |
+
if ( 'migrate_from_cf7_api' === $action_type || 'migrate_from_cf7_redirect' === $action_type ) {
|
529 |
+
if ( ! $this->cf7r_form->has_migrated( $action_type ) ) {
|
530 |
+
$actions = $this->convert_to_action( $action_type, $post_id, $rule_name, $rule_id );
|
531 |
+
$this->cf7r_form->update_migration( $action_type );
|
532 |
+
}
|
533 |
+
} else {
|
534 |
+
$actions[] = $this->create_action( $post_id, $rule_name, $rule_id, $action_type );
|
535 |
+
}
|
536 |
+
|
537 |
+
if ( $actions ) {
|
538 |
+
foreach ( $actions as $action ) {
|
539 |
+
if ( ! is_wp_error( $action ) ) {
|
540 |
+
$results['action_row'] .= $action->get_action_row();
|
541 |
+
} else {
|
542 |
+
wp_send_json( $results );
|
543 |
+
}
|
544 |
+
}
|
545 |
+
} else {
|
546 |
+
$results['action_row'] = '';
|
547 |
+
}
|
548 |
+
|
549 |
+
wp_send_json( $results );
|
550 |
+
}
|
551 |
+
|
552 |
+
/**
|
553 |
+
* Convert old plugin data to new structure
|
554 |
+
*
|
555 |
+
* @param $required_conversion
|
556 |
+
* @param $post_id
|
557 |
+
* @param $rule_name
|
558 |
+
* @param $rule_id
|
559 |
+
* @return Actions
|
560 |
+
*
|
561 |
+
* @version 1.2
|
562 |
+
*/
|
563 |
+
|
564 |
+
private function convert_to_action( $cf7r_form, $required_conversion, $post_id, $rule_id ) {
|
565 |
+
$actions = array();
|
566 |
+
|
567 |
+
if ( 'migrate_from_cf7_redirect' === $required_conversion ) {
|
568 |
+
$old_api_action = $cf7r_form->get_cf7_redirection_settings();
|
569 |
+
|
570 |
+
if ( $old_api_action ) {
|
571 |
+
// CREATE JAVSCRIPT ACTION.
|
572 |
+
if ( $old_api_action['fire_sctipt'] ) {
|
573 |
+
$javscript_action = $this->create_action( $post_id, __( 'Migrated Javascript Action From Old Plugin', 'wpcf7-redirect' ), $rule_id, 'FireScript' );
|
574 |
+
|
575 |
+
$javscript_action->set( 'script', $old_api_action['fire_sctipt'] );
|
576 |
+
$javscript_action->set( 'action_status', 'on' );
|
577 |
+
|
578 |
+
unset( $old_api_action['fire_sctipt'] );
|
579 |
+
|
580 |
+
$actions[] = $javscript_action;
|
581 |
+
}
|
582 |
+
|
583 |
+
// CREATE REDIRECT ACTION.
|
584 |
+
$action = $this->create_action( $post_id, __( 'Migrated Redirect Action From Old Plugin', 'wpcf7-redirect' ), $rule_id, 'redirect' );
|
585 |
+
|
586 |
+
$action->set( 'action_status', 'on' );
|
587 |
+
|
588 |
+
foreach ( $old_api_action as $key => $value ) {
|
589 |
+
$action->set( $key, $value );
|
590 |
+
}
|
591 |
+
|
592 |
+
$actions[] = $action;
|
593 |
+
|
594 |
+
}
|
595 |
+
} elseif ( 'migrate_from_cf7_api' === $required_conversion ) {
|
596 |
+
$old_api_action = $cf7r_form->get_cf7_api_settings();
|
597 |
+
|
598 |
+
if ( $old_api_action ) {
|
599 |
+
|
600 |
+
$old_api__wpcf7_api_data = $old_api_action['_wpcf7_api_data'];
|
601 |
+
$old_tags_map = $old_api_action['_wpcf7_api_data_map'];
|
602 |
+
|
603 |
+
if ( 'params' === $old_api__wpcf7_api_data['input_type'] ) {
|
604 |
+
$action_type = 'api_url_request';
|
605 |
+
} elseif ( 'xml' === $old_api__wpcf7_api_data['input_type'] || 'json' === $old_api__wpcf7_api_data['input_type'] ) {
|
606 |
+
$action_type = 'api_json_xml_request';
|
607 |
+
}
|
608 |
+
|
609 |
+
$action = $this->create_action( $post_id, __( 'Migrated Data from Old Plugin', 'wpcf7-redirect' ), $rule_id, $action_type );
|
610 |
+
|
611 |
+
if ( ! is_wp_error( $action ) ) {
|
612 |
+
$action->set( 'base_url', $old_api__wpcf7_api_data['base_url'] );
|
613 |
+
$action->set( 'input_type', strtolower( $old_api__wpcf7_api_data['method'] ) );
|
614 |
+
$action->set( 'record_type', strtolower( $old_api__wpcf7_api_data['input_type'] ) );
|
615 |
+
$action->set( 'show_debug', '' );
|
616 |
+
$action->set( 'action_status', $old_api__wpcf7_api_data['send_to_api'] );
|
617 |
+
|
618 |
+
$tags_map = array();
|
619 |
+
|
620 |
+
if ( $old_tags_map ) {
|
621 |
+
foreach ( $old_tags_map as $tag_key => $tag_api_key ) {
|
622 |
+
$tags_map[ $tag_key ] = $tag_api_key;
|
623 |
+
}
|
624 |
+
|
625 |
+
$action->set( 'tags_map', $tags_map );
|
626 |
+
}
|
627 |
+
|
628 |
+
if ( isset( $old_api_action['_template'] ) && $old_api_action['_template'] ) {
|
629 |
+
$action->set( 'request_template', $old_api_action['_template'] );
|
630 |
+
} elseif ( isset( $old_api_action['_json_template'] ) && $old_api_action['_json_template'] ) {
|
631 |
+
$action->set( 'request_template', $old_api_action['_json_template'] );
|
632 |
+
}
|
633 |
+
|
634 |
+
$actions[] = $action;
|
635 |
+
}
|
636 |
+
}
|
637 |
+
}
|
638 |
+
|
639 |
+
return $actions;
|
640 |
+
}
|
641 |
+
|
642 |
+
/**
|
643 |
+
* Create new post that will hold the action
|
644 |
+
*
|
645 |
+
* @param $rule_name
|
646 |
+
* @param $rule_id
|
647 |
+
* @param $action_type
|
648 |
+
* @return Actions
|
649 |
+
*/
|
650 |
+
public function create_action( $post_id, $rule_name, $rule_id, $action_type ) {
|
651 |
+
$new_action_post = array(
|
652 |
+
'post_type' => 'wpcf7r_action',
|
653 |
+
'post_title' => $rule_name,
|
654 |
+
'post_status' => 'private',
|
655 |
+
'menu_order' => 1,
|
656 |
+
'meta_input' => array(
|
657 |
+
'wpcf7_id' => $post_id,
|
658 |
+
'wpcf7_rule_id' => $rule_id,
|
659 |
+
'action_type' => $action_type,
|
660 |
+
'action_status' => 'on',
|
661 |
+
),
|
662 |
+
);
|
663 |
+
|
664 |
+
$new_action_id = wp_insert_post( $new_action_post );
|
665 |
+
|
666 |
+
return WPCF7R_Action::get_action( $new_action_id, $post_id );
|
667 |
+
}
|
668 |
+
|
669 |
+
/**
|
670 |
+
* Get instance
|
671 |
+
*/
|
672 |
+
public static function get_instance() {
|
673 |
+
if ( null === self::$instance ) {
|
674 |
+
self::$instance = new self();
|
675 |
+
}
|
676 |
+
return self::$instance;
|
677 |
+
}
|
678 |
+
|
679 |
+
/**
|
680 |
+
* Get the banner template
|
681 |
+
*/
|
682 |
+
public function get_banner() {
|
683 |
+
if ( $this->get_option( 'last_banner_displayed' ) === $this->banner_version ) {
|
684 |
+
return;
|
685 |
+
}
|
686 |
+
ob_start();
|
687 |
+
|
688 |
+
include WPCF7_PRO_REDIRECT_TEMPLATE_PATH . 'banner.php';
|
689 |
+
|
690 |
+
$banner_html = ob_get_clean();
|
691 |
+
|
692 |
+
echo $banner_html;
|
693 |
+
}
|
694 |
+
|
695 |
+
/**
|
696 |
+
* Show a message containing the license details
|
697 |
+
*/
|
698 |
+
public function license_details_message() {
|
699 |
+
if ( ! self::get_activation_id() ) {
|
700 |
+
printf(
|
701 |
+
'<tr class="plugin-update-tr active" id="wpcf7-redirect-pro-update" data-slug="wpcf7-redirect-pro" data-plugin="contact-form-7-redirection-pro/wpcf7-redirect-pro.php"><td colspan="3" class="plugin-update colspanchange"><div class="update-message notice inline notice-warning notice-alt"><p><strong>%s</strong> %s</p></div></td></tr>',
|
702 |
+
__( 'Please activate plugin license for updates', 'wpcf7-redirect' ),
|
703 |
+
self::get_settings_link()
|
704 |
+
);
|
705 |
+
|
706 |
+
}
|
707 |
+
|
708 |
+
}
|
709 |
+
|
710 |
+
/**
|
711 |
+
* Get all data related with plugin activation
|
712 |
+
*/
|
713 |
+
public static function get_activation_data() {
|
714 |
+
return get_option( 'wpcf7r_activation_data' );
|
715 |
+
}
|
716 |
+
|
717 |
+
/**
|
718 |
+
* Get date of plugin license expiration
|
719 |
+
*/
|
720 |
+
public static function get_activation_expiration() {
|
721 |
+
return get_option( 'wpcf7r_activation_expiration' );
|
722 |
+
}
|
723 |
+
|
724 |
+
/**
|
725 |
+
* A validation function to test the serial key
|
726 |
+
*/
|
727 |
+
public static function validate_serial_key() {
|
728 |
+
$instance = self::get_instance();
|
729 |
+
|
730 |
+
$serial = self::get_serial_key();
|
731 |
+
$activation_id = self::get_activation_id();
|
732 |
+
|
733 |
+
return $instance->api->validate_serial( $activation_id, $serial );
|
734 |
+
}
|
735 |
+
|
736 |
+
/**
|
737 |
+
* Get the used serial key
|
738 |
+
*/
|
739 |
+
public static function get_serial_key() {
|
740 |
+
return get_option( 'wpcf7r_serial_number' );
|
741 |
+
}
|
742 |
+
|
743 |
+
/**
|
744 |
+
* Delete the used setial key
|
745 |
+
*/
|
746 |
+
public static function delete_serial_key() {
|
747 |
+
return delete_option( 'wpcf7r_serial_number' );
|
748 |
+
}
|
749 |
+
|
750 |
+
/**
|
751 |
+
* Get a url to deactivate plugin license
|
752 |
+
*/
|
753 |
+
public static function get_deactivation_link() {
|
754 |
+
$url = self::get_plugin_settings_page_url();
|
755 |
+
|
756 |
+
$url = add_query_arg( 'wpcf7r_deactivate_license', '', $url );
|
757 |
+
|
758 |
+
return $url;
|
759 |
+
}
|
760 |
+
|
761 |
+
/**
|
762 |
+
* Get the plugin settings link
|
763 |
+
*/
|
764 |
+
public static function get_plugin_settings_page_url() {
|
765 |
+
return get_admin_url( null, 'options-general.php?page=wpc7_redirect' );
|
766 |
+
}
|
767 |
+
|
768 |
+
/**
|
769 |
+
* Get the activation id
|
770 |
+
*/
|
771 |
+
public static function get_activation_id() {
|
772 |
+
return get_option( 'wpcf7r_activation_id' );
|
773 |
+
}
|
774 |
+
|
775 |
+
/**
|
776 |
+
* Get a link to the admin settings panel
|
777 |
+
*/
|
778 |
+
public static function get_settings_link() {
|
779 |
+
return '<a href="' . self::get_plugin_settings_page_url() . '">' . __( 'Settings', 'wpcf7-redirect' ) . '</a>';
|
780 |
+
}
|
781 |
+
|
782 |
+
/**
|
783 |
+
* Close banner
|
784 |
+
*/
|
785 |
+
public function close_banner() {
|
786 |
+
$this->update_option( 'last_banner_displayed', $this->banner_version );
|
787 |
+
}
|
788 |
+
|
789 |
+
/**
|
790 |
+
* Get specific option by key
|
791 |
+
*/
|
792 |
+
public function get_option( $key ) {
|
793 |
+
$options = $this->get_wpcf7_options();
|
794 |
+
|
795 |
+
return isset( $options[ $key ] ) ? $options[ $key ] : '';
|
796 |
+
}
|
797 |
+
|
798 |
+
/**
|
799 |
+
* Update specific option
|
800 |
+
*
|
801 |
+
* @param $key
|
802 |
+
* @param $value
|
803 |
+
*/
|
804 |
+
public function update_option( $key, $value ) {
|
805 |
+
$options = $this->get_wpcf7_options();
|
806 |
+
|
807 |
+
$options[ $key ] = $value;
|
808 |
+
|
809 |
+
$this->save_wpcf7_options( $options );
|
810 |
+
|
811 |
+
}
|
812 |
+
|
813 |
+
/**
|
814 |
+
* Get the plugin options
|
815 |
+
*/
|
816 |
+
public function get_wpcf7_options() {
|
817 |
+
return get_option( 'wpcf_redirect_options' );
|
818 |
+
}
|
819 |
+
|
820 |
+
/**
|
821 |
+
* Save the plugin options
|
822 |
+
*
|
823 |
+
* @param $options
|
824 |
+
*/
|
825 |
+
public function save_wpcf7_options( $options ) {
|
826 |
+
update_option( 'wpcf_redirect_options', $options );
|
827 |
+
}
|
828 |
+
|
829 |
+
/**
|
830 |
+
* Get a list of avaiable text functions and callbacks
|
831 |
+
*
|
832 |
+
* @param string $func
|
833 |
+
* @param string $field_type
|
834 |
+
*/
|
835 |
+
public static function get_available_text_functions( $func = '', $field_type = '' ) {
|
836 |
+
$functions = array(
|
837 |
+
'md5' => array( 'WPCF7r_Utils', 'func_md5' ),
|
838 |
+
'base64_encode' => array( 'WPCF7r_Utils', 'func_base64_encode' ),
|
839 |
+
'utf8_encode' => array( 'WPCF7r_Utils', 'func_utf8_encode' ),
|
840 |
+
'urlencode' => array( 'WPCF7r_Utils', 'func_urlencode' ),
|
841 |
+
'json_encode' => array( 'WPCF7r_Utils', 'func_json_encode' ),
|
842 |
+
'esc_html' => array( 'WPCF7r_Utils', 'func_esc_html' ),
|
843 |
+
'esc_attr' => array( 'WPCF7r_Utils', 'func_esc_attr' ),
|
844 |
+
);
|
845 |
+
|
846 |
+
if ( 'checkbox' === $field_type || 'checkbox*' === $field_type || 'all' === $field_type ) {
|
847 |
+
$functions['implode'] = array( 'WPCF7r_Utils', 'func_implode' );
|
848 |
+
}
|
849 |
+
|
850 |
+
$functions = apply_filters( 'get_available_text_functions', $functions );
|
851 |
+
|
852 |
+
if ( $func ) {
|
853 |
+
return isset( $functions[ $func ] ) ? $functions[ $func ] : '';
|
854 |
+
}
|
855 |
+
|
856 |
+
return $functions;
|
857 |
+
}
|
858 |
+
|
859 |
+
/**
|
860 |
+
* [func_utf8_encode description]
|
861 |
+
*
|
862 |
+
* @param $value
|
863 |
+
*/
|
864 |
+
public static function func_utf8_encode( $value ) {
|
865 |
+
return apply_filters( 'func_utf8_encode', utf8_encode( $value ), $value );
|
866 |
+
}
|
867 |
+
|
868 |
+
/**
|
869 |
+
* [func_base64_encode description]
|
870 |
+
*
|
871 |
+
* @param $value
|
872 |
+
*/
|
873 |
+
public static function func_base64_encode( $value ) {
|
874 |
+
return apply_filters( 'func_base64_encode', base64_encode( $value ), $value );
|
875 |
+
}
|
876 |
+
|
877 |
+
/**
|
878 |
+
* [func_base64_encode description]
|
879 |
+
*
|
880 |
+
* @param $value
|
881 |
+
*/
|
882 |
+
public static function func_urlencode( $value ) {
|
883 |
+
return apply_filters( 'func_urlencode', urlencode( $value ), $value );
|
884 |
+
}
|
885 |
+
|
886 |
+
/**
|
887 |
+
* Esc html callback
|
888 |
+
*
|
889 |
+
* @param $value
|
890 |
+
*/
|
891 |
+
public function func_esc_html( $value ) {
|
892 |
+
return apply_filters( 'func_esc_html', esc_html( $value ), $value );
|
893 |
+
}
|
894 |
+
|
895 |
+
/**
|
896 |
+
* Esc Attr callback
|
897 |
+
*
|
898 |
+
* @param $value
|
899 |
+
*/
|
900 |
+
public function func_esc_attr( $value ) {
|
901 |
+
return apply_filters( 'func_esc_attr', esc_attr( $value ), $value );
|
902 |
+
}
|
903 |
+
|
904 |
+
/**
|
905 |
+
* Json Encode callback
|
906 |
+
*
|
907 |
+
* @param $value
|
908 |
+
*/
|
909 |
+
public function func_json_encode( $value ) {
|
910 |
+
return apply_filters( 'func_json_encode', wp_json_encode( $value ), $value );
|
911 |
+
}
|
912 |
+
/**
|
913 |
+
* [func_base64_encode description]
|
914 |
+
*
|
915 |
+
* @param $value
|
916 |
+
*/
|
917 |
+
public static function func_implode( $value ) {
|
918 |
+
|
919 |
+
if ( is_array( $value ) ) {
|
920 |
+
$value = apply_filters( 'func_implode', implode( ',', $value ), $value );
|
921 |
+
}
|
922 |
+
|
923 |
+
return $value;
|
924 |
+
}
|
925 |
+
|
926 |
+
/**
|
927 |
+
* md5 function
|
928 |
+
*
|
929 |
+
* @param $value
|
930 |
+
*/
|
931 |
+
public static function func_md5( $value ) {
|
932 |
+
return apply_filters( 'func_md5', md5( $value ), $value );
|
933 |
+
}
|
934 |
+
|
935 |
+
public function make_api_test() {
|
936 |
+
parse_str( $_POST['data']['data'], $data );
|
937 |
+
|
938 |
+
if ( ! is_array( $data ) ) {
|
939 |
+
die( '-1' );
|
940 |
+
}
|
941 |
+
|
942 |
+
$action_id = isset( $_POST['data']['action_id'] ) ? (int) sanitize_text_field( $_POST['data']['action_id'] ) : '';
|
943 |
+
$cf7_id = isset( $_POST['data']['cf7_id'] ) ? (int) sanitize_text_field( $_POST['data']['cf7_id'] ) : '';
|
944 |
+
$rule_id = isset( $_POST['data']['rule_id'] ) ? $_POST['data']['rule_id'] : '';
|
945 |
+
|
946 |
+
add_filter( 'after_qs_cf7_api_send_lead', array( $this, 'after_fake_submission' ), 10, 3 );
|
947 |
+
|
948 |
+
if ( isset( $data['wpcf7-redirect']['actions'] ) ) {
|
949 |
+
$response = array();
|
950 |
+
|
951 |
+
$posted_action = reset( $data['wpcf7-redirect']['actions'] );
|
952 |
+
$posted_action = $posted_action['test_values'];
|
953 |
+
$_POST = $posted_action;
|
954 |
+
// this will create a fake form submission
|
955 |
+
$this->cf7r_form = get_cf7r_form( $cf7_id );
|
956 |
+
$this->cf7r_form->enable_action( $action_id );
|
957 |
+
|
958 |
+
$cf7_form = $this->cf7r_form->get_cf7_form_instance();
|
959 |
+
$submission = WPCF7_Submission::get_instance( $cf7_form );
|
960 |
+
|
961 |
+
if ( $submission->get_status() === 'validation_failed' ) {
|
962 |
+
$invalid_fields = $submission->get_invalid_fields();
|
963 |
+
$response['status'] = 'failed';
|
964 |
+
$response['invalid_fields'] = $invalid_fields;
|
965 |
+
} else {
|
966 |
+
$response['status'] = 'success';
|
967 |
+
$response['html'] = $this->get_test_api_results_html();
|
968 |
+
}
|
969 |
+
|
970 |
+
wp_send_json( $response );
|
971 |
+
}
|
972 |
+
}
|
973 |
+
/**
|
974 |
+
* Store the results from the API
|
975 |
+
*
|
976 |
+
* @param $result
|
977 |
+
* @param $record
|
978 |
+
*/
|
979 |
+
public function after_fake_submission( $result, $record, $args ) {
|
980 |
+
$this->results = $result;
|
981 |
+
$this->record = $record;
|
982 |
+
$this->request = $args;
|
983 |
+
|
984 |
+
return $result;
|
985 |
+
}
|
986 |
+
|
987 |
+
/**
|
988 |
+
* Show A preview for the action
|
989 |
+
*/
|
990 |
+
public function show_action_preview() {
|
991 |
+
if ( isset( $_GET['wpcf7r-preview'] ) ) {
|
992 |
+
$action_id = (int) $_GET['wpcf7r-preview'];
|
993 |
+
|
994 |
+
$action = WPCF7R_Action::get_action( $action_id );
|
995 |
+
|
996 |
+
$action->dynamic_params['popup-template'] = isset( $_GET['template'] ) ? sanitize_text_field( $_GET['template'] ) : '';
|
997 |
+
|
998 |
+
$action->preview();
|
999 |
+
}
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
/**
|
1003 |
+
* Get action template in case field are dynamicaly changed
|
1004 |
+
*/
|
1005 |
+
public function get_action_template() {
|
1006 |
+
$data = isset( $_POST['data'] ) ? $_POST['data'] : '';
|
1007 |
+
|
1008 |
+
$response = array();
|
1009 |
+
|
1010 |
+
if ( isset( $data['action_id'] ) ) {
|
1011 |
+
$action_id = (int) $data['action_id'];
|
1012 |
+
$popup_template = sanitize_text_field( $data['template'] );
|
1013 |
+
|
1014 |
+
$action = WPCF7R_Action::get_action( $action_id );
|
1015 |
+
|
1016 |
+
ob_start();
|
1017 |
+
|
1018 |
+
$params = array(
|
1019 |
+
'popup-template' => $popup_template,
|
1020 |
+
);
|
1021 |
+
|
1022 |
+
$action->get_action_settings( $params );
|
1023 |
+
|
1024 |
+
$response['action_content'] = ob_get_clean();
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
wp_send_json_success( $response );
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
/**
|
1031 |
+
* Get the popup html
|
1032 |
+
*/
|
1033 |
+
public function get_test_api_results_html() {
|
1034 |
+
ob_start();
|
1035 |
+
|
1036 |
+
include WPCF7_PRO_REDIRECT_TEMPLATE_PATH . 'popup-api-test.php';
|
1037 |
+
|
1038 |
+
return ob_get_clean();
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
/**
|
1042 |
+
* Get lists, maybe create new list
|
1043 |
+
*/
|
1044 |
+
public function get_mailchimp_lists() {
|
1045 |
+
$data = $_POST['data'];
|
1046 |
+
|
1047 |
+
$results = array();
|
1048 |
+
|
1049 |
+
if ( ! is_array( $data ) ) {
|
1050 |
+
die( '-1' );
|
1051 |
+
}
|
1052 |
+
|
1053 |
+
$api_key = $data['mailchimp_api_key'];
|
1054 |
+
|
1055 |
+
// A request to create a list
|
1056 |
+
if ( isset( $data['list_name'] ) && $data['list_name'] ) {
|
1057 |
+
$new_list_results = WPCF7R_Mailchimp_Helper::create_list( $api_key, $data['list_name'] );
|
1058 |
+
|
1059 |
+
if ( is_wp_error( $new_list_results ) ) {
|
1060 |
+
$results['error'] = $new_list_results->get_error_message();
|
1061 |
+
}
|
1062 |
+
}
|
1063 |
+
|
1064 |
+
// In the end return the lists
|
1065 |
+
if ( ! isset( $results['error'] ) ) {
|
1066 |
+
$lists = WPCF7R_Mailchimp_Helper::get_lists_clean( $api_key );
|
1067 |
+
|
1068 |
+
update_post_meta( $data['action_id'], 'mailchimp_lists', $lists );
|
1069 |
+
|
1070 |
+
if ( is_wp_error( $lists ) ) {
|
1071 |
+
$results['error'] = $lists->get_error_message();
|
1072 |
+
} else {
|
1073 |
+
$results['lists'] = $lists;
|
1074 |
+
}
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
wp_send_json( $results );
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
}
|
modules/cf7-shortcode-password-field.php
CHANGED
@@ -1,224 +1,224 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* A base module for the following types of tags:
|
4 |
-
* [text] and [text*] # Single-line text
|
5 |
-
* [email] and [email*] # Email address
|
6 |
-
* [url] and [url*] # URL
|
7 |
-
* [tel] and [tel*] # Telephone number
|
8 |
-
*/
|
9 |
-
|
10 |
-
defined( 'ABSPATH' ) || exit;
|
11 |
-
|
12 |
-
/* form_tag handler */
|
13 |
-
add_action( 'wpcf7_init', 'wpcf7_add_form_tag_password', 10, 0 );
|
14 |
-
|
15 |
-
function wpcf7_add_form_tag_password() {
|
16 |
-
if ( function_exists( 'wpcf7_add_form_tag' ) ) {
|
17 |
-
wpcf7_add_form_tag(
|
18 |
-
array( 'password', 'password*' ),
|
19 |
-
'wpcf7_password_form_tag_handler',
|
20 |
-
array( 'name-attr' => true )
|
21 |
-
);
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
-
function wpcf7_password_form_tag_handler( $tag ) {
|
26 |
-
if ( empty( $tag->name ) ) {
|
27 |
-
return '';
|
28 |
-
}
|
29 |
-
|
30 |
-
$validation_error = wpcf7_get_validation_error( $tag->name );
|
31 |
-
$class = wpcf7_form_controls_class( $tag->type, 'wpcf7-password' );
|
32 |
-
|
33 |
-
if ( in_array( $tag->basetype, array( 'password' ), true ) ) {
|
34 |
-
$class .= ' wpcf7-validates-as-' . $tag->basetype;
|
35 |
-
}
|
36 |
-
|
37 |
-
if ( $validation_error ) {
|
38 |
-
$class .= ' wpcf7-not-valid';
|
39 |
-
}
|
40 |
-
|
41 |
-
$atts = array();
|
42 |
-
$atts['size'] = $tag->get_size_option( '40' );
|
43 |
-
$atts['maxlength'] = $tag->get_maxlength_option();
|
44 |
-
$atts['minlength'] = $tag->get_minlength_option();
|
45 |
-
|
46 |
-
if ( $atts['maxlength'] && $atts['minlength'] ) {
|
47 |
-
$atts['pattern'] = ".{{$atts['minlength']},{$atts['maxlength']}}";
|
48 |
-
} elseif ( $atts['minlength'] ) {
|
49 |
-
$atts['pattern'] = ".{{$atts['minlength']},}";
|
50 |
-
}
|
51 |
-
|
52 |
-
if ( $atts['maxlength'] and $atts['minlength'] && $atts['maxlength'] < $atts['minlength'] ) {
|
53 |
-
unset( $atts['maxlength'], $atts['minlength'] );
|
54 |
-
}
|
55 |
-
|
56 |
-
$atts['class'] = $tag->get_class_option( $class );
|
57 |
-
$atts['id'] = $tag->get_id_option();
|
58 |
-
$atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
|
59 |
-
$atts['autocomplete'] = $tag->get_option(
|
60 |
-
'autocomplete',
|
61 |
-
'[-0-9a-zA-Z]+',
|
62 |
-
true
|
63 |
-
);
|
64 |
-
|
65 |
-
if ( $tag->has_option( 'readonly' ) ) {
|
66 |
-
$atts['readonly'] = 'readonly';
|
67 |
-
}
|
68 |
-
|
69 |
-
if ( $tag->is_required() ) {
|
70 |
-
$atts['aria-required'] = 'true';
|
71 |
-
}
|
72 |
-
|
73 |
-
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
|
74 |
-
$value = (string) reset( $tag->values );
|
75 |
-
|
76 |
-
if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
|
77 |
-
$atts['placeholder'] = $value;
|
78 |
-
$value = '';
|
79 |
-
}
|
80 |
-
|
81 |
-
$value = $tag->get_default_option( $value );
|
82 |
-
$value = wpcf7_get_hangover( $tag->name, $value );
|
83 |
-
$atts['value'] = $value;
|
84 |
-
|
85 |
-
if ( wpcf7_support_html5() ) {
|
86 |
-
$atts['type'] = $tag->basetype;
|
87 |
-
} else {
|
88 |
-
$atts['type'] = 'password';
|
89 |
-
}
|
90 |
-
|
91 |
-
$atts['name'] = $tag->name;
|
92 |
-
$atts = wpcf7_format_atts( $atts );
|
93 |
-
$html = sprintf(
|
94 |
-
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s autocomplete="false"/>%3$s</span>',
|
95 |
-
sanitize_html_class( $tag->name ),
|
96 |
-
$atts,
|
97 |
-
$validation_error
|
98 |
-
);
|
99 |
-
|
100 |
-
return $html;
|
101 |
-
}
|
102 |
-
|
103 |
-
/* Validation filter */
|
104 |
-
add_filter( 'wpcf7_validate_password', 'wpcf7_password_validation_filter', 10, 2 );
|
105 |
-
add_filter( 'wpcf7_validate_password*', 'wpcf7_password_validation_filter', 10, 2 );
|
106 |
-
|
107 |
-
function wpcf7_password_validation_filter( $result, $tag ) {
|
108 |
-
$name = $tag->name;
|
109 |
-
$value = isset( $_POST[ $name ] )
|
110 |
-
? trim( wp_unslash( strtr( (string) $_POST[ $name ], "\n", ' ' ) ) )
|
111 |
-
: '';
|
112 |
-
if ( 'password' === $tag->basetype ) {
|
113 |
-
if ( $tag->is_required() and '' === $value ) {
|
114 |
-
$result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
|
115 |
-
}
|
116 |
-
$atts['maxlength'] = $tag->get_maxlength_option();
|
117 |
-
$atts['minlength'] = $tag->get_minlength_option();
|
118 |
-
if ( $atts['maxlength'] && strlen( $value ) > $atts['maxlength'] ) {
|
119 |
-
$result->invalidate( $tag, wpcf7_get_message( 'invalid_too_long' ) );
|
120 |
-
}
|
121 |
-
if ( $atts['minlength'] && strlen( $value ) < $atts['minlength'] ) {
|
122 |
-
$result->invalidate( $tag, wpcf7_get_message( 'invalid_too_short' ) );
|
123 |
-
}
|
124 |
-
}
|
125 |
-
return $result;
|
126 |
-
}
|
127 |
-
|
128 |
-
/* Messages */
|
129 |
-
add_filter( 'wpcf7_messages', 'wpcf7_password_messages', 10, 1 );
|
130 |
-
|
131 |
-
function wpcf7_password_messages( $messages ) {
|
132 |
-
$messages = array_merge(
|
133 |
-
$messages,
|
134 |
-
array(
|
135 |
-
'invalid_email' => array(
|
136 |
-
'description' =>
|
137 |
-
__( 'Email address that the sender entered is invalid', 'wpcf7-redirect' ),
|
138 |
-
'default' =>
|
139 |
-
__( 'The e-mail address entered is invalid.', 'wpcf7-redirect' ),
|
140 |
-
),
|
141 |
-
'invalid_url' => array(
|
142 |
-
'description' =>
|
143 |
-
__( 'URL that the sender entered is invalid', 'wpcf7-redirect' ),
|
144 |
-
'default' =>
|
145 |
-
__( 'The URL is invalid.', 'wpcf7-redirect' ),
|
146 |
-
),
|
147 |
-
'invalid_tel' => array(
|
148 |
-
'description' =>
|
149 |
-
__( 'Telephone number that the sender entered is invalid', 'wpcf7-redirect' ),
|
150 |
-
'default' =>
|
151 |
-
__( 'The telephone number is invalid.', 'wpcf7-redirect' ),
|
152 |
-
),
|
153 |
-
)
|
154 |
-
);
|
155 |
-
return $messages;
|
156 |
-
}
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Tag generator
|
160 |
-
*/
|
161 |
-
add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_password', 15, 0 );
|
162 |
-
|
163 |
-
function wpcf7_add_tag_generator_password() {
|
164 |
-
$tag_generator = WPCF7_TagGenerator::get_instance();
|
165 |
-
$tag_generator->add(
|
166 |
-
'password',
|
167 |
-
__( 'password', 'wpcf7-redirect' ),
|
168 |
-
'wpcf7_tag_generator_password'
|
169 |
-
);
|
170 |
-
}
|
171 |
-
|
172 |
-
function wpcf7_tag_generator_password( $contact_form, $args = '' ) {
|
173 |
-
$args = wp_parse_args( $args, array() );
|
174 |
-
$type = $args['id'];
|
175 |
-
|
176 |
-
if ( 'password' === $type ) {
|
177 |
-
$description = __( 'Generate a form-tag for a single-line plain password input field.', 'wpcf7-redirect' );
|
178 |
-
}
|
179 |
-
|
180 |
-
?>
|
181 |
-
<div class="control-box">
|
182 |
-
<fieldset>
|
183 |
-
<table class="form-table">
|
184 |
-
<tbody>
|
185 |
-
<tr>
|
186 |
-
<th scope="row"><?php echo esc_html( __( 'Field type', 'wpcf7-redirect' ) ); ?></th>
|
187 |
-
<td>
|
188 |
-
<fieldset>
|
189 |
-
<legend class="screen-reader-text"><?php echo esc_html( __( 'Field type', 'wpcf7-redirect' ) ); ?></legend>
|
190 |
-
<label><input type="checkbox" name="required" /> <?php echo esc_html( __( 'Required field', 'wpcf7-redirect' ) ); ?></label>
|
191 |
-
</fieldset>
|
192 |
-
</td>
|
193 |
-
</tr>
|
194 |
-
<tr>
|
195 |
-
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'wpcf7-redirect' ) ); ?></label></th>
|
196 |
-
<td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td>
|
197 |
-
</tr>
|
198 |
-
<tr>
|
199 |
-
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-values' ); ?>"><?php echo esc_html( __( 'Default value', 'wpcf7-redirect' ) ); ?></label></th>
|
200 |
-
<td><input type="text" name="values" class="oneline" id="<?php echo esc_attr( $args['content'] . '-values' ); ?>" /><br />
|
201 |
-
<label><input type="checkbox" name="placeholder" class="option" /> <?php echo esc_html( __( 'Use this text as the placeholder of the field', 'wpcf7-redirect' ) ); ?></label></td>
|
202 |
-
</tr>
|
203 |
-
<tr>
|
204 |
-
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'wpcf7-redirect' ) ); ?></label></th>
|
205 |
-
<td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td>
|
206 |
-
</tr>
|
207 |
-
<tr>
|
208 |
-
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'wpcf7-redirect' ) ); ?></label></th>
|
209 |
-
<td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td>
|
210 |
-
</tr>
|
211 |
-
</tbody>
|
212 |
-
</table>
|
213 |
-
</fieldset>
|
214 |
-
</div>
|
215 |
-
<div class="insert-box">
|
216 |
-
<input type="text" name="<?php echo $type; ?>" class="tag code" readonly="readonly" onfocus="this.select()" />
|
217 |
-
<div class="submitbox">
|
218 |
-
<input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'wpcf7-redirect' ) ); ?>" />
|
219 |
-
</div>
|
220 |
-
<br class="clear" />
|
221 |
-
<p class="description mail-tag"><label for="<?php echo esc_attr( $args['content'] . '-mailtag' ); ?>"><?php echo sprintf( esc_html( __( 'To use the value input through this field in a mail field, you need to insert the corresponding mail-tag into the field on the Mail tab.', 'wpcf7-redirect' ) ), '<strong><span class="mail-tag"></span></strong>' ); ?><input type="text" class="mail-tag code hidden" readonly="readonly" id="<?php echo esc_attr( $args['content'] . '-mailtag' ); ?>" /></label></p>
|
222 |
-
</div>
|
223 |
-
<?php
|
224 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* A base module for the following types of tags:
|
4 |
+
* [text] and [text*] # Single-line text
|
5 |
+
* [email] and [email*] # Email address
|
6 |
+
* [url] and [url*] # URL
|
7 |
+
* [tel] and [tel*] # Telephone number
|
8 |
+
*/
|
9 |
+
|
10 |
+
defined( 'ABSPATH' ) || exit;
|
11 |
+
|
12 |
+
/* form_tag handler */
|
13 |
+
add_action( 'wpcf7_init', 'wpcf7_add_form_tag_password', 10, 0 );
|
14 |
+
|
15 |
+
function wpcf7_add_form_tag_password() {
|
16 |
+
if ( function_exists( 'wpcf7_add_form_tag' ) ) {
|
17 |
+
wpcf7_add_form_tag(
|
18 |
+
array( 'password', 'password*' ),
|
19 |
+
'wpcf7_password_form_tag_handler',
|
20 |
+
array( 'name-attr' => true )
|
21 |
+
);
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
function wpcf7_password_form_tag_handler( $tag ) {
|
26 |
+
if ( empty( $tag->name ) ) {
|
27 |
+
return '';
|
28 |
+
}
|
29 |
+
|
30 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
31 |
+
$class = wpcf7_form_controls_class( $tag->type, 'wpcf7-password' );
|
32 |
+
|
33 |
+
if ( in_array( $tag->basetype, array( 'password' ), true ) ) {
|
34 |
+
$class .= ' wpcf7-validates-as-' . $tag->basetype;
|
35 |
+
}
|
36 |
+
|
37 |
+
if ( $validation_error ) {
|
38 |
+
$class .= ' wpcf7-not-valid';
|
39 |
+
}
|
40 |
+
|
41 |
+
$atts = array();
|
42 |
+
$atts['size'] = $tag->get_size_option( '40' );
|
43 |
+
$atts['maxlength'] = $tag->get_maxlength_option();
|
44 |
+
$atts['minlength'] = $tag->get_minlength_option();
|
45 |
+
|
46 |
+
if ( $atts['maxlength'] && $atts['minlength'] ) {
|
47 |
+
$atts['pattern'] = ".{{$atts['minlength']},{$atts['maxlength']}}";
|
48 |
+
} elseif ( $atts['minlength'] ) {
|
49 |
+
$atts['pattern'] = ".{{$atts['minlength']},}";
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( $atts['maxlength'] and $atts['minlength'] && $atts['maxlength'] < $atts['minlength'] ) {
|
53 |
+
unset( $atts['maxlength'], $atts['minlength'] );
|
54 |
+
}
|
55 |
+
|
56 |
+
$atts['class'] = $tag->get_class_option( $class );
|
57 |
+
$atts['id'] = $tag->get_id_option();
|
58 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
|
59 |
+
$atts['autocomplete'] = $tag->get_option(
|
60 |
+
'autocomplete',
|
61 |
+
'[-0-9a-zA-Z]+',
|
62 |
+
true
|
63 |
+
);
|
64 |
+
|
65 |
+
if ( $tag->has_option( 'readonly' ) ) {
|
66 |
+
$atts['readonly'] = 'readonly';
|
67 |
+
}
|
68 |
+
|
69 |
+
if ( $tag->is_required() ) {
|
70 |
+
$atts['aria-required'] = 'true';
|
71 |
+
}
|
72 |
+
|
73 |
+
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
|
74 |
+
$value = (string) reset( $tag->values );
|
75 |
+
|
76 |
+
if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
|
77 |
+
$atts['placeholder'] = $value;
|
78 |
+
$value = '';
|
79 |
+
}
|
80 |
+
|
81 |
+
$value = $tag->get_default_option( $value );
|
82 |
+
$value = wpcf7_get_hangover( $tag->name, $value );
|
83 |
+
$atts['value'] = $value;
|
84 |
+
|
85 |
+
if ( wpcf7_support_html5() ) {
|
86 |
+
$atts['type'] = $tag->basetype;
|
87 |
+
} else {
|
88 |
+
$atts['type'] = 'password';
|
89 |
+
}
|
90 |
+
|
91 |
+
$atts['name'] = $tag->name;
|
92 |
+
$atts = wpcf7_format_atts( $atts );
|
93 |
+
$html = sprintf(
|
94 |
+
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s autocomplete="false"/>%3$s</span>',
|
95 |
+
sanitize_html_class( $tag->name ),
|
96 |
+
$atts,
|
97 |
+
$validation_error
|
98 |
+
);
|
99 |
+
|
100 |
+
return $html;
|
101 |
+
}
|
102 |
+
|
103 |
+
/* Validation filter */
|
104 |
+
add_filter( 'wpcf7_validate_password', 'wpcf7_password_validation_filter', 10, 2 );
|
105 |
+
add_filter( 'wpcf7_validate_password*', 'wpcf7_password_validation_filter', 10, 2 );
|
106 |
+
|
107 |
+
function wpcf7_password_validation_filter( $result, $tag ) {
|
108 |
+
$name = $tag->name;
|
109 |
+
$value = isset( $_POST[ $name ] )
|
110 |
+
? trim( wp_unslash( strtr( (string) $_POST[ $name ], "\n", ' ' ) ) )
|
111 |
+
: '';
|
112 |
+
if ( 'password' === $tag->basetype ) {
|
113 |
+
if ( $tag->is_required() and '' === $value ) {
|
114 |
+
$result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
|
115 |
+
}
|
116 |
+
$atts['maxlength'] = $tag->get_maxlength_option();
|
117 |
+
$atts['minlength'] = $tag->get_minlength_option();
|
118 |
+
if ( $atts['maxlength'] && strlen( $value ) > $atts['maxlength'] ) {
|
119 |
+
$result->invalidate( $tag, wpcf7_get_message( 'invalid_too_long' ) );
|
120 |
+
}
|
121 |
+
if ( $atts['minlength'] && strlen( $value ) < $atts['minlength'] ) {
|
122 |
+
$result->invalidate( $tag, wpcf7_get_message( 'invalid_too_short' ) );
|
123 |
+
}
|
124 |
+
}
|
125 |
+
return $result;
|
126 |
+
}
|
127 |
+
|
128 |
+
/* Messages */
|
129 |
+
add_filter( 'wpcf7_messages', 'wpcf7_password_messages', 10, 1 );
|
130 |
+
|
131 |
+
function wpcf7_password_messages( $messages ) {
|
132 |
+
$messages = array_merge(
|
133 |
+
$messages,
|
134 |
+
array(
|
135 |
+
'invalid_email' => array(
|
136 |
+
'description' =>
|
137 |
+
__( 'Email address that the sender entered is invalid', 'wpcf7-redirect' ),
|
138 |
+
'default' =>
|
139 |
+
__( 'The e-mail address entered is invalid.', 'wpcf7-redirect' ),
|
140 |
+
),
|
141 |
+
'invalid_url' => array(
|
142 |
+
'description' =>
|
143 |
+
__( 'URL that the sender entered is invalid', 'wpcf7-redirect' ),
|
144 |
+
'default' =>
|
145 |
+
__( 'The URL is invalid.', 'wpcf7-redirect' ),
|
146 |
+
),
|
147 |
+
'invalid_tel' => array(
|
148 |
+
'description' =>
|
149 |
+
__( 'Telephone number that the sender entered is invalid', 'wpcf7-redirect' ),
|
150 |
+
'default' =>
|
151 |
+
__( 'The telephone number is invalid.', 'wpcf7-redirect' ),
|
152 |
+
),
|
153 |
+
)
|
154 |
+
);
|
155 |
+
return $messages;
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Tag generator
|
160 |
+
*/
|
161 |
+
add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_password', 15, 0 );
|
162 |
+
|
163 |
+
function wpcf7_add_tag_generator_password() {
|
164 |
+
$tag_generator = WPCF7_TagGenerator::get_instance();
|
165 |
+
$tag_generator->add(
|
166 |
+
'password',
|
167 |
+
__( 'password', 'wpcf7-redirect' ),
|
168 |
+
'wpcf7_tag_generator_password'
|
169 |
+
);
|
170 |
+
}
|
171 |
+
|
172 |
+
function wpcf7_tag_generator_password( $contact_form, $args = '' ) {
|
173 |
+
$args = wp_parse_args( $args, array() );
|
174 |
+
$type = $args['id'];
|
175 |
+
|
176 |
+
if ( 'password' === $type ) {
|
177 |
+
$description = __( 'Generate a form-tag for a single-line plain password input field.', 'wpcf7-redirect' );
|
178 |
+
}
|
179 |
+
|
180 |
+
?>
|
181 |
+
<div class="control-box">
|
182 |
+
<fieldset>
|
183 |
+
<table class="form-table">
|
184 |
+
<tbody>
|
185 |
+
<tr>
|
186 |
+
<th scope="row"><?php echo esc_html( __( 'Field type', 'wpcf7-redirect' ) ); ?></th>
|
187 |
+
<td>
|
188 |
+
<fieldset>
|
189 |
+
<legend class="screen-reader-text"><?php echo esc_html( __( 'Field type', 'wpcf7-redirect' ) ); ?></legend>
|
190 |
+
<label><input type="checkbox" name="required" /> <?php echo esc_html( __( 'Required field', 'wpcf7-redirect' ) ); ?></label>
|
191 |
+
</fieldset>
|
192 |
+
</td>
|
193 |
+
</tr>
|
194 |
+
<tr>
|
195 |
+
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'wpcf7-redirect' ) ); ?></label></th>
|
196 |
+
<td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td>
|
197 |
+
</tr>
|
198 |
+
<tr>
|
199 |
+
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-values' ); ?>"><?php echo esc_html( __( 'Default value', 'wpcf7-redirect' ) ); ?></label></th>
|
200 |
+
<td><input type="text" name="values" class="oneline" id="<?php echo esc_attr( $args['content'] . '-values' ); ?>" /><br />
|
201 |
+
<label><input type="checkbox" name="placeholder" class="option" /> <?php echo esc_html( __( 'Use this text as the placeholder of the field', 'wpcf7-redirect' ) ); ?></label></td>
|
202 |
+
</tr>
|
203 |
+
<tr>
|
204 |
+
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'wpcf7-redirect' ) ); ?></label></th>
|
205 |
+
<td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td>
|
206 |
+
</tr>
|
207 |
+
<tr>
|
208 |
+
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'wpcf7-redirect' ) ); ?></label></th>
|
209 |
+
<td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td>
|
210 |
+
</tr>
|
211 |
+
</tbody>
|
212 |
+
</table>
|
213 |
+
</fieldset>
|
214 |
+
</div>
|
215 |
+
<div class="insert-box">
|
216 |
+
<input type="text" name="<?php echo $type; ?>" class="tag code" readonly="readonly" onfocus="this.select()" />
|
217 |
+
<div class="submitbox">
|
218 |
+
<input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'wpcf7-redirect' ) ); ?>" />
|
219 |
+
</div>
|
220 |
+
<br class="clear" />
|
221 |
+
<p class="description mail-tag"><label for="<?php echo esc_attr( $args['content'] . '-mailtag' ); ?>"><?php echo sprintf( esc_html( __( 'To use the value input through this field in a mail field, you need to insert the corresponding mail-tag into the field on the Mail tab.', 'wpcf7-redirect' ) ), '<strong><span class="mail-tag"></span></strong>' ); ?><input type="text" class="mail-tag code hidden" readonly="readonly" id="<?php echo esc_attr( $args['content'] . '-mailtag' ); ?>" /></label></p>
|
222 |
+
</div>
|
223 |
+
<?php
|
224 |
+
}
|
modules/cf7r-shortcode-get-param-field.php
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Get params from the redirect page
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
add_shortcode( 'get_param', 'wpcf7r_get_param' );
|
9 |
-
add_shortcode( 'wpcf7r_posted_param', 'wpcf7r_get_param' );
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Collect the data from the query string by parameter
|
13 |
-
*/
|
14 |
-
function wpcf7r_get_param( $atts ) {
|
15 |
-
$atts = shortcode_atts(
|
16 |
-
array(
|
17 |
-
'param' => '',
|
18 |
-
),
|
19 |
-
$atts,
|
20 |
-
'wpcf7-redirect'
|
21 |
-
);
|
22 |
-
$param = '';
|
23 |
-
|
24 |
-
if ( isset( $_GET[ $atts['param'] ] ) && $_GET[ $atts['param'] ] ) {
|
25 |
-
$param = esc_attr( wp_kses( $_GET[ $atts['param'] ], array( '' ) ) );
|
26 |
-
}
|
27 |
-
|
28 |
-
return $param;
|
29 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Get params from the redirect page
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
add_shortcode( 'get_param', 'wpcf7r_get_param' );
|
9 |
+
add_shortcode( 'wpcf7r_posted_param', 'wpcf7r_get_param' );
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Collect the data from the query string by parameter
|
13 |
+
*/
|
14 |
+
function wpcf7r_get_param( $atts ) {
|
15 |
+
$atts = shortcode_atts(
|
16 |
+
array(
|
17 |
+
'param' => '',
|
18 |
+
),
|
19 |
+
$atts,
|
20 |
+
'wpcf7-redirect'
|
21 |
+
);
|
22 |
+
$param = '';
|
23 |
+
|
24 |
+
if ( isset( $_GET[ $atts['param'] ] ) && $_GET[ $atts['param'] ] ) {
|
25 |
+
$param = esc_attr( wp_kses( $_GET[ $atts['param'] ], array( '' ) ) );
|
26 |
+
}
|
27 |
+
|
28 |
+
return $param;
|
29 |
+
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Tags: contact form 7 redirect, contact form 7 thank you page, redirect cf7, redi
|
|
3 |
Contributors: yuvalsabar, regevlio
|
4 |
Requires at least: 4.7.0
|
5 |
Tested up to: 5.6
|
6 |
-
Stable tag: 2.3.
|
7 |
License: GPLv3 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -78,6 +78,11 @@ No. One of the reasons we developed this plugin, is because on_send_ok is now de
|
|
78 |
|
79 |
== Changelog ==
|
80 |
|
|
|
|
|
|
|
|
|
|
|
81 |
= 2.2.9 =
|
82 |
* Added Export leads to csv option.
|
83 |
* Added Duplicate action button.
|
3 |
Contributors: yuvalsabar, regevlio
|
4 |
Requires at least: 4.7.0
|
5 |
Tested up to: 5.6
|
6 |
+
Stable tag: 2.3.1
|
7 |
License: GPLv3 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
78 |
|
79 |
== Changelog ==
|
80 |
|
81 |
+
= 2.3.1 =
|
82 |
+
* Added index.php to directories to disable directory browsing.
|
83 |
+
* Fixed typo in popup action class name for receiving updates.
|
84 |
+
* Fixed extensions update process.
|
85 |
+
|
86 |
= 2.2.9 =
|
87 |
* Added Export leads to csv option.
|
88 |
* Added Duplicate action button.
|
templates/banner.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Display banner
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<div class="wpcfr-banner">
|
10 |
-
<div class="wpcfr-banner-holder">
|
11 |
-
<span class="dashicons dashicons-no close-banner" title="<?php _e( 'Close', 'wpcf7-redirect' ); ?>"></span>
|
12 |
-
<a href="https://redirection-for-contact-form7.com/" target="_blank">
|
13 |
-
<img src="<?php echo wpcf7r_get_redirect_plugin_url(); ?>/assets/images/banner.png" alt="Get pro version" />
|
14 |
-
</a>
|
15 |
-
</div>
|
16 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Display banner
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="wpcfr-banner">
|
10 |
+
<div class="wpcfr-banner-holder">
|
11 |
+
<span class="dashicons dashicons-no close-banner" title="<?php _e( 'Close', 'wpcf7-redirect' ); ?>"></span>
|
12 |
+
<a href="https://redirection-for-contact-form7.com/" target="_blank">
|
13 |
+
<img src="<?php echo wpcf7r_get_redirect_plugin_url(); ?>/assets/images/banner.png" alt="Get pro version" />
|
14 |
+
</a>
|
15 |
+
</div>
|
16 |
+
</div>
|
templates/block-html.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Displays a condition logic HTML block
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
self::conditional_groups_display( $group_block, $prefix );
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Displays a condition logic HTML block
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
self::conditional_groups_display( $group_block, $prefix );
|
templates/block-title.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Displays a conditional block title
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<div class="block-title <?php echo $active_tab_title; ?>" data-rel="<?php echo $group_block_key; ?>">
|
10 |
-
<?php $active_tab_title = ''; ?>
|
11 |
-
<span class="dashicons dashicons-edit"></span>
|
12 |
-
<span class="dashicons dashicons-yes show-on-edit" data-rel="<?php echo $group_block_key; ?>"></span>
|
13 |
-
<span class="dashicons dashicons-no show-on-edit" data-rel="<?php echo $group_block_key; ?>"></span>
|
14 |
-
<span class="dashicons dashicons-minus show-on-edit remove-block"></span>
|
15 |
-
<input type="text" name="wpcf7-redirect<?php echo $prefix; ?>[blocks][<?php echo $group_block_key; ?>][block_title]" value="<?php echo $group_block['block_title']; ?>" data-original="<?php echo $group_block['block_title']; ?>" readonly="readonly">
|
16 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Displays a conditional block title
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="block-title <?php echo $active_tab_title; ?>" data-rel="<?php echo $group_block_key; ?>">
|
10 |
+
<?php $active_tab_title = ''; ?>
|
11 |
+
<span class="dashicons dashicons-edit"></span>
|
12 |
+
<span class="dashicons dashicons-yes show-on-edit" data-rel="<?php echo $group_block_key; ?>"></span>
|
13 |
+
<span class="dashicons dashicons-no show-on-edit" data-rel="<?php echo $group_block_key; ?>"></span>
|
14 |
+
<span class="dashicons dashicons-minus show-on-edit remove-block"></span>
|
15 |
+
<input type="text" name="wpcf7-redirect<?php echo $prefix; ?>[blocks][<?php echo $group_block_key; ?>][block_title]" value="<?php echo $group_block['block_title']; ?>" data-original="<?php echo $group_block['block_title']; ?>" readonly="readonly">
|
16 |
+
</div>
|
templates/default-settings.php
CHANGED
@@ -1,69 +1,69 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Displays the list of actions
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$rule_id = 'default';
|
9 |
-
$actions = $this->get_actions( $rule_id );
|
10 |
-
?>
|
11 |
-
|
12 |
-
<h2>
|
13 |
-
<?php _e( 'Submission Actions', 'wpcf7-redirect' ); ?>
|
14 |
-
</h2>
|
15 |
-
|
16 |
-
<legend>
|
17 |
-
<?php _e( 'You can add actions that will be fired on submission. For details and support check', 'wpcf7-redirect' ); ?> <a href="https://redirection-for-contact-form7.com/" target="_blank"><?php _e( 'official website', 'wpcf7-redirect' ); ?></a>.
|
18 |
-
</legend>
|
19 |
-
|
20 |
-
<div class="actions-list">
|
21 |
-
<div class="actions">
|
22 |
-
<table class="wp-list-table widefat fixed striped pages" data-wrapid="<?php echo $rule_id; ?>">
|
23 |
-
<thead>
|
24 |
-
<tr>
|
25 |
-
<th class="manage-column check-column">
|
26 |
-
<a href="#"><?php _e( 'No.', 'wpcf7-redirect' ); ?></a>
|
27 |
-
</th>
|
28 |
-
<th class="manage-column column-title column-primary sortable desc">
|
29 |
-
<a href="#"><?php _e( 'Title', 'wpcf7-redirect' ); ?></a>
|
30 |
-
</th>
|
31 |
-
<th class="manage-column column-primary sortable desc">
|
32 |
-
<a href="#"><?php _e( 'Type', 'wpcf7-redirect' ); ?></a>
|
33 |
-
</th>
|
34 |
-
<th class="manage-column column-primary sortable desc">
|
35 |
-
<a href="#"><?php _e( 'Active', 'wpcf7-redirect' ); ?></a>
|
36 |
-
</th>
|
37 |
-
<th class="manage-column check-column">
|
38 |
-
</th>
|
39 |
-
</tr>
|
40 |
-
</thead>
|
41 |
-
<tbody id="the_list">
|
42 |
-
<?php if ( $actions ) : ?>
|
43 |
-
<?php foreach ( $actions as $action ) : ?>
|
44 |
-
<?php echo $action->get_action_row(); ?>
|
45 |
-
<?php endforeach; ?>
|
46 |
-
<?php endif; ?>
|
47 |
-
</tbody>
|
48 |
-
</table>
|
49 |
-
</div>
|
50 |
-
<div class="add-new-action-wrap">
|
51 |
-
<select class="new-action-selector" name="new-action-selector">
|
52 |
-
<option value="" selected="selected"><?php _e( 'Choose Action', 'wpcf7-redirect' ); ?></option>
|
53 |
-
<?php foreach ( wpcf7r_get_available_actions() as $available_action_key => $available_action_label ) : ?>
|
54 |
-
<option value="<?php echo $available_action_key; ?>" <?php echo $available_action_label['attr']; ?>><?php echo $available_action_label['label']; ?></option>
|
55 |
-
<?php endforeach; ?>
|
56 |
-
|
57 |
-
<?php foreach ( wpcf7_get_extensions() as $extension ) : ?>
|
58 |
-
<?php if ( ! isset( $extension['active'] ) || ! $extension['active'] ) : ?>
|
59 |
-
<option value="<?php echo WPCF7_PRO_REDIRECT_PLUGIN_PAGE_URL . $extension['name']; ?>" data-action="purchase">
|
60 |
-
<?php echo $extension['title']; ?> (<?php _e( 'Purchase', 'wpcf7-redirect' ); ?>)
|
61 |
-
</option>
|
62 |
-
<?php endif; ?>
|
63 |
-
<?php endforeach; ?>
|
64 |
-
</select>
|
65 |
-
<a type="button" name="button" class="button-primary wpcf7-add-new-action" data-ruleid="<?php echo $rule_id; ?>" data-id="<?php echo $this->get_id(); ?>">
|
66 |
-
<?php _e( 'Add Action', 'wpcf7-redirect' ); ?>
|
67 |
-
</a>
|
68 |
-
</div>
|
69 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Displays the list of actions
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$rule_id = 'default';
|
9 |
+
$actions = $this->get_actions( $rule_id );
|
10 |
+
?>
|
11 |
+
|
12 |
+
<h2>
|
13 |
+
<?php _e( 'Submission Actions', 'wpcf7-redirect' ); ?>
|
14 |
+
</h2>
|
15 |
+
|
16 |
+
<legend>
|
17 |
+
<?php _e( 'You can add actions that will be fired on submission. For details and support check', 'wpcf7-redirect' ); ?> <a href="https://redirection-for-contact-form7.com/" target="_blank"><?php _e( 'official website', 'wpcf7-redirect' ); ?></a>.
|
18 |
+
</legend>
|
19 |
+
|
20 |
+
<div class="actions-list">
|
21 |
+
<div class="actions">
|
22 |
+
<table class="wp-list-table widefat fixed striped pages" data-wrapid="<?php echo $rule_id; ?>">
|
23 |
+
<thead>
|
24 |
+
<tr>
|
25 |
+
<th class="manage-column check-column">
|
26 |
+
<a href="#"><?php _e( 'No.', 'wpcf7-redirect' ); ?></a>
|
27 |
+
</th>
|
28 |
+
<th class="manage-column column-title column-primary sortable desc">
|
29 |
+
<a href="#"><?php _e( 'Title', 'wpcf7-redirect' ); ?></a>
|
30 |
+
</th>
|
31 |
+
<th class="manage-column column-primary sortable desc">
|
32 |
+
<a href="#"><?php _e( 'Type', 'wpcf7-redirect' ); ?></a>
|
33 |
+
</th>
|
34 |
+
<th class="manage-column column-primary sortable desc">
|
35 |
+
<a href="#"><?php _e( 'Active', 'wpcf7-redirect' ); ?></a>
|
36 |
+
</th>
|
37 |
+
<th class="manage-column check-column">
|
38 |
+
</th>
|
39 |
+
</tr>
|
40 |
+
</thead>
|
41 |
+
<tbody id="the_list">
|
42 |
+
<?php if ( $actions ) : ?>
|
43 |
+
<?php foreach ( $actions as $action ) : ?>
|
44 |
+
<?php echo $action->get_action_row(); ?>
|
45 |
+
<?php endforeach; ?>
|
46 |
+
<?php endif; ?>
|
47 |
+
</tbody>
|
48 |
+
</table>
|
49 |
+
</div>
|
50 |
+
<div class="add-new-action-wrap">
|
51 |
+
<select class="new-action-selector" name="new-action-selector">
|
52 |
+
<option value="" selected="selected"><?php _e( 'Choose Action', 'wpcf7-redirect' ); ?></option>
|
53 |
+
<?php foreach ( wpcf7r_get_available_actions() as $available_action_key => $available_action_label ) : ?>
|
54 |
+
<option value="<?php echo $available_action_key; ?>" <?php echo $available_action_label['attr']; ?>><?php echo $available_action_label['label']; ?></option>
|
55 |
+
<?php endforeach; ?>
|
56 |
+
|
57 |
+
<?php foreach ( wpcf7_get_extensions() as $extension ) : ?>
|
58 |
+
<?php if ( ! isset( $extension['active'] ) || ! $extension['active'] ) : ?>
|
59 |
+
<option value="<?php echo WPCF7_PRO_REDIRECT_PLUGIN_PAGE_URL . $extension['name']; ?>" data-action="purchase">
|
60 |
+
<?php echo $extension['title']; ?> (<?php _e( 'Purchase', 'wpcf7-redirect' ); ?>)
|
61 |
+
</option>
|
62 |
+
<?php endif; ?>
|
63 |
+
<?php endforeach; ?>
|
64 |
+
</select>
|
65 |
+
<a type="button" name="button" class="button-primary wpcf7-add-new-action" data-ruleid="<?php echo $rule_id; ?>" data-id="<?php echo $this->get_id(); ?>">
|
66 |
+
<?php _e( 'Add Action', 'wpcf7-redirect' ); ?>
|
67 |
+
</a>
|
68 |
+
</div>
|
69 |
+
</div>
|
templates/extensions.php
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Displays the extensions panel
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
wp_nonce_field( 'wpcf7_redirect_page_extensions', 'wpcf7_redirect_page_extensions_nonce' );
|
9 |
-
|
10 |
-
do_action( 'before_extensions_settings_tab_title', $this );
|
11 |
-
?>
|
12 |
-
|
13 |
-
<fieldset>
|
14 |
-
<div class="fields-wrap field-wrap-page-id">
|
15 |
-
<div class="tab-wrap">
|
16 |
-
<div class="wpcf7r-tab-wrap-inner">
|
17 |
-
<div data-tab-inner>
|
18 |
-
<?php include( 'extensions/extensions-table.php' ); ?>
|
19 |
-
</div>
|
20 |
-
</div>
|
21 |
-
</div>
|
22 |
-
</div>
|
23 |
-
</fieldset>
|
24 |
-
|
25 |
-
<?php
|
26 |
-
do_action( 'after_extensions_settings_tab_title', $this );
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Displays the extensions panel
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
wp_nonce_field( 'wpcf7_redirect_page_extensions', 'wpcf7_redirect_page_extensions_nonce' );
|
9 |
+
|
10 |
+
do_action( 'before_extensions_settings_tab_title', $this );
|
11 |
+
?>
|
12 |
+
|
13 |
+
<fieldset>
|
14 |
+
<div class="fields-wrap field-wrap-page-id">
|
15 |
+
<div class="tab-wrap">
|
16 |
+
<div class="wpcf7r-tab-wrap-inner">
|
17 |
+
<div data-tab-inner>
|
18 |
+
<?php include( 'extensions/extensions-table.php' ); ?>
|
19 |
+
</div>
|
20 |
+
</div>
|
21 |
+
</div>
|
22 |
+
</div>
|
23 |
+
</fieldset>
|
24 |
+
|
25 |
+
<?php
|
26 |
+
do_action( 'after_extensions_settings_tab_title', $this );
|
templates/extensions/extension-promo-box.php
CHANGED
@@ -1,81 +1,81 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render extension promo box
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$ver = $this->get_extension_ver();
|
9 |
-
$badge = method_exists( $this, 'get_badge' ) ? $this->get_badge() : '';
|
10 |
-
?>
|
11 |
-
|
12 |
-
<div class="promo-box <?php echo $this->get_name(); ?> <?php echo $this->needs_activation() ? 'needs-activation' : ''; ?> <?php echo $this->has_update() ? 'has-update' : ''; ?> <?php echo $this->get_name(); ?> <?php echo $this->is_active() ? 'active-ext' : ''; ?>" data-extension="<?php echo $this->get_name(); ?>">
|
13 |
-
<div class="promo-box-inner">
|
14 |
-
<div class="promo-bot-title">
|
15 |
-
<div class="promo-version">
|
16 |
-
<?php if ( $ver && ! $badge ) : ?>
|
17 |
-
<small>v.<?php echo $this->get_extension_ver(); ?></small> <span class="dashicons dashicons-editor-code"></span>
|
18 |
-
<?php elseif ( $badge ) : ?>
|
19 |
-
<?php echo $badge; ?>
|
20 |
-
<?php endif; ?>
|
21 |
-
</div>
|
22 |
-
|
23 |
-
<?php if ( ! $this->is_active() ) : ?>
|
24 |
-
<div class="promo-purchase-link">
|
25 |
-
<?php if ( $this->get_aff_url() ) : ?>
|
26 |
-
<a href="<?php echo $this->get_aff_url(); ?>" class=""><?php _e( 'Activate', 'wpcf7-redirect' ); ?></a>
|
27 |
-
<?php else : ?>
|
28 |
-
<span type="button" class="btn-activate"><?php _e( 'Activate', 'wpcf7-redirect' ); ?></span>
|
29 |
-
<?php endif; ?>
|
30 |
-
</div>
|
31 |
-
<?php endif; ?>
|
32 |
-
|
33 |
-
</div>
|
34 |
-
<div class="promo-box-content">
|
35 |
-
<div class="promo-box-thumb">
|
36 |
-
<img src="<?php echo $this->get_icon(); ?>" alt="<?php $this->get_name(); ?>">
|
37 |
-
</div>
|
38 |
-
<div class="promo-box-description">
|
39 |
-
<h3><?php echo $this->get_title(); ?></h3>
|
40 |
-
|
41 |
-
<div class="description">
|
42 |
-
<?php echo $this->get_description(); ?>
|
43 |
-
</div>
|
44 |
-
|
45 |
-
<div class="promo-actions-box">
|
46 |
-
<div class="actions">
|
47 |
-
<?php if ( $this->get_aff_url() ) : ?>
|
48 |
-
<a href="<?php echo $this->get_aff_url(); ?>" class="button-primary"><?php echo $this->get_btn_text(); ?></a>
|
49 |
-
<?php else : ?>
|
50 |
-
<?php if ( ! $this->is_active() ) : ?>
|
51 |
-
<?php if ( $this->extension_file_exists() ) : ?>
|
52 |
-
<span type="button" class="btn-activate"><?php _e( 'Activate' ); ?></span>
|
53 |
-
<?php else : ?>
|
54 |
-
<a href="<?php echo $this->get_purchase_link(); ?>" class="btn-getit" target="_blank">
|
55 |
-
<span class="get-it-label"><?php _e( 'Get It', 'wpcf7-redirect' ); ?></span><span class="dashicons dashicons-arrow-down-alt"></span>
|
56 |
-
</a>
|
57 |
-
<?php endif; ?>
|
58 |
-
<?php else : ?>
|
59 |
-
<span type="button" class="button-primary btn-deactivate" ><?php _e( 'Deactivate' ); ?></span>
|
60 |
-
<?php endif; ?>
|
61 |
-
|
62 |
-
<?php if ( $this->is_active() && $this->has_update() ) : ?>
|
63 |
-
<span type="button" class="button-primary btn-update"><?php _e( 'Update' ); ?></span>
|
64 |
-
<?php endif; ?>
|
65 |
-
|
66 |
-
<div class="serial">
|
67 |
-
<input type="text" class="serial-number" value="<?php echo $this->get_serial(); ?>" placeholder="<?php _e( 'License Key', 'wpcf7-redirect' ); ?>">
|
68 |
-
<span class="button-primary btn-activate-serial" value="<?php _e( 'Save', 'wpcf7-redirect' ); ?>">
|
69 |
-
<span class="dashicons dashicons-yes"></span>
|
70 |
-
</span>
|
71 |
-
<span class="button-primary btn-close" title="<?php _e( 'Cancel', 'wpcf7-redirect' ); ?>">
|
72 |
-
<span class="dashicons dashicons-no"></span>
|
73 |
-
</span>
|
74 |
-
</div>
|
75 |
-
<?php endif; ?>
|
76 |
-
</div>
|
77 |
-
</div>
|
78 |
-
</div>
|
79 |
-
</div>
|
80 |
-
</div>
|
81 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render extension promo box
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$ver = $this->get_extension_ver();
|
9 |
+
$badge = method_exists( $this, 'get_badge' ) ? $this->get_badge() : '';
|
10 |
+
?>
|
11 |
+
|
12 |
+
<div class="promo-box <?php echo $this->get_name(); ?> <?php echo $this->needs_activation() ? 'needs-activation' : ''; ?> <?php echo $this->has_update() ? 'has-update' : ''; ?> <?php echo $this->get_name(); ?> <?php echo $this->is_active() ? 'active-ext' : ''; ?>" data-extension="<?php echo $this->get_name(); ?>">
|
13 |
+
<div class="promo-box-inner">
|
14 |
+
<div class="promo-bot-title">
|
15 |
+
<div class="promo-version">
|
16 |
+
<?php if ( $ver && ! $badge ) : ?>
|
17 |
+
<small>v.<?php echo $this->get_extension_ver(); ?></small> <span class="dashicons dashicons-editor-code"></span>
|
18 |
+
<?php elseif ( $badge ) : ?>
|
19 |
+
<?php echo $badge; ?>
|
20 |
+
<?php endif; ?>
|
21 |
+
</div>
|
22 |
+
|
23 |
+
<?php if ( ! $this->is_active() ) : ?>
|
24 |
+
<div class="promo-purchase-link">
|
25 |
+
<?php if ( $this->get_aff_url() ) : ?>
|
26 |
+
<a href="<?php echo $this->get_aff_url(); ?>" class=""><?php _e( 'Activate', 'wpcf7-redirect' ); ?></a>
|
27 |
+
<?php else : ?>
|
28 |
+
<span type="button" class="btn-activate"><?php _e( 'Activate', 'wpcf7-redirect' ); ?></span>
|
29 |
+
<?php endif; ?>
|
30 |
+
</div>
|
31 |
+
<?php endif; ?>
|
32 |
+
|
33 |
+
</div>
|
34 |
+
<div class="promo-box-content">
|
35 |
+
<div class="promo-box-thumb">
|
36 |
+
<img src="<?php echo $this->get_icon(); ?>" alt="<?php $this->get_name(); ?>">
|
37 |
+
</div>
|
38 |
+
<div class="promo-box-description">
|
39 |
+
<h3><?php echo $this->get_title(); ?></h3>
|
40 |
+
|
41 |
+
<div class="description">
|
42 |
+
<?php echo $this->get_description(); ?>
|
43 |
+
</div>
|
44 |
+
|
45 |
+
<div class="promo-actions-box">
|
46 |
+
<div class="actions">
|
47 |
+
<?php if ( $this->get_aff_url() ) : ?>
|
48 |
+
<a href="<?php echo $this->get_aff_url(); ?>" class="button-primary"><?php echo $this->get_btn_text(); ?></a>
|
49 |
+
<?php else : ?>
|
50 |
+
<?php if ( ! $this->is_active() ) : ?>
|
51 |
+
<?php if ( $this->extension_file_exists() ) : ?>
|
52 |
+
<span type="button" class="btn-activate"><?php _e( 'Activate' ); ?></span>
|
53 |
+
<?php else : ?>
|
54 |
+
<a href="<?php echo $this->get_purchase_link(); ?>" class="btn-getit" target="_blank">
|
55 |
+
<span class="get-it-label"><?php _e( 'Get It', 'wpcf7-redirect' ); ?></span><span class="dashicons dashicons-arrow-down-alt"></span>
|
56 |
+
</a>
|
57 |
+
<?php endif; ?>
|
58 |
+
<?php else : ?>
|
59 |
+
<span type="button" class="button-primary btn-deactivate" ><?php _e( 'Deactivate' ); ?></span>
|
60 |
+
<?php endif; ?>
|
61 |
+
|
62 |
+
<?php if ( $this->is_active() && $this->has_update() ) : ?>
|
63 |
+
<span type="button" class="button-primary btn-update"><?php _e( 'Update' ); ?></span>
|
64 |
+
<?php endif; ?>
|
65 |
+
|
66 |
+
<div class="serial">
|
67 |
+
<input type="text" class="serial-number" value="<?php echo $this->get_serial(); ?>" placeholder="<?php _e( 'License Key', 'wpcf7-redirect' ); ?>">
|
68 |
+
<span class="button-primary btn-activate-serial" value="<?php _e( 'Save', 'wpcf7-redirect' ); ?>">
|
69 |
+
<span class="dashicons dashicons-yes"></span>
|
70 |
+
</span>
|
71 |
+
<span class="button-primary btn-close" title="<?php _e( 'Cancel', 'wpcf7-redirect' ); ?>">
|
72 |
+
<span class="dashicons dashicons-no"></span>
|
73 |
+
</span>
|
74 |
+
</div>
|
75 |
+
<?php endif; ?>
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
+
</div>
|
templates/extensions/extensions-table.php
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render extensions table
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$extensions = $this->get_extensions();
|
9 |
-
?>
|
10 |
-
|
11 |
-
<div class="extensions-list">
|
12 |
-
<div class="extensions">
|
13 |
-
<?php if ( $extensions ) : ?>
|
14 |
-
<?php foreach ( $extensions as $extension_slug => $extension ) : ?>
|
15 |
-
<div class="extension">
|
16 |
-
<?php echo $extension->get_action_promo(); ?>
|
17 |
-
</div>
|
18 |
-
<?php endforeach; ?>
|
19 |
-
<?php endif; ?>
|
20 |
-
</div>
|
21 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render extensions table
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$extensions = $this->get_extensions();
|
9 |
+
?>
|
10 |
+
|
11 |
+
<div class="extensions-list">
|
12 |
+
<div class="extensions">
|
13 |
+
<?php if ( $extensions ) : ?>
|
14 |
+
<?php foreach ( $extensions as $extension_slug => $extension ) : ?>
|
15 |
+
<div class="extension">
|
16 |
+
<?php echo $extension->get_action_promo(); ?>
|
17 |
+
</div>
|
18 |
+
<?php endforeach; ?>
|
19 |
+
<?php endif; ?>
|
20 |
+
</div>
|
21 |
+
</div>
|
templates/extensions/index.php
ADDED
File without changes
|
templates/fields/field-button.php
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render button field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> wpcf7r-button <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>" data-toggle="<?php echo isset( $field['show_selector'] ) ? $field['show_selector'] : ''; ?>">
|
10 |
-
<?php if ( isset( $field['label'] ) && $field['label'] ) : ?>
|
11 |
-
<label class="wpcf7-redirect-<?php echo $field['name']; ?>"><?php echo $field['label']; ?></label>
|
12 |
-
<?php endif; ?>
|
13 |
-
<input type="button" class="button-primary wpcf7-redirect-<?php echo $field['name']; ?>-fields"
|
14 |
-
name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]"
|
15 |
-
<?php echo isset( $field['attr'] ) ? wpcf7r_implode_attributes( $field['attr'] ) : ''; ?>
|
16 |
-
value="<?php echo esc_html( $field['label'] ); ?>"
|
17 |
-
/>
|
18 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render button field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> wpcf7r-button <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>" data-toggle="<?php echo isset( $field['show_selector'] ) ? $field['show_selector'] : ''; ?>">
|
10 |
+
<?php if ( isset( $field['label'] ) && $field['label'] ) : ?>
|
11 |
+
<label class="wpcf7-redirect-<?php echo $field['name']; ?>"><?php echo $field['label']; ?></label>
|
12 |
+
<?php endif; ?>
|
13 |
+
<input type="button" class="button-primary wpcf7-redirect-<?php echo $field['name']; ?>-fields"
|
14 |
+
name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]"
|
15 |
+
<?php echo isset( $field['attr'] ) ? wpcf7r_implode_attributes( $field['attr'] ) : ''; ?>
|
16 |
+
value="<?php echo esc_html( $field['label'] ); ?>"
|
17 |
+
/>
|
18 |
+
</div>
|
templates/fields/field-checkbox.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render checkbox field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?> wpcf7r-checkbox" data-toggle="<?php echo isset( $field['show_selector'] ) ? $field['show_selector'] : ''; ?>">
|
10 |
-
<label>
|
11 |
-
<input type="checkbox" class="wpcf7-redirect-<?php echo $field['name']; ?>-fields"
|
12 |
-
name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]"
|
13 |
-
<?php checked( $field['value'], 'on', true ); ?>
|
14 |
-
data-toggle-label="<?php echo isset( $field['toggle-label'] ) ? esc_html( $field['toggle-label'] ) : ''; ?>"
|
15 |
-
/>
|
16 |
-
<span class="wpcf7r-on-off-button">
|
17 |
-
<span class="wpcf7r-toggle-button">
|
18 |
-
</span>
|
19 |
-
</span>
|
20 |
-
<strong class="checkbox-label"><?php echo esc_html( $field['label'] ); ?></strong>
|
21 |
-
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
22 |
-
</label>
|
23 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render checkbox field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?> wpcf7r-checkbox" data-toggle="<?php echo isset( $field['show_selector'] ) ? $field['show_selector'] : ''; ?>">
|
10 |
+
<label>
|
11 |
+
<input type="checkbox" class="wpcf7-redirect-<?php echo $field['name']; ?>-fields"
|
12 |
+
name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]"
|
13 |
+
<?php checked( $field['value'], 'on', true ); ?>
|
14 |
+
data-toggle-label="<?php echo isset( $field['toggle-label'] ) ? esc_html( $field['toggle-label'] ) : ''; ?>"
|
15 |
+
/>
|
16 |
+
<span class="wpcf7r-on-off-button">
|
17 |
+
<span class="wpcf7r-toggle-button">
|
18 |
+
</span>
|
19 |
+
</span>
|
20 |
+
<strong class="checkbox-label"><?php echo esc_html( $field['label'] ); ?></strong>
|
21 |
+
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
22 |
+
</label>
|
23 |
+
</div>
|
templates/fields/field-download.php
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Display download field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
9 |
-
<?php if ( isset( $field['label'] ) && $field['label'] ) : ?>
|
10 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
11 |
-
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
12 |
-
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
13 |
-
</label>
|
14 |
-
<?php endif; ?>
|
15 |
-
|
16 |
-
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
17 |
-
|
18 |
-
<div class="wpcf7-subtitle">
|
19 |
-
<?php echo $field['sub_title']; ?>
|
20 |
-
</div>
|
21 |
-
|
22 |
-
<?php endif; ?>
|
23 |
-
|
24 |
-
<a href="data:application/octet-stream;base64,<?php echo esc_html( $field['value'] ); ?>" download="<?php echo $field['filename']; ?>"><?php echo $field['filename']; ?></a>
|
25 |
-
|
26 |
-
<div class="field-footer">
|
27 |
-
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
28 |
-
</div>
|
29 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Display download field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
9 |
+
<?php if ( isset( $field['label'] ) && $field['label'] ) : ?>
|
10 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
11 |
+
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
12 |
+
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
13 |
+
</label>
|
14 |
+
<?php endif; ?>
|
15 |
+
|
16 |
+
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
17 |
+
|
18 |
+
<div class="wpcf7-subtitle">
|
19 |
+
<?php echo $field['sub_title']; ?>
|
20 |
+
</div>
|
21 |
+
|
22 |
+
<?php endif; ?>
|
23 |
+
|
24 |
+
<a href="data:application/octet-stream;base64,<?php echo esc_html( $field['value'] ); ?>" download="<?php echo $field['filename']; ?>"><?php echo $field['filename']; ?></a>
|
25 |
+
|
26 |
+
<div class="field-footer">
|
27 |
+
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
28 |
+
</div>
|
29 |
+
</div>
|
templates/fields/field-editor.php
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render editor field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$field_name = "wpcf7-redirect{$prefix}[{$field['name']}]";
|
9 |
-
$css_class = "wpcf7-redirect-{$field['name']}-fields";
|
10 |
-
?>
|
11 |
-
|
12 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
13 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
14 |
-
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
15 |
-
</label>
|
16 |
-
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
17 |
-
<div class="wpcf7-subtitle">
|
18 |
-
<?php echo $field['sub_title']; ?>
|
19 |
-
</div>
|
20 |
-
<?php endif; ?>
|
21 |
-
|
22 |
-
<?php
|
23 |
-
wp_editor(
|
24 |
-
$field['value'],
|
25 |
-
'editor-' . md5( $field_name ),
|
26 |
-
$settings = array(
|
27 |
-
'textarea_name' => $field_name,
|
28 |
-
'editor_class' => $css_class,
|
29 |
-
)
|
30 |
-
);
|
31 |
-
?>
|
32 |
-
|
33 |
-
<div class="field-footer">
|
34 |
-
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
35 |
-
</div>
|
36 |
-
|
37 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render editor field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$field_name = "wpcf7-redirect{$prefix}[{$field['name']}]";
|
9 |
+
$css_class = "wpcf7-redirect-{$field['name']}-fields";
|
10 |
+
?>
|
11 |
+
|
12 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
13 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
14 |
+
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
15 |
+
</label>
|
16 |
+
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
17 |
+
<div class="wpcf7-subtitle">
|
18 |
+
<?php echo $field['sub_title']; ?>
|
19 |
+
</div>
|
20 |
+
<?php endif; ?>
|
21 |
+
|
22 |
+
<?php
|
23 |
+
wp_editor(
|
24 |
+
$field['value'],
|
25 |
+
'editor-' . md5( $field_name ),
|
26 |
+
$settings = array(
|
27 |
+
'textarea_name' => $field_name,
|
28 |
+
'editor_class' => $css_class,
|
29 |
+
)
|
30 |
+
);
|
31 |
+
?>
|
32 |
+
|
33 |
+
<div class="field-footer">
|
34 |
+
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
35 |
+
</div>
|
36 |
+
|
37 |
+
</div>
|
templates/fields/field-json-editor.php
CHANGED
@@ -1,22 +1,22 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render json editor field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
10 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
11 |
-
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
12 |
-
</label>
|
13 |
-
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
14 |
-
<div class="wpcf7-subtitle">
|
15 |
-
<?php echo $field['sub_title']; ?>
|
16 |
-
</div>
|
17 |
-
<?php endif; ?>
|
18 |
-
<textarea rows="10" class="json-container wpcf7-redirect-<?php echo $field['name']; ?>-fields" placeholder="<?php echo $field['placeholder']; ?>" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]"><?php echo esc_html( $field['value'] ); ?></textarea>
|
19 |
-
<div class="field-footer">
|
20 |
-
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
21 |
-
</div>
|
22 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render json editor field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
10 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
11 |
+
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
12 |
+
</label>
|
13 |
+
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
14 |
+
<div class="wpcf7-subtitle">
|
15 |
+
<?php echo $field['sub_title']; ?>
|
16 |
+
</div>
|
17 |
+
<?php endif; ?>
|
18 |
+
<textarea rows="10" class="json-container wpcf7-redirect-<?php echo $field['name']; ?>-fields" placeholder="<?php echo $field['placeholder']; ?>" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]"><?php echo esc_html( $field['value'] ); ?></textarea>
|
19 |
+
<div class="field-footer">
|
20 |
+
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
21 |
+
</div>
|
22 |
+
</div>
|
templates/fields/field-leads-mapping.php
CHANGED
@@ -1,73 +1,73 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render mapping leads field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
10 |
-
<?php if ( isset( $field['title'] ) && $field['title'] ) : ?>
|
11 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
12 |
-
<h3><?php echo esc_html( $field['label'] ); ?></h3>
|
13 |
-
|
14 |
-
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
15 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>"><?php echo esc_html( $field['sub_title'] ); ?></label>
|
16 |
-
<br/>
|
17 |
-
<?php endif; ?>
|
18 |
-
</label>
|
19 |
-
<?php endif; ?>
|
20 |
-
|
21 |
-
<div class="cf7_row">
|
22 |
-
<table class="wp-list-table widefat fixed striped pages wp-list-table-inner">
|
23 |
-
<tr>
|
24 |
-
<td>
|
25 |
-
<strong>
|
26 |
-
<?php _e( 'Form fields', 'wpcf7-redirect' ); ?>
|
27 |
-
</strong>
|
28 |
-
</td>
|
29 |
-
<td class="tags-map-api-key">
|
30 |
-
<strong>
|
31 |
-
<?php _e( 'Field Label', 'wpcf7-redirect' ); ?>
|
32 |
-
</strong>
|
33 |
-
<?php echo cf7r_tooltip( __( 'The field label', 'wpcf7-redirect' ) ); ?>
|
34 |
-
</td>
|
35 |
-
<td>
|
36 |
-
<strong>
|
37 |
-
<?php _e( 'Display on leads list', 'wpcf7-redirect' ); ?>
|
38 |
-
</strong>
|
39 |
-
<?php echo cf7r_tooltip( __( 'Should this field appear on the leads list', 'wpcf7-redirect' ) ); ?>
|
40 |
-
</td>
|
41 |
-
</tr>
|
42 |
-
<?php
|
43 |
-
if ( isset( $field['tags'] ) ) :
|
44 |
-
foreach ( $field['tags'] as $mail_tag ) :
|
45 |
-
if ( 'lead_id' === $mail_tag->name ) {
|
46 |
-
continue;
|
47 |
-
}
|
48 |
-
$save = isset( $field['value'][ $mail_tag->name ]['save'] ) ? esc_html( $field['value'][ $mail_tag->name ]['save'] ) : '';
|
49 |
-
$tag_value = isset( $field['value'][ $mail_tag->name ]['tag'] ) ? esc_html( $field['value'][ $mail_tag->name ]['tag'] ) : '';
|
50 |
-
$appear = isset( $field['value'][ $mail_tag->name ]['appear'] ) && $field['value'][ $mail_tag->name ]['appear'] ? true : false;
|
51 |
-
?>
|
52 |
-
<tr>
|
53 |
-
<td class="<?php echo $mail_tag->name; ?>"><?php echo $mail_tag->name; ?></td>
|
54 |
-
<td class="tags-map-api-key">
|
55 |
-
<input type="text" id="sf-<?php echo $mail_tag->name; ?>"
|
56 |
-
name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>][<?php echo $mail_tag->name; ?>][tag]"
|
57 |
-
class="large-text"
|
58 |
-
value="<?php echo $tag_value; ?>" />
|
59 |
-
</td>
|
60 |
-
<td>
|
61 |
-
<input type="checkbox"
|
62 |
-
name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>][<?php echo $mail_tag->name; ?>][appear]"
|
63 |
-
value="1"
|
64 |
-
<?php checked( $appear, 1 ); ?> />
|
65 |
-
</td>
|
66 |
-
</tr>
|
67 |
-
<?php
|
68 |
-
endforeach;
|
69 |
-
endif;
|
70 |
-
?>
|
71 |
-
</table>
|
72 |
-
</div>
|
73 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render mapping leads field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
10 |
+
<?php if ( isset( $field['title'] ) && $field['title'] ) : ?>
|
11 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
12 |
+
<h3><?php echo esc_html( $field['label'] ); ?></h3>
|
13 |
+
|
14 |
+
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
15 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>"><?php echo esc_html( $field['sub_title'] ); ?></label>
|
16 |
+
<br/>
|
17 |
+
<?php endif; ?>
|
18 |
+
</label>
|
19 |
+
<?php endif; ?>
|
20 |
+
|
21 |
+
<div class="cf7_row">
|
22 |
+
<table class="wp-list-table widefat fixed striped pages wp-list-table-inner">
|
23 |
+
<tr>
|
24 |
+
<td>
|
25 |
+
<strong>
|
26 |
+
<?php _e( 'Form fields', 'wpcf7-redirect' ); ?>
|
27 |
+
</strong>
|
28 |
+
</td>
|
29 |
+
<td class="tags-map-api-key">
|
30 |
+
<strong>
|
31 |
+
<?php _e( 'Field Label', 'wpcf7-redirect' ); ?>
|
32 |
+
</strong>
|
33 |
+
<?php echo cf7r_tooltip( __( 'The field label', 'wpcf7-redirect' ) ); ?>
|
34 |
+
</td>
|
35 |
+
<td>
|
36 |
+
<strong>
|
37 |
+
<?php _e( 'Display on leads list', 'wpcf7-redirect' ); ?>
|
38 |
+
</strong>
|
39 |
+
<?php echo cf7r_tooltip( __( 'Should this field appear on the leads list', 'wpcf7-redirect' ) ); ?>
|
40 |
+
</td>
|
41 |
+
</tr>
|
42 |
+
<?php
|
43 |
+
if ( isset( $field['tags'] ) ) :
|
44 |
+
foreach ( $field['tags'] as $mail_tag ) :
|
45 |
+
if ( 'lead_id' === $mail_tag->name ) {
|
46 |
+
continue;
|
47 |
+
}
|
48 |
+
$save = isset( $field['value'][ $mail_tag->name ]['save'] ) ? esc_html( $field['value'][ $mail_tag->name ]['save'] ) : '';
|
49 |
+
$tag_value = isset( $field['value'][ $mail_tag->name ]['tag'] ) ? esc_html( $field['value'][ $mail_tag->name ]['tag'] ) : '';
|
50 |
+
$appear = isset( $field['value'][ $mail_tag->name ]['appear'] ) && $field['value'][ $mail_tag->name ]['appear'] ? true : false;
|
51 |
+
?>
|
52 |
+
<tr>
|
53 |
+
<td class="<?php echo $mail_tag->name; ?>"><?php echo $mail_tag->name; ?></td>
|
54 |
+
<td class="tags-map-api-key">
|
55 |
+
<input type="text" id="sf-<?php echo $mail_tag->name; ?>"
|
56 |
+
name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>][<?php echo $mail_tag->name; ?>][tag]"
|
57 |
+
class="large-text"
|
58 |
+
value="<?php echo $tag_value; ?>" />
|
59 |
+
</td>
|
60 |
+
<td>
|
61 |
+
<input type="checkbox"
|
62 |
+
name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>][<?php echo $mail_tag->name; ?>][appear]"
|
63 |
+
value="1"
|
64 |
+
<?php checked( $appear, 1 ); ?> />
|
65 |
+
</td>
|
66 |
+
</tr>
|
67 |
+
<?php
|
68 |
+
endforeach;
|
69 |
+
endif;
|
70 |
+
?>
|
71 |
+
</table>
|
72 |
+
</div>
|
73 |
+
</div>
|
templates/fields/field-media.php
CHANGED
@@ -1,30 +1,30 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render image field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
?>
|
9 |
-
|
10 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
11 |
-
<?php if ( isset( $field['label'] ) && $field['label'] ) : ?>
|
12 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
13 |
-
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
14 |
-
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
15 |
-
</label>
|
16 |
-
<?php endif; ?>
|
17 |
-
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
18 |
-
<div class="wpcf7-subtitle">
|
19 |
-
<?php echo $field['sub_title']; ?>
|
20 |
-
</div>
|
21 |
-
<?php endif; ?>
|
22 |
-
<div class="image-container">
|
23 |
-
<img src="<?php echo esc_html( $field['value'] ); ?>" alt="" style="max-width:100px;" class="popup-image" />
|
24 |
-
<a title="Set Image" href="javascript:;" class="image-uploader-btn browser button button-hero"><?php _e( 'Select Image', 'wpcf7-redirect' ); ?></a>
|
25 |
-
<input type="hidden" class="wpcf7-redirect-<?php echo $field['name']; ?>-fields" placeholder="<?php echo esc_html( $field['placeholder'] ); ?>" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]" value="<?php echo esc_html( $field['value'] ); ?>" <?php echo isset( $field['input_attr'] ) ? $field['input_attr'] : ''; ?>>
|
26 |
-
</div>
|
27 |
-
<div class="field-footer">
|
28 |
-
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
29 |
-
</div>
|
30 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render image field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
?>
|
9 |
+
|
10 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
11 |
+
<?php if ( isset( $field['label'] ) && $field['label'] ) : ?>
|
12 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
13 |
+
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
14 |
+
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
15 |
+
</label>
|
16 |
+
<?php endif; ?>
|
17 |
+
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
18 |
+
<div class="wpcf7-subtitle">
|
19 |
+
<?php echo $field['sub_title']; ?>
|
20 |
+
</div>
|
21 |
+
<?php endif; ?>
|
22 |
+
<div class="image-container">
|
23 |
+
<img src="<?php echo esc_html( $field['value'] ); ?>" alt="" style="max-width:100px;" class="popup-image" />
|
24 |
+
<a title="Set Image" href="javascript:;" class="image-uploader-btn browser button button-hero"><?php _e( 'Select Image', 'wpcf7-redirect' ); ?></a>
|
25 |
+
<input type="hidden" class="wpcf7-redirect-<?php echo $field['name']; ?>-fields" placeholder="<?php echo esc_html( $field['placeholder'] ); ?>" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]" value="<?php echo esc_html( $field['value'] ); ?>" <?php echo isset( $field['input_attr'] ) ? $field['input_attr'] : ''; ?>>
|
26 |
+
</div>
|
27 |
+
<div class="field-footer">
|
28 |
+
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
29 |
+
</div>
|
30 |
+
</div>
|
templates/fields/field-notice.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render notice block
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<div class="field-wrap">
|
10 |
-
<div class="field-notice field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
11 |
-
<strong>
|
12 |
-
<?php echo $field['label']; ?>
|
13 |
-
</strong>
|
14 |
-
<?php echo $field['sub_title']; ?>
|
15 |
-
</div>
|
16 |
-
|
17 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render notice block
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="field-wrap">
|
10 |
+
<div class="field-notice field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
11 |
+
<strong>
|
12 |
+
<?php echo $field['label']; ?>
|
13 |
+
</strong>
|
14 |
+
<?php echo $field['sub_title']; ?>
|
15 |
+
</div>
|
16 |
+
|
17 |
+
</div>
|
templates/fields/field-number.php
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render number field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
10 |
-
<?php if ( isset( $field['label'] ) && $field['label'] ) : ?>
|
11 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
12 |
-
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
13 |
-
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
14 |
-
</label>
|
15 |
-
<?php endif; ?>
|
16 |
-
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
17 |
-
<div class="wpcf7-subtitle">
|
18 |
-
<?php echo $field['sub_title']; ?>
|
19 |
-
</div>
|
20 |
-
<?php endif; ?>
|
21 |
-
<input type="number" class="wpcf7-redirect-<?php echo $field['name']; ?>-fields" placeholder="<?php echo esc_html( $field['placeholder'] ); ?>" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]" value="<?php echo esc_html( $field['value'] ); ?>" <?php echo isset( $field['input_attr'] ) ? $field['input_attr'] : ''; ?>>
|
22 |
-
<div class="field-footer">
|
23 |
-
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
24 |
-
</div>
|
25 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render number field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
10 |
+
<?php if ( isset( $field['label'] ) && $field['label'] ) : ?>
|
11 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
12 |
+
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
13 |
+
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
14 |
+
</label>
|
15 |
+
<?php endif; ?>
|
16 |
+
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
17 |
+
<div class="wpcf7-subtitle">
|
18 |
+
<?php echo $field['sub_title']; ?>
|
19 |
+
</div>
|
20 |
+
<?php endif; ?>
|
21 |
+
<input type="number" class="wpcf7-redirect-<?php echo $field['name']; ?>-fields" placeholder="<?php echo esc_html( $field['placeholder'] ); ?>" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]" value="<?php echo esc_html( $field['value'] ); ?>" <?php echo isset( $field['input_attr'] ) ? $field['input_attr'] : ''; ?>>
|
22 |
+
<div class="field-footer">
|
23 |
+
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
24 |
+
</div>
|
25 |
+
</div>
|
templates/fields/field-page-select.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render page select field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$field_id = $field['name'] . '-' . rand( 0, 1000 );
|
9 |
-
?>
|
10 |
-
|
11 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
12 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
13 |
-
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
14 |
-
</label>
|
15 |
-
<?php
|
16 |
-
echo wp_dropdown_pages(
|
17 |
-
array(
|
18 |
-
'echo' => 0,
|
19 |
-
'name' => 'wpcf7-redirect' . $prefix . '[' . $field['name'] . ']',
|
20 |
-
'show_option_none' => $field['placeholder'],
|
21 |
-
'option_none_value' => '',
|
22 |
-
'selected' => $field['value'] ? $field['value'] : '',
|
23 |
-
'id' => $field_id,
|
24 |
-
'class' => 'wpcf7-redirect-' . $field['name'] . '-fields',
|
25 |
-
)
|
26 |
-
);
|
27 |
-
?>
|
28 |
-
<script>
|
29 |
-
var element = document.getElementById('<?php echo $field_id; ?>');
|
30 |
-
|
31 |
-
if ( ! element.value ) {
|
32 |
-
element.options[0].setAttribute('selected','selected');
|
33 |
-
}
|
34 |
-
</script>
|
35 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render page select field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$field_id = $field['name'] . '-' . rand( 0, 1000 );
|
9 |
+
?>
|
10 |
+
|
11 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
12 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
13 |
+
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
14 |
+
</label>
|
15 |
+
<?php
|
16 |
+
echo wp_dropdown_pages(
|
17 |
+
array(
|
18 |
+
'echo' => 0,
|
19 |
+
'name' => 'wpcf7-redirect' . $prefix . '[' . $field['name'] . ']',
|
20 |
+
'show_option_none' => $field['placeholder'],
|
21 |
+
'option_none_value' => '',
|
22 |
+
'selected' => $field['value'] ? $field['value'] : '',
|
23 |
+
'id' => $field_id,
|
24 |
+
'class' => 'wpcf7-redirect-' . $field['name'] . '-fields',
|
25 |
+
)
|
26 |
+
);
|
27 |
+
?>
|
28 |
+
<script>
|
29 |
+
var element = document.getElementById('<?php echo $field_id; ?>');
|
30 |
+
|
31 |
+
if ( ! element.value ) {
|
32 |
+
element.options[0].setAttribute('selected','selected');
|
33 |
+
}
|
34 |
+
</script>
|
35 |
+
</div>
|
templates/fields/field-password.php
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render a password field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
10 |
-
<?php if ( isset( $field['label'] ) && $field['label'] ) : ?>
|
11 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
12 |
-
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
13 |
-
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
14 |
-
</label>
|
15 |
-
<?php endif; ?>
|
16 |
-
|
17 |
-
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
18 |
-
<div class="wpcf7-subtitle">
|
19 |
-
<?php echo $field['sub_title']; ?>
|
20 |
-
</div>
|
21 |
-
<?php endif; ?>
|
22 |
-
|
23 |
-
<input type="password" class="wpcf7-redirect-<?php echo $field['name']; ?>-fields <?php echo isset( $field['input_class'] ) ? $field['input_class'] : ''; ?>" placeholder="<?php echo esc_html( $field['placeholder'] ); ?>" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]" value="<?php echo esc_html( $field['value'] ); ?>" <?php echo isset( $field['input_attr'] ) ? $field['input_attr'] : ''; ?>>
|
24 |
-
|
25 |
-
<div class="field-footer">
|
26 |
-
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
27 |
-
</div>
|
28 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render a password field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
10 |
+
<?php if ( isset( $field['label'] ) && $field['label'] ) : ?>
|
11 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
12 |
+
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
13 |
+
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
14 |
+
</label>
|
15 |
+
<?php endif; ?>
|
16 |
+
|
17 |
+
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
18 |
+
<div class="wpcf7-subtitle">
|
19 |
+
<?php echo $field['sub_title']; ?>
|
20 |
+
</div>
|
21 |
+
<?php endif; ?>
|
22 |
+
|
23 |
+
<input type="password" class="wpcf7-redirect-<?php echo $field['name']; ?>-fields <?php echo isset( $field['input_class'] ) ? $field['input_class'] : ''; ?>" placeholder="<?php echo esc_html( $field['placeholder'] ); ?>" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]" value="<?php echo esc_html( $field['value'] ); ?>" <?php echo isset( $field['input_attr'] ) ? $field['input_attr'] : ''; ?>>
|
24 |
+
|
25 |
+
<div class="field-footer">
|
26 |
+
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
27 |
+
</div>
|
28 |
+
</div>
|
templates/fields/field-post-author-select.php
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render post author select field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$template = WPCF7_PRO_REDIRECT_FIELDS_PATH . 'field-select.php';
|
9 |
-
|
10 |
-
$args = array(
|
11 |
-
'role__in' => array( 'administrator', 'editor', 'author' ),
|
12 |
-
);
|
13 |
-
|
14 |
-
$author_args = apply_filters( 'wpcf7r_get_authors_args', $args );
|
15 |
-
|
16 |
-
$authors = get_users( $author_args );
|
17 |
-
|
18 |
-
$field['options']['current_user'] = __( 'Current Logged In User', 'wpcf7-redirect' );
|
19 |
-
|
20 |
-
foreach ( $authors as $author ) {
|
21 |
-
$field['options'][ $author->ID ] = $author->data->user_nicename;
|
22 |
-
}
|
23 |
-
|
24 |
-
|
25 |
-
include $template;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render post author select field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$template = WPCF7_PRO_REDIRECT_FIELDS_PATH . 'field-select.php';
|
9 |
+
|
10 |
+
$args = array(
|
11 |
+
'role__in' => array( 'administrator', 'editor', 'author' ),
|
12 |
+
);
|
13 |
+
|
14 |
+
$author_args = apply_filters( 'wpcf7r_get_authors_args', $args );
|
15 |
+
|
16 |
+
$authors = get_users( $author_args );
|
17 |
+
|
18 |
+
$field['options']['current_user'] = __( 'Current Logged In User', 'wpcf7-redirect' );
|
19 |
+
|
20 |
+
foreach ( $authors as $author ) {
|
21 |
+
$field['options'][ $author->ID ] = $author->data->user_nicename;
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
include $template;
|
templates/fields/field-post-type-select.php
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render post type select field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$post_types = get_post_types();
|
9 |
-
?>
|
10 |
-
|
11 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
12 |
-
<?php if ( $field['label'] ) : ?>
|
13 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
14 |
-
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
15 |
-
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
16 |
-
</label>
|
17 |
-
<?php endif; ?>
|
18 |
-
|
19 |
-
<select class="" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]">
|
20 |
-
<?php foreach ( $post_types as $option_key => $option_label ) : ?>
|
21 |
-
<option value="<?php echo $option_key; ?>" <?php selected( $field['value'], $option_key ); ?>><?php echo $option_label; ?></option>
|
22 |
-
<?php endforeach; ?>
|
23 |
-
</select>
|
24 |
-
|
25 |
-
<div class="field-footer">
|
26 |
-
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
27 |
-
</div>
|
28 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render post type select field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$post_types = get_post_types();
|
9 |
+
?>
|
10 |
+
|
11 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
12 |
+
<?php if ( $field['label'] ) : ?>
|
13 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
14 |
+
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
15 |
+
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
16 |
+
</label>
|
17 |
+
<?php endif; ?>
|
18 |
+
|
19 |
+
<select class="" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]">
|
20 |
+
<?php foreach ( $post_types as $option_key => $option_label ) : ?>
|
21 |
+
<option value="<?php echo $option_key; ?>" <?php selected( $field['value'], $option_key ); ?>><?php echo $option_label; ?></option>
|
22 |
+
<?php endforeach; ?>
|
23 |
+
</select>
|
24 |
+
|
25 |
+
<div class="field-footer">
|
26 |
+
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
27 |
+
</div>
|
28 |
+
</div>
|
templates/fields/field-preview.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render preview iFrame
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
10 |
-
<iframe data-name="preview" class="preview-iframe" src="<?php echo add_query_arg( $field['value'], admin_url() ); ?>" scrolling="no" style=" width: 100%; height: 500px; overflow: hidden;" ></iframe>
|
11 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render preview iFrame
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
10 |
+
<iframe data-name="preview" class="preview-iframe" src="<?php echo add_query_arg( $field['value'], admin_url() ); ?>" scrolling="no" style=" width: 100%; height: 500px; overflow: hidden;" ></iframe>
|
11 |
+
</div>
|
templates/fields/field-repeater.php
CHANGED
@@ -1,90 +1,90 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render a repater field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$values = isset( $field['value'] ) && ! empty( $field['value'] ) > 0 ? $field['value'] : array( 'default' );
|
9 |
-
$base_prefix = $prefix;
|
10 |
-
$repeater_row_template = array();
|
11 |
-
?>
|
12 |
-
|
13 |
-
<?php ob_start(); ?>
|
14 |
-
|
15 |
-
<tr class="qs-repeater-row <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>" data-repeater-row-count="new_row">
|
16 |
-
<?php $prefix = $base_prefix . '[' . $field['name'] . ']' . '[new_row]'; ?>
|
17 |
-
<?php foreach ( $field['fields'] as $child_field ) : ?>
|
18 |
-
<td>
|
19 |
-
<?php
|
20 |
-
$child_field['value'] = isset( $value[ $child_field['name'] ] ) ? $value[ $child_field['name'] ] : '';
|
21 |
-
$child_field['label'] = '';
|
22 |
-
WPCF7R_Html::render_field( $child_field, $prefix );
|
23 |
-
?>
|
24 |
-
</td>
|
25 |
-
<?php endforeach; ?>
|
26 |
-
<td>
|
27 |
-
<div class="qs-repeater-action">
|
28 |
-
<span class="dashicons dashicons-plus"></span>
|
29 |
-
<span class="dashicons dashicons-minus"></span>
|
30 |
-
</div>
|
31 |
-
</td>
|
32 |
-
</tr>
|
33 |
-
|
34 |
-
<?php $repeater_single_row_template['template'] = ob_get_clean(); ?>
|
35 |
-
|
36 |
-
<div class="qs-row">
|
37 |
-
<div class="qs-col qs-col-12">
|
38 |
-
<?php if ( isset( $field['sub_title'] ) ) : ?>
|
39 |
-
<h2><?php echo esc_html( $field['sub_title'] ); ?></h2>
|
40 |
-
<?php endif; ?>
|
41 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
42 |
-
<h3><?php echo esc_html( $field['label'] ); ?> <?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?></h3>
|
43 |
-
</label>
|
44 |
-
<div>
|
45 |
-
<div class="actions">
|
46 |
-
<table class="wp-list-table widefat fixed striped pages repeater-table leads-list">
|
47 |
-
<thead>
|
48 |
-
<tr>
|
49 |
-
<?php foreach ( $values as $value_row => $value ) : ?>
|
50 |
-
<?php foreach ( $field['fields'] as $child_field ) : ?>
|
51 |
-
<th class="manage-column column-primary sortable desc">
|
52 |
-
<a href="#"><?php echo $child_field['label']; ?></a>
|
53 |
-
</th>
|
54 |
-
<?php endforeach; ?>
|
55 |
-
<th><?php _e( 'Actions', 'wpcf7-redirect' ); ?></th>
|
56 |
-
<?php break; ?>
|
57 |
-
<?php endforeach; ?>
|
58 |
-
</tr>
|
59 |
-
</thead>
|
60 |
-
|
61 |
-
<tbody id="the_list" data-repeater-template="<?php echo htmlspecialchars( wp_json_encode( $repeater_single_row_template ) ); ?>">
|
62 |
-
<?php foreach ( $values as $value_row => $value ) : ?>
|
63 |
-
<tr class="qs-repeater-row" data-repeater-row-count="<?php echo $value_row; ?>">
|
64 |
-
<?php $prefix = $base_prefix . '[' . $field['name'] . ']' . '[' . $value_row . ']'; ?>
|
65 |
-
<?php foreach ( $field['fields'] as $child_field ) : ?>
|
66 |
-
<td>
|
67 |
-
<?php
|
68 |
-
$child_field['value'] = isset( $value[ $child_field['name'] ] ) ? $value[ $child_field['name'] ] : '';
|
69 |
-
$child_field['label'] = '';
|
70 |
-
WPCF7R_Html::render_field( $child_field, $prefix );
|
71 |
-
?>
|
72 |
-
</td>
|
73 |
-
<?php endforeach; ?>
|
74 |
-
<td>
|
75 |
-
<div class="qs-repeater-action">
|
76 |
-
<span class="dashicons dashicons-plus"></span>
|
77 |
-
<span class="dashicons dashicons-minus"></span>
|
78 |
-
</div>
|
79 |
-
</td>
|
80 |
-
</tr>
|
81 |
-
<?php endforeach; ?>
|
82 |
-
</tbody>
|
83 |
-
</table>
|
84 |
-
</div>
|
85 |
-
</div>
|
86 |
-
<div class="field-footer">
|
87 |
-
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
88 |
-
</div>
|
89 |
-
</div>
|
90 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render a repater field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$values = isset( $field['value'] ) && ! empty( $field['value'] ) > 0 ? $field['value'] : array( 'default' );
|
9 |
+
$base_prefix = $prefix;
|
10 |
+
$repeater_row_template = array();
|
11 |
+
?>
|
12 |
+
|
13 |
+
<?php ob_start(); ?>
|
14 |
+
|
15 |
+
<tr class="qs-repeater-row <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>" data-repeater-row-count="new_row">
|
16 |
+
<?php $prefix = $base_prefix . '[' . $field['name'] . ']' . '[new_row]'; ?>
|
17 |
+
<?php foreach ( $field['fields'] as $child_field ) : ?>
|
18 |
+
<td>
|
19 |
+
<?php
|
20 |
+
$child_field['value'] = isset( $value[ $child_field['name'] ] ) ? $value[ $child_field['name'] ] : '';
|
21 |
+
$child_field['label'] = '';
|
22 |
+
WPCF7R_Html::render_field( $child_field, $prefix );
|
23 |
+
?>
|
24 |
+
</td>
|
25 |
+
<?php endforeach; ?>
|
26 |
+
<td>
|
27 |
+
<div class="qs-repeater-action">
|
28 |
+
<span class="dashicons dashicons-plus"></span>
|
29 |
+
<span class="dashicons dashicons-minus"></span>
|
30 |
+
</div>
|
31 |
+
</td>
|
32 |
+
</tr>
|
33 |
+
|
34 |
+
<?php $repeater_single_row_template['template'] = ob_get_clean(); ?>
|
35 |
+
|
36 |
+
<div class="qs-row">
|
37 |
+
<div class="qs-col qs-col-12">
|
38 |
+
<?php if ( isset( $field['sub_title'] ) ) : ?>
|
39 |
+
<h2><?php echo esc_html( $field['sub_title'] ); ?></h2>
|
40 |
+
<?php endif; ?>
|
41 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
42 |
+
<h3><?php echo esc_html( $field['label'] ); ?> <?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?></h3>
|
43 |
+
</label>
|
44 |
+
<div>
|
45 |
+
<div class="actions">
|
46 |
+
<table class="wp-list-table widefat fixed striped pages repeater-table leads-list">
|
47 |
+
<thead>
|
48 |
+
<tr>
|
49 |
+
<?php foreach ( $values as $value_row => $value ) : ?>
|
50 |
+
<?php foreach ( $field['fields'] as $child_field ) : ?>
|
51 |
+
<th class="manage-column column-primary sortable desc">
|
52 |
+
<a href="#"><?php echo $child_field['label']; ?></a>
|
53 |
+
</th>
|
54 |
+
<?php endforeach; ?>
|
55 |
+
<th><?php _e( 'Actions', 'wpcf7-redirect' ); ?></th>
|
56 |
+
<?php break; ?>
|
57 |
+
<?php endforeach; ?>
|
58 |
+
</tr>
|
59 |
+
</thead>
|
60 |
+
|
61 |
+
<tbody id="the_list" data-repeater-template="<?php echo htmlspecialchars( wp_json_encode( $repeater_single_row_template ) ); ?>">
|
62 |
+
<?php foreach ( $values as $value_row => $value ) : ?>
|
63 |
+
<tr class="qs-repeater-row" data-repeater-row-count="<?php echo $value_row; ?>">
|
64 |
+
<?php $prefix = $base_prefix . '[' . $field['name'] . ']' . '[' . $value_row . ']'; ?>
|
65 |
+
<?php foreach ( $field['fields'] as $child_field ) : ?>
|
66 |
+
<td>
|
67 |
+
<?php
|
68 |
+
$child_field['value'] = isset( $value[ $child_field['name'] ] ) ? $value[ $child_field['name'] ] : '';
|
69 |
+
$child_field['label'] = '';
|
70 |
+
WPCF7R_Html::render_field( $child_field, $prefix );
|
71 |
+
?>
|
72 |
+
</td>
|
73 |
+
<?php endforeach; ?>
|
74 |
+
<td>
|
75 |
+
<div class="qs-repeater-action">
|
76 |
+
<span class="dashicons dashicons-plus"></span>
|
77 |
+
<span class="dashicons dashicons-minus"></span>
|
78 |
+
</div>
|
79 |
+
</td>
|
80 |
+
</tr>
|
81 |
+
<?php endforeach; ?>
|
82 |
+
</tbody>
|
83 |
+
</table>
|
84 |
+
</div>
|
85 |
+
</div>
|
86 |
+
<div class="field-footer">
|
87 |
+
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
</div>
|
templates/fields/field-rule-blocks.php
CHANGED
@@ -1,38 +1,38 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render a block of rules
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
if ( ! conditional_logic_enabled() ) {
|
9 |
-
return;
|
10 |
-
}
|
11 |
-
?>
|
12 |
-
|
13 |
-
<div class="conditional-logic-blocks <?php echo $field['has_conditional_logic'] ? 'active' : ''; ?>">
|
14 |
-
<div class="conditional-groups-wrap">
|
15 |
-
<div class="conditional-groups-tabs">
|
16 |
-
<div class="conditional-group-blocks">
|
17 |
-
<div class="qs-row">
|
18 |
-
<div class="qs-col qs-col-12">
|
19 |
-
<div class="wpcfr-rule-groups">
|
20 |
-
<?php
|
21 |
-
$active_tab = 'active';
|
22 |
-
foreach ( $field['blocks'] as $group_block ) :
|
23 |
-
WPCF7R_Html::get_block_html( 'block_1', $group_block, $active_tab, true, $prefix );
|
24 |
-
$active_tab = false;
|
25 |
-
endforeach;
|
26 |
-
?>
|
27 |
-
</div>
|
28 |
-
</div>
|
29 |
-
<div class="qs-col qs-col-12">
|
30 |
-
<div class="groups-actions">
|
31 |
-
<a href="#" class="button-primary wpcfr-add-group"><?php _e( 'OR', 'wpcf7-redirect' ); ?></a>
|
32 |
-
</div>
|
33 |
-
</div>
|
34 |
-
</div>
|
35 |
-
</div>
|
36 |
-
</div>
|
37 |
-
</div>
|
38 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render a block of rules
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
if ( ! conditional_logic_enabled() ) {
|
9 |
+
return;
|
10 |
+
}
|
11 |
+
?>
|
12 |
+
|
13 |
+
<div class="conditional-logic-blocks <?php echo $field['has_conditional_logic'] ? 'active' : ''; ?>">
|
14 |
+
<div class="conditional-groups-wrap">
|
15 |
+
<div class="conditional-groups-tabs">
|
16 |
+
<div class="conditional-group-blocks">
|
17 |
+
<div class="qs-row">
|
18 |
+
<div class="qs-col qs-col-12">
|
19 |
+
<div class="wpcfr-rule-groups">
|
20 |
+
<?php
|
21 |
+
$active_tab = 'active';
|
22 |
+
foreach ( $field['blocks'] as $group_block ) :
|
23 |
+
WPCF7R_Html::get_block_html( 'block_1', $group_block, $active_tab, true, $prefix );
|
24 |
+
$active_tab = false;
|
25 |
+
endforeach;
|
26 |
+
?>
|
27 |
+
</div>
|
28 |
+
</div>
|
29 |
+
<div class="qs-col qs-col-12">
|
30 |
+
<div class="groups-actions">
|
31 |
+
<a href="#" class="button-primary wpcfr-add-group"><?php _e( 'OR', 'wpcf7-redirect' ); ?></a>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
</div>
|
templates/fields/field-select.php
CHANGED
@@ -1,31 +1,31 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render a select field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$selected = selected( '1', '1', false );
|
9 |
-
$toggler = isset( $field['toggler'] ) ? $field['name'] : false;
|
10 |
-
?>
|
11 |
-
|
12 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>" >
|
13 |
-
<?php if ( $field['label'] ) : ?>
|
14 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
15 |
-
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
16 |
-
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
17 |
-
</label>
|
18 |
-
<?php endif; ?>
|
19 |
-
<select class="" <?php echo $toggler ? "data-toggler-name='{$toggler}'" : ''; ?> name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]" >
|
20 |
-
<?php foreach ( $field['options'] as $option_key => $option_label ) : ?>
|
21 |
-
<?php
|
22 |
-
$selected = isset( $field['value'] ) && $field['value'] ? selected( $field['value'], $option_key, false ) : $selected;
|
23 |
-
?>
|
24 |
-
<option value="<?php echo $option_key; ?>" <?php echo $selected; ?>><?php echo $option_label; ?></option>
|
25 |
-
<?php $selected = ''; ?>
|
26 |
-
<?php endforeach; ?>
|
27 |
-
</select>
|
28 |
-
<div class="field-footer">
|
29 |
-
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
30 |
-
</div>
|
31 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render a select field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$selected = selected( '1', '1', false );
|
9 |
+
$toggler = isset( $field['toggler'] ) ? $field['name'] : false;
|
10 |
+
?>
|
11 |
+
|
12 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>" >
|
13 |
+
<?php if ( $field['label'] ) : ?>
|
14 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
15 |
+
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
16 |
+
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
17 |
+
</label>
|
18 |
+
<?php endif; ?>
|
19 |
+
<select class="" <?php echo $toggler ? "data-toggler-name='{$toggler}'" : ''; ?> name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]" >
|
20 |
+
<?php foreach ( $field['options'] as $option_key => $option_label ) : ?>
|
21 |
+
<?php
|
22 |
+
$selected = isset( $field['value'] ) && $field['value'] ? selected( $field['value'], $option_key, false ) : $selected;
|
23 |
+
?>
|
24 |
+
<option value="<?php echo $option_key; ?>" <?php echo $selected; ?>><?php echo $option_label; ?></option>
|
25 |
+
<?php $selected = ''; ?>
|
26 |
+
<?php endforeach; ?>
|
27 |
+
</select>
|
28 |
+
<div class="field-footer">
|
29 |
+
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
30 |
+
</div>
|
31 |
+
</div>
|
templates/fields/field-tags-map.php
CHANGED
@@ -1,76 +1,76 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render tags mapping for API field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$defaults_name = isset( $field['defaults_name'] ) ? $field['defaults_name'] : 'tags_defaults';
|
9 |
-
$selected = selected( '1', '1', false );
|
10 |
-
?>
|
11 |
-
|
12 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
13 |
-
<?php if ( isset( $field['title'] ) && $field['title'] ) : ?>
|
14 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
15 |
-
<h3><?php echo esc_html( $field['label'] ); ?></h3>
|
16 |
-
|
17 |
-
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
18 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>"><?php echo esc_html( $field['sub_title'] ); ?></label>
|
19 |
-
<br/>
|
20 |
-
<?php endif; ?>
|
21 |
-
</label>
|
22 |
-
<?php endif; ?>
|
23 |
-
|
24 |
-
<div class="cf7_row">
|
25 |
-
<table class="wp-list-table widefat fixed striped pages wp-list-table-inner">
|
26 |
-
<tr>
|
27 |
-
<td><strong><?php _e( 'Form Field Name', 'wpcf7-redirect' ); ?></strong></td>
|
28 |
-
<?php if ( 'test_tags_map' !== $field['name'] ) : ?>
|
29 |
-
<td class="tags-map-api-key"><strong><?php _e( 'Matching 3rd-Party Field Name', 'wpcf7-redirect' ); ?></strong><?php echo cf7r_tooltip( __( 'The Matching 3rd-Party field name as your api provider required', 'wpcf7-redirect' ) ); ?></td>
|
30 |
-
<?php endif; ?>
|
31 |
-
<?php if ( 'test_tags_map' !== $field['name'] ) : ?>
|
32 |
-
<td><strong><?php _e( 'Defaults', 'wpcf7-redirect' ); ?></strong><?php echo cf7r_tooltip( __( 'Send default values if not selected by the user', 'wpcf7-redirect' ) ); ?></td>
|
33 |
-
<?php else : ?>
|
34 |
-
<td><strong><?php _e( 'Value', 'wpcf7-redirect' ); ?></strong><?php echo cf7r_tooltip( __( 'Which value to send', 'wpcf7-redirect' ) ); ?></td>
|
35 |
-
<?php endif; ?>
|
36 |
-
<?php if ( 'test_tags_map' !== $field['name'] && isset( $field['tags_functions'] ) ) : ?>
|
37 |
-
<td><strong><?php _e( 'Function', 'wpcf7-redirect' ); ?></strong><?php echo cf7r_tooltip( __( 'Perform actions on the submitted value', 'wpcf7-redirect' ) ); ?></td>
|
38 |
-
<?php endif; ?>
|
39 |
-
</tr>
|
40 |
-
<?php
|
41 |
-
if ( isset( $field['tags'] ) && $field['tags'] ) :
|
42 |
-
foreach ( $field['tags'] as $mail_tag ) :
|
43 |
-
?>
|
44 |
-
<tr>
|
45 |
-
<td class="<?php echo $mail_tag->name; ?>"><?php echo $mail_tag->name; ?></td>
|
46 |
-
<?php if ( 'test_tags_map' !== $field['name'] ) : ?>
|
47 |
-
<td class="tags-map-api-key">
|
48 |
-
<input type="text" id="sf-<?php echo $mail_tag->name; ?>"
|
49 |
-
name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>][<?php echo $mail_tag->name; ?>]"
|
50 |
-
class="large-text"
|
51 |
-
value="<?php echo isset( $field['value'][ $mail_tag->name ] ) ? esc_html( $field['value'][ $mail_tag->name ] ) : ''; ?>" />
|
52 |
-
</td>
|
53 |
-
<?php endif; ?>
|
54 |
-
<td>
|
55 |
-
<?php $selected_value = isset( $field[ $defaults_name ][ "{$mail_tag->name}" ] ) ? $field[ $defaults_name ][ "{$mail_tag->name}" ] : ''; ?>
|
56 |
-
<input type="text" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $defaults_name; ?>][<?php echo $mail_tag->name; ?>]" value="<?php echo $selected_value; ?>" />
|
57 |
-
</td>
|
58 |
-
<?php if ( 'test_tags_map' !== $field['name'] && isset( $field['tags_functions'] ) ) : ?>
|
59 |
-
<td>
|
60 |
-
<?php $selected_function = isset( $field['tags_functions'][ "{$mail_tag->name}" ] ) ? $field['tags_functions'][ "{$mail_tag->name}" ] : ''; ?>
|
61 |
-
<select class="" name="wpcf7-redirect<?php echo $prefix; ?>[tags_functions][<?php echo $mail_tag->name; ?>]">
|
62 |
-
<?php $functions = WPCF7r_Utils::get_available_text_functions( '', $mail_tag->type ); ?>
|
63 |
-
<option value="" <?php echo ! $selected_function ? "selected='selected'" : ''; ?>><?php _e( 'Select' ); ?></option>
|
64 |
-
<?php foreach ( array_keys( $functions ) as $function_name ) : ?>
|
65 |
-
<option value="<?php echo $function_name; ?>" <?php selected( $selected_function, $function_name, true ); ?>><?php echo $function_name; ?></option>
|
66 |
-
<?php $selected = ''; ?>
|
67 |
-
<?php endforeach; ?>
|
68 |
-
</select>
|
69 |
-
</td>
|
70 |
-
<?php endif; ?>
|
71 |
-
</tr>
|
72 |
-
<?php endforeach; ?>
|
73 |
-
<?php endif; ?>
|
74 |
-
</table>
|
75 |
-
</div>
|
76 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render tags mapping for API field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$defaults_name = isset( $field['defaults_name'] ) ? $field['defaults_name'] : 'tags_defaults';
|
9 |
+
$selected = selected( '1', '1', false );
|
10 |
+
?>
|
11 |
+
|
12 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
13 |
+
<?php if ( isset( $field['title'] ) && $field['title'] ) : ?>
|
14 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
15 |
+
<h3><?php echo esc_html( $field['label'] ); ?></h3>
|
16 |
+
|
17 |
+
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
18 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>"><?php echo esc_html( $field['sub_title'] ); ?></label>
|
19 |
+
<br/>
|
20 |
+
<?php endif; ?>
|
21 |
+
</label>
|
22 |
+
<?php endif; ?>
|
23 |
+
|
24 |
+
<div class="cf7_row">
|
25 |
+
<table class="wp-list-table widefat fixed striped pages wp-list-table-inner">
|
26 |
+
<tr>
|
27 |
+
<td><strong><?php _e( 'Form Field Name', 'wpcf7-redirect' ); ?></strong></td>
|
28 |
+
<?php if ( 'test_tags_map' !== $field['name'] ) : ?>
|
29 |
+
<td class="tags-map-api-key"><strong><?php _e( 'Matching 3rd-Party Field Name', 'wpcf7-redirect' ); ?></strong><?php echo cf7r_tooltip( __( 'The Matching 3rd-Party field name as your api provider required', 'wpcf7-redirect' ) ); ?></td>
|
30 |
+
<?php endif; ?>
|
31 |
+
<?php if ( 'test_tags_map' !== $field['name'] ) : ?>
|
32 |
+
<td><strong><?php _e( 'Defaults', 'wpcf7-redirect' ); ?></strong><?php echo cf7r_tooltip( __( 'Send default values if not selected by the user', 'wpcf7-redirect' ) ); ?></td>
|
33 |
+
<?php else : ?>
|
34 |
+
<td><strong><?php _e( 'Value', 'wpcf7-redirect' ); ?></strong><?php echo cf7r_tooltip( __( 'Which value to send', 'wpcf7-redirect' ) ); ?></td>
|
35 |
+
<?php endif; ?>
|
36 |
+
<?php if ( 'test_tags_map' !== $field['name'] && isset( $field['tags_functions'] ) ) : ?>
|
37 |
+
<td><strong><?php _e( 'Function', 'wpcf7-redirect' ); ?></strong><?php echo cf7r_tooltip( __( 'Perform actions on the submitted value', 'wpcf7-redirect' ) ); ?></td>
|
38 |
+
<?php endif; ?>
|
39 |
+
</tr>
|
40 |
+
<?php
|
41 |
+
if ( isset( $field['tags'] ) && $field['tags'] ) :
|
42 |
+
foreach ( $field['tags'] as $mail_tag ) :
|
43 |
+
?>
|
44 |
+
<tr>
|
45 |
+
<td class="<?php echo $mail_tag->name; ?>"><?php echo $mail_tag->name; ?></td>
|
46 |
+
<?php if ( 'test_tags_map' !== $field['name'] ) : ?>
|
47 |
+
<td class="tags-map-api-key">
|
48 |
+
<input type="text" id="sf-<?php echo $mail_tag->name; ?>"
|
49 |
+
name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>][<?php echo $mail_tag->name; ?>]"
|
50 |
+
class="large-text"
|
51 |
+
value="<?php echo isset( $field['value'][ $mail_tag->name ] ) ? esc_html( $field['value'][ $mail_tag->name ] ) : ''; ?>" />
|
52 |
+
</td>
|
53 |
+
<?php endif; ?>
|
54 |
+
<td>
|
55 |
+
<?php $selected_value = isset( $field[ $defaults_name ][ "{$mail_tag->name}" ] ) ? $field[ $defaults_name ][ "{$mail_tag->name}" ] : ''; ?>
|
56 |
+
<input type="text" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $defaults_name; ?>][<?php echo $mail_tag->name; ?>]" value="<?php echo $selected_value; ?>" />
|
57 |
+
</td>
|
58 |
+
<?php if ( 'test_tags_map' !== $field['name'] && isset( $field['tags_functions'] ) ) : ?>
|
59 |
+
<td>
|
60 |
+
<?php $selected_function = isset( $field['tags_functions'][ "{$mail_tag->name}" ] ) ? $field['tags_functions'][ "{$mail_tag->name}" ] : ''; ?>
|
61 |
+
<select class="" name="wpcf7-redirect<?php echo $prefix; ?>[tags_functions][<?php echo $mail_tag->name; ?>]">
|
62 |
+
<?php $functions = WPCF7r_Utils::get_available_text_functions( '', $mail_tag->type ); ?>
|
63 |
+
<option value="" <?php echo ! $selected_function ? "selected='selected'" : ''; ?>><?php _e( 'Select' ); ?></option>
|
64 |
+
<?php foreach ( array_keys( $functions ) as $function_name ) : ?>
|
65 |
+
<option value="<?php echo $function_name; ?>" <?php selected( $selected_function, $function_name, true ); ?>><?php echo $function_name; ?></option>
|
66 |
+
<?php $selected = ''; ?>
|
67 |
+
<?php endforeach; ?>
|
68 |
+
</select>
|
69 |
+
</td>
|
70 |
+
<?php endif; ?>
|
71 |
+
</tr>
|
72 |
+
<?php endforeach; ?>
|
73 |
+
<?php endif; ?>
|
74 |
+
</table>
|
75 |
+
</div>
|
76 |
+
</div>
|
templates/fields/field-taxonomy.php
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render taxonomy select field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$taxonomiies = get_taxonomies();
|
9 |
-
?>
|
10 |
-
|
11 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
12 |
-
<?php if ( $field['label'] ) : ?>
|
13 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
14 |
-
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
15 |
-
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
16 |
-
</label>
|
17 |
-
<?php endif; ?>
|
18 |
-
<select class="" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]">
|
19 |
-
<?php foreach ( $taxonomiies as $option_key => $option_label ) : ?>
|
20 |
-
<option value="<?php echo $option_key; ?>" <?php selected( $field['value'], $option_key ); ?>><?php echo $option_label; ?></option>
|
21 |
-
<?php endforeach; ?>
|
22 |
-
</select>
|
23 |
-
<div class="field-footer">
|
24 |
-
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
25 |
-
</div>
|
26 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render taxonomy select field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$taxonomiies = get_taxonomies();
|
9 |
+
?>
|
10 |
+
|
11 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
12 |
+
<?php if ( $field['label'] ) : ?>
|
13 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
14 |
+
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
15 |
+
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
16 |
+
</label>
|
17 |
+
<?php endif; ?>
|
18 |
+
<select class="" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]">
|
19 |
+
<?php foreach ( $taxonomiies as $option_key => $option_label ) : ?>
|
20 |
+
<option value="<?php echo $option_key; ?>" <?php selected( $field['value'], $option_key ); ?>><?php echo $option_label; ?></option>
|
21 |
+
<?php endforeach; ?>
|
22 |
+
</select>
|
23 |
+
<div class="field-footer">
|
24 |
+
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
25 |
+
</div>
|
26 |
+
</div>
|
templates/fields/field-text.php
CHANGED
@@ -1,41 +1,41 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Display text field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$name = isset( $field['name'] ) ? $field['name'] : '';
|
9 |
-
$class = isset( $field['class'] ) ? $field['class'] : '';
|
10 |
-
$label = isset( $field['label'] ) ? $field['label'] : '';
|
11 |
-
$tooltip = isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : '';
|
12 |
-
$sub_title = isset( $field['sub_title'] ) ? $field['sub_title'] : '';
|
13 |
-
$input_class = isset( $field['input_class'] ) ? $field['input_class'] : '';
|
14 |
-
$input_attr = isset( $field['input_attr'] ) ? $field['input_attr'] : '';
|
15 |
-
$footer = isset( $field['footer'] ) ? $field['footer'] : '';
|
16 |
-
$placeholder = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
|
17 |
-
$value = isset( $field['value'] ) ? $field['value'] : '';
|
18 |
-
|
19 |
-
?>
|
20 |
-
<div class="field-wrap field-wrap-<?php echo esc_html( $name ); ?> <?php echo $class; ?>">
|
21 |
-
<?php if ( $label ) : ?>
|
22 |
-
<label for="wpcf7-redirect-<?php echo $name; ?>">
|
23 |
-
<strong><?php echo esc_html( $label ); ?></strong>
|
24 |
-
<?php echo $tooltip;?>
|
25 |
-
</label>
|
26 |
-
<?php endif; ?>
|
27 |
-
|
28 |
-
<?php if ( $sub_title ) : ?>
|
29 |
-
|
30 |
-
<div class="wpcf7-subtitle">
|
31 |
-
<?php echo esc_html( $sub_title ); ?>
|
32 |
-
</div>
|
33 |
-
|
34 |
-
<?php endif; ?>
|
35 |
-
|
36 |
-
<input type="text" class="wpcf7-redirect-<?php echo esc_html( $name ); ?>-fields <?php echo esc_html( $input_class ); ?>" placeholder="<?php echo esc_html( $placeholder ); ?>" name="wpcf7-redirect<?php echo esc_html( $prefix ); ?>[<?php echo esc_html( $name ); ?>]" value="<?php echo esc_html( $value ); ?>" <?php echo esc_html( $input_attr ); ?>>
|
37 |
-
|
38 |
-
<div class="field-footer">
|
39 |
-
<?php echo $footer; ?>
|
40 |
-
</div>
|
41 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Display text field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$name = isset( $field['name'] ) ? $field['name'] : '';
|
9 |
+
$class = isset( $field['class'] ) ? $field['class'] : '';
|
10 |
+
$label = isset( $field['label'] ) ? $field['label'] : '';
|
11 |
+
$tooltip = isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : '';
|
12 |
+
$sub_title = isset( $field['sub_title'] ) ? $field['sub_title'] : '';
|
13 |
+
$input_class = isset( $field['input_class'] ) ? $field['input_class'] : '';
|
14 |
+
$input_attr = isset( $field['input_attr'] ) ? $field['input_attr'] : '';
|
15 |
+
$footer = isset( $field['footer'] ) ? $field['footer'] : '';
|
16 |
+
$placeholder = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
|
17 |
+
$value = isset( $field['value'] ) ? $field['value'] : '';
|
18 |
+
|
19 |
+
?>
|
20 |
+
<div class="field-wrap field-wrap-<?php echo esc_html( $name ); ?> <?php echo $class; ?>">
|
21 |
+
<?php if ( $label ) : ?>
|
22 |
+
<label for="wpcf7-redirect-<?php echo $name; ?>">
|
23 |
+
<strong><?php echo esc_html( $label ); ?></strong>
|
24 |
+
<?php echo $tooltip;?>
|
25 |
+
</label>
|
26 |
+
<?php endif; ?>
|
27 |
+
|
28 |
+
<?php if ( $sub_title ) : ?>
|
29 |
+
|
30 |
+
<div class="wpcf7-subtitle">
|
31 |
+
<?php echo esc_html( $sub_title ); ?>
|
32 |
+
</div>
|
33 |
+
|
34 |
+
<?php endif; ?>
|
35 |
+
|
36 |
+
<input type="text" class="wpcf7-redirect-<?php echo esc_html( $name ); ?>-fields <?php echo esc_html( $input_class ); ?>" placeholder="<?php echo esc_html( $placeholder ); ?>" name="wpcf7-redirect<?php echo esc_html( $prefix ); ?>[<?php echo esc_html( $name ); ?>]" value="<?php echo esc_html( $value ); ?>" <?php echo esc_html( $input_attr ); ?>>
|
37 |
+
|
38 |
+
<div class="field-footer">
|
39 |
+
<?php echo $footer; ?>
|
40 |
+
</div>
|
41 |
+
</div>
|
templates/fields/field-textarea.php
CHANGED
@@ -1,33 +1,33 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render a textarea field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
$name = isset( $field['name'] ) ? $field['name'] : '';
|
9 |
-
$class = isset( $field['class'] ) ? $field['class'] : '';
|
10 |
-
$label = isset( $field['label'] ) ? $field['label'] : '';
|
11 |
-
$tooltip = isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : '';
|
12 |
-
$sub_title = isset( $field['sub_title'] ) ? $field['sub_title'] : '';
|
13 |
-
$input_class = isset( $field['input_class'] ) ? $field['input_class'] : '';
|
14 |
-
$input_attr = isset( $field['input_attr'] ) ? $field['input_attr'] : '';
|
15 |
-
$footer = isset( $field['footer'] ) ? $field['footer'] : '';
|
16 |
-
$placeholder = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
|
17 |
-
$value = isset( $field['value'] ) ? $field['value'] : '';
|
18 |
-
|
19 |
-
?>
|
20 |
-
<div class="field-wrap field-wrap-<?php echo esc_html( $name ); ?> <?php echo esc_html( $class ); ?>">
|
21 |
-
<label for="wpcf7-redirect-<?php echo esc_html( $name ); ?>">
|
22 |
-
<strong><?php echo esc_html( $label ); ?></strong>
|
23 |
-
</label>
|
24 |
-
<?php if ( $sub_title ) : ?>
|
25 |
-
<div class="wpcf7-subtitle">
|
26 |
-
<?php echo esc_html( $sub_title ); ?>
|
27 |
-
</div>
|
28 |
-
<?php endif; ?>
|
29 |
-
<textarea rows="10" class="wpcf7-redirect-<?php echo esc_html( $name ); ?>-fields" placeholder="<?php echo esc_html( $placeholder ); ?>" name="wpcf7-redirect<?php echo esc_html( $prefix ); ?>[<?php echo esc_html( $name ); ?>]"><?php echo esc_html( $value ); ?></textarea>
|
30 |
-
<div class="field-footer">
|
31 |
-
<?php echo $footer ; ?>
|
32 |
-
</div>
|
33 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render a textarea field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$name = isset( $field['name'] ) ? $field['name'] : '';
|
9 |
+
$class = isset( $field['class'] ) ? $field['class'] : '';
|
10 |
+
$label = isset( $field['label'] ) ? $field['label'] : '';
|
11 |
+
$tooltip = isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : '';
|
12 |
+
$sub_title = isset( $field['sub_title'] ) ? $field['sub_title'] : '';
|
13 |
+
$input_class = isset( $field['input_class'] ) ? $field['input_class'] : '';
|
14 |
+
$input_attr = isset( $field['input_attr'] ) ? $field['input_attr'] : '';
|
15 |
+
$footer = isset( $field['footer'] ) ? $field['footer'] : '';
|
16 |
+
$placeholder = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
|
17 |
+
$value = isset( $field['value'] ) ? $field['value'] : '';
|
18 |
+
|
19 |
+
?>
|
20 |
+
<div class="field-wrap field-wrap-<?php echo esc_html( $name ); ?> <?php echo esc_html( $class ); ?>">
|
21 |
+
<label for="wpcf7-redirect-<?php echo esc_html( $name ); ?>">
|
22 |
+
<strong><?php echo esc_html( $label ); ?></strong>
|
23 |
+
</label>
|
24 |
+
<?php if ( $sub_title ) : ?>
|
25 |
+
<div class="wpcf7-subtitle">
|
26 |
+
<?php echo esc_html( $sub_title ); ?>
|
27 |
+
</div>
|
28 |
+
<?php endif; ?>
|
29 |
+
<textarea rows="10" class="wpcf7-redirect-<?php echo esc_html( $name ); ?>-fields" placeholder="<?php echo esc_html( $placeholder ); ?>" name="wpcf7-redirect<?php echo esc_html( $prefix ); ?>[<?php echo esc_html( $name ); ?>]"><?php echo esc_html( $value ); ?></textarea>
|
30 |
+
<div class="field-footer">
|
31 |
+
<?php echo $footer ; ?>
|
32 |
+
</div>
|
33 |
+
</div>
|
templates/fields/field-url.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Render url field
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
10 |
-
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
11 |
-
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
12 |
-
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
13 |
-
</label>
|
14 |
-
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
15 |
-
<div class="wpcf7-subtitle">
|
16 |
-
<?php echo $field['sub_title']; ?>
|
17 |
-
</div>
|
18 |
-
<?php endif; ?>
|
19 |
-
<input type="url" class="wpcf7-redirect-<?php echo $field['name']; ?>-fields" placeholder="<?php echo esc_html( $field['placeholder'] ); ?>" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]" value="<?php echo esc_html( $field['value'] ); ?>">
|
20 |
-
<div class="field-footer">
|
21 |
-
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
22 |
-
</div>
|
23 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Render url field
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="field-wrap field-wrap-<?php echo $field['name']; ?> <?php echo isset( $field['class'] ) ? $field['class'] : ''; ?>">
|
10 |
+
<label for="wpcf7-redirect-<?php echo $field['name']; ?>">
|
11 |
+
<strong><?php echo esc_html( $field['label'] ); ?></strong>
|
12 |
+
<?php echo isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : ''; ?>
|
13 |
+
</label>
|
14 |
+
<?php if ( isset( $field['sub_title'] ) && $field['sub_title'] ) : ?>
|
15 |
+
<div class="wpcf7-subtitle">
|
16 |
+
<?php echo $field['sub_title']; ?>
|
17 |
+
</div>
|
18 |
+
<?php endif; ?>
|
19 |
+
<input type="url" class="wpcf7-redirect-<?php echo $field['name']; ?>-fields" placeholder="<?php echo esc_html( $field['placeholder'] ); ?>" name="wpcf7-redirect<?php echo $prefix; ?>[<?php echo $field['name']; ?>]" value="<?php echo esc_html( $field['value'] ); ?>">
|
20 |
+
<div class="field-footer">
|
21 |
+
<?php echo isset( $field['footer'] ) ? $field['footer'] : ''; ?>
|
22 |
+
</div>
|
23 |
+
</div>
|
templates/fields/index.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit;
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit;
|
templates/index.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit;
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit;
|
templates/popup-api-test.php
CHANGED
@@ -1,74 +1,74 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) || exit;
|
3 |
-
?>
|
4 |
-
|
5 |
-
<div class="wpcfr-popup-wrap wpcfr-popup-hidden <?php echo $template; ?> middle-center">
|
6 |
-
<div class="wpcfr-popup-wrap-inner">
|
7 |
-
<span class="dashicons dashicons-no-alt wpcfr-close-popup top-right"></span>
|
8 |
-
<div class="wpcfr-popup-wrap-content">
|
9 |
-
<h3>
|
10 |
-
<?php _e( 'Record', 'wpcf7-redirect' ); ?>
|
11 |
-
</h3>
|
12 |
-
<div class="wrapper">
|
13 |
-
<textarea name="name" rows="8" cols="80">
|
14 |
-
<?php
|
15 |
-
ob_start();
|
16 |
-
|
17 |
-
print_r( $this->record );
|
18 |
-
|
19 |
-
echo esc_html( ob_get_clean() );
|
20 |
-
?>
|
21 |
-
</textarea>
|
22 |
-
</div>
|
23 |
-
<h3>
|
24 |
-
<?php _e( 'Request', 'wpcf7-redirect' ); ?>
|
25 |
-
</h3>
|
26 |
-
<div class="wrapper">
|
27 |
-
<textarea name="name" rows="8" cols="80">
|
28 |
-
<?php
|
29 |
-
ob_start();
|
30 |
-
|
31 |
-
print_r( $this->request );
|
32 |
-
|
33 |
-
echo esc_html( ob_get_clean() );
|
34 |
-
?>
|
35 |
-
</textarea>
|
36 |
-
</div>
|
37 |
-
<h3>
|
38 |
-
<?php _e( 'Response', 'wpcf7-redirect' ); ?>
|
39 |
-
</h3>
|
40 |
-
<div class="wrapper">
|
41 |
-
<?php if ( is_wp_error( $this->results ) ) : ?>
|
42 |
-
<span class="err"><?php _e( 'Error!' ); ?></span>
|
43 |
-
<textarea name="name" rows="8" cols="80">
|
44 |
-
<?php
|
45 |
-
ob_start();
|
46 |
-
|
47 |
-
print_r( $this->results );
|
48 |
-
|
49 |
-
echo esc_html( ob_get_clean() );
|
50 |
-
?>
|
51 |
-
</textarea>
|
52 |
-
<?php else : ?>
|
53 |
-
<div class="field-wrap">
|
54 |
-
<div class="label">
|
55 |
-
<label>
|
56 |
-
<?php _e( 'Response code', 'wpcf7-redirect' ); ?>
|
57 |
-
</label>
|
58 |
-
<span><?php echo $this->results['response']['message']; ?>(<?php echo $this->results['response']['code']; ?>)</span>
|
59 |
-
</div>
|
60 |
-
<textarea name="name" rows="8" cols="80">
|
61 |
-
<?php
|
62 |
-
ob_start();
|
63 |
-
|
64 |
-
print_r( $this->results );
|
65 |
-
|
66 |
-
echo esc_html( ob_get_clean() );
|
67 |
-
?>
|
68 |
-
</textarea>
|
69 |
-
</div>
|
70 |
-
<?php endif; ?>
|
71 |
-
</div>
|
72 |
-
</div>
|
73 |
-
</div>
|
74 |
-
</div>
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit;
|
3 |
+
?>
|
4 |
+
|
5 |
+
<div class="wpcfr-popup-wrap wpcfr-popup-hidden <?php echo $template; ?> middle-center">
|
6 |
+
<div class="wpcfr-popup-wrap-inner">
|
7 |
+
<span class="dashicons dashicons-no-alt wpcfr-close-popup top-right"></span>
|
8 |
+
<div class="wpcfr-popup-wrap-content">
|
9 |
+
<h3>
|
10 |
+
<?php _e( 'Record', 'wpcf7-redirect' ); ?>
|
11 |
+
</h3>
|
12 |
+
<div class="wrapper">
|
13 |
+
<textarea name="name" rows="8" cols="80">
|
14 |
+
<?php
|
15 |
+
ob_start();
|
16 |
+
|
17 |
+
print_r( $this->record );
|
18 |
+
|
19 |
+
echo esc_html( ob_get_clean() );
|
20 |
+
?>
|
21 |
+
</textarea>
|
22 |
+
</div>
|
23 |
+
<h3>
|
24 |
+
<?php _e( 'Request', 'wpcf7-redirect' ); ?>
|
25 |
+
</h3>
|
26 |
+
<div class="wrapper">
|
27 |
+
<textarea name="name" rows="8" cols="80">
|
28 |
+
<?php
|
29 |
+
ob_start();
|
30 |
+
|
31 |
+
print_r( $this->request );
|
32 |
+
|
33 |
+
echo esc_html( ob_get_clean() );
|
34 |
+
?>
|
35 |
+
</textarea>
|
36 |
+
</div>
|
37 |
+
<h3>
|
38 |
+
<?php _e( 'Response', 'wpcf7-redirect' ); ?>
|
39 |
+
</h3>
|
40 |
+
<div class="wrapper">
|
41 |
+
<?php if ( is_wp_error( $this->results ) ) : ?>
|
42 |
+
<span class="err"><?php _e( 'Error!' ); ?></span>
|
43 |
+
<textarea name="name" rows="8" cols="80">
|
44 |
+
<?php
|
45 |
+
ob_start();
|
46 |
+
|
47 |
+
print_r( $this->results );
|
48 |
+
|
49 |
+
echo esc_html( ob_get_clean() );
|
50 |
+
?>
|
51 |
+
</textarea>
|
52 |
+
<?php else : ?>
|
53 |
+
<div class="field-wrap">
|
54 |
+
<div class="label">
|
55 |
+
<label>
|
56 |
+
<?php _e( 'Response code', 'wpcf7-redirect' ); ?>
|
57 |
+
</label>
|
58 |
+
<span><?php echo $this->results['response']['message']; ?>(<?php echo $this->results['response']['code']; ?>)</span>
|
59 |
+
</div>
|
60 |
+
<textarea name="name" rows="8" cols="80">
|
61 |
+
<?php
|
62 |
+
ob_start();
|
63 |
+
|
64 |
+
print_r( $this->results );
|
65 |
+
|
66 |
+
echo esc_html( ob_get_clean() );
|
67 |
+
?>
|
68 |
+
</textarea>
|
69 |
+
</div>
|
70 |
+
<?php endif; ?>
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
</div>
|
74 |
+
</div>
|
templates/save-form.php
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Please save your form message
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
?>
|
8 |
-
|
9 |
-
<fieldset>
|
10 |
-
<div class="fields-wrap field-wrap-page-id">
|
11 |
-
<div class="tab-wrap">
|
12 |
-
<div class="wpcf7r-tab-wrap-inner">
|
13 |
-
<div data-tab-inner>
|
14 |
-
<h3>
|
15 |
-
<?php _e( 'Please save your form', 'wpcf7-redirect' ); ?>
|
16 |
-
</h3>
|
17 |
-
</div>
|
18 |
-
</div>
|
19 |
-
</div>
|
20 |
-
</div>
|
21 |
-
</fieldset>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Please save your form message
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
?>
|
8 |
+
|
9 |
+
<fieldset>
|
10 |
+
<div class="fields-wrap field-wrap-page-id">
|
11 |
+
<div class="tab-wrap">
|
12 |
+
<div class="wpcf7r-tab-wrap-inner">
|
13 |
+
<div data-tab-inner>
|
14 |
+
<h3>
|
15 |
+
<?php _e( 'Please save your form', 'wpcf7-redirect' ); ?>
|
16 |
+
</h3>
|
17 |
+
</div>
|
18 |
+
</div>
|
19 |
+
</div>
|
20 |
+
</div>
|
21 |
+
</fieldset>
|
templates/settings.php
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Displays the settings panel
|
4 |
-
*/
|
5 |
-
|
6 |
-
defined( 'ABSPATH' ) || exit;
|
7 |
-
|
8 |
-
wp_nonce_field( 'wpcf7_redirect_page_metaboxes', 'wpcf7_redirect_page_metaboxes_nonce' );
|
9 |
-
|
10 |
-
do_action( 'before_redirect_settings_tab_title', $this->cf7_post );
|
11 |
-
?>
|
12 |
-
|
13 |
-
<fieldset>
|
14 |
-
<div class="fields-wrap field-wrap-page-id">
|
15 |
-
<div class="tab-wrap">
|
16 |
-
<div class="wpcf7r-tab-wrap-inner">
|
17 |
-
<div data-tab-inner>
|
18 |
-
<div class="qs-row">
|
19 |
-
<?php include( 'default-settings.php' ); ?>
|
20 |
-
</div>
|
21 |
-
</div>
|
22 |
-
</div>
|
23 |
-
</div>
|
24 |
-
</div>
|
25 |
-
</fieldset>
|
26 |
-
|
27 |
-
<?php
|
28 |
-
do_action( 'after_redirect_settings_tab_form', $this->cf7_post );
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Displays the settings panel
|
4 |
+
*/
|
5 |
+
|
6 |
+
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
wp_nonce_field( 'wpcf7_redirect_page_metaboxes', 'wpcf7_redirect_page_metaboxes_nonce' );
|
9 |
+
|
10 |
+
do_action( 'before_redirect_settings_tab_title', $this->cf7_post );
|
11 |
+
?>
|
12 |
+
|
13 |
+
<fieldset>
|
14 |
+
<div class="fields-wrap field-wrap-page-id">
|
15 |
+
<div class="tab-wrap">
|
16 |
+
<div class="wpcf7r-tab-wrap-inner">
|
17 |
+
<div data-tab-inner>
|
18 |
+
<div class="qs-row">
|
19 |
+
<?php include( 'default-settings.php' ); ?>
|
20 |
+
</div>
|
21 |
+
</div>
|
22 |
+
</div>
|
23 |
+
</div>
|
24 |
+
</div>
|
25 |
+
</fieldset>
|
26 |
+
|
27 |
+
<?php
|
28 |
+
do_action( 'after_redirect_settings_tab_form', $this->cf7_post );
|
vendor/composer/installed.json
CHANGED
@@ -1,49 +1,49 @@
|
|
1 |
-
[
|
2 |
-
{
|
3 |
-
"name": "jhut89/mailchimp3php",
|
4 |
-
"version": "3.2.3",
|
5 |
-
"version_normalized": "3.2.3.0",
|
6 |
-
"source": {
|
7 |
-
"type": "git",
|
8 |
-
"url": "https://github.com/Jhut89/Mailchimp-API-3.0-PHP.git",
|
9 |
-
"reference": "dc05359b68e1f12864f5119f6fbc0b1421dcc2d1"
|
10 |
-
},
|
11 |
-
"dist": {
|
12 |
-
"type": "zip",
|
13 |
-
"url": "https://api.github.com/repos/Jhut89/Mailchimp-API-3.0-PHP/zipball/dc05359b68e1f12864f5119f6fbc0b1421dcc2d1",
|
14 |
-
"reference": "dc05359b68e1f12864f5119f6fbc0b1421dcc2d1",
|
15 |
-
"shasum": ""
|
16 |
-
},
|
17 |
-
"require": {
|
18 |
-
"ext-curl": "*",
|
19 |
-
"ext-json": "*",
|
20 |
-
"php": ">=5.5.0"
|
21 |
-
},
|
22 |
-
"require-dev": {
|
23 |
-
"php": ">=7.2.0",
|
24 |
-
"phpunit/phpunit": "^5",
|
25 |
-
"squizlabs/php_codesniffer": "3.*"
|
26 |
-
},
|
27 |
-
"time": "2020-08-24T15:17:54+00:00",
|
28 |
-
"type": "library",
|
29 |
-
"installation-source": "dist",
|
30 |
-
"autoload": {
|
31 |
-
"psr-4": {
|
32 |
-
"MailchimpAPI\\": "src/",
|
33 |
-
"MailchimpTests\\": "tests/"
|
34 |
-
}
|
35 |
-
},
|
36 |
-
"notification-url": "https://packagist.org/downloads/",
|
37 |
-
"license": [
|
38 |
-
"MIT"
|
39 |
-
],
|
40 |
-
"authors": [
|
41 |
-
{
|
42 |
-
"name": "John Hutcheson",
|
43 |
-
"email": "hutch@theresearchgrp.com"
|
44 |
-
}
|
45 |
-
],
|
46 |
-
"description": "A php library for version 3.0 of MailChimp's API",
|
47 |
-
"homepage": "https://github.com/Jhut89/Mailchimp-API-3.0-PHP"
|
48 |
-
}
|
49 |
-
]
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "jhut89/mailchimp3php",
|
4 |
+
"version": "3.2.3",
|
5 |
+
"version_normalized": "3.2.3.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/Jhut89/Mailchimp-API-3.0-PHP.git",
|
9 |
+
"reference": "dc05359b68e1f12864f5119f6fbc0b1421dcc2d1"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/Jhut89/Mailchimp-API-3.0-PHP/zipball/dc05359b68e1f12864f5119f6fbc0b1421dcc2d1",
|
14 |
+
"reference": "dc05359b68e1f12864f5119f6fbc0b1421dcc2d1",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"require": {
|
18 |
+
"ext-curl": "*",
|
19 |
+
"ext-json": "*",
|
20 |
+
"php": ">=5.5.0"
|
21 |
+
},
|
22 |
+
"require-dev": {
|
23 |
+
"php": ">=7.2.0",
|
24 |
+
"phpunit/phpunit": "^5",
|
25 |
+
"squizlabs/php_codesniffer": "3.*"
|
26 |
+
},
|
27 |
+
"time": "2020-08-24T15:17:54+00:00",
|
28 |
+
"type": "library",
|
29 |
+
"installation-source": "dist",
|
30 |
+
"autoload": {
|
31 |
+
"psr-4": {
|
32 |
+
"MailchimpAPI\\": "src/",
|
33 |
+
"MailchimpTests\\": "tests/"
|
34 |
+
}
|
35 |
+
},
|
36 |
+
"notification-url": "https://packagist.org/downloads/",
|
37 |
+
"license": [
|
38 |
+
"MIT"
|
39 |
+
],
|
40 |
+
"authors": [
|
41 |
+
{
|
42 |
+
"name": "John Hutcheson",
|
43 |
+
"email": "hutch@theresearchgrp.com"
|
44 |
+
}
|
45 |
+
],
|
46 |
+
"description": "A php library for version 3.0 of MailChimp's API",
|
47 |
+
"homepage": "https://github.com/Jhut89/Mailchimp-API-3.0-PHP"
|
48 |
+
}
|
49 |
+
]
|
vendor/index.php
ADDED
File without changes
|
vendor/jhut89/mailchimp3php/CODE_OF_CONDUCT.md
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
-
# Contributor Covenant Code of Conduct
|
2 |
-
|
3 |
-
## Our Pledge
|
4 |
-
|
5 |
-
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6 |
-
|
7 |
-
## Our Standards
|
8 |
-
|
9 |
-
Examples of behavior that contributes to creating a positive environment include:
|
10 |
-
|
11 |
-
* Using welcoming and inclusive language
|
12 |
-
* Being respectful of differing viewpoints and experiences
|
13 |
-
* Gracefully accepting constructive criticism
|
14 |
-
* Focusing on what is best for the community
|
15 |
-
* Showing empathy towards other community members
|
16 |
-
|
17 |
-
Examples of unacceptable behavior by participants include:
|
18 |
-
|
19 |
-
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
20 |
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
21 |
-
* Public or private harassment
|
22 |
-
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
23 |
-
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
24 |
-
|
25 |
-
## Our Responsibilities
|
26 |
-
|
27 |
-
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
28 |
-
|
29 |
-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
30 |
-
|
31 |
-
## Scope
|
32 |
-
|
33 |
-
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
34 |
-
|
35 |
-
## Enforcement
|
36 |
-
|
37 |
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at j.d.hutcheson4@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
38 |
-
|
39 |
-
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
40 |
-
|
41 |
-
## Attribution
|
42 |
-
|
43 |
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
44 |
-
|
45 |
-
[homepage]: http://contributor-covenant.org
|
46 |
-
[version]: http://contributor-covenant.org/version/1/4/
|
1 |
+
# Contributor Covenant Code of Conduct
|
2 |
+
|
3 |
+
## Our Pledge
|
4 |
+
|
5 |
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6 |
+
|
7 |
+
## Our Standards
|
8 |
+
|
9 |
+
Examples of behavior that contributes to creating a positive environment include:
|
10 |
+
|
11 |
+
* Using welcoming and inclusive language
|
12 |
+
* Being respectful of differing viewpoints and experiences
|
13 |
+
* Gracefully accepting constructive criticism
|
14 |
+
* Focusing on what is best for the community
|
15 |
+
* Showing empathy towards other community members
|
16 |
+
|
17 |
+
Examples of unacceptable behavior by participants include:
|
18 |
+
|
19 |
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
20 |
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
21 |
+
* Public or private harassment
|
22 |
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
23 |
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
24 |
+
|
25 |
+
## Our Responsibilities
|
26 |
+
|
27 |
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
28 |
+
|
29 |
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
30 |
+
|
31 |
+
## Scope
|
32 |
+
|
33 |
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
34 |
+
|
35 |
+
## Enforcement
|
36 |
+
|
37 |
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at j.d.hutcheson4@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
38 |
+
|
39 |
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
40 |
+
|
41 |
+
## Attribution
|
42 |
+
|
43 |
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
44 |
+
|
45 |
+
[homepage]: http://contributor-covenant.org
|
46 |
+
[version]: http://contributor-covenant.org/version/1/4/
|
vendor/jhut89/mailchimp3php/PULL_REQUEST_TEMPLATE.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
#### __**Description of change:**__
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
#### __**Description of implementation:**__
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
#### __**Risks & Mitigation:**__
|
12 |
-
|
1 |
+
#### __**Description of change:**__
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
#### __**Description of implementation:**__
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
#### __**Risks & Mitigation:**__
|
12 |
+
|
vendor/jhut89/mailchimp3php/README.md
CHANGED
@@ -1,401 +1,401 @@
|
|
1 |
-
# Table Of Contents
|
2 |
-
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
3 |
-
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
4 |
-
|
5 |
-
- [MAILCHIMP API 3.0 PHP](#mailchimp-api-3.0-php)
|
6 |
-
- [Installation](#installation)
|
7 |
-
- [Instantiation](#instantiation)
|
8 |
-
- [Oauth](#oauth)
|
9 |
-
- [Constructing a Request](#constructing-a-request)
|
10 |
-
- [GET](#get)
|
11 |
-
- [POST](#post)
|
12 |
-
- [PATCH & PUT](#patch-put-heading)
|
13 |
-
- [DELETE](#delete)
|
14 |
-
- [Handling A Response](https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Handling-A-Response)
|
15 |
-
- [Callbacks](https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Callbacks)
|
16 |
-
- [Method Chart (\*excluding verbs)](#method-chart-heading)
|
17 |
-
- [Wiki](https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki) - See for more in depth documentation
|
18 |
-
|
19 |
-
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
20 |
-
|
21 |
-
# MAILCHIMP API 3.0 PHP
|
22 |
-
[![GitHub license](https://img.shields.io/github/license/Jhut89/Mailchimp-API-3.0-PHP.svg)](https://github.com/Jhut89/Mailchimp-API-3.0-PHP/blob/master/LICENSE)
|
23 |
-
[![Build Status](https://travis-ci.com/Jhut89/Mailchimp-API-3.0-PHP.svg?branch=master)](https://travis-ci.com/Jhut89/Mailchimp-API-3.0-PHP)
|
24 |
-
[![Latest Stable Version](https://poser.pugx.org/jhut89/mailchimp3php/v/stable?format=flat)](https://packagist.org/packages/jhut89/mailchimp3php)
|
25 |
-
[![Total Downloads](https://poser.pugx.org/jhut89/mailchimp3php/downloads?format=flat)](https://packagist.org/packages/jhut89/mailchimp3php)
|
26 |
-
[![Slack Workspace](https://img.shields.io/badge/slack%20workspace-join-blue.svg?style=flat)](https://join.slack.com/t/mailchimp-api-30-php/shared_invite/enQtMzkwNTg3Mzc5NzI5LTdhOWE2ZGE1NzJmZGRjNDg2Mzg1MDYwZmVhNGM0MGJmMDY3NGVkOWQyZTI1Zjg1YTA2YjdkMDMxNjIyZjg5MGM)
|
27 |
-
[![Trello Board](https://img.shields.io/badge/trello-view%20board-blue.svg?style=flat)](https://trello.com/b/N5DRSTgL/mailchimp-api-30-sdk)
|
28 |
-
|
29 |
-
|
30 |
-
This is a PHP library for interacting with [version 3.0 of MailChimp's API](https://developer.mailchimp.com)
|
31 |
-
|
32 |
-
This library assumes a basic understanding of the MailChimp application and its associated functions.
|
33 |
-
|
34 |
-
## Installation
|
35 |
-
|
36 |
-
For Composer run:
|
37 |
-
|
38 |
-
```php
|
39 |
-
composer require jhut89/mailchimp3php
|
40 |
-
```
|
41 |
-
|
42 |
-
Alternatively you may add a require line to your projects `composer.json` for the package `jhut89/mailchimp3php`.
|
43 |
-
|
44 |
-
Then run `composer update` and add the composer autoloader to your project with:
|
45 |
-
|
46 |
-
```php
|
47 |
-
require "vendor/autoload.php";
|
48 |
-
```
|
49 |
-
|
50 |
-
You can then use a use statement to pull in the Mailchimp class:
|
51 |
-
```php
|
52 |
-
use MailchimpAPI\Mailchimp;
|
53 |
-
```
|
54 |
-
## Instantiation
|
55 |
-
|
56 |
-
```php
|
57 |
-
$mailchimp = new Mailchimp('123abc123abc123abc123abc-us0');
|
58 |
-
```
|
59 |
-
|
60 |
-
To instantiate you will need a new instance of the `Mailchimp` class with your MailChimp account's API key as its only argument.
|
61 |
-
|
62 |
-
## Oauth
|
63 |
-
|
64 |
-
If you are using [Oauth](http://developer.mailchimp.com/documentation/mailchimp/guides/how-to-use-oauth2/) to obtain an access token, this library can handle the "handshake" for you.
|
65 |
-
|
66 |
-
You must first send the user to your applications `authorize_uri`. You can get this url by calling the `Mailchimp::getAuthUrl()` statically:
|
67 |
-
|
68 |
-
```php
|
69 |
-
$client_id = '12345676543';
|
70 |
-
$redirect_url = 'https://www.some-domain.com/callback_file.php';
|
71 |
-
|
72 |
-
Mailchimp::getAuthUrl($client_id, $redirect_url);
|
73 |
-
```
|
74 |
-
|
75 |
-
From there the user will input their username and password to approve your application and will be redirected to the `redirect_uri` you set along with a `code`.
|
76 |
-
|
77 |
-
With that `code` you can now request an access token from mailchimp. For this you will need to call the `Mailchimp::oauthExchange()` method statically like this:
|
78 |
-
|
79 |
-
```php
|
80 |
-
$code = 'abc123abc123abc123abc123';
|
81 |
-
$client_id = '12345676543';
|
82 |
-
$client_secret = '789xyz789xyz789xyz789xyz';
|
83 |
-
$redirect_url = 'https://www.some-domain.com/callback_file.php';
|
84 |
-
|
85 |
-
Mailchimp::oauthExchange($code, $client_id, $client_secret, $redirect_url);
|
86 |
-
```
|
87 |
-
|
88 |
-
If the handshake is successful, then this method will return a string containing your API key like this: `123abc123abc123abc123abc123abc-us0`. This API key can now be used to instantiate your `Mailchimp` class as we have above.
|
89 |
-
|
90 |
-
|
91 |
-
## Constructing a Request
|
92 |
-
|
93 |
-
Once you have instantiated the `Mailchimp` class you can start constructing requests. Constructing requests is done by 'chaining' methods to the `$mailchimp` instance. In most cases this 'chain' will end with the HTTP verb for your request.
|
94 |
-
|
95 |
-
### GET
|
96 |
-
|
97 |
-
An Example of how to retrieve a list collection:
|
98 |
-
```php
|
99 |
-
$mailchimp
|
100 |
-
->lists()
|
101 |
-
->get();
|
102 |
-
```
|
103 |
-
|
104 |
-
Retrieving an instance can be accomplished by giving a unique identifier for the instance you want as an argument to the appropriate method. For example if I wanted to retrieve a list instance from the above example I would simply pass a `list_id`, as the only argument for the `lists()` method. Like this:
|
105 |
-
|
106 |
-
```php
|
107 |
-
$mailchimp
|
108 |
-
->lists('1a2b3c4d')
|
109 |
-
->get();
|
110 |
-
```
|
111 |
-
|
112 |
-
Methods available for each position in the chain depend on what the prior method returns. For example if I wanted to retrieve subscribers from a list in my account I would:
|
113 |
-
|
114 |
-
```php
|
115 |
-
$mailchimp
|
116 |
-
->lists('1a2b3c4d')
|
117 |
-
->members()
|
118 |
-
->get();
|
119 |
-
```
|
120 |
-
|
121 |
-
Notice that I provided a `list_id` to the `lists()` method, as there would be no way to retrieve a list of subscribers from a lists collection. The above request however will only return 10 subscriber instances from the members collection. This is because MailChimp's API uses pagination (documented [HERE](http://developer.mailchimp.com/documentation/mailchimp/guides/get-started-with-mailchimp-api-3/#parameters)) that defaults to `count=10` and `offset=0`. This library allows you to alter query string parameters by passing them as an argument to the `GET()` method. We do this by providing an array of key-value pairs where the keys are the query parameter you wish to provide/alter and its value is the parameter's value. As an example if I wanted to retrieve the second 100 subscribers from my list I could:
|
122 |
-
|
123 |
-
```php
|
124 |
-
$mailchimp
|
125 |
-
->lists('1a2b3c4d')
|
126 |
-
->members()
|
127 |
-
->get([
|
128 |
-
"count" => "100",
|
129 |
-
"offset" => "100"
|
130 |
-
]);
|
131 |
-
```
|
132 |
-
|
133 |
-
This would be equivalent to making a get request against:
|
134 |
-
|
135 |
-
```
|
136 |
-
Https://us0.api.mailchimp.com/3.0/lists/1a2b3c4d/members?count=100&offset=100
|
137 |
-
```
|
138 |
-
|
139 |
-
Going a little further we can retrieve a single list member by giving the `members_hash` (md5 hash of lower-case address) to the `members()` method. Like this:
|
140 |
-
|
141 |
-
```php
|
142 |
-
$mailchimp
|
143 |
-
->lists('1a2b3c4d')
|
144 |
-
->members('8bdbf060209f35b52087992a3cbdf4d7')
|
145 |
-
->get();
|
146 |
-
```
|
147 |
-
|
148 |
-
Alternatively, in place of providing an md5 hash as the identifier to the `members()` function you can provide a contact's email address as a string and this library will do the hashing for you. Like this:
|
149 |
-
|
150 |
-
```php
|
151 |
-
$mailchimp
|
152 |
-
->lists('1a2b3c4d')
|
153 |
-
->members('example@domain.com')
|
154 |
-
->get();
|
155 |
-
```
|
156 |
-
|
157 |
-
> You can read about `GET` requests in depth here: https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Get-Requests
|
158 |
-
### POST
|
159 |
-
|
160 |
-
While being able to retrieve data from your account is great we also need to be able to post new data. This can be done by calling the `POST()` method at the end of a chain. As an example subscribing an address to a list would look like this:
|
161 |
-
|
162 |
-
```php
|
163 |
-
$post_params = [
|
164 |
-
'email_address'=>'example@domain.com',
|
165 |
-
'status'=>'subscribed'
|
166 |
-
];
|
167 |
-
|
168 |
-
$mailchimp
|
169 |
-
->lists('1a2b3c4d')
|
170 |
-
->members()
|
171 |
-
->post($post_params);
|
172 |
-
```
|
173 |
-
|
174 |
-
In this case I would not provide `members()` with an identifier as I want to post to its collection. Also notice that the post data is an array of key-value pairs representing what parameters I want to pass to the MailChimp API. Be sure that you provide all required fields for the endpoint you are posting to. Check [MailChimp's documentation](http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#create-post_lists_list_id_members) for what parameters are required. Non-required parameters can just be added to the post data, and MailChimp will ignore any that are unusable. To illustrate here is an example of adding a subscriber to a list with some non-required parameters:
|
175 |
-
|
176 |
-
```php
|
177 |
-
$merge_values = [
|
178 |
-
"FNAME" => "John",
|
179 |
-
"LNAME" => "Doe"
|
180 |
-
];
|
181 |
-
|
182 |
-
$post_params = [
|
183 |
-
"email_address" => "example@domain.com",
|
184 |
-
"status" => "subscribed",
|
185 |
-
"email_type" => "html",
|
186 |
-
"merge_fields" => $merge_values
|
187 |
-
]
|
188 |
-
|
189 |
-
$mailchimp
|
190 |
-
->lists('1a2b3c4d')
|
191 |
-
->members()
|
192 |
-
->post($post_params);
|
193 |
-
```
|
194 |
-
> You can read about `POST` requests in depth here: https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Post-Requests
|
195 |
-
|
196 |
-
### <a name="patch-put-heading"></a> PATCH & PUT
|
197 |
-
|
198 |
-
This library handles PUT and PATCH request similar to that of POST requests. Meaning that `PUT()` & `PATCH()` both accept an array of key-value pairs that represent the data you wish altered/provided to MailChimp. As an example if I was patching the subscriber that we subscribed above, to have a new first name, that would look like this.
|
199 |
-
|
200 |
-
```php
|
201 |
-
$mailchimp
|
202 |
-
->lists('1a2b3c4d')
|
203 |
-
->members('a1167f5be2df7113beb69c95ebcdb2fd')
|
204 |
-
->patch([
|
205 |
-
"merge_fields" => ["FNAME" => "Jane"]
|
206 |
-
]);
|
207 |
-
```
|
208 |
-
> You can read about `PATCH` & `PUT` requests in depth here: https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Patch-&-Put-Requests
|
209 |
-
|
210 |
-
### DELETE
|
211 |
-
|
212 |
-
Deleting a record from MailChimp is performed with the `DELETE()` method and is constructed similar to GET requests. If I wanted to delete the above subscriber I would:
|
213 |
-
|
214 |
-
```php
|
215 |
-
$mailchimp
|
216 |
-
->lists('1a2b3c4d')
|
217 |
-
->members('a1167f5be2df7113beb69c95ebcdb2fd')
|
218 |
-
->delete();
|
219 |
-
```
|
220 |
-
> You can read about `DELETE` requests in depth here: https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Delete-Requests
|
221 |
-
## Handling A Response
|
222 |
-
|
223 |
-
Methods named for http verbs such as `get()` ,`post()`, `patch()`, `put()`, or `delete()` kick off an over the wire request to MailChimp's A.P.I. Given a successful request these methods return an instance of a `MailchimpResponse`.
|
224 |
-
I suggest you become familiar with this class as there are a number of modifiers and getters for different pieces of a response.
|
225 |
-
|
226 |
-
There are a number of getters we can use to interact with pieces our `MailchimpResponse` instance. Some of the more commonly used ones are:
|
227 |
-
|
228 |
-
```php
|
229 |
-
$response->deserialize(); // returns a deserialized (to php object) resource returned by API
|
230 |
-
$response->getHttpCode(); // returns an integer representation of the HTTP response code
|
231 |
-
$response->getHeaders(); // returns response headers as an array of key => value pairs
|
232 |
-
$response->getBody(); // return the raw text body of the response
|
233 |
-
```
|
234 |
-
|
235 |
-
As an example, if I posses an API key but want the contact email associated with its account:
|
236 |
-
|
237 |
-
```php
|
238 |
-
$mailchimp = new Mailchimp('123abc123abc123abc123abc-us0');
|
239 |
-
$account = $mailchimp
|
240 |
-
->account()
|
241 |
-
->get()
|
242 |
-
|
243 |
-
$contact_email = $account
|
244 |
-
->deserialize()
|
245 |
-
->email
|
246 |
-
|
247 |
-
print $contact_email; // outputs something like "example@domain.com"
|
248 |
-
```
|
249 |
-
|
250 |
-
> You can read about how to work with responses in depth here: https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Handling-A-Response
|
251 |
-
|
252 |
-
## <a name="method-chart-heading"></a>Method Chart (\*excluding verbs)
|
253 |
-
|
254 |
-
|
255 |
-
mailchimp()
|
256 |
-
|
|
257 |
-
|----account()
|
258 |
-
|
|
259 |
-
|----apps()
|
260 |
-
|
|
261 |
-
|----automations()
|
262 |
-
| |
|
263 |
-
| |----removedSubscribers()
|
264 |
-
| |----emails()
|
265 |
-
| |
|
266 |
-
| |---queue()*
|
267 |
-
| |---pauseAll()*
|
268 |
-
| |---startAll()*
|
269 |
-
|
|
270 |
-
|----batches()
|
271 |
-
|
|
272 |
-
|----batchWebhooks()
|
273 |
-
|
|
274 |
-
|----campaignFolders()
|
275 |
-
|
|
276 |
-
|----campaigns()
|
277 |
-
| |
|
278 |
-
| |----cancel()*
|
279 |
-
| |----pause()*
|
280 |
-
| |----replicate()*
|
281 |
-
| |----resume()*
|
282 |
-
| |----scedule()*
|
283 |
-
| |----send()*
|
284 |
-
| |----test()*
|
285 |
-
| |----unschedule()*
|
286 |
-
| |----checklist()
|
287 |
-
| |----feedback()
|
288 |
-
| |----content()
|
289 |
-
|
|
290 |
-
|----connectedSites()
|
291 |
-
| |
|
292 |
-
| |----verifyScriptInstallation()*
|
293 |
-
|
|
294 |
-
|----conversations()
|
295 |
-
| |
|
296 |
-
| |----messages()
|
297 |
-
|
|
298 |
-
|----ecommStores()
|
299 |
-
| |
|
300 |
-
| |----customers()
|
301 |
-
| |----products()
|
302 |
-
| | |
|
303 |
-
| | |----variants()
|
304 |
-
| | |----images()
|
305 |
-
| |
|
306 |
-
| |----promoRules()
|
307 |
-
| | |
|
308 |
-
| | |----promoCodes()
|
309 |
-
| |
|
310 |
-
| |----orders()
|
311 |
-
| | |
|
312 |
-
| | |----lines()
|
313 |
-
| |
|
314 |
-
| |----carts()
|
315 |
-
| |
|
316 |
-
| |----lines()
|
317 |
-
|
|
318 |
-
|----facebookAds()
|
319 |
-
|
|
320 |
-
|----fileManagerFiles()
|
321 |
-
|
|
322 |
-
|----fileManagerFolders()
|
323 |
-
|
|
324 |
-
|----googleAds()
|
325 |
-
|
|
326 |
-
|----landingPages()
|
327 |
-
| |
|
328 |
-
| |----publish()*
|
329 |
-
| |----unpublish()*
|
330 |
-
| |----content()
|
331 |
-
|
|
332 |
-
|----lists()
|
333 |
-
| |
|
334 |
-
| |----batchSubscribe()*
|
335 |
-
| |----webhooks()
|
336 |
-
| |----signupForms()
|
337 |
-
| |----mergeFields()
|
338 |
-
| |----growthHistory()
|
339 |
-
| |----clients()
|
340 |
-
| |----activity()
|
341 |
-
| |----abuseReports()
|
342 |
-
| |----segments()
|
343 |
-
| | |
|
344 |
-
| | |----batch()*
|
345 |
-
| | |----members()
|
346 |
-
| |
|
347 |
-
| |----members()
|
348 |
-
| | |
|
349 |
-
| | |---notes()
|
350 |
-
| | |---goals()
|
351 |
-
| | |---activity()
|
352 |
-
| | |---tags()
|
353 |
-
| |
|
354 |
-
| |----interestCategories()
|
355 |
-
| |
|
356 |
-
| |----interests()
|
357 |
-
|
|
358 |
-
|----ping()
|
359 |
-
|
|
360 |
-
|----reports()
|
361 |
-
| |
|
362 |
-
| |----unsubscribes()
|
363 |
-
| |----subReports()
|
364 |
-
| |----sentTo()
|
365 |
-
| |----locations()
|
366 |
-
| |----emailActivity()
|
367 |
-
| |----googleAnalytics()
|
368 |
-
| |----openDetails()
|
369 |
-
| |----eepurl()
|
370 |
-
| |----domainPerformance()
|
371 |
-
| |----advice()
|
372 |
-
| |----abuse()
|
373 |
-
| |----clickReports()
|
374 |
-
| |
|
375 |
-
| |----members()
|
376 |
-
|
|
377 |
-
|----searchCampaigns()
|
378 |
-
|
|
379 |
-
|----searchMembers()
|
380 |
-
|
|
381 |
-
|----templateFolders()
|
382 |
-
|
|
383 |
-
|----templates()
|
384 |
-
| |
|
385 |
-
| |----defaultContent()
|
386 |
-
|
|
387 |
-
|----verifiedDomains()
|
388 |
-
|
|
389 |
-
|----verify()
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
\*Please see [MailChimp's API Documentation](http://developer.mailchimp.com/documentation/mailchimp/reference/overview/) for what verbs are appropriate where.
|
394 |
-
|
395 |
-
\** Methods marked with a `*` make a network request
|
396 |
-
|
397 |
-
\*\*Please watch for updates, and feel free to Fork or Pull Request. Check out the Wiki for a little more info on contributing.
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
1 |
+
# Table Of Contents
|
2 |
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
3 |
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
4 |
+
|
5 |
+
- [MAILCHIMP API 3.0 PHP](#mailchimp-api-3.0-php)
|
6 |
+
- [Installation](#installation)
|
7 |
+
- [Instantiation](#instantiation)
|
8 |
+
- [Oauth](#oauth)
|
9 |
+
- [Constructing a Request](#constructing-a-request)
|
10 |
+
- [GET](#get)
|
11 |
+
- [POST](#post)
|
12 |
+
- [PATCH & PUT](#patch-put-heading)
|
13 |
+
- [DELETE](#delete)
|
14 |
+
- [Handling A Response](https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Handling-A-Response)
|
15 |
+
- [Callbacks](https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Callbacks)
|
16 |
+
- [Method Chart (\*excluding verbs)](#method-chart-heading)
|
17 |
+
- [Wiki](https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki) - See for more in depth documentation
|
18 |
+
|
19 |
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
20 |
+
|
21 |
+
# MAILCHIMP API 3.0 PHP
|
22 |
+
[![GitHub license](https://img.shields.io/github/license/Jhut89/Mailchimp-API-3.0-PHP.svg)](https://github.com/Jhut89/Mailchimp-API-3.0-PHP/blob/master/LICENSE)
|
23 |
+
[![Build Status](https://travis-ci.com/Jhut89/Mailchimp-API-3.0-PHP.svg?branch=master)](https://travis-ci.com/Jhut89/Mailchimp-API-3.0-PHP)
|
24 |
+
[![Latest Stable Version](https://poser.pugx.org/jhut89/mailchimp3php/v/stable?format=flat)](https://packagist.org/packages/jhut89/mailchimp3php)
|
25 |
+
[![Total Downloads](https://poser.pugx.org/jhut89/mailchimp3php/downloads?format=flat)](https://packagist.org/packages/jhut89/mailchimp3php)
|
26 |
+
[![Slack Workspace](https://img.shields.io/badge/slack%20workspace-join-blue.svg?style=flat)](https://join.slack.com/t/mailchimp-api-30-php/shared_invite/enQtMzkwNTg3Mzc5NzI5LTdhOWE2ZGE1NzJmZGRjNDg2Mzg1MDYwZmVhNGM0MGJmMDY3NGVkOWQyZTI1Zjg1YTA2YjdkMDMxNjIyZjg5MGM)
|
27 |
+
[![Trello Board](https://img.shields.io/badge/trello-view%20board-blue.svg?style=flat)](https://trello.com/b/N5DRSTgL/mailchimp-api-30-sdk)
|
28 |
+
|
29 |
+
|
30 |
+
This is a PHP library for interacting with [version 3.0 of MailChimp's API](https://developer.mailchimp.com)
|
31 |
+
|
32 |
+
This library assumes a basic understanding of the MailChimp application and its associated functions.
|
33 |
+
|
34 |
+
## Installation
|
35 |
+
|
36 |
+
For Composer run:
|
37 |
+
|
38 |
+
```php
|
39 |
+
composer require jhut89/mailchimp3php
|
40 |
+
```
|
41 |
+
|
42 |
+
Alternatively you may add a require line to your projects `composer.json` for the package `jhut89/mailchimp3php`.
|
43 |
+
|
44 |
+
Then run `composer update` and add the composer autoloader to your project with:
|
45 |
+
|
46 |
+
```php
|
47 |
+
require "vendor/autoload.php";
|
48 |
+
```
|
49 |
+
|
50 |
+
You can then use a use statement to pull in the Mailchimp class:
|
51 |
+
```php
|
52 |
+
use MailchimpAPI\Mailchimp;
|
53 |
+
```
|
54 |
+
## Instantiation
|
55 |
+
|
56 |
+
```php
|
57 |
+
$mailchimp = new Mailchimp('123abc123abc123abc123abc-us0');
|
58 |
+
```
|
59 |
+
|
60 |
+
To instantiate you will need a new instance of the `Mailchimp` class with your MailChimp account's API key as its only argument.
|
61 |
+
|
62 |
+
## Oauth
|
63 |
+
|
64 |
+
If you are using [Oauth](http://developer.mailchimp.com/documentation/mailchimp/guides/how-to-use-oauth2/) to obtain an access token, this library can handle the "handshake" for you.
|
65 |
+
|
66 |
+
You must first send the user to your applications `authorize_uri`. You can get this url by calling the `Mailchimp::getAuthUrl()` statically:
|
67 |
+
|
68 |
+
```php
|
69 |
+
$client_id = '12345676543';
|
70 |
+
$redirect_url = 'https://www.some-domain.com/callback_file.php';
|
71 |
+
|
72 |
+
Mailchimp::getAuthUrl($client_id, $redirect_url);
|
73 |
+
```
|
74 |
+
|
75 |
+
From there the user will input their username and password to approve your application and will be redirected to the `redirect_uri` you set along with a `code`.
|
76 |
+
|
77 |
+
With that `code` you can now request an access token from mailchimp. For this you will need to call the `Mailchimp::oauthExchange()` method statically like this:
|
78 |
+
|
79 |
+
```php
|
80 |
+
$code = 'abc123abc123abc123abc123';
|
81 |
+
$client_id = '12345676543';
|
82 |
+
$client_secret = '789xyz789xyz789xyz789xyz';
|
83 |
+
$redirect_url = 'https://www.some-domain.com/callback_file.php';
|
84 |
+
|
85 |
+
Mailchimp::oauthExchange($code, $client_id, $client_secret, $redirect_url);
|
86 |
+
```
|
87 |
+
|
88 |
+
If the handshake is successful, then this method will return a string containing your API key like this: `123abc123abc123abc123abc123abc-us0`. This API key can now be used to instantiate your `Mailchimp` class as we have above.
|
89 |
+
|
90 |
+
|
91 |
+
## Constructing a Request
|
92 |
+
|
93 |
+
Once you have instantiated the `Mailchimp` class you can start constructing requests. Constructing requests is done by 'chaining' methods to the `$mailchimp` instance. In most cases this 'chain' will end with the HTTP verb for your request.
|
94 |
+
|
95 |
+
### GET
|
96 |
+
|
97 |
+
An Example of how to retrieve a list collection:
|
98 |
+
```php
|
99 |
+
$mailchimp
|
100 |
+
->lists()
|
101 |
+
->get();
|
102 |
+
```
|
103 |
+
|
104 |
+
Retrieving an instance can be accomplished by giving a unique identifier for the instance you want as an argument to the appropriate method. For example if I wanted to retrieve a list instance from the above example I would simply pass a `list_id`, as the only argument for the `lists()` method. Like this:
|
105 |
+
|
106 |
+
```php
|
107 |
+
$mailchimp
|
108 |
+
->lists('1a2b3c4d')
|
109 |
+
->get();
|
110 |
+
```
|
111 |
+
|
112 |
+
Methods available for each position in the chain depend on what the prior method returns. For example if I wanted to retrieve subscribers from a list in my account I would:
|
113 |
+
|
114 |
+
```php
|
115 |
+
$mailchimp
|
116 |
+
->lists('1a2b3c4d')
|
117 |
+
->members()
|
118 |
+
->get();
|
119 |
+
```
|
120 |
+
|
121 |
+
Notice that I provided a `list_id` to the `lists()` method, as there would be no way to retrieve a list of subscribers from a lists collection. The above request however will only return 10 subscriber instances from the members collection. This is because MailChimp's API uses pagination (documented [HERE](http://developer.mailchimp.com/documentation/mailchimp/guides/get-started-with-mailchimp-api-3/#parameters)) that defaults to `count=10` and `offset=0`. This library allows you to alter query string parameters by passing them as an argument to the `GET()` method. We do this by providing an array of key-value pairs where the keys are the query parameter you wish to provide/alter and its value is the parameter's value. As an example if I wanted to retrieve the second 100 subscribers from my list I could:
|
122 |
+
|
123 |
+
```php
|
124 |
+
$mailchimp
|
125 |
+
->lists('1a2b3c4d')
|
126 |
+
->members()
|
127 |
+
->get([
|
128 |
+
"count" => "100",
|
129 |
+
"offset" => "100"
|
130 |
+
]);
|
131 |
+
```
|
132 |
+
|
133 |
+
This would be equivalent to making a get request against:
|
134 |
+
|
135 |
+
```
|
136 |
+
Https://us0.api.mailchimp.com/3.0/lists/1a2b3c4d/members?count=100&offset=100
|
137 |
+
```
|
138 |
+
|
139 |
+
Going a little further we can retrieve a single list member by giving the `members_hash` (md5 hash of lower-case address) to the `members()` method. Like this:
|
140 |
+
|
141 |
+
```php
|
142 |
+
$mailchimp
|
143 |
+
->lists('1a2b3c4d')
|
144 |
+
->members('8bdbf060209f35b52087992a3cbdf4d7')
|
145 |
+
->get();
|
146 |
+
```
|
147 |
+
|
148 |
+
Alternatively, in place of providing an md5 hash as the identifier to the `members()` function you can provide a contact's email address as a string and this library will do the hashing for you. Like this:
|
149 |
+
|
150 |
+
```php
|
151 |
+
$mailchimp
|
152 |
+
->lists('1a2b3c4d')
|
153 |
+
->members('example@domain.com')
|
154 |
+
->get();
|
155 |
+
```
|
156 |
+
|
157 |
+
> You can read about `GET` requests in depth here: https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Get-Requests
|
158 |
+
### POST
|
159 |
+
|
160 |
+
While being able to retrieve data from your account is great we also need to be able to post new data. This can be done by calling the `POST()` method at the end of a chain. As an example subscribing an address to a list would look like this:
|
161 |
+
|
162 |
+
```php
|
163 |
+
$post_params = [
|
164 |
+
'email_address'=>'example@domain.com',
|
165 |
+
'status'=>'subscribed'
|
166 |
+
];
|
167 |
+
|
168 |
+
$mailchimp
|
169 |
+
->lists('1a2b3c4d')
|
170 |
+
->members()
|
171 |
+
->post($post_params);
|
172 |
+
```
|
173 |
+
|
174 |
+
In this case I would not provide `members()` with an identifier as I want to post to its collection. Also notice that the post data is an array of key-value pairs representing what parameters I want to pass to the MailChimp API. Be sure that you provide all required fields for the endpoint you are posting to. Check [MailChimp's documentation](http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#create-post_lists_list_id_members) for what parameters are required. Non-required parameters can just be added to the post data, and MailChimp will ignore any that are unusable. To illustrate here is an example of adding a subscriber to a list with some non-required parameters:
|
175 |
+
|
176 |
+
```php
|
177 |
+
$merge_values = [
|
178 |
+
"FNAME" => "John",
|
179 |
+
"LNAME" => "Doe"
|
180 |
+
];
|
181 |
+
|
182 |
+
$post_params = [
|
183 |
+
"email_address" => "example@domain.com",
|
184 |
+
"status" => "subscribed",
|
185 |
+
"email_type" => "html",
|
186 |
+
"merge_fields" => $merge_values
|
187 |
+
]
|
188 |
+
|
189 |
+
$mailchimp
|
190 |
+
->lists('1a2b3c4d')
|
191 |
+
->members()
|
192 |
+
->post($post_params);
|
193 |
+
```
|
194 |
+
> You can read about `POST` requests in depth here: https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Post-Requests
|
195 |
+
|
196 |
+
### <a name="patch-put-heading"></a> PATCH & PUT
|
197 |
+
|
198 |
+
This library handles PUT and PATCH request similar to that of POST requests. Meaning that `PUT()` & `PATCH()` both accept an array of key-value pairs that represent the data you wish altered/provided to MailChimp. As an example if I was patching the subscriber that we subscribed above, to have a new first name, that would look like this.
|
199 |
+
|
200 |
+
```php
|
201 |
+
$mailchimp
|
202 |
+
->lists('1a2b3c4d')
|
203 |
+
->members('a1167f5be2df7113beb69c95ebcdb2fd')
|
204 |
+
->patch([
|
205 |
+
"merge_fields" => ["FNAME" => "Jane"]
|
206 |
+
]);
|
207 |
+
```
|
208 |
+
> You can read about `PATCH` & `PUT` requests in depth here: https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Patch-&-Put-Requests
|
209 |
+
|
210 |
+
### DELETE
|
211 |
+
|
212 |
+
Deleting a record from MailChimp is performed with the `DELETE()` method and is constructed similar to GET requests. If I wanted to delete the above subscriber I would:
|
213 |
+
|
214 |
+
```php
|
215 |
+
$mailchimp
|
216 |
+
->lists('1a2b3c4d')
|
217 |
+
->members('a1167f5be2df7113beb69c95ebcdb2fd')
|
218 |
+
->delete();
|
219 |
+
```
|
220 |
+
> You can read about `DELETE` requests in depth here: https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Delete-Requests
|
221 |
+
## Handling A Response
|
222 |
+
|
223 |
+
Methods named for http verbs such as `get()` ,`post()`, `patch()`, `put()`, or `delete()` kick off an over the wire request to MailChimp's A.P.I. Given a successful request these methods return an instance of a `MailchimpResponse`.
|
224 |
+
I suggest you become familiar with this class as there are a number of modifiers and getters for different pieces of a response.
|
225 |
+
|
226 |
+
There are a number of getters we can use to interact with pieces our `MailchimpResponse` instance. Some of the more commonly used ones are:
|
227 |
+
|
228 |
+
```php
|
229 |
+
$response->deserialize(); // returns a deserialized (to php object) resource returned by API
|
230 |
+
$response->getHttpCode(); // returns an integer representation of the HTTP response code
|
231 |
+
$response->getHeaders(); // returns response headers as an array of key => value pairs
|
232 |
+
$response->getBody(); // return the raw text body of the response
|
233 |
+
```
|
234 |
+
|
235 |
+
As an example, if I posses an API key but want the contact email associated with its account:
|
236 |
+
|
237 |
+
```php
|
238 |
+
$mailchimp = new Mailchimp('123abc123abc123abc123abc-us0');
|
239 |
+
$account = $mailchimp
|
240 |
+
->account()
|
241 |
+
->get()
|
242 |
+
|
243 |
+
$contact_email = $account
|
244 |
+
->deserialize()
|
245 |
+
->email
|
246 |
+
|
247 |
+
print $contact_email; // outputs something like "example@domain.com"
|
248 |
+
```
|
249 |
+
|
250 |
+
> You can read about how to work with responses in depth here: https://github.com/Jhut89/Mailchimp-API-3.0-PHP/wiki/Handling-A-Response
|
251 |
+
|
252 |
+
## <a name="method-chart-heading"></a>Method Chart (\*excluding verbs)
|
253 |
+
|
254 |
+
|
255 |
+
mailchimp()
|
256 |
+
|
|
257 |
+
|----account()
|
258 |
+
|
|
259 |
+
|----apps()
|
260 |
+
|
|
261 |
+
|----automations()
|
262 |
+
| |
|
263 |
+
| |----removedSubscribers()
|
264 |
+
| |----emails()
|
265 |
+
| |
|
266 |
+
| |---queue()*
|
267 |
+
| |---pauseAll()*
|
268 |
+
| |---startAll()*
|
269 |
+
|
|
270 |
+
|----batches()
|
271 |
+
|
|
272 |
+
|----batchWebhooks()
|
273 |
+
|
|
274 |
+
|----campaignFolders()
|
275 |
+
|
|
276 |
+
|----campaigns()
|
277 |
+
| |
|
278 |
+
| |----cancel()*
|
279 |
+
| |----pause()*
|
280 |
+
| |----replicate()*
|
281 |
+
| |----resume()*
|
282 |
+
| |----scedule()*
|
283 |
+
| |----send()*
|
284 |
+
| |----test()*
|
285 |
+
| |----unschedule()*
|
286 |
+
| |----checklist()
|
287 |
+
| |----feedback()
|
288 |
+
| |----content()
|
289 |
+
|
|
290 |
+
|----connectedSites()
|
291 |
+
| |
|
292 |
+
| |----verifyScriptInstallation()*
|
293 |
+
|
|
294 |
+
|----conversations()
|
295 |
+
| |
|
296 |
+
| |----messages()
|
297 |
+
|
|
298 |
+
|----ecommStores()
|
299 |
+
| |
|
300 |
+
| |----customers()
|
301 |
+
| |----products()
|
302 |
+
| | |
|
303 |
+
| | |----variants()
|
304 |
+
| | |----images()
|
305 |
+
| |
|
306 |
+
| |----promoRules()
|
307 |
+
| | |
|
308 |
+
| | |----promoCodes()
|
309 |
+
| |
|
310 |
+
| |----orders()
|
311 |
+
| | |
|
312 |
+
| | |----lines()
|
313 |
+
| |
|
314 |
+
| |----carts()
|
315 |
+
| |
|
316 |
+
| |----lines()
|
317 |
+
|
|
318 |
+
|----facebookAds()
|
319 |
+
|
|
320 |
+
|----fileManagerFiles()
|
321 |
+
|
|
322 |
+
|----fileManagerFolders()
|
323 |
+
|
|
324 |
+
|----googleAds()
|
325 |
+
|
|
326 |
+
|----landingPages()
|
327 |
+
| |
|
328 |
+
| |----publish()*
|
329 |
+
| |----unpublish()*
|
330 |
+
| |----content()
|
331 |
+
|
|
332 |
+
|----lists()
|
333 |
+
| |
|
334 |
+
| |----batchSubscribe()*
|
335 |
+
| |----webhooks()
|
336 |
+
| |----signupForms()
|
337 |
+
| |----mergeFields()
|
338 |
+
| |----growthHistory()
|
339 |
+
| |----clients()
|
340 |
+
| |----activity()
|
341 |
+
| |----abuseReports()
|
342 |
+
| |----segments()
|
343 |
+
| | |
|
344 |
+
| | |----batch()*
|
345 |
+
| | |----members()
|
346 |
+
| |
|
347 |
+
| |----members()
|
348 |
+
| | |
|
349 |
+
| | |---notes()
|
350 |
+
| | |---goals()
|
351 |
+
| | |---activity()
|
352 |
+
| | |---tags()
|
353 |
+
| |
|
354 |
+
| |----interestCategories()
|
355 |
+
| |
|
356 |
+
| |----interests()
|
357 |
+
|
|
358 |
+
|----ping()
|
359 |
+
|
|
360 |
+
|----reports()
|
361 |
+
| |
|
362 |
+
| |----unsubscribes()
|
363 |
+
| |----subReports()
|
364 |
+
| |----sentTo()
|
365 |
+
| |----locations()
|
366 |
+
| |----emailActivity()
|
367 |
+
| |----googleAnalytics()
|
368 |
+
| |----openDetails()
|
369 |
+
| |----eepurl()
|
370 |
+
| |----domainPerformance()
|
371 |
+
| |----advice()
|
372 |
+
| |----abuse()
|
373 |
+
| |----clickReports()
|
374 |
+
| |
|
375 |
+
| |----members()
|
376 |
+
|
|
377 |
+
|----searchCampaigns()
|
378 |
+
|
|
379 |
+
|----searchMembers()
|
380 |
+
|
|
381 |
+
|----templateFolders()
|
382 |
+
|
|
383 |
+
|----templates()
|
384 |
+
| |
|
385 |
+
| |----defaultContent()
|
386 |
+
|
|
387 |
+
|----verifiedDomains()
|
388 |
+
|
|
389 |
+
|----verify()
|
390 |
+
|
391 |
+
|
392 |
+
|
393 |
+
\*Please see [MailChimp's API Documentation](http://developer.mailchimp.com/documentation/mailchimp/reference/overview/) for what verbs are appropriate where.
|
394 |
+
|
395 |
+
\** Methods marked with a `*` make a network request
|
396 |
+
|
397 |
+
\*\*Please watch for updates, and feel free to Fork or Pull Request. Check out the Wiki for a little more info on contributing.
|
398 |
+
|
399 |
+
|
400 |
+
|
401 |
+
|
vendor/jhut89/mailchimp3php/composer.json
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
-
{
|
2 |
-
"name": "jhut89/mailchimp3php",
|
3 |
-
"description": "A php library for version 3.0 of MailChimp's API",
|
4 |
-
"license": "MIT",
|
5 |
-
"authors": [
|
6 |
-
{
|
7 |
-
"name": "John Hutcheson",
|
8 |
-
"email": "hutch@theresearchgrp.com"
|
9 |
-
}
|
10 |
-
],
|
11 |
-
"autoload":{
|
12 |
-
"psr-4": {
|
13 |
-
"MailchimpAPI\\" : "src/",
|
14 |
-
"MailchimpTests\\" : "tests/"
|
15 |
-
}
|
16 |
-
},
|
17 |
-
"require": {
|
18 |
-
"php": ">=5.5.0",
|
19 |
-
"ext-curl": "*",
|
20 |
-
"ext-json": "*"
|
21 |
-
},
|
22 |
-
"homepage": "https://github.com/Jhut89/Mailchimp-API-3.0-PHP",
|
23 |
-
"require-dev": {
|
24 |
-
"php": ">=7.2.0",
|
25 |
-
"phpunit/phpunit": "^5",
|
26 |
-
"squizlabs/php_codesniffer": "3.*"
|
27 |
-
}
|
28 |
-
}
|
1 |
+
{
|
2 |
+
"name": "jhut89/mailchimp3php",
|
3 |
+
"description": "A php library for version 3.0 of MailChimp's API",
|
4 |
+
"license": "MIT",
|
5 |
+
"authors": [
|
6 |
+
{
|
7 |
+
"name": "John Hutcheson",
|
8 |
+
"email": "hutch@theresearchgrp.com"
|
9 |
+
}
|
10 |
+
],
|
11 |
+
"autoload":{
|
12 |
+
"psr-4": {
|
13 |
+
"MailchimpAPI\\" : "src/",
|
14 |
+
"MailchimpTests\\" : "tests/"
|
15 |
+
}
|
16 |
+
},
|
17 |
+
"require": {
|
18 |
+
"php": ">=5.5.0",
|
19 |
+
"ext-curl": "*",
|
20 |
+
"ext-json": "*"
|
21 |
+
},
|
22 |
+
"homepage": "https://github.com/Jhut89/Mailchimp-API-3.0-PHP",
|
23 |
+
"require-dev": {
|
24 |
+
"php": ">=7.2.0",
|
25 |
+
"phpunit/phpunit": "^5",
|
26 |
+
"squizlabs/php_codesniffer": "3.*"
|
27 |
+
}
|
28 |
+
}
|
vendor/jhut89/mailchimp3php/composer.lock
CHANGED
@@ -1,1460 +1,1460 @@
|
|
1 |
-
{
|
2 |
-
"_readme": [
|
3 |
-
"This file locks the dependencies of your project to a known state",
|
4 |
-
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
5 |
-
"This file is @generated automatically"
|
6 |
-
],
|
7 |
-
"content-hash": "db604eedfdb2b905992cd201cf0a5b34",
|
8 |
-
"packages": [],
|
9 |
-
"packages-dev": [
|
10 |
-
{
|
11 |
-
"name": "doctrine/instantiator",
|
12 |
-
"version": "1.3.0",
|
13 |
-
"source": {
|
14 |
-
"type": "git",
|
15 |
-
"url": "https://github.com/doctrine/instantiator.git",
|
16 |
-
"reference": "ae466f726242e637cebdd526a7d991b9433bacf1"
|
17 |
-
},
|
18 |
-
"dist": {
|
19 |
-
"type": "zip",
|
20 |
-
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1",
|
21 |
-
"reference": "ae466f726242e637cebdd526a7d991b9433bacf1",
|
22 |
-
"shasum": ""
|
23 |
-
},
|
24 |
-
"require": {
|
25 |
-
"php": "^7.1"
|
26 |
-
},
|
27 |
-
"require-dev": {
|
28 |
-
"doctrine/coding-standard": "^6.0",
|
29 |
-
"ext-pdo": "*",
|
30 |
-
"ext-phar": "*",
|
31 |
-
"phpbench/phpbench": "^0.13",
|
32 |
-
"phpstan/phpstan-phpunit": "^0.11",
|
33 |
-
"phpstan/phpstan-shim": "^0.11",
|
34 |
-
"phpunit/phpunit": "^7.0"
|
35 |
-
},
|
36 |
-
"type": "library",
|
37 |
-
"extra": {
|
38 |
-
"branch-alias": {
|
39 |
-
"dev-master": "1.2.x-dev"
|
40 |
-
}
|
41 |
-
},
|
42 |
-
"autoload": {
|
43 |
-
"psr-4": {
|
44 |
-
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
|
45 |
-
}
|
46 |
-
},
|
47 |
-
"notification-url": "https://packagist.org/downloads/",
|
48 |
-
"license": [
|
49 |
-
"MIT"
|
50 |
-
],
|
51 |
-
"authors": [
|
52 |
-
{
|
53 |
-
"name": "Marco Pivetta",
|
54 |
-
"email": "ocramius@gmail.com",
|
55 |
-
"homepage": "http://ocramius.github.com/"
|
56 |
-
}
|
57 |
-
],
|
58 |
-
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
59 |
-
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
|
60 |
-
"keywords": [
|
61 |
-
"constructor",
|
62 |
-
"instantiate"
|
63 |
-
],
|
64 |
-
"time": "2019-10-21T16:45:58+00:00"
|
65 |
-
},
|
66 |
-
{
|
67 |
-
"name": "myclabs/deep-copy",
|
68 |
-
"version": "1.9.5",
|
69 |
-
"source": {
|
70 |
-
"type": "git",
|
71 |
-
"url": "https://github.com/myclabs/DeepCopy.git",
|
72 |
-
"reference": "b2c28789e80a97badd14145fda39b545d83ca3ef"
|
73 |
-
},
|
74 |
-
"dist": {
|
75 |
-
"type": "zip",
|
76 |
-
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef",
|
77 |
-
"reference": "b2c28789e80a97badd14145fda39b545d83ca3ef",
|
78 |
-
"shasum": ""
|
79 |
-
},
|
80 |
-
"require": {
|
81 |
-
"php": "^7.1"
|
82 |
-
},
|
83 |
-
"replace": {
|
84 |
-
"myclabs/deep-copy": "self.version"
|
85 |
-
},
|
86 |
-
"require-dev": {
|
87 |
-
"doctrine/collections": "^1.0",
|
88 |
-
"doctrine/common": "^2.6",
|
89 |
-
"phpunit/phpunit": "^7.1"
|
90 |
-
},
|
91 |
-
"type": "library",
|
92 |
-
"autoload": {
|
93 |
-
"psr-4": {
|
94 |
-
"DeepCopy\\": "src/DeepCopy/"
|
95 |
-
},
|
96 |
-
"files": [
|
97 |
-
"src/DeepCopy/deep_copy.php"
|
98 |
-
]
|
99 |
-
},
|
100 |
-
"notification-url": "https://packagist.org/downloads/",
|
101 |
-
"license": [
|
102 |
-
"MIT"
|
103 |
-
],
|
104 |
-
"description": "Create deep copies (clones) of your objects",
|
105 |
-
"keywords": [
|
106 |
-
"clone",
|
107 |
-
"copy",
|
108 |
-
"duplicate",
|
109 |
-
"object",
|
110 |
-
"object graph"
|
111 |
-
],
|
112 |
-
"time": "2020-01-17T21:11:47+00:00"
|
113 |
-
},
|
114 |
-
{
|
115 |
-
"name": "phpdocumentor/reflection-common",
|
116 |
-
"version": "2.0.0",
|
117 |
-
"source": {
|
118 |
-
"type": "git",
|
119 |
-
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
|
120 |
-
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a"
|
121 |
-
},
|
122 |
-
"dist": {
|
123 |
-
"type": "zip",
|
124 |
-
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a",
|
125 |
-
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a",
|
126 |
-
"shasum": ""
|
127 |
-
},
|
128 |
-
"require": {
|
129 |
-
"php": ">=7.1"
|
130 |
-
},
|
131 |
-
"require-dev": {
|
132 |
-
"phpunit/phpunit": "~6"
|
133 |
-
},
|
134 |
-
"type": "library",
|
135 |
-
"extra": {
|
136 |
-
"branch-alias": {
|
137 |
-
"dev-master": "2.x-dev"
|
138 |
-
}
|
139 |
-
},
|
140 |
-
"autoload": {
|
141 |
-
"psr-4": {
|
142 |
-
"phpDocumentor\\Reflection\\": "src/"
|
143 |
-
}
|
144 |
-
},
|
145 |
-
"notification-url": "https://packagist.org/downloads/",
|
146 |
-
"license": [
|
147 |
-
"MIT"
|
148 |
-
],
|
149 |
-
"authors": [
|
150 |
-
{
|
151 |
-
"name": "Jaap van Otterdijk",
|
152 |
-
"email": "opensource@ijaap.nl"
|
153 |
-
}
|
154 |
-
],
|
155 |
-
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
|
156 |
-
"homepage": "http://www.phpdoc.org",
|
157 |
-
"keywords": [
|
158 |
-
"FQSEN",
|
159 |
-
"phpDocumentor",
|
160 |
-
"phpdoc",
|
161 |
-
"reflection",
|
162 |
-
"static analysis"
|
163 |
-
],
|
164 |
-
"time": "2018-08-07T13:53:10+00:00"
|
165 |
-
},
|
166 |
-
{
|
167 |
-
"name": "phpdocumentor/reflection-docblock",
|
168 |
-
"version": "4.3.4",
|
169 |
-
"source": {
|
170 |
-
"type": "git",
|
171 |
-
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
172 |
-
"reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c"
|
173 |
-
},
|
174 |
-
"dist": {
|
175 |
-
"type": "zip",
|
176 |
-
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c",
|
177 |
-
"reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c",
|
178 |
-
"shasum": ""
|
179 |
-
},
|
180 |
-
"require": {
|
181 |
-
"php": "^7.0",
|
182 |
-
"phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0",
|
183 |
-
"phpdocumentor/type-resolver": "~0.4 || ^1.0.0",
|
184 |
-
"webmozart/assert": "^1.0"
|
185 |
-
},
|
186 |
-
"require-dev": {
|
187 |
-
"doctrine/instantiator": "^1.0.5",
|
188 |
-
"mockery/mockery": "^1.0",
|
189 |
-
"phpdocumentor/type-resolver": "0.4.*",
|
190 |
-
"phpunit/phpunit": "^6.4"
|
191 |
-
},
|
192 |
-
"type": "library",
|
193 |
-
"extra": {
|
194 |
-
"branch-alias": {
|
195 |
-
"dev-master": "4.x-dev"
|
196 |
-
}
|
197 |
-
},
|
198 |
-
"autoload": {
|
199 |
-
"psr-4": {
|
200 |
-
"phpDocumentor\\Reflection\\": [
|
201 |
-
"src/"
|
202 |
-
]
|
203 |
-
}
|
204 |
-
},
|
205 |
-
"notification-url": "https://packagist.org/downloads/",
|
206 |
-
"license": [
|
207 |
-
"MIT"
|
208 |
-
],
|
209 |
-
"authors": [
|
210 |
-
{
|
211 |
-
"name": "Mike van Riel",
|
212 |
-
"email": "me@mikevanriel.com"
|
213 |
-
}
|
214 |
-
],
|
215 |
-
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
216 |
-
"time": "2019-12-28T18:55:12+00:00"
|
217 |
-
},
|
218 |
-
{
|
219 |
-
"name": "phpdocumentor/type-resolver",
|
220 |
-
"version": "1.0.1",
|
221 |
-
"source": {
|
222 |
-
"type": "git",
|
223 |
-
"url": "https://github.com/phpDocumentor/TypeResolver.git",
|
224 |
-
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9"
|
225 |
-
},
|
226 |
-
"dist": {
|
227 |
-
"type": "zip",
|
228 |
-
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
|
229 |
-
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
|
230 |
-
"shasum": ""
|
231 |
-
},
|
232 |
-
"require": {
|
233 |
-
"php": "^7.1",
|
234 |
-
"phpdocumentor/reflection-common": "^2.0"
|
235 |
-
},
|
236 |
-
"require-dev": {
|
237 |
-
"ext-tokenizer": "^7.1",
|
238 |
-
"mockery/mockery": "~1",
|
239 |
-
"phpunit/phpunit": "^7.0"
|
240 |
-
},
|
241 |
-
"type": "library",
|
242 |
-
"extra": {
|
243 |
-
"branch-alias": {
|
244 |
-
"dev-master": "1.x-dev"
|
245 |
-
}
|
246 |
-
},
|
247 |
-
"autoload": {
|
248 |
-
"psr-4": {
|
249 |
-
"phpDocumentor\\Reflection\\": "src"
|
250 |
-
}
|
251 |
-
},
|
252 |
-
"notification-url": "https://packagist.org/downloads/",
|
253 |
-
"license": [
|
254 |
-
"MIT"
|
255 |
-
],
|
256 |
-
"authors": [
|
257 |
-
{
|
258 |
-
"name": "Mike van Riel",
|
259 |
-
"email": "me@mikevanriel.com"
|
260 |
-
}
|
261 |
-
],
|
262 |
-
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
|
263 |
-
"time": "2019-08-22T18:11:29+00:00"
|
264 |
-
},
|
265 |
-
{
|
266 |
-
"name": "phpspec/prophecy",
|
267 |
-
"version": "v1.10.2",
|
268 |
-
"source": {
|
269 |
-
"type": "git",
|
270 |
-
"url": "https://github.com/phpspec/prophecy.git",
|
271 |
-
"reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9"
|
272 |
-
},
|
273 |
-
"dist": {
|
274 |
-
"type": "zip",
|
275 |
-
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/b4400efc9d206e83138e2bb97ed7f5b14b831cd9",
|
276 |
-
"reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9",
|
277 |
-
"shasum": ""
|
278 |
-
},
|
279 |
-
"require": {
|
280 |
-
"doctrine/instantiator": "^1.0.2",
|
281 |
-
"php": "^5.3|^7.0",
|
282 |
-
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0",
|
283 |
-
"sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0",
|
284 |
-
"sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0"
|
285 |
-
},
|
286 |
-
"require-dev": {
|
287 |
-
"phpspec/phpspec": "^2.5 || ^3.2",
|
288 |
-
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1"
|
289 |
-
},
|
290 |
-
"type": "library",
|
291 |
-
"extra": {
|
292 |
-
"branch-alias": {
|
293 |
-
"dev-master": "1.10.x-dev"
|
294 |
-
}
|
295 |
-
},
|
296 |
-
"autoload": {
|
297 |
-
"psr-4": {
|
298 |
-
"Prophecy\\": "src/Prophecy"
|
299 |
-
}
|
300 |
-
},
|
301 |
-
"notification-url": "https://packagist.org/downloads/",
|
302 |
-
"license": [
|
303 |
-
"MIT"
|
304 |
-
],
|
305 |
-
"authors": [
|
306 |
-
{
|
307 |
-
"name": "Konstantin Kudryashov",
|
308 |
-
"email": "ever.zet@gmail.com",
|
309 |
-
"homepage": "http://everzet.com"
|
310 |
-
},
|
311 |
-
{
|
312 |
-
"name": "Marcello Duarte",
|
313 |
-
"email": "marcello.duarte@gmail.com"
|
314 |
-
}
|
315 |
-
],
|
316 |
-
"description": "Highly opinionated mocking framework for PHP 5.3+",
|
317 |
-
"homepage": "https://github.com/phpspec/prophecy",
|
318 |
-
"keywords": [
|
319 |
-
"Double",
|
320 |
-
"Dummy",
|
321 |
-
"fake",
|
322 |
-
"mock",
|
323 |
-
"spy",
|
324 |
-
"stub"
|
325 |
-
],
|
326 |
-
"time": "2020-01-20T15:57:02+00:00"
|
327 |
-
},
|
328 |
-
{
|
329 |
-
"name": "phpunit/php-code-coverage",
|
330 |
-
"version": "4.0.8",
|
331 |
-
"source": {
|
332 |
-
"type": "git",
|
333 |
-
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
334 |
-
"reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d"
|
335 |
-
},
|
336 |
-
"dist": {
|
337 |
-
"type": "zip",
|
338 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d",
|
339 |
-
"reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d",
|
340 |
-
"shasum": ""
|
341 |
-
},
|
342 |
-
"require": {
|
343 |
-
"ext-dom": "*",
|
344 |
-
"ext-xmlwriter": "*",
|
345 |
-
"php": "^5.6 || ^7.0",
|
346 |
-
"phpunit/php-file-iterator": "^1.3",
|
347 |
-
"phpunit/php-text-template": "^1.2",
|
348 |
-
"phpunit/php-token-stream": "^1.4.2 || ^2.0",
|
349 |
-
"sebastian/code-unit-reverse-lookup": "^1.0",
|
350 |
-
"sebastian/environment": "^1.3.2 || ^2.0",
|
351 |
-
"sebastian/version": "^1.0 || ^2.0"
|
352 |
-
},
|
353 |
-
"require-dev": {
|
354 |
-
"ext-xdebug": "^2.1.4",
|
355 |
-
"phpunit/phpunit": "^5.7"
|
356 |
-
},
|
357 |
-
"suggest": {
|
358 |
-
"ext-xdebug": "^2.5.1"
|
359 |
-
},
|
360 |
-
"type": "library",
|
361 |
-
"extra": {
|
362 |
-
"branch-alias": {
|
363 |
-
"dev-master": "4.0.x-dev"
|
364 |
-
}
|
365 |
-
},
|
366 |
-
"autoload": {
|
367 |
-
"classmap": [
|
368 |
-
"src/"
|
369 |
-
]
|
370 |
-
},
|
371 |
-
"notification-url": "https://packagist.org/downloads/",
|
372 |
-
"license": [
|
373 |
-
"BSD-3-Clause"
|
374 |
-
],
|
375 |
-
"authors": [
|
376 |
-
{
|
377 |
-
"name": "Sebastian Bergmann",
|
378 |
-
"email": "sb@sebastian-bergmann.de",
|
379 |
-
"role": "lead"
|
380 |
-
}
|
381 |
-
],
|
382 |
-
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
|
383 |
-
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
|
384 |
-
"keywords": [
|
385 |
-
"coverage",
|
386 |
-
"testing",
|
387 |
-
"xunit"
|
388 |
-
],
|
389 |
-
"time": "2017-04-02T07:44:40+00:00"
|
390 |
-
},
|
391 |
-
{
|
392 |
-
"name": "phpunit/php-file-iterator",
|
393 |
-
"version": "1.4.5",
|
394 |
-
"source": {
|
395 |
-
"type": "git",
|
396 |
-
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
397 |
-
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4"
|
398 |
-
},
|
399 |
-
"dist": {
|
400 |
-
"type": "zip",
|
401 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4",
|
402 |
-
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4",
|
403 |
-
"shasum": ""
|
404 |
-
},
|
405 |
-
"require": {
|
406 |
-
"php": ">=5.3.3"
|
407 |
-
},
|
408 |
-
"type": "library",
|
409 |
-
"extra": {
|
410 |
-
"branch-alias": {
|
411 |
-
"dev-master": "1.4.x-dev"
|
412 |
-
}
|
413 |
-
},
|
414 |
-
"autoload": {
|
415 |
-
"classmap": [
|
416 |
-
"src/"
|
417 |
-
]
|
418 |
-
},
|
419 |
-
"notification-url": "https://packagist.org/downloads/",
|
420 |
-
"license": [
|
421 |
-
"BSD-3-Clause"
|
422 |
-
],
|
423 |
-
"authors": [
|
424 |
-
{
|
425 |
-
"name": "Sebastian Bergmann",
|
426 |
-
"email": "sb@sebastian-bergmann.de",
|
427 |
-
"role": "lead"
|
428 |
-
}
|
429 |
-
],
|
430 |
-
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
|
431 |
-
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
|
432 |
-
"keywords": [
|
433 |
-
"filesystem",
|
434 |
-
"iterator"
|
435 |
-
],
|
436 |
-
"time": "2017-11-27T13:52:08+00:00"
|
437 |
-
},
|
438 |
-
{
|
439 |
-
"name": "phpunit/php-text-template",
|
440 |
-
"version": "1.2.1",
|
441 |
-
"source": {
|
442 |
-
"type": "git",
|
443 |
-
"url": "https://github.com/sebastianbergmann/php-text-template.git",
|
444 |
-
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
|
445 |
-
},
|
446 |
-
"dist": {
|
447 |
-
"type": "zip",
|
448 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
|
449 |
-
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
|
450 |
-
"shasum": ""
|
451 |
-
},
|
452 |
-
"require": {
|
453 |
-
"php": ">=5.3.3"
|
454 |
-
},
|
455 |
-
"type": "library",
|
456 |
-
"autoload": {
|
457 |
-
"classmap": [
|
458 |
-
"src/"
|
459 |
-
]
|
460 |
-
},
|
461 |
-
"notification-url": "https://packagist.org/downloads/",
|
462 |
-
"license": [
|
463 |
-
"BSD-3-Clause"
|
464 |
-
],
|
465 |
-
"authors": [
|
466 |
-
{
|
467 |
-
"name": "Sebastian Bergmann",
|
468 |
-
"email": "sebastian@phpunit.de",
|
469 |
-
"role": "lead"
|
470 |
-
}
|
471 |
-
],
|
472 |
-
"description": "Simple template engine.",
|
473 |
-
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
|
474 |
-
"keywords": [
|
475 |
-
"template"
|
476 |
-
],
|
477 |
-
"time": "2015-06-21T13:50:34+00:00"
|
478 |
-
},
|
479 |
-
{
|
480 |
-
"name": "phpunit/php-timer",
|
481 |
-
"version": "1.0.9",
|
482 |
-
"source": {
|
483 |
-
"type": "git",
|
484 |
-
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
485 |
-
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f"
|
486 |
-
},
|
487 |
-
"dist": {
|
488 |
-
"type": "zip",
|
489 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
|
490 |
-
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
|
491 |
-
"shasum": ""
|
492 |
-
},
|
493 |
-
"require": {
|
494 |
-
"php": "^5.3.3 || ^7.0"
|
495 |
-
},
|
496 |
-
"require-dev": {
|
497 |
-
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
|
498 |
-
},
|
499 |
-
"type": "library",
|
500 |
-
"extra": {
|
501 |
-
"branch-alias": {
|
502 |
-
"dev-master": "1.0-dev"
|
503 |
-
}
|
504 |
-
},
|
505 |
-
"autoload": {
|
506 |
-
"classmap": [
|
507 |
-
"src/"
|
508 |
-
]
|
509 |
-
},
|
510 |
-
"notification-url": "https://packagist.org/downloads/",
|
511 |
-
"license": [
|
512 |
-
"BSD-3-Clause"
|
513 |
-
],
|
514 |
-
"authors": [
|
515 |
-
{
|
516 |
-
"name": "Sebastian Bergmann",
|
517 |
-
"email": "sb@sebastian-bergmann.de",
|
518 |
-
"role": "lead"
|
519 |
-
}
|
520 |
-
],
|
521 |
-
"description": "Utility class for timing",
|
522 |
-
"homepage": "https://github.com/sebastianbergmann/php-timer/",
|
523 |
-
"keywords": [
|
524 |
-
"timer"
|
525 |
-
],
|
526 |
-
"time": "2017-02-26T11:10:40+00:00"
|
527 |
-
},
|
528 |
-
{
|
529 |
-
"name": "phpunit/php-token-stream",
|
530 |
-
"version": "2.0.2",
|
531 |
-
"source": {
|
532 |
-
"type": "git",
|
533 |
-
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
534 |
-
"reference": "791198a2c6254db10131eecfe8c06670700904db"
|
535 |
-
},
|
536 |
-
"dist": {
|
537 |
-
"type": "zip",
|
538 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db",
|
539 |
-
"reference": "791198a2c6254db10131eecfe8c06670700904db",
|
540 |
-
"shasum": ""
|
541 |
-
},
|
542 |
-
"require": {
|
543 |
-
"ext-tokenizer": "*",
|
544 |
-
"php": "^7.0"
|
545 |
-
},
|
546 |
-
"require-dev": {
|
547 |
-
"phpunit/phpunit": "^6.2.4"
|
548 |
-
},
|
549 |
-
"type": "library",
|
550 |
-
"extra": {
|
551 |
-
"branch-alias": {
|
552 |
-
"dev-master": "2.0-dev"
|
553 |
-
}
|
554 |
-
},
|
555 |
-
"autoload": {
|
556 |
-
"classmap": [
|
557 |
-
"src/"
|
558 |
-
]
|
559 |
-
},
|
560 |
-
"notification-url": "https://packagist.org/downloads/",
|
561 |
-
"license": [
|
562 |
-
"BSD-3-Clause"
|
563 |
-
],
|
564 |
-
"authors": [
|
565 |
-
{
|
566 |
-
"name": "Sebastian Bergmann",
|
567 |
-
"email": "sebastian@phpunit.de"
|
568 |
-
}
|
569 |
-
],
|
570 |
-
"description": "Wrapper around PHP's tokenizer extension.",
|
571 |
-
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
|
572 |
-
"keywords": [
|
573 |
-
"tokenizer"
|
574 |
-
],
|
575 |
-
"time": "2017-11-27T05:48:46+00:00"
|
576 |
-
},
|
577 |
-
{
|
578 |
-
"name": "phpunit/phpunit",
|
579 |
-
"version": "5.7.27",
|
580 |
-
"source": {
|
581 |
-
"type": "git",
|
582 |
-
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
583 |
-
"reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c"
|
584 |
-
},
|
585 |
-
"dist": {
|
586 |
-
"type": "zip",
|
587 |
-
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c",
|
588 |
-
"reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c",
|
589 |
-
"shasum": ""
|
590 |
-
},
|
591 |
-
"require": {
|
592 |
-
"ext-dom": "*",
|
593 |
-
"ext-json": "*",
|
594 |
-
"ext-libxml": "*",
|
595 |
-
"ext-mbstring": "*",
|
596 |
-
"ext-xml": "*",
|
597 |
-
"myclabs/deep-copy": "~1.3",
|
598 |
-
"php": "^5.6 || ^7.0",
|
599 |
-
"phpspec/prophecy": "^1.6.2",
|
600 |
-
"phpunit/php-code-coverage": "^4.0.4",
|
601 |
-
"phpunit/php-file-iterator": "~1.4",
|
602 |
-
"phpunit/php-text-template": "~1.2",
|
603 |
-
"phpunit/php-timer": "^1.0.6",
|
604 |
-
"phpunit/phpunit-mock-objects": "^3.2",
|
605 |
-
"sebastian/comparator": "^1.2.4",
|
606 |
-
"sebastian/diff": "^1.4.3",
|
607 |
-
"sebastian/environment": "^1.3.4 || ^2.0",
|
608 |
-
"sebastian/exporter": "~2.0",
|
609 |
-
"sebastian/global-state": "^1.1",
|
610 |
-
"sebastian/object-enumerator": "~2.0",
|
611 |
-
"sebastian/resource-operations": "~1.0",
|
612 |
-
"sebastian/version": "^1.0.6|^2.0.1",
|
613 |
-
"symfony/yaml": "~2.1|~3.0|~4.0"
|
614 |
-
},
|
615 |
-
"conflict": {
|
616 |
-
"phpdocumentor/reflection-docblock": "3.0.2"
|
617 |
-
},
|
618 |
-
"require-dev": {
|
619 |
-
"ext-pdo": "*"
|
620 |
-
},
|
621 |
-
"suggest": {
|
622 |
-
"ext-xdebug": "*",
|
623 |
-
"phpunit/php-invoker": "~1.1"
|
624 |
-
},
|
625 |
-
"bin": [
|
626 |
-
"phpunit"
|
627 |
-
],
|
628 |
-
"type": "library",
|
629 |
-
"extra": {
|
630 |
-
"branch-alias": {
|
631 |
-
"dev-master": "5.7.x-dev"
|
632 |
-
}
|
633 |
-
},
|
634 |
-
"autoload": {
|
635 |
-
"classmap": [
|
636 |
-
"src/"
|
637 |
-
]
|
638 |
-
},
|
639 |
-
"notification-url": "https://packagist.org/downloads/",
|
640 |
-
"license": [
|
641 |
-
"BSD-3-Clause"
|
642 |
-
],
|
643 |
-
"authors": [
|
644 |
-
{
|
645 |
-
"name": "Sebastian Bergmann",
|
646 |
-
"email": "sebastian@phpunit.de",
|
647 |
-
"role": "lead"
|
648 |
-
}
|
649 |
-
],
|
650 |
-
"description": "The PHP Unit Testing framework.",
|
651 |
-
"homepage": "https://phpunit.de/",
|
652 |
-
"keywords": [
|
653 |
-
"phpunit",
|
654 |
-
"testing",
|
655 |
-
"xunit"
|
656 |
-
],
|
657 |
-
"time": "2018-02-01T05:50:59+00:00"
|
658 |
-
},
|
659 |
-
{
|
660 |
-
"name": "phpunit/phpunit-mock-objects",
|
661 |
-
"version": "3.4.4",
|
662 |
-
"source": {
|
663 |
-
"type": "git",
|
664 |
-
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
665 |
-
"reference": "a23b761686d50a560cc56233b9ecf49597cc9118"
|
666 |
-
},
|
667 |
-
"dist": {
|
668 |
-
"type": "zip",
|
669 |
-
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118",
|
670 |
-
"reference": "a23b761686d50a560cc56233b9ecf49597cc9118",
|
671 |
-
"shasum": ""
|
672 |
-
},
|
673 |
-
"require": {
|
674 |
-
"doctrine/instantiator": "^1.0.2",
|
675 |
-
"php": "^5.6 || ^7.0",
|
676 |
-
"phpunit/php-text-template": "^1.2",
|
677 |
-
"sebastian/exporter": "^1.2 || ^2.0"
|
678 |
-
},
|
679 |
-
"conflict": {
|
680 |
-
"phpunit/phpunit": "<5.4.0"
|
681 |
-
},
|
682 |
-
"require-dev": {
|
683 |
-
"phpunit/phpunit": "^5.4"
|
684 |
-
},
|
685 |
-
"suggest": {
|
686 |
-
"ext-soap": "*"
|
687 |
-
},
|
688 |
-
"type": "library",
|
689 |
-
"extra": {
|
690 |
-
"branch-alias": {
|
691 |
-
"dev-master": "3.2.x-dev"
|
692 |
-
}
|
693 |
-
},
|
694 |
-
"autoload": {
|
695 |
-
"classmap": [
|
696 |
-
"src/"
|
697 |
-
]
|
698 |
-
},
|
699 |
-
"notification-url": "https://packagist.org/downloads/",
|
700 |
-
"license": [
|
701 |
-
"BSD-3-Clause"
|
702 |
-
],
|
703 |
-
"authors": [
|
704 |
-
{
|
705 |
-
"name": "Sebastian Bergmann",
|
706 |
-
"email": "sb@sebastian-bergmann.de",
|
707 |
-
"role": "lead"
|
708 |
-
}
|
709 |
-
],
|
710 |
-
"description": "Mock Object library for PHPUnit",
|
711 |
-
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
|
712 |
-
"keywords": [
|
713 |
-
"mock",
|
714 |
-
"xunit"
|
715 |
-
],
|
716 |
-
"abandoned": true,
|
717 |
-
"time": "2017-06-30T09:13:00+00:00"
|
718 |
-
},
|
719 |
-
{
|
720 |
-
"name": "sebastian/code-unit-reverse-lookup",
|
721 |
-
"version": "1.0.1",
|
722 |
-
"source": {
|
723 |
-
"type": "git",
|
724 |
-
"url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
|
725 |
-
"reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18"
|
726 |
-
},
|
727 |
-
"dist": {
|
728 |
-
"type": "zip",
|
729 |
-
"url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
|
730 |
-
"reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
|
731 |
-
"shasum": ""
|
732 |
-
},
|
733 |
-
"require": {
|
734 |
-
"php": "^5.6 || ^7.0"
|
735 |
-
},
|
736 |
-
"require-dev": {
|
737 |
-
"phpunit/phpunit": "^5.7 || ^6.0"
|
738 |
-
},
|
739 |
-
"type": "library",
|
740 |
-
"extra": {
|
741 |
-
"branch-alias": {
|
742 |
-
"dev-master": "1.0.x-dev"
|
743 |
-
}
|
744 |
-
},
|
745 |
-
"autoload": {
|
746 |
-
"classmap": [
|
747 |
-
"src/"
|
748 |
-
]
|
749 |
-
},
|
750 |
-
"notification-url": "https://packagist.org/downloads/",
|
751 |
-
"license": [
|
752 |
-
"BSD-3-Clause"
|
753 |
-
],
|
754 |
-
"authors": [
|
755 |
-
{
|
756 |
-
"name": "Sebastian Bergmann",
|
757 |
-
"email": "sebastian@phpunit.de"
|
758 |
-
}
|
759 |
-
],
|
760 |
-
"description": "Looks up which function or method a line of code belongs to",
|
761 |
-
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
|
762 |
-
"time": "2017-03-04T06:30:41+00:00"
|
763 |
-
},
|
764 |
-
{
|
765 |
-
"name": "sebastian/comparator",
|
766 |
-
"version": "1.2.4",
|
767 |
-
"source": {
|
768 |
-
"type": "git",
|
769 |
-
"url": "https://github.com/sebastianbergmann/comparator.git",
|
770 |
-
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be"
|
771 |
-
},
|
772 |
-
"dist": {
|
773 |
-
"type": "zip",
|
774 |
-
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
|
775 |
-
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
|
776 |
-
"shasum": ""
|
777 |
-
},
|
778 |
-
"require": {
|
779 |
-
"php": ">=5.3.3",
|
780 |
-
"sebastian/diff": "~1.2",
|
781 |
-
"sebastian/exporter": "~1.2 || ~2.0"
|
782 |
-
},
|
783 |
-
"require-dev": {
|
784 |
-
"phpunit/phpunit": "~4.4"
|
785 |
-
},
|
786 |
-
"type": "library",
|
787 |
-
"extra": {
|
788 |
-
"branch-alias": {
|
789 |
-
"dev-master": "1.2.x-dev"
|
790 |
-
}
|
791 |
-
},
|
792 |
-
"autoload": {
|
793 |
-
"classmap": [
|
794 |
-
"src/"
|
795 |
-
]
|
796 |
-
},
|
797 |
-
"notification-url": "https://packagist.org/downloads/",
|
798 |
-
"license": [
|
799 |
-
"BSD-3-Clause"
|
800 |
-
],
|
801 |
-
"authors": [
|
802 |
-
{
|
803 |
-
"name": "Jeff Welch",
|
804 |
-
"email": "whatthejeff@gmail.com"
|
805 |
-
},
|
806 |
-
{
|
807 |
-
"name": "Volker Dusch",
|
808 |
-
"email": "github@wallbash.com"
|
809 |
-
},
|
810 |
-
{
|
811 |
-
"name": "Bernhard Schussek",
|
812 |
-
"email": "bschussek@2bepublished.at"
|
813 |
-
},
|
814 |
-
{
|
815 |
-
"name": "Sebastian Bergmann",
|
816 |
-
"email": "sebastian@phpunit.de"
|
817 |
-
}
|
818 |
-
],
|
819 |
-
"description": "Provides the functionality to compare PHP values for equality",
|
820 |
-
"homepage": "http://www.github.com/sebastianbergmann/comparator",
|
821 |
-
"keywords": [
|
822 |
-
"comparator",
|
823 |
-
"compare",
|
824 |
-
"equality"
|
825 |
-
],
|
826 |
-
"time": "2017-01-29T09:50:25+00:00"
|
827 |
-
},
|
828 |
-
{
|
829 |
-
"name": "sebastian/diff",
|
830 |
-
"version": "1.4.3",
|
831 |
-
"source": {
|
832 |
-
"type": "git",
|
833 |
-
"url": "https://github.com/sebastianbergmann/diff.git",
|
834 |
-
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4"
|
835 |
-
},
|
836 |
-
"dist": {
|
837 |
-
"type": "zip",
|
838 |
-
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4",
|
839 |
-
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4",
|
840 |
-
"shasum": ""
|
841 |
-
},
|
842 |
-
"require": {
|
843 |
-
"php": "^5.3.3 || ^7.0"
|
844 |
-
},
|
845 |
-
"require-dev": {
|
846 |
-
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
|
847 |
-
},
|
848 |
-
"type": "library",
|
849 |
-
"extra": {
|
850 |
-
"branch-alias": {
|
851 |
-
"dev-master": "1.4-dev"
|
852 |
-
}
|
853 |
-
},
|
854 |
-
"autoload": {
|
855 |
-
"classmap": [
|
856 |
-
"src/"
|
857 |
-
]
|
858 |
-
},
|
859 |
-
"notification-url": "https://packagist.org/downloads/",
|
860 |
-
"license": [
|
861 |
-
"BSD-3-Clause"
|
862 |
-
],
|
863 |
-
"authors": [
|
864 |
-
{
|
865 |
-
"name": "Kore Nordmann",
|
866 |
-
"email": "mail@kore-nordmann.de"
|
867 |
-
},
|
868 |
-
{
|
869 |
-
"name": "Sebastian Bergmann",
|
870 |
-
"email": "sebastian@phpunit.de"
|
871 |
-
}
|
872 |
-
],
|
873 |
-
"description": "Diff implementation",
|
874 |
-
"homepage": "https://github.com/sebastianbergmann/diff",
|
875 |
-
"keywords": [
|
876 |
-
"diff"
|
877 |
-
],
|
878 |
-
"time": "2017-05-22T07:24:03+00:00"
|
879 |
-
},
|
880 |
-
{
|
881 |
-
"name": "sebastian/environment",
|
882 |
-
"version": "2.0.0",
|
883 |
-
"source": {
|
884 |
-
"type": "git",
|
885 |
-
"url": "https://github.com/sebastianbergmann/environment.git",
|
886 |
-
"reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac"
|
887 |
-
},
|
888 |
-
"dist": {
|
889 |
-
"type": "zip",
|
890 |
-
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
|
891 |
-
"reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
|
892 |
-
"shasum": ""
|
893 |
-
},
|
894 |
-
"require": {
|
895 |
-
"php": "^5.6 || ^7.0"
|
896 |
-
},
|
897 |
-
"require-dev": {
|
898 |
-
"phpunit/phpunit": "^5.0"
|
899 |
-
},
|
900 |
-
"type": "library",
|
901 |
-
"extra": {
|
902 |
-
"branch-alias": {
|
903 |
-
"dev-master": "2.0.x-dev"
|
904 |
-
}
|
905 |
-
},
|
906 |
-
"autoload": {
|
907 |
-
"classmap": [
|
908 |
-
"src/"
|
909 |
-
]
|
910 |
-
},
|
911 |
-
"notification-url": "https://packagist.org/downloads/",
|
912 |
-
"license": [
|
913 |
-
"BSD-3-Clause"
|
914 |
-
],
|
915 |
-
"authors": [
|
916 |
-
{
|
917 |
-
"name": "Sebastian Bergmann",
|
918 |
-
"email": "sebastian@phpunit.de"
|
919 |
-
}
|
920 |
-
],
|
921 |
-
"description": "Provides functionality to handle HHVM/PHP environments",
|
922 |
-
"homepage": "http://www.github.com/sebastianbergmann/environment",
|
923 |
-
"keywords": [
|
924 |
-
"Xdebug",
|
925 |
-
"environment",
|
926 |
-
"hhvm"
|
927 |
-
],
|
928 |
-
"time": "2016-11-26T07:53:53+00:00"
|
929 |
-
},
|
930 |
-
{
|
931 |
-
"name": "sebastian/exporter",
|
932 |
-
"version": "2.0.0",
|
933 |
-
"source": {
|
934 |
-
"type": "git",
|
935 |
-
"url": "https://github.com/sebastianbergmann/exporter.git",
|
936 |
-
"reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4"
|
937 |
-
},
|
938 |
-
"dist": {
|
939 |
-
"type": "zip",
|
940 |
-
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
|
941 |
-
"reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
|
942 |
-
"shasum": ""
|
943 |
-
},
|
944 |
-
"require": {
|
945 |
-
"php": ">=5.3.3",
|
946 |
-
"sebastian/recursion-context": "~2.0"
|
947 |
-
},
|
948 |
-
"require-dev": {
|
949 |
-
"ext-mbstring": "*",
|
950 |
-
"phpunit/phpunit": "~4.4"
|
951 |
-
},
|
952 |
-
"type": "library",
|
953 |
-
"extra": {
|
954 |
-
"branch-alias": {
|
955 |
-
"dev-master": "2.0.x-dev"
|
956 |
-
}
|
957 |
-
},
|
958 |
-
"autoload": {
|
959 |
-
"classmap": [
|
960 |
-
"src/"
|
961 |
-
]
|
962 |
-
},
|
963 |
-
"notification-url": "https://packagist.org/downloads/",
|
964 |
-
"license": [
|
965 |
-
"BSD-3-Clause"
|
966 |
-
],
|
967 |
-
"authors": [
|
968 |
-
{
|
969 |
-
"name": "Jeff Welch",
|
970 |
-
"email": "whatthejeff@gmail.com"
|
971 |
-
},
|
972 |
-
{
|
973 |
-
"name": "Volker Dusch",
|
974 |
-
"email": "github@wallbash.com"
|
975 |
-
},
|
976 |
-
{
|
977 |
-
"name": "Bernhard Schussek",
|
978 |
-
"email": "bschussek@2bepublished.at"
|
979 |
-
},
|
980 |
-
{
|
981 |
-
"name": "Sebastian Bergmann",
|
982 |
-
"email": "sebastian@phpunit.de"
|
983 |
-
},
|
984 |
-
{
|
985 |
-
"name": "Adam Harvey",
|
986 |
-
"email": "aharvey@php.net"
|
987 |
-
}
|
988 |
-
],
|
989 |
-
"description": "Provides the functionality to export PHP variables for visualization",
|
990 |
-
"homepage": "http://www.github.com/sebastianbergmann/exporter",
|
991 |
-
"keywords": [
|
992 |
-
"export",
|
993 |
-
"exporter"
|
994 |
-
],
|
995 |
-
"time": "2016-11-19T08:54:04+00:00"
|
996 |
-
},
|
997 |
-
{
|
998 |
-
"name": "sebastian/global-state",
|
999 |
-
"version": "1.1.1",
|
1000 |
-
"source": {
|
1001 |
-
"type": "git",
|
1002 |
-
"url": "https://github.com/sebastianbergmann/global-state.git",
|
1003 |
-
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
|
1004 |
-
},
|
1005 |
-
"dist": {
|
1006 |
-
"type": "zip",
|
1007 |
-
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
|
1008 |
-
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
|
1009 |
-
"shasum": ""
|
1010 |
-
},
|
1011 |
-
"require": {
|
1012 |
-
"php": ">=5.3.3"
|
1013 |
-
},
|
1014 |
-
"require-dev": {
|
1015 |
-
"phpunit/phpunit": "~4.2"
|
1016 |
-
},
|
1017 |
-
"suggest": {
|
1018 |
-
"ext-uopz": "*"
|
1019 |
-
},
|
1020 |
-
"type": "library",
|
1021 |
-
"extra": {
|
1022 |
-
"branch-alias": {
|
1023 |
-
"dev-master": "1.0-dev"
|
1024 |
-
}
|
1025 |
-
},
|
1026 |
-
"autoload": {
|
1027 |
-
"classmap": [
|
1028 |
-
"src/"
|
1029 |
-
]
|
1030 |
-
},
|
1031 |
-
"notification-url": "https://packagist.org/downloads/",
|
1032 |
-
"license": [
|
1033 |
-
"BSD-3-Clause"
|
1034 |
-
],
|
1035 |
-
"authors": [
|
1036 |
-
{
|
1037 |
-
"name": "Sebastian Bergmann",
|
1038 |
-
"email": "sebastian@phpunit.de"
|
1039 |
-
}
|
1040 |
-
],
|
1041 |
-
"description": "Snapshotting of global state",
|
1042 |
-
"homepage": "http://www.github.com/sebastianbergmann/global-state",
|
1043 |
-
"keywords": [
|
1044 |
-
"global state"
|
1045 |
-
],
|
1046 |
-
"time": "2015-10-12T03:26:01+00:00"
|
1047 |
-
},
|
1048 |
-
{
|
1049 |
-
"name": "sebastian/object-enumerator",
|
1050 |
-
"version": "2.0.1",
|
1051 |
-
"source": {
|
1052 |
-
"type": "git",
|
1053 |
-
"url": "https://github.com/sebastianbergmann/object-enumerator.git",
|
1054 |
-
"reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7"
|
1055 |
-
},
|
1056 |
-
"dist": {
|
1057 |
-
"type": "zip",
|
1058 |
-
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7",
|
1059 |
-
"reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7",
|
1060 |
-
"shasum": ""
|
1061 |
-
},
|
1062 |
-
"require": {
|
1063 |
-
"php": ">=5.6",
|
1064 |
-
"sebastian/recursion-context": "~2.0"
|
1065 |
-
},
|
1066 |
-
"require-dev": {
|
1067 |
-
"phpunit/phpunit": "~5"
|
1068 |
-
},
|
1069 |
-
"type": "library",
|
1070 |
-
"extra": {
|
1071 |
-
"branch-alias": {
|
1072 |
-
"dev-master": "2.0.x-dev"
|
1073 |
-
}
|
1074 |
-
},
|
1075 |
-
"autoload": {
|
1076 |
-
"classmap": [
|
1077 |
-
"src/"
|
1078 |
-
]
|
1079 |
-
},
|
1080 |
-
"notification-url": "https://packagist.org/downloads/",
|
1081 |
-
"license": [
|
1082 |
-
"BSD-3-Clause"
|
1083 |
-
],
|
1084 |
-
"authors": [
|
1085 |
-
{
|
1086 |
-
"name": "Sebastian Bergmann",
|
1087 |
-
"email": "sebastian@phpunit.de"
|
1088 |
-
}
|
1089 |
-
],
|
1090 |
-
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
|
1091 |
-
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
|
1092 |
-
"time": "2017-02-18T15:18:39+00:00"
|
1093 |
-
},
|
1094 |
-
{
|
1095 |
-
"name": "sebastian/recursion-context",
|
1096 |
-
"version": "2.0.0",
|
1097 |
-
"source": {
|
1098 |
-
"type": "git",
|
1099 |
-
"url": "https://github.com/sebastianbergmann/recursion-context.git",
|
1100 |
-
"reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a"
|
1101 |
-
},
|
1102 |
-
"dist": {
|
1103 |
-
"type": "zip",
|
1104 |
-
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a",
|
1105 |
-
"reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a",
|
1106 |
-
"shasum": ""
|
1107 |
-
},
|
1108 |
-
"require": {
|
1109 |
-
"php": ">=5.3.3"
|
1110 |
-
},
|
1111 |
-
"require-dev": {
|
1112 |
-
"phpunit/phpunit": "~4.4"
|
1113 |
-
},
|
1114 |
-
"type": "library",
|
1115 |
-
"extra": {
|
1116 |
-
"branch-alias": {
|
1117 |
-
"dev-master": "2.0.x-dev"
|
1118 |
-
}
|
1119 |
-
},
|
1120 |
-
"autoload": {
|
1121 |
-
"classmap": [
|
1122 |
-
"src/"
|
1123 |
-
]
|
1124 |
-
},
|
1125 |
-
"notification-url": "https://packagist.org/downloads/",
|
1126 |
-
"license": [
|
1127 |
-
"BSD-3-Clause"
|
1128 |
-
],
|
1129 |
-
"authors": [
|
1130 |
-
{
|
1131 |
-
"name": "Jeff Welch",
|
1132 |
-
"email": "whatthejeff@gmail.com"
|
1133 |
-
},
|
1134 |
-
{
|
1135 |
-
"name": "Sebastian Bergmann",
|
1136 |
-
"email": "sebastian@phpunit.de"
|
1137 |
-
},
|
1138 |
-
{
|
1139 |
-
"name": "Adam Harvey",
|
1140 |
-
"email": "aharvey@php.net"
|
1141 |
-
}
|
1142 |
-
],
|
1143 |
-
"description": "Provides functionality to recursively process PHP variables",
|
1144 |
-
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
1145 |
-
"time": "2016-11-19T07:33:16+00:00"
|
1146 |
-
},
|
1147 |
-
{
|
1148 |
-
"name": "sebastian/resource-operations",
|
1149 |
-
"version": "1.0.0",
|
1150 |
-
"source": {
|
1151 |
-
"type": "git",
|
1152 |
-
"url": "https://github.com/sebastianbergmann/resource-operations.git",
|
1153 |
-
"reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52"
|
1154 |
-
},
|
1155 |
-
"dist": {
|
1156 |
-
"type": "zip",
|
1157 |
-
"url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
|
1158 |
-
"reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
|
1159 |
-
"shasum": ""
|
1160 |
-
},
|
1161 |
-
"require": {
|
1162 |
-
"php": ">=5.6.0"
|
1163 |
-
},
|
1164 |
-
"type": "library",
|
1165 |
-
"extra": {
|
1166 |
-
"branch-alias": {
|
1167 |
-
"dev-master": "1.0.x-dev"
|
1168 |
-
}
|
1169 |
-
},
|
1170 |
-
"autoload": {
|
1171 |
-
"classmap": [
|
1172 |
-
"src/"
|
1173 |
-
]
|
1174 |
-
},
|
1175 |
-
"notification-url": "https://packagist.org/downloads/",
|
1176 |
-
"license": [
|
1177 |
-
"BSD-3-Clause"
|
1178 |
-
],
|
1179 |
-
"authors": [
|
1180 |
-
{
|
1181 |
-
"name": "Sebastian Bergmann",
|
1182 |
-
"email": "sebastian@phpunit.de"
|
1183 |
-
}
|
1184 |
-
],
|
1185 |
-
"description": "Provides a list of PHP built-in functions that operate on resources",
|
1186 |
-
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
|
1187 |
-
"time": "2015-07-28T20:34:47+00:00"
|
1188 |
-
},
|
1189 |
-
{
|
1190 |
-
"name": "sebastian/version",
|
1191 |
-
"version": "2.0.1",
|
1192 |
-
"source": {
|
1193 |
-
"type": "git",
|
1194 |
-
"url": "https://github.com/sebastianbergmann/version.git",
|
1195 |
-
"reference": "99732be0ddb3361e16ad77b68ba41efc8e979019"
|
1196 |
-
},
|
1197 |
-
"dist": {
|
1198 |
-
"type": "zip",
|
1199 |
-
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019",
|
1200 |
-
"reference": "99732be0ddb3361e16ad77b68ba41efc8e979019",
|
1201 |
-
"shasum": ""
|
1202 |
-
},
|
1203 |
-
"require": {
|
1204 |
-
"php": ">=5.6"
|
1205 |
-
},
|
1206 |
-
"type": "library",
|
1207 |
-
"extra": {
|
1208 |
-
"branch-alias": {
|
1209 |
-
"dev-master": "2.0.x-dev"
|
1210 |
-
}
|
1211 |
-
},
|
1212 |
-
"autoload": {
|
1213 |
-
"classmap": [
|
1214 |
-
"src/"
|
1215 |
-
]
|
1216 |
-
},
|
1217 |
-
"notification-url": "https://packagist.org/downloads/",
|
1218 |
-
"license": [
|
1219 |
-
"BSD-3-Clause"
|
1220 |
-
],
|
1221 |
-
"authors": [
|
1222 |
-
{
|
1223 |
-
"name": "Sebastian Bergmann",
|
1224 |
-
"email": "sebastian@phpunit.de",
|
1225 |
-
"role": "lead"
|
1226 |
-
}
|
1227 |
-
],
|
1228 |
-
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
1229 |
-
"homepage": "https://github.com/sebastianbergmann/version",
|
1230 |
-
"time": "2016-10-03T07:35:21+00:00"
|
1231 |
-
},
|
1232 |
-
{
|
1233 |
-
"name": "squizlabs/php_codesniffer",
|
1234 |
-
"version": "3.5.4",
|
1235 |
-
"source": {
|
1236 |
-
"type": "git",
|
1237 |
-
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
1238 |
-
"reference": "dceec07328401de6211037abbb18bda423677e26"
|
1239 |
-
},
|
1240 |
-
"dist": {
|
1241 |
-
"type": "zip",
|
1242 |
-
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26",
|
1243 |
-
"reference": "dceec07328401de6211037abbb18bda423677e26",
|
1244 |
-
"shasum": ""
|
1245 |
-
},
|
1246 |
-
"require": {
|
1247 |
-
"ext-simplexml": "*",
|
1248 |
-
"ext-tokenizer": "*",
|
1249 |
-
"ext-xmlwriter": "*",
|
1250 |
-
"php": ">=5.4.0"
|
1251 |
-
},
|
1252 |
-
"require-dev": {
|
1253 |
-
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
1254 |
-
},
|
1255 |
-
"bin": [
|
1256 |
-
"bin/phpcs",
|
1257 |
-
"bin/phpcbf"
|
1258 |
-
],
|
1259 |
-
"type": "library",
|
1260 |
-
"extra": {
|
1261 |
-
"branch-alias": {
|
1262 |
-
"dev-master": "3.x-dev"
|
1263 |
-
}
|
1264 |
-
},
|
1265 |
-
"notification-url": "https://packagist.org/downloads/",
|
1266 |
-
"license": [
|
1267 |
-
"BSD-3-Clause"
|
1268 |
-
],
|
1269 |
-
"authors": [
|
1270 |
-
{
|
1271 |
-
"name": "Greg Sherwood",
|
1272 |
-
"role": "lead"
|
1273 |
-
}
|
1274 |
-
],
|
1275 |
-
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
1276 |
-
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
|
1277 |
-
"keywords": [
|
1278 |
-
"phpcs",
|
1279 |
-
"standards"
|
1280 |
-
],
|
1281 |
-
"time": "2020-01-30T22:20:29+00:00"
|
1282 |
-
},
|
1283 |
-
{
|
1284 |
-
"name": "symfony/polyfill-ctype",
|
1285 |
-
"version": "v1.13.1",
|
1286 |
-
"source": {
|
1287 |
-
"type": "git",
|
1288 |
-
"url": "https://github.com/symfony/polyfill-ctype.git",
|
1289 |
-
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3"
|
1290 |
-
},
|
1291 |
-
"dist": {
|
1292 |
-
"type": "zip",
|
1293 |
-
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
|
1294 |
-
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
|
1295 |
-
"shasum": ""
|
1296 |
-
},
|
1297 |
-
"require": {
|
1298 |
-
"php": ">=5.3.3"
|
1299 |
-
},
|
1300 |
-
"suggest": {
|
1301 |
-
"ext-ctype": "For best performance"
|
1302 |
-
},
|
1303 |
-
"type": "library",
|
1304 |
-
"extra": {
|
1305 |
-
"branch-alias": {
|
1306 |
-
"dev-master": "1.13-dev"
|
1307 |
-
}
|
1308 |
-
},
|
1309 |
-
"autoload": {
|
1310 |
-
"psr-4": {
|
1311 |
-
"Symfony\\Polyfill\\Ctype\\": ""
|
1312 |
-
},
|
1313 |
-
"files": [
|
1314 |
-
"bootstrap.php"
|
1315 |
-
]
|
1316 |
-
},
|
1317 |
-
"notification-url": "https://packagist.org/downloads/",
|
1318 |
-
"license": [
|
1319 |
-
"MIT"
|
1320 |
-
],
|
1321 |
-
"authors": [
|
1322 |
-
{
|
1323 |
-
"name": "Gert de Pagter",
|
1324 |
-
"email": "BackEndTea@gmail.com"
|
1325 |
-
},
|
1326 |
-
{
|
1327 |
-
"name": "Symfony Community",
|
1328 |
-
"homepage": "https://symfony.com/contributors"
|
1329 |
-
}
|
1330 |
-
],
|
1331 |
-
"description": "Symfony polyfill for ctype functions",
|
1332 |
-
"homepage": "https://symfony.com",
|
1333 |
-
"keywords": [
|
1334 |
-
"compatibility",
|
1335 |
-
"ctype",
|
1336 |
-
"polyfill",
|
1337 |
-
"portable"
|
1338 |
-
],
|
1339 |
-
"time": "2019-11-27T13:56:44+00:00"
|
1340 |
-
},
|
1341 |
-
{
|
1342 |
-
"name": "symfony/yaml",
|
1343 |
-
"version": "v4.4.4",
|
1344 |
-
"source": {
|
1345 |
-
"type": "git",
|
1346 |
-
"url": "https://github.com/symfony/yaml.git",
|
1347 |
-
"reference": "cd014e425b3668220adb865f53bff64b3ad21767"
|
1348 |
-
},
|
1349 |
-
"dist": {
|
1350 |
-
"type": "zip",
|
1351 |
-
"url": "https://api.github.com/repos/symfony/yaml/zipball/cd014e425b3668220adb865f53bff64b3ad21767",
|
1352 |
-
"reference": "cd014e425b3668220adb865f53bff64b3ad21767",
|
1353 |
-
"shasum": ""
|
1354 |
-
},
|
1355 |
-
"require": {
|
1356 |
-
"php": "^7.1.3",
|
1357 |
-
"symfony/polyfill-ctype": "~1.8"
|
1358 |
-
},
|
1359 |
-
"conflict": {
|
1360 |
-
"symfony/console": "<3.4"
|
1361 |
-
},
|
1362 |
-
"require-dev": {
|
1363 |
-
"symfony/console": "^3.4|^4.0|^5.0"
|
1364 |
-
},
|
1365 |
-
"suggest": {
|
1366 |
-
"symfony/console": "For validating YAML files using the lint command"
|
1367 |
-
},
|
1368 |
-
"type": "library",
|
1369 |
-
"extra": {
|
1370 |
-
"branch-alias": {
|
1371 |
-
"dev-master": "4.4-dev"
|
1372 |
-
}
|
1373 |
-
},
|
1374 |
-
"autoload": {
|
1375 |
-
"psr-4": {
|
1376 |
-
"Symfony\\Component\\Yaml\\": ""
|
1377 |
-
},
|
1378 |
-
"exclude-from-classmap": [
|
1379 |
-
"/Tests/"
|
1380 |
-
]
|
1381 |
-
},
|
1382 |
-
"notification-url": "https://packagist.org/downloads/",
|
1383 |
-
"license": [
|
1384 |
-
"MIT"
|
1385 |
-
],
|
1386 |
-
"authors": [
|
1387 |
-
{
|
1388 |
-
"name": "Fabien Potencier",
|
1389 |
-
"email": "fabien@symfony.com"
|
1390 |
-
},
|
1391 |
-
{
|
1392 |
-
"name": "Symfony Community",
|
1393 |
-
"homepage": "https://symfony.com/contributors"
|
1394 |
-
}
|
1395 |
-
],
|
1396 |
-
"description": "Symfony Yaml Component",
|
1397 |
-
"homepage": "https://symfony.com",
|
1398 |
-
"time": "2020-01-21T11:12:16+00:00"
|
1399 |
-
},
|
1400 |
-
{
|
1401 |
-
"name": "webmozart/assert",
|
1402 |
-
"version": "1.6.0",
|
1403 |
-
"source": {
|
1404 |
-
"type": "git",
|
1405 |
-
"url": "https://github.com/webmozart/assert.git",
|
1406 |
-
"reference": "573381c0a64f155a0d9a23f4b0c797194805b925"
|
1407 |
-
},
|
1408 |
-
"dist": {
|
1409 |
-
"type": "zip",
|
1410 |
-
"url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925",
|
1411 |
-
"reference": "573381c0a64f155a0d9a23f4b0c797194805b925",
|
1412 |
-
"shasum": ""
|
1413 |
-
},
|
1414 |
-
"require": {
|
1415 |
-
"php": "^5.3.3 || ^7.0",
|
1416 |
-
"symfony/polyfill-ctype": "^1.8"
|
1417 |
-
},
|
1418 |
-
"conflict": {
|
1419 |
-
"vimeo/psalm": "<3.6.0"
|
1420 |
-
},
|
1421 |
-
"require-dev": {
|
1422 |
-
"phpunit/phpunit": "^4.8.36 || ^7.5.13"
|
1423 |
-
},
|
1424 |
-
"type": "library",
|
1425 |
-
"autoload": {
|
1426 |
-
"psr-4": {
|
1427 |
-
"Webmozart\\Assert\\": "src/"
|
1428 |
-
}
|
1429 |
-
},
|
1430 |
-
"notification-url": "https://packagist.org/downloads/",
|
1431 |
-
"license": [
|
1432 |
-
"MIT"
|
1433 |
-
],
|
1434 |
-
"authors": [
|
1435 |
-
{
|
1436 |
-
"name": "Bernhard Schussek",
|
1437 |
-
"email": "bschussek@gmail.com"
|
1438 |
-
}
|
1439 |
-
],
|
1440 |
-
"description": "Assertions to validate method input/output with nice error messages.",
|
1441 |
-
"keywords": [
|
1442 |
-
"assert",
|
1443 |
-
"check",
|
1444 |
-
"validate"
|
1445 |
-
],
|
1446 |
-
"time": "2019-11-24T13:36:37+00:00"
|
1447 |
-
}
|
1448 |
-
],
|
1449 |
-
"aliases": [],
|
1450 |
-
"minimum-stability": "stable",
|
1451 |
-
"stability-flags": [],
|
1452 |
-
"prefer-stable": false,
|
1453 |
-
"prefer-lowest": false,
|
1454 |
-
"platform": {
|
1455 |
-
"php": ">=5.5.0",
|
1456 |
-
"ext-curl": "*",
|
1457 |
-
"ext-json": "*"
|
1458 |
-
},
|
1459 |
-
"platform-dev": []
|
1460 |
-
}
|
1 |
+
{
|
2 |
+
"_readme": [
|
3 |
+
"This file locks the dependencies of your project to a known state",
|
4 |
+
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
5 |
+
"This file is @generated automatically"
|
6 |
+
],
|
7 |
+
"content-hash": "db604eedfdb2b905992cd201cf0a5b34",
|
8 |
+
"packages": [],
|
9 |
+
"packages-dev": [
|
10 |
+
{
|
11 |
+
"name": "doctrine/instantiator",
|
12 |
+
"version": "1.3.0",
|
13 |
+
"source": {
|
14 |
+
"type": "git",
|
15 |
+
"url": "https://github.com/doctrine/instantiator.git",
|
16 |
+
"reference": "ae466f726242e637cebdd526a7d991b9433bacf1"
|
17 |
+
},
|
18 |
+
"dist": {
|
19 |
+
"type": "zip",
|
20 |
+
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1",
|
21 |
+
"reference": "ae466f726242e637cebdd526a7d991b9433bacf1",
|
22 |
+
"shasum": ""
|
23 |
+
},
|
24 |
+
"require": {
|
25 |
+
"php": "^7.1"
|
26 |
+
},
|
27 |
+
"require-dev": {
|
28 |
+
"doctrine/coding-standard": "^6.0",
|
29 |
+
"ext-pdo": "*",
|
30 |
+
"ext-phar": "*",
|
31 |
+
"phpbench/phpbench": "^0.13",
|
32 |
+
"phpstan/phpstan-phpunit": "^0.11",
|
33 |
+
"phpstan/phpstan-shim": "^0.11",
|
34 |
+
"phpunit/phpunit": "^7.0"
|
35 |
+
},
|
36 |
+
"type": "library",
|
37 |
+
"extra": {
|
38 |
+
"branch-alias": {
|
39 |
+
"dev-master": "1.2.x-dev"
|
40 |
+
}
|
41 |
+
},
|
42 |
+
"autoload": {
|
43 |
+
"psr-4": {
|
44 |
+
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
|
45 |
+
}
|
46 |
+
},
|
47 |
+
"notification-url": "https://packagist.org/downloads/",
|
48 |
+
"license": [
|
49 |
+
"MIT"
|
50 |
+
],
|
51 |
+
"authors": [
|
52 |
+
{
|
53 |
+
"name": "Marco Pivetta",
|
54 |
+
"email": "ocramius@gmail.com",
|
55 |
+
"homepage": "http://ocramius.github.com/"
|
56 |
+
}
|
57 |
+
],
|
58 |
+
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
59 |
+
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
|
60 |
+
"keywords": [
|
61 |
+
"constructor",
|
62 |
+
"instantiate"
|
63 |
+
],
|
64 |
+
"time": "2019-10-21T16:45:58+00:00"
|
65 |
+
},
|
66 |
+
{
|
67 |
+
"name": "myclabs/deep-copy",
|
68 |
+
"version": "1.9.5",
|
69 |
+
"source": {
|
70 |
+
"type": "git",
|
71 |
+
"url": "https://github.com/myclabs/DeepCopy.git",
|
72 |
+
"reference": "b2c28789e80a97badd14145fda39b545d83ca3ef"
|
73 |
+
},
|
74 |
+
"dist": {
|
75 |
+
"type": "zip",
|
76 |
+
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef",
|
77 |
+
"reference": "b2c28789e80a97badd14145fda39b545d83ca3ef",
|
78 |
+
"shasum": ""
|
79 |
+
},
|
80 |
+
"require": {
|
81 |
+
"php": "^7.1"
|
82 |
+
},
|
83 |
+
"replace": {
|
84 |
+
"myclabs/deep-copy": "self.version"
|
85 |
+
},
|
86 |
+
"require-dev": {
|
87 |
+
"doctrine/collections": "^1.0",
|
88 |
+
"doctrine/common": "^2.6",
|
89 |
+
"phpunit/phpunit": "^7.1"
|
90 |
+
},
|
91 |
+
"type": "library",
|
92 |
+
"autoload": {
|
93 |
+
"psr-4": {
|
94 |
+
"DeepCopy\\": "src/DeepCopy/"
|
95 |
+
},
|
96 |
+
"files": [
|
97 |
+
"src/DeepCopy/deep_copy.php"
|
98 |
+
]
|
99 |
+
},
|
100 |
+
"notification-url": "https://packagist.org/downloads/",
|
101 |
+
"license": [
|
102 |
+
"MIT"
|
103 |
+
],
|
104 |
+
"description": "Create deep copies (clones) of your objects",
|
105 |
+
"keywords": [
|
106 |
+
"clone",
|
107 |
+
"copy",
|
108 |
+
"duplicate",
|
109 |
+
"object",
|
110 |
+
"object graph"
|
111 |
+
],
|
112 |
+
"time": "2020-01-17T21:11:47+00:00"
|
113 |
+
},
|
114 |
+
{
|
115 |
+
"name": "phpdocumentor/reflection-common",
|
116 |
+
"version": "2.0.0",
|
117 |
+
"source": {
|
118 |
+
"type": "git",
|
119 |
+
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
|
120 |
+
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a"
|
121 |
+
},
|
122 |
+
"dist": {
|
123 |
+
"type": "zip",
|
124 |
+
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a",
|
125 |
+
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a",
|
126 |
+
"shasum": ""
|
127 |
+
},
|
128 |
+
"require": {
|
129 |
+
"php": ">=7.1"
|
130 |
+
},
|
131 |
+
"require-dev": {
|
132 |
+
"phpunit/phpunit": "~6"
|
133 |
+
},
|
134 |
+
"type": "library",
|
135 |
+
"extra": {
|
136 |
+
"branch-alias": {
|
137 |
+
"dev-master": "2.x-dev"
|
138 |
+
}
|
139 |
+
},
|
140 |
+
"autoload": {
|
141 |
+
"psr-4": {
|
142 |
+
"phpDocumentor\\Reflection\\": "src/"
|
143 |
+
}
|
144 |
+
},
|
145 |
+
"notification-url": "https://packagist.org/downloads/",
|
146 |
+
"license": [
|
147 |
+
"MIT"
|
148 |
+
],
|
149 |
+
"authors": [
|
150 |
+
{
|
151 |
+
"name": "Jaap van Otterdijk",
|
152 |
+
"email": "opensource@ijaap.nl"
|
153 |
+
}
|
154 |
+
],
|
155 |
+
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
|
156 |
+
"homepage": "http://www.phpdoc.org",
|
157 |
+
"keywords": [
|
158 |
+
"FQSEN",
|
159 |
+
"phpDocumentor",
|
160 |
+
"phpdoc",
|
161 |
+
"reflection",
|
162 |
+
"static analysis"
|
163 |
+
],
|
164 |
+
"time": "2018-08-07T13:53:10+00:00"
|
165 |
+
},
|
166 |
+
{
|
167 |
+
"name": "phpdocumentor/reflection-docblock",
|
168 |
+
"version": "4.3.4",
|
169 |
+
"source": {
|
170 |
+
"type": "git",
|
171 |
+
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
172 |
+
"reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c"
|
173 |
+
},
|
174 |
+
"dist": {
|
175 |
+
"type": "zip",
|
176 |
+
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c",
|
177 |
+
"reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c",
|
178 |
+
"shasum": ""
|
179 |
+
},
|
180 |
+
"require": {
|
181 |
+
"php": "^7.0",
|
182 |
+
"phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0",
|
183 |
+
"phpdocumentor/type-resolver": "~0.4 || ^1.0.0",
|
184 |
+
"webmozart/assert": "^1.0"
|
185 |
+
},
|
186 |
+
"require-dev": {
|
187 |
+
"doctrine/instantiator": "^1.0.5",
|
188 |
+
"mockery/mockery": "^1.0",
|
189 |
+
"phpdocumentor/type-resolver": "0.4.*",
|
190 |
+
"phpunit/phpunit": "^6.4"
|
191 |
+
},
|
192 |
+
"type": "library",
|
193 |
+
"extra": {
|
194 |
+
"branch-alias": {
|
195 |
+
"dev-master": "4.x-dev"
|
196 |
+
}
|
197 |
+
},
|
198 |
+
"autoload": {
|
199 |
+
"psr-4": {
|
200 |
+
"phpDocumentor\\Reflection\\": [
|
201 |
+
"src/"
|
202 |
+
]
|
203 |
+
}
|
204 |
+
},
|
205 |
+
"notification-url": "https://packagist.org/downloads/",
|
206 |
+
"license": [
|
207 |
+
"MIT"
|
208 |
+
],
|
209 |
+
"authors": [
|
210 |
+
{
|
211 |
+
"name": "Mike van Riel",
|
212 |
+
"email": "me@mikevanriel.com"
|
213 |
+
}
|
214 |
+
],
|
215 |
+
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
216 |
+
"time": "2019-12-28T18:55:12+00:00"
|
217 |
+
},
|
218 |
+
{
|
219 |
+
"name": "phpdocumentor/type-resolver",
|
220 |
+
"version": "1.0.1",
|
221 |
+
"source": {
|
222 |
+
"type": "git",
|
223 |
+
"url": "https://github.com/phpDocumentor/TypeResolver.git",
|
224 |
+
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9"
|
225 |
+
},
|
226 |
+
"dist": {
|
227 |
+
"type": "zip",
|
228 |
+
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
|
229 |
+
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
|
230 |
+
"shasum": ""
|
231 |
+
},
|
232 |
+
"require": {
|
233 |
+
"php": "^7.1",
|
234 |
+
"phpdocumentor/reflection-common": "^2.0"
|
235 |
+
},
|
236 |
+
"require-dev": {
|
237 |
+
"ext-tokenizer": "^7.1",
|
238 |
+
"mockery/mockery": "~1",
|
239 |
+
"phpunit/phpunit": "^7.0"
|
240 |
+
},
|
241 |
+
"type": "library",
|
242 |
+
"extra": {
|
243 |
+
"branch-alias": {
|
244 |
+
"dev-master": "1.x-dev"
|
245 |
+
}
|
246 |
+
},
|
247 |
+
"autoload": {
|
248 |
+
"psr-4": {
|
249 |
+
"phpDocumentor\\Reflection\\": "src"
|
250 |
+
}
|
251 |
+
},
|
252 |
+
"notification-url": "https://packagist.org/downloads/",
|
253 |
+
"license": [
|
254 |
+
"MIT"
|
255 |
+
],
|
256 |
+
"authors": [
|
257 |
+
{
|
258 |
+
"name": "Mike van Riel",
|
259 |
+
"email": "me@mikevanriel.com"
|
260 |
+
}
|
261 |
+
],
|
262 |
+
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
|
263 |
+
"time": "2019-08-22T18:11:29+00:00"
|
264 |
+
},
|
265 |
+
{
|
266 |
+
"name": "phpspec/prophecy",
|
267 |
+
"version": "v1.10.2",
|
268 |
+
"source": {
|
269 |
+
"type": "git",
|
270 |
+
"url": "https://github.com/phpspec/prophecy.git",
|
271 |
+
"reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9"
|
272 |
+
},
|
273 |
+
"dist": {
|
274 |
+
"type": "zip",
|
275 |
+
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/b4400efc9d206e83138e2bb97ed7f5b14b831cd9",
|
276 |
+
"reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9",
|
277 |
+
"shasum": ""
|
278 |
+
},
|
279 |
+
"require": {
|
280 |
+
"doctrine/instantiator": "^1.0.2",
|
281 |
+
"php": "^5.3|^7.0",
|
282 |
+
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0",
|
283 |
+
"sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0",
|
284 |
+
"sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0"
|
285 |
+
},
|
286 |
+
"require-dev": {
|
287 |
+
"phpspec/phpspec": "^2.5 || ^3.2",
|
288 |
+
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1"
|
289 |
+
},
|
290 |
+
"type": "library",
|
291 |
+
"extra": {
|
292 |
+
"branch-alias": {
|
293 |
+
"dev-master": "1.10.x-dev"
|
294 |
+
}
|
295 |
+
},
|
296 |
+
"autoload": {
|
297 |
+
"psr-4": {
|
298 |
+
"Prophecy\\": "src/Prophecy"
|
299 |
+
}
|
300 |
+
},
|
301 |
+
"notification-url": "https://packagist.org/downloads/",
|
302 |
+
"license": [
|
303 |
+
"MIT"
|
304 |
+
],
|
305 |
+
"authors": [
|
306 |
+
{
|
307 |
+
"name": "Konstantin Kudryashov",
|
308 |
+
"email": "ever.zet@gmail.com",
|
309 |
+
"homepage": "http://everzet.com"
|
310 |
+
},
|
311 |
+
{
|
312 |
+
"name": "Marcello Duarte",
|
313 |
+
"email": "marcello.duarte@gmail.com"
|
314 |
+
}
|
315 |
+
],
|
316 |
+
"description": "Highly opinionated mocking framework for PHP 5.3+",
|
317 |
+
"homepage": "https://github.com/phpspec/prophecy",
|
318 |
+
"keywords": [
|
319 |
+
"Double",
|
320 |
+
"Dummy",
|
321 |
+
"fake",
|
322 |
+
"mock",
|
323 |
+
"spy",
|
324 |
+
"stub"
|
325 |
+
],
|
326 |
+
"time": "2020-01-20T15:57:02+00:00"
|
327 |
+
},
|
328 |
+
{
|
329 |
+
"name": "phpunit/php-code-coverage",
|
330 |
+
"version": "4.0.8",
|
331 |
+
"source": {
|
332 |
+
"type": "git",
|
333 |
+
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
334 |
+
"reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d"
|
335 |
+
},
|
336 |
+
"dist": {
|
337 |
+
"type": "zip",
|
338 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d",
|
339 |
+
"reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d",
|
340 |
+
"shasum": ""
|
341 |
+
},
|
342 |
+
"require": {
|
343 |
+
"ext-dom": "*",
|
344 |
+
"ext-xmlwriter": "*",
|
345 |
+
"php": "^5.6 || ^7.0",
|
346 |
+
"phpunit/php-file-iterator": "^1.3",
|
347 |
+
"phpunit/php-text-template": "^1.2",
|
348 |
+
"phpunit/php-token-stream": "^1.4.2 || ^2.0",
|
349 |
+
"sebastian/code-unit-reverse-lookup": "^1.0",
|
350 |
+
"sebastian/environment": "^1.3.2 || ^2.0",
|
351 |
+
"sebastian/version": "^1.0 || ^2.0"
|
352 |
+
},
|
353 |
+
"require-dev": {
|
354 |
+
"ext-xdebug": "^2.1.4",
|
355 |
+
"phpunit/phpunit": "^5.7"
|
356 |
+
},
|
357 |
+
"suggest": {
|
358 |
+
"ext-xdebug": "^2.5.1"
|
359 |
+
},
|
360 |
+
"type": "library",
|
361 |
+
"extra": {
|
362 |
+
"branch-alias": {
|
363 |
+
"dev-master": "4.0.x-dev"
|
364 |
+
}
|
365 |
+
},
|
366 |
+
"autoload": {
|
367 |
+
"classmap": [
|
368 |
+
"src/"
|
369 |
+
]
|
370 |
+
},
|
371 |
+
"notification-url": "https://packagist.org/downloads/",
|
372 |
+
"license": [
|
373 |
+
"BSD-3-Clause"
|
374 |
+
],
|
375 |
+
"authors": [
|
376 |
+
{
|
377 |
+
"name": "Sebastian Bergmann",
|
378 |
+
"email": "sb@sebastian-bergmann.de",
|
379 |
+
"role": "lead"
|
380 |
+
}
|
381 |
+
],
|
382 |
+
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
|
383 |
+
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
|
384 |
+
"keywords": [
|
385 |
+
"coverage",
|
386 |
+
"testing",
|
387 |
+
"xunit"
|
388 |
+
],
|
389 |
+
"time": "2017-04-02T07:44:40+00:00"
|
390 |
+
},
|
391 |
+
{
|
392 |
+
"name": "phpunit/php-file-iterator",
|
393 |
+
"version": "1.4.5",
|
394 |
+
"source": {
|
395 |
+
"type": "git",
|
396 |
+
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
397 |
+
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4"
|
398 |
+
},
|
399 |
+
"dist": {
|
400 |
+
"type": "zip",
|
401 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4",
|
402 |
+
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4",
|
403 |
+
"shasum": ""
|
404 |
+
},
|
405 |
+
"require": {
|
406 |
+
"php": ">=5.3.3"
|
407 |
+
},
|
408 |
+
"type": "library",
|
409 |
+
"extra": {
|
410 |
+
"branch-alias": {
|
411 |
+
"dev-master": "1.4.x-dev"
|
412 |
+
}
|
413 |
+
},
|
414 |
+
"autoload": {
|
415 |
+
"classmap": [
|
416 |
+
"src/"
|
417 |
+
]
|
418 |
+
},
|
419 |
+
"notification-url": "https://packagist.org/downloads/",
|
420 |
+
"license": [
|
421 |
+
"BSD-3-Clause"
|
422 |
+
],
|
423 |
+
"authors": [
|
424 |
+
{
|
425 |
+
"name": "Sebastian Bergmann",
|
426 |
+
"email": "sb@sebastian-bergmann.de",
|
427 |
+
"role": "lead"
|
428 |
+
}
|
429 |
+
],
|
430 |
+
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
|
431 |
+
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
|
432 |
+
"keywords": [
|
433 |
+
"filesystem",
|
434 |
+
"iterator"
|
435 |
+
],
|
436 |
+
"time": "2017-11-27T13:52:08+00:00"
|
437 |
+
},
|
438 |
+
{
|
439 |
+
"name": "phpunit/php-text-template",
|
440 |
+
"version": "1.2.1",
|
441 |
+
"source": {
|
442 |
+
"type": "git",
|
443 |
+
"url": "https://github.com/sebastianbergmann/php-text-template.git",
|
444 |
+
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
|
445 |
+
},
|
446 |
+
"dist": {
|
447 |
+
"type": "zip",
|
448 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
|
449 |
+
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
|
450 |
+
"shasum": ""
|
451 |
+
},
|
452 |
+
"require": {
|
453 |
+
"php": ">=5.3.3"
|
454 |
+
},
|
455 |
+
"type": "library",
|
456 |
+
"autoload": {
|
457 |
+
"classmap": [
|
458 |
+
"src/"
|
459 |
+
]
|
460 |
+
},
|
461 |
+
"notification-url": "https://packagist.org/downloads/",
|
462 |
+
"license": [
|
463 |
+
"BSD-3-Clause"
|
464 |
+
],
|
465 |
+
"authors": [
|
466 |
+
{
|
467 |
+
"name": "Sebastian Bergmann",
|
468 |
+
"email": "sebastian@phpunit.de",
|
469 |
+
"role": "lead"
|
470 |
+
}
|
471 |
+
],
|
472 |
+
"description": "Simple template engine.",
|
473 |
+
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
|
474 |
+
"keywords": [
|
475 |
+
"template"
|
476 |
+
],
|
477 |
+
"time": "2015-06-21T13:50:34+00:00"
|
478 |
+
},
|
479 |
+
{
|
480 |
+
"name": "phpunit/php-timer",
|
481 |
+
"version": "1.0.9",
|
482 |
+
"source": {
|
483 |
+
"type": "git",
|
484 |
+
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
485 |
+
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f"
|
486 |
+
},
|
487 |
+
"dist": {
|
488 |
+
"type": "zip",
|
489 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
|
490 |
+
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
|
491 |
+
"shasum": ""
|
492 |
+
},
|
493 |
+
"require": {
|
494 |
+
"php": "^5.3.3 || ^7.0"
|
495 |
+
},
|
496 |
+
"require-dev": {
|
497 |
+
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
|
498 |
+
},
|
499 |
+
"type": "library",
|
500 |
+
"extra": {
|
501 |
+
"branch-alias": {
|
502 |
+
"dev-master": "1.0-dev"
|
503 |
+
}
|
504 |
+
},
|
505 |
+
"autoload": {
|
506 |
+
"classmap": [
|
507 |
+
"src/"
|
508 |
+
]
|
509 |
+
},
|
510 |
+
"notification-url": "https://packagist.org/downloads/",
|
511 |
+
"license": [
|
512 |
+
"BSD-3-Clause"
|
513 |
+
],
|
514 |
+
"authors": [
|
515 |
+
{
|
516 |
+
"name": "Sebastian Bergmann",
|
517 |
+
"email": "sb@sebastian-bergmann.de",
|
518 |
+
"role": "lead"
|
519 |
+
}
|
520 |
+
],
|
521 |
+
"description": "Utility class for timing",
|
522 |
+
"homepage": "https://github.com/sebastianbergmann/php-timer/",
|
523 |
+
"keywords": [
|
524 |
+
"timer"
|
525 |
+
],
|
526 |
+
"time": "2017-02-26T11:10:40+00:00"
|
527 |
+
},
|
528 |
+
{
|
529 |
+
"name": "phpunit/php-token-stream",
|
530 |
+
"version": "2.0.2",
|
531 |
+
"source": {
|
532 |
+
"type": "git",
|
533 |
+
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
534 |
+
"reference": "791198a2c6254db10131eecfe8c06670700904db"
|
535 |
+
},
|
536 |
+
"dist": {
|
537 |
+
"type": "zip",
|
538 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db",
|
539 |
+
"reference": "791198a2c6254db10131eecfe8c06670700904db",
|
540 |
+
"shasum": ""
|
541 |
+
},
|
542 |
+
"require": {
|
543 |
+
"ext-tokenizer": "*",
|
544 |
+
"php": "^7.0"
|
545 |
+
},
|
546 |
+
"require-dev": {
|
547 |
+
"phpunit/phpunit": "^6.2.4"
|
548 |
+
},
|
549 |
+
"type": "library",
|
550 |
+
"extra": {
|
551 |
+
"branch-alias": {
|
552 |
+
"dev-master": "2.0-dev"
|
553 |
+
}
|
554 |
+
},
|
555 |
+
"autoload": {
|
556 |
+
"classmap": [
|
557 |
+
"src/"
|
558 |
+
]
|
559 |
+
},
|
560 |
+
"notification-url": "https://packagist.org/downloads/",
|
561 |
+
"license": [
|
562 |
+
"BSD-3-Clause"
|
563 |
+
],
|
564 |
+
"authors": [
|
565 |
+
{
|
566 |
+
"name": "Sebastian Bergmann",
|
567 |
+
"email": "sebastian@phpunit.de"
|
568 |
+
}
|
569 |
+
],
|
570 |
+
"description": "Wrapper around PHP's tokenizer extension.",
|
571 |
+
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
|
572 |
+
"keywords": [
|
573 |
+
"tokenizer"
|
574 |
+
],
|
575 |
+
"time": "2017-11-27T05:48:46+00:00"
|
576 |
+
},
|
577 |
+
{
|
578 |
+
"name": "phpunit/phpunit",
|
579 |
+
"version": "5.7.27",
|
580 |
+
"source": {
|
581 |
+
"type": "git",
|
582 |
+
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
583 |
+
"reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c"
|
584 |
+
},
|
585 |
+
"dist": {
|
586 |
+
"type": "zip",
|
587 |
+
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c",
|
588 |
+
"reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c",
|
589 |
+
"shasum": ""
|
590 |
+
},
|
591 |
+
"require": {
|
592 |
+
"ext-dom": "*",
|
593 |
+
"ext-json": "*",
|
594 |
+
"ext-libxml": "*",
|
595 |
+
"ext-mbstring": "*",
|
596 |
+
"ext-xml": "*",
|
597 |
+
"myclabs/deep-copy": "~1.3",
|
598 |
+
"php": "^5.6 || ^7.0",
|
599 |
+
"phpspec/prophecy": "^1.6.2",
|
600 |
+
"phpunit/php-code-coverage": "^4.0.4",
|
601 |
+
"phpunit/php-file-iterator": "~1.4",
|
602 |
+
"phpunit/php-text-template": "~1.2",
|
603 |
+
"phpunit/php-timer": "^1.0.6",
|
604 |
+
"phpunit/phpunit-mock-objects": "^3.2",
|
605 |
+
"sebastian/comparator": "^1.2.4",
|
606 |
+
"sebastian/diff": "^1.4.3",
|
607 |
+
"sebastian/environment": "^1.3.4 || ^2.0",
|
608 |
+
"sebastian/exporter": "~2.0",
|
609 |
+
"sebastian/global-state": "^1.1",
|
610 |
+
"sebastian/object-enumerator": "~2.0",
|
611 |
+
"sebastian/resource-operations": "~1.0",
|
612 |
+
"sebastian/version": "^1.0.6|^2.0.1",
|
613 |
+
"symfony/yaml": "~2.1|~3.0|~4.0"
|
614 |
+
},
|
615 |
+
"conflict": {
|
616 |
+
"phpdocumentor/reflection-docblock": "3.0.2"
|
617 |
+
},
|
618 |
+
"require-dev": {
|
619 |
+
"ext-pdo": "*"
|
620 |
+
},
|
621 |
+
"suggest": {
|
622 |
+
"ext-xdebug": "*",
|
623 |
+
"phpunit/php-invoker": "~1.1"
|
624 |
+
},
|
625 |
+
"bin": [
|
626 |
+
"phpunit"
|
627 |
+
],
|
628 |
+
"type": "library",
|
629 |
+
"extra": {
|
630 |
+
"branch-alias": {
|
631 |
+
"dev-master": "5.7.x-dev"
|
632 |
+
}
|
633 |
+
},
|
634 |
+
"autoload": {
|
635 |
+
"classmap": [
|
636 |
+
"src/"
|
637 |
+
]
|
638 |
+
},
|
639 |
+
"notification-url": "https://packagist.org/downloads/",
|
640 |
+
"license": [
|
641 |
+
"BSD-3-Clause"
|
642 |
+
],
|
643 |
+
"authors": [
|
644 |
+
{
|
645 |
+
"name": "Sebastian Bergmann",
|
646 |
+
"email": "sebastian@phpunit.de",
|
647 |
+
"role": "lead"
|
648 |
+
}
|
649 |
+
],
|
650 |
+
"description": "The PHP Unit Testing framework.",
|
651 |
+
"homepage": "https://phpunit.de/",
|
652 |
+
"keywords": [
|
653 |
+
"phpunit",
|
654 |
+
"testing",
|
655 |
+
"xunit"
|
656 |
+
],
|
657 |
+
"time": "2018-02-01T05:50:59+00:00"
|
658 |
+
},
|
659 |
+
{
|
660 |
+
"name": "phpunit/phpunit-mock-objects",
|
661 |
+
"version": "3.4.4",
|
662 |
+
"source": {
|
663 |
+
"type": "git",
|
664 |
+
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
665 |
+
"reference": "a23b761686d50a560cc56233b9ecf49597cc9118"
|
666 |
+
},
|
667 |
+
"dist": {
|
668 |
+
"type": "zip",
|
669 |
+
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118",
|
670 |
+
"reference": "a23b761686d50a560cc56233b9ecf49597cc9118",
|
671 |
+
"shasum": ""
|
672 |
+
},
|
673 |
+
"require": {
|
674 |
+
"doctrine/instantiator": "^1.0.2",
|
675 |
+
"php": "^5.6 || ^7.0",
|
676 |
+
"phpunit/php-text-template": "^1.2",
|
677 |
+
"sebastian/exporter": "^1.2 || ^2.0"
|
678 |
+
},
|
679 |
+
"conflict": {
|
680 |
+
"phpunit/phpunit": "<5.4.0"
|
681 |
+
},
|
682 |
+
"require-dev": {
|
683 |
+
"phpunit/phpunit": "^5.4"
|
684 |
+
},
|
685 |
+
"suggest": {
|
686 |
+
"ext-soap": "*"
|
687 |
+
},
|
688 |
+
"type": "library",
|
689 |
+
"extra": {
|
690 |
+
"branch-alias": {
|
691 |
+
"dev-master": "3.2.x-dev"
|
692 |
+
}
|
693 |
+
},
|
694 |
+
"autoload": {
|
695 |
+
"classmap": [
|
696 |
+
"src/"
|
697 |
+
]
|
698 |
+
},
|
699 |
+
"notification-url": "https://packagist.org/downloads/",
|
700 |
+
"license": [
|
701 |
+
"BSD-3-Clause"
|
702 |
+
],
|
703 |
+
"authors": [
|
704 |
+
{
|
705 |
+
"name": "Sebastian Bergmann",
|
706 |
+
"email": "sb@sebastian-bergmann.de",
|
707 |
+
"role": "lead"
|
708 |
+
}
|
709 |
+
],
|
710 |
+
"description": "Mock Object library for PHPUnit",
|
711 |
+
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
|
712 |
+
"keywords": [
|
713 |
+
"mock",
|
714 |
+
"xunit"
|
715 |
+
],
|
716 |
+
"abandoned": true,
|
717 |
+
"time": "2017-06-30T09:13:00+00:00"
|
718 |
+
},
|
719 |
+
{
|
720 |
+
"name": "sebastian/code-unit-reverse-lookup",
|
721 |
+
"version": "1.0.1",
|
722 |
+
"source": {
|
723 |
+
"type": "git",
|
724 |
+
"url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
|
725 |
+
"reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18"
|
726 |
+
},
|
727 |
+
"dist": {
|
728 |
+
"type": "zip",
|
729 |
+
"url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
|
730 |
+
"reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
|
731 |
+
"shasum": ""
|
732 |
+
},
|
733 |
+
"require": {
|
734 |
+
"php": "^5.6 || ^7.0"
|
735 |
+
},
|
736 |
+
"require-dev": {
|
737 |
+
"phpunit/phpunit": "^5.7 || ^6.0"
|
738 |
+
},
|
739 |
+
"type": "library",
|
740 |
+
"extra": {
|
741 |
+
"branch-alias": {
|
742 |
+
"dev-master": "1.0.x-dev"
|
743 |
+
}
|
744 |
+
},
|
745 |
+
"autoload": {
|
746 |
+
"classmap": [
|
747 |
+
"src/"
|
748 |
+
]
|
749 |
+
},
|
750 |
+
"notification-url": "https://packagist.org/downloads/",
|
751 |
+
"license": [
|
752 |
+
"BSD-3-Clause"
|
753 |
+
],
|
754 |
+
"authors": [
|
755 |
+
{
|
756 |
+
"name": "Sebastian Bergmann",
|
757 |
+
"email": "sebastian@phpunit.de"
|
758 |
+
}
|
759 |
+
],
|
760 |
+
"description": "Looks up which function or method a line of code belongs to",
|
761 |
+
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
|
762 |
+
"time": "2017-03-04T06:30:41+00:00"
|
763 |
+
},
|
764 |
+
{
|
765 |
+
"name": "sebastian/comparator",
|
766 |
+
"version": "1.2.4",
|
767 |
+
"source": {
|
768 |
+
"type": "git",
|
769 |
+
"url": "https://github.com/sebastianbergmann/comparator.git",
|
770 |
+
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be"
|
771 |
+
},
|
772 |
+
"dist": {
|
773 |
+
"type": "zip",
|
774 |
+
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
|
775 |
+
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
|
776 |
+
"shasum": ""
|
777 |
+
},
|
778 |
+
"require": {
|
779 |
+
"php": ">=5.3.3",
|
780 |
+
"sebastian/diff": "~1.2",
|
781 |
+
"sebastian/exporter": "~1.2 || ~2.0"
|
782 |
+
},
|
783 |
+
"require-dev": {
|
784 |
+
"phpunit/phpunit": "~4.4"
|
785 |
+
},
|
786 |
+
"type": "library",
|
787 |
+
"extra": {
|
788 |
+
"branch-alias": {
|
789 |
+
"dev-master": "1.2.x-dev"
|
790 |
+
}
|
791 |
+
},
|
792 |
+
"autoload": {
|
793 |
+
"classmap": [
|
794 |
+
"src/"
|
795 |
+
]
|
796 |
+
},
|
797 |
+
"notification-url": "https://packagist.org/downloads/",
|
798 |
+
"license": [
|
799 |
+
"BSD-3-Clause"
|
800 |
+
],
|
801 |
+
"authors": [
|
802 |
+
{
|
803 |
+
"name": "Jeff Welch",
|
804 |
+
"email": "whatthejeff@gmail.com"
|
805 |
+
},
|
806 |
+
{
|
807 |
+
"name": "Volker Dusch",
|
808 |
+
"email": "github@wallbash.com"
|
809 |
+
},
|
810 |
+
{
|
811 |
+
"name": "Bernhard Schussek",
|
812 |
+
"email": "bschussek@2bepublished.at"
|
813 |
+
},
|
814 |
+
{
|
815 |
+
"name": "Sebastian Bergmann",
|
816 |
+
"email": "sebastian@phpunit.de"
|
817 |
+
}
|
818 |
+
],
|
819 |
+
"description": "Provides the functionality to compare PHP values for equality",
|
820 |
+
"homepage": "http://www.github.com/sebastianbergmann/comparator",
|
821 |
+
"keywords": [
|
822 |
+
"comparator",
|
823 |
+
"compare",
|
824 |
+
"equality"
|
825 |
+
],
|
826 |
+
"time": "2017-01-29T09:50:25+00:00"
|
827 |
+
},
|
828 |
+
{
|
829 |
+
"name": "sebastian/diff",
|
830 |
+
"version": "1.4.3",
|
831 |
+
"source": {
|
832 |
+
"type": "git",
|
833 |
+
"url": "https://github.com/sebastianbergmann/diff.git",
|
834 |
+
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4"
|
835 |
+
},
|
836 |
+
"dist": {
|
837 |
+
"type": "zip",
|
838 |
+
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4",
|
839 |
+
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4",
|
840 |
+
"shasum": ""
|
841 |
+
},
|
842 |
+
"require": {
|
843 |
+
"php": "^5.3.3 || ^7.0"
|
844 |
+
},
|
845 |
+
"require-dev": {
|
846 |
+
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
|
847 |
+
},
|
848 |
+
"type": "library",
|
849 |
+
"extra": {
|
850 |
+
"branch-alias": {
|
851 |
+
"dev-master": "1.4-dev"
|
852 |
+
}
|
853 |
+
},
|
854 |
+
"autoload": {
|
855 |
+
"classmap": [
|
856 |
+
"src/"
|
857 |
+
]
|
858 |
+
},
|
859 |
+
"notification-url": "https://packagist.org/downloads/",
|
860 |
+
"license": [
|
861 |
+
"BSD-3-Clause"
|
862 |
+
],
|
863 |
+
"authors": [
|
864 |
+
{
|
865 |
+
"name": "Kore Nordmann",
|
866 |
+
"email": "mail@kore-nordmann.de"
|
867 |
+
},
|
868 |
+
{
|
869 |
+
"name": "Sebastian Bergmann",
|
870 |
+
"email": "sebastian@phpunit.de"
|
871 |
+
}
|
872 |
+
],
|
873 |
+
"description": "Diff implementation",
|
874 |
+
"homepage": "https://github.com/sebastianbergmann/diff",
|
875 |
+
"keywords": [
|
876 |
+
"diff"
|
877 |
+
],
|
878 |
+
"time": "2017-05-22T07:24:03+00:00"
|
879 |
+
},
|
880 |
+
{
|
881 |
+
"name": "sebastian/environment",
|
882 |
+
"version": "2.0.0",
|
883 |
+
"source": {
|
884 |
+
"type": "git",
|
885 |
+
"url": "https://github.com/sebastianbergmann/environment.git",
|
886 |
+
"reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac"
|
887 |
+
},
|
888 |
+
"dist": {
|
889 |
+
"type": "zip",
|
890 |
+
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
|
891 |
+
"reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
|
892 |
+
"shasum": ""
|
893 |
+
},
|
894 |
+
"require": {
|
895 |
+
"php": "^5.6 || ^7.0"
|
896 |
+
},
|
897 |
+
"require-dev": {
|
898 |
+
"phpunit/phpunit": "^5.0"
|
899 |
+
},
|
900 |
+
"type": "library",
|
901 |
+
"extra": {
|
902 |
+
"branch-alias": {
|
903 |
+
"dev-master": "2.0.x-dev"
|
904 |
+
}
|
905 |
+
},
|
906 |
+
"autoload": {
|
907 |
+
"classmap": [
|
908 |
+
"src/"
|
909 |
+
]
|
910 |
+
},
|
911 |
+
"notification-url": "https://packagist.org/downloads/",
|
912 |
+
"license": [
|
913 |
+
"BSD-3-Clause"
|
914 |
+
],
|
915 |
+
"authors": [
|
916 |
+
{
|
917 |
+
"name": "Sebastian Bergmann",
|
918 |
+
"email": "sebastian@phpunit.de"
|
919 |
+
}
|
920 |
+
],
|
921 |
+
"description": "Provides functionality to handle HHVM/PHP environments",
|
922 |
+
"homepage": "http://www.github.com/sebastianbergmann/environment",
|
923 |
+
"keywords": [
|
924 |
+
"Xdebug",
|
925 |
+
"environment",
|
926 |
+
"hhvm"
|
927 |
+
],
|
928 |
+
"time": "2016-11-26T07:53:53+00:00"
|
929 |
+
},
|
930 |
+
{
|
931 |
+
"name": "sebastian/exporter",
|
932 |
+
"version": "2.0.0",
|
933 |
+
"source": {
|
934 |
+
"type": "git",
|
935 |
+
"url": "https://github.com/sebastianbergmann/exporter.git",
|
936 |
+
"reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4"
|
937 |
+
},
|
938 |
+
"dist": {
|
939 |
+
"type": "zip",
|
940 |
+
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
|
941 |
+
"reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
|
942 |
+
"shasum": ""
|
943 |
+
},
|
944 |
+
"require": {
|
945 |
+
"php": ">=5.3.3",
|
946 |
+
"sebastian/recursion-context": "~2.0"
|
947 |
+
},
|
948 |
+
"require-dev": {
|
949 |
+
"ext-mbstring": "*",
|
950 |
+
"phpunit/phpunit": "~4.4"
|
951 |
+
},
|
952 |
+
"type": "library",
|
953 |
+
"extra": {
|
954 |
+
"branch-alias": {
|
955 |
+
"dev-master": "2.0.x-dev"
|
956 |
+
}
|
957 |
+
},
|
958 |
+
"autoload": {
|
959 |
+
"classmap": [
|
960 |
+
"src/"
|
961 |
+
]
|
962 |
+
},
|
963 |
+
"notification-url": "https://packagist.org/downloads/",
|
964 |
+
"license": [
|
965 |
+
"BSD-3-Clause"
|
966 |
+
],
|
967 |
+
"authors": [
|
968 |
+
{
|
969 |
+
"name": "Jeff Welch",
|
970 |
+
"email": "whatthejeff@gmail.com"
|
971 |
+
},
|
972 |
+
{
|
973 |
+
"name": "Volker Dusch",
|
974 |
+
"email": "github@wallbash.com"
|
975 |
+
},
|
976 |
+
{
|
977 |
+
"name": "Bernhard Schussek",
|
978 |
+
"email": "bschussek@2bepublished.at"
|
979 |
+
},
|
980 |
+
{
|
981 |
+
"name": "Sebastian Bergmann",
|
982 |
+
"email": "sebastian@phpunit.de"
|
983 |
+
},
|
984 |
+
{
|
985 |
+
"name": "Adam Harvey",
|
986 |
+
"email": "aharvey@php.net"
|
987 |
+
}
|
988 |
+
],
|
989 |
+
"description": "Provides the functionality to export PHP variables for visualization",
|
990 |
+
"homepage": "http://www.github.com/sebastianbergmann/exporter",
|
991 |
+
"keywords": [
|
992 |
+
"export",
|
993 |
+
"exporter"
|
994 |
+
],
|
995 |
+
"time": "2016-11-19T08:54:04+00:00"
|
996 |
+
},
|
997 |
+
{
|
998 |
+
"name": "sebastian/global-state",
|
999 |
+
"version": "1.1.1",
|
1000 |
+
"source": {
|
1001 |
+
"type": "git",
|
1002 |
+
"url": "https://github.com/sebastianbergmann/global-state.git",
|
1003 |
+
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
|
1004 |
+
},
|
1005 |
+
"dist": {
|
1006 |
+
"type": "zip",
|
1007 |
+
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
|
1008 |
+
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
|
1009 |
+
"shasum": ""
|
1010 |
+
},
|
1011 |
+
"require": {
|
1012 |
+
"php": ">=5.3.3"
|
1013 |
+
},
|
1014 |
+
"require-dev": {
|
1015 |
+
"phpunit/phpunit": "~4.2"
|
1016 |
+
},
|
1017 |
+
"suggest": {
|
1018 |
+
"ext-uopz": "*"
|
1019 |
+
},
|
1020 |
+
"type": "library",
|
1021 |
+
"extra": {
|
1022 |
+
"branch-alias": {
|
1023 |
+
"dev-master": "1.0-dev"
|
1024 |
+
}
|
1025 |
+
},
|
1026 |
+
"autoload": {
|
1027 |
+
"classmap": [
|
1028 |
+
"src/"
|
1029 |
+
]
|
1030 |
+
},
|
1031 |
+
"notification-url": "https://packagist.org/downloads/",
|
1032 |
+
"license": [
|
1033 |
+
"BSD-3-Clause"
|
1034 |
+
],
|
1035 |
+
"authors": [
|
1036 |
+
{
|
1037 |
+
"name": "Sebastian Bergmann",
|
1038 |
+
"email": "sebastian@phpunit.de"
|
1039 |
+
}
|
1040 |
+
],
|
1041 |
+
"description": "Snapshotting of global state",
|
1042 |
+
"homepage": "http://www.github.com/sebastianbergmann/global-state",
|
1043 |
+
"keywords": [
|
1044 |
+
"global state"
|
1045 |
+
],
|
1046 |
+
"time": "2015-10-12T03:26:01+00:00"
|
1047 |
+
},
|
1048 |
+
{
|
1049 |
+
"name": "sebastian/object-enumerator",
|
1050 |
+
"version": "2.0.1",
|
1051 |
+
"source": {
|
1052 |
+
"type": "git",
|
1053 |
+
"url": "https://github.com/sebastianbergmann/object-enumerator.git",
|
1054 |
+
"reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7"
|
1055 |
+
},
|
1056 |
+
"dist": {
|
1057 |
+
"type": "zip",
|
1058 |
+
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7",
|
1059 |
+
"reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7",
|
1060 |
+
"shasum": ""
|
1061 |
+
},
|
1062 |
+
"require": {
|
1063 |
+
"php": ">=5.6",
|
1064 |
+
"sebastian/recursion-context": "~2.0"
|
1065 |
+
},
|
1066 |
+
"require-dev": {
|
1067 |
+
"phpunit/phpunit": "~5"
|
1068 |
+
},
|
1069 |
+
"type": "library",
|
1070 |
+
"extra": {
|
1071 |
+
"branch-alias": {
|
1072 |
+
"dev-master": "2.0.x-dev"
|
1073 |
+
}
|
1074 |
+
},
|
1075 |
+
"autoload": {
|
1076 |
+
"classmap": [
|
1077 |
+
"src/"
|
1078 |
+
]
|
1079 |
+
},
|
1080 |
+
"notification-url": "https://packagist.org/downloads/",
|
1081 |
+
"license": [
|
1082 |
+
"BSD-3-Clause"
|
1083 |
+
],
|
1084 |
+
"authors": [
|
1085 |
+
{
|
1086 |
+
"name": "Sebastian Bergmann",
|
1087 |
+
"email": "sebastian@phpunit.de"
|
1088 |
+
}
|
1089 |
+
],
|
1090 |
+
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
|
1091 |
+
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
|
1092 |
+
"time": "2017-02-18T15:18:39+00:00"
|
1093 |
+
},
|
1094 |
+
{
|
1095 |
+
"name": "sebastian/recursion-context",
|
1096 |
+
"version": "2.0.0",
|
1097 |
+
"source": {
|
1098 |
+
"type": "git",
|
1099 |
+
"url": "https://github.com/sebastianbergmann/recursion-context.git",
|
1100 |
+
"reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a"
|
1101 |
+
},
|
1102 |
+
"dist": {
|
1103 |
+
"type": "zip",
|
1104 |
+
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a",
|
1105 |
+
"reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a",
|
1106 |
+
"shasum": ""
|
1107 |
+
},
|
1108 |
+
"require": {
|
1109 |
+
"php": ">=5.3.3"
|
1110 |
+
},
|
1111 |
+
"require-dev": {
|
1112 |
+
"phpunit/phpunit": "~4.4"
|
1113 |
+
},
|
1114 |
+
"type": "library",
|
1115 |
+
"extra": {
|
1116 |
+
"branch-alias": {
|
1117 |
+
"dev-master": "2.0.x-dev"
|
1118 |
+
}
|
1119 |
+
},
|
1120 |
+
"autoload": {
|
1121 |
+
"classmap": [
|
1122 |
+
"src/"
|
1123 |
+
]
|
1124 |
+
},
|
1125 |
+
"notification-url": "https://packagist.org/downloads/",
|
1126 |
+
"license": [
|
1127 |
+
"BSD-3-Clause"
|
1128 |
+
],
|
1129 |
+
"authors": [
|
1130 |
+
{
|
1131 |
+
"name": "Jeff Welch",
|
1132 |
+
"email": "whatthejeff@gmail.com"
|
1133 |
+
},
|
1134 |
+
{
|
1135 |
+
"name": "Sebastian Bergmann",
|
1136 |
+
"email": "sebastian@phpunit.de"
|
1137 |
+
},
|
1138 |
+
{
|
1139 |
+
"name": "Adam Harvey",
|
1140 |
+
"email": "aharvey@php.net"
|
1141 |
+
}
|
1142 |
+
],
|
1143 |
+
"description": "Provides functionality to recursively process PHP variables",
|
1144 |
+
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
1145 |
+
"time": "2016-11-19T07:33:16+00:00"
|
1146 |
+
},
|
1147 |
+
{
|
1148 |
+
"name": "sebastian/resource-operations",
|
1149 |
+
"version": "1.0.0",
|
1150 |
+
"source": {
|
1151 |
+
"type": "git",
|
1152 |
+
"url": "https://github.com/sebastianbergmann/resource-operations.git",
|
1153 |
+
"reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52"
|
1154 |
+
},
|
1155 |
+
"dist": {
|
1156 |
+
"type": "zip",
|
1157 |
+
"url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
|
1158 |
+
"reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
|
1159 |
+
"shasum": ""
|
1160 |
+
},
|
1161 |
+
"require": {
|
1162 |
+
"php": ">=5.6.0"
|
1163 |
+
},
|
1164 |
+
"type": "library",
|
1165 |
+
"extra": {
|
1166 |
+
"branch-alias": {
|
1167 |
+
"dev-master": "1.0.x-dev"
|
1168 |
+
}
|
1169 |
+
},
|
1170 |
+
"autoload": {
|
1171 |
+
"classmap": [
|
1172 |
+
"src/"
|
1173 |
+
]
|
1174 |
+
},
|
1175 |
+
"notification-url": "https://packagist.org/downloads/",
|
1176 |
+
"license": [
|
1177 |
+
"BSD-3-Clause"
|
1178 |
+
],
|
1179 |
+
"authors": [
|
1180 |
+
{
|
1181 |
+
"name": "Sebastian Bergmann",
|
1182 |
+
"email": "sebastian@phpunit.de"
|
1183 |
+
}
|
1184 |
+
],
|
1185 |
+
"description": "Provides a list of PHP built-in functions that operate on resources",
|
1186 |
+
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
|
1187 |
+
"time": "2015-07-28T20:34:47+00:00"
|
1188 |
+
},
|
1189 |
+
{
|
1190 |
+
"name": "sebastian/version",
|
1191 |
+
"version": "2.0.1",
|
1192 |
+
"source": {
|
1193 |
+
"type": "git",
|
1194 |
+
"url": "https://github.com/sebastianbergmann/version.git",
|
1195 |
+
"reference": "99732be0ddb3361e16ad77b68ba41efc8e979019"
|
1196 |
+
},
|
1197 |
+
"dist": {
|
1198 |
+
"type": "zip",
|
1199 |
+
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019",
|
1200 |
+
"reference": "99732be0ddb3361e16ad77b68ba41efc8e979019",
|
1201 |
+
"shasum": ""
|
1202 |
+
},
|
1203 |
+
"require": {
|
1204 |
+
"php": ">=5.6"
|
1205 |
+
},
|
1206 |
+
"type": "library",
|
1207 |
+
"extra": {
|
1208 |
+
"branch-alias": {
|
1209 |
+
"dev-master": "2.0.x-dev"
|
1210 |
+
}
|
1211 |
+
},
|
1212 |
+
"autoload": {
|
1213 |
+
"classmap": [
|
1214 |
+
"src/"
|
1215 |
+
]
|
1216 |
+
},
|
1217 |
+
"notification-url": "https://packagist.org/downloads/",
|
1218 |
+
"license": [
|
1219 |
+
"BSD-3-Clause"
|
1220 |
+
],
|
1221 |
+
"authors": [
|
1222 |
+
{
|
1223 |
+
"name": "Sebastian Bergmann",
|
1224 |
+
"email": "sebastian@phpunit.de",
|
1225 |
+
"role": "lead"
|
1226 |
+
}
|
1227 |
+
],
|
1228 |
+
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
1229 |
+
"homepage": "https://github.com/sebastianbergmann/version",
|
1230 |
+
"time": "2016-10-03T07:35:21+00:00"
|
1231 |
+
},
|
1232 |
+
{
|
1233 |
+
"name": "squizlabs/php_codesniffer",
|
1234 |
+
"version": "3.5.4",
|
1235 |
+
"source": {
|
1236 |
+
"type": "git",
|
1237 |
+
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
1238 |
+
"reference": "dceec07328401de6211037abbb18bda423677e26"
|
1239 |
+
},
|
1240 |
+
"dist": {
|
1241 |
+
"type": "zip",
|
1242 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26",
|
1243 |
+
"reference": "dceec07328401de6211037abbb18bda423677e26",
|
1244 |
+
"shasum": ""
|
1245 |
+
},
|
1246 |
+
"require": {
|
1247 |
+
"ext-simplexml": "*",
|
1248 |
+
"ext-tokenizer": "*",
|
1249 |
+
"ext-xmlwriter": "*",
|
1250 |
+
"php": ">=5.4.0"
|
1251 |
+
},
|
1252 |
+
"require-dev": {
|
1253 |
+
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
1254 |
+
},
|
1255 |
+
"bin": [
|
1256 |
+
"bin/phpcs",
|
1257 |
+
"bin/phpcbf"
|
1258 |
+
],
|
1259 |
+
"type": "library",
|
1260 |
+
"extra": {
|
1261 |
+
"branch-alias": {
|
1262 |
+
"dev-master": "3.x-dev"
|
1263 |
+
}
|
1264 |
+
},
|
1265 |
+
"notification-url": "https://packagist.org/downloads/",
|
1266 |
+
"license": [
|
1267 |
+
"BSD-3-Clause"
|
1268 |
+
],
|
1269 |
+
"authors": [
|
1270 |
+
{
|
1271 |
+
"name": "Greg Sherwood",
|
1272 |
+
"role": "lead"
|
1273 |
+
}
|
1274 |
+
],
|
1275 |
+
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
1276 |
+
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
|
1277 |
+
"keywords": [
|
1278 |
+
"phpcs",
|
1279 |
+
"standards"
|
1280 |
+
],
|
1281 |
+
"time": "2020-01-30T22:20:29+00:00"
|
1282 |
+
},
|
1283 |
+
{
|
1284 |
+
"name": "symfony/polyfill-ctype",
|
1285 |
+
"version": "v1.13.1",
|
1286 |
+
"source": {
|
1287 |
+
"type": "git",
|
1288 |
+
"url": "https://github.com/symfony/polyfill-ctype.git",
|
1289 |
+
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3"
|
1290 |
+
},
|
1291 |
+
"dist": {
|
1292 |
+
"type": "zip",
|
1293 |
+
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
|
1294 |
+
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
|
1295 |
+
"shasum": ""
|
1296 |
+
},
|
1297 |
+
"require": {
|
1298 |
+
"php": ">=5.3.3"
|
1299 |
+
},
|
1300 |
+
"suggest": {
|
1301 |
+
"ext-ctype": "For best performance"
|
1302 |
+
},
|
1303 |
+
"type": "library",
|
1304 |
+
"extra": {
|
1305 |
+
"branch-alias": {
|
1306 |
+
"dev-master": "1.13-dev"
|
1307 |
+
}
|
1308 |
+
},
|
1309 |
+
"autoload": {
|
1310 |
+
"psr-4": {
|
1311 |
+
"Symfony\\Polyfill\\Ctype\\": ""
|
1312 |
+
},
|
1313 |
+
"files": [
|
1314 |
+
"bootstrap.php"
|
1315 |
+
]
|
1316 |
+
},
|
1317 |
+
"notification-url": "https://packagist.org/downloads/",
|
1318 |
+
"license": [
|
1319 |
+
"MIT"
|
1320 |
+
],
|
1321 |
+
"authors": [
|
1322 |
+
{
|
1323 |
+
"name": "Gert de Pagter",
|
1324 |
+
"email": "BackEndTea@gmail.com"
|
1325 |
+
},
|
1326 |
+
{
|
1327 |
+
"name": "Symfony Community",
|
1328 |
+
"homepage": "https://symfony.com/contributors"
|
1329 |
+
}
|
1330 |
+
],
|
1331 |
+
"description": "Symfony polyfill for ctype functions",
|
1332 |
+
"homepage": "https://symfony.com",
|
1333 |
+
"keywords": [
|
1334 |
+
"compatibility",
|
1335 |
+
"ctype",
|
1336 |
+
"polyfill",
|
1337 |
+
"portable"
|
1338 |
+
],
|
1339 |
+
"time": "2019-11-27T13:56:44+00:00"
|
1340 |
+
},
|
1341 |
+
{
|
1342 |
+
"name": "symfony/yaml",
|
1343 |
+
"version": "v4.4.4",
|
1344 |
+
"source": {
|
1345 |
+
"type": "git",
|
1346 |
+
"url": "https://github.com/symfony/yaml.git",
|
1347 |
+
"reference": "cd014e425b3668220adb865f53bff64b3ad21767"
|
1348 |
+
},
|
1349 |
+
"dist": {
|
1350 |
+
"type": "zip",
|
1351 |
+
"url": "https://api.github.com/repos/symfony/yaml/zipball/cd014e425b3668220adb865f53bff64b3ad21767",
|
1352 |
+
"reference": "cd014e425b3668220adb865f53bff64b3ad21767",
|
1353 |
+
"shasum": ""
|
1354 |
+
},
|
1355 |
+
"require": {
|
1356 |
+
"php": "^7.1.3",
|
1357 |
+
"symfony/polyfill-ctype": "~1.8"
|
1358 |
+
},
|
1359 |
+
"conflict": {
|
1360 |
+
"symfony/console": "<3.4"
|
1361 |
+
},
|
1362 |
+
"require-dev": {
|
1363 |
+
"symfony/console": "^3.4|^4.0|^5.0"
|
1364 |
+
},
|
1365 |
+
"suggest": {
|
1366 |
+
"symfony/console": "For validating YAML files using the lint command"
|
1367 |
+
},
|
1368 |
+
"type": "library",
|
1369 |
+
"extra": {
|
1370 |
+
"branch-alias": {
|
1371 |
+
"dev-master": "4.4-dev"
|
1372 |
+
}
|
1373 |
+
},
|
1374 |
+
"autoload": {
|
1375 |
+
"psr-4": {
|
1376 |
+
"Symfony\\Component\\Yaml\\": ""
|
1377 |
+
},
|
1378 |
+
"exclude-from-classmap": [
|
1379 |
+
"/Tests/"
|
1380 |
+
]
|
1381 |
+
},
|
1382 |
+
"notification-url": "https://packagist.org/downloads/",
|
1383 |
+
"license": [
|
1384 |
+
"MIT"
|
1385 |
+
],
|
1386 |
+
"authors": [
|
1387 |
+
{
|
1388 |
+
"name": "Fabien Potencier",
|
1389 |
+
"email": "fabien@symfony.com"
|
1390 |
+
},
|
1391 |
+
{
|
1392 |
+
"name": "Symfony Community",
|
1393 |
+
"homepage": "https://symfony.com/contributors"
|
1394 |
+
}
|
1395 |
+
],
|
1396 |
+
"description": "Symfony Yaml Component",
|
1397 |
+
"homepage": "https://symfony.com",
|
1398 |
+
"time": "2020-01-21T11:12:16+00:00"
|
1399 |
+
},
|
1400 |
+
{
|
1401 |
+
"name": "webmozart/assert",
|
1402 |
+
"version": "1.6.0",
|
1403 |
+
"source": {
|
1404 |
+
"type": "git",
|
1405 |
+
"url": "https://github.com/webmozart/assert.git",
|
1406 |
+
"reference": "573381c0a64f155a0d9a23f4b0c797194805b925"
|
1407 |
+
},
|
1408 |
+
"dist": {
|
1409 |
+
"type": "zip",
|
1410 |
+
"url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925",
|
1411 |
+
"reference": "573381c0a64f155a0d9a23f4b0c797194805b925",
|
1412 |
+
"shasum": ""
|
1413 |
+
},
|
1414 |
+
"require": {
|
1415 |
+
"php": "^5.3.3 || ^7.0",
|
1416 |
+
"symfony/polyfill-ctype": "^1.8"
|
1417 |
+
},
|
1418 |
+
"conflict": {
|
1419 |
+
"vimeo/psalm": "<3.6.0"
|
1420 |
+
},
|
1421 |
+
"require-dev": {
|
1422 |
+
"phpunit/phpunit": "^4.8.36 || ^7.5.13"
|
1423 |
+
},
|
1424 |
+
"type": "library",
|
1425 |
+
"autoload": {
|
1426 |
+
"psr-4": {
|
1427 |
+
"Webmozart\\Assert\\": "src/"
|
1428 |
+
}
|
1429 |
+
},
|
1430 |
+
"notification-url": "https://packagist.org/downloads/",
|
1431 |
+
"license": [
|
1432 |
+
"MIT"
|
1433 |
+
],
|
1434 |
+
"authors": [
|
1435 |
+
{
|
1436 |
+
"name": "Bernhard Schussek",
|
1437 |
+
"email": "bschussek@gmail.com"
|
1438 |
+
}
|
1439 |
+
],
|
1440 |
+
"description": "Assertions to validate method input/output with nice error messages.",
|
1441 |
+
"keywords": [
|
1442 |
+
"assert",
|
1443 |
+
"check",
|
1444 |
+
"validate"
|
1445 |
+
],
|
1446 |
+
"time": "2019-11-24T13:36:37+00:00"
|
1447 |
+
}
|
1448 |
+
],
|
1449 |
+
"aliases": [],
|
1450 |
+
"minimum-stability": "stable",
|
1451 |
+
"stability-flags": [],
|
1452 |
+
"prefer-stable": false,
|
1453 |
+
"prefer-lowest": false,
|
1454 |
+
"platform": {
|
1455 |
+
"php": ">=5.5.0",
|
1456 |
+
"ext-curl": "*",
|
1457 |
+
"ext-json": "*"
|
1458 |
+
},
|
1459 |
+
"platform-dev": []
|
1460 |
+
}
|
wpcf7-redirect.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Redirection for Contact Form 7
|
4 |
* Plugin URI: https://redirection-for-contact-form7.com/
|
5 |
* Description: The ultimate add-on for Contact Form 7 - redirect to any page after submission, fire scripts, save submissions in database, and much more options to make Contact Form 7 poweful than ever.
|
6 |
-
* Version: 2.3.
|
7 |
* Author: Query Solutions
|
8 |
* Author URI: https://redirection-for-contact-form7.com/
|
9 |
* Contributors: querysolutions, yuvalsabar, regevlio
|
@@ -23,7 +23,7 @@ if ( ! defined( 'CF7_REDIRECT_DEBUG' ) ) {
|
|
23 |
define( 'CF7_REDIRECT_DEBUG', get_option( 'wpcf_debug' ) ? true : false );
|
24 |
}
|
25 |
|
26 |
-
define( 'WPCF7_PRO_REDIRECT_PLUGIN_VERSION', '2.3.
|
27 |
define( 'WPCF7_PRO_MIGRATION_VERSION', '1' );
|
28 |
define( 'WPCF7_PRO_REDIRECT_CLASSES_PATH', plugin_dir_path( __FILE__ ) . 'classes/' );
|
29 |
|
3 |
* Plugin Name: Redirection for Contact Form 7
|
4 |
* Plugin URI: https://redirection-for-contact-form7.com/
|
5 |
* Description: The ultimate add-on for Contact Form 7 - redirect to any page after submission, fire scripts, save submissions in database, and much more options to make Contact Form 7 poweful than ever.
|
6 |
+
* Version: 2.3.1
|
7 |
* Author: Query Solutions
|
8 |
* Author URI: https://redirection-for-contact-form7.com/
|
9 |
* Contributors: querysolutions, yuvalsabar, regevlio
|
23 |
define( 'CF7_REDIRECT_DEBUG', get_option( 'wpcf_debug' ) ? true : false );
|
24 |
}
|
25 |
|
26 |
+
define( 'WPCF7_PRO_REDIRECT_PLUGIN_VERSION', '2.3.1' );
|
27 |
define( 'WPCF7_PRO_MIGRATION_VERSION', '1' );
|
28 |
define( 'WPCF7_PRO_REDIRECT_CLASSES_PATH', plugin_dir_path( __FILE__ ) . 'classes/' );
|
29 |
|
wpcf7r-functions.php
CHANGED
@@ -66,6 +66,14 @@ function wpcf7_redirect_get_all_extensions_list() {
|
|
66 |
'icon' => WPCF7_PRO_REDIRECT_BUILD_PATH . 'images/paypal.png',
|
67 |
'classname' => 'WPCF7R_Action_redirect_to_paypal',
|
68 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
'wpcf7r-api' => array(
|
70 |
'name' => 'wpcf7r-api',
|
71 |
'filename' => 'class-wpcf7r-action-api-url.php',
|
@@ -88,7 +96,7 @@ function wpcf7_redirect_get_all_extensions_list() {
|
|
88 |
'title' => __( 'Thank You Popup', 'wpcf7-redirect' ),
|
89 |
'description' => __( 'Display popup message after form submission success.', 'wpcf7-redirect' ),
|
90 |
'icon' => WPCF7_PRO_REDIRECT_BUILD_PATH . 'images/icon3.png',
|
91 |
-
'classname' => '
|
92 |
),
|
93 |
'wpcf7r-create-post' => array(
|
94 |
'name' => 'wpcf7r-create-post',
|
@@ -96,7 +104,7 @@ function wpcf7_redirect_get_all_extensions_list() {
|
|
96 |
'title' => __( 'Create Posts', 'wpcf7-redirect' ),
|
97 |
'description' => __( 'Create any post with post meta and taxonomy assigments.', 'wpcf7-redirect' ),
|
98 |
'icon' => WPCF7_PRO_REDIRECT_BUILD_PATH . 'images/icon12.png',
|
99 |
-
'classname' => '
|
100 |
),
|
101 |
'wpcf7r-login' => array(
|
102 |
'name' => 'wpcf7r-login',
|
66 |
'icon' => WPCF7_PRO_REDIRECT_BUILD_PATH . 'images/paypal.png',
|
67 |
'classname' => 'WPCF7R_Action_redirect_to_paypal',
|
68 |
),
|
69 |
+
'wpcf7r-stripe' => array(
|
70 |
+
'name' => 'wpcf7r-stripe',
|
71 |
+
'filename' => 'class-wpcf7r-action-stripe.php',
|
72 |
+
'title' => __( 'Stripe Integration', 'wpcf7-redirect' ),
|
73 |
+
'description' => __( 'Collect payments with your Contact Form 7 form. Setup product details and custom stripe fields.', 'wpcf7-redirect' ),
|
74 |
+
'icon' => home_url() . '/wp-content/uploads/2020/11/362px-Stripe_Logo_revised_2016.svg_.png',
|
75 |
+
'classname' => 'WPCF7R_Action_Stripe_Integration',
|
76 |
+
),
|
77 |
'wpcf7r-api' => array(
|
78 |
'name' => 'wpcf7r-api',
|
79 |
'filename' => 'class-wpcf7r-action-api-url.php',
|
96 |
'title' => __( 'Thank You Popup', 'wpcf7-redirect' ),
|
97 |
'description' => __( 'Display popup message after form submission success.', 'wpcf7-redirect' ),
|
98 |
'icon' => WPCF7_PRO_REDIRECT_BUILD_PATH . 'images/icon3.png',
|
99 |
+
'classname' => 'WPCF7R_Action_Popup',
|
100 |
),
|
101 |
'wpcf7r-create-post' => array(
|
102 |
'name' => 'wpcf7r-create-post',
|
104 |
'title' => __( 'Create Posts', 'wpcf7-redirect' ),
|
105 |
'description' => __( 'Create any post with post meta and taxonomy assigments.', 'wpcf7-redirect' ),
|
106 |
'icon' => WPCF7_PRO_REDIRECT_BUILD_PATH . 'images/icon12.png',
|
107 |
+
'classname' => 'WPCF7R_Action_Create_Post',
|
108 |
),
|
109 |
'wpcf7r-login' => array(
|
110 |
'name' => 'wpcf7r-login',
|