本文整理汇总了PHP中G::json_encode方法的典型用法代码示例。如果您正苦于以下问题:PHP G::json_encode方法的具体用法?PHP G::json_encode怎么用?PHP G::json_encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::json_encode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addToBackup
public function addToBackup ($workspace)
{
//verifing if workspace exists.
if (! $workspace->workspaceExists()) {
echo "Workspace {$workspace->name} not found\n";
return false;
}
//create destination path
if (! file_exists( PATH_DATA . "upgrade/" )) {
mkdir( PATH_DATA . "upgrade/" );
}
$tempDirectory = PATH_DATA . "upgrade/" . basename( tempnam( __FILE__, '' ) );
mkdir( $tempDirectory );
$metadata = $workspace->getMetadata();
CLI::logging( "Temporing up database...\n" );
$metadata["databases"] = $workspace->exportDatabase( $tempDirectory );
$metadata["directories"] = array ("{$workspace->name}.files");
$metadata["version"] = 1;
$metaFilename = "$tempDirectory/{$workspace->name}.meta";
if (! file_put_contents( $metaFilename, str_replace( array (",","{","}"), array (",\n ","{\n ","\n}\n"), G::json_encode( $metadata ) ) )) {
CLI::logging( "Could not create backup metadata" );
}
CLI::logging( "Adding database to backup...\n" );
$this->addDirToBackup( $tempDirectory );
CLI::logging( "Adding files to backup...\n" );
$this->addDirToBackup( $workspace->path );
$this->tempDirectories[] = $tempDirectory;
}
示例2: postNote
/**
* post Note Action
*
* @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION'])
* @return array containg the case notes
*/
function postNote($httpData)
{
require_once "classes/model/AppNotes.php";
//extract(getExtJSParams());
if (isset($httpData->appUid) && trim($httpData->appUid) != "") {
$appUid = $httpData->appUid;
} else {
$appUid = $_SESSION['APPLICATION'];
}
if (!isset($appUid)) {
throw new Exception('Can\'t resolve the Apllication ID for this request.');
}
$usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : "";
$noteContent = addslashes($httpData->noteText);
//Disabling the controller response because we handle a special behavior
$this->setSendResponse(false);
//Add note case
$appNote = new AppNotes();
$response = $appNote->addCaseNote($appUid, $usrUid, $noteContent, intval($httpData->swSendMail));
//Send the response to client
@ini_set("implicit_flush", 1);
ob_start();
echo G::json_encode($response);
@ob_flush();
@flush();
@ob_end_flush();
ob_implicit_flush(1);
}
示例3: WebResource
/**
* WebResource
*
* @param string $uri
* @param string $post
*
* @return none
*/
function WebResource($uri, $post)
{
$this->_uri = $uri;
if (isset($post['function']) && $post['function'] != '') {
/*Call a function*/
header('Content-Type: text/json');
//$parameters=G::json_decode((urldecode($post['parameters']))); //for %AC
$parameters = G::json_decode($post['parameters']);
$paramsRef = array();
foreach ($parameters as $key => $value) {
if (is_string($key)) {
$paramsRef[] = "\$parameters['" . addcslashes($key, '\\\'') . "']";
} else {
$paramsRef[] = '$parameters[' . $key . ']';
}
}
$paramsRef = implode(',', $paramsRef);
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$post['function'] = $filter->validateInput($post['function']);
$paramsRef = $filter->validateInput($paramsRef);
$res = eval('return ($this->' . $post['function'] . '(' . $paramsRef . '));');
$res = G::json_encode($res);
print $res;
} else {
/*Print class definition*/
$this->_encode();
}
}
示例4: sendJsonResultGeneric
function sendJsonResultGeneric($response, $callback)
{
header("Content-Type: application/json");
$finalResponse = G::json_encode($response);
if ($callback != '') {
print $callback . "({$finalResponse});";
} else {
print $finalResponse;
}
}
示例5: saveProcess
/**
* Save new process
*
* @param object $httpData
*/
public function saveProcess($httpData)
{
require_once 'classes/model/Task.php';
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
$httpData->PRO_TITLE = trim($httpData->PRO_TITLE);
if (!isset($httpData->PRO_UID)) {
if (Process::existsByProTitle($httpData->PRO_TITLE)) {
$result = array('success' => false, 'msg' => G::LoadTranslation('ID_SAVE_PROCESS_ERROR'), 'errors' => array('PRO_TITLE' => G::LoadTranslation('ID_PROCESSTITLE_ALREADY_EXISTS', SYS_LANG, array('PRO_TITLE' => $httpData->PRO_TITLE))));
print G::json_encode($result);
exit(0);
}
$processData['USR_UID'] = $_SESSION['USER_LOGGED'];
$processData['PRO_TITLE'] = $httpData->PRO_TITLE;
$processData['PRO_DESCRIPTION'] = $httpData->PRO_DESCRIPTION;
$processData['PRO_CATEGORY'] = $httpData->PRO_CATEGORY;
$sProUid = $oProcessMap->createProcess($processData);
//call plugins
$oData['PRO_UID'] = $sProUid;
$oData['PRO_TEMPLATE'] = isset($httpData->PRO_TEMPLATE) && $httpData->PRO_TEMPLATE != '' ? $httpData->PRO_TEMPLATE : '';
$oData['PROCESSMAP'] = $oProcessMap;
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->executeTriggers(PM_NEW_PROCESS_SAVE, $oData);
} else {
//$oProcessMap->updateProcess($_POST['form']);
$sProUid = $httpData->PRO_UID;
}
//Save Calendar ID for this process
if (isset($httpData->PRO_CALENDAR)) {
G::LoadClass("calendar");
$calendarObj = new Calendar();
$calendarObj->assignCalendarTo($sProUid, $httpData->PRO_CALENDAR, 'PROCESS');
}
$this->success = true;
$this->PRO_UID = $sProUid;
$this->msg = G::LoadTranslation('ID_CREATE_PROCESS_SUCCESS');
}
示例6: postNote
/**
* post Note Action
* @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION'])
* @return array containg the case notes
*/
function postNote($httpData)
{
//extract(getExtJSParams());
if (isset($httpData->appUid) && trim($httpData->appUid) != "") {
$appUid = $httpData->appUid;
} else {
$appUid = $_SESSION['APPLICATION'];
}
if (!isset($appUid)) {
throw new Exception('Can\'t resolve the Apllication ID for this request.');
}
$usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : "";
require_once "classes/model/AppNotes.php";
$appNotes = new AppNotes();
$noteContent = addslashes($httpData->noteText);
$result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false);
// Disabling the controller response because we handle a special behavior
$this->setSendResponse(false);
//send the response to client
@ini_set('implicit_flush', 1);
ob_start();
echo G::json_encode($result);
@ob_flush();
@flush();
@ob_end_flush();
ob_implicit_flush(1);
//send notification in background
$noteRecipientsList = array();
G::LoadClass('case');
$oCase = new Cases();
$p = $oCase->getUsersParticipatedInCase($appUid);
foreach ($p['array'] as $key => $userParticipated) {
$noteRecipientsList[] = $key;
}
$noteRecipients = implode(",", $noteRecipientsList);
$appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
}
示例7: getDWSDocumentVersions
/**
*
* @method Get DWS Document Versions
*
* @name getDWSDocumentVersions
* @label Get DWS Document Versions
*
* @param string | $sharepointServer | Server name and port whre DWS wsdl exists, including protocol | http://server:port/_vti_bin/Dws.asmx?WSDL
* @param string | $auth | Valid Auth string to connect to server | user:password
* @param string | $newFileName | Name of New File
* @param string | $dwsname | Name of DWS
*
* @return string | $result | Response
*
*/
function getDWSDocumentVersions($sharepointServer, $auth, $newFileName, $dwsname)
{
require_once PATH_CORE . 'classes' . PATH_SEP . 'triggers' . PATH_SEP . 'class.pmTrSharepoint.php';
$pmTrSharepoint = new pmTrSharepointClass($sharepointServer, $auth);
$result = $pmTrSharepoint->getDWSDocumentVersions($newFileName, $dwsname);
if (isset($result->GetVersionsResult)) {
/*
* Code to get the Document's Version/s
*/
$xml = $result->GetVersionsResult->any;
// in Result we get string in Xml format
$xmlNew = simplexml_load_string($xml);
// used to parse string to xml
$xmlArray = @G::json_decode(@G::json_encode($xmlNew), 1);
// used to convert Objects to array
$resultCount = count($xmlArray['result']);
for ($i = 0; $i < $resultCount; $i++) {
$version[] = $xmlArray['result'][$i]['@attributes']['version'];
}
$serializeResult = serialize($version);
// serializing the Array for Returning.
return $serializeResult;
} else {
return "No version found";
}
}
示例8: array
$res = $appCache->triggerApplicationDelete($lang, true);
//$result->info[] = array ('name' => 'Trigger APPLICATION DELETE', 'value'=> $res);
//CONTENT UPDATE
$res = $appCache->triggerContentUpdate($lang, true);
//$result->info[] = array("name" => "Trigger CONTENT UPDATE", "value" => $res);
//build using the method in AppCacheView Class
$res = $appCache->fillAppCacheView($lang);
//$result->info[] = array ('name' => 'build APP_CACHE_VIEW', 'value'=> $res);
//set status in config table
$confParams = array('LANG' => $lang, 'STATUS' => 'active');
$conf->aConfig = $confParams;
$conf->saveConfig('APP_CACHE_VIEW_ENGINE', '', '', '');
$response = new StdClass();
$result->success = true;
$result->msg = "Completed successfully";
echo G::json_encode($result);
} catch (Exception $e) {
$confParams = array('lang' => $lang, 'status' => 'failed');
$appCacheViewEngine = $oServerConf->setProperty('APP_CACHE_VIEW_ENGINE', $confParams);
echo '{success: false, msg:"' . $e->getMessage() . '"}';
}
break;
case 'recreate-root':
$sh = md5(filemtime(PATH_GULLIVER . "/class.g.php"));
$h = G::encrypt($_POST['host'] . $sh . $_POST['user'] . $sh . $_POST['password'] . $sh . 1, $sh);
$insertStatements = "define ( 'HASH_INSTALLATION','{$h}' ); \ndefine ( 'SYSTEM_HASH', '{$sh}' ); \n";
$lines = array();
$content = '';
$filename = PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php';
$lines = file($filename);
$count = 1;
示例9: _render
/**
* Prints the DynaformEditor
*
* @return void
*/
public function _render()
{
global $G_PUBLISH;
$script = '';
/* Start Block: Load (Create if doesn't exist) the xmlform */
$Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($this->file, URL_KEY), 'DYN_UID' => $this->dyn_uid, 'PRO_UID' => $this->pro_uid, 'DYNAFORM_NAME' => $this->dyn_title, 'FILE' => $this->file, 'DYN_EDITOR' => $this->dyn_editor);
$_SESSION['Current_Dynafom']['Parameters'] = $Parameters;
$XmlEditor = array('URL' => G::encrypt($this->file, URL_KEY), 'XML' => '');
$JSEditor = array('URL' => G::encrypt($this->file, URL_KEY));
$A = G::encrypt($this->file, URL_KEY);
try {
$openDoc = new Xml_Document();
$fileName = $this->home . $this->file . '.xml';
if (file_exists($fileName)) {
$openDoc->parseXmlFile($fileName);
} else {
$this->_createDefaultXmlForm($fileName);
$openDoc->parseXmlFile($fileName);
}
//$form = new Form( $this->file , $this->home, SYS_LANG, true );
$Properties = dynaformEditorAjax::get_properties($A, $this->dyn_uid);
/* Start Block: Prepare the XMLDB connection */
define('DB_XMLDB_HOST', PATH_DYNAFORM . $this->file . '.xml');
define('DB_XMLDB_USER', '');
define('DB_XMLDB_PASS', '');
define('DB_XMLDB_NAME', '');
define('DB_XMLDB_TYPE', 'myxml');
/* Start Block: Prepare the dynaformEditor */
$G_PUBLISH = new Publisher();
$sName = 'dynaformEditor';
$G_PUBLISH->publisherId = $sName;
$oHeadPublisher =& headPublisher::getSingleton();
$labesTrans = G::getTranslations(array('ID_FIELD_DYNAFORM_TEXT', 'ID_FIELD_DYNAFORM_CURRENCY', 'ID_FIELD_DYNAFORM_PERCENTAGE', 'ID_FIELD_DYNAFORM_PASSWORD', 'ID_FIELD_DYNAFORM_SUGGEST', 'ID_FIELD_DYNAFORM_TEXTAREA', 'ID_FIELD_DYNAFORM_TITLE', 'ID_FIELD_DYNAFORM_SUBTITLE', 'ID_FIELD_DYNAFORM_BUTTON', 'ID_FIELD_DYNAFORM_SUBMIT', 'ID_FIELD_DYNAFORM_RESET', 'ID_FIELD_DYNAFORM_DROPDOWN', 'ID_FIELD_DYNAFORM_YESNO', 'ID_FIELD_DYNAFORM_LISTBOX', 'ID_FIELD_DYNAFORM_CHECKBOX', 'ID_FIELD_DYNAFORM_CHECKGROUP', 'ID_FIELD_DYNAFORM_RADIOGROUP', 'DATE_LABEL', 'ID_FIELD_DYNAFORM_HIDDEN', 'ID_FIELD_DYNAFORM_LINK', 'ID_FIELD_DYNAFORM_LINK', 'ID_FIELD_DYNAFORM_FILE', 'ID_FIELD_DYNAFORM_JAVASCRIPT', 'ID_FIELD_DYNAFORM_GRID', 'ID_INDEX'));
$oHeadPublisher->addScriptCode("var TRANSLATIONS = " . G::json_encode($labesTrans) . ";");
$oHeadPublisher->setTitle(G::LoadTranslation('ID_DYNAFORM_EDITOR') . ' - ' . $Properties['DYN_TITLE']);
$G_PUBLISH->AddContent('blank');
$this->panelConf['title'] = '';
$G_PUBLISH->AddContent('panel-init', 'mainPanel', $this->panelConf);
if ($Properties['DYN_TYPE'] == 'xmlform') {
$G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', '');
} else {
$G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', '');
}
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', 'display:none', $Parameters, '', '');
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', 'display:none', $XmlEditor, '', '');
$G_PUBLISH->AddContent('blank');
$i = 0;
$aFields = array();
$aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char');
$oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $this->file . '.xml', '', '', '', 'myxml'));
$oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"');
$iMaximun = $oDataset->count();
while ($aRow = $oDataset->Read()) {
$aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => $i > 0 ? G::LoadTranslation('ID_UP') : '', 'DOWN' => $i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : '', 'row__' => $i + 1);
$i++;
break;
}
global $_DBArray;
$_DBArray['fields'] = $aFields;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass('ArrayPeer');
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('fields');
/**
* *@Erik-> this is deprecated,.
* (unuseful) $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/fields_List', $oCriteria, $Parameters, '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');**
*/
$G_PUBLISH->AddContent('blank');
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', 'display:none', $JSEditor, '', '');
} catch (Exception $e) {
}
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', 'display:none', $Properties, '', '');
//for showHide tab option @Neyek
$G_PUBLISH->AddContent('blank');
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PREVIEW"), $sName . '[3]', 'dynaformEditor.changeToPreview', 'dynaformEditor.saveCurrentView');
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_XML"), $sName . '[4]', 'dynaformEditor.changeToXmlCode', 'dynaformEditor.saveCurrentView');
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_HTML"), $sName . '[5]', 'dynaformEditor.changeToHtmlCode', 'dynaformEditor.saveCurrentView');
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_FIELDS_LIST"), $sName . '[6]', 'dynaformEditor.changeToFieldsList', 'dynaformEditor.saveCurrentView');
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView');
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PROPERTIES"), $sName . '[8]', 'dynaformEditor.changeToProperties', 'dynaformEditor.saveCurrentView');
//for showHide tab option @Neyek
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_CONDITIONS_EDITOR"), $sName . '[9]', 'dynaformEditor.changeToShowHide', 'dynaformEditor.saveShowHide');
$G_PUBLISH->AddContent('panel-close');
$oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js", 2);
$oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js');
//$oHeadPublisher->addScriptFile('/js/dveditor/core/dveditor.js');
//$oHeadPublisher->addScriptFile('/codepress/codepress.js',1);
$oHeadPublisher->addScriptFile('/js/codemirror/js/codemirror.js', 1);
$oHeadPublisher->addScriptFile('/js/grid/core/grid.js');
$oHeadPublisher->addScriptCode('
var DYNAFORM_URL="' . $Parameters['URL'] . '";
leimnud.event.add(window,"load",function(){ loadEditor(); });
');
$oHeadPublisher->addScriptCode(' var jsMeta;var usernameLogged = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";');
G::RenderPage("publish", 'blank');
//.........这里部分代码省略.........
示例10: deleteSkin
function deleteSkin()
{
G::LoadSystem('inputfilter');
$filter = new InputFilter();
try {
$_REQUEST['SKIN_FOLDER_ID'] = $filter->xssFilterHard($_REQUEST['SKIN_FOLDER_ID']);
if (!isset($_REQUEST['SKIN_FOLDER_ID'])) {
throw new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED'));
}
if ($_REQUEST['SKIN_FOLDER_ID'] == "classic") {
throw new Exception(G::LoadTranslation('ID_SKIN_FOLDER_NOT_DELETEABLE'));
}
$folderId = $_REQUEST['SKIN_FOLDER_ID'];
if (!is_dir(PATH_CUSTOM_SKINS . $folderId)) {
throw new Exception(G::LoadTranslation('ID_SKIN_NOT_EXISTS'));
}
//Delete
G::rm_dir(PATH_CUSTOM_SKINS . $folderId);
$response['success'] = true;
$response['message'] = "{$folderId} deleted";
G::auditLog("DeleteSkin", "Skin Name: " . $folderId);
} catch (Exception $e) {
$response['success'] = false;
$response['error'] = $response['message'] = $e->getMessage();
$response = $filter->xssFilterHard($response);
print_r(G::json_encode($response));
}
}
示例11: casesShowOuputDocumentExist
}
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$totalCount = 0;
for ($j = 0; $j < $rs->getRecordCount(); $j++) {
$result = $rs->getRow();
$result["FILEDOCEXIST"] = casesShowOuputDocumentExist($result["FILEDOC"]);
$result["FILEPDFEXIST"] = casesShowOuputDocumentExist($result["FILEPDF"]);
$aProcesses[] = $result;
$rs->next();
$totalCount++;
}
//!dateFormat
G::LoadClass('configuration');
$conf = new Configurations();
try {
$generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '');
} catch (Exception $e) {
$generalConfCasesList = array();
}
$dateFormat = "";
if (isset($generalConfCasesList['casesListDateFormat']) && !empty($generalConfCasesList['casesListDateFormat'])) {
$dateFormat = $generalConfCasesList['casesListDateFormat'];
}
$newDir = '/tmp/test/directory';
$r = G::verifyPath($newDir);
$r->data = $aProcesses;
$r->totalCount = $totalCount;
$r->dataFormat = $dateFormat;
echo G::json_encode($r);
}
示例12: elseif
}
$realPath = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/' . $sAppDocUid . '_' . $iDocVersion . '.' . $ext;
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/' . $sAppDocUid . '.' . $ext;
$sw_file_exists = false;
if (file_exists($realPath)) {
$sw_file_exists = true;
} elseif (file_exists($realPath1)) {
$sw_file_exists = true;
$realPath = $realPath1;
}
if (!$sw_file_exists) {
$error_message = "'" . $oAppDocument->Fields['APP_DOC_FILENAME'] . "' " . G::LoadTranslation('ID_ERROR_STREAMING_FILE');
if (isset($_POST['request']) && $_POST['request'] == true) {
$res['success'] = 'failure';
$res['message'] = $error_message;
print G::json_encode($res);
} else {
G::SendMessageText($error_message, "ERROR");
$backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
die;
}
} else {
if (isset($_POST['request']) && $_POST['request'] == true) {
$res['success'] = 'success';
$res['message'] = $oAppDocument->Fields['APP_DOC_FILENAME'];
print G::json_encode($res);
} else {
G::streamFile($realPath, $bDownload, $oAppDocument->Fields['APP_DOC_FILENAME']);
}
}
示例13: foreach
$oResult = $oTrigger->verifyDependecies($_POST['TRI_UID']);
$oResult->passed = false;
if ($oResult->code == 0) {
$oResult->passed = true;
$oResult->message = G::LoadTranslation('ID_TRIGGERS_VALIDATION');
//"No Dependencies were found for this trigger in Events definitions\n";
} else {
$oResult->message = '';
foreach ($oResult->dependencies as $Object => $aDeps) {
$nDeps = count($aDeps);
$message = str_replace('{N}', $nDeps, G::LoadTranslation('ID_TRIGGERS_VALIDATION_ERR2'));
$message = str_replace('{Object}', $Object, $message);
$oResult->message .= $message . "\n";
foreach ($aDeps as $dep) {
if (substr($Object, -1) == 's') {
$Object = substr($Object, 0, strlen($Object) - 1);
}
$message = str_replace('{Object}', $Object, G::LoadTranslation('ID_TRIGGERS_VALIDATION_ERR3'));
$message = str_replace('{Description}', '"' . $dep['DESCRIPTION'] . '"', $message);
$oResult->message .= $message . "\n";
}
$oResult->message .= "\n";
}
}
$oResult->success = true;
//print_r($oResult);
print G::json_encode($oResult);
break;
default:
echo 'default';
}
示例14: deleteSkin
function deleteSkin()
{
try {
if (!isset($_REQUEST['SKIN_FOLDER_ID'])) {
throw new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED'));
}
if ($_REQUEST['SKIN_FOLDER_ID'] == "classic") {
throw new Exception(G::LoadTranslation('ID_SKIN_FOLDER_NOT_DELETEABLE'));
}
$folderId = $_REQUEST['SKIN_FOLDER_ID'];
if (!is_dir(PATH_CUSTOM_SKINS . $folderId)) {
throw new Exception(G::LoadTranslation('ID_SKIN_NOT_EXISTS'));
}
//Delete
G::rm_dir(PATH_CUSTOM_SKINS . $folderId);
$response['success'] = true;
$response['message'] = "{$folderId} deleted";
} catch (Exception $e) {
$response['success'] = false;
$response['error'] = $response['message'] = $e->getMessage();
print_r(G::json_encode($response));
}
}
示例15: streamJSTranslationFile
/**
* streaming the translation.<lang>.js file
* take the WEB-INF/translation.<lang> file and append it to file js/widgets/lang/<lang>.js file
*
* @author Fernando Ontiveros Lira <fernando@colosa.com>
* @access public
* @param string $file
* @param boolean $download
* @param string $downloadFileName
* @return string
*/
public function streamJSTranslationFile($filename, $locale = 'en')
{
$defaultTranslations = array();
$foreignTranslations = array();
//if the default translations table doesn't exist we can't proceed
if (!is_file(PATH_LANGUAGECONT . 'translation.en')) {
return;
}
//load the translations table
require_once PATH_LANGUAGECONT . 'translation.en';
$defaultTranslations = $translation;
//if some foreign language was requested and its translation file exists
if ($locale != 'en' && file_exists(PATH_LANGUAGECONT . 'translation.' . $locale)) {
require_once PATH_LANGUAGECONT . 'translation.' . $locale;
//load the foreign translations table
$foreignTranslations = $translation;
}
if (defined("SHOW_UNTRANSLATED_AS_TAG") && SHOW_UNTRANSLATED_AS_TAG != 0) {
$translation = $foreignTranslations;
} else {
$translation = array_merge($defaultTranslations, $foreignTranslations);
}
$calendarJs = '';
$calendarJsFile = PATH_GULLIVER_HOME . "js/widgets/js-calendar/lang/" . $locale . ".js";
if (!file_exists($calendarJsFile)) {
$calendarJsFile = PATH_GULLIVER_HOME . "js/widgets/js-calendar/lang/en.js";
}
$calendarJs = file_get_contents($calendarJsFile) . "\n";
return $calendarJs . 'var TRANSLATIONS = ' . G::json_encode($translation) . ';';
}