PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 2.1.4
Visualizer – Tables & Charts Manager with Built-in AI Generator v2.1.4
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / codeinwp / themeisle-sdk / class-themeisle-sdk-feedback.php

class-themeisle-sdk-feedback.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 2.1.4, at vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback.php

89 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The feedback model class for ThemeIsle SDK
4 *
5 * @package ThemeIsleSDK
6 * @subpackage Feedback
7 * @copyright Copyright (c) 2017, Marius Cristea
8 * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9 * @since 1.0.0
10 */
11 // Exit if accessed directly.
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15 if ( ! class_exists( 'ThemeIsle_SDK_Feedback' ) ) :
16 /**
17 * Feedback model for ThemeIsle SDK.
18 */
19 abstract class ThemeIsle_SDK_Feedback {
20 /**
21 * @var ThemeIsle_SDK_Product $product Themeisle Product.
22 */
23 protected $product;
24
25 /**
26 * @var string $feedback_url Url where to send the feedback
27 */
28 private $feedback_url = 'http://feedback.themeisle.com/wordpress/wp-json/__pirate_feedback_/v1/feedback';
29
30 /**
31 * ThemeIsle_SDK_Feedback constructor.
32 *
33 * @param ThemeIsle_SDK_Product $product_object Product Object.
34 */
35 public function __construct( $product_object ) {
36 if ( $product_object instanceof ThemeIsle_SDK_Product ) {
37 $this->product = $product_object;
38 }
39 $this->setup_hooks();
40 }
41
42 /**
43 * Registers the hooks and then delegates to the child
44 */
45 public function setup_hooks() {
46 $this->setup_hooks_child();
47 }
48
49 /**
50 * Calls the API
51 *
52 * @param string $attributes The attributes of the post body.
53 */
54 protected function call_api( $attributes ) {
55 $slug = $this->product->get_slug();
56 $version = $this->product->get_version();
57 $attributes['slug'] = $slug;
58 $attributes['version'] = $version;
59
60 $response = wp_remote_post( $this->feedback_url, array(
61 'body' => $attributes,
62 ) );
63 }
64
65 /**
66 * Randomizes the options array
67 *
68 * @param array $options The options array.
69 */
70 function randomize_options( $options ) {
71 $new = array();
72 $keys = array_keys( $options );
73 shuffle( $keys );
74
75 foreach ( $keys as $key ) {
76 $new[ $key ] = $options[ $key ];
77 }
78
79 return $new;
80 }
81
82 /**
83 * Abstract function for delegating to the child
84 */
85 protected abstract function setup_hooks_child();
86
87 }
88 endif;
89