当前位置: 首页>>代码示例>>PHP>>正文


PHP r函数代码示例

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


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

示例1: import

 /**
  * undocumented function
  *
  * @param string $file 
  * @return void
  * @access public
  */
 function import($file)
 {
     $source = file_get_contents($file);
     $xml = new Xml($source);
     $result = $xml->toArray();
     $result = $result['Xmlarchive']['Fileset']['File'];
     if (empty($result)) {
         return false;
     }
     $count = 0;
     foreach ($result as $smiley) {
         $name = $smiley['filename'];
         $content = $smiley['content'];
         $content = preg_replace('/\\s/', '', $content);
         $content = base64_decode($content);
         $filePath = SMILEY_PATH . $name;
         if (file_exists($filePath)) {
             continue;
         }
         $this->create(array('code' => ':' . r('.gif', '', $name) . ':', 'filename' => $name));
         $this->save();
         $f = fopen($filePath, 'w+');
         fwrite($f, $content);
         fclose($f);
         $count++;
     }
     return $count;
 }
开发者ID:stripthis,项目名称:donate,代码行数:35,代码来源:smiley.php

示例2: r

 function r($url)
 {
     if (!Configure::read('App.baseUrl')) {
         return $url;
     }
     return r('/index.php', '', $url);
 }
开发者ID:masayukiando,项目名称:googlemap-search_ActionScript3.0,代码行数:7,代码来源:base_url.php

示例3: env

 static function env($key)
 {
     if (isset($_SERVER[$key])) {
         return $_SERVER[$key];
     } else {
         if (isset($_ENV[$key])) {
             return $_ENV[$key];
         } else {
             if (getenv($key) !== false) {
                 return getenv($key);
             }
         }
     }
     if ($key == 'DOCUMENT_ROOT') {
         $offset = 0;
         if (!strpos(NServer::env('SCRIPT_NAME'), '.php')) {
             $offset = 4;
         }
         return substr(NServer::env('SCRIPT_FILENAME'), 0, strlen(NServer::env('SCRIPT_FILENAME')) - (strlen(NServer::env('SCRIPT_NAME')) + $offset));
     }
     if ($key == 'PHP_SELF') {
         return r(NServer::env('DOCUMENT_ROOT'), '', NServer::env('SCRIPT_FILENAME'));
     }
     return null;
 }
开发者ID:nonfiction,项目名称:nterchange,代码行数:25,代码来源:n_server.php

示例4: testUserRegex

 public function testUserRegex()
 {
     $r = new RouterTestWrapper();
     $r->get(r('|/|'), function () {
     });
     $this->assertEquals('|/|', $r->routes['GET'][0]->regex());
 }
开发者ID:brysonian,项目名称:Vicious,代码行数:7,代码来源:RouterTest.php

示例5: replace

 /**
  * Renmove HTML inutil ou com problemas
  *
  * @return String formatada com HTML removido
  */
 function replace($strContent = null)
 {
     $strSiteUrl = 'http://' . $this->siteurl;
     $arrProcura = array("<FONT COLOR=\"000000\">", '</FONT>', '<font FACE=Tahoma color=\'#CC0000\' size=2>', '</font>', '<FONT COLOR="5F9F9F">Entregue', '<td> Entregue </td>', '<FONT COLOR="007FFF">Saiu para entrega', '<td> Aguardando retirada </td>', 'Conferido', '<td> Encaminhado </td>', 'Postado', '<td> Destinatário ausente </td>', 'FISCALIZACAO/CUSTOMS', 'FISCALIZAÇÃO/CUSTOMS', 'Liberado pela alfândega', 'CTCI SAO PAULO (GEARA)', 'CTCI SAO PAULO (GEEXP)', 'OBJ RETIDO - VER AUTENTICIDADE MARCA', 'Recebido/Brasil', 'TRIBUTADO', 'Por favor, entre em contato conosco clicando <a href="http://www.correios.com.br/servicos/falecomoscorreios/default.cfm">aqui</a>.');
     $arrTroca = array(' ', ' ', ' ', ' ', '<span class="entregue">Entregue</span>', '<td><span class="entregue">Entregue</span></td>', '<span class="saiu">Saiu para entrega</span>', '<td><span class="saiu">Saiu para entrega</span></td>', '<span class="conferido">Conferido</span>', '<td><span class="encaminhado">Encaminhado</span></td>', '<span class="postado">Postado</span>', '<td><span class="ausente">Destinatário ausente</span></td>', '<a href="' . $strSiteUrl . '/fiscalizacao-ou-customs" class="informacao">FISCALIZACAO/CUSTOMS</a>', '<a href="' . $strSiteUrl . '/fiscalizacao-ou-customs" class="informacao">FISCALIZACAO/CUSTOMS</a>', '<a href="' . $strSiteUrl . '/liberado-pela-alfandega" class="informacao">Liberado pela alfândega</a>', '<a href="' . $strSiteUrl . '/o-que-e-ctci" class="informacao">CTCI SAO PAULO (GEARA)</a>', '<span class="informacao">CTCI SAO PAULO (GEEXP)</span>', '<a href="' . $strSiteUrl . '/objeto-retido" class="informacao">OBJ RETIDO - VER AUTENTICIDADE MARCA</a>', '<a href="' . $strSiteUrl . '/recebido-no-brasil" class="informacao">Recebido/Brasil</a>', '<a href="' . $strSiteUrl . '/tributado" class="informacao">TRIBUTADO</a>', '<span class="problema"><a href="http://www.correios.com.br/servicos/falecomoscorreios/default.cfm">Por favor, entre em contato conosco clicando aqui</a>.</span>');
     return r($arrProcura, $arrTroca, preg_replace('/\\s{2,}/', '', $strContent));
 }
开发者ID:John-Henrique,项目名称:RF,代码行数:12,代码来源:rastreamento.php

示例6: get_ip

 /**
  *
  */
 public static function get_ip($i_asLong = false)
 {
     static $env_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR');
     static $ip = null;
     $skip_ips = r(self::PROXY_IPS);
     if ($ip) {
         return $i_asLong ? ip2long($ip) : $ip;
     }
     foreach ($env_keys as $key) {
         if (!($val = @$_SERVER[$key])) {
             continue;
         }
         if (strcasecmp($val, 'unknown') == 0) {
             continue;
         }
         list($first) = explode(',', $val);
         $first = trim($first);
         if (preg_match('/^(\\d{1,3}\\.){3,3}\\d{1,3}$/', $first)) {
             if (in_array($first, $skip_ips)) {
                 continue;
             }
             $ip = $first;
             return $i_asLong ? ip2long($ip) : $ip;
         }
     }
     return null;
 }
开发者ID:rommelsantor,项目名称:RawMVC,代码行数:30,代码来源:request.php

示例7: read

 function read($dir = null, $recursive = false)
 {
     $notes = array();
     $path = CORE_PATH . APP_PATH . $dir;
     $folder = new Folder(APP_PATH . $dir);
     $fold = $recursive ? $folder->findRecursive('.*\\.php') : $folder->find('.*\\.php');
     foreach ($fold as $file) {
         $file = $recursive ? $file : $path . $file;
         $file_path = r(CORE_PATH . APP_PATH, '', $file);
         $handle = new File($file_path);
         $content = $handle->read();
         $lines = explode(PHP_EOL, $content);
         //$lines = file($file);
         $ln = 1;
         if (!empty($lines)) {
             foreach ($lines as $line) {
                 if ((is_null($this->type) || $this->type == 'TODO') && preg_match("/[#\\*\\/\\/]\\s*TODO\\s*(.*)/", $line, $match)) {
                     $this->notes[$file_path]['TODO'][$ln] = $match[1];
                 }
                 if ((is_null($this->type) || $this->type == 'OPTIMIZE') && preg_match("/[#\\*\\/\\/]\\s*OPTIMIZE|OPTIMISE\\s*(.*)/", $line, $match)) {
                     $this->notes[$file_path]['OPTIMIZE'][$ln] = $match[1];
                 }
                 if ((is_null($this->type) || $this->type == 'FIXME') && preg_match("/[#\\*\\/\\/]\\s*FIXME|BUG\\s*(.*)/", $line, $match)) {
                     $this->notes[$file_path]['FIXME'][$ln] = $match[1];
                 }
                 $ln++;
             }
         }
     }
     return $this->notes;
 }
开发者ID:robksawyer,项目名称:tools,代码行数:31,代码来源:notes.php

示例8: array_to_xml

 private function array_to_xml($array, $container = 'response', $is_root = true)
 {
     if (!is_array($array)) {
         return array_to_xml(array($array));
     }
     $xml = '';
     if ($is_root) {
         $xml .= '<?xml version="1.0" encoding="utf-8"?>';
         $xml .= "<{$container}>";
     }
     foreach ($array as $key => $value) {
         // make sure key is a string
         $elem = $key;
         if (!is_string($key) && !empty($container)) {
             $elem = $container;
         }
         $xml .= "<{$elem}>";
         if (is_array($value)) {
             if (array_keys($value) !== array_keys(array_keys($value))) {
                 $xml .= array_to_xml($value, '', false);
             } else {
                 $xml .= array_to_xml($value, r('/s$/', '', $elem), false);
             }
         } else {
             $xml .= htmlspecialchars($value, ENT_COMPAT, 'ISO-8859-1') != $value ? "<![CDATA[{$value}]]>" : $value;
         }
         $xml .= "</{$elem}>";
     }
     if ($is_root) {
         $xml .= "</{$container}>";
     }
     return preg_replace('/[\\x00-\\x1F\\x7F]/', '', $xml);
 }
开发者ID:ranzhe,项目名称:tinytinyrss-fever-plugin,代码行数:33,代码来源:fever_api.php

示例9: gist

 /**
  * Embeds a github gist
  *
  * @param string $url Gist url: i.e. https://gist.github.com/2924148
  * @param string $file The name of a particular file from the gist, which should displayed only.
  * @return string
  */
 public static function gist($url, $file = null)
 {
     // url for the script file
     $url = $url . '.js' . r(!is_null($file), '?file=' . $file);
     // load the gist
     return html::tag('script', '', array('src' => $url));
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:14,代码来源:embed.php

示例10: css

 function css($key)
 {
     //return;
     $out = '';
     $file = glob(CSS . $key . '_*.css');
     $out .= $this->Html->Css(r('.css', '', basename($file[count($file) - 1])));
     return $out;
 }
开发者ID:anito,项目名称:app.datastore,代码行数:8,代码来源:asset.php

示例11: cleanTags

 function cleanTags($value)
 {
     $value = rtrim(preg_replace('/,+/', ',', r(' ', ',', trim($value))), ',') . ',';
     if ($value == ',') {
         $value = '';
     }
     return $value;
 }
开发者ID:phototech,项目名称:sailvenice,代码行数:8,代码来源:app_model.php

示例12: loginBeforeContinue

 public function loginBeforeContinue()
 {
     if (!s()->user->id) {
         Core_Application::getInstance()->breakDispacher();
         $this->getView()->disableLayout();
         r('/');
     }
 }
开发者ID:bozhich,项目名称:PHP-on-Rails,代码行数:8,代码来源:Controller.php

示例13: oauth

 public function oauth()
 {
     if (isset($this->params['url']['code'])) {
         $code = $this->params['url']['code'];
     }
     SlSession::write('Api.facebook.accessToken', r('access_token=', '', $this->Facebook->graph("oauth/access_token", array('client_id' => SlConfigure::read('Api.facebook.appId'), 'redirect_uri' => Sl::url(true), 'client_secret' => SlConfigure::read('Api.facebook.secret'), 'code' => $code, 'decode' => false))));
     $this->redirect(SlConfigure::read('Api.facebook.oauthSuccess'));
 }
开发者ID:sandulungu,项目名称:StarLight,代码行数:8,代码来源:facebook_controller.php

示例14: r

/**
 * Created by PhpStorm.
 * User: raynald
 * Date: 2/5/15
 * Time: 9:44 PM
 */
function r($a)
{
    if ($a < 2) {
        echo "{$a}<br>";
        r($a + 1);
    }
    echo "{$a}" . ' hello<br>';
}
开发者ID:raynaldmo,项目名称:php-education,代码行数:14,代码来源:ex1.php

示例15: fatal

 /**
  * Kill Now
  */
 public function fatal($msg)
 {
     if ($this->error_reporting) {
         $this->fatal_errors[] = $msg . @r(debug_backtrace());
     }
     $this->count++;
     exit;
 }
开发者ID:rezgui,项目名称:LastAutoIndex,代码行数:11,代码来源:error.php


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