| @@ -21,8 +21,10 @@ | ||
| 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 | |
| 25 | 27 | */ |
| 26 | 28 | public static function prepare_template_details( &$template, $pricing, $license_type ) { |
| 27 | 29 | $template['is_featured'] = ! empty( $template['is_featured'] ); |
| 28 | 30 | $template['is_favorite'] = ! empty( $template['is_favorite'] ); |
| @@ -39,13 +41,13 @@ | ||
| 39 | 41 | $template['name'] = ''; |
| 40 | 42 | } |
| 41 | 43 | |
| 42 | 44 | $template['use_template'] = '#'; |
| 45 | + | |
| 43 | 46 | if ( $template['is_custom'] ) { |
| 44 | 47 | $template['use_template'] = $template['url']; |
| 45 | 48 | } elseif ( ! $template['plan_required'] ) { |
| 46 | - $link = FrmFormsHelper::get_template_install_link( $template, compact( 'pricing', 'license_type' ) ); | |
| 47 | - | |
| 49 | + $link = FrmFormsHelper::get_template_install_link( $template, compact( 'pricing', 'license_type' ) ); | |
| 48 | 50 | $template['use_template'] = esc_url( $link['url'] ); |
| 49 | 51 | } |
| 50 | 52 | } |
| 51 | 53 | |
| @@ -55,8 +57,9 @@ | ||
| 55 | 57 | * @since 6.7 |
| 56 | 58 | * |
| 57 | 59 | * @param array $template The template data. |
| 58 | 60 | * @param bool $expired Whether the API request is expired or not. |
| 61 | + * | |
| 59 | 62 | * @return void |
| 60 | 63 | */ |
| 61 | 64 | public static function add_template_attributes( $template, $expired ) { |
| 62 | 65 | $attributes = array( |
| @@ -86,18 +89,22 @@ | ||
| 86 | 89 | * |
| 87 | 90 | * @since 6.7 |
| 88 | 91 | * |
| 89 | 92 | * @param array $template The template data. |
| 93 | + * | |
| 90 | 94 | * @return string |
| 91 | 95 | */ |
| 92 | 96 | private static function prepare_single_template_classes( $template ) { |
| 93 | 97 | $class_names = array( 'frm-card-item' ); |
| 98 | + | |
| 94 | 99 | if ( $template['is_featured'] ) { |
| 95 | 100 | $class_names[] = 'frm-form-templates-featured-item'; |
| 96 | 101 | } |
| 102 | + | |
| 97 | 103 | if ( $template['is_favorite'] ) { |
| 98 | 104 | $class_names[] = 'frm-form-templates-favorite-item'; |
| 99 | 105 | } |
| 106 | + | |
| 100 | 107 | if ( $template['is_custom'] ) { |
| 101 | 108 | $class_names[] = 'frm-form-templates-custom-item'; |
| 102 | 109 | } |
| 103 | 110 | |
| @@ -111,8 +118,9 @@ | ||
| 111 | 118 | * |
| 112 | 119 | * @param array $template The template data. |
| 113 | 120 | * @param bool $expired Whether the license is expired. |
| 114 | 121 | * @param array $attributes The template attributes. |
| 122 | + * | |
| 115 | 123 | * @return void |
| 116 | 124 | */ |
| 117 | 125 | private static function prepare_single_template_plan( $template, $expired, &$attributes ) { |
| 118 | 126 | if ( ! $template['plan_required'] ) { |
| @@ -120,8 +128,9 @@ | ||
| 120 | 128 | } |
| 121 | 129 | |
| 122 | 130 | $required_plan_slug = sanitize_title( $template['plan_required'] ); |
| 123 | 131 | $attributes['data-required-plan'] = $expired && 'free' !== $required_plan_slug ? 'renew' : $required_plan_slug; |
| 132 | + | |
| 124 | 133 | if ( 'free' === $required_plan_slug ) { |
| 125 | 134 | $attributes['data-key'] = $template['key']; |
| 126 | 135 | } |
| 127 | 136 | |
| @@ -133,8 +142,9 @@ | ||
| 133 | 142 | * |
| 134 | 143 | * @since 6.7 |
| 135 | 144 | * |
| 136 | 145 | * @param array $template The template data. |
| 146 | + * | |
| 137 | 147 | * @return void |
| 138 | 148 | */ |
| 139 | 149 | public static function add_template_link_attributes( $template ) { |
| 140 | 150 | $attributes = array( |
| @@ -166,8 +176,9 @@ | ||
| 166 | 176 | * |
| 167 | 177 | * @type string $upgrade_link Upgrade link URL. |
| 168 | 178 | * @type string $renew_link Renew link URL. |
| 169 | 179 | * } |
| 180 | + * | |
| 170 | 181 | * @return void |
| 171 | 182 | */ |
| 172 | 183 | public static function show_upgrade_renew_cta( $args ) { |
| 173 | 184 | // Show 'renew' banner for expired users. |
| @@ -174,9 +185,9 @@ | ||
| 174 | 185 | if ( $args['expired'] ) { |
| 175 | 186 | FrmTipsHelper::show_admin_cta( |
| 176 | 187 | array( |
| 177 | 188 | 'title' => esc_html__( 'Get Super Powers with Pre-built Forms', 'formidable' ), |
| 178 | - 'description' => esc_html__( 'Unleash the potential of hundreds of form templates and save precious time. Renew today for unparalleled form-building speed.', '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 | |
| 179 | 190 | 'link_text' => esc_html__( 'Renew Now', 'formidable' ), |
| 180 | 191 | 'link_url' => $args['renew_link'], |
| 181 | 192 | 'id' => 'frm-renew-subscription-banner', |
| 182 | 193 | ) |
| @@ -216,13 +227,15 @@ | ||
| 216 | 227 | $args = array( |
| 217 | 228 | 'direction' => 'vertical', |
| 218 | 229 | ); |
| 219 | 230 | |
| 231 | + // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 220 | 232 | ?> |
| 221 | 233 | <div class="frm-card-item frm-px-sm"> |
| 222 | 234 | <?php require FrmAppHelper::plugin_path() . '/classes/views/shared/get-free-templates-banner.php'; ?> |
| 223 | 235 | </div> |
| 224 | 236 | <?php |
| 237 | + // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 225 | 238 | } |
| 226 | 239 | |
| 227 | 240 | /** |
| 228 | 241 | * Checks if the get free templates banner should be displayed. |
| @@ -240,13 +253,16 @@ | ||
| 240 | 253 | * |
| 241 | 254 | * @since 6.25 |
| 242 | 255 | * |
| 243 | 256 | * @param array $template The template data. |
| 257 | + * | |
| 244 | 258 | * @return bool |
| 245 | 259 | */ |
| 246 | 260 | private static function needs_free_plan( $template ) { |
| 261 | + // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 247 | 262 | return self::needs_get_free_templates_banner() |
| 248 | 263 | && ! empty( $template['category_slugs'] ) |
| 249 | 264 | && in_array( 'free', $template['category_slugs'], true ) |
| 250 | 265 | && ! in_array( $template['id'], FrmFormTemplatesController::FREE_TEMPLATES_IDS, true ); |
| 266 | + // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 251 | 267 | } |
| 252 | 268 | } |