| @@ -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,24 +28,18 @@ | ||
| 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 | - } | |
| 32 | + $template['name'] = $template['is_custom'] | |
| 33 | + ? $template['name'] | |
| 34 | + : preg_replace( '/(\sForm)?(\sTemplate)?$/', '', $template['name'] ); | |
| 37 | 35 | |
| 38 | - if ( ! empty( $template['name'] ) ) { | |
| 39 | - $template['name'] = $template['is_custom'] ? $template['name'] : preg_replace( '/(\sForm)?(\sTemplate)?$/', '', $template['name'] ); | |
| 40 | - } else { | |
| 41 | - $template['name'] = ''; | |
| 42 | - } | |
| 43 | - | |
| 44 | 36 | $template['use_template'] = '#'; |
| 45 | - | |
| 46 | 37 | if ( $template['is_custom'] ) { |
| 47 | 38 | $template['use_template'] = $template['url']; |
| 48 | 39 | } elseif ( ! $template['plan_required'] ) { |
| 49 | - $link = FrmFormsHelper::get_template_install_link( $template, compact( 'pricing', 'license_type' ) ); | |
| 40 | + $link = FrmFormsHelper::get_template_install_link( $template, compact( 'pricing', 'license_type' ) ); | |
| 41 | + | |
| 50 | 42 | $template['use_template'] = esc_url( $link['url'] ); |
| 51 | 43 | } |
| 52 | 44 | } |
| 53 | 45 | |
| @@ -57,9 +49,8 @@ | ||
| 57 | 49 | * @since 6.7 |
| 58 | 50 | * |
| 59 | 51 | * @param array $template The template data. |
| 60 | 52 | * @param bool $expired Whether the API request is expired or not. |
| 61 | - * | |
| 62 | 53 | * @return void |
| 63 | 54 | */ |
| 64 | 55 | public static function add_template_attributes( $template, $expired ) { |
| 65 | 56 | $attributes = array( |
| @@ -89,22 +80,18 @@ | ||
| 89 | 80 | * |
| 90 | 81 | * @since 6.7 |
| 91 | 82 | * |
| 92 | 83 | * @param array $template The template data. |
| 93 | - * | |
| 94 | 84 | * @return string |
| 95 | 85 | */ |
| 96 | 86 | private static function prepare_single_template_classes( $template ) { |
| 97 | 87 | $class_names = array( 'frm-card-item' ); |
| 98 | - | |
| 99 | 88 | if ( $template['is_featured'] ) { |
| 100 | 89 | $class_names[] = 'frm-form-templates-featured-item'; |
| 101 | 90 | } |
| 102 | - | |
| 103 | 91 | if ( $template['is_favorite'] ) { |
| 104 | 92 | $class_names[] = 'frm-form-templates-favorite-item'; |
| 105 | 93 | } |
| 106 | - | |
| 107 | 94 | if ( $template['is_custom'] ) { |
| 108 | 95 | $class_names[] = 'frm-form-templates-custom-item'; |
| 109 | 96 | } |
| 110 | 97 | |
| @@ -118,9 +105,8 @@ | ||
| 118 | 105 | * |
| 119 | 106 | * @param array $template The template data. |
| 120 | 107 | * @param bool $expired Whether the license is expired. |
| 121 | 108 | * @param array $attributes The template attributes. |
| 122 | - * | |
| 123 | 109 | * @return void |
| 124 | 110 | */ |
| 125 | 111 | private static function prepare_single_template_plan( $template, $expired, &$attributes ) { |
| 126 | 112 | if ( ! $template['plan_required'] ) { |
| @@ -128,9 +114,8 @@ | ||
| 128 | 114 | } |
| 129 | 115 | |
| 130 | 116 | $required_plan_slug = sanitize_title( $template['plan_required'] ); |
| 131 | 117 | $attributes['data-required-plan'] = $expired && 'free' !== $required_plan_slug ? 'renew' : $required_plan_slug; |
| 132 | - | |
| 133 | 118 | if ( 'free' === $required_plan_slug ) { |
| 134 | 119 | $attributes['data-key'] = $template['key']; |
| 135 | 120 | } |
| 136 | 121 | |
| @@ -142,9 +127,8 @@ | ||
| 142 | 127 | * |
| 143 | 128 | * @since 6.7 |
| 144 | 129 | * |
| 145 | 130 | * @param array $template The template data. |
| 146 | - * | |
| 147 | 131 | * @return void |
| 148 | 132 | */ |
| 149 | 133 | public static function add_template_link_attributes( $template ) { |
| 150 | 134 | $attributes = array( |
| @@ -176,9 +160,8 @@ | ||
| 176 | 160 | * |
| 177 | 161 | * @type string $upgrade_link Upgrade link URL. |
| 178 | 162 | * @type string $renew_link Renew link URL. |
| 179 | 163 | * } |
| 180 | - * | |
| 181 | 164 | * @return void |
| 182 | 165 | */ |
| 183 | 166 | public static function show_upgrade_renew_cta( $args ) { |
| 184 | 167 | // Show 'renew' banner for expired users. |
| @@ -185,9 +168,9 @@ | ||
| 185 | 168 | if ( $args['expired'] ) { |
| 186 | 169 | FrmTipsHelper::show_admin_cta( |
| 187 | 170 | array( |
| 188 | 171 | '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 | |
| 172 | + 'description' => esc_html__( 'Unleash the potential of hundreds of form templates and save precious time. Renew today for unparalleled form-building speed.', 'formidable' ), | |
| 190 | 173 | 'link_text' => esc_html__( 'Renew Now', 'formidable' ), |
| 191 | 174 | 'link_url' => $args['renew_link'], |
| 192 | 175 | 'id' => 'frm-renew-subscription-banner', |
| 193 | 176 | ) |
| @@ -198,71 +181,19 @@ | ||
| 198 | 181 | // Show 'upgrade' banner for non-elite users. |
| 199 | 182 | if ( ! in_array( FrmAddonsController::license_type(), array( 'elite', 'business' ), true ) ) { |
| 200 | 183 | FrmTipsHelper::show_admin_cta( |
| 201 | 184 | array( |
| 202 | - 'class' => 'frm-gradient', | |
| 203 | - 'icon' => 'frmfont frm_speaker_icon', | |
| 204 | 185 | 'title' => sprintf( |
| 205 | 186 | /* translators: %1$s: Open span tag, %2$s: Close span tag */ |
| 206 | - esc_html__( 'Upgrade to get all %1$s%2$s templates', 'formidable' ), | |
| 187 | + esc_html__( 'Get Super Powers with %1$s%2$s More Pre-built Forms', 'formidable' ) . ' 🦸', | |
| 207 | 188 | '<span class="frm-form-templates-extra-templates-count">', |
| 208 | 189 | '</span>' |
| 209 | 190 | ), |
| 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' ), | |
| 191 | + 'description' => esc_html__( 'Unleash the potential of hundreds of additional form templates and save precious time. Upgrade today for unparalleled form-building capabilities.', 'formidable' ), | |
| 192 | + 'link_text' => esc_html__( 'Upgrade to PRO', 'formidable' ), | |
| 212 | 193 | 'link_url' => $args['upgrade_link'], |
| 213 | 194 | 'id' => 'frm-upgrade-banner', |
| 214 | 195 | ) |
| 215 | 196 | ); |
| 216 | 197 | } |
| 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 | 198 | } |
| 268 | 199 | } |