PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.0
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
formidable / classes / models / FrmStyleApi.php

FrmStyleApi.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.0, at classes/models/FrmStyleApi.php

56 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 /**
7 * @since 6.0
8 */
9 class FrmStyleApi extends FrmFormApi {
10
11 /**
12 * @var string $base_api_url
13 */
14 private static $base_api_url = 'https://formidableforms.com/wp-json/style-templates/v1/list';
15
16 /**
17 * @var int $new_days
18 */
19 protected $new_days = 30;
20
21 /**
22 * @return string
23 */
24 protected function api_url() {
25 return self::$base_api_url;
26 }
27
28 /**
29 * @return void
30 */
31 protected function set_cache_key() {
32 $this->cache_key = 'frm_style_templates_l' . ( empty( $this->license ) ? '' : md5( $this->license ) );
33 }
34
35 public function get_api_info() {
36 $api_info = parent::get_api_info();
37 $api_info = $this->fill_missing_style_settings( $api_info );
38 return $api_info;
39 }
40
41 /**
42 * @param array $api_info
43 * @return array
44 */
45 private function fill_missing_style_settings( $api_info ) {
46 // Remove 'Styling Template' from titles.
47 foreach ( $api_info as $id => $template ) {
48 if ( isset( $template['name'] ) ) {
49 $api_info[ $id ]['name'] = preg_replace( '/(\sStyle|Styling)?(\sTemplate)?$/', '', $template['name'] );
50 }
51 }
52
53 return $api_info;
54 }
55 }
56