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; }
public static function userFieldDestToDB($value) { return utilsCsp::jsonEncode($value); }
<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
<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(){
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; }
public static function statesInput($name, $params = array('value' => '', 'attrs' => '', 'notSelected' => true, 'id' => '', 'selectHtml' => '')) { if (empty($params['selectHtml']) || !method_exists(html, $params['selectHtml'])) { return false; } $params['notSelected'] = isset($params['notSelected']) ? $params['notSelected'] : true; $states = fieldAdapterCsp::getStates($params['notSelected']); foreach ($states as $sid => $s) { $params['options'][$sid] = $s['name']; } $idSelect = ''; $idText = ''; $id = ''; if (!empty($params['id'])) { $id = $params['id']; } else { $id = self::nameToClassId($name); } $paramsText = $paramsSelect = $params; $paramsText['attrs'] .= 'id = "' . $id . '_text"'; $paramsSelect['attrs'] .= 'id = "' . $id . '_select"'; $res = ''; $res .= self::$params['selectHtml']($name, $paramsSelect); $res .= self::text($name, $paramsText); if (empty($params['doNotAddJs'])) { $res .= '<script type="text/javascript"> // <!-- if(!toeStates.length) toeStates = ' . utilsCsp::jsonEncode($states) . '; toeStatesObjects["' . $id . '"] = new toeStatesSelect("' . $id . '"); // --> </script>'; } return $res; }
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>'; }
<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>