本文整理汇总了PHP中friendly_url函数的典型用法代码示例。如果您正苦于以下问题:PHP friendly_url函数的具体用法?PHP friendly_url怎么用?PHP friendly_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了friendly_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: feed_display_name
function feed_display_name(&$record)
{
if ($record['display_name']) {
return $record['display_name'];
}
return friendly_url($record['feed_url']);
}
示例2: get_party
function get_party($short_name, $parties)
{
$k = 1;
foreach ($parties as $party) {
if ($party['party_short_name'] == $short_name) {
return array('party' => $party['party'], 'party_short_name' => $party['party_short_name'], 'id' => $k, 'friendly_name' => friendly_url($party['party_short_name']));
}
$k++;
}
}
示例3: do_registrar
function do_registrar($id)
{
$imagen = $this->upload_file('imagen');
$imagen2 = $this->upload_file('imagen2');
$logo = array();
if ($imagen) {
$logo['lo_nombre'] = $imagen['file_name'];
}
if ($imagen2) {
$logo['lo_nombre2'] = $imagen2['file_name'];
}
$logo['lo_usu_id'] = $id;
$logo['lo_key'] = friendly_url($logo['lo_nombre']);
$idinsert = $this->logotipo_model->save_logotipo($logo);
redirect('administrador/logotipo/listar_logotipos');
}
示例4: editar
function editar($id)
{
$val = $this->form_validation;
$val->set_rules('tipo', 'tipo', 'callback_reqsel_check|xss_clean');
$val->set_rules('nombre', 'nombre', 'required|xss_clean');
if ($val->run()) {
$data = array('cat_nombre' => $val->set_value('nombre'), 'cat_key' => friendly_url($val->set_value('nombre')), 'cat_padre' => $val->set_value('tipo'));
$this->categoria->update_file($id, $data);
$this->session->set_flashdata('msje', '<h2> La categoria con el id: <b>' . $id . '</b> fue editado correctamente </h2>');
redirect('administrador/categoria/listar');
} else {
$cont['categoria'] = $this->categoria->get_file($id);
$cont['tipo'] = $this->categoria->get_all_array(0);
$data['contenido'] = $this->load->view('administrador/categoria_editar', $cont, TRUE);
$this->load->view('administrador/template_admin', $data);
}
}
示例5: do_registrar
function do_registrar()
{
$val = $this->form_validation;
$val->set_rules('cat_nombre', 'Nombre Categoria', 'trim|required|xss_clean');
if (!$val->run()) {
$this->load_registrar();
} else {
$res = '';
$ta_id = $this->input->post('tipoarticulo');
if ($ta_id == 1) {
$categoria = array('cat_nombre' => $this->input->post('cat_nombre'), 'cat_key' => friendly_url($this->input->post('cat_nombre')), 'cat_ta_id' => 1);
$res = $this->categorias_model->insert_categoria($categoria);
} else {
$categoria = array('cat_nombre' => $this->input->post('cat_nombre'), 'cat_ta_id' => 2);
$res = $this->categorias_model->insert_categoria($categoria);
}
redirect('administrador/categorias/listar_categorias');
}
}
示例6: foreach
$answers_id[$key] = $ids;
}
//print_r($keys);die();
foreach ($answers0 as $key => $region) {
array_shift($region);
array_shift($region);
$i = 1;
foreach ($region as $row) {
//print_r($row);die();
$vote = array();
foreach ($answers_id[$key] as $ikey => $id) {
$vote[$id] = answer2value($row[$ikey]);
}
if (isset($parties[$row[$unique_code_column[$key]]])) {
$party = $parties[$row[$unique_code_column[$key]]];
$data[$key][] = array('vote' => $vote, 'last_name' => $party['last_name'], 'first_name' => $party['first_name'], 'short_name' => $party['short_name'], 'name' => $party['name'], 'friendly_name' => friendly_url($party['last_name']), 'id' => $i);
$i++;
} else {
//report wrong unique key
echo $key . "::" . $row[$unique_code_column[$key]] . "<br/>\n";
}
}
//print_r($data);die();
//if direcotry not existing, create it
$dir = $path . 'volba-prezidenta-cr-2-kolo' . '-2013/';
if (!file_exists($dir)) {
mkdir($dir);
}
$fout = fopen($dir . 'answers.json', "w+");
$json = json_encode($data[$key]);
fwrite($fout, $json);
示例7: foreach
}
}
$answers_id[$key] = $ids;
}
//print_r($answers0);die();
foreach ($answers0 as $key => $region) {
array_shift($region);
$i = 1;
foreach ($region as $row) {
$vote = array();
foreach ($answers_id[$key] as $ikey => $id) {
$vote[$id] = answer2value($row[$ikey]);
}
if (isset($parties[$row[$unique_code_column[$key]]])) {
$party = $parties[$row[$unique_code_column[$key]]];
$data[$key][] = array('vote' => $vote, 'last_name' => $party['last_name'], 'first_name' => $party['first_name'], 'short_name' => $party['short_name'], 'name' => $party['name'], 'party' => $party['party'], 'constituency_code' => $party['constituency_code'], 'friendly_name' => friendly_url($party['party']), 'id' => $i);
$i++;
} else {
//report wrong unique key
echo $key . "::" . $row[$unique_code_column[$key]] . "<br/>\n";
}
}
//print_r($data);die();
//if direcotry not existing, create it
$dir = $path . 'senat' . '-2012/';
if (!file_exists($dir)) {
mkdir($dir);
}
$fout = fopen($dir . 'answers.json', "w+");
$json = json_encode($data[$key]);
fwrite($fout, $json);
示例8: header
header('location: ./mn-galleries.php?back=added');
exit;
} else {
overal_header($lang['galleries_galleries'], $lang['galleries_msg_put_contents_error'], 'error');
}
} else {
overall_header($lang['galleries_galleries'], $lang['galleries_msg_empty_gallery_name'], 'error');
}
} elseif (isset($_POST['action']) && $_POST['action'] == 'edit' && isset($_POST['id']) && file_exists($file['galleries'])) {
if (!empty($_POST['gallery_name'])) {
$galleries_file = file($file['galleries']);
$galleries_file_content = '';
foreach ($galleries_file as $single_line) {
$gallery_data = explode(DELIMITER, $single_line);
if ($gallery_data[0] == $_POST['id']) {
$galleries_file_content .= $gallery_data[0] . DELIMITER . $_POST['gallery_name'] . DELIMITER . friendly_url($_POST['gallery_name']) . "\n";
} else {
$galleries_file_content .= $single_line;
}
}
if (mn_put_contents($file['galleries'], $galleries_file_content)) {
header('location: ./mn-galleries.php?back=edited');
exit;
} else {
overal_header($lang['galleries_galleries'], $lang['galleries_msg_put_contents_error'], 'error');
}
} else {
overall_header($lang['galleries_galleries'], $lang['galleries_msg_empty_gallery_name'], 'error');
}
} elseif (isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['id']) && file_exists($file['galleries']) && !empty($var['gallery_name'])) {
overall_header($lang['galleries_edit_gallery'] . ' » ' . $var['gallery_name'], $lang['galleries_edit_gallery'], 'main');
示例9: htmlspecialchars
?>
single h-entry">
<td>
<div class="title p-name"><a href="<?php
echo $this->post->href;
?>
" class="u-url"><?php
echo htmlspecialchars($this->post->title ?: preg_replace('/^https?:\\/\\//', '', $this->post->href));
?>
</a></div>
<div class="details">
<span class="p-author h-card"><a href="<?php
echo $this->post->post_author;
?>
" class="u-url"><?php
echo friendly_url($this->post->post_author);
?>
</a></span> |
<? if($this->post->in_reply_to) { ?>
<a href="<?php
echo $this->post->in_reply_to;
?>
" class="u-in-reply-to"><?php
echo __('in reply to');
?>
</a> |
<? } ?>
<?php
echo $this->post->post_date ? '<time class="dt-published" datetime="' . date('c', strtotime($this->post->post_date)) . '">' . date('Y-m-d H:i T', strtotime($this->post->post_date)) . '</time> |' : '';
?>
<?php
示例10: foreach
//for each region
foreach ($out as $key => $region) {
print_r($key);
//if direcotry not existing, create it
$dir = $path . friendly_url($regions[$key]['name']) . '-2012/';
if (!file_exists($dir)) {
mkdir($dir);
}
//questions
$fout = fopen($dir . 'questions.json', "w+");
$json = json_encode($region);
fwrite($fout, $json);
fclose($fout);
//info about region
$rout = $regions[$key];
$rout['friendly_calc_url'] = friendly_url($regions[$key]['name']) . '-2012';
$rout['calc'] = $regions[$key]['name'] . ' 2012';
$fout = fopen($dir . 'region.json', "w+");
$json = json_encode($rout);
fwrite($fout, $json);
fclose($fout);
}
/**
* creates "friendly url" version of text, translits string (gets rid of diacritics) and substitutes ' ' for '-', etc.
* @return friendly url version of text
* example:
* friendly_url('klub ČSSD')
* returns 'klub-cssd'
*/
function friendly_url($text, $locale = 'cs_CZ.utf-8')
{
示例11: user_auth
<?php
include './stuff/inc/mn-start.php';
# --- xFIELDs
if (isset($_GET['action']) && $_GET['action'] == 'xfields') {
$auth = user_auth('8');
$xfields = get_unserialized_array('xfields');
# --- add new xField
if (isset($_POST['action']) && $_POST['action'] == 'xfield_add') {
if (!in_array($_POST['field_section'], array('posts', 'comments', 'pages', 'users'))) {
die;
} else {
$xSection = $_POST['field_section'];
}
$xName = check_text(trim($_POST['field_name']), true);
$xVar = str_replace('-', '_', friendly_url(trim($_POST['field_variable'])));
$xType = $_POST['field_type'] == 'select' && !empty($_POST['field_options']) ? 'select' : 'input';
if (empty($xName) || empty($xVar) || array_key_exists($xVar, $xfields)) {
$var = array('name' => $xName, 'var' => $xVar, 'section' => $xSection, 'type' => $xType, 'options' => trim($_POST['field_options']), 'action' => 'add');
$admin_tmpl['xfields_list'] = true;
$xError = array_key_exists($xVar, $xfields) ? 'xfields_msg_variable_exists' : 'xfields_msg_empty_fields';
overall_header($lang['xfields_xfields'], $lang[$xError], 'error');
} else {
if ($xType == 'select' && !empty($_POST['field_options'])) {
$xOptions = array();
$xOptions_lines = explode("\n", trim($_POST['field_options']));
foreach ($xOptions_lines as $xLine) {
$xO = explode('=', check_text($xLine, true));
if (isset($xO[1])) {
$xOptions[$xO[0]] = $xO[1];
} else {
示例12: friendly_url
<?php
if (session('me')) {
?>
<li><a href="/channels">Channels</a></li>
<?php
}
?>
<!-- <li><a href="/docs">Docs</a></li> -->
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
if (session('me')) {
?>
<li><span class="navbar-text"><?php
echo friendly_url(session('me'));
?>
</span></li>
<li><a href="/signout">Sign Out</a></li>
<?php
/* } else if(!property_exists($this, 'authorizing')) { ?>
<li class="navbar-text"><?= $this->authorizing ?></li>
<?php */
} else {
?>
<form action="/auth/start" method="get" class="navbar-form">
<input type="text" name="me" placeholder="yourdomain.com" class="form-control" />
<button type="submit" class="btn">Sign In</button>
</form>
<?php
}
示例13: header
header('location: ./mn-categories.php?back=added');
exit;
} else {
overal_header($lang['cats_categories'], $lang['cats_msg_put_contents_error'], 'error');
}
} else {
overall_header($lang['cats_categories'], $lang['cats_msg_empty_cat_name'], 'error');
}
} elseif (isset($_POST['action']) && $_POST['action'] == 'edit' && isset($_POST['id']) && file_exists($file['categories'])) {
if (!empty($_POST['cat_name'])) {
$cats_file = file($file['categories']);
$cats_file_content = '';
foreach ($cats_file as $single_line) {
$cat_data = explode(DELIMITER, $single_line);
if ($cat_data[0] == $_POST['id']) {
$cats_file_content .= $cat_data[0] . DELIMITER . $_POST['cat_name'] . DELIMITER . friendly_url($_POST['cat_name']) . "\n";
} else {
$cats_file_content .= $single_line;
}
}
if (mn_put_contents($file['categories'], $cats_file_content)) {
header('location: ./mn-categories.php?back=edited');
exit;
} else {
overal_header($lang['cats_categories'], $lang['cats_msg_put_contents_error'], 'error');
}
} else {
overall_header($lang['cats_categories'], $lang['cats_msg_empty_cat_name'], 'error');
}
} elseif (isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['id']) && file_exists($file['categories']) && !empty($var['cat_name'])) {
overall_header($lang['cats_edit_category'] . ' » ' . $var['cat_name'], $lang['cats_edit_category'], 'main');
示例14: foreach
foreach ($region as $row) {
$vote = array();
foreach ($answers_id[$key] as $ikey => $id) {
$vote[$id] = answer2value($row[$ikey]);
}
if (isset($parties[$row[$unique_code_column[$key]]])) {
$party = $parties[$row[$unique_code_column[$key]]];
$data[$key][] = array('vote' => $vote, 'name' => $party['name'], 'short_name' => $party['short_name'], 'friendly_name' => friendly_url($party['short_name']), 'id' => $i);
$i++;
} else {
//report wrong unique key
echo $key . "::" . $row[$unique_code_column[$key]] . "<br/>\n";
}
}
//if direcotry not existing, create it
$dir = $path . friendly_url($regions[$key]['name']) . '-2012/';
if (!file_exists($dir)) {
mkdir($dir);
}
$fout = fopen($dir . 'answers.json', "w+");
$json = json_encode($data[$key]);
fwrite($fout, $json);
fclose($fout);
}
print_r($data);
die;
function answer2value($a)
{
if ($a == 'Souhlasím.') {
return 1;
}
示例15: array
$path = '../www/';
$out = array();
$i = 1;
while (($row = fgetcsv($fin)) !== FALSE) {
if ($i == 1) {
$j = 0;
$ids = array();
foreach ($row as $item) {
if ($j >= $columns) {
$ids[$j] = $item;
}
$j++;
}
} else {
if ($i > 2) {
$mp = array('last_name' => $row[1], 'first_name' => $row[0], 'party' => $row[2], 'friendly_name' => friendly_url($row[2]), 'id' => $row[6], 'sex' => $row[5], 'region' => $row[4], 'party_long' => $row[3]);
for ($j = $columns; $j < count($row); $j++) {
if (trim($row[$j]) != '') {
$mp['vote'][$ids[$j]] = $row[$j];
}
}
$out[] = $mp;
}
}
$i++;
}
$fout = fopen($path . $directory . 'answers.json', "w+");
$json = json_encode($out);
fwrite($fout, $json);
fclose($fout);
/**