本文整理汇总了PHP中stripcslashes函数的典型用法代码示例。如果您正苦于以下问题:PHP stripcslashes函数的具体用法?PHP stripcslashes怎么用?PHP stripcslashes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stripcslashes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_new
function update_new($stId)
{
$data = array('title' => $this->input->post('news_title'), 'an_text' => stripcslashes($this->input->post('news_content')), 'type' => $this->input->post('typeA'));
$this->db->where('news_id', $stId);
$this->db->update('announcement', $data);
redirect('stadium/announcement/' . $this->input->post('st_id'));
}
示例2: getGeocode
public function getGeocode($lon, $lat)
{
$result = "";
$result = json_decode(stripcslashes(file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?latlng=' . $lat . ',' . $lon . '&sensor=false&language=ru')));
sleep(4);
return $result;
}
示例3: tokenize
/**
* Tokenizes a string.
*
* @param string $input The input to tokenise
* @throws \InvalidArgumentException When unable to parse input (should never happen)
*/
private function tokenize($input)
{
$input = preg_replace('/(\r\n|\r|\n|\t)/', ' ', $input);
$tokens = array();
$length = strlen($input);
$cursor = 0;
while ($cursor < $length) {
if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
} elseif (preg_match('/([^="\' ]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
$tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
} elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
$tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
} elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
$tokens[] = stripcslashes($match[1]);
} else {
// should never happen
// @codeCoverageIgnoreStart
throw new \InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
// @codeCoverageIgnoreEnd
}
$cursor += strlen($match[0]);
}
return $tokens;
}
示例4: command_calc
public function command_calc($user, $channel, $args)
{
$calc = implode(" ", $args);
$data = file_get_contents("http://www.google.com/ig/calculator?hl=en&q=" . urlencode($calc));
$this->bot->privmsg($channel, "0|" . $data);
$data = mb_convert_encoding($data, 'UTF-8', mb_detect_encoding($data, 'UTF-8, ISO-8859-1', true));
//print("1|".$data . "\n");
$this->bot->privmsg($channel, "1|" . $data);
$data = preg_replace("/([,{])(.*?):/", '$1"$2":', $data);
//hack, convert js to json.
//print("2|".$data . "\n");
$this->bot->privmsg($channel, "2|" . $data);
$data = stripcslashes($data);
//print("3|".$data . "\n");
$this->bot->privmsg($channel, "3|" . $data);
$data = preg_replace("/<sup>(.*?)<\\/sup>/", '^$1', $data);
//print("4|".$data . "\n");
$this->bot->privmsg($channel, "4|" . $data);
$data = preg_replace("/×/", '\\u00d7', $data);
//print("5|".$data . "\n");
$this->bot->privmsg($channel, "5|" . $data);
$data = json_decode($data, 1);
//foreach ($data as &$node) { $node = html_entity_decode($node); }
//print_r($data);
$this->bot->privmsg($channel, "6|" . json_encode($data));
$this->bot->privmsg($channel, $data["lhs"] . " = " . $data["rhs"]);
//$this->bot->privmsg($channel, json_encode(array($data[error], $data[icc], $calc))); //DEBUG
}
示例5: upload
function upload($dir, $insert = true)
{
$dir = $dir ? $dir : date("Ym");
if (!$this->isdir($dir)) {
if ($this->mkdir($dir) == false) {
return array('status' => 'error', 'msg' => '目录创建失败.' . $d->getErrorMsg());
}
}
$dir = trim($dir, '/');
$response = $imgService->uzUpload("/" . $dir . "/" . md5(TIMESTAMP) . '.jpg', NULL);
$json = array();
if ($response->isSuccess()) {
$img = $response->getResult();
$json['img_name'] = $img->name;
$json['img_id'] = $img->id;
$json['dir_id'] = $img->dirId;
$json['img_size'] = $img->size;
$json['img_url'] = stripcslashes($img->url);
$json['dir_name'] = $dir;
$json['dateline'] = TIMESTAMP;
if ($insert) {
// $json['id'] = $this->insert($json);
}
$json['status'] = 'success';
$json['msg'] = '上传成功';
} else {
$json['status'] = 'error';
$json['msg'] = '上传失败.' . $response->getErrorMsg();
}
return $json;
}
示例6: indexAction
public function indexAction()
{
//validate if ajax request
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
//redirect request if not login, this will not work if the ajax is requested
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array("PLEASE LOGIN!")));
}
//declare the store_id and customer_id
$customer_id = Mage::getSingleton('customer/session')->getId();
$store_id = Mage::app()->getStore()->getStoreId();
//popup content
$model = Mage::getModel("singpost_login/profile");
$data = $model->getNotification();
//check if close forever
$notif_logs = $model->getNotificationLogs($customer_id);
//check login count
$login_count = $model->getUserLogCount($customer_id, $store_id);
//insert to array and response as json
$array = array('content' => stripcslashes($data[0]['content']), 'event' => $notif_logs, 'login_count' => $login_count['count']);
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($array));
} else {
//url request send back to the redirect
Mage::app()->getResponse()->setRedirect(Mage::getUrl('customer/account/login'));
}
}
示例7: send_email_exchange
function send_email_exchange($user, $pw, $supporter_KEY, $contact_array)
{
global $db;
$sql = 'select Email,First_Name, Last_Name from supporter where supporter_KEY =' . $supporter_KEY;
$S = $db->Execute($sql) or die($db->errorMsg());
$s = $S->FetchRow();
$contact_array['supporter_KEY'] = $supporter_KEY;
#replace the merge fields
$contact_array['Notes'] = str_replace('[[First_Name]]', $s['First_Name'], $contact_array['Notes']);
$contact_array['Notes'] = str_replace('[[Last_Name]]', $s['Last_Name'], $contact_array['Notes']);
$contact_array['Notes'] = stripcslashes($contact_array['Notes']);
#testing send
#echo '<pre>';
#echo $s['Email'].'<br>';
#echo $contact_array['Codes'].'<br>';
#echo $contact_array['Notes'].'<br>';
#print_r($contact_array);
#echo '</pre>';
#send to exchange
$exchangeclient = new ExchangeClient();
#$exchangeclient->init($user,$pw , NULL, EXCHANGE_SERVER);
#$send = $exchangeclient->send_message($s['Email'], $contact_array['Codes'],$contact_array['Notes'], 'HTML',true, false);
$exchangeclient->init($user, $pw);
$send = $exchangeclient->send_message($s['Email'], $contact_array['Codes'], $contact_array['Notes'], 'HTML', true, false);
$contact = new ContactHistory($contact_array);
$contact->data['supporter_KEY'] = $supporter_KEY;
$contact->save();
#save_contact($supporter_KEY, $contact_array);
echo $x . 'emails sent';
}
示例8: loginUser
static function loginUser($input)
{
$input = trim($input);
$input = stripcslashes($input);
$input = htmlspecialchars($input);
return $input;
}
示例9: actionLogin
/**
* Method for validation Admin
* data from entrance
*
* @var $username
* @var $password
*/
public function actionLogin()
{
include_once $_SERVER['DOCUMENT_ROOT'] . '/Storage.php';
$db = Storage::getInstance();
$mysqli = $db->getConnection();
if (isset($_POST['username'])) {
$username = $_POST['username'];
$username = stripslashes($username);
if ($username !== 'serdiuk.oleksandr@woden.sims') {
header('Location: /admin/login?error=1');
} else {
if (isset($_POST['password'])) {
$password = $_POST['password'];
$password = stripcslashes($password);
}
$sql_query = "SELECT * FROM users WHERE email='{$username}' AND password='{$password}'";
$result = $mysqli->query($sql_query);
session_start();
if ($result->num_rows == 1) {
$_SESSION['admin'] = $username;
header("Location: /admin/");
} else {
header("Location: /admin/login?error=1");
}
session_write_close();
}
}
}
示例10: getArgumentsAsString
protected function getArgumentsAsString(array $arguments)
{
foreach ($arguments as $key => $argument) {
$arguments[$key] = is_string($argument) ? trim($argument, "''") : $this->parseArgumentAsString($argument);
}
return stripcslashes(trim(json_encode($arguments, JSON_UNESCAPED_UNICODE), '[]'));
}
示例11: editInput
public function editInput($table, $field, $attrs, $value)
{
if ($field["type"] == "enum") {
$options = array("" => array());
$selected = $value;
if (isset($_GET["select"])) {
$options[""][-1] = lang('original');
}
if ($field["null"]) {
$options[""][""] = "NULL";
if ($value === null && !isset($_GET["select"])) {
$selected = "";
}
}
$options[""][0] = lang('empty');
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
foreach ($matches[1] as $i => $val) {
$val = stripcslashes(str_replace("''", "'", $val));
$options[$i + 1] = $val;
if ($value === $val) {
$selected = $i + 1;
}
}
return "<select{$attrs}>" . optionlist($options, (string) $selected, 1) . "</select>";
// 1 - use keys
}
}
示例12: readINIfile
function readINIfile($filename, $commentchar)
{
$array1 = file($filename);
$section = '';
foreach ($array1 as $filedata) {
$dataline = trim($filedata);
$firstchar = substr($dataline, 0, 1);
if ($firstchar != $commentchar && $dataline != '') {
//It's an entry (not a comment and not a blank line)
if ($firstchar == '[' && substr($dataline, -1, 1) == ']') {
//It's a section
$section = strtolower(substr($dataline, 1, -1));
} else {
//It's a key...
$delimiter = strpos($dataline, '=');
if ($delimiter > 0) {
//...with a value
$key = trim(substr($dataline, 0, $delimiter));
$value = trim(substr($dataline, $delimiter + 1));
if (substr($value, 0, 1) == '"' && substr($value, -1, 1) == '"') {
$value = substr($value, 1, -1);
}
$array2[$section][$key] = stripcslashes($value);
} else {
//...without a value
$array2[$section][strtolower(trim($dataline))] = '';
}
}
} else {
//It's a comment or blank line. Ignore.
}
}
return $array2;
}
示例13: displayPoll
/**
* Display Poll
* Gives the HTML for the poll to display on the front-end
*
* @param array $args
* @return string
*/
public function displayPoll(array $args)
{
$limit = get_option('sp_limit');
if (isset($args['id'])) {
$pollid = $args['id'];
$poll = $this->grabPoll($pollid);
if (isset($poll['question'])) {
$question = stripcslashes($poll['question']);
$answers = $poll['answers'];
$answersother = $poll['answersother'];
$totalvotes = $poll['totalvotes'];
foreach ($answers as $key => $answer) {
$answers[$key]['answer'] = stripcslashes($answer['answer']);
}
ob_start();
$postFile = plugins_url(SP_SUBMIT, dirname(__FILE__));
$thisPage = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$userCannotTakePoll = false;
if ($limit == 'yes' && isset($_COOKIE['sptaken']) && in_array($args['id'], unserialize($_COOKIE['sptaken'])) || isset($_GET['simply-poll-return'])) {
$userCannotTakePoll = true;
}
include SP_DIR . SP_DISPLAY;
$content = ob_get_clean();
return $content;
}
}
}
示例14: css_get_font_family
public static function css_get_font_family($css_array)
{
if (!empty($css_array['font_family'])) {
$explode_font_family = explode('_', $css_array['font_family']);
$font_id = $explode_font_family[1];
switch ($explode_font_family[0]) {
//fonts from files (links to files)
case 'file':
$css_array['font_family'] = stripcslashes(td_global::$td_options['td_fonts_user_inserted']['font_family_' . $font_id]);
break;
//fonts from type kit
//fonts from type kit
case 'tk':
$css_array['font_family'] = stripcslashes(td_global::$td_options['td_fonts_user_inserted']['type_kit_font_family_' . $font_id]);
break;
//fonts from font stacks
//fonts from font stacks
case 'fs':
$css_array['font_family'] = self::$font_stack_list['fs_' . $font_id];
break;
//fonts from google
//fonts from google
case 'g':
$google_font_name = trim(self::$font_names_google_list[$font_id]);
//search for space in google font names
if (preg_match('/\\s/', $google_font_name)) {
$google_font_name = '"' . $google_font_name . '"';
}
$css_array['font_family'] = $google_font_name;
break;
}
}
return $css_array;
}
示例15: ReadThemePack
public function ReadThemePack($theme, &$recArr = array())
{
$theme_dir = OPENBIZ_THEME_PATH . DIRECTORY_SEPARATOR . $theme;
$theme_metafile = $theme_dir . DIRECTORY_SEPARATOR . "theme.xml";
if (is_file($theme_metafile)) {
$metadata = file_get_contents($theme_metafile);
$xmldata = new SimpleXMLElement($metadata);
foreach ($xmldata as $key => $value) {
if (substr($key, 0, 1) != "@") {
$str = (string) $value;
$str = str_replace('\\n', "\n", $str);
$str = stripcslashes($str);
$recArr[$key] = $str;
}
}
}
if (is_file(OPENBIZ_THEME_PATH . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR . $recArr['icon'])) {
$recArr['icon_url'] = OPENBIZ_THEME_URL . "/{$theme}/images/" . $recArr['icon'];
} else {
$recArr['icon_url'] = OPENBIZ_THEME_URL . "/{$theme}/images/spacer.gif";
}
if (is_file(OPENBIZ_THEME_PATH . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR . $recArr['preview'])) {
$recArr['preview_url'] = OPENBIZ_THEME_URL . "/{$theme}/images/" . $recArr['preview'];
return $recArr;
} else {
$recArr['preview_url'] = OPENBIZ_THEME_URL . "/{$theme}/images/spacer.gif";
}
}