本文整理汇总了PHP中tag_replace函数的典型用法代码示例。如果您正苦于以下问题:PHP tag_replace函数的具体用法?PHP tag_replace怎么用?PHP tag_replace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tag_replace函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_menu
function build_menu($menus = array())
{
// Check if current level is parent
$current_line = isset($menus[0]) ? $menus[0] : array();
$root_level = get_value($current_line, 'id_menu_parent') <= 0 ? true : false;
if (count($menus) > 0) {
foreach ($menus as $menu) {
// DEBUG:
// print_r($menu);
// Counting children menu
$count_menu_children = count(get_value($menu, 'children'));
// Build a link
$link = tag_replace(get_value($menu, 'link'));
$target = get_value($menu, 'target') != '' ? ' target="' . tag_replace(get_value($menu, 'target')) . '" ' : '';
$label = lang(get_value($menu, 'label'));
$img = image(get_value($menu, 'url_img'));
// Build a single line menu
if ($count_menu_children > 0) {
$class = $root_level ? 'dropdown' : 'dropdown dropdown-submenu';
$caret = $root_level ? '<span class="caret"></span>' : '';
?>
<li class="<?php
echo $class;
?>
">
<a href="<?php
echo $link;
?>
" <?php
echo $target;
?>
class="dropdown-toggle" data-toggle="dropdown">
<?php
echo $img . ' ' . $label . $caret;
?>
</a>
<ul class="dropdown-menu"><?php
build_menu(get_value($menu, 'children'));
?>
</ul>
</li>
<?php
} else {
?>
<li><a href="<?php
echo $link;
?>
" <?php
echo $target;
?>
><?php
echo $img . ' ' . $label;
?>
</a></li>
<?php
}
}
}
}
示例2: _load_module
/**
* load_module()
* Loads module data from database to current object.
* @return void
*/
private function _load_module()
{
// Try to locate the module on database
$module = $this->db->from('acm_module')->where(array('controller' => $this->controller))->get()->row_array(0);
if (count($module) <= 0) {
// There is no modules on database with this name
$this->error->show_error(lang('Module not found'), lang('It was not possible to load the specified module. Make sure that the class name is the same registered on database.') . ' Classe: ' . $this->controller);
exit;
}
// Set current object attributes values
$this->id_module = get_value($module, 'id_module');
$this->label = lang(get_value($module, 'label'));
$this->sql_list = get_value($module, 'sql_list');
$this->url_img = tag_replace(get_value($module, 'url_img'));
$this->description = get_value($module, 'description');
$this->table_name = get_value($module, 'table_name');
$this->menus = $this->db->get_where('acm_module_menu', array('id_module' => $this->id_module))->result_array();
$this->actions = $this->db->get_where('acm_module_action', array('id_module' => $this->id_module))->result_array();
// Load the module model
$this->load->model($this->controller . '_model');
// Load base model
$this->load->model('core/acme_module_controller_model');
}
示例3: lang
echo URL_ROOT;
?>
/app-log"><i class="fa fa-fw fa-refresh"></i> <?php
echo lang('Refresh');
?>
</a></li>
<li><a href="javascript:void(0)" class="remove-all"><i class="fa fa-fw fa-warning"></i> <?php
echo lang('Remove all errors');
?>
</a></li>
<?php
foreach ($this->menus as $menu) {
// build link
$link = tag_replace(get_value($menu, 'link'));
$target = get_value($menu, 'target') != '' ? ' target="' . tag_replace(get_value($menu, 'target')) . '" ' : '';
$label = lang(get_value($menu, 'label'));
$img = image(get_value($menu, 'url_img'));
?>
<li><a href="<?php
echo $link;
?>
" <?php
echo $target;
?>
><?php
echo $img . ' ' . $label;
?>
</a></li>
<?php
示例4: get_value
</div>
</div>
</div>
</div>
<div class="module-body">
<div class="row">
<div class="col-sm-8 col-md-7">
<?php
$action = get_value($form, 'action') != '' ? tag_replace(get_value($form, 'action')) : URL_ROOT . '/' . $this->controller . '/form_process';
$enctype = get_value($form, 'enctype') != '' ? 'enctype="' . get_value($form, 'enctype') . '"' : '';
$method = get_value($form, 'method') != '' ? get_value($form, 'method') : 'post';
?>
<form action="<?php
echo $action;
?>
" method="<?php
echo $method;
?>
" <?php
echo $enctype;
?>
>
示例5: lang
<h3 style="margin-top: 15px"><?php
echo lang('Your new module') . ' <a href="' . tag_replace($link) . '" target="_blank">' . get_value($module, 'label') . ' <i class="fa fa-fw fa-external-link"></i></a> ' . lang('was created with no errors.');
?>
</h3>
<h4 style="margin-top: 40px"><?php
echo lang('Things you are recommended now');
?>
:</h4>
<div>
<h5>
<i class="fa fa-fw fa-arrow-circle-right"></i>
<a href="<?php
echo tag_replace($link);
?>
" target="_blank"><?php
echo lang('Go to');
?>
<?php
echo get_value($module, 'label');
?>
<i class="fa fa-fw fa-external-link"></i></a>
</h5>
</div>
<div>
<h5>
<i class="fa fa-fw fa-users"></i>
<a href="<?php
示例6: get_value
</div>
</div>
<div class="module-body">
<div class="row">
<div class="col-sm-3 user-data">
<?php
$id_user = get_value($user, 'id_user');
$url_img = get_value($user, 'url_img');
// Adjust thumb
if (basename($url_img) != '' && file_exists(PATH_UPLOAD . '/' . $this->photos_dir . '/' . basename($url_img))) {
$url_img = tag_replace($url_img);
} else {
$url_img = URL_IMG . '/user-unknown.png';
}
?>
<div class="text-center user-img">
<img src="<?php
echo $url_img;
?>
" class="img-circle img-responsive" />
</div>
<h4 class="text-center name">
<div><i class="fa fa-fw fa-envelope-o"></i> <?php
示例7: edit_thumbnail
/**
* edit_thumbnail()
* update user thumbnail according to the coordinates.
* @return int id_user
* @return void
*/
public function edit_thumbnail($id_user = 0)
{
// only the logged user can see your profile
if ($this->session->userdata('id_user') != $id_user || $id_user == '' || $id_user == 0) {
redirect($this->session->userdata('url_default'));
}
// coordinates of image
$w = $this->input->post('w');
$h = $this->input->post('h');
$sw = $this->input->post('sw');
$sh = $this->input->post('sh');
$x1 = $this->input->post('x1');
$x2 = $this->input->post('x2');
$y1 = $this->input->post('y1');
$y2 = $this->input->post('y2');
// Make thumb only if coordinates are correct
if ($w != '' && $h != '' && $x1 != '' && $x2 != '' && $y1 != '' && $y2 != '' && $sw != '' && $sh != '') {
// user data
$user = $this->app_user_model->get_user($id_user);
// make thumb (return = thumb name)
if (($file_thumb_name = $this->_make_thumbnail($id_user, basename(get_value($user, 'url_img_large')), $w, $h, $sw, $sh, $x1, $x2, $y1, $y2)) === false) {
// force header 400 (erro)
$this->output->set_status_header('400');
} else {
// Remove previous thumb
@unlink(PATH_UPLOAD . '/' . $this->photos_dir . '/' . basename(get_value($user, 'url_img')));
// update info on database
$new_user_img = '{URL_UPLOAD}/' . $this->photos_dir . '/' . $file_thumb_name;
$this->db->update('acm_user_config', array('url_img' => $new_user_img), array('id_user' => $id_user));
// update img on session
$this->session->set_userdata('user_img', tag_replace($new_user_img));
}
}
}
示例8: login_process
/**
* Process login page/form. After validate login, redirect user to his home.
*
* @return void
*/
public function login_process()
{
$email = $this->input->post('email');
$pass = $this->input->post('pass');
// Try to get the user by email and pass
$user = $this->access->validate_login($email, $pass);
// Case user doesnt exist, redirect to login page again
if (!$user) {
// Error message
$this->session->set_userdata('email_user', $email);
$this->session->set_userdata('bool_email_error', true);
if ($email == '') {
$this->session->set_userdata('email_msg_error', lang('Enter your email address'));
} elseif ($email != '') {
$this->session->set_userdata('email_msg_error', lang('The given email address or password are incorrect'));
}
redirect('app-login');
} else {
// Check url default for user, if not exist try to redirect to default dashboard
$url_default = get_value($user, 'url_default') != '' ? $this->tag->tag_replace(get_value($user, 'url_default')) : URL_ROOT . '/app_dashboard/';
// Put some user data in session
$session['id_user'] = get_value($user, 'id_user');
$session['user_group'] = get_value($user, 'user_group');
$session['user_name'] = get_value($user, 'user_name');
$session['email'] = get_value($user, 'email');
$session['user_img'] = tag_replace(get_value($user, 'url_img'));
$session['language'] = get_value($user, 'lang_default');
$session['url_default'] = $url_default;
$session['login_access'] = true;
// Set the data above
$this->session->set_userdata($session);
// Log the login
$this->logger->db_log('login', 'login');
// Redirect to user's home
redirect($url_default);
}
}
示例9: parse_page
//.........这里部分代码省略.........
//get usual var
} else {
$tagvalue = hfvalue($tag, $hf);
}
# $attr_lang='';
# if ( array_key_exists('lang', $attrs) ) $attr_lang=$attrs['lang'];
//start working with tag value
if (!is_null($tagvalue)) {
//rw("$tag EXISTS");
if (array_key_exists('repeat', $attrs)) {
//if this is 'repeat' tag parse as datarow
if (is_array($tagvalue)) {
$repeat_array = $tagvalue;
$tagvalue = '';
$hfcount = count($repeat_array);
$k1 = 0;
foreach ($repeat_array as $k => $v) {
$hfrow = $v;
$hfrow['repeat.last'] = $k1 == $hfcount - 1 ? 1 : 0;
$hfrow['repeat.first'] = $k1 == 0 ? 1 : 0;
$hfrow['repeat.even'] = $k1 % 2 ? 1 : 0;
$hfrow['repeat.odd'] = $k1 % 2 ? 0 : 1;
$hfrow['repeat.index'] = $k1;
$hfrow['repeat.iteration'] = $k1 + 1;
$hfrow['repeat.total'] = $hfcount;
$tagvalue .= parse_page($basedir, tag_tplpath($tag, $tpl_name, $is_inline_tpl), $hfrow, 'v', $inline_tpl, $hf);
$k1++;
}
} else {
logger('WARN', 'ParsePage - not an array passed to repeat tag = ' . $tag);
$tagvalue = '';
}
} elseif (array_key_exists('sub', $attrs)) {
//if this is 'sub' tag - parse it as independent subtemplate
$tagvalue = parse_page($basedir, tag_tplpath($tag, $tpl_name, $is_inline_tpl), $tagvalue, 'v', $inline_tpl, $hf);
} else {
//if usual tag - replace it with tagvalue got above
#CSRF shield +1
if ($tagvalue > "" && !array_key_exists('noescape', $attrs)) {
$tagvalue = htmlescape($tagvalue);
}
}
$page = tag_replace($page, $tag_full, $tagvalue, $attrs);
} elseif (array_key_exists('repeat', $attrs)) {
//if it's repeat tag, but tag value empty - just replace with empty string
$page = tag_replace($page, $tag_full, '', $attrs);
} elseif (array_key_exists('var', $attrs)) {
//if tag doesn't exists in $hf and it's marked as variable (var)
//then don't make subparse and just replace to empty string for more performance
$page = tag_replace($page, $tag_full, "", $attrs);
} elseif (array_key_exists('select', $attrs)) {
//this is special case for '<select>' HTML tag
$v = parse_select_tag($basedir, tag_tplpath($tag, $tpl_name, $is_inline_tpl), $hf, $attrs);
$page = tag_replace($page, $tag_full, $v, $attrs);
} elseif (array_key_exists('radio', $attrs)) {
//this is special case for '<index type=radio>' HTML tag
$v = parse_radio_tag($basedir, tag_tplpath($tag, $tpl_name, $is_inline_tpl), $hf, $attrs);
$page = tag_replace($page, $tag_full, $v, $attrs);
} elseif (array_key_exists('selvalue', $attrs)) {
//this is special case for displaying just one selected value (for '<select>' or '<index type=radio>' HTML tags
$v = parse_selvalue_tag($basedir, tag_tplpath($tag, $tpl_name, $is_inline_tpl), $hf, $attrs);
if (!array_key_exists('noescape', $attrs)) {
$v = htmlescape($v);
}
$page = tag_replace($page, $tag_full, $v, $attrs);
} else {
//if tag is not set and not a var - then it's subtemplate in a file - parse it
//echo "$tag SUBPARSE<br>\n";
$v = parse_page($basedir, tag_tplpath($tag, $tpl_name, $is_inline_tpl), $hf, 'v', $inline_tpl, $hf);
$page = tag_replace($page, $tag_full, $v, $attrs);
}
} else {
$page = tag_replace_raw($page, $tag_full, '', array_key_exists('inline', $attrs));
// print "$tag not shown\n";
}
}
}
//if tags empty
}
//if tpl empty
if ($out_filename && $out_filename != 'v' && $out_filename != 's') {
$outdir = dirname($out_filename);
//check dir
if (!is_dir($outdir)) {
mkdir($outdir, 0777);
}
$OUTFILE = fopen($out_filename, "w") or die("Can't open out [{$out_filename}] file");
fputs($OUTFILE, $page);
fclose($OUTFILE);
} else {
if ($out_filename == 'v') {
#variable mode
return $page;
} else {
#screen mode
print_header();
print $page;
}
}
}
示例10: app_settings_inputs
/**
* app_settings_inputs()
* Returns a set of HTML hidden inputs, each one for each app setting as APP_NAME, TEMPLATE, etc.
* @return string html_inputs
*/
public function app_settings_inputs()
{
$return = '';
$escape = array();
// Just creates the input if it is safe or is not an object
foreach ($this->CI->config->config['app_settings'] as $attribute => $value) {
if (!is_object($value)) {
$return .= !in_array($attribute, $escape) || !$protected_mode ? "<input type=\"hidden\" name=\"{$attribute}\" id=\"{$attribute}\" value=\"" . tag_replace($value) . "\" />\n" : '';
}
}
// Returns
return $return;
}
示例11: elseif
* This HTML component build an img tag. It also check if the given url is a font-awesome icon
* and them let it be (know more on fontawesome.github.io/Font-Awesome/)
*
* It is loaded by the call $this->template->image($url_img);
*
* Or by the function loaded by template helper, called image($url_img);
*
* @param string $url_img
* @since 28/06/2013
*
* --------------------------------------------------------------------------------------------------
*/
?>
<?php
// Check if the given value is a font-awesome
if (stristr($url_img, 'class="fa') || stristr($url_img, "class='fa")) {
echo $url_img;
} elseif ($url_img != '') {
?>
<img src="<?php
echo tag_replace($url_img);
?>
" />
<?php
}
?>
示例12: app_settings_inputs
/**
* Returns a set of HTML hidden inputs, each one for each app setting
* as APP_NAME, TEMPLATE, etc.
*
* @return string html_inputs
*/
public function app_settings_inputs()
{
$return = '';
$escape = array();
// Gets a single controller
$CI = get_instance();
// Loads properly configs
if ($CI->acme_installed) {
$config = $this->CI->config->config['app_settings'];
} else {
require 'application/core/engine-files/installer_app_settings.php';
}
// Just creates the input if it is safe or is not an object
foreach ($config as $attribute => $value) {
if (!is_object($value)) {
$return .= !in_array($attribute, $escape) || !$protected_mode ? "<input type=\"hidden\" name=\"{$attribute}\" id=\"{$attribute}\" value=\"" . tag_replace($value) . "\" />\n" : '';
}
}
// Returns
return $return;
}
示例13: get_value
* [url_img] => <i class="fa fa-fw fa-home"></i>
* )
*
* @param array $action
* @since 28/06/2013
*
* --------------------------------------------------------------------------------------------------
*/
?>
<?php
// Adjust target
$target = get_value($action, 'target') != '' ? ' target="' . get_value($action, 'target') . '"' : '';
// Adjust image
$img = image(get_value($action, 'url_img'));
?>
<a href="<?php
echo tag_replace(get_value($action, 'link'));
?>
" <?php
echo $target;
?>
>
<?php
echo $img;
?>
<?php
echo get_value($action, 'label');
?>
</a>