PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.16.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.16.1
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/helpers/FrmFormTemplatesHelper.php +6 -73 6.336.16.1 View file →
@@ -21,10 +21,8 @@
21 21 *
22 22 * @param array $template Template data.
23 23 * @param string $pricing Upgrade link URL.
24 24 * @param string $license_type License type.
25 - *
26 - * @return void
27 25 */
28 26 public static function prepare_template_details( &$template, $pricing, $license_type ) {
29 27 $template['is_featured'] = ! empty( $template['is_featured'] );
30 28 $template['is_favorite'] = ! empty( $template['is_favorite'] );
@@ -30,12 +28,8 @@
30 28 $template['is_favorite'] = ! empty( $template['is_favorite'] );
31 29 $template['is_custom'] = ! empty( $template['is_custom'] );
32 30 $template['plan_required'] = FrmFormsHelper::get_plan_required( $template );
33 31
34 - if ( self::needs_free_plan( $template ) ) {
35 - $template['plan_required'] = 'free';
36 - }
37 -
38 32 if ( ! empty( $template['name'] ) ) {
39 33 $template['name'] = $template['is_custom'] ? $template['name'] : preg_replace( '/(\sForm)?(\sTemplate)?$/', '', $template['name'] );
40 34 } else {
41 35 $template['name'] = '';
@@ -41,13 +35,13 @@
41 35 $template['name'] = '';
42 36 }
43 37
44 38 $template['use_template'] = '#';
45 -
46 39 if ( $template['is_custom'] ) {
47 40 $template['use_template'] = $template['url'];
48 41 } elseif ( ! $template['plan_required'] ) {
49 - $link = FrmFormsHelper::get_template_install_link( $template, compact( 'pricing', 'license_type' ) );
42 + $link = FrmFormsHelper::get_template_install_link( $template, compact( 'pricing', 'license_type' ) );
43 +
50 44 $template['use_template'] = esc_url( $link['url'] );
51 45 }
52 46 }
53 47
@@ -57,9 +51,8 @@
57 51 * @since 6.7
58 52 *
59 53 * @param array $template The template data.
60 54 * @param bool $expired Whether the API request is expired or not.
61 - *
62 55 * @return void
63 56 */
64 57 public static function add_template_attributes( $template, $expired ) {
65 58 $attributes = array(
@@ -89,22 +82,18 @@
89 82 *
90 83 * @since 6.7
91 84 *
92 85 * @param array $template The template data.
93 - *
94 86 * @return string
95 87 */
96 88 private static function prepare_single_template_classes( $template ) {
97 89 $class_names = array( 'frm-card-item' );
98 -
99 90 if ( $template['is_featured'] ) {
100 91 $class_names[] = 'frm-form-templates-featured-item';
101 92 }
102 -
103 93 if ( $template['is_favorite'] ) {
104 94 $class_names[] = 'frm-form-templates-favorite-item';
105 95 }
106 -
107 96 if ( $template['is_custom'] ) {
108 97 $class_names[] = 'frm-form-templates-custom-item';
109 98 }
110 99
@@ -118,9 +107,8 @@
118 107 *
119 108 * @param array $template The template data.
120 109 * @param bool $expired Whether the license is expired.
121 110 * @param array $attributes The template attributes.
122 - *
123 111 * @return void
124 112 */
125 113 private static function prepare_single_template_plan( $template, $expired, &$attributes ) {
126 114 if ( ! $template['plan_required'] ) {
@@ -128,9 +116,8 @@
128 116 }
129 117
130 118 $required_plan_slug = sanitize_title( $template['plan_required'] );
131 119 $attributes['data-required-plan'] = $expired && 'free' !== $required_plan_slug ? 'renew' : $required_plan_slug;
132 -
133 120 if ( 'free' === $required_plan_slug ) {
134 121 $attributes['data-key'] = $template['key'];
135 122 }
136 123
@@ -142,9 +129,8 @@
142 129 *
143 130 * @since 6.7
144 131 *
145 132 * @param array $template The template data.
146 - *
147 133 * @return void
148 134 */
149 135 public static function add_template_link_attributes( $template ) {
150 136 $attributes = array(
@@ -176,9 +162,8 @@
176 162 *
177 163 * @type string $upgrade_link Upgrade link URL.
178 164 * @type string $renew_link Renew link URL.
179 165 * }
180 - *
181 166 * @return void
182 167 */
183 168 public static function show_upgrade_renew_cta( $args ) {
184 169 // Show 'renew' banner for expired users.
@@ -185,9 +170,9 @@
185 170 if ( $args['expired'] ) {
186 171 FrmTipsHelper::show_admin_cta(
187 172 array(
188 173 'title' => esc_html__( 'Get Super Powers with Pre-built Forms', 'formidable' ),
189 - 'description' => esc_html__( 'Unleash the potential of hundreds of form templates and save precious time. Renew today for unparalleled form-building speed.', 'formidable' ), // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
174 + 'description' => esc_html__( 'Unleash the potential of hundreds of form templates and save precious time. Renew today for unparalleled form-building speed.', 'formidable' ),
190 175 'link_text' => esc_html__( 'Renew Now', 'formidable' ),
191 176 'link_url' => $args['renew_link'],
192 177 'id' => 'frm-renew-subscription-banner',
193 178 )
@@ -198,71 +183,19 @@
198 183 // Show 'upgrade' banner for non-elite users.
199 184 if ( ! in_array( FrmAddonsController::license_type(), array( 'elite', 'business' ), true ) ) {
200 185 FrmTipsHelper::show_admin_cta(
201 186 array(
202 - 'class' => 'frm-gradient',
203 - 'icon' => 'frmfont frm_speaker_icon',
204 187 'title' => sprintf(
205 188 /* translators: %1$s: Open span tag, %2$s: Close span tag */
206 - esc_html__( 'Upgrade to get all %1$s%2$s templates', 'formidable' ),
189 + esc_html__( 'Get Super Powers with %1$s%2$s More Pre-built Forms', 'formidable' ) . ' 🦸',
207 190 '<span class="frm-form-templates-extra-templates-count">',
208 191 '</span>'
209 192 ),
210 - 'description' => esc_html__( 'Upgrade to PRO to get access to all of our templates and unlock the full potential of your forms.', 'formidable' ),
211 - 'link_text' => esc_html__( 'Get More Templates', 'formidable' ),
193 + 'description' => esc_html__( 'Unleash the potential of hundreds of additional form templates and save precious time. Upgrade today for unparalleled form-building capabilities.', 'formidable' ),
194 + 'link_text' => esc_html__( 'Upgrade to PRO', 'formidable' ),
212 195 'link_url' => $args['upgrade_link'],
213 196 'id' => 'frm-upgrade-banner',
214 197 )
215 198 );
216 199 }
217 - }
218 -
219 - /**
220 - * Echo the get free templates banner.
221 - *
222 - * @since 6.25
223 - *
224 - * @return void
225 - */
226 - public static function echo_get_free_templates_banner() {
227 - $args = array(
228 - 'direction' => 'vertical',
229 - );
230 -
231 - // phpcs:disable Generic.WhiteSpace.ScopeIndent
232 - ?>
233 - <div class="frm-card-item frm-px-sm">
234 - <?php require FrmAppHelper::plugin_path() . '/classes/views/shared/get-free-templates-banner.php'; ?>
235 - </div>
236 - <?php
237 - // phpcs:enable Generic.WhiteSpace.ScopeIndent
238 - }
239 -
240 - /**
241 - * Checks if the get free templates banner should be displayed.
242 - *
243 - * @since 6.25
244 - *
245 - * @return bool
246 - */
247 - public static function needs_get_free_templates_banner() {
248 - return ! FrmAppHelper::pro_is_installed() && ! FrmFormTemplateApi::get_free_license_code();
249 - }
250 -
251 - /**
252 - * Checks if a template needs the free plan override.
253 - *
254 - * @since 6.25
255 - *
256 - * @param array $template The template data.
257 - *
258 - * @return bool
259 - */
260 - private static function needs_free_plan( $template ) {
261 - // phpcs:disable Generic.WhiteSpace.ScopeIndent
262 - return self::needs_get_free_templates_banner()
263 - && ! empty( $template['category_slugs'] )
264 - && in_array( 'free', $template['category_slugs'], true )
265 - && ! in_array( $template['id'], FrmFormTemplatesController::FREE_TEMPLATES_IDS, true );
266 - // phpcs:enable Generic.WhiteSpace.ScopeIndent
267 200 }
268 201 }