PluginProbe ʕ •ᴥ•ʔ
AI Copilot – Content Generator / 1.5.4
AI Copilot – Content Generator v1.5.4
1.5.4 1.4.21 1.4.18 1.4.19 1.4.20 trunk 1.0.4 1.1.0 1.2.0 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.17 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.9
ai-copilot-content-generator / classes / fieldAdapter.php
ai-copilot-content-generator / classes Last commit date
helpers 1 week ago tables 1 week ago aIProviderInterface.php 1 week ago assets.php 1 week ago baseObject.php 1 week ago builderBlock.php 1 week ago controller.php 1 week ago date.php 1 week ago db.php 1 week ago dispatcher.php 1 week ago errors.php 1 week ago field.php 1 week ago fieldAdapter.php 1 week ago frame.php 1 week ago helper.php 1 week ago html.php 1 week ago installer.php 1 week ago installerDbUpdater.php 1 week ago integration.php 1 week ago modInstaller.php 1 week ago model.php 1 week ago module.php 1 week ago req.php 1 week ago response.php 1 week ago table.php 1 week ago uri.php 1 week ago user.php 1 week ago utils.php 1 week ago validator.php 1 week ago view.php 1 week ago
fieldAdapter.php
52 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5 /**
6 * Class to adapt field before display and save/get DB
7 * return ONLY htmlParams property
8 *
9 * @see field
10 */
11 class WaicFieldAdapter {
12 const DB = 'WaicDb';
13 const HTML = 'WaicHtml';
14 const STR = 'str';
15 public static $userfieldDest = array('registration', 'shipping', 'billing');
16 public static $countries = array();
17 public static $states = array();
18 /**
19 * Executes field Adaption process
20 *
21 * @param object type field or value $fieldOrValue if DB adaption - this must be a value of field, elase if html - field object
22 */
23 public static function _( $fieldOrValue, $method, $type ) {
24 if (method_exists('WaicFieldAdapter', $method)) {
25 switch ($type) {
26 case self::DB:
27 return self::$method($fieldOrValue);
28 break;
29 case self::HTML:
30 self::$method($fieldOrValue);
31 break;
32 case self::STR:
33 return self::$method($fieldOrValue);
34 break;
35 }
36 }
37 return $fieldOrValue;
38 }
39 public static function intToDB( $val ) {
40 return intval($val);
41 }
42 public static function floatToDB( $val ) {
43 return floatval($val);
44 }
45 public static function userFieldDestToDB( $value ) {
46 return WaicUtils::jsonEncode($value);
47 }
48 public static function userFieldDestFromDB( $value ) {
49 return WaicUtils::jsonDecode($value);
50 }
51 }
52