本文整理汇总了PHP中str_ireplace函数的典型用法代码示例。如果您正苦于以下问题:PHP str_ireplace函数的具体用法?PHP str_ireplace怎么用?PHP str_ireplace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了str_ireplace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pic_cutOp
/**
* 图片裁剪
*
*/
public function pic_cutOp()
{
Uk86Language::uk86_read('admin_common');
$lang = Uk86Language::uk86_getLangContent();
uk86_import('function.thumb');
if (uk86_chksubmit()) {
$thumb_width = $_POST['x'];
$x1 = $_POST["x1"];
$y1 = $_POST["y1"];
$x2 = $_POST["x2"];
$y2 = $_POST["y2"];
$w = $_POST["w"];
$h = $_POST["h"];
$scale = $thumb_width / $w;
$src = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['url']);
if (strpos($src, '..') !== false || strpos($src, BASE_UPLOAD_PATH) !== 0) {
exit;
}
if (!empty($_POST['filename'])) {
// $save_file2 = BASE_UPLOAD_PATH.'/'.$_POST['filename'];
$save_file2 = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['filename']);
} else {
$save_file2 = str_replace('_small.', '_sm.', $src);
}
$cropped = uk86_resize_thumb($save_file2, $src, $w, $h, $x1, $y1, $scale);
@unlink($src);
$pathinfo = pathinfo($save_file2);
exit($pathinfo['basename']);
}
$save_file = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_GET['url']);
$_GET['resize'] = $_GET['resize'] == '0' ? '0' : '1';
Tpl::output('height', uk86_get_height($save_file));
Tpl::output('width', uk86_get_width($save_file));
Tpl::showpage('common.pic_cut', 'null_layout');
}
示例2: singleParamHtmlHolder
public function singleParamHtmlHolder($param, $value)
{
$output = '';
// Compatibility fixes
$old_names = array('yellow_message', 'blue_message', 'green_message', 'button_green', 'button_grey', 'button_yellow', 'button_blue', 'button_red', 'button_orange');
$new_names = array('alert-block', 'alert-info', 'alert-success', 'btn-success', 'btn', 'btn-info', 'btn-primary', 'btn-danger', 'btn-warning');
$value = str_ireplace($old_names, $new_names, $value);
//$value = __($value, LANGUAGE_ZONE);
//
$param_name = isset($param['param_name']) ? $param['param_name'] : '';
$type = isset($param['type']) ? $param['type'] : '';
$class = isset($param['class']) ? $param['class'] : '';
if (isset($param['holder']) == true && $param['holder'] !== 'hidden') {
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
}
if ($param_name == 'images') {
$images_ids = empty($value) ? array() : explode(',', trim($value));
$output .= '<ul class="attachment-thumbnails' . (empty($images_ids) ? ' image-exists' : '') . '" data-name="' . $param_name . '">';
foreach ($images_ids as $image) {
$img = wpb_getImageBySize(array('attach_id' => (int) $image, 'thumb_size' => 'thumbnail'));
$output .= $img ? '<li>' . $img['thumbnail'] . '</li>' : '<li><img width="150" height="150" test="' . $image . '" src="' . WPBakeryVisualComposer::getInstance()->assetURL('vc/blank.gif') . '" class="attachment-thumbnail" alt="" title="" /></li>';
}
$output .= '</ul>';
$output .= '<a href="#" class="column_edit_trigger' . (!empty($images_ids) ? ' image-exists' : '') . '">' . __('Add images', LANGUAGE_ZONE) . '</a>';
}
return $output;
}
示例3: StripTags
function StripTags($out)
{
$out = strip_tags($out);
$out = trim(preg_replace("~[\\s]+~", " ", $out));
$out = str_ireplace("…", "", $out);
return $out;
}
示例4: getLink
public static function getLink($params, $fields = array('simple', 'menu', 'article'), $content_item = false, $isJoomlaArticle = true)
{
$simple = $fields[0];
$menu = $fields[1];
$article = $fields[2];
$link = '';
if ($params->get($simple, '') != '') {
$link = str_ireplace('{SITE}/', JURI::root(), $params->get($simple));
} elseif ($params->get($menu, '') != '') {
$application = JFactory::getApplication();
$cms_menu = $application->getMenu();
$menu_item = $cms_menu->getItem($params->get($menu));
$link = JRoute::_($menu_item->link . '&Itemid=' . $menu_item->id);
} elseif ($params->get($article, '') != '') {
if (self::getjVersion() > 2) {
$link = JRoute::_('index.php?option=com_content&view=article&id=' . $params->get($article, ''));
} else {
$link = JRoute::_(ContentHelperRoute::getArticleRoute($params->get($article, '')));
}
} elseif ($content_item && $isJoomlaArticle) {
if (self::getjVersion() > 2) {
$link = JRoute::_('index.php?option=com_content&view=article&id=' . $content_item->id);
} else {
$link = JRoute::_(ContentHelperRoute::getArticleRoute($content_item->id, $content_item->catid));
}
} elseif ($content_item) {
if (@isset($content_item->link)) {
$link = $content_item->link;
}
}
return $link;
}
示例5: removeAttribute
/**
* Removes unwanted attributes from a particular tag
*
* @param string $fullTag (e.g. '<a onclick="alert('XSS');">')
* @param string $attributes (e.g. 'a onclick="alert('XSS');"')
* @return string
*/
protected function removeAttribute($fullTag, $attributes)
{
$replacement = $this->attributeFinder->findAttributes($attributes, function () {
return '';
});
return str_ireplace($attributes, $replacement, $fullTag);
}
示例6: talk
function talk($content, $name, $api, $apikey = '')
{
$content = str_ireplace("@{$name}", '', $content);
$content = str_ireplace("回复 {$name} :", '', $content);
$content = urlencode($content);
switch ($api) {
case 'xiaoji':
$re = xiaoji($content);
break;
case 'xiaoi3':
$re = xiaoi3($content);
break;
case 'tuling':
$re = tuling($content, $apikey);
break;
case 'simsimi3':
$re = simsimi3($content);
break;
case 'simsimi':
$re = simsimi($content);
break;
default:
$re = xiaoji($content);
}
return $re;
}
示例7: parse
/**
* Parses an URI string returning an array of connection parameters.
*
* When using the "redis" and "rediss" schemes the URI is parsed according
* to the rules defined by the provisional registration documents approved
* by IANA. If the URI has a password in its "user-information" part or a
* database number in the "path" part these values override the values of
* "password" and "database" if they are present in the "query" part.
*
* @link http://www.iana.org/assignments/uri-schemes/prov/redis
* @link http://www.iana.org/assignments/uri-schemes/prov/redis
*
* @param string $uri URI string.
*
* @throws \InvalidArgumentException
*
* @return array
*/
public static function parse($uri)
{
if (stripos($uri, 'unix') === 0) {
// Hack to support URIs for UNIX sockets with minimal effort.
$uri = str_ireplace('unix:///', 'unix://localhost/', $uri);
}
if (!($parsed = parse_url($uri))) {
throw new \InvalidArgumentException("Invalid parameters URI: {$uri}");
}
if (isset($parsed['host']) && false !== strpos($parsed['host'], '[') && false !== strpos($parsed['host'], ']')) {
$parsed['host'] = substr($parsed['host'], 1, -1);
}
if (isset($parsed['query'])) {
parse_str($parsed['query'], $queryarray);
unset($parsed['query']);
$parsed = array_merge($parsed, $queryarray);
}
if (stripos($uri, 'redis') === 0) {
if (isset($parsed['pass'])) {
$parsed['password'] = $parsed['pass'];
unset($parsed['pass']);
}
if (isset($parsed['path']) && preg_match('/^\\/(\\d+)(\\/.*)?/', $parsed['path'], $path)) {
$parsed['database'] = $path[1];
if (isset($path[2])) {
$parsed['path'] = $path[2];
} else {
unset($parsed['path']);
}
}
}
return $parsed;
}
示例8: installPaExtension
public function installPaExtension()
{
$this->model = $this->getModel('installer');
JSNFactory::import('components.com_installer.helpers.installer');
$canDo = InstallerHelper::getActions();
if ($canDo->get('core.manage')) {
try {
$rs = $this->model->download();
$this->input->set('package', $rs);
// Set extension parameters
$_GET['package'] = $rs;
$_GET['type'] = 'plugin';
$_GET['folder'] = 'jsnpoweradmin';
$_GET['publish'] = 1;
$_GET['client'] = 'site';
$_GET['name'] = str_ireplace(JSN_POWERADMIN_EXT_IDENTIFIED_NAME_PREFIX, '', $_GET['identified_name']);
$this->model->install($rs);
if ($this->model->install($rs)) {
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/extensions.php';
// Enable extension suport
$_GET['name'] = str_ireplace(JSN_POWERADMIN_EXT_IDENTIFIED_NAME_PREFIX, '', $_GET['identified_name']);
try {
JSNPaExtensionsHelper::enableExt($identifiedName);
} catch (Exception $ex) {
exit('notenabled');
}
}
} catch (Exception $ex) {
exit($ex->getMessage());
}
exit('success');
}
}
示例9: singleParamHtmlHolder
public function singleParamHtmlHolder($param, $value)
{
$output = '';
// Compatibility fixes
$old_names = array('yellow_message', 'blue_message', 'green_message', 'button_green', 'button_grey', 'button_yellow', 'button_blue', 'button_red', 'button_orange');
$new_names = array('alert-block', 'alert-info', 'alert-success', 'btn-success', 'btn', 'btn-info', 'btn-primary', 'btn-danger', 'btn-warning');
$value = str_ireplace($old_names, $new_names, $value);
$param_name = isset($param['param_name']) ? $param['param_name'] : '';
$type = isset($param['type']) ? $param['type'] : '';
$class = isset($param['class']) ? $param['class'] : '';
if ('attach_image' === $param['type'] && 'image' === $param_name) {
$output .= '<input type="hidden" class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" value="' . $value . '" />';
$element_icon = $this->settings('icon');
$img = wpb_getImageBySize(array('attach_id' => (int) preg_replace('/[^\\d]/', '', $value), 'thumb_size' => 'thumbnail'));
$this->setSettings('logo', ($img ? $img['thumbnail'] : '<img width="150" height="150" src="' . vc_asset_url('vc/blank.gif') . '" class="attachment-thumbnail vc_element-icon" data-name="' . $param_name . '" alt="" title="" style="display: none;" />') . '<span class="no_image_image vc_element-icon' . (!empty($element_icon) ? ' ' . $element_icon : '') . ($img && !empty($img['p_img_large'][0]) ? ' image-exists' : '') . '" /><a href="#" class="column_edit_trigger' . ($img && !empty($img['p_img_large'][0]) ? ' image-exists' : '') . '">' . __('Add image', 'js_composer') . '</a>');
$output .= $this->outputTitleTrue($this->settings['name']);
} elseif (!empty($param['holder'])) {
if ($param['holder'] === 'input') {
$output .= '<' . $param['holder'] . ' readonly="true" class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" value="' . $value . '">';
} elseif (in_array($param['holder'], array('img', 'iframe'))) {
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" src="' . $value . '">';
} elseif ($param['holder'] !== 'hidden') {
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
}
}
if (!empty($param['admin_label']) && $param['admin_label'] === true) {
$output .= '<span class="vc_admin_label admin_label_' . $param['param_name'] . (empty($value) ? ' hidden-label' : '') . '"><label>' . $param['heading'] . '</label>: ' . $value . '</span>';
}
return $output;
}
示例10: basePathLib
function basePathLib($relative_path)
{
$scriptName = str_replace('/class/image.class.php', '', $_SERVER['SCRIPT_NAME']);
$realpath = str_replace('\\', '/', realpath($relative_path));
$htmlpath = str_ireplace(str_replace('\\', '/', ROOT_DIR), '', $realpath);
return $htmlpath;
}
示例11: load
/**
* Autoloader load method. Load the class.
*
* @param $class_name
*/
public function load($class_name)
{
// Only load DLM
if (0 === strpos($class_name, 'DLM_')) {
// String to lower
$class_name = strtolower($class_name);
// Format file name
$file_name = 'class-' . str_ireplace('_', '-', str_ireplace('DLM_', 'dlm-', $class_name)) . '.php';
// Setup the file path
$file_path = $this->path;
// Check if we need to extend the class path
if (strpos($class_name, 'dlm_admin') === 0) {
$file_path .= 'admin/';
} else {
if (strpos($class_name, 'dlm_widget') === 0) {
$file_path .= 'widgets/';
} else {
if (strpos($class_name, 'dlm_product') === 0) {
$file_path .= 'product/';
}
}
}
// Append file name to clas path
$file_path .= $file_name;
// Check & load file
if (file_exists($file_path)) {
require_once $file_path;
}
}
}
示例12: createFolder
/**
* Create missing folders
*
* @copyright
* @author RolandD
* @todo
* @see
* @access public
* @param
* @return
* @since 3.0
*/
public function createFolder()
{
$app = JFactory::getApplication();
jimport('joomla.filesystem.folder');
$folder = str_ireplace(JPATH_ROOT, '', JRequest::getVar('folder'));
return JFolder::create($folder);
}
示例13: migrate_authors
function migrate_authors($string)
{
$result = '';
$array = array();
$new_authors = array();
$string = str_ireplace(' and ', ' , ', $string);
$string = str_ireplace(', and ', ' , ', $string);
$string = str_ireplace(',and ', ' , ', $string);
$string = str_ireplace(';', ',', $string);
$array = explode(',', $string);
$array = array_filter($array);
if (!empty($array)) {
foreach ($array as $author) {
$author = trim($author);
$author = str_replace('"', '', $author);
$space = strpos($author, ' ');
if ($space === false) {
$last = trim($author);
$first = '';
} else {
$last = trim(substr($author, 0, $space));
$first = trim(substr($author, $space + 1));
}
if (!empty($last)) {
$new_authors[] = 'L:"' . $last . '",F:"' . $first . '"';
}
}
if (count($new_authors) > 0) {
$result = join(';', $new_authors);
}
}
return $result;
}
示例14: wpui_slide_shortcode
function wpui_slide_shortcode($atts, $content = null)
{
extract(shortcode_atts(array('image' => false, 'image_title' => false), $atts));
if ($image_title) {
$imagea = wpui_get_media_item($image_title);
}
$image = $imagea['image'];
if (!$image || !function_exists('getimagesize')) {
return false;
}
if (is_array($imagea)) {
$img_title = $imagea['title'];
} else {
$filename = substr(strrchr($image, '/'), 1);
$filename = str_ireplace(strrchr($filename, '.'), '', $filename);
$img_title = $filename;
}
$samp = getimagesize($image);
if (!is_array($samp)) {
return "Not a valid image.";
}
$output = '';
$output .= '<h3 class="wp-tab-title">' . $imagea['title'] . '</h3>';
$output .= '<div class="wpui-slide wp-tab-content">';
$output .= '<img src="' . $image . '" />';
$output .= '<div class="wpui_image_description">' . $content . '</div>';
$output .= '</div><!-- end .wpui-slide -->';
return $output;
}
示例15: __construct
/**
*
* @param Mongostar_Model_Interface $model
* @param string $foreign_class_name
* @param array $options
* @param string $property_name
*/
public function __construct(Mongostar_Model_Interface $model, $foreign_class_name, array $options, $property_name)
{
$this->_foreign_class_name = $foreign_class_name;
$this->set_relation_name($property_name);
$this->_local_class_name = get_class($model);
if (isset($options['foreignKey'])) {
$this->_foreign_key = $options['foreignKey'];
} else {
$this->_foreign_key = $property_name . '_id';
}
if (isset($options['foreignSort'])) {
$sort_key = $options['foreignSort'];
$sort_dir = 1;
if (strpos(':', $sort_key)) {
$sort_key = explode(':', $sort_key);
$sort_dir = $sort_key[1];
$sort_key = $sort_key[0];
$sort_dir = (int) str_ireplace(array('asc', 'desc'), array(0, 1), $sort_dir);
}
$this->_foreign_sort[$sort_key] = $sort_dir;
}
if (isset($options['localKey'])) {
$this->_local_key = $options['localKey'];
} else {
$this->_localKey = 'id';
}
}