本文整理汇总了PHP中unslash函数的典型用法代码示例。如果您正苦于以下问题:PHP unslash函数的具体用法?PHP unslash怎么用?PHP unslash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unslash函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: herchi_1
public static function herchi_1($arr, $wanted = null, $soft_search = false)
{
$lists_obj = new lists();
$array = $lists_obj->{$arr};
// dd($array);
foreach ($array as $lev1) {
$key_en_name = $lev1[0][0];
$key_ar_name = $lev1[0][1];
$models_array_en = $models_array_ar = array();
foreach ($lev1[1] as $model) {
$models_array_en[slash($model[0])] = $model[0];
$models_array_ar[slash($model[0])] = $model[1];
}
$res_array[slash($key_en_name)] = ['list_name' => $arr, 'wanted' => $wanted, 'code_name' => slash($key_en_name), 'name_en' => strtolower($key_en_name), 'name_ar' => $key_ar_name, 'models_en' => $models_array_en, 'models_ar' => $models_array_ar];
}
// err($res_array);
if ($wanted != null) {
if (isset($res_array[unslash($wanted)])) {
return $res_array[unslash($wanted)];
}
if ($soft_search) {
return false;
}
die("error in herci_1 : " . $arr);
}
return $res_array;
}
示例2: spaceslink
/**
* replaces a link with blanks of same length
* The first string is the complete link and
* and the second optional string might be the
* alternative text that would become part of
* the result string and will be checked for
* spelling errors again.
*
* callback for preg_replace_callback
*
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
* @author Andreas Gohr <andi@splitbrain.org>
*/
function spaceslink($matches)
{
$string = unslash($matches[1]);
$check = unslash($matches[2]);
$result = ' ';
//opening [[
$result .= str_pad('', utf8_strlen($string), ' ');
$result .= $check;
$result .= ' ';
//closing ]]
return $result;
}
示例3: css_datauri
/**
* Convert local image URLs to data URLs if the filesize is small
*
* Callback for preg_replace_callback
*
* @param array $match
* @return string
*/
function css_datauri($match)
{
global $conf;
$pre = unslash($match[1]);
$base = unslash($match[2]);
$url = unslash($match[3]);
$ext = unslash($match[4]);
$local = DOKU_INC . $url;
$size = @filesize($local);
if ($size && $size < $conf['cssdatauri']) {
$data = base64_encode(file_get_contents($local));
}
if ($data) {
$url = 'data:image/' . $ext . ';base64,' . $data;
} else {
$url = $base . $url;
}
return $pre . $url;
}
示例4: html_hilight_callback
/**
* Callback used by html_hilight()
*
* @author Harry Fuecks <hfuecks@gmail.com>
*/
function html_hilight_callback($m)
{
$hlight = unslash($m[0]);
if (!isset($m[2])) {
$hlight = '<span class="search_hit">' . $hlight . '</span>';
}
return $hlight;
}
示例5: U
function U($str)
{
return ucwords(unslash($str));
}
示例6: testUnslash
function testUnslash()
{
$this->equals(unslash('foobar/'), 'foobar');
$this->equals(unslash('/foobar/'), '/foobar');
$this->equals(unslash('/foobar'), '/foobar');
$this->equals(unslash('/foobar///'), '/foobar');
}
示例7: arr_to_str
function arr_to_str($array, $delemeter = "/", $func = null)
{
if (!is_array($array)) {
die('<h1>arr_to_str() says: it isn\'s an array...</h1>');
}
// $str = implode($delemeter,$array);
$new = [];
foreach ($array as $key => $val) {
if ($func == 'slash') {
$new[$key] = slash($val);
} elseif ($func == 'unslash') {
$new[$key] = u(unslash($val));
} else {
$new[$key] = $val;
}
}
$str = implode($delemeter, $new);
return $str;
}
示例8: wp_nav_menu
<?php
wp_nav_menu(array('theme_location' => 'mobile', 'container' => false));
?>
</div>
<div id="page">
<?php
//Post Variables
$shade = climb_get_field('logo_shade', 'option');
function unslash($s)
{
$pattern = '/\\/$/';
// remove any ending slash
return preg_replace($pattern, '', $s);
}
$isDepartment = !(unslash(home_url()) == unslash(network_site_url()));
if (is_front_page()) {
$headerImageArr = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
$headerImage = $headerImageArr[0];
} else {
$headerImage = climb_get_field('header_background_image', 'option');
}
?>
<!-- HEADER -->
<?php
$main_header_styles = array();
if (is_front_page()) {
$main_header_styles[] = "home";
$featuredItems = get_field('featured_items');
}
示例9: testUnslash
function testUnslash()
{
$this->assertEquals('foobar', unslash('foobar/'));
$this->assertEquals('/foobar', unslash('/foobar/'));
$this->assertEquals('/foobar', unslash('/foobar'));
$this->assertEquals('/foobar', unslash('/foobar///'));
}