예제 #1
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 = CSP_MODULES_DIR;
             if (!empty($m['ex_plug_dir'])) {
                 $moduleLocationDir = utilsCsp::getExtModDir($m['ex_plug_dir']);
             }
             if (is_dir($moduleLocationDir . $code)) {
                 $this->_allModules[$m['code']] = 1;
                 if ((bool) $m['active']) {
                     importClassCsp($code . strFirstUp(CSP_CODE), $moduleLocationDir . $code . DS . 'mod.php');
                     $moduleClass = toeGetClassNameCsp($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;
 }
예제 #2
0
 public function get($d = array())
 {
     parent::get($d);
     if (empty($this->_allTemplates)) {
         $directories = utilsCsp::getDirList(CSP_TEMPLATES_DIR);
         if (!empty($directories)) {
             foreach ($directories as $code => $dir) {
                 if ($xml = utilsCsp::getXml($dir['path'] . 'settings.xml')) {
                     $this->_allTemplates[$code] = $xml;
                     $this->_allTemplates[$code]->prevImg = CSP_TEMPLATES_PATH . $code . '/screenshot.png';
                 }
             }
         }
         if (is_dir(utilsCsp::getCurrentWPThemeDir() . 'csp' . DS)) {
             if ($xml = utilsCsp::getXml(utilsCsp::getCurrentWPThemeDir() . 'csp' . DS . 'settings.xml')) {
                 $code = utilsCsp::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(utilsCsp::getCurrentWPThemeDir() . 'screenshot.jpg')) {
                     $this->_allTemplates[$code]->prevImg = utilsCsp::getCurrentWPThemePath() . '/screenshot.jpg';
                 } else {
                     $this->_allTemplates[$code]->prevImg = utilsCsp::getCurrentWPThemePath() . '/screenshot.png';
                 }
             }
         }
     }
     if (isset($d['code']) && isset($this->_allTemplates[$d['code']])) {
         return $this->_allTemplates[$d['code']];
     }
     return $this->_allTemplates;
 }
예제 #3
0
 public function init()
 {
     $isAdminPlugPage = frameCsp::_()->isAdminPlugPage();
     $isPluginsPage = utilsCsp::isPluginsPage();
     if (is_admin()) {
         if ($isAdminPlugPage || $isPluginsPage) {
             frameCsp::_()->addScript('jquery');
             frameCsp::_()->addScript('jquery-ui-tabs', '', array('jquery'));
             frameCsp::_()->addScript('jquery-ui-dialog', '', array('jquery'));
             frameCsp::_()->addScript('jquery-ui-button', '', array('jquery'));
             frameCsp::_()->addScript('farbtastic');
             frameCsp::_()->addScript('commonCsp', CSP_JS_PATH . 'common.js');
             frameCsp::_()->addScript('coreCsp', CSP_JS_PATH . 'core.js');
             frameCsp::_()->addScript('adminOptionsCsp', CSP_JS_PATH . 'admin.options.js');
             frameCsp::_()->addScript('ajaxupload', CSP_JS_PATH . 'ajaxupload.js');
             frameCsp::_()->addScript('postbox', get_bloginfo('wpurl') . '/wp-admin/js/postbox.js');
             add_thickbox();
             $ajaxurl = admin_url('admin-ajax.php');
             if (frameCsp::_()->getModule('options')->get('ssl_on_ajax')) {
                 $ajaxurl = uriCsp::makeHttps($ajaxurl);
             }
             $jsData = array('siteUrl' => CSP_SITE_URL, 'imgPath' => CSP_IMG_PATH, 'cssPath' => CSP_CSS_PATH, 'loader' => CSP_LOADER_IMG, 'close' => CSP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameCsp::_()->getModule('options')->get('js_animation_speed'), 'siteLang' => langCsp::getData(), 'options' => frameCsp::_()->getModule('options')->getAllowedPublicOptions(), 'CSP_CODE' => CSP_CODE, 'ball_loader' => CSP_IMG_PATH . 'ajax-loader-ball.gif', 'ok_icon' => CSP_IMG_PATH . 'ok-icon.png');
             $jsData['allCheckRegPlugs'] = modInstallerCsp::getCheckRegPlugs();
             $jsData = dispatcherCsp::applyFilters('jsInitVariables', $jsData);
             frameCsp::_()->addJSVar('coreCsp', 'CSP_DATA', $jsData);
             $this->_styles = array('styleCsp' => array('path' => CSP_CSS_PATH . 'style.css'), 'adminStylesCsp' => array('path' => CSP_CSS_PATH . 'adminStyles.css'), 'jquery-tabs' => array('path' => CSP_CSS_PATH . 'jquery-tabs.css'), 'jquery-buttons' => array('path' => CSP_CSS_PATH . 'jquery-buttons.css'), 'wp-jquery-ui-dialog' => array(), 'farbtastic' => array(), 'jquery-dialog' => array('path' => CSP_CSS_PATH . 'jquery-dialog.css'));
             $defaultPlugTheme = frameCsp::_()->getModule('options')->get('default_theme');
             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(CSP_TEMPLATES_DIR . $defaultPlugTheme . DS . $s . '.css')) {
                     frameCsp::_()->addStyle($s, CSP_TEMPLATES_PATH . $defaultPlugTheme . '/' . $s . '.css');
                 } elseif ($canBeSubstituted && file_exists(utilsCsp::getCurrentWPThemeDir() . 'csp' . DS . $s . '.css')) {
                     frameCsp::_()->addStyle($s, utilsCsp::getCurrentWPThemePath() . '/toe/' . $s . '.css');
                 } elseif (!empty($sInfo['path'])) {
                     frameCsp::_()->addStyle($s, $sInfo['path']);
                 } else {
                     frameCsp::_()->addStyle($s);
                 }
             }
         }
     }
     parent::init();
 }
예제 #4
0
 protected function _adaptFromDb($d = array())
 {
     switch ($d['type']) {
         case 'email':
             $d['data'] = utilsCsp::unserialize($d['data']);
             break;
     }
     return $d;
 }
예제 #5
0
 public function create($d = array())
 {
     $withoutConfirm = isset($d['withoutConfirm']) ? $d['withoutConfirm'] : false;
     $mainEngine = $this->getMainEngine();
     if ($mainEngine) {
         // Confirnation will be processed by subscribe engine, here it will be created in active state
         $withoutConfirm = true;
     }
     if (isset($d['email']) && !empty($d['email'])) {
         if (is_email($d['email'])) {
             $d['email'] = trim($d['email']);
             $params = array('email' => $d['email'], 'created' => dbCsp::timeToDate(), 'ip' => utilsCsp::getIP(), 'active' => $withoutConfirm ? 1 : 0, 'token' => md5($d['email'] . AUTH_KEY));
             if (isset($d['name']) && !empty($d['name'])) {
                 $params['name'] = $d['name'];
             }
             /*$defSystem = frameCsp::_()->getModule('options')->get('sub_synchronize_system') ;
             		switch($defSystem) {*/
             /*case 'aweber':
             		$listId = frameCsp::_()->getModule('options')->get('sub_aweber_selected_list');
             		$aweberModule = frameCsp::_()->getModule('aweber'); 
             		$params['listId'] = $listId;
             		if($aweberModule->createNewAweberSubscriber($params)){
             			return true;
             		}else{
             			$this->pushError( langCsp::_($aweberModule->getErrors()) );
             			return false;
             		}
             		break;*/
             //default:
             if (!frameCsp::_()->getTable('subscribers')->exists($d['email'], 'email')) {
                 if (frameCsp::_()->getTable('subscribers')->insert($params)) {
                     if ($mainEngine) {
                         $mainEngine->subscribe($params);
                     }
                     $this->processEnginesSubscribe($params, $mainEngine);
                     if (!$withoutConfirm) {
                         $this->sendConfirmEmail($d['email']);
                     }
                     return true;
                 } else {
                     $this->pushError(langCsp::_('Error insert email to database'));
                 }
             } else {
                 $this->pushError(langCsp::_('You are already subscribed'));
             }
             /*break;
             		}*/
         } else {
             $this->pushError(langCsp::_('Invalid email'));
         }
     } else {
         $this->pushError(langCsp::_('Please enter email'));
     }
     return false;
 }
예제 #6
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(utilsCsp::getExtModDir($d['ex_plug_dir']));
         $this->setExternalPath(utilsCsp::getExtModPath($d['ex_plug_dir']));
     }
 }
예제 #7
0
 public function getPath($tpl)
 {
     $path = '';
     $code = $this->_code;
     $parentModule = frameCsp::_()->getModule($this->_code);
     $plTemplate = frameCsp::_()->getModule('options')->get('template');
     // Current plugin template
     if (empty($plTemplate) || !frameCsp::_()->getModule($plTemplate)) {
         $plTemplate = '';
     }
     if (file_exists(utilsCsp::getCurrentWPThemeDir() . 'csp' . DS . $code . DS . $tpl . '.php')) {
         $path = utilsCsp::getCurrentWPThemeDir() . 'csp' . DS . $code . DS . $tpl . '.php';
     } elseif ($plTemplate && file_exists(frameCsp::_()->getModule($plTemplate)->getModDir() . 'templates' . DS . $code . DS . $tpl . '.php')) {
         $path = frameCsp::_()->getModule($plTemplate)->getModDir() . 'templates' . DS . $code . DS . $tpl . '.php';
     } elseif (file_exists($parentModule->getModDir() . 'views' . DS . 'tpl' . DS . $tpl . '.php')) {
         //Then try to find it in module directory
         $path = $parentModule->getModDir() . DS . 'views' . DS . 'tpl' . DS . $tpl . '.php';
     }
     return $path;
 }
예제 #8
0
 public function checkIp()
 {
     $ip = utilsCsp::getIP();
     if (frameCsp::_()->getTable('access')->get('*', array('access' => $ip, 'type_access' => 1))) {
         return false;
     } else {
         return true;
     }
 }
예제 #9
0
<script type="text/javascript">
// <!--
var toeAllLogData = <?php 
echo utilsCsp::jsonEncode($this->logs);
?>
;
jQuery(document).ready(function(){
   jQuery('#toeLogTabs').tabs(); 
   jQuery('.toeLogRow').click(function(){
       var type = str_replace(jQuery(this).parents('div.toeLogTab:first').attr('id'), 'toeLogs', '');
       var id = parseInt(jQuery(this).find('td:first').html());
       if(typeof(toeAllLogData[type]) != undefined && typeof(toeAllLogData[type][id]) != undefined) {
           var logContent = '<table>';
           if(typeof(toeAllLogData[type][id]['data']) == 'object') {
               for(var key in toeAllLogData[type][id]['data']) {
                   logContent += '<tr><td valign="top">'+ key+ '</td><td valign="top">'+ toeAllLogData[type][id]['data'][key]+ '</td></tr>';
               }
           } else if(typeof(toeAllLogData[type][id]['data']) == 'string') {
                logContent += '<tr><td valign="top">data</td><td valign="top">'+ toeAllLogData[type][id]['data']+ '</td></tr>';
           }
           logContent += '</table>';
           subScreen.show(logContent);
       }
       //alert(type);
   });
});
// -->
</script>
<div id="toeLogTabs">
    <ul>
        <?php 
예제 #10
0
 public static function getCurrentWPThemeDir()
 {
     static $themePath;
     if (empty($themePath)) {
         $themePath = get_theme_root() . DS . utilsCsp::getCurrentWPThemeCode() . DS;
     }
     return $themePath;
 }
예제 #11
0
 public function getSocImgPath($imgName)
 {
     $template = frameCsp::_()->getModule('options')->get('template');
     if (!empty($template) && frameCsp::_()->getModule($template)) {
         if (utilsCsp::fileExists(frameCsp::_()->getModule($template)->getModDir() . 'img' . DS . $imgName)) {
             return frameCsp::_()->getModule($template)->getModPath() . 'img/' . $imgName;
         }
     }
     return uriCsp::_(CSP_IMG_PATH . $imgName);
 }
예제 #12
0
 private function createFileName()
 {
     return utilsCsp::getRandStr() . '-' . utilsCsp::getRandStr() . '-' . utilsCsp::getRandStr() . '-' . utilsCsp::getRandStr();
 }
예제 #13
0
 public function getBgCssAttrs()
 {
     return utilsCsp::arrToCss($this->getBgCssAttrsArray());
 }
예제 #14
0
 /**
  * Check if the element exists in array
  * @param array $param 
  */
 function checkVarFromParam($param, $element)
 {
     return utilsCsp::xmlAttrToStr($param, $element);
     /*if (isset($param[$element])) {
     			// convert object element to string
     			return (string)$param[$element];
     		} else {
     			return '';
     		}*/
 }
예제 #15
0
 /**
  * Render content
  * 
  * @param array $variables 
  */
 public function renderContent($variables)
 {
     //$replacements = utilsCsp::jsonDecode($this->template['variables']);
     $this->message = utilsCsp::makeVariablesReplacement($this->template['body'], $variables);
     $this->subject = utilsCsp::makeVariablesReplacement($this->template['subject'], $variables);
     /*foreach($replacements as $k => $v) {
            $message = str_replace(":$v", $variables[$v], $message);
            $subject = str_replace(":$v", $variables[$v], $subject);
       } // foreach
       $this->subject = $subject;
       $this->message = $message;*/
 }
예제 #16
0
 public function put($d = array())
 {
     $res = new responseCsp();
     $id = $this->_getIDFromReq($d);
     $d = prepareParamsCsp($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 (frameCsp::_()->getTable('modules')->update($d, array('id' => $id))) {
             $res->messages[] = langCsp::_('Module Updated');
             $mod = frameCsp::_()->getTable('modules')->getById($id);
             $newType = frameCsp::_()->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' => utilsCsp::jsonEncode($mod['params']), 'description' => $mod['description'], 'active' => $mod['active']);
         } else {
             if ($tableErrors = frameCsp::_()->getTable('modules')->getErrors()) {
                 $res->errors = array_merge($res->errors, $tableErrors);
             } else {
                 $res->errors[] = langCsp::_('Module Update Failed');
             }
         }
     } else {
         $res->errors[] = langCsp::_('Error module ID');
     }
     parent::put($d);
     return $res;
 }
<script type="text/javascript">
// <!--
jQuery(document).ready(function(){
	var toeGlobalMessages = <?php 
echo utilsCsp::jsonEncode($this->messages);
?>
;
	var toeGlobalMessagesStr = '';
	if(toeGlobalMessages.adminAlerts) {
		for(var i in toeGlobalMessages.adminAlerts) {
			toeGlobalMessagesStr += '<div class="toeSystemAlert">'+ 
				'<i style="font-size: 12px;"><?php 
echo $this->forAdminOnly;
?>
</i><br class="toeClear" />'+ 
				toeGlobalMessages.adminAlerts[ i ]+ 
				'</div>';
		}
	}
	if(toeGlobalMessagesStr != '') {
		jQuery('body:first').prepend(toeGlobalMessagesStr);
	}
		
});
// -->
</script>
예제 #18
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] = htmlCsp::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'] = utilsCsp::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 .= langCsp::_($p['label']) . htmlCsp::text($name . '[' . $i . '][' . $key . ']', $paramsForText);
             }
             $res .= $remove . '</div>';
             $i++;
         } while ($i < count($params['value']));
         $res .= $add;
         $res .= '</div>';
     }
     return $res;
 }
예제 #19
0
    public function initJsVars()
    {
        $ajaxurl = admin_url('admin-ajax.php');
        if (frameCsp::_()->getModule('options')->get('ssl_on_ajax')) {
            $ajaxurl = uriCsp::makeHttps($ajaxurl);
        }
        $jsData = array('siteUrl' => CSP_SITE_URL, 'imgPath' => CSP_IMG_PATH, 'loader' => CSP_LOADER_IMG, 'close' => CSP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameCsp::_()->getModule('options')->get('js_animation_speed'), 'CSP_CODE' => CSP_CODE);
        return '<script type="text/javascript">
		// <!--
			var CSP_DATA = ' . utilsCsp::jsonEncode($jsData) . ';
		// -->
		</script>';
    }
예제 #20
0
 public function getFavicoFullPath()
 {
     return utilsCsp::getUploadsPath() . '/' . $this->_uploadDir . '/' . $this->_favicoDir . '/' . $this->get('favico');
 }
예제 #21
0
 public static function init()
 {
     global $wpdb;
     $wpPrefix = $wpdb->prefix;
     /* add to 0.0.3 Versiom */
     //$start = microtime(true);					// Speed debug info
     //$queriesCountStart = $wpdb->num_queries;	// Speed debug info
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $current_version = get_option($wpPrefix . CSP_DB_PREF . 'db_version', 0);
     $installed = (int) get_option($wpPrefix . CSP_DB_PREF . 'db_installed', 0);
     if (!$current_version) {
         self::$_firstTimeActivated = true;
     }
     /**
      * htmltype 
      */
     if (!dbCsp::exist($wpPrefix . CSP_DB_PREF . "htmltype")) {
         $q = "CREATE TABLE IF NOT EXISTS `" . $wpPrefix . CSP_DB_PREF . "htmltype` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `label` varchar(32) NOT NULL,\n\t\t\t  `description` varchar(255) NOT NULL,\n\t\t\t  PRIMARY KEY (`id`),\n\t\t\t  UNIQUE INDEX `label` (`label`)\n\t\t\t) DEFAULT CHARSET=utf8";
         dbDelta($q);
     }
     dbCsp::query("INSERT INTO `" . $wpPrefix . CSP_DB_PREF . "htmltype` VALUES\n\t\t\t(1, 'text', 'Text'),\n\t\t\t(2, 'password', 'Password'),\n\t\t\t(3, 'hidden', 'Hidden'),\n\t\t\t(4, 'checkbox', 'Checkbox'),\n\t\t\t(5, 'checkboxlist', 'Checkboxes'),\n\t\t\t(6, 'datepicker', 'Date Picker'),\n\t\t\t(7, 'submit', 'Button'),\n\t\t\t(8, 'img', 'Image'),\n\t\t\t(9, 'selectbox', 'Drop Down'),\n\t\t\t(10, 'radiobuttons', 'Radio Buttons'),\n\t\t\t(11, 'countryList', 'Countries List'),\n\t\t\t(12, 'selectlist', 'List'),\n\t\t\t(13, 'countryListMultiple', 'Country List with posibility to select multiple countries'),\n\t\t\t(14, 'block', 'Will show only value as text'),\n\t\t\t(15, 'statesList', 'States List'),\n\t\t\t(16, 'textFieldsDynamicTable', 'Dynamic table - multiple text options set'),\n\t\t\t(17, 'textarea', 'Textarea'),\n\t\t\t(18, 'checkboxHiddenVal', 'Checkbox with Hidden field')");
     /**
      * modules 
      */
     if (!dbCsp::exist($wpPrefix . CSP_DB_PREF . "modules")) {
         $q = "CREATE TABLE IF NOT EXISTS `" . $wpPrefix . CSP_DB_PREF . "modules` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `code` varchar(64) NOT NULL,\n\t\t\t  `active` tinyint(1) NOT NULL DEFAULT '0',\n\t\t\t  `type_id` smallint(3) NOT NULL DEFAULT '0',\n\t\t\t  `params` text,\n\t\t\t  `has_tab` tinyint(1) NOT NULL DEFAULT '0',\n\t\t\t  `label` varchar(128) DEFAULT NULL,\n\t\t\t  `description` text,\n\t\t\t  `ex_plug_dir` varchar(255) DEFAULT NULL,\n\t\t\t  PRIMARY KEY (`id`),\n\t\t\t  UNIQUE INDEX `code` (`code`)\n\t\t\t) DEFAULT CHARSET=utf8;";
         dbDelta($q);
     }
     dbCsp::query("INSERT INTO `" . $wpPrefix . CSP_DB_PREF . "modules` (id, code, active, type_id, params, has_tab, label, description) VALUES\n\t\t  (NULL, 'adminmenu',1,1,'',0,'Admin Menu',''),\n\t\t  (NULL, 'options',1,1,'',1,'Options',''),\n\t\t  (NULL, 'user',1,1,'',1,'Users',''),\n\t\t  (NULL, 'pages',1,1,'" . json_encode(array()) . "',0,'Pages',''),\n\t\t  (NULL, 'templates',1,1,'',1,'Templates for Plugin',''),\n\t\t  (NULL, 'messenger', 1, 1, '', 1, 'Notifications', 'Module provides the ability to create templates for user notifications and for mass mailing.'),\n\t\t  (NULL, 'shortcodes', 1, 6, '', 0, 'Shortcodes', 'Shortcodes data'),\n\t\t  (NULL, 'twitter_widget', 1, 4, '', 0, 'Twitter Widget', 'Twitter Widget'),\n\t\t  (NULL, 'log', 1, 1, '', 0, 'Log', 'Internal system module to log some actions on server'),\n\t\t  (NULL, 'coming_soon', 1, 1, '', 0, 'Coming soon', 'Coming soon'),\n\t\t  (NULL, 'csp_tpl_standard', 1, 7, '', 0, 'Standard template', 'Standard template'),\n\t\t  (NULL, 'subscribe', 1, 1, '', 0, 'Subscribe', 'Subscribe'),\n\t\t  (NULL, 'social_icons', 1, 1, '', 0, 'Social Icons', 'Social Icons'),\n\t\t  (NULL, 'access', 1, 1, '', 0, 'Access', 'Access');");
     if (!$installed) {
         self::createPages();
     }
     /**
      *  modules_type 
      */
     if (!dbCsp::exist($wpPrefix . CSP_DB_PREF . "modules_type")) {
         $q = "CREATE TABLE IF NOT EXISTS `" . $wpPrefix . CSP_DB_PREF . "modules_type` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `label` varchar(64) NOT NULL,\n\t\t\t  PRIMARY KEY (`id`)\n\t\t\t) AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;";
         dbDelta($q);
     }
     dbCsp::query("INSERT INTO `" . $wpPrefix . CSP_DB_PREF . "modules_type` VALUES\n\t\t  (1,'system'),\n\t\t  (2,'payment'),\n\t\t  (3,'shipping'),\n\t\t  (4,'widget'),\n\t\t  (5,'product_extra'),\n\t\t  (6,'addons'),\n\t\t  (7,'template')");
     /**
      * options 
      */
     if (!dbCsp::exist($wpPrefix . CSP_DB_PREF . "options")) {
         $q = "CREATE TABLE IF NOT EXISTS `" . $wpPrefix . CSP_DB_PREF . "options` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `code` varchar(64) CHARACTER SET latin1 NOT NULL,\n\t\t\t  `value` text NULL,\n\t\t\t  `label` varchar(128) CHARACTER SET latin1 DEFAULT NULL,\n\t\t\t  `description` text CHARACTER SET latin1,\n\t\t\t  `htmltype_id` smallint(2) NOT NULL DEFAULT '1',\n\t\t\t  `params` text NULL,\n\t\t\t  `cat_id` mediumint(3) DEFAULT '0',\n\t\t\t  `sort_order` mediumint(3) DEFAULT '0',\n\t\t\t  `value_type` varchar(16) CHARACTER SET latin1 DEFAULT NULL,\n\t\t\t  PRIMARY KEY (`id`),\n\t\t\t  KEY `id` (`id`),\n\t\t\t  UNIQUE INDEX `code` (`code`)\n\t\t\t) DEFAULT CHARSET=utf8";
         dbDelta($q);
     }
     $eol = "\n";
     $msgText = 'We apologize, but at this time our site does not work. But we promise you, very soon we will resume work. ' . $eol . 'We just want to improve our site for your comfort.Be among the first to see our new website! Just send your email using the form below and we will inform you.';
     dbCsp::query("INSERT INTO `" . $wpPrefix . CSP_DB_PREF . "options` (`id`,`code`,`value`,`label`,`description`,`htmltype_id`,`params`,`cat_id`,`sort_order`) VALUES\n\t\t\t(NULL,'mode','disable','Plugin Mode','Mode for Coming Soon Plugin',9,'" . utilsCsp::serialize(array('options' => array('disable' => 'Disable', 'coming_soon' => 'Coming Soon Mode', 'maint_mode' => 'Maintenance Mode-Under Construction (HTTP 503)', 'redirect' => 'Redirect 301'))) . "',1,0),\n\t\t\t(NULL,'template','csp_tpl_standard','Template','Your page Template',14,'',1,0),\n\t\t\t(NULL,'redirect','','Redirect URL','Redirect URL',1,'',1,0),\n\t\t\t(NULL,'sub_notif_end_maint','0','Notify Subscribers','Notify Subscribers that your site go live',4,'',1,0),\n\t\t\t\n\t\t\t(NULL,'bg_type','color','Bg Type','Bg Type',10,'',2,0),\n\t\t\t(NULL,'bg_color','#ffffff','Bg Color','Bg Color',1,'',2,0),\n\t\t\t(NULL,'bg_image','','Bg Image','Bg Image',1,'',2,0),\n\t\t\t(NULL,'bg_img_show_type','center','Bg Image show type','Bg Image show type',10,'',2,0),\n\t\t\t(NULL,'logo_image','','Logo image','Logo image',1,'',2,0),\n\t\t\t(NULL,'msg_title','Website is Under Construction','Message Title','Message Title',1,'',2,0),\n\t\t\t(NULL,'msg_title_color','#000000','Message Title Color','Message Title Color',1,'',2,0),\n\t\t\t(NULL,'msg_title_font','','Message Title Font','Message Title Font',1,'',2,0),\n\t\t\t(NULL,'msg_text','" . $msgText . "','Message Text','Message Text',1,'',2,0),\n\t\t\t(NULL,'msg_text_color','#000000','Message Text Color','Message Text Color',1,'',2,0),\n\t\t\t(NULL,'msg_text_font','','Message Text Font','Message Text Font',1,'',2,0),\n\t\t\t(NULL,'sub_enable','1','Enable Subscribe','Enable Subscribe',1,'',3,0),\n\t\t\t(NULL,'sub_name_enable','1','Enable Subscriber Name Field','Enable Subscribe Name',1,'',3,0),\n\t\t\t(NULL,'sub_admin_email','','New Subscribe notification email','New Subscribe notification email',1,'',3,0),\n\t\t\t(NULL,'soc_facebook_enable_share','','Facebook enable share','Facebook enable share',18,'',4,0),\n\t\t\t(NULL,'soc_facebook_enable_like','','Facebook enable like','Facebook enable like',18,'',4,0),\n\t\t\t(NULL,'soc_facebook_enable_send','1','Facebook enable send','Facebook enable send',18,'',4,0),\n\t\t\t(NULL,'soc_facebook_like_layout','standard','Facebook like layout','Facebook like layout',9,'',4,0),\n\t\t\t(NULL,'soc_facebook_like_width','450','Facebook like width','Facebook like width',1,'',4,0),\n\t\t\t(NULL,'soc_facebook_like_faces','1','Facebook like faces','Facebook like faces',18,'',4,0),\n\t\t\t(NULL,'soc_facebook_like_font','verdana','Facebook like font','Facebook like font',9,'',4,0),\n\t\t\t(NULL,'soc_facebook_like_color_scheme','light','Facebook like color','Facebook like color',9,'',4,0),\n\t\t\t(NULL,'soc_facebook_like_verb','like','Facebook like verb','Facebook like verb',9,'',4,0),\n\t\t\t(NULL,'soc_facebook_share_layout','box_count','Facebook share layout','Facebook share layout',9,'',4,0),\n\t\t\t(NULL,'soc_facebook_enable_follow','','Facebook follow enable','Facebook follow enable',18,'',4,0),\n\t\t\t(NULL,'soc_facebook_follow_profile','','Facebook follow profile','Facebook follow profile',1,'',4,0),\n\t\t\t(NULL,'soc_facebook_follow_layout','standard','Facebook follow layout','Facebook follow layout',9,'',4,0),\n\t\t\t(NULL,'soc_facebook_follow_faces','1','Facebook follow faces','Facebook follow faces',18,'',4,0),\n\t\t\t(NULL,'soc_facebook_follow_color_scheme','light','Facebook follow color scheme','Facebook follow color scheme',9,'',4,0),\n\t\t\t(NULL,'soc_facebook_follow_font','verdana','Facebook follow font','Facebook follow font',9,'',4,0),\n\t\t\t(NULL,'soc_facebook_follow_width','450','Facebook follow width','Facebook follow width',1,'',4,0),\n\t\t\t(NULL,'soc_facebook_enable_link','1','Facebook link enable','Facebook link enable',18,'',4,0),\n\t\t\t(NULL,'soc_facebook_link_account','','Facebook link enable','Facebook link enable',18,'',4,0),\n\t\t\t\n\t\t\t(NULL,'soc_tw_enable_tweet','','Twitter','Twitter',1,'',18,0),\n\t\t\t(NULL,'soc_tw_enable_follow','','Twitter','Twitter',1,'',18,0),\n\t\t\t(NULL,'soc_tw_tweet_count','none','Twitter','Twitter',1,'',18,0),\n\t\t\t(NULL,'soc_tw_tweet_size','medium','Twitter','Twitter',1,'',18,0),\n\t\t\t(NULL,'soc_tw_follow_account','','Twitter','Twitter',1,'',18,0),\n\t\t\t(NULL,'soc_tw_follow_count','1','Twitter','Twitter',1,'',18,0),\n\t\t\t(NULL,'soc_tw_follow_size','medium','Twitter','Twitter',1,'',18,0),\n\t\t\t(NULL,'soc_tw_follow_show_name','','Twitter','Twitter',1,'',18,0),\n\t\t\t(NULL,'soc_tw_enable_link','1','Facebook link enable','Facebook link enable',18,'',4,0),\n\t\t\t(NULL,'soc_tw_link_account','','Facebook link enable','Facebook link enable',18,'',4,0),\n\t\t\t\n\t\t\t(NULL,'soc_gp_enable_badge','','Google+','Google+',1,'',18,0),\n\t\t\t(NULL,'soc_gp_enable_like','','Google+','Google+',1,'',18,0),\n\t\t\t(NULL,'soc_gp_badge_account','','Google+','Google+',1,'',18,0),\n\t\t\t(NULL,'soc_gp_badge_width','300','Google+','Google+',1,'',18,0),\n\t\t\t(NULL,'soc_gp_badge_color_scheme','light','Google+','Google+',1,'',18,0),\n\t\t\t(NULL,'soc_gp_like_size','medium','Google+','Google+',1,'',18,0),\n\t\t\t(NULL,'soc_gp_like_annotation','inline','Google+','Google+',1,'',18,0),\n\t\t\t(NULL,'soc_gp_like_width','200','Google+','Google+',1,'',18,0),\n\t\t\t(NULL,'soc_gp_enable_link','1','Facebook link enable','Facebook link enable',18,'',4,0),\n\t\t\t(NULL,'soc_gp_link_account','','Facebook link enable','Facebook link enable',18,'',4,0);");
     /* options categories */
     if (!dbCsp::exist($wpPrefix . CSP_DB_PREF . "options_categories")) {
         $q = "CREATE TABLE IF NOT EXISTS `" . $wpPrefix . CSP_DB_PREF . "options_categories` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `label` varchar(128) NOT NULL,\n\t\t\t  PRIMARY KEY (`id`),\n\t\t\t  KEY `id` (`id`)\n\t\t\t) DEFAULT CHARSET=utf8";
         dbDelta($q);
     }
     dbCsp::query("INSERT INTO `" . $wpPrefix . CSP_DB_PREF . "options_categories` VALUES\n\t\t\t(1, 'General'),\n\t\t\t(2, 'Template'),\n\t\t\t(3, 'Subscribe'),\n\t\t\t(4, 'Social');");
     /**
      * Email Templates
      */
     if (!dbCsp::exist($wpPrefix . CSP_DB_PREF . "email_templates")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . CSP_DB_PREF . "email_templates` (\n\t\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t  `label` varchar(128) NOT NULL,\n\t\t\t\t  `subject` varchar(255) NOT NULL,\n\t\t\t\t  `body` text NOT NULL,\n\t\t\t\t  `variables` text NOT NULL,\n\t\t\t\t  `active` tinyint(1) NOT NULL,\n\t\t\t\t  `name` varchar(128) NOT NULL,\n\t\t\t\t  `module` varchar(128) NOT NULL,\n\t\t\t\t  PRIMARY KEY (`id`),\n\t\t\t\t  UNIQUE INDEX `name` (`name`)\n\t\t\t\t) DEFAULT CHARSET=utf8");
     }
     $eol = "\n\r";
     $emailTemplates = array('sub_confirm' => array('body' => 'Hello!' . $eol . 'Thank you for subscribing for :site_name!' . $eol . 'To complete your subscription please follow the link bellow:' . $eol . '<a href=":link">:link</a>' . $eol . 'Regards,' . $eol . ':site_name team.', 'variables' => array('site_name', 'link')), 'sub_admin_notify' => array('body' => 'Hello!' . $eol . 'New user activated subscription on your site :site_name for email :email.', 'variables' => array('site_name', 'email')), 'sub_site_opened' => array('body' => 'Hello!' . $eol . 'Please be advised that site :site_name are opened from now!' . $eol . 'You can visit site following this link <a href=":site_link">:site_link</a>.' . $eol . 'Regards,' . $eol . ':site_name team.', 'variables' => array('site_name', 'site_link')), 'sub_new_post' => array('body' => 'Hello!' . $eol . 'New entry was published on :site_name.' . $eol . 'Visit it by following next link:' . $eol . '<a href=":post_link">:post_title</a>' . $eol . 'Regards,' . $eol . ':site_name team.', 'variables' => array('site_name', 'post_link', 'post_title')));
     dbCsp::query("INSERT INTO `" . $wpPrefix . CSP_DB_PREF . "email_templates` (`id`, `label`, `subject`, `body`, `variables`, `active`, `name`, `module`) VALUES \n\t\t\t(NULL, 'Subscribe Confirm', 'Subscribe Confirmation', '" . $emailTemplates['sub_confirm']['body'] . "', '[\"" . implode('","', $emailTemplates['sub_confirm']['variables']) . "\"]', 1, 'sub_confirm', 'subscribe'),\n\t\t\t(NULL, 'Subscribe Admin Notify', 'New subscriber', '" . $emailTemplates['sub_admin_notify']['body'] . "', '[\"" . implode('","', $emailTemplates['sub_admin_notify']['variables']) . "\"]', 1, 'sub_admin_notify', 'subscribe'),\n\t\t\t(NULL, 'Subscribe Site Opened', 'Site :site_name Opened!', '" . $emailTemplates['sub_site_opened']['body'] . "', '[\"" . implode('","', $emailTemplates['sub_site_opened']['variables']) . "\"]', 1, 'sub_site_opened', 'subscribe'),\n\t\t\t(NULL, 'Subscribe New Entry', ':site_name - New Entry!', '" . $emailTemplates['sub_new_post']['body'] . "', '[\"" . implode('","', $emailTemplates['sub_new_post']['variables']) . "\"]', 1, 'sub_new_post', 'subscribe');");
     /**
      * Subscribers
      */
     if (!dbCsp::exist($wpPrefix . CSP_DB_PREF . "subscribers")) {
         $q = "CREATE TABLE IF NOT EXISTS `" . $wpPrefix . CSP_DB_PREF . "subscribers` (\n\t\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t  `user_id` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t  `email` varchar(255) NOT NULL,\n\t\t\t\t  `name` varchar(255) DEFAULT NULL,\n\t\t\t\t  `created` datetime NOT NULL,\n\t\t\t\t  `unsubscribe_date` datetime DEFAULT NULL,\n\t\t\t\t  `active` tinyint(4) NOT NULL DEFAULT '1',\n\t\t\t\t  `token` varchar(255) DEFAULT NULL,\n\t\t\t\t  `ip` varchar(64) DEFAULT NULL,\n\t\t\t\t  PRIMARY KEY (`id`),\n\t\t\t\t  KEY `user_id` (`user_id`)\n\t\t\t\t) DEFAULT CHARSET=utf8";
         dbDelta($q);
     }
     /**
      * Log table - all logs in project
      */
     if (!dbCsp::exist($wpPrefix . CSP_DB_PREF . "log")) {
         dbDelta("CREATE TABLE `" . $wpPrefix . CSP_DB_PREF . "log` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `type` varchar(64) NOT NULL,\n\t\t\t  `data` text,\n\t\t\t  `date_created` int(11) NOT NULL DEFAULT '0',\n\t\t\t  `uid` int(11) NOT NULL DEFAULT 0,\n\t\t\t  PRIMARY KEY (`id`)\n\t\t\t) DEFAULT CHARSET=utf8");
     }
     /**
      * Files
      */
     if (!dbCsp::exist($wpPrefix . CSP_DB_PREF . "files")) {
         dbDelta("CREATE TABLE IF NOT EXISTS `" . $wpPrefix . CSP_DB_PREF . "files` (\n\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t `pid` int(11) NOT NULL,\n\t\t\t `name` varchar(255) NOT NULL,\n\t\t\t `path` varchar(255) NOT NULL,\n\t\t\t `mime_type` varchar(255) DEFAULT NULL,\n\t\t\t `size` int(11) NOT NULL DEFAULT '0',\n\t\t\t `active` tinyint(1) NOT NULL,\n\t\t\t `date` datetime DEFAULT NULL,\n\t\t\t `download_limit` int(11) NOT NULL DEFAULT '0',\n\t\t\t `period_limit` int(11) NOT NULL DEFAULT '0',\n\t\t\t `description` text NOT NULL,\n\t\t\t `type_id` SMALLINT(5) NOT NULL DEFAULT 1,\n\t\t\t PRIMARY KEY (`id`)\n\t\t   ) DEFAULT CHARSET=utf8");
     }
     installerDbUpdaterCsp::runUpdate();
     if ($current_version && !self::$_firstTimeActivated) {
         self::setUsed();
     }
     update_option($wpPrefix . CSP_DB_PREF . 'db_version', CSP_VERSION);
     add_option($wpPrefix . CSP_DB_PREF . 'db_installed', 1);
     dbCsp::query("UPDATE `" . $wpPrefix . CSP_DB_PREF . "options` SET value = '" . CSP_VERSION . "' WHERE code = 'version' LIMIT 1");
     //$time = microtime(true) - $start;	// Speed debug info
 }
<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 utilsCsp::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(){
예제 #23
0
 function prepareParamsCsp(&$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 = utilsCsp::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 = utilsCsp::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'] = prepareFieldCodeCsp($d['label']) . '_' . rand(0, 9999999);
         }
     }
     return $d;
 }
예제 #24
0
 public static function userFieldDestFromDB($value)
 {
     return utilsCsp::jsonDecode($value);
 }
예제 #25
0
 public static function _installTables($module, $action = 'install')
 {
     $modDir = empty($module['ex_plug_dir']) ? CSP_MODULES_DIR . $module['code'] . DS : utilsCsp::getPluginDir($module['ex_plug_dir']) . $module['code'] . DS;
     if (is_dir($modDir . 'tables')) {
         $tableFiles = utilsCsp::getFilesList($modDir . 'tables');
         if (!empty($tableFiles)) {
             frameCsp::_()->extractTables($modDir . 'tables' . DS);
             foreach ($tableFiles as $file) {
                 $tableName = str_replace('.php', '', $file);
                 if (frameCsp::_()->getTable($tableName)) {
                     frameCsp::_()->getTable($tableName)->{$action}();
                 }
             }
         }
     }
 }
예제 #26
0
 public function removeLogoImg($d = array())
 {
     $logoImgDirPath = frameCsp::_()->getModule('options')->getLogoImgFullDir();
     if ($this->save(array('opt_values' => array('logo_image' => ''), 'code' => 'logo_image')) && utilsCsp::deleteFile($logoImgDirPath)) {
         return true;
     } else {
         $this->pushError(langCsp::_('Unable to remove image'));
     }
 }