• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP normalize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中normalize函数的典型用法代码示例。如果您正苦于以下问题:PHP normalize函数的具体用法?PHP normalize怎么用?PHP normalize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了normalize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: youtubeSearch

function youtubeSearch($title)
{
    $trailers = array();
    $title = normalize($title);
    $trailerquery = $title . " trailer";
    $youtubeurl = "http://gdata.youtube.com/feeds/api/videos?client=" . YOUTUBE_CLIENT_ID . "&key=" . YOUTUBE_DEVELOPER_KEY . "&v=2&" . "q=" . urlencode($trailerquery) . "&start-index=1&max-results=10";
    $resp = httpClient($youtubeurl, true);
    if (!$resp['success']) {
        return $trailers;
    }
    $xml = simplexml_load_string($resp['data']);
    // obtain namespaces
    $namespaces = $xml->getNameSpaces(true);
    foreach ($xml->entry as $trailer) {
        $media = $trailer->children($namespaces['media']);
        $yt = $media->group->children($namespaces['yt']);
        $id = $yt->videoid;
        // API filtering code removed
        $trailers[] = array('id' => (string) $id, 'src' => (string) $trailer->content['src'], 'title' => (string) $trailer->title);
        if (count($trailers) >= 10) {
            break;
        }
    }
    return $trailers;
}
开发者ID:Boris-de,项目名称:videodb,代码行数:25,代码来源:youtube.php


示例2: slug

function slug($str, $separator = '-')
{
    $str = normalize($str);
    // replace non letter or digits by separator
    $str = preg_replace('#^[^A-z0-9]+$#', $separator, $str);
    return trim(strtolower($str), $separator);
}
开发者ID:gautamkrishnar,项目名称:Anchor-CMS-openshift-quickstart,代码行数:7,代码来源:helpers.php


示例3: render_child

    /**
     * Overrides the method to render the child in a `<DIV.field>` wrapper:
     *
     * ```html
     * <div class="field [{normalized_field_name}][required]">
     *     [<label for="{element_id}" class="input-label [required]">{element_form_label}</label>]
     *     <div class="input">{child}</div>
     * </div>
     * ```
     *
     * @inheritdoc
     */
    protected function render_child($child)
    {
        $control_group_class = 'control-group';
        $name = $child['name'];
        if ($name) {
            $control_group_class .= ' control-group--' . normalize($name);
        }
        if ($child[self::REQUIRED]) {
            $control_group_class .= ' required';
        }
        $state = $child[Element::STATE];
        if ($state) {
            $control_group_class .= ' ' . $state;
        }
        $label = $child[Form::LABEL];
        if ($label) {
            if (!$label instanceof Element) {
                $label = $this->t($label, [], ['scope' => 'group.label', 'default' => $this->t($label, [], ['scope' => 'element.label'])]);
            }
            $label = '<label for="' . $child->id . '" class="controls-label">' . $label . '</label>' . PHP_EOL;
        }
        return <<<EOT
<div class="{$control_group_class}">
\t{$label}<div class="controls">{$child}</div>
</div>
EOT;
    }
开发者ID:brickrouge,项目名称:brickrouge,代码行数:39,代码来源:Group.php


示例4: slug

function slug($str, $separator = '-')
{
    $str = normalize($str);
    // replace non letter or digits by separator
    $str = preg_replace('/[^a-zA-Z0-9]+/', $separator, html_entity_decode($str, ENT_QUOTES));
    return trim(strtolower($str), $separator);
}
开发者ID:Rictus,项目名称:CMS_Prod,代码行数:7,代码来源:helpers.php


示例5: plug_chat

function plug_chat($p, $msg, $res = '')
{
    //$_SESSION['muse']='';
    $p = $p ? normalize($p) : 'public';
    ses('muse', $res ? ajxg($res) : ses('USE'));
    return chatform($p, $msg) . divd('cht' . $p, chatread($p));
}
开发者ID:philum,项目名称:cms,代码行数:7,代码来源:chat.php


示例6: env

/**
 * @param string $key
 * @param mixed $default
 * @return mixed
 */
function env($key, $default = null)
{
    $value = getenv($key);
    if ($value === false) {
        return value($default);
    }
    return normalize($value);
}
开发者ID:pldin601,项目名称:SlungFramework,代码行数:13,代码来源:helpers.php


示例7: rednm

function rednm($d)
{
    if (strrpos($d, "/") !== false) {
        $d = substr($d, strrpos($d, "/") + 1);
    }
    //if(strrpos($d,".")!==false)$d=substr($d,0,strpos($d,"."));
    return normalize($d);
}
开发者ID:philum,项目名称:cms,代码行数:8,代码来源:download.php


示例8: cameraTransform

function cameraTransform($C, $A)
{
    $w = normalize(addVector($C, scalarProduct($A, -1)));
    $y = array(0, 1, 0);
    $u = normalize(crossProduct($y, $w));
    $v = crossProduct($w, $u);
    $t = scalarProduct($C, -1);
    return array($u[0], $v[0], $w[0], 0, $u[1], $v[1], $w[1], 0, $u[2], $v[2], $w[2], 0, dotProduct($u, $t), dotProduct($v, $t), dotProduct($w, $t), 1);
}
开发者ID:painsOnline,项目名称:3dcaptcha,代码行数:9,代码来源:3DCaptcha.php


示例9: testNormalizeCase

 /**
  * 
  */
 public function testNormalizeCase()
 {
     $test1 = 'slug-case-to-normal-case';
     $test2 = 'snake_case_to_normal_case';
     $test3 = 'camelCaseToNormalCase';
     $test4 = 'CamelCaseToNormalCase';
     $this->assertEquals(normalize($test1), 'Slug case to normal case');
     $this->assertEquals(normalize($test2), 'Snake case to normal case');
     $this->assertEquals(normalize($test3), 'Camel case to normal case');
     $this->assertEquals(normalize($test4), 'Camel case to normal case');
 }
开发者ID:aurelienlhx,项目名称:PhpComponents,代码行数:14,代码来源:CaseHelpersTest.php


示例10: mform_mr

function mform_mr($d)
{
    $r = explode(",", $d);
    $n = count($r);
    for ($i = 0; $i < $n; $i++) {
        list($v, $type) = explode("=", $r[$i]);
        $vb = normalize($v);
        if ($type != 'button') {
            $rb[] = $vb;
        }
    }
    //$rb[]='day';
    return $rb;
}
开发者ID:philum,项目名称:cms,代码行数:14,代码来源:microform.php


示例11: testword

function testword()
{
    require "../includes/connect.php";
    require "../includes/string.php";
    //$name = str_replace($unwantedChars, "", $row['movieId']);
    //$hashtag = "#".$name;
    //rpp = tweetcount (max=  100)
    $tweetUrl = "http://tweets2csv.com/results.php?q=%23starwars&rpp=40&submit=Search";
    echo $tweetUrl . "<br>";
    $htmltext = file_get_contents($tweetUrl);
    $regex = "#<div class='user'>(.*)(\\s*)<div class='text'>(.*)<div class='description'>#";
    preg_match_all($regex, $htmltext, $matches, PREG_SET_ORDER);
    $wordArray = array();
    $unwantedChars = array('/', "\\", 'http', "@", "-", "<a");
    foreach ($matches as $tweet) {
        //'text'=>$tweet[3],
        //$newData = array("text"=>htmlentities($tweet[3]));
        //array_push($data["data"], $newData);
        //echo $tweet[3]."<br>";
        $words = explode(" ", $tweet[3]);
        foreach ($words as $word) {
            if (!contains($word, $unwantedChars) && !in_array(normalize($word), $stopwords)) {
                if (!isset($wordArray[$word])) {
                    $wordArray[$word] = 1;
                } else {
                    $wordArray[$word]++;
                }
            }
        }
    }
    $newFileName = '../words/starwars.txt';
    if (file_put_contents($newFileName, json_encode($wordArray)) != false) {
        echo "added";
    } else {
        echo "Cannot create file (" . basename($newFileName) . ")";
    }
    echo "<br>";
    //format (just split by / and :)
    /*$newFileName = '../sentiment/'.$name.".txt";
    			$appendContent = $sent['positive'].";".$sent['negative'].";".$sent['neutral'].";".$sent['tweetCount'].";".$updateDate."/";
    
    
    			//If filename does not exist, the file is created. Otherwise, the existing file is overwritten, unless the FILE_APPEND flag is set.
    			if(file_put_contents($newFileName,$appendContent,  FILE_APPEND) !=false){
    			    echo "File created (".basename($newFileName).")";
    			}else{
    			    echo "Cannot create file (".basename($newFileName).")";
    			}*/
}
开发者ID:113256,项目名称:finalYear,代码行数:49,代码来源:wordTest.php


示例12: prepare_link

function prepare_link($title, $slug)
{
    //if not allowed characters
    $link = normalize($title);
    //multiples whitespaces -> single whitespace
    $link = preg_replace("/[^a-zA-Z0-9-\\s]+/i", "", $link);
    $link = trim($link);
    $link = strtolower($link);
    //multiples whitespaces -> single minus sign
    $link = preg_replace("/\\s\\s+/i", " ", $link);
    $link = preg_replace("/--+/i", "-", $link);
    $link = preg_replace("/\\s/i", "-", $link);
    $link = '/' . $slug . '/' . $link;
    return $link;
}
开发者ID:alexbodea,项目名称:globalnews,代码行数:15,代码来源:functions.php


示例13: downloadPoster

function downloadPoster($movieId, $posterUrl)
{
    //require("includes/connect.php");
    set_time_limit(3600);
    $filename = normalize($movieId);
    $file = '../poster/' . $filename . '.jpg';
    if (!empty($posterUrl)) {
        echo $file . "made <br>";
        if (!file_exists($file)) {
            copy($posterUrl, $file);
        } else {
            echo "already exists";
        }
    } else {
        echo "EMPTY <br>";
    }
}
开发者ID:113256,项目名称:finalYear,代码行数:17,代码来源:string.php


示例14: addf_inject

function addf_inject()
{
    calltar();
    $ra = msql_read('server', 'edition_typos', '');
    if ($ra) {
        $vra = array_keys_r($ra, 0, 'k');
    }
    $r = msql_read('', 'public_addfonts', '');
    if ($r) {
        $vr = array_shift($r);
    }
    $dir = 'fonts/';
    $diru = 'users/' . $_SESSION['qb'] . '/fonts/';
    if (!is_dir($diru)) {
        mkdir($diru);
    }
    if ($r) {
        foreach ($r as $k => $v) {
            $font = normalize($v[0]);
            if (!$vra[$font]) {
                $rb = array($font, '', '', '', '');
                for ($i = 1; $i < count($v); $i++) {
                    $f = $font . '.' . $vr[$i];
                    $rc[] = $dir . $f;
                    $ret .= addf_copy($v[$i], $dir . $f) . br();
                }
                //u
                //msql_modif('server','edition_typos',$rb,$dfb,'push','');
                //modif_vars('','public_addfonts',$k,'del');
                if ($rc) {
                    PclTarCreate($diru . $font . '.tar.gz', $rc, '', '', '');
                }
                $ret .= btn('txtblc', lka($diru . $font . '.tar.gz')) . ' ' . btn('txtx', 'saved') . br();
            } else {
                $ret .= $font . ' already_exists' . br();
            }
        }
    }
    //if($rb)msql_modif('server','edition_typos',$rb,$dfb,'add','');
    $ret .= lkc('txtbox', '/?admin=fonts&inject==', 'inject datas (admin/fonts)') . br();
    return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:42,代码来源:addfonts.php


示例15: vernam_enkripsi

function vernam_enkripsi($plain, $key)
{
    $n = strlen($plain);
    for ($i = 0; $i < $n; $i++) {
        $data[$i] = str_pad(decbin(ord($plain[$i])), 8, "0", STR_PAD_LEFT);
        $kunci[$i] = str_pad(decbin(ord($key[$i])), 8, "0", STR_PAD_LEFT);
        //echo 'biner data ='.str_pad(decbin(ord($plain[$i])), 8, "0", STR_PAD_LEFT).', biner kunci = '.str_pad(decbin(ord($key[$i])), 8, "0", STR_PAD_LEFT).' ';
        //opeasi xor
        for ($j = 0; $j < 8; $j++) {
            $hasil[$j] = ($data[$i][$j] + $kunci[$i][$j]) % 2;
        }
        $result[$i] = implode($hasil);
        //echo 'biner hasil = '.$result[$i];
        $chiper[$i] = chr(normalize(bindec($result[$i])));
        //echo ', biner chiper = '.$chiper[$i];
        //echo ' '.ord($plain[$i]).', key ='.ord($key[$i]).', hasil = '.bindec($result[$i]).', normalisasi ='.normalize(bindec($result[$i])).'<br/>';
    }
    $chiperKey = implode($chiper);
    return $chiperKey;
}
开发者ID:firhan200,项目名称:vernam,代码行数:20,代码来源:good.php


示例16: do_new

function do_new($formatter, $options)
{
    global $DBInfo;
    if (!$options['value']) {
        $title = _("Create a new page");
        $formatter->send_header("", $options);
        $formatter->send_title($title, "", $options);
        $url = $formatter->link_url($formatter->page->urlname);
        if ($DBInfo->hasPage('MyNewPage')) {
            $p = $DBInfo->getPage('MyNewPage');
            $f = new Formatter($p, $options);
            $f->use_rating = 0;
            $f->send_page('', $options);
        }
        $msg = _("Page Name");
        $fixname = _("Normalize this page name");
        $btn = _("Create a new page");
        print <<<FORM
<div class='addPage'>
<form method='get' action='{$url}'>
<table style='border:0'><tr><th class='addLabel'><labe>{$msg}: </label></th><td><input type='hidden' name='action' value='new' />
    <input name='value' size='30' /></td></tr>
<tr><th class='addLabel'><input type='checkbox' name='fixname' checked='checked' /></th><td>{$fixname}</td></tr>
<td></td><td><input type='submit' value='{$btn}' /></td>
</tr></table>
    </form>
</div>
FORM;
        $formatter->send_footer();
    } else {
        $pgname = $options['value'];
        if ($options['fixname']) {
            $pgname = normalize($pgname);
        }
        $options['page'] = $pgname;
        $page = new WikiPage($pgname);
        $f = new Formatter($page, $options);
        do_edit($f, $options);
        return true;
    }
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:41,代码来源:new.php


示例17: addToIndex

 static function addToIndex($id)
 {
     $indexThese = array('title', 'creator', 'subject', 'publisher', 'contributor', 'identifier', 's:subtitle', 's:isbn', 's:tag');
     $prefix = Config::db('prefix', '');
     $title = Input::get('title');
     $input = Input::get('extend.metadata_wtf');
     $metadata = self::parse_wtf($input);
     if (empty($metadata['.']['title'])) {
         $metadata['.']['title'][] = $title;
     }
     $query = Query::table($prefix . 'wtfsearch')->where('post_id', '=', $id);
     $query->delete();
     foreach ($metadata['.'] as $k => $vals) {
         if (in_array($k, $indexThese)) {
             foreach ($vals as $val) {
                 $query->insert(array('post_id' => $id, 'meta_key' => $k, 'meta_value' => normalize($val)));
             }
         }
     }
     //var_dump($prefix, $metadata, $id);
     //die;
 }
开发者ID:svita-cz,项目名称:web,代码行数:22,代码来源:wtfsearch.php


示例18: putOutput

function putOutput($reply)
{
    global $plain_text_log;
    global $query_id;
    global $time_start;
    $time_output = microtime(true);
    $time = $time_output - $time_start;
    $reply = normalize(clean(trim(clean(html_entity_decode($reply)))));
    $numbs = $_GET["mobile"];
    $myid = "AUU";
    //Log
    $response_length = strlen($reply);
    $plain_text_log .= "{$reply}\n----------------\n";
    file_put_contents(dirname(__FILE__) . "/log/plainlog.txt", $plain_text_log, FILE_APPEND);
    $to_log = array("Qid" => $query_id, "T" => $time, "L" => $response_length, "R" => mysql_real_escape_string($reply));
    $log = serialize($to_log);
    //$to_log = "$query_id\t$time\t$response_length\n$reply\n\n";
    file_put_contents(LOG_DIR . "/response.log", $log . "\n", FILE_APPEND);
    if ($numbs != "test" && $numbs != "ashwin" && $numbs != "abhinav" && $numbs != "suhail" && $numbs != "vineeth" && $numbs != "shyam" && $numbs != "web") {
        //$text=urldecode($_GET['content']);
        //$to=urldecode($_GET['number']);
        //$sender=urldecode($_GET['sender']);
        $url = 'http://IP/mt/send.php?sender=9822818163&number=' . $numbs . '&content=' . urlencode($reply);
        $content = file_get_contents($url);
        //echo $content;
    } else {
        echo $reply;
        echo "<br><br>" . dirname(__FILE__);
    }
    //	$reply;
    /* @header("Content-Type: text/html; charset=ISO-8859-1;");
       ?><br />
       <font face="Courier New, Courier, monospace">
       <?php //echo str_replace("\n","<br>",$reply); ?>
       </font>
       <?php
       //echo "<br>----------------------------<br>".strlen($reply); */
    //exit();
}
开发者ID:superego546,项目名称:SMSGyan,代码行数:39,代码来源:main_functions.php


示例19: downloadAllPosters

function downloadAllPosters()
{
    require "../includes/connect.php";
    set_time_limit(3600);
    $selectQuery = "SELECT * FROM movieinfo";
    $selectResult = mysqli_query($conn, $selectQuery) or die(mysqli_error($conn));
    while ($row = mysqli_fetch_array($selectResult)) {
        $id = $row['movieId'];
        $filename = normalize($id);
        $file = '../poster/' . $filename . '.jpg';
        //echo $filename."<br>";
        $posterUrl = $row['poster'];
        if (!empty($posterUrl)) {
            echo $file . "made <br>";
            if (!file_exists($file)) {
                copy($posterUrl, $file);
            } else {
                echo "already exists";
            }
        } else {
            echo "EMPTY <br>";
        }
    }
}
开发者ID:113256,项目名称:finalYear,代码行数:24,代码来源:posterTest.php


示例20: basename

if (isset($_REQUEST['media_id'])) {
    $media_id = basename($_REQUEST['media_id']);
}
if ($media_id != '*') {
    $media_id = strtolower(basename($media_id));
    $media_id = normalize($media_id);
    $_REQUEST['media_id'] = $media_id;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
$part_id = '';
if (isset($_REQUEST['part_id'])) {
    $part_id = basename($_REQUEST['part_id']);
}
if ($part_id != '*') {
    $part_id = strtolower(basename($part_id));
    $part_id = normalize($part_id);
    $_REQUEST['part_id'] = $part_id;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
$resultText = '';
$fCount = 0;
$updateDone = FALSE;
$doPreview = FALSE;
$loc4msg = '';
if (isset($_REQUEST['posx'])) {
    $loc4msg = $_REQUEST['posx'];
}
$resultMsg = '';
if (isset($_REQUEST['msg'])) {
    $resultMsg = stripslashes(urldecode($_REQUEST['msg']));
}
开发者ID:noveopiu,项目名称:dCTL,代码行数:31,代码来源:config.inc.php



注:本文中的normalize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP normalize_component函数代码示例发布时间:2022-05-15
下一篇:
PHP normalise_link函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap