本文整理汇总了PHP中stripslashes函数的典型用法代码示例。如果您正苦于以下问题:PHP stripslashes函数的具体用法?PHP stripslashes怎么用?PHP stripslashes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stripslashes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveFile
public function saveFile($data)
{
$post = (object) $data;
self::setMapping();
// recupera variáveis
$fileData = $_FILES["filedata"];
$fileName = $fileData["name"];
$fileType = $fileData["type"];
$tempName = $fileData["tmp_name"];
$dataType = self::$mapping[$fileType];
if (!is_uploaded_file($tempName)) {
self::$response->success = false;
self::$response->text = "O arquivo não foi enviado com sucesso. Erro de sistema: {$fileData['error']}.";
return json_encode(self::$response);
}
if (!array_key_exists($fileType, self::$mapping)) {
return '{"success":false,"records":0,"error":2,"root":[],"text":"Tipo de arquivo não mapeado para esta operação!"}';
}
// comprime arquivo temporário
if ($dataType === true) {
self::sizeFile();
self::workSize($tempName);
}
$tempData = base64_encode(file_get_contents($tempName));
// recupera extensão do arquivo
$fileExtension = strtoupper(strrchr($fileName, "."));
$fileExtension = str_replace(".", "", $fileExtension);
$fileInfo = array("fileType" => $fileType, "fileExtension" => $fileExtension, "dataType" => $dataType, "fileName" => $fileName);
$fileInfo = stripslashes(json_encode($fileInfo));
$affectedRows = $this->exec("update {$post->tableName} set filedata = '{$tempData}', fileinfo = '{$fileInfo}' where id = {$post->id}");
unlink($tempName);
return $affectedRows;
}
示例2: validate
function validate($data = null)
{
$this->errors = array();
if (!empty($data)) {
$data = empty($data[$this->model]) ? $data : $data[$this->model];
foreach ($data as $dkey => $dval) {
$this->data->{$dkey} = stripslashes($dval);
}
extract($data, EXTR_SKIP);
if (empty($gallery_id)) {
$this->errors['title'] = __('No gallery was specified', $this->plugin_name);
}
if (empty($slide_id)) {
$this->errors['title'] = __('No slide was specified', $this->plugin_name);
}
if (empty($this->errors)) {
if ($galleryslide = $this->find(array('gallery_id' => $gallery_id, 'slide_id' => $slide_id))) {
$this->data->id = $galleryslide->id;
}
}
} else {
$this->errors[] = __('No data was posted', $this->plugin_name);
}
return $this->errors;
}
示例3: autoRun
public function autoRun()
{
if (!eregi('redirecionar=', $_SERVER['QUERY_STRING']) && !$this->system->input['redirecionar']) {
$this->redir = base64_encode('index.php?' . $_SERVER['QUERY_STRING']);
} else {
$this->redir = stripslashes($this->system->input['redirecionar']);
}
switch ($this->system->input['do']) {
case 'nova':
$this->doEdicao();
break;
case 'editar':
$this->doEdicao();
break;
case 'buscar':
$this->doListar();
break;
case 'listar':
$this->doListar();
break;
case 'apagar':
$this->doDeletar();
break;
default:
$this->pagina404();
break;
}
}
示例4: inp
function inp($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
示例5: prepare
protected function prepare()
{
include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
try {
$this->api = $api = Sputnik::get_plugin($this->id);
} catch (Exception $e) {
status_header(500);
$this->header();
echo '<p>' . $e->getMessage() . '</p>';
$this->footer();
return;
}
if (!Sputnik::is_purchased($this->api->slug)) {
wp_redirect(Sputnik_Admin::build_url(array('buy' => $this->id)));
die;
}
if (!current_user_can('install_plugins')) {
wp_die(__('You do not have sufficient permissions to install plugins for this site.', 'sputnik'));
}
check_admin_referer($this->nonce_prefix . $this->api->slug);
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
$title = sprintf($this->title_format, $this->api->name . ' ' . $this->api->version);
$nonce = $this->nonce_prefix . $this->id;
$url = 'update.php?action=install-plugin&plugin=' . $this->id;
if (isset($_GET['from'])) {
$url .= '&from=' . urlencode(stripslashes($_GET['from']));
}
$type = 'web';
//Install plugin type, From Web or an Upload.
if ($this->api->is_theme) {
$this->upgrader = new Sputnik_ThemeUpgrader(new Sputnik_View_Install_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
} else {
$this->upgrader = new Sputnik_Upgrader(new Sputnik_View_Install_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
}
}
示例6: PMA_transformation_getOptions
/**
* Set of functions used with the relation and pdf feature
*/
function PMA_transformation_getOptions($string)
{
$transform_options = array();
/* Parse options */
for ($nextToken = strtok($string, ','); $nextToken !== false; $nextToken = strtok(',')) {
$trimmed = trim($nextToken);
if ($trimmed[0] == '\'' && $trimmed[strlen($trimmed) - 1] == '\'') {
$transform_options[] = substr($trimmed, 1, -1);
} else {
if ($trimmed[0] == '\'') {
$trimmed = ltrim($nextToken);
while ($nextToken !== false) {
$nextToken = strtok(',');
$trimmed .= $nextToken;
$rtrimmed = rtrim($trimmed);
if ($rtrimmed[strlen($rtrimmed) - 1] == '\'') {
break;
}
}
$transform_options[] = substr($rtrimmed, 1, -1);
} else {
$transform_options[] = $nextToken;
}
}
}
// strip possible slashes to behave like documentation says
$result = array();
foreach ($transform_options as $val) {
$result[] = stripslashes($val);
}
return $result;
}
示例7: stripStr
function stripStr($str)
{
if (get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return addslashes(htmlspecialchars($str, ENT_QUOTES, 'UTF-8'));
}
示例8: contrexx_stripslashes
/**
* Wrapper for stripslashes() that complies with gpc_magic_quotes
* @param string $string
* @return string
*/
function contrexx_stripslashes($string)
{
if (CONTREXX_ESCAPE_GPC) {
return stripslashes($string);
}
return $string;
}
示例9: sanitize
private static function sanitize($value)
{
$value = trim($value);
$value = stripslashes($value);
$value = htmlspecialchars($value);
return $value;
}
示例10: metaform
public function metaform()
{
$value = $this->getValue();
$data = $this->getData();
$attributes = $this->getAttr();
$form = array();
$options = array();
if (isset($data['options'])) {
if (!is_admin()) {
$new_options = array();
foreach ($data['options'] as $key => $option) {
$tmp = $option['value'];
$option['value'] = $option['types-value'];
$option['types-value'] = $tmp;
$new_options[$key] = $option;
unset($tmp);
}
$data['options'] = $new_options;
}
foreach ($data['options'] as $key => $option) {
$one_option_data = array('#value' => $option['value'], '#title' => stripslashes($option['title']));
/**
* add default value if needed
* issue: frontend, multiforms CRED
*/
// if (array_key_exists('types-value', $option)) {
// $one_option_data['#types-value'] = $option['types-value'];
// }
$options[] = $one_option_data;
}
}
/**
* for user fields we reset title and description to avoid double
* display
*/
$title = $this->getTitle();
if (empty($title)) {
$title = $this->getTitle(true);
}
$options = apply_filters('wpt_field_options', $options, $title, 'select');
/**
* default_value
*/
if (!empty($value) || $value == '0') {
$data['default_value'] = $value;
}
$is_multiselect = array_key_exists('multiple', $attributes) && 'multiple' == $attributes['multiple'];
$default_value = isset($data['default_value']) ? $data['default_value'] : null;
//Fix https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189219391/comments
if ($is_multiselect) {
$default_value = new RecursiveIteratorIterator(new RecursiveArrayIterator($default_value));
$default_value = iterator_to_array($default_value, false);
}
//##############################################################################################
/**
* metaform
*/
$form[] = array('#type' => 'select', '#title' => $this->getTitle(), '#description' => $this->getDescription(), '#name' => $this->getName(), '#options' => $options, '#default_value' => $default_value, '#multiple' => $is_multiselect, '#validate' => $this->getValidationData(), '#class' => 'form-inline', '#repetitive' => $this->isRepetitive());
return $form;
}
示例11: load_settings
function load_settings()
{
global $system__options_general, $system__options_defaults;
$query = "SELECT * FROM " . table('options') . "\n WHERE option_type='general' OR option_type='default'";
$result = or_query($query);
while ($line = pdo_fetch_assoc($result)) {
$settings[$line['option_name']] = stripslashes($line['option_value']);
}
foreach ($system__options_general as $option) {
if (isset($option['type']) && ($option['type'] == 'line' || $option['type'] == 'comment')) {
} else {
if (!isset($settings[$option['option_name']])) {
$settings[$option['option_name']] = $option['default_value'];
}
}
}
foreach ($system__options_defaults as $option) {
if (isset($option['type']) && ($option['type'] == 'line' || $option['type'] == 'comment')) {
} else {
if (!isset($settings[$option['option_name']])) {
$settings[$option['option_name']] = $option['default_value'];
}
}
}
return $settings;
}
示例12: strips
public static function strips($data)
{
foreach ($data as $i => $v) {
$data[$i] = stripslashes($v);
}
return $data;
}
示例13: mres
function mres($input)
{
if (get_magic_quotes_gpc()) {
$input = stripslashes($input);
}
return mysql_real_escape_string($input);
}
示例14: sendMessage
function sendMessage($form, $to, $subject, $body, $avatar = false, $allow_html = true)
{
if ($allow_html) {
$this->header = $subject;
$this->m_text = $body;
} else {
$this->header = stripslashes(htmlspecialchars($subject));
$this->m_text = stripslashes(htmlspecialchars($body));
}
$this->send_date = date("Y-m-d H:i:s");
$this->author_id = $form;
$this->recipient_id = $to;
if (!$avatar) {
$user = new UserModel();
$user->load($from);
$this->avatar_id = $user->getUserAvatar($user->id);
$this->avatar_id = $this->avatar_id['id'];
} else {
$this->avatar_id = $avatar;
}
$this->is_read = 0;
$this->is_deleted = 0;
$messageId = $this->save();
return $messageId;
}
示例15: replace_input
function replace_input($input)
{
$output = stripslashes($input);
$output = filter_var($output, FILTER_SANITIZE_SPECIAL_CHARS);
$output = trim($output, "/");
return $output;
}