Exemple #1
0
 public function get($d = array())
 {
     parent::get($d);
     if (empty($this->_allTemplates)) {
         $directories = utilsGmp::getDirList(GMP_TEMPLATES_DIR);
         if (!empty($directories)) {
             foreach ($directories as $code => $dir) {
                 if ($xml = utilsGmp::getXml($dir['path'] . 'settings.xml')) {
                     $this->_allTemplates[$code] = $xml;
                     $this->_allTemplates[$code]->prevImg = GMP_TEMPLATES_PATH . $code . '/screenshot.png';
                 }
             }
         }
         if (is_dir(utilsGmp::getCurrentWPThemeDir() . 'gmp' . DS)) {
             if ($xml = utilsGmp::getXml(utilsGmp::getCurrentWPThemeDir() . 'gmp' . DS . 'settings.xml')) {
                 $code = utilsGmp::getCurrentWPThemeCode();
                 if (strpos($code, '/') !== false) {
                     // If theme is in sub-folder
                     $code = explode('/', $code);
                     $code = trim($code[count($code) - 1]);
                 }
                 $this->_allTemplates[$code] = $xml;
                 if (is_file(utilsGmp::getCurrentWPThemeDir() . 'screenshot.jpg')) {
                     $this->_allTemplates[$code]->prevImg = utilsGmp::getCurrentWPThemePath() . '/screenshot.jpg';
                 } else {
                     $this->_allTemplates[$code]->prevImg = utilsGmp::getCurrentWPThemePath() . '/screenshot.png';
                 }
             }
         }
     }
     if (isset($d['code']) && isset($this->_allTemplates[$d['code']])) {
         return $this->_allTemplates[$d['code']];
     }
     return $this->_allTemplates;
 }
Exemple #2
0
 protected function _extractModules()
 {
     $activeModules = $this->getTable('modules')->innerJoin($this->getTable('modules_type'), 'type_id')->get($this->getTable('modules')->alias() . '.*, ' . $this->getTable('modules_type')->alias() . '.label as type_name');
     if ($activeModules) {
         foreach ($activeModules as $m) {
             $code = $m['code'];
             $moduleLocationDir = GMP_MODULES_DIR;
             if (!empty($m['ex_plug_dir'])) {
                 $moduleLocationDir = utilsGmp::getExtModDir($m['ex_plug_dir']);
             }
             if (is_dir($moduleLocationDir . $code)) {
                 $this->_allModules[$m['code']] = 1;
                 if ((bool) $m['active']) {
                     importClassGmp($code . strFirstUp(GMP_CODE), $moduleLocationDir . $code . DS . 'mod.php');
                     $moduleClass = toeGetClassNameGmp($code);
                     if (class_exists($moduleClass)) {
                         $this->_modules[$code] = new $moduleClass($m);
                         $this->_modules[$code]->setParams((array) json_decode($m['params']));
                         if (is_dir($moduleLocationDir . $code . DS . 'tables')) {
                             $this->_extractTables($moduleLocationDir . $code . DS . 'tables' . DS);
                         }
                     }
                 }
             }
         }
     }
     //$operationTime = microtime(true) - $startTime;
 }
Exemple #3
0
 public function init()
 {
     if (frameGmp::isAdminPlugPage()) {
         $this->_styles = array('styleGmp' => array('path' => GMP_CSS_PATH . 'style.css'), 'adminStylesGmp' => array('path' => GMP_CSS_PATH . 'adminStyles.css'), 'farbtastic' => array(), 'wp-jquery-ui-dialog' => array(), 'jquery-dialog' => array('path' => GMP_CSS_PATH . 'jquery-dialog.css'));
     }
     $defaultPlugTheme = frameGmp::_()->getModule('options')->get('default_theme');
     $ajaxurl = admin_url('admin-ajax.php');
     if (frameGmp::_()->getModule('options')->get('ssl_on_ajax')) {
         $ajaxurl = uriGmp::makeHttps($ajaxurl);
     }
     $jsData = array('siteUrl' => GMP_SITE_URL, 'imgPath' => GMP_IMG_PATH, 'cssPath' => GMP_CSS_PATH, 'loader' => GMP_LOADER_IMG, 'close' => GMP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameGmp::_()->getModule('options')->get('js_animation_speed'), 'siteLang' => langGmp::getData(), 'options' => frameGmp::_()->getModule('options')->getAllowedPublicOptions(), 'GMP_CODE' => GMP_CODE, 'ball_loader' => GMP_IMG_PATH . 'ajax-loader-ball.gif', 'ok_icon' => GMP_IMG_PATH . 'ok-icon.png', 'isHttps' => uriGmp::isHttps());
     if (frameGmp::isAdminPlugPage()) {
         frameGmp::_()->addScript('commonGmp', GMP_JS_PATH . 'common.js');
         frameGmp::_()->addScript('coreGmp', GMP_JS_PATH . 'core.js');
         $jsData = dispatcherGmp::applyFilters('jsInitVariables', $jsData);
         frameGmp::_()->addJSVar('coreGmp', 'GMP_DATA', $jsData);
         frameGmp::_()->addScript('datatable', GMP_JS_PATH . 'jquery.dataTables.min.js');
         frameGmp::_()->addScript('farbtastic', get_bloginfo('wpurl') . '/wp-admin/js/farbtastic.js', array('jquery'));
         frameGmp::_()->addScript('jquery-ui-tabs', '', array('jquery'), false, true);
         frameGmp::_()->addScript('jquery-ui-autocomplete', '', array('jquery'), false, true);
         frameGmp::_()->getModule('marker')->connectAssets();
         frameGmp::_()->addScript('jquery-ui-dialog', '', array('jquery'));
         frameGmp::_()->addScript('adminOptionsGmp', GMP_JS_PATH . 'admin.options.js');
     }
     if (is_admin()) {
         frameGmp::_()->addScript('ajaxupload', GMP_JS_PATH . 'ajaxupload.js');
         frameGmp::_()->addScript('postbox', get_bloginfo('wpurl') . '/wp-admin/js/postbox.js');
         add_action('wp_enqueue_scripts', array($this, 'addThickbox'));
         $jsData['allCheckRegPlugs'] = modInstallerGmp::getCheckRegPlugs();
     } else {
     }
     foreach ($this->_styles as $s => $sInfo) {
         if (isset($sInfo['for'])) {
             if ($sInfo['for'] == 'frontend' && is_admin() || $sInfo['for'] == 'admin' && !is_admin()) {
                 continue;
             }
         }
         $canBeSubstituted = true;
         if (isset($sInfo['substituteFor'])) {
             switch ($sInfo['substituteFor']) {
                 case 'frontend':
                     $canBeSubstituted = !is_admin();
                     break;
                 case 'admin':
                     $canBeSubstituted = is_admin();
                     break;
             }
         }
         if ($canBeSubstituted && file_exists(GMP_TEMPLATES_DIR . $defaultPlugTheme . DS . $s . '.css')) {
             frameGmp::_()->addStyle($s, GMP_TEMPLATES_PATH . $defaultPlugTheme . '/' . $s . '.css');
         } elseif ($canBeSubstituted && file_exists(utilsGmp::getCurrentWPThemeDir() . 'gmp' . DS . $s . '.css')) {
             frameGmp::_()->addStyle($s, utilsGmp::getCurrentWPThemePath() . '/toe/' . $s . '.css');
         } elseif (!empty($sInfo['path'])) {
             frameGmp::_()->addStyle($s, $sInfo['path']);
         } else {
             frameGmp::_()->addStyle($s);
         }
     }
     parent::init();
 }
Exemple #4
0
 public function put($d = array())
 {
     $res = new responseGmp();
     $id = $this->_getIDFromReq($d);
     $d = prepareParamsGmp($d);
     if (is_numeric($id) && $id) {
         if (isset($d['active'])) {
             $d['active'] = is_string($d['active']) && $d['active'] == 'true' || $d['active'] == 1 ? 1 : 0;
         }
         //mmm.... govnokod?....)))
         /* else
            $d['active'] = 0;*/
         if (frameGmp::_()->getTable('modules')->update($d, array('id' => $id))) {
             $res->messages[] = langGmp::_('Module Updated');
             $mod = frameGmp::_()->getTable('modules')->getById($id);
             $newType = frameGmp::_()->getTable('modules_type')->getById($mod['type_id'], 'label');
             $newType = $newType['label'];
             $res->data = array('id' => $id, 'label' => $mod['label'], 'code' => $mod['code'], 'type' => $newType, 'params' => utilsGmp::jsonEncode($mod['params']), 'description' => $mod['description'], 'active' => $mod['active']);
         } else {
             if ($tableErrors = frameGmp::_()->getTable('modules')->getErrors()) {
                 $res->errors = array_merge($res->errors, $tableErrors);
             } else {
                 $res->errors[] = langGmp::_('Module Update Failed');
             }
         }
     } else {
         $res->errors[] = langGmp::_('Error module ID');
     }
     parent::put($d);
     return $res;
 }
Exemple #5
0
 public function getPluginSettingsTab()
 {
     $saveStatistic = $this->getModel('options')->getStatisticStatus();
     $indoWindowSize = utilsGmp::unserialize($this->getModel('options')->get('infowindow_size'));
     $this->assign('saveStatistic', $saveStatistic);
     $this->assign('indoWindowSize', $indoWindowSize);
     $this->assign('additionalGlobalSettings', dispatcherGmp::applyFilters('additionalGlobalSettings', array()));
     return parent::getContent('settingsTab');
 }
Exemple #6
0
 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;
 }
Exemple #7
0
 public function __construct($d, $params = array())
 {
     $this->setTypeID($d['type_id']);
     $this->setType($d['type_name']);
     $this->setCode($d['code']);
     $this->setLabel($d['label']);
     $this->setDescription($d['description']);
     $this->setParams($d['params']);
     $this->_setID($d['id']);
     if (isset($d['ex_plug_dir']) && !empty($d['ex_plug_dir'])) {
         $this->isExternal(true);
         $this->setExternalDir(utilsGmp::getExtModDir($d['ex_plug_dir']));
         $this->setExternalPath(utilsGmp::getExtModPath($d['ex_plug_dir']));
     }
 }
Exemple #8
0
 public function getPath($tpl)
 {
     $path = '';
     $code = $this->_code;
     $parentModule = frameGmp::_()->getModule($this->_code);
     $plTemplate = frameGmp::_()->getModule('options')->get('template');
     // Current plugin template
     if (empty($plTemplate) || !frameGmp::_()->getModule($plTemplate)) {
         $plTemplate = '';
     }
     if (file_exists($parentModule->getModDir() . 'views' . DS . 'tpl' . DS . $tpl . '.php')) {
         // Try to find it in module directory
         $path = $parentModule->getModDir() . DS . 'views' . DS . 'tpl' . DS . $tpl . '.php';
     } elseif (file_exists(utilsGmp::getCurrentWPThemeDir() . 'gmp' . DS . $code . DS . $tpl . '.php')) {
         // Look in WP template folder
         $path = utilsGmp::getCurrentWPThemeDir() . 'gmp' . DS . $code . DS . $tpl . '.php';
     }
     return $path;
 }
 private function createFileName()
 {
     return utilsGmp::getRandStr() . '-' . utilsGmp::getRandStr() . '-' . utilsGmp::getRandStr() . '-' . utilsGmp::getRandStr();
 }
Exemple #10
0
 public static function startSession()
 {
     if (!utilsGmp::isSessionStarted()) {
         session_start();
     }
 }
Exemple #11
0
<script type='text/javascript'>
    var gmpExistsGroups = JSON.parse('<?php 
echo utilsGmp::jsonEncode($this->groupsList);
?>
');
</script>
<table class="gmpTable" id="GmpTableGroups">
      <thead>
          <tr>
              <th><?php 
langGmp::_e("ID");
?>
    </th>
              <th><?php 
langGmp::_e("Title");
?>
 </th>
              <th>
                  <?php 
langGmp::_e("Description");
?>
              </th>
              <th class='thOperations'>
                  <?php 
langGmp::_e("Operations");
?>
              </th>
          </tr>
      </thead>
      <tbody>
          <?php 
Exemple #12
0
 public function drawMap($params)
 {
     $ajaxurl = admin_url('admin-ajax.php');
     if (frameGmp::_()->getModule('options')->get('ssl_on_ajax')) {
         $ajaxurl = uriGmp::makeHttps($ajaxurl);
     }
     $jsData = array('siteUrl' => GMP_SITE_URL, 'imgPath' => GMP_IMG_PATH, 'loader' => GMP_LOADER_IMG, 'close' => GMP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameGmp::_()->getModule('options')->get('js_animation_speed'), 'siteLang' => langGmp::getData(), 'options' => frameGmp::_()->getModule('options')->getAllowedPublicOptions(), 'GMP_CODE' => GMP_CODE, 'ball_loader' => GMP_IMG_PATH . 'ajax-loader-ball.gif', 'ok_icon' => GMP_IMG_PATH . 'ok-icon.png', 'isHttps' => uriGmp::isHttps());
     frameGmp::_()->addScript('coreGmp', GMP_JS_PATH . 'core.js');
     $jsData = dispatcherGmp::applyFilters('jsInitVariables', $jsData);
     frameGmp::_()->addJSVar('coreGmp', 'GMP_DATA', $jsData);
     frameGmp::_()->addScript('jquery', '', array('jquery'));
     $mapObj = frameGmp::_()->getModule('gmap')->getModel()->getMapById($params['id']);
     if (isset($params['map_center']) && is_string($params['map_center'])) {
         if (strpos($params['map_center'], ';')) {
             $centerXY = array_map('trim', explode(';', $params['map_center']));
             $params['map_center'] = array('coord_x' => $centerXY[0], 'coord_y' => $centerXY[1]);
         } elseif (is_numeric($params['map_center'])) {
             // Map center - is coords of one of it's marker
             $params['map_center'] = (int) trim($params['map_center']);
             $found = false;
             if (!empty($mapObj['markers'])) {
                 foreach ($mapObj['markers'] as $marker) {
                     if ($marker['id'] == $params['map_center']) {
                         $params['map_center'] = array('coord_x' => $marker['coord_x'], 'coord_y' => $marker['coord_y']);
                         $found = true;
                         break;
                     }
                 }
             }
             // If no marker with such ID were found - just unset it to prevent map broke
             if (!$found) {
                 unset($params['map_center']);
             }
         } else {
             // If it is set, but not valid - just unset it to not break user map
             unset($params['map_center']);
         }
     }
     $shortCodeHtmlParams = array('width', 'height', 'align');
     $paramsCanNotBeEmpty = array('width', 'height');
     foreach ($shortCodeHtmlParams as $code) {
         if (isset($params[$code])) {
             if (in_array($code, $paramsCanNotBeEmpty) && empty($params[$code])) {
                 continue;
             }
             $mapObj['html_options'][$code] = $params[$code];
         }
     }
     $shortCodeMapParams = $this->getModel()->getParamsList();
     //array('map_display_mode', 'language', 'type', 'zoom', 'enable_zoom', 'enable_mouse_zoom');
     foreach ($shortCodeMapParams as $code) {
         if (isset($params[$code])) {
             if (in_array($code, $paramsCanNotBeEmpty) && empty($params[$code])) {
                 continue;
             }
             $mapObj['params'][$code] = $params[$code];
         }
     }
     if (isset($params['display_as_img']) && $params['display_as_img']) {
         $mapObj['params']['map_display_mode'] = 'popup';
     }
     if ($mapObj['params']['map_display_mode'] == 'popup') {
         frameGmp::_()->addScript('bpopup', GMP_JS_PATH . '/bpopup.js');
     }
     frameGmp::_()->addScript('google_maps_api_' . $mapObj['params']['language'], $this->getApiUrl() . $mapObj['params']['language']);
     frameGmp::_()->addScript('map.options', $this->getModule()->getModPath() . 'js/map.options.js', array('jquery'));
     frameGmp::_()->addStyle('map_params', $this->getModule()->getModPath() . 'css/map.css');
     frameGmp::_()->getModule('marker')->connectAssets();
     if (empty($mapObj['params']['map_display_mode'])) {
         $mapObj['params']['map_display_mode'] = 'map';
     }
     // This is for posibility to show multy maps with same ID on one page
     $mapObj['original_id'] = $mapObj['id'];
     if (isset($this->_idToRandId[$mapObj['original_id']])) {
         $mapObj['id'] = $this->_idToRandId[$mapObj['original_id']];
     } else {
         $this->_idToRandId[$mapObj['original_id']] = $mapObj['id'] = mt_rand(1, 99999) . $mapObj['id'];
     }
     $indoWindowSize = utilsGmp::unserialize(frameGmp::_()->getModule('options')->getModel('options')->get('infowindow_size'));
     $this->assign('indoWindowSize', $indoWindowSize);
     $this->assign('currentMap', $mapObj);
     $markersDisplayType = '';
     if (isset($params['display_type'])) {
         $markersDisplayType = $params['display_type'];
     } else {
         if (isset($params['markers_list_type'])) {
             $markersDisplayType = $params['markers_list_type'];
         } else {
             if (isset($mapObj['params']['markers_list_type']) && !empty($mapObj['params']['markers_list_type'])) {
                 $markersDisplayType = $mapObj['params']['markers_list_type'];
             }
         }
     }
     $mapObj['params']['markers_list_type'] = $markersDisplayType;
     $this->addMapData($mapObj);
     $this->assign('markersDisplayType', $markersDisplayType);
     // This will require only in PRO, but we will make it here - to avoid code doubling
     $this->assign('mapCategories', frameGmp::_()->getModule('marker_groups')->getModel()->getListForMarkers(isset($mapObj['markers']) ? $mapObj['markers'] : false));
     return parent::getContent('mapPreview');
 }
Exemple #13
0
 public static function listToJson($array)
 {
     return str_replace("'", "\\'", str_replace('\\', '\\\\', utilsGmp::jsonEncode($array)));
 }
Exemple #14
0
 public static function userFieldDestFromDB($value)
 {
     return utilsGmp::jsonDecode($value);
 }
Exemple #15
0
 /**
  * Check if the element exists in array
  * @param array $param 
  */
 function checkVarFromParam($param, $element)
 {
     return utilsGmp::xmlAttrToStr($param, $element);
     /*if (isset($param[$element])) {
     			// convert object element to string
     			return (string)$param[$element];
     		} else {
     			return '';
     		}*/
 }
Exemple #16
0
 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;
 }
Exemple #17
0
 public function downloadIconFromUrl($url)
 {
     $filename = basename($url);
     if (empty($filename)) {
         $this->pushError(__('File not found', GMP_LANG_CODE));
         return false;
     }
     $imageinfo = getimagesize($url, $imgProp);
     if (empty($imageinfo)) {
         $this->pushError(__('Cannot get image', GMP_LANG_CODE));
         return false;
     }
     $fileExt = str_replace("image/", "", $imageinfo['mime']);
     $filename = utilsGmp::getRandStr(8) . "." . $fileExt;
     $dest = $this->getIconsFullPath() . $filename;
     file_put_contents($dest, fopen($url, 'r'));
     $newIconId = frameGmp::_()->getTable('icons')->store(array('path' => $filename), "insert");
     if ($newIconId) {
         return array('id' => $newIconId, 'path' => $this->getIconsFullDir() . $filename);
     } else {
         $this->pushError(__('cannot insert to table', GMP_LANG_CODE));
         return false;
     }
 }
Exemple #18
0
 public static function getCurrentWPThemeDir()
 {
     static $themePath;
     if (empty($themePath)) {
         $themePath = get_theme_root() . DS . utilsGmp::getCurrentWPThemeCode() . DS;
     }
     return $themePath;
 }
Exemple #19
0
 public function loadJqGrid()
 {
     static $loaded = false;
     if (!$loaded) {
         $this->loadJqueryUi();
         frameGmp::_()->addScript('jq-grid', $this->_cdnUrl . 'lib/jqgrid/jquery.jqGrid.min.js');
         frameGmp::_()->addStyle('jq-grid', $this->_cdnUrl . 'lib/jqgrid/ui.jqgrid.css');
         $langToLoad = utilsGmp::getLangCode2Letter();
         $availableLocales = array('ar', 'bg', 'bg1251', 'cat', 'cn', 'cs', 'da', 'de', 'dk', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gl', 'he', 'hr', 'hr1250', 'hu', 'id', 'is', 'it', 'ja', 'kr', 'lt', 'mne', 'nl', 'no', 'pl', 'pt', 'pt', 'ro', 'ru', 'sk', 'sr', 'sr', 'sv', 'th', 'tr', 'tw', 'ua', 'vi');
         if (!in_array($langToLoad, $availableLocales)) {
             $langToLoad = 'en';
         }
         frameGmp::_()->addScript('jq-grid-lang', $this->_cdnUrl . 'lib/jqgrid/i18n/grid.locale-' . $langToLoad . '.js');
         $loaded = true;
     }
 }
Exemple #20
0
 public function updateInfoWindowSize($sizeParams)
 {
     return frameGmp::_()->getTable('options')->update(array('value' => utilsGmp::serialize($sizeParams)), "`code`='infowindow_size'");
 }
 public static function _installTables($module, $action = 'install')
 {
     $modDir = empty($module['ex_plug_dir']) ? GMP_MODULES_DIR . $module['code'] . DS : utilsGmp::getPluginDir($module['ex_plug_dir']) . $module['code'] . DS;
     if (is_dir($modDir . 'tables')) {
         $tableFiles = utilsGmp::getFilesList($modDir . 'tables');
         if (!empty($tableFiles)) {
             frameGmp::_()->extractTables($modDir . 'tables' . DS);
             foreach ($tableFiles as $file) {
                 $tableName = str_replace('.php', '', $file);
                 if (frameGmp::_()->getTable($tableName)) {
                     frameGmp::_()->getTable($tableName)->{$action}();
                 }
             }
         }
     }
 }
Exemple #22
0
 function prepareParamsGmp(&$d = array(), &$options = array())
 {
     if (!empty($d['params'])) {
         if (isset($d['params']['options'])) {
             $options = $d['params']['options'];
             //unset($d['params']['options']);
         }
         if (is_array($d['params'])) {
             $params = utilsGmp::jsonEncode($d['params']);
             $params = str_replace(array('\\n\\r', "\n\r", '\\n', "\r", '\\r', "\r"), '<br />', $params);
             $params = str_replace(array('<br /><br />', '<br /><br /><br />'), '<br />', $params);
             $d['params'] = $params;
         }
     } elseif (isset($d['params'])) {
         $d['params']['attr']['class'] = '';
         $d['params']['attr']['id'] = '';
         $params = utilsGmp::jsonEncode($d['params']);
         $d['params'] = $params;
     }
     if (empty($options)) {
         $options = array('value' => array('EMPTY'), 'data' => array());
     }
     if (isset($d['code'])) {
         if ($d['code'] == '') {
             $d['code'] = prepareFieldCodeGmp($d['label']) . '_' . rand(0, 9999999);
         }
     }
     return $d;
 }
Exemple #23
0
 public function connectMapsAssets($params, $forAdminArea = false)
 {
     $params['language'] = isset($params['language']) && !empty($params['language']) ? $params['language'] : utilsGmp::getLangCode2Letter();
     frameGmp::_()->addScript('google_maps_api', $this->getApiUrl() . '&language=' . $params['language']);
     frameGmp::_()->addScript('core.gmap', $this->getModule()->getModPath() . 'js/core.gmap.js');
     frameGmp::_()->addStyle('core.gmap', $this->getModule()->getModPath() . 'css/core.gmap.css');
     if (isset($params['marker_clasterer']) && $params['marker_clasterer'] != 'none' || $forAdminArea) {
         frameGmp::_()->addScript('core.markerclusterer', $this->getModule()->getModPath() . 'js/core.markerclusterer.min.js');
     }
     dispatcherGmp::doAction('afterConnectMapAssets', $params, $forAdminArea);
 }
Exemple #24
0
<div class="gmpMapsContainer">
    <?php 
/*?><div class="refreshMapsList">
      <a class="btn btn-success" id="gmpRefreshMapsList" onclick="getMapsList()">
          <span class="gmpIcon gmpIconRefresh"></span>
          <?php langGmp::_e('Refresh');?>
      </a>
  </div><?php */
?>
	<script type='text/javascript'>
		var existsMapsArr = JSON.parse('<?php 
echo utilsGmp::listToJson($this->mapsArr);
?>
');
		var defaultOpenTab = "<?php 
echo $this->currentTab;
?>
";
		//gmpActiveTab.mainmenu = "#<?php 
echo str_replace("#", "", $this->currentTab);
?>
";
	</script>
	<div id="gmpAllMapsListShell">
		<?php 
echo $this->allMaps;
?>
	</div>
	<div id="gmpEditMapShell" style="display: none;">
		<?php 
echo $this->editMap;
Exemple #25
0
 public static function init()
 {
     global $wpdb;
     $wpPrefix = $wpdb->prefix;
     /* add to 0.0.3 Versiom */
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $current_version = get_option($wpPrefix . GMP_DB_PREF . 'db_version', 0);
     $installed = (int) get_option($wpPrefix . GMP_DB_PREF . 'db_installed', 0);
     /**
      * modules 
      */
     if (!dbGmp::exist($wpPrefix . GMP_DB_PREF . "modules")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . GMP_DB_PREF . "modules` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `code` varchar(64) NOT NULL,\r\n\t\t\t  `active` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t  `type_id` smallint(3) NOT NULL DEFAULT '0',\r\n\t\t\t  `params` text,\r\n\t\t\t  `has_tab` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t  `label` varchar(128) DEFAULT NULL,\r\n\t\t\t  `description` text,\r\n\t\t\t  `ex_plug_dir` varchar(255) DEFAULT NULL,\r\n\t\t\t  PRIMARY KEY (`id`),\r\n\t\t\t  UNIQUE INDEX `code` (`code`)\r\n\t\t\t) DEFAULT CHARSET=utf8;");
         dbGmp::query("INSERT INTO `" . $wpPrefix . GMP_DB_PREF . "modules` (id, code, active, type_id, params, has_tab, label, description) VALUES\r\n\t\t\t\t(NULL, 'adminmenu',1,1,'',0,'Admin Menu',''),\r\n\t\t\t\t(NULL, 'options',1,1,'',1,'Options',''),\r\n\t\t\t\t(NULL, 'user',1,1,'',1,'Users',''),\r\n\t\t\t\t(NULL, 'templates',1,1,'',1,'Templates for Plugin',''),\r\n\r\n\t\t\t\t(NULL, 'shortcodes', 1, 6, '', 0, 'Shortcodes', 'Shortcodes data'),\r\n\t\t\t\t(NULL, 'gmap', 1, 1, '',1, 'Gmap', 'Gmap'),\r\n\t\t\t\t(NULL, 'marker', 1, 1, '', 0, 'Markers', 'Google Maps Markers'),\r\n\t\t\t\t(NULL, 'marker_groups', 1, 1, '', 0, 'Marker Gropus', 'Marker Groups'),                  \r\n\t\t\t\t(NULL, 'supsystic_promo', 1, 1, '', 0, 'Promo', 'Promo'),\r\n\t\t\t\t(NULL, 'icons', 1, 1, '', 1, 'Marker Icons', 'Marker Icons'),\r\n\t\t\t\t(NULL, 'mail', 1, 1, '', 1, 'mail', 'mail');");
     }
     if (dbGmp::exist('@__modules', 'code', 'promo')) {
         dbGmp::query('UPDATE @__modules SET code = "supsystic_promo" WHERE code = "promo"');
     }
     if (!dbGmp::exist('@__modules', 'code', 'mail')) {
         dbGmp::query("INSERT INTO `" . $wpPrefix . GMP_DB_PREF . "modules` (id, code, active, type_id, params, has_tab, label, description) VALUES\r\n\t\t\t\t(NULL, 'mail', 1, 1, '', 1, 'mail', 'mail');");
     }
     if (!dbGmp::exist('@__modules', 'code', 'supsystic_promo')) {
         dbGmp::query("INSERT INTO `@__modules` (id, code, active, type_id, params, has_tab, label, description) VALUES\r\n\t\t\t\t(NULL, 'supsystic_promo', 1, 1, '', 1, 'supsystic_promo', 'supsystic_promo');");
     }
     /**
      *  modules_type 
      */
     if (!dbGmp::exist($wpPrefix . GMP_DB_PREF . "modules_type")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . GMP_DB_PREF . "modules_type` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `label` varchar(64) NOT NULL,\r\n\t\t\t  PRIMARY KEY (`id`)\r\n\t\t\t) AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;");
         dbGmp::query("INSERT INTO `" . $wpPrefix . GMP_DB_PREF . "modules_type` VALUES\r\n\t\t\t  (1,'system'),\r\n\t\t\t  (4,'widget'),\r\n\t\t\t  (6,'addons'),\r\n\t\t\t  (7,'template')");
     }
     /**
      * options 
      */
     if (!dbGmp::exist($wpPrefix . GMP_DB_PREF . "options")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . GMP_DB_PREF . "options` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `code` varchar(64) CHARACTER SET latin1 NOT NULL,\r\n\t\t\t  `value` text NULL,\r\n\t\t\t  `label` varchar(128) CHARACTER SET latin1 DEFAULT NULL,\r\n\t\t\t  `description` text CHARACTER SET latin1,\r\n\t\t\t  `htmltype_id` smallint(2) NOT NULL DEFAULT '1',\r\n\t\t\t  `params` text NULL,\r\n\t\t\t  `cat_id` mediumint(3) DEFAULT '0',\r\n\t\t\t  `sort_order` mediumint(3) DEFAULT '0',\r\n\t\t\t  `value_type` varchar(16) CHARACTER SET latin1 DEFAULT NULL,\r\n\t\t\t  PRIMARY KEY (`id`),\r\n\t\t\t  KEY `id` (`id`),\r\n\t\t\t  UNIQUE INDEX `code` (`code`)\r\n\t\t\t) DEFAULT CHARSET=utf8");
         dbGmp::query("insert into `" . $wpPrefix . GMP_DB_PREF . "options` (  `code` ,  `value` ,  `label` ) \r\n\t\t\t\t\tVALUES ( 'save_statistic',  '0',  'Send statistic')");
         dbGmp::query("insert into `@__options` (`code`,`value`,`label`) VALUES\r\n\t\t\t('infowindow_size','" . utilsGmp::serialize(array('width' => '100', 'height' => '100')) . "','Info Window Size')");
     }
     /* options categories */
     if (!dbGmp::exist($wpPrefix . GMP_DB_PREF . "options_categories")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . GMP_DB_PREF . "options_categories` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `label` varchar(128) NOT NULL,\r\n\t\t\t  PRIMARY KEY (`id`),\r\n\t\t\t  KEY `id` (`id`)\r\n\t\t\t) DEFAULT CHARSET=utf8");
         dbGmp::query("INSERT INTO `" . $wpPrefix . GMP_DB_PREF . "options_categories` VALUES\r\n\t\t\t\t(1, 'General'),\r\n\t\t\t\t(2, 'Template'),\r\n\t\t\t\t(3, 'Subscribe'),\r\n\t\t\t\t(4, 'Social');");
     }
     /*
      * Create table for map
      */
     if (!dbGmp::exist($wpPrefix . GMP_DB_PREF . "maps")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . GMP_DB_PREF . "maps` (\r\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t`title` varchar(125) CHARACTER SET utf8  NOT NULL,\r\n\t\t\t\t`description` text CHARACTER SET utf8 NULL,\r\n\t\t\t\t`params` text NULL,\r\n\t\t\t\t`html_options` text NOT NULL,\r\n\t\t\t\t`create_date` datetime,\r\n\t\t\t\tPRIMARY KEY (`id`),\r\n\t\t\t\tUNIQUE INDEX `id` (`id`)\r\n\t\t\t  ) DEFAULT CHARSET=utf8");
     }
     /**
      * Create table for markers    
      */
     if (!dbGmp::exist($wpPrefix . GMP_DB_PREF . "markers")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . GMP_DB_PREF . "markers" . "` (\r\n\t\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t`title` varchar(125) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t\t\t`description` text CHARACTER SET utf8 NULL,\r\n\t\t\t\t\t`coord_x` varchar(30) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t\t\t`coord_y` varchar(30) CHARACTER SET utf8 NOT NULL,\r\n\t\t\t\t\t`icon` int(11),\r\n\t\t\t\t\t`map_id` int(11),\r\n\t\t\t\t\t`marker_group_id` int(11),\r\n\t\t\t\t\t`address` text CHARACTER SET utf8,\r\n\t\t\t\t\t`animation` int(1),\r\n\t\t\t\t\t`create_date` datetime,\r\n\t\t\t\t\t`params` text  CHARACTER SET utf8 NOT NULL,\r\n\t\t\t\t\t`sort_order` tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\tPRIMARY KEY (`id`)\r\n\t\t\t\t) DEFAULT CHARSET=utf8");
     }
     if (!dbGmp::exist($wpPrefix . GMP_DB_PREF . "markers", 'sort_order')) {
         dbGmp::query("ALTER TABLE `@__markers` ADD COLUMN `sort_order` tinyint(1) NOT NULL DEFAULT '0';");
     }
     /**
      * Create table for marker Icons
      */
     if (!dbGmp::exist($wpPrefix . GMP_DB_PREF . "icons")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . GMP_DB_PREF . "icons" . "` (\r\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t`title` varchar(100) CHARACTER SET utf8,   \r\n\t\t\t\t`description` text CHARACTER SET utf8,   \r\n\t\t\t\t`path` varchar(250) CHARACTER SET utf8,   \r\n\t\t\t\t PRIMARY KEY (`id`)\r\n\t\t\t) DEFAULT CHARSET=utf8");
     }
     /**
      * Create table for marker groups
      */
     if (!dbGmp::exist($wpPrefix . GMP_DB_PREF . "marker_groups")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . GMP_DB_PREF . "marker_groups" . "` (\r\n\t\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t`title` varchar(250) CHARACTER SET utf8,\r\n\t\t\t\t\t`description` text CHARACTER SET utf8,\r\n\t\t\t\t PRIMARY KEY (`id`)\r\n\t\t\t\t  ) DEFAULT CHARSET=utf8");
     }
     $markerGroupsClearedInvalid = get_option($wpPrefix . GMP_DB_PREF . 'mg_cleared_inv', 0);
     if (!$markerGroupsClearedInvalid) {
         dbGmp::query('UPDATE @__markers SET marker_group_id = 0 WHERE marker_group_id = 1');
         // This was wrong update in markers table before - fix this one time before update plugin
         update_option($wpPrefix . GMP_DB_PREF . 'mg_cleared_inv', 1);
     }
     /**
      * Plugin usage statistics
      */
     if (!dbGmp::exist($wpPrefix . GMP_DB_PREF . "usage_stat")) {
         dbDelta("CREATE TABLE `" . $wpPrefix . GMP_DB_PREF . "usage_stat` (\r\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  `code` varchar(64) NOT NULL,\r\n\t\t\t  `visits` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t  `spent_time` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t  `modify_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\r\n\t\t\t  UNIQUE INDEX `code` (`code`),\r\n\t\t\t  PRIMARY KEY (`id`)\r\n\t\t\t) DEFAULT CHARSET=utf8");
         dbGmp::query("INSERT INTO `" . $wpPrefix . GMP_DB_PREF . "usage_stat` (code, visits) VALUES ('installed', 1)");
     }
     update_option($wpPrefix . GMP_DB_PREF . 'db_version', GMP_VERSION_PLUGIN);
     add_option($wpPrefix . GMP_DB_PREF . 'db_installed', 1);
     installerDbUpdaterGmp::runUpdate();
 }
Exemple #26
0
 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;
 }
Exemple #27
0
                      onclick='gmpEditMarkerItem(<?php echo $marker['id']?>); return false;'>
                      <span class='gmpIcon gmpIconEdit '></span>
                      <?php echo langGmp::_("Edit")?></a>
                  <a class='btn btn-danger gmpRemoveBtn gmpListActBtn' id='<?php echo $marker['id']?>'
                     onclick="gmpRemoveMarkerItem(<?php echo $marker['id']?>)">
                    <span class='gmpIcon gmpIconRemove '></span>
                      <?php echo langGmp::_("Remove")?>
                  </a>
                  <span id="gmpMarkerListTableLoader_<?php echo $marker['id']?>"></span>
              </td>

          </tr> 

                  <?php
              }
          ?>
      </tbody><?php */
?>
</table>
<script type="text/javascript">
// <!--
jQuery(document).ready(function(){
	gmpMarkersTblColumns = <?php 
echo utilsGmp::jsonEncode($this->displayColumns);
?>
;
});
// -->
</script>

    
<script type="text/javascript">
// <!--
var toeTextEditorInst = null;   //Here will be stored current text editor instance, see shortcodes/js/textEditroPlugin.js - ed var
var toeShortCodesData = <?php 
echo utilsGmp::jsonEncode($this->shortcodes);
?>
;
var toeShortCodeDataSelected = '';
var toeShortCodeCurrentMenuSelectedHtml = null;
(function(){
    jQuery('#toeInsertShortcodeSelectBox').accordion({
        change: function(event, ui) {
            toeShortCodeCurrentMenuSelectedHtml = ui.newContent;
            var code = jQuery(ui.newHeader).find('a:first').attr('title');
            jQuery('#toeInsertShortcodeSelectBox > div').css('height', '');
            if(code) {
                toeShortcodeSelect(code, toeShortCodeCurrentMenuSelectedHtml);
            } else {
                toeShortcodeSelect(jQuery('#toeInsertShortcodeForm select[name=shortcodeType]').val(), toeShortCodeCurrentMenuSelectedHtml);
            }
        },
        create: function(event, ui) {
            toeShortCodeCurrentMenuSelectedHtml = jQuery('#toeInsertShortcodeContentDefault');
        }
    });
    jQuery('#toeInsertShortcodeSelectBox > div').css('height', '');
    jQuery('#toeInsertShortcodeForm').submit(function(){
        if(jQuery(toeShortCodeCurrentMenuSelectedHtml).find('.toeInsertShortcodeAtts').find('input, select, textarea').size()) {
            var attsStr = ' ';
            var insertedAtts = 0;
            jQuery(toeShortCodeCurrentMenuSelectedHtml).find('.toeInsertShortcodeAtts').find('input, select, textarea').each(function(){
Exemple #29
0
 public function getMapById($id = false, $withMarkers = true, $withGroups = false)
 {
     if (!$id) {
         return false;
     }
     $map = frameGmp::_()->getTable('maps')->get('*', array('id' => (int) $id));
     if (!empty($map)) {
         $markerModule = frameGmp::_()->getModule('marker');
         if ($withMarkers) {
             $map[0]['markers'] = $markerModule->getModel()->getMapMarkers($map[0]['id'], $withGroups);
         }
         $map[0]['html_options'] = utilsGmp::unserialize($map[0]['html_options']);
         $map[0]['params'] = utilsGmp::unserialize($map[0]['params']);
         return $map[0];
     }
     return false;
 }
 public static function update_05()
 {
     dbGmp::query("ALTER TABLE `@__markers` ADD column `params` text;");
     dbGmp::query("insert into `@__options` (`code`,`value`,`label`) VALUES('save_statistic','0','Save Statistic')");
     dbGmp::query("insert into `@__options` (`code`,`value`,`label`) VALUES\n\t\t\t('infowindow_size','" . utilsGmp::serialize(array('width' => '100', 'height' => '100')) . "','Info Window Size')");
 }