Example #1
0
 public function addNoticeAction()
 {
     $res = new responseGmp();
     $code = reqGmp::getVar('code', 'post');
     $choice = reqGmp::getVar('choice', 'post');
     if (!empty($code) && !empty($choice)) {
         $optModel = frameGmp::_()->getModule('options')->getModel();
         switch ($choice) {
             case 'hide':
                 $optModel->save('hide_' . $code, 1);
                 break;
             case 'later':
                 $optModel->save('later_' . $code, time());
                 break;
             case 'done':
                 $optModel->save('done_' . $code, 1);
                 if ($code == 'enb_promo_link_msg') {
                     $optModel->save('add_love_link', 1);
                 }
                 break;
         }
         $this->getModel()->saveUsageStat($code . '.' . $choice, true);
         $this->getModel()->checkAndSend(true);
     }
     $res->ajaxExec();
 }
Example #2
0
 public function exportData()
 {
     $data = reqGmp::get('post');
     $exportItem = $data['to_export'];
     $res = new responseGmp();
     //$exportModule = frameGmp::_()->getModule($exportItem);
     switch ($data["gmpActionMode"]) {
         case "export":
             $maps = $data['map'];
             $mapsArr = array();
             $mapsModule = frameGmp::_()->getModule("gmap");
             foreach ($maps as $k => $map_id) {
                 $mapsArr[] = $mapsModule->getModel()->getMapById($map_id, $withMarkers = true, $withGroups = true);
             }
             $uplDir = wp_upload_dir();
             $filePath = $uplDir['basedir'];
             $filename = "export" . date("Y_M_D") . "_" . rand(10, 100) . ".csv";
             $dest = $filePath . DS . $filename;
             $handle = fopen($dest, "a+");
             if ($handle) {
                 file_put_contents($dest, utilsGmp::serialize($mapsArr));
             }
             fclose($handle);
             $data = array("file" => $uplDir['baseurl'] . DS . $filename);
             break;
     }
     $res->addData($data);
     return $res->ajaxExec();
 }
Example #3
0
 public function remove()
 {
     $res = new responseGmp();
     if (!$this->getModel()->remove(reqGmp::get('post'))) {
         $res->pushError($this->getModel()->getErrors());
     }
     return $res->ajaxExec();
 }
Example #4
0
 public function getEditTabContent()
 {
     $id = (int) reqGmp::getVar('id', 'get');
     if (!$id) {
         return __('No Map Found', GMP_LANG_CODE);
     }
     return $this->getView()->getEditMap($id);
 }
Example #5
0
 public function displayDeactivatePage()
 {
     $this->assign('GET', reqGmp::get('get'));
     $this->assign('POST', reqGmp::get('post'));
     $this->assign('REQUEST_METHOD', strtoupper(reqGmp::getVar('REQUEST_METHOD', 'server')));
     $this->assign('REQUEST_URI', basename(reqGmp::getVar('REQUEST_URI', 'server')));
     parent::display('deactivatePage');
 }
Example #6
0
 public function remove()
 {
     $res = new responseGmp();
     if (!$this->getModel()->remove(reqGmp::get('post'))) {
         $res->pushError($this->getModel()->getErrors());
     }
     //frameGmp::_()->getModule('supsystic_promo')->getModel()->saveUsageStat('icon.delete');
     return $res->ajaxExec();
 }
Example #7
0
 public function saveUsageStat()
 {
     $res = new responseGmp();
     $code = reqGmp::getVar('code');
     if ($code) {
         $this->getModel()->saveUsageStat($code);
     }
     return $res->ajaxExec();
 }
Example #8
0
 public function saveGroup()
 {
     $res = new responseGmp();
     if ($this->getModel()->saveGroup(reqGmp::get('post'))) {
         $res->addMessage(__('Done', GMP_LANG_CODE));
     } else {
         $res->pushError($this->getModel('options')->getErrors());
     }
     return $res->ajaxExec();
 }
Example #9
0
 public function remove()
 {
     $res = new responseGmp();
     if ($this->getModel()->remove(reqGmp::getVar('id', 'post'))) {
         $res->addMessage(__('Done', GMP_LANG_CODE));
     } else {
         $res->pushError($this->getModel()->getErrors());
     }
     $res->ajaxExec();
 }
Example #10
0
 public function ajaxExec($forceAjax = false)
 {
     $reqType = reqGmp::getVar('reqType');
     $redirect = reqGmp::getVar('redirect');
     if (count($this->errors) > 0) {
         $this->error = true;
     }
     if ($reqType == 'ajax' || $forceAjax) {
         exit(json_encode($this));
     }
     /*if($redirect)
       redirectGmp($redirect);*/
     return $this;
 }
Example #11
0
 public function ajaxExec()
 {
     $reqType = reqGmp::getVar('reqType');
     $redirect = reqGmp::getVar('redirect');
     if (count($this->errors) > 0) {
         $this->error = true;
     }
     if ($reqType == 'ajax') {
         exit(json_encode($this));
     }
     if ($redirect) {
         redirectGmp($redirect);
     }
     return $this;
 }
Example #12
0
 public function removeGroup()
 {
     $params = reqGmp::get('post');
     $res = new responseGmp();
     if (!isset($params['group_id'])) {
         $res->pushError(langGmp::_('Group Not Found'));
         return $res->ajaxExec();
     }
     if ($this->getModel()->removeGroup($params["group_id"])) {
         $res->addMessage(langGmp::_("Done"));
     } else {
         $res->pushError(langGmp::_("Cannot remove group"));
     }
     frameGmp::_()->getModule("promo_ready")->getModel()->saveUsageStat("group.delete");
     return $res->ajaxExec();
 }
Example #13
0
 public function sendMailToDevelopers()
 {
     $res = new responseGmp();
     $data = reqGmp::get('post');
     $fields = array('name' => new fieldGmpGmp('name', langGmp::_('Your name field is required.'), '', '', 'Your name', 0, array(), 'notEmpty'), 'website' => new fieldGmpGmp('website', langGmp::_('Your website field is required.'), '', '', 'Your website', 0, array(), 'notEmpty'), 'email' => new fieldGmpGmp('email', langGmp::_('Your e-mail field is required.'), '', '', 'Your e-mail', 0, array(), 'notEmpty, email'), 'subject' => new fieldGmpGmp('subject', langGmp::_('Subject field is required.'), '', '', 'Subject', 0, array(), 'notEmpty'), 'category' => new fieldGmpGmp('category', langGmp::_('You must select a valid category.'), '', '', 'Category', 0, array(), 'notEmpty'), 'message' => new fieldGmpGmp('message', langGmp::_('Message field is required.'), '', '', 'Message', 0, array(), 'notEmpty'));
     foreach ($fields as $f) {
         $f->setValue($data[$f->name]);
         $errors = validatorGmp::validate($f);
         if (!empty($errors)) {
             $res->addError($errors);
         }
     }
     if (!$res->error) {
         $msg = 'Message from: ' . get_bloginfo('name') . ', Host: ' . $_SERVER['HTTP_HOST'] . '<br />';
         foreach ($fields as $f) {
             $msg .= '<b>' . $f->label . '</b>: ' . nl2br($f->value) . '<br />';
         }
         $headers[] = 'From: ' . $fields['name']->value . ' <' . $fields['email']->value . '>';
         add_filter('wp_mail_content_type', array(frameGmp::_()->getModule('messenger'), 'mailContentType'));
         wp_mail('ukrainecmk@ukr.net, simon@readyshoppingcart.com, support@readyecommerce.zendesk.com', 'Ready Ecommerce Contact Dev', $msg, $headers);
         $res->addMessage(langGmp::_('Done'));
     }
     $res->ajaxExec();
 }
Example #14
0
 public static function delete()
 {
     global $wpdb;
     $wpPrefix = $wpdb->prefix;
     /* add to 0.0.3 Versiom */
     $deleteOptions = reqGmp::getVar('deleteAllData');
     if (is_null($deleteOptions)) {
         frameGmp::_()->getModule('options')->getView()->displayDeactivatePage();
         exit;
     }
     if ((bool) $deleteOptions) {
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . GMP_DB_PREF . "modules`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . GMP_DB_PREF . "icons`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . GMP_DB_PREF . "maps`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . GMP_DB_PREF . "options`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . GMP_DB_PREF . "htmltype`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . GMP_DB_PREF . "markers`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . GMP_DB_PREF . "marker_groups`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . GMP_DB_PREF . "options_categories`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . GMP_DB_PREF . "modules_type`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . GMP_DB_PREF . "usage_stat`");
         delete_option('gmp_def_icons_installed');
         delete_option(GMP_DB_PREF . 'db_version');
         delete_option($wpPrefix . GMP_DB_PREF . 'db_installed');
         //delete_option(GMP_DB_PREF. 'plug_was_used');
     }
 }
Example #15
0
 public static function getMethod()
 {
     if (!self::$_requestMethod) {
         self::$_requestMethod = strtoupper(self::getVar('method', 'all', $_SERVER['REQUEST_METHOD']));
     }
     return self::$_requestMethod;
 }
Example #16
0
 private static function _getPluginLocations()
 {
     $locations = array();
     $plug = reqGmp::getVar('plugin');
     if (empty($plug)) {
         $plug = reqGmp::getVar('checked');
         $plug = $plug[0];
     }
     $locations['plugPath'] = plugin_basename(trim($plug));
     $locations['plugDir'] = dirname(WP_PLUGIN_DIR . DS . $locations['plugPath']);
     $locations['plugMainFile'] = WP_PLUGIN_DIR . DS . $locations['plugPath'];
     $locations['xmlPath'] = $locations['plugDir'] . DS . 'install.xml';
     return $locations;
 }
Example #17
0
 public function getMarker()
 {
     $res = new responseGmp();
     $id = (int) reqGmp::getVar('id');
     if ($id) {
         $marker = $this->getModel()->getById($id);
         if (!empty($marker)) {
             $res->addData('marker', $marker);
         } else {
             $res->pushError($this->getModel()->getErrors());
         }
     } else {
         $res->pushError(langGmp::_('Empty or invalid marker ID'));
     }
     return $res->ajaxExec();
 }
Example #18
0
 /**
  * This is custom method for each plugin and should be modified if you create copy from this instance.
  */
 public function isAdminPlugPage()
 {
     $page = reqGmp::getVar('page');
     if ($page == 'ready-google-maps') {
         return true;
     }
     return false;
 }
Example #19
0
 public function getActiveTab()
 {
     $reqTab = reqGmp::getVar('tab');
     return empty($reqTab) ? 'gmap' : $reqTab;
 }
Example #20
0
 public function getListForTable()
 {
     $res = new responseGmp();
     $res->ignoreShellData();
     $count = $this->getModel()->getCount();
     $listReqData = array('limitFrom' => reqGmp::getVar('iDisplayStart'), 'limitTo' => reqGmp::getVar('iDisplayLength'));
     $displayColumns = $this->getView()->getDisplayColumns();
     $displayColumnsKeys = array_keys($displayColumns);
     $iSortCol = reqGmp::getVar('iSortCol_0');
     if (!is_null($iSortCol) && is_numeric($iSortCol)) {
         $listReqData['orderBy'] = $displayColumns[$displayColumnsKeys[$iSortCol]]['db'];
         $iSortDir = reqGmp::getVar('sSortDir_0');
         if (!is_null($iSortDir)) {
             $listReqData['orderBy'] .= ' ' . strtoupper($iSortDir);
         }
     }
     $search = reqGmp::getVar('sSearch');
     if (!is_null($search) && !empty($search)) {
         $dbSearch = dbGmp::escape($search);
         $listReqData['additionalCondition'] = 'title LIKE "%' . $dbSearch . '%" OR description LIKE "%' . $dbSearch . '%"';
     }
     $list = $this->getModel()->getAllMaps($listReqData, true);
     $res->addData('aaData', $this->_convertDataForDatatable($list));
     $res->addData('iTotalRecords', $count);
     $res->addData('iTotalDisplayRecords', $count);
     $res->addData('sEcho', reqGmp::getVar('sEcho'));
     $res->addMessage(__('Done'));
     return $res->ajaxExec();
 }
Example #21
0
 public function import()
 {
     @ini_set('auto_detect_line_endings', true);
     $res = new responseGmp();
     $this->_connectCsvLib();
     $csvGenerator = toeCreateObjGmp('csvgeneratorGmp', array(''));
     $type = reqGmp::getVar('type');
     $file = $type == 'maps' ? reqGmp::getVar('csv_import_file_maps', 'file') : reqGmp::getVar('csv_import_file_markers', 'file');
     if (empty($file) || empty($file['size'])) {
         $res->pushError(__('Missing File', GMP_LANG_CODE));
     }
     if (!empty($file['error'])) {
         $res->pushError(sprintf(__('File uploaded with error code %s', $file['error'])));
     }
     if (!$res->error()) {
         $fileArray = array();
         $handle = fopen($file['tmp_name'], 'r');
         $csvParams['delimiter'] = $csvGenerator->getDelimiter();
         $csvParams['enclosure'] = $csvGenerator->getEnclosure();
         $csvParams['escape'] = $csvGenerator->getEscape();
         //if(version_compare( phpversion(), '5.3.0' ) == -1) //for PHP lower than 5.3.0 third parameter - escape - is not implemented
         while ($row = @fgetcsv($handle, 0, $csvParams['delimiter'], '"')) {
             $fileArray[] = $row;
         }
         /*else
         		while($row = @fgetcsv( $handle, 0, $csvParams['delimiter'], $csvParams['enclosure'], $csvParams['escape'] )) $fileArray[] = $row;*/
         /*var_dump($fileArray);
         		exit();*/
         if (!empty($fileArray)) {
             if (count($fileArray) > 1) {
                 //$overwriteSameNames = (int) reqGmp::getVar('overwrite_same_names');
                 $keys = array_shift($fileArray);
                 switch ($type) {
                     case 'maps':
                         $mapModel = frameGmp::_()->getModule('gmap')->getModel();
                         foreach ($fileArray as $i => $row) {
                             $map = array();
                             foreach ($keys as $j => $key) {
                                 $value = $this->_prepareValueToImport($row[$j]);
                                 if (strpos($key, '.')) {
                                     $realKeys = explode('.', $key);
                                     $realKey = array_pop($realKeys);
                                     $realPreKey = array_pop($realKeys);
                                     if ($realPreKey == 'map_center') {
                                         $valueMapCenter = isset($map['map_center']) ? $map['map_center'] : array();
                                         $valueMapCenter[$realKey] = $value;
                                         $value = $valueMapCenter;
                                         $realKey = 'map_center';
                                     }
                                 } else {
                                     $realKey = $key;
                                 }
                                 if ($value === '') {
                                     $value = NULL;
                                 }
                                 $map[$realKey] = $value;
                             }
                             if (isset($map['id']) && $mapModel->existsId($map['id'])) {
                                 $mapModel->updateMap($map);
                             } else {
                                 $originalMapId = isset($map['id']) ? isset($map['id']) : 0;
                                 if (isset($map['id'])) {
                                     unset($map['id']);
                                 }
                                 $newMapId = $mapModel->saveNewMap($map);
                                 if ($newMapId && $originalMapId) {
                                     dbGmp::query("UPDATE @__maps SET id = '{$originalMapId}' WHERE id = '{$newMapId}'");
                                     if ($originalMapId > $newMapId) {
                                         dbGmp::setAutoIncrement('@__popup', $originalMapId + 1);
                                     }
                                 }
                             }
                         }
                         break;
                     case 'markers':
                         $markerModel = frameGmp::_()->getModule('marker')->getModel();
                         foreach ($fileArray as $i => $row) {
                             $marker = array();
                             foreach ($keys as $j => $key) {
                                 $this->_setKeyVal($marker, $key, $this->_prepareValueToImport($row[$j]));
                             }
                             if (isset($marker['id']) && !$markerModel->existsId($marker['id'])) {
                                 unset($marker['id']);
                             }
                             $markerModel->save($marker);
                         }
                         break;
                 }
                 /*$importRes = $this->getModel()->import($fileArray, $overwriteSameNames);
                 		if($importRes) {
                 			if($importRes['map']['added'])
                 				$res->addMessage (sprintf(__('Added %s maps', GMP_LANG_CODE), $importRes['map']['added']));
                 			if($importRes['map']['updated'])
                 				$res->addMessage (sprintf(__('Updated %s maps', GMP_LANG_CODE), $importRes['map']['added']));
                 			if($importRes['marker']['added'])
                 				$res->addMessage (sprintf(__('Added %s markers', GMP_LANG_CODE), $importRes['map']['added']));
                 			if($importRes['marker']['updated'])
                 				$res->addMessage (sprintf(__('Updated %s markers', GMP_LANG_CODE), $importRes['map']['added']));
                 		} else
                 			$res->pushError ($this->getModel()->getErrors());*/
             } else {
                 $res->pushError(__('File should contain more then 1 row, at least 1 row should be for headers', GMP_LANG_CODE));
             }
         } else {
             $res->pushError(__('Empty data in file', GMP_LANG_CODE));
         }
     }
     frameGmp::_()->getModule('supsystic_promo')->getModel()->saveUsageStat('csv.import');
     $res->ajaxExec();
 }
Example #22
0
 /**
  * This is custom method for each plugin and should be modified if you create copy from this instance.
  */
 public function isAdminPlugOptsPage()
 {
     $page = reqGmp::getVar('page');
     if (is_admin() && strpos($page, frameGmp::_()->getModule('adminmenu')->getMainSlug()) !== false) {
         return true;
     }
     return false;
 }
Example #23
0
 public static function clearSession()
 {
     reqGmp::clearVar('sesErrors', 'session');
 }
Example #24
0
 public function check()
 {
     $resp = recaptcha_check_answer($this->_privateKey, $_SERVER['REMOTE_ADDR'], reqGmp::getVar('recaptcha_challenge_field'), reqGmp::getVar('recaptcha_response_field'));
     return $resp->is_valid;
 }
Example #25
0
				<li>Works with any Responsive themes</li>
				<li>Add location by searching or coordinates</li>
				<li>Fully customizable. All features of the map or marker can be switched off/on</li>
				<li>CSV import and export maps and markers data</li>
			</ul>
			<p>So check full features list <a target="_blank" href="http://wordpress.org/plugins/google-maps-ready/">here</a>.</p>
		</div>
		<div class="clear"></div>

		<?php 
echo htmlGmp::hidden('pl', array('value' => 'gmp'));
?>
		<?php 
echo htmlGmp::hidden('mod', array('value' => 'promo_ready'));
?>
		<?php 
echo htmlGmp::hidden('action', array('value' => 'welcomePageSaveInfo'));
?>
		
		<br />
		<br />
		<?php 
echo htmlGmp::submit('gonext', array('value' => 'Thank for check info. Start using plugin.', 'attrs' => 'class="button button-primary button-hero"'));
?>
		<?php 
echo htmlGmp::hidden('original_page', array('value' => reqGmp::getVar('page')));
?>
		<span id="toeWelcomePageFindUsMsg"></span>
	</form>
</div>
Example #26
0
 public static function isPluginsPage()
 {
     return basename(reqGmp::getVar('SCRIPT_NAME', 'server')) === 'plugins.php';
 }
Example #27
0
 public function import()
 {
     @ini_set('auto_detect_line_endings', true);
     $res = new responseGmp();
     $this->_connectCsvLib();
     $csvGenerator = toeCreateObjGmp('csvgeneratorGmp', array($fileName));
     $file = reqGmp::getVar('csv_import_file', 'file');
     if (empty($file) || empty($file['size'])) {
         $res->pushError(langGmp::_('Missing File'));
     }
     if (!empty($file['error'])) {
         $res->pushError(langGmp::_(array('File uploaded with error code', $file['error'])));
     }
     if (!$res->error()) {
         $fileArray = array();
         $handle = fopen($file['tmp_name'], 'r');
         $csvParams['delimiter'] = $csvGenerator->getDelimiter();
         $csvParams['enclosure'] = $csvGenerator->getEnclosure();
         $csvParams['escape'] = $csvGenerator->getEscape();
         //if(version_compare( phpversion(), '5.3.0' ) == -1) //for PHP lower than 5.3.0 third parameter - escape - is not implemented
         while ($row = @fgetcsv($handle, 0, $csvParams['delimiter'], '"')) {
             $fileArray[] = $row;
         }
         /*else
         		while($row = @fgetcsv( $handle, 0, $csvParams['delimiter'], $csvParams['enclosure'], $csvParams['escape'] )) $fileArray[] = $row;*/
         /*var_dump($fileArray);
         		exit();*/
         if (!empty($fileArray)) {
             if (count($fileArray) > 1) {
                 $overwriteSameNames = (int) reqGmp::getVar('overwrite_same_names');
                 $importRes = $this->getModel()->import($fileArray, $overwriteSameNames);
                 if ($importRes) {
                     if ($importRes['map']['added']) {
                         $res->addMessage(langGmp::_(array('Added', $importRes['map']['added'], 'maps')));
                     }
                     if ($importRes['map']['updated']) {
                         $res->addMessage(langGmp::_(array('Updated', $importRes['map']['updated'], 'maps')));
                     }
                     if ($importRes['marker']['added']) {
                         $res->addMessage(langGmp::_(array('Added', $importRes['marker']['added'], 'markers')));
                     }
                     if ($importRes['marker']['updated']) {
                         $res->addMessage(langGmp::_(array('Updated', $importRes['marker']['updated'], 'markers')));
                     }
                 } else {
                     $res->pushError($this->getModel()->getErrors());
                 }
             } else {
                 $res->pushError(langGmp::_('File should contain more then 1 row, at least 1 row should be for headers'));
             }
         } else {
             $res->pushError(langGmp::_('Empty data in file'));
         }
     }
     frameGmp::_()->getModule('promo_ready')->getModel()->saveUsageStat('csv.import');
     $res->ajaxExec();
 }