本文整理匯總了PHP中IPSText::safeSlashes方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::safeSlashes方法的具體用法?PHP IPSText::safeSlashes怎麽用?PHP IPSText::safeSlashes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::safeSlashes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: languageEditWordPackValues
/**
* Saves new language edits
*
* @return @e void
*/
public function languageEditWordPackValues()
{
//-----------------------------------------
// Init
//-----------------------------------------
$id = intval($this->request['id']);
$langCheck = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_sys_lang', 'where' => 'lang_id=' . $id));
if ($langCheck['lang_protected'] and !IN_DEV) {
$this->registry->output->showError($this->lang->words['lang_pack_protected']);
}
/* Got anything? */
if (!count(array_keys($_POST['lang']))) {
$this->registry->output->redirect($this->settings['base_url'] . $this->form_code . "&do=edit_word_pack&word_pack={$this->request['pack']}&id={$this->request['id']}&search={$this->request['search']}&filter={$this->request['filter']}&st={$this->request['st']}", $this->lang->words['language_word_pack_edited']);
}
//-----------------------------------------
// Get the words
//-----------------------------------------
$lang = $this->DB->buildAndFetchAll(array('select' => '*', 'from' => 'core_sys_lang_words', 'where' => "lang_id={$id} AND word_id IN(" . implode(',', array_map('intval', array_keys($_POST['lang']))) . ')'), 'word_id');
//-----------------------------------------
// Loop through language bits submitted
//-----------------------------------------
if (is_array($_POST['lang']) && count($_POST['lang'])) {
foreach ($_POST['lang'] as $k => $v) {
if ($v != "") {
$v = IPSText::safeSlashes($v);
$v = str_replace('\', '\\', $v);
if ($lang[$k]['word_pack'] == 'admin_js' or $lang[$k]['word_pack'] == 'public_js') {
$v = str_replace(array("\r\n", "\r"), "", $v);
}
$this->DB->update('core_sys_lang_words', "word_custom='" . $this->DB->addSlashes($v) . "', word_custom_version=word_default_version", "word_id=" . intval($k), false, true);
} elseif (isset($lang[$k]) and $lang[$k]['word_custom']) {
$this->DB->update('core_sys_lang_words', array('word_custom' => ''), "word_id=" . intval($k));
}
}
}
//-----------------------------------------
// Recache and redirect
//-----------------------------------------
$this->cacheToDisk($id);
$this->registry->output->redirect($this->settings['base_url'] . $this->form_code . "&do=edit_word_pack&word_pack={$this->request['pack']}&id={$this->request['id']}&search={$this->request['search']}&filter={$this->request['filter']}&st={$this->request['st']}", $this->lang->words['language_word_pack_edited']);
}
示例2: languageEditWordPackValues
/**
* Saves new language edits
*
* @access public
* @return void
*/
public function languageEditWordPackValues()
{
//-----------------------------------------
// Init
//-----------------------------------------
$id = intval($this->request['id']);
//-----------------------------------------
// Loop through language bits submitted
//-----------------------------------------
if (is_array($_POST['lang']) && count($_POST['lang'])) {
foreach ($_POST['lang'] as $k => $v) {
if ($v) {
$v = IPSText::safeSlashes($v);
$v = str_replace('\', '\\', $v);
$this->DB->update('core_sys_lang_words', "word_custom='" . $this->DB->addSlashes($v) . "', word_custom_version=word_default_version", "word_id=" . intval($k), false, true);
}
}
}
//-----------------------------------------
// Recache and redirect
//-----------------------------------------
$this->cacheToDisk($id);
$this->registry->output->redirect("{$this->settings['base_url']}&module=languages§ion=manage_languages&do=edit_word_pack&word_pack={$this->request['pack']}&id={$this->request['id']}&search={$this->request['search']}&filter={$this->request['filter']}&st={$this->request['st']}", $this->lang->words['language_word_pack_edited']);
}