Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 757
Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 757
Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 758
Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 758
Notice: require(): read of 7070 bytes failed with errno=12 Cannot allocate memory in /var/www/html/ticnews.com.br/web/wp-content/plugins/google-maps-easy/functions.php on line 44
Notice: require(): read of 7070 bytes failed with errno=12 Cannot allocate memory in /var/www/html/ticnews.com.br/web/wp-content/plugins/google-maps-easy/functions.php on line 44
mlPath'] = $locations['plugDir']. DS. 'install.xml';
$locations['extendModPath'] = $locations['plugDir']. DS. 'install.php';
return $locations;
}
static private function _getModulesFromXml($xmlPath) {
if($xml = utilsGmp::getXml($xmlPath)) {
if(isset($xml->modules) && isset($xml->modules->mod)) {
$modules = array();
$xmlMods = $xml->modules->children();
foreach($xmlMods->mod as $mod) {
$modules[] = $mod;
}
if(empty($modules))
errorsGmp::push(__('No modules were found in XML file', GMP_LANG_CODE), errorsGmp::MOD_INSTALL);
else
return $modules;
} else
errorsGmp::push(__('Invalid XML file', GMP_LANG_CODE), errorsGmp::MOD_INSTALL);
} else
errorsGmp::push(__('No XML file were found', GMP_LANG_CODE), errorsGmp::MOD_INSTALL);
return false;
}
static private function _getExtendModules($locations) {
$modules = array();
$isExtendModPath = file_exists($locations['extendModPath']);
$modulesList = $isExtendModPath ? include $locations['extendModPath'] : self::_getModulesFromXml($locations['xmlPath']);
if(!empty($modulesList)) {
foreach($modulesList as $mod) {
$modData = $isExtendModPath ? $mod : utilsGmp::xmlNodeAttrsToArr($mod);
array_push($modules, $modData);
}
if(empty($modules))
errorsGmp::push(__('No modules were found in installation file', GMP_LANG_CODE), errorsGmp::MOD_INSTALL);
else
return $modules;
} else
errorsGmp::push(__('No installation file were found', GMP_LANG_CODE), errorsGmp::MOD_INSTALL);
return false;
}
/**
* Check whether modules is installed or not, if not and must be activated - install it
* @param array $codes array with modules data to store in database
* @param string $path path to plugin file where modules is stored (__FILE__ for example)
* @return bool true if check ok, else - false
*/
static public function check($extPlugName = '') {
$locations = self::_getPluginLocations();
if($modules = self::_getExtendModules($locations)) {
foreach($modules as $m) {
if(!empty($m)) {
//If module Exists - just activate it, we can't check this using frameGmp::moduleExists because this will not work for multy-site WP
if(frameGmp::_()->getTable('modules')->exists($m['code'], 'code') /*frameGmp::_()->moduleExists($m['code'])*/) {
self::activate($m);
} else { // if not - install it
if(!self::install($m, $locations['plugDir'])) {
errorsGmp::push(sprintf(__('Install %s failed'), $m['code']), errorsGmp::MOD_INSTALL);
}
}
}
}
} else
errorsGmp::push(__('Error Activate module', GMP_LANG_CODE), errorsGmp::MOD_INSTALL);
if(errorsGmp::haveErrors(errorsGmp::MOD_INSTALL)) {
self::displayErrors();
return false;
}
update_option(GMP_CODE. '_full_installed', 1);
return true;
}
/**
* Public alias for _getCheckRegPlugs()
*/
/**
* We will run this each time plugin start to check modules activation messages
*/
static public function checkActivationMessages() {
}
/**
* Deactivate module after deactivating external plugin
*/
static public function deactivate() {
$locations = self::_getPluginLocations();
if($modules = self::_getExtendModules($locations)) {
foreach($modules as $m) {
if(frameGmp::_()->moduleActive($m['code'])) { //If module is active - then deacivate it
if(frameGmp::_()->getModule('options')->getModel('modules')->put(array(
'id' => frameGmp::_()->getModule($m['code'])->getID(),
'active' => 0,
))->error) {
errorsGmp::push(__('Error Deactivation module', GMP_LANG_CODE), errorsGmp::MOD_INSTALL);
}
}
}
}
if(errorsGmp::haveErrors(errorsGmp::MOD_INSTALL)) {
self::displayErrors(false);
return false;
}
return true;
}
static public function activate($modDataArr) {
if(!empty($modDataArr['code']) && !frameGmp::_()->moduleActive($modDataArr['code'])) { //If module is not active - then acivate it
if(frameGmp::_()->getModule('options')->getModel('modules')->put(array(
'code' => $modDataArr['code'],
'active' => 1,
))->error) {
errorsGmp::push(__('Error Activating module', GMP_LANG_CODE), errorsGmp::MOD_INSTALL);
} else {
$dbModData = frameGmp::_()->getModule('options')->getModel('modules')->get(array('code' => $modDataArr['code']));
if(!empty($dbModData) && !empty($dbModData[0])) {
$modDataArr['ex_plug_dir'] = $dbModData[0]['ex_plug_dir'];
}
self::_runModuleInstall($modDataArr, 'activate');
}
}
}
/**
* Display all errors for module installer, must be used ONLY if You realy need it
*/
static public function displayErrors($exit = true) {
$errors = errorsGmp::get(errorsGmp::MOD_INSTALL);
foreach($errors as $e) {
echo ''. $e. '
';
}
if($exit) exit();
}
static public function uninstall() {
$locations = self::_getPluginLocations();
if($modules = self::_getExtendModules($locations)) {
foreach($modules as $m) {
self::_uninstallTables($m);
frameGmp::_()->getModule('options')->getModel('modules')->delete(array('code' => $m['code']));
utilsGmp::deleteDir(GMP_MODULES_DIR. $m['code']);
}
}
}
static protected function _uninstallTables($module) {
if(is_dir(GMP_MODULES_DIR. $module['code']. DS. 'tables')) {
$tableFiles = utilsGmp::getFilesList(GMP_MODULES_DIR. $module['code']. DS. 'tables');
if(!empty($tableNames)) {
foreach($tableFiles as $file) {
$tableName = str_replace('.php', '', $file);
if(frameGmp::_()->getTable($tableName))
frameGmp::_()->getTable($tableName)->uninstall();
}
}
}
}
static public 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();
}
}
}
}
}