PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.8.9
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.8.9
7.8.13 7.8.13.1 trunk 3.0 3.1 3.1.1 3.1.2 3.1.3 3.1.4 4.3.2 4.4.4 4.4.5 4.4.5.1 4.4.5.4 4.6 4.6.1.1 4.6.1.4 4.7.0.2 4.7.0.3 4.7.0.7 4.7.0.9 4.7.1.0 4.7.1.1 4.8.0.0 5.0.0 5.0.1 5.0.1.1 5.0.1.2 5.1 5.1.1 5.1.2 5.1.3 5.1.3.1 5.1.3.2 5.1.4 5.1.5 6.0 6.0.1 6.0.2 6.0.3 6.0.4.2 6.0.5 6.0.6.1 6.0.7 6.0.8.1 6.0.9 7.0.0.1 7.0.2 7.0.3 7.0.4 7.1.0 7.1.1 7.2.0 7.2.1 7.3.0 7.3.1 7.3.3 7.3.5 7.3.6 7.3.7 7.4.0 7.4.1 7.4.11 7.4.13 7.4.13.1 7.4.2 7.4.3 7.4.4 7.4.5 7.4.5.1 7.4.5.2 7.4.6 7.4.7 7.5.0 7.6.0 7.6.1 7.6.3 7.6.4 7.6.6 7.7.0 7.7.1 7.8.0 7.8.1 7.8.10 7.8.10.1 7.8.10.2 7.8.11 7.8.12 7.8.12.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.8.9.1 7.8.9.2 7.8.9.3
wordpress-popup / inc / class-hustle-meta.php
wordpress-popup / inc Last commit date
display-conditions 3 years ago front 9 months ago helpers 9 months ago metas 3 years ago multisite 3 years ago palettes 3 years ago provider 3 years ago providers 9 months ago templates 3 years ago update 3 years ago class-hustle-admin-page-abstract.php 9 months ago class-hustle-black-friday-campaign.php 7 months ago class-hustle-condition-factory.php 6 years ago class-hustle-cross-sell.php 9 months ago class-hustle-dashboard-admin.php 3 years ago class-hustle-data.php 3 years ago class-hustle-db.php 2 years ago class-hustle-installer.php 4 years ago class-hustle-meta.php 3 years ago class-hustle-module-admin.php 9 months ago class-hustle-module-collection.php 3 years ago class-hustle-module-page-abstract.php 2 years ago class-hustle-notifications.php 3 years ago class-hustle-settings-admin.php 3 years ago class-hustle-tutorials-page.php 4 years ago class-hustle-wp-dashboard-page.php 3 years ago hustle-deletion.php 3 years ago hustle-embedded-admin.php 3 years ago hustle-entries-admin.php 3 years ago hustle-entry-model.php 3 years ago hustle-general-data-protection.php 3 years ago hustle-init.php 7 months ago hustle-mail.php 3 years ago hustle-migration.php 3 years ago hustle-model.php 3 years ago hustle-module-model.php 9 months ago hustle-module-widget-legacy.php 3 years ago hustle-module-widget.php 3 years ago hustle-modules-common-admin-ajax.php 9 months ago hustle-popup-admin.php 3 years ago hustle-providers-admin.php 3 years ago hustle-providers.php 3 years ago hustle-settings-admin-ajax.php 3 years ago hustle-settings-page.php 3 years ago hustle-slidein-admin.php 3 years ago hustle-sshare-admin.php 3 years ago hustle-sshare-model.php 3 years ago hustle-tracking-model.php 3 years ago opt-in-geo.php 9 months ago opt-in-utils.php 3 years ago opt-in-wpmudev-api.php 3 years ago
class-hustle-meta.php
99 lines
1 <?php
2 /**
3 * File for Hustle_Meta class.
4 *
5 * @package Hustle
6 * @since unkown
7 */
8
9 /**
10 * Abstract Hustle_Meta class.
11 * Extended by each handler of the modules' metas.
12 *
13 * When creating a new meta property:
14 * -Booleans properties must be '0' and '1', as strings. Make sure they're also stored in this way when saving.
15 */
16 abstract class Hustle_Meta {
17
18 /**
19 * The meta's saved value.
20 *
21 * @since unknown
22 *
23 * @var array
24 */
25 protected $data;
26
27 /**
28 * Current module.
29 *
30 * @since unknown
31 * @var Hustle_Model
32 */
33 protected $module;
34
35 /**
36 * Hustle_Meta constructos.
37 *
38 * @param array $data The saved meta's value.
39 * @param Hustle_Model $model Instance of the module this meta belongs to.
40 */
41 public function __construct( array $data, Hustle_Model $model ) {
42 $this->data = $data;
43 $this->module = $model;
44 }
45
46 /**
47 * Return an array with the default values.
48 * Must be overridden to return an array of default values
49 * without restricting them to static values.
50 *
51 * @since 4.0.0
52 *
53 * @return array
54 */
55 abstract public function get_defaults();
56
57 /**
58 * Returns the defaults for merging purposes.
59 * Allows handling unwanted overrides of the saved data.
60 *
61 * @since 4.4.1
62 *
63 * @return array
64 */
65 protected function get_defaults_for_merge() {
66 return $this->get_defaults();
67 }
68
69 /**
70 * Returns the meta value with the defaults as fallback.
71 * Useful for introducing new values without things exploding.
72 *
73 * @since unknown
74 *
75 * @todo Rename this method. It's inaccurate.
76 *
77 * @return array
78 */
79 public function to_array() {
80 $defaults = $this->get_defaults_for_merge();
81 if ( $defaults ) {
82 $data = array_replace_recursive( $defaults, $this->data );
83 } else {
84 $data = $this->data;
85 }
86
87 if ( ! empty( $data['schedule'] ) ) {
88 array_walk_recursive(
89 $data['schedule'],
90 function ( &$val ) {
91 $val = esc_attr( $val );
92 }
93 );
94 }
95
96 return $data;
97 }
98 }
99