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;
 }
/**
 * 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 <*****@*****.**>
 * @author Andreas Gohr <*****@*****.**>
 */
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;
}
Example #3
0
/**
 * 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;
}
Example #4
0
/**
 * Callback used by html_hilight()
 *
 * @author Harry Fuecks <*****@*****.**>
 */
function html_hilight_callback($m)
{
    $hlight = unslash($m[0]);
    if (!isset($m[2])) {
        $hlight = '<span class="search_hit">' . $hlight . '</span>';
    }
    return $hlight;
}
 function U($str)
 {
     return ucwords(unslash($str));
 }
 function testUnslash()
 {
     $this->equals(unslash('foobar/'), 'foobar');
     $this->equals(unslash('/foobar/'), '/foobar');
     $this->equals(unslash('/foobar'), '/foobar');
     $this->equals(unslash('/foobar///'), '/foobar');
 }
 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;
 }
      <?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');
}
 function testUnslash()
 {
     $this->assertEquals('foobar', unslash('foobar/'));
     $this->assertEquals('/foobar', unslash('/foobar/'));
     $this->assertEquals('/foobar', unslash('/foobar'));
     $this->assertEquals('/foobar', unslash('/foobar///'));
 }