本文整理匯總了PHP中Inflector::urlize方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::urlize方法的具體用法?PHP Inflector::urlize怎麽用?PHP Inflector::urlize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Inflector
的用法示例。
在下文中一共展示了Inflector::urlize方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct($bucket = null, $args = [])
{
$this->bucket = !$bucket ? SITE_NAME : Inflector::urlize($bucket, '');
$this->args = $args;
if ($this->bucket == 'download') {
throw new Exception("The bucket name 'download' is not possible. Please chosse another one => ex: 'downloads'.");
}
$dir = session_save_path() . DS . 'bucket';
if (!is_dir($dir)) {
File::mkdir($dir);
}
$this->dir = $dir . DS . $this->bucket;
if (!is_dir($this->dir)) {
File::mkdir($this->dir);
}
$this->dir .= '/';
$this->check();
}
示例2: __construct
public function __construct($db = null, $table = null)
{
$this->db = is_null($db) ? SITE_NAME : $db;
$this->table = is_null($table) ? 'core' : $table;
$dir = Config::get('dir.flat.store', session_save_path());
if (!is_dir($dir)) {
File::mkdir($dir);
}
$dir .= DS . Inflector::urlize(Inflector::uncamelize($this->db));
if (!is_dir($dir)) {
File::mkdir($dir);
}
$this->file = $dir . DS . Inflector::urlize(Inflector::uncamelize($this->table)) . '.flat';
if (!file_exists($this->file)) {
File::put($this->file, serialize([]));
}
Now::set('flat.collection.' . $this->db . '.' . $this->table, lib('sessy', [$this->db, $this->table, unserialize(File::read($this->file))]));
}
示例3: slugify
/**
* Normalise une chaine en ne conservant que des caractères alphanumériques et des tirets. Si l'extension est renseignée,
* elle sera protégée (non normalisée) dans le texte. L'extension peut être indifféremment de la forme '.ext' ou 'ext'.
* @param string $text
* @param string $extension
* @return string
*/
public static function slugify($text, $extension = "")
{
// Protection de l'extension (pour les noms de fichiers complets)
$extension = trim($extension);
if ($extension != "" && strpos($text, $extension) === false) {
$extension = "";
}
if ($extension != "") {
if ($extension[0] != '.') {
/**
* L'extension doit commencer par un .
*/
$extension = ".{$extension}";
}
// On la supprime du texte à traiter pour qu'elle ne soit pas transformée.
// On la replacera en fin de texte avant de quitter la méthode
$text = str_replace($extension, "", $text);
}
$text = Inflector::urlize($text);
return "{$text}{$extension}";
}
示例4: forget
public function forget($key)
{
$key = Inflector::urlize($key, '.');
unset(self::$datas[$this->ns][$key]);
return $this;
}
示例5: getTransports
public function getTransports($lat, $lng)
{
$bbox = $this->getBoundingBox($lat, $lng);
$url = "https://navitia.opendatasoft.com/api/records/1.0/download/?dataset=global_stops&format=json&geofilter.bbox={$bbox[0]},{$bbox[1]},{$bbox[2]},{$bbox[3]}&rows=1000&timezone=Europe%2FParis";
return xCache('get.transports.' . sha1($url), function () use($url, $lat, $lng) {
$json = lib('geo')->dwnCache($url);
$tab = json_decode($json, true);
$collection = [];
foreach ($tab as $row) {
$obj = [];
$stop_id = isAke(isAke($row, 'fields', []), 'stop_id', '');
$name = isAke(isAke($row, 'fields', []), 'stop_name', '');
$geo = isAke(isAke($row, 'fields', []), 'geo', [0, 0]);
$distances = distanceKmMiles($lng, $lat, $geo[1], $geo[0]);
$type = 'bus';
for ($i = 0; $i < strlen($name); $i++) {
$char = $name[$i];
$charC = Inflector::urlize($char, '');
if (strlen($charC)) {
if (!is_numeric($charC)) {
if (ctype_lower($char)) {
$type = 'subway';
}
}
}
}
$has = false;
if (fnmatch("StopArea:OIF*", $stop_id)) {
list($dummy, $ratp_stop_id) = explode('StopArea:OIF', $stop_id, 2);
$native = clipp()->em('transports')->findOne(['stop_id' => strval($ratp_stop_id)]);
$has = true;
if ($native) {
unset($native['_id']);
unset($native['created_at']);
unset($native['updated_at']);
unset($native['status']);
unset($native['__v']);
$native['geo'] = $native['location']['coordinates'];
$native['km'] = $distances['km'];
$native['distances'] = $distances;
$collection[] = $native;
}
}
if (!$has) {
$obj['title'] = $name;
$obj['geo'] = $geo;
$obj['km'] = $distances['km'];
$obj['distances'] = $distances;
$obj['type'] = $type;
$obj['stop_id'] = $stop_id;
$collection[] = $obj;
}
}
$check = coll($collection)->min('km');
$collection = coll($collection)->sortBy('km')->toArray();
$collection = array_values($collection);
if (0.5 > $check) {
$return = [];
foreach ($collection as $row) {
if (0.5 >= $row['km']) {
$return[] = $row;
} else {
return $return;
}
}
} else {
return $collection;
}
});
}
示例6: lng
public static function lng($content)
{
$tab = array_merge(explode('<t ', $content), explode('<t>', $content));
if (count($tab)) {
array_shift($tab);
foreach ($tab as $row) {
$id = Utils::cut('id="', '"', trim($row));
$args = Utils::cut('args=[', ']', trim($row));
$default = Utils::cut('">', '</t>', trim($row));
$default = !strlen($default) ? Utils::cut(']>', '</t>', trim($row)) : $default;
if (!strlen($default)) {
if (!strstr($row, '</t>')) {
continue;
} else {
list($default, $dummy) = explode('</t>', $row, 2);
}
}
if (strlen($args)) {
if (strlen($id)) {
$content = repl('<t id="' . $id . '" args=[' . $args . ']>' . $default . '</t>', '<?php echo trad("' . repl('"', '\\"', $id) . '", "' . repl('"', '\\"', $default) . '", "' . repl('"', '\\"', $args) . '"); ?>', $content);
} else {
$id = Inflector::urlize($default);
$content = repl('<t args=[' . $args . ']>' . $default . '</t>', '<?php echo trad("' . $id . '", "' . repl('"', '\\"', $default) . '", "' . repl('"', '\\"', $args) . '"); ?>', $content);
}
} else {
if (strlen($id)) {
$content = repl('<t id="' . $id . '">' . $default . '</t>', '<?php echo trad("' . repl('"', '\\"', $id) . '", "' . repl('"', '\\"', $default) . '"); ?>', $content);
} else {
$id = Inflector::urlize($default);
$content = repl('<t>' . $default . '</t>', '<?php echo trad("' . $id . '", "' . repl('"', '\\"', $default) . '"); ?>', $content);
}
}
}
}
return $content;
}
示例7: __construct
/**
* [__construct description]
* @param [type] $name [description]
*/
public function __construct($name = null)
{
$name = is_null($name) ? 'core' : $name;
$this->_name = Inflector::urlize($name, '.');
$this->check();
}
示例8: open
public function open($savePath, $sessionName)
{
$this->db = core('fast')->instanciate('session', Inflector::urlize($sessionName, ''));
}
示例9: normalize
private function normalize($str)
{
return Inflector::urlize($str, '');
}
示例10: raw2url
/**
* Convert a string (normally a title) to a string suitable for using in
* urls and other html attributes. Uses {@link URLSegmentFilter}.
*
* @param string
* @return string
*/
public function raw2url($title)
{
return Inflector::urlize($title);
}