public function getStylizationsList() { if (empty($this->_stylizations)) { $this->_stylizations = dispatcherGmp::applyFilters('stylizationsList', require_once $this->getModDir() . 'stylezations.php'); foreach ($this->_stylizations as $k => $v) { $this->_stylizations[$k] = utilsGmp::jsonDecode($this->_stylizations[$k]); } } return $this->_stylizations; }
public function setDefaultIcons() { $jsonFile = frameGmp::_()->getModule('icons')->getModDir() . 'icons_files/icons.json'; $icons = utilsGmp::jsonDecode(file_get_contents($jsonFile)); $uplDir = wp_upload_dir(); if (!is_dir($uplDir['basedir'])) { @mkdir($uplDir['basedir'], 0777); } $icons_upload_path = $uplDir['basedir'] . $this->getIconsPath(); if (!is_dir($icons_upload_path)) { @mkdir($icons_upload_path, 0777); } $qItems = array(); foreach ($icons as $icon) { $qItems[] = "('" . $icon['title'] . "','" . $icon['description'] . "','" . $icon['img'] . "')"; } $query = "insert into `@__icons` (`title`,`description`,`path`) VALUES " . implode(",", $qItems); dbGmp::query($query); update_option('gmp_def_icons_installed', true); }
public static function userFieldDestFromDB($value) { return utilsGmp::jsonDecode($value); }
public function findAddress($params) { if (!isset($params['addressStr']) || strlen($params['addressStr']) < 3) { $this->pushError(langGmp::_('Address is empty or not match')); return false; } $addr = $params['addressStr']; $getdata = http_build_query(array('address' => $addr, 'language' => 'en', 'sensor' => 'false')); $google_response = utilsGmp::jsonDecode(file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?' . $getdata)); $res = array(); foreach ($google_response['results'] as $response) { $res[] = array('position' => $response['geometry']['location'], 'address' => $response['formatted_address']); } return $res; }
/** * Check plugin activity on our server */ private static function _checkPluginActivity($locations = array(), $modules = array()) { $plugName = basename($locations['plugDir']); if (!empty($plugName)) { if (!class_exists('WP_Http')) { include_once ABSPATH . WPINC . '/class-http.php'; } $ourUrl = self::_getAddress('plugHasKeys'); $ourUrl .= '&plugName=' . urlencode($plugName); $res = wp_remote_get($ourUrl); if ($res) { $body = wp_remote_retrieve_body($res); if ($body) { $resArray = utilsGmp::jsonDecode($body); if ($resArray && is_array($resArray) && isset($resArray['data']) && isset($resArray['data']['plugHasKeys'])) { if ((int) $resArray['data']['plugHasKeys']) { foreach ($modules as $m) { frameGmp::_()->getModule('options')->getModel('modules')->put(array('code' => $m['code'], 'active' => 0)); } self::_addToActivationMessage($plugName, $modules, $locations); } } } } } }
public static function textFieldsDynamicTable($name, $params = array('value' => '', 'attrs' => '', 'options' => array())) { $res = ''; if (empty($params['options'])) { $params['options'] = array(0 => array('label' => '')); } if (!empty($params['options'])) { $pattern = array(); foreach ($params['options'] as $key => $p) { $pattern[$key] = htmlGmp::text($name . '[][' . $key . ']'); } $countOptions = count($params['options']); $remove = '<a href="#" onclick="toeRemoveTextFieldsDynamicTable(this); return false;">remove</a>'; $add = '<a href="#" onclick="toeAddTextFieldsDynamicTable(this, ' . $countOptions . '); return false;">add</a>'; $res = '<div class="toeTextFieldsDynamicTable">'; if (empty($params['value'])) { $params['value'] = array(); } elseif (!is_array($params['value'])) { $params['value'] = utilsGmp::jsonDecode($params['value']); //$params['value'] = $params['value'][0]; } $i = 0; do { $res .= '<div class="toeTextFieldDynamicRow">'; foreach ($params['options'] as $key => $p) { switch ($countOptions) { case 1: if (isset($params['value'][$i])) { $value = is_array($params['value'][$i]) ? $params['value'][$i][$key] : $params['value'][$i]; } else { $value = ''; } break; case 2: default: $value = isset($params['value'][$i][$key]) ? $params['value'][$i][$key] : ''; break; } $paramsForText = array('value' => $value); $res .= __($p['label']) . htmlGmp::text($name . '[' . $i . '][' . $key . ']', $paramsForText); } $res .= $remove . '</div>'; $i++; } while ($i < count($params['value'])); $res .= $add; $res .= '</div>'; } return $res; }