本文整理汇总了PHP中str_Replace函数的典型用法代码示例。如果您正苦于以下问题:PHP str_Replace函数的具体用法?PHP str_Replace怎么用?PHP str_Replace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了str_Replace函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: generateOptions
function generateOptions(&$xml)
{
$template = (string) $this->_xml;
$cssfile = NextendFilesystem::translateToMediaPath(str_replace(DIRECTORY_SEPARATOR, '/', dirname($this->_form->_xmlfile)) . '/style.');
$css = NextendCss::getInstance();
if (NextendFilesystem::fileexists($cssfile . 'less')) {
$css->enableLess();
$cssfile .= 'less';
$css->addCssFile(array($cssfile, $cssfile, array('id' => 'body')));
} else {
$cssfile .= 'css';
$css->addCssFile($cssfile);
}
$prefix = NextendXmlGetAttribute($this->_xml, 'prefix');
$this->_values = array();
$html = '';
foreach ($xml->option as $option) {
$v = NextendXmlGetAttribute($option, 'value');
$this->_values[] = $v;
if ($v != -1) {
$info = pathinfo($v);
$class = $prefix . basename($v, '.' . $info['extension']);
$html .= '
<div class="nextend-radio-option nextend-imagelist-option' . $this->isSelected($v) . '">
' . str_Replace('{image}', NextendUri::pathToUri($v), str_Replace('{class}', $class, $template)) . '
</div>';
} else {
$html .= '<div class="nextend-radio-option' . $this->isSelected($v) . '">' . (string) $option . '</div>';
}
}
return $html;
}
开发者ID:pguilford,项目名称:vcomcc,代码行数:32,代码来源:cssimagelist.php
示例2: parse
/**
* Parse the given file for apprentices and mentors.
*
* @param string $file Path to the File to parse.
*
* @return array
*/
public function parse($file)
{
$return = array('mentors' => array(), 'apprentices' => array());
$content = file_Get_contents($file);
$content = str_Replace('<local-time', '<span tag="local-time"', $content);
$content = str_Replace('</local-time', '</span', $content);
$content = str_Replace('<time', '<span tag="time"', $content);
$content = str_Replace('</time', '</span', $content);
$this->dom = new \DomDocument('1.0', 'UTF-8');
$this->dom->strictErrorChecking = false;
libxml_use_internal_errors(true);
$this->dom->loadHTML('<?xml encoding="UTF-8" ?>' . $content);
libxml_use_internal_errors(false);
$xpathMentors = new \DOMXPath($this->dom);
$mentors = $xpathMentors->query('//a[@id="user-content-mentors-currently-accepting-an-apprentice"]/../following-sibling::ul[1]/li');
foreach ($mentors as $mentor) {
$user = $this->parseUser($mentor);
if (!$user) {
continue;
}
$user['type'] = 'mentor';
$return['mentors'][] = $user;
}
$xpathApprentices = new \DOMXPath($this->dom);
$apprentices = $xpathApprentices->query('//a[@id="user-content-apprentices-currently-accepting-mentors"]/../following-sibling::ul[1]/li');
foreach ($apprentices as $apprentice) {
$user = $this->parseUser($apprentice);
if (!$user) {
continue;
}
$user['type'] = 'apprentice';
$return['apprentices'][] = $user;
}
return $return;
}
开发者ID:tsilvers,项目名称:php.ug,代码行数:42,代码来源:Mentoring.php
示例3: send_im
function send_im($user, $recipient, $message, $opt, &$errors)
{
global $config, $lang_set;
$sip_msg = "MESSAGE\n" . addslashes($recipient) . "\n" . ".\n" . "From: " . $user->get_uri() . "\n" . "To: <" . addslashes($recipient) . ">\n" . "p-version: " . $config->psignature . "\n" . "Contact: <" . $config->web_contact . ">\n" . "Content-Type: text/plain; charset=" . $lang_set['charset'] . "\n.\n" . str_Replace("\n.\n", "\n. \n", $message) . "\n.\n\n";
if ($config->use_rpc) {
if (!$this->connect_to_xml_rpc(null, $errors)) {
return false;
}
$params = array(new XML_RPC_Value($sip_msg, 'string'));
$msg = new XML_RPC_Message('t_uac_dlg', $params);
$res = $this->rpc->send($msg);
if ($this->rpc_is_error($res)) {
log_errors($res, $errors);
return false;
}
} else {
/* construct FIFO command */
$fifo_cmd = ":t_uac_dlg:" . $config->reply_fifo_filename . "\n" . $sip_msg;
if (false === write2fifo($fifo_cmd, $errors, $status)) {
return false;
}
/* we accept any status code beginning with 2 as ok */
if (substr($status, 0, 1) != "2") {
$errors[] = $status;
return false;
}
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:29,代码来源:method.send_im.php
示例4: beforeSave
public function beforeSave($event, $entity, $options)
{
if ($entity->get('Archive')['tmp_name'] != '') {
switch ($entity->get('Archive')['type']) {
case "application/x-rar":
break;
case "application/zip":
case "application/octet-stream":
case "application/x-zip-compressed":
case "application/x-zip":
$zip = new \ZipArchive();
$zip->open($entity->get('Archive')['tmp_name']);
for ($i = 0; $i < $zip->numFiles; $i++) {
$filepath = pathinfo($zip->getNameIndex($i));
if ($filepath['basename'] == $entity->get('dmname')) {
$fd = fopen(WWW_ROOT . 'tmp/mods/' . $zip->getNameIndex($i), 'r');
if ($fd) {
rewind($fd);
while (($line = fgets($fd)) !== false) {
if (strpos($line, '#disableoldnations') !== false) {
$entity->set('disableoldnations', 1);
}
$arr = explode(' ', $line);
switch ($arr[0]) {
case '--':
break;
case '#version':
$entity->set('version', trim(substr($line, strlen('#version '))));
break;
case '#description':
$entity->set('description', trim(str_replace('"', '', substr($line, strlen('#description ')))));
break;
case '#modname':
$entity->set('name', trim(str_replace('"', '', substr($line, strlen('#modname ')))));
break;
case '#icon':
$entity->set('icon', trim(str_Replace('"', '', substr($line, strlen('#icon ')))));
break;
}
}
fclose($fd);
}
$zip->close();
return true;
}
}
break;
}
return true;
}
}
开发者ID:Moggers,项目名称:blitzserver,代码行数:51,代码来源:ModsTable.php
示例5: epl_load_core_templates
function epl_load_core_templates($template)
{
global $epl_settings;
$template_path = epl_get_content_path();
if (isset($epl_settings['epl_feeling_lucky']) && $epl_settings['epl_feeling_lucky'] == 'on') {
return $template;
}
$post_tpl = '';
if (is_epl_post_single()) {
$common_tpl = apply_filters('epl_common_single_template', 'single-listing.php');
$post_tpl = 'single-' . str_Replace('_', '-', get_post_type()) . '.php';
$find[] = $post_tpl;
$find[] = epl_template_path() . $post_tpl;
$find[] = $common_tpl;
$find[] = epl_template_path() . $common_tpl;
} elseif (is_epl_post_archive()) {
$common_tpl = apply_filters('epl_common_archive_template', 'archive-listing.php');
$post_tpl = 'archive-' . str_Replace('_', '-', get_post_type()) . '.php';
$find[] = $post_tpl;
$find[] = epl_template_path() . $post_tpl;
$find[] = $common_tpl;
$find[] = epl_template_path() . $common_tpl;
} elseif (is_tax('location') || is_tax('tax_feature')) {
$term = get_queried_object();
$common_tpl = apply_filters('epl_common_taxonomy_template', 'archive-listing.php');
$post_tpl = 'taxonomy-' . $term->taxonomy . '.php';
$find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
$find[] = epl_template_path() . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
$find[] = 'taxonomy-' . $term->taxonomy . '.php';
$find[] = epl_template_path() . 'taxonomy-' . $term->taxonomy . '.php';
$find[] = $common_tpl;
$find[] = $post_tpl;
$find[] = epl_template_path() . $common_tpl;
}
if ($post_tpl) {
$template = locate_template(array_unique($find));
if (!$template) {
$template = $template_path . $common_tpl;
}
}
return $template;
}
开发者ID:ksan5835,项目名称:rankproperties,代码行数:42,代码来源:themes.php
示例6: addFile
function addFile($name, $force = false, $handleRequire = false, $patches = array())
{
global $buffer, $filesDone;
$unixname = str_replace(DS, '/', $name);
//already done/skip?
if (in_array($unixname, $filesDone) && $force == false) {
return;
}
if ('vendors/' != substr($name, 0, 8)) {
//malformed filename?
if (basename($name) != strtolower(basename($name))) {
die("uppercase filename violation: '{$name}'\n");
}
}
$txt = trim(file_get_contents($name));
if ($txt === false) {
die("cannot open '{$name}'\n");
}
echo "** {$name}\n";
// remove preamble / closing tag
if (substr($txt, 0, 5) == '<?php') {
$txt = substr($txt, 5);
}
if (substr($txt, 0, 2) == '<?') {
$txt = substr($txt, 2);
}
if (substr($txt, -2, 2) == '?>') {
$txt = substr($txt, 0, strlen($txt) - 2);
}
if ($handleRequire) {
$txt = str_Replace("require", "//require", $txt);
}
foreach ($patches as $s => $d) {
$txt = str_replace($s, $d, $txt);
}
$buffer .= "\n\n//============ {$name} =======================================================\n\n{$txt}\n\n";
$filesDone[] = $name;
}
开发者ID:emente,项目名称:kataii---kata-framework-2.x,代码行数:38,代码来源:package.php
示例7: parseFile
/**
* parse a dictionary-file to create an ini-file from it.
*
* @param string $locale Parse the file for the given locale
*
* @throws \Org\Heigl\Hyphenator\Exception\PathNotFoundException
* @return string
*/
public static function parseFile($locale)
{
$path = self::$_fileLocation . DIRECTORY_SEPARATOR;
$file = $path . 'hyph_' . $locale . '.dic';
if (!file_Exists($file)) {
throw new \Org\Heigl\Hyphenator\Exception\PathNotFoundException('The given Path does not exist');
}
$items = file($file);
$source = trim($items[0]);
if (0 === strpos($source, 'ISO8859')) {
$source = str_Replace('ISO8859', 'ISO-8859', $source);
}
unset($items[0]);
$fh = fopen($path . $locale . '.ini', 'w+');
foreach ($items as $item) {
// Remove comment-lines starting with '#' or '%'.
if (in_array(mb_substr($item, 0, 1), array('#', '%'))) {
continue;
}
// Ignore empty lines.
if ('' == trim($item)) {
continue;
}
// Remove all Upper-case items as they are OOo-specific
if ($item === mb_strtoupper($item)) {
continue;
}
// Ignore lines containing an '=' sign as these are specific
// instructions for non-standard-hyphenations. These will be
// implemented later.
if (false !== mb_strpos($item, '=')) {
continue;
}
$item = mb_convert_Encoding($item, 'UTF-8', $source);
$result = Pattern::factory($item);
$string = '@:' . $result->getText() . ' = "' . $result->getPattern() . '"' . "\n";
fwrite($fh, $string);
}
fclose($fh);
return $path . $locale . '.ini';
}
开发者ID:heiglandreas,项目名称:Org_Heigl_Hyphenator,代码行数:49,代码来源:Dictionary.php
示例8: write_channel_config
function write_channel_config($table, $webdbs)
{
global $db, $pre;
if (is_array($webdbs)) {
foreach ($webdbs as $key => $value) {
if (is_array($value)) {
$webdbs[$key] = $value = implode(",", $value);
}
$SQL2 .= "'{$key}',";
$SQL .= "('{$key}', '{$value}', ''),";
}
$SQL = $SQL . ";";
$SQL = str_Replace("'),;", "')", $SQL);
$db->query(" DELETE FROM {$table} WHERE c_key IN ({$SQL2}'') ");
$db->query(" INSERT INTO `{$table}` VALUES {$SQL} ");
}
}
开发者ID:GHubgenius,项目名称:qbbj,代码行数:17,代码来源:global.php
示例9: make_html
$show = "暂无...";
}
//真静态
if ($webdb[NewsMakeHtml] == 1 || $gethtmlurl) {
$show = make_html($show, $pagetype = 'N');
} elseif ($webdb[NewsMakeHtml] == 2) {
$show = fake_html($show);
}
if ($webdb[RewriteUrl] == 1) {
//全站伪静态
rewrite_url($show);
}
$show = "<ul>{$show}</ul>";
$show = str_Replace("'", '"', $show);
$show = str_Replace("\r", '', $show);
$show = str_Replace("\n", '', $show);
$show = "document.write('{$show}');";
echo $show;
} else {
die("document.write('指定的类型不存在');");
}
function get_fid($fid)
{
global $db, $pre;
$fid = intval($fid);
$F[] = " fid={$fid} ";
$query = $db->query("SELECT fid FROM {$pre}spsort WHERE fup='{$fid}'");
while ($rs = $db->fetch_array($query)) {
$F[] = " fid={$rs['fid']} ";
}
return $F;
开发者ID:GHubgenius,项目名称:qbbj,代码行数:31,代码来源:jsspecial.php
示例10: dirname
$module_id .= " </select>";
require dirname(__FILE__) . "/" . "head.php";
require dirname(__FILE__) . "/" . "template/fu_sort/menu.htm";
require dirname(__FILE__) . "/" . "template/fu_sort/batch_edit.htm";
require dirname(__FILE__) . "/" . "foot.php";
} elseif ($action == 'batch_edit' && $Apower[fu_sort_power]) {
if (!$ifchang && !$db_index_showtitle && !$db_sonTitleRow && !$db_sonTitleLeng && !$db_cachetime) {
showmsg("请选择要修改哪个属性");
}
$postdb[allowpost] = @implode(",", $postdb[allowpost]);
$postdb[allowviewtitle] = @implode(",", $postdb[allowviewtitle]);
$postdb[allowviewcontent] = @implode(",", $postdb[allowviewcontent]);
$postdb[allowdownload] = @implode(",", $postdb[allowdownload]);
$postdb[template] = @serialize($postdb[tpl]);
/*缺少对版主有效用户名的检测*/
$postdb[admin] = str_Replace(",", ",", $postdb[admin]);
foreach ($fiddb as $fid => $name) {
unset($SQL);
$postdb[fid] = $fid;
//检查父栏目是否有问题
$ifchang[fup] && check_fup("{$pre}fu_sort", $postdb[fid], $postdb[fup]);
$ifchang[fup] && ($rs_fid = $db->get_one("SELECT * FROM {$pre}fu_sort WHERE fid='{$postdb['fid']}'"));
if ($ifchang[fup] && $rs_fid[fup] != $postdb[fup]) {
$rs_fup = $db->get_one("SELECT class FROM {$pre}fu_sort WHERE fup='{$postdb['fup']}' ");
$newclass = $rs_fup['class'] + 1;
$db->query("UPDATE {$pre}fu_sort SET sons=sons+1 WHERE fup='{$postdb['fup']}' ");
$db->query("UPDATE {$pre}fu_sort SET sons=sons-1 WHERE fup='{$rs_fid['fup']}' ");
$SQL = ",class={$newclass}";
}
if ($ifchang[admin] && $postdb[admin]) {
$detail = explode(",", $postdb[admin]);
开发者ID:GHubgenius,项目名称:qbbj,代码行数:31,代码来源:fu_sort.php
示例11: pri
function pri(&$x)
{
$x = print_r($x, 1);
$x = Preg_replace(array("~Array\n[ ]{2,}\\(\n[ ]{2,}~", "~Array\n\\(~", "~ \\[~"), array("A:\n ", '', '['), $x);
#return $x;
$x = str_ireplace(array(' =>', ' =>'), ':', $x);
$x = trim($x, ")\n");
return htmlentities(trim(str_Replace(array(" => Array\n (", " )\n\n", " "), array(">", "", ' '), $x), ' )'));
#
}
开发者ID:Ben749,项目名称:racetrack,代码行数:10,代码来源:fun.php
示例12: trim
$domain = trim($_POST['new_subdomain']);
$domain = str_Replace("https://", "", $domain);
$domain = str_Replace("http://", "", $domain);
$domain = substr($domain, strpos($domain, '.') + 1);
$pattern = "/(.*?)\\." . $domain . "/";
$core_config['script']['multiple_webspace_pattern'] = $pattern;
writeToConfig('$core_config[\'script\'][\'multiple_webspace_pattern\']', $pattern);
writeToConfig('$core_config[\'script\'][\'single_webspace\']', '');
$core_domain = $domain;
$core_domain = $http . "://" . $core_domain;
writeToConfig('$core_config[\'script\'][\'core_domain\']', $core_domain);
writeToConfig('$core_config[\'registration\'][\'allow_registration\']', 1);
} else {
$_POST['new_domain'] = trim($_POST['new_domain']);
$_POST['new_domain'] = str_Replace("https://", "", $_POST['new_domain']);
$_POST['new_domain'] = str_Replace("http://", "", $_POST['new_domain']);
writeToConfig('$core_config[\'script\'][\'multiple_webspace_pattern\']', '');
writeToConfig('$core_config[\'script\'][\'single_webspace\']', $openid_name);
$core_domain = $http . "://" . $_POST['new_domain'];
$core_config['script']['core_domain'] = $core_domain;
writeToConfig('$core_config[\'script\'][\'core_domain\']', $core_domain);
writeToConfig('$core_config[\'registration\'][\'allow_registration\']', 0);
}
// create database --------------
$core_config['db']['host'] = $_POST['database_host'];
$core_config['db']['user'] = $_POST['database_user'];
$core_config['db']['pass'] = $_POST['database_password'];
$core_config['db']['db'] = $_POST['database_db'];
$connection = @mysql_connect($core_config['db']['host'], $core_config['db']['user'], $core_config['db']['pass']);
if (!is_resource($connection)) {
$GLOBALS['script_error_log'][] = _("The database connection could not be created. Please check your database settings.");
开发者ID:apotek,项目名称:prairie-openid2-server,代码行数:31,代码来源:installer.php
示例13: chrToHTML
function chrToHTML($Str)
{
$Str = str_Replace(CHR(10), "<br />", $Str);
$Str = str_Replace(CHR(32), " ", $Str);
$Str = str_Replace(CHR(9), " ", $Str);
$Str = str_Replace(CHR(34), """, $Str);
$Str = str_Replace(CHR(39), "'", $Str);
$Str = str_Replace(CHR(13), "", $Str);
$Str = str_Replace(CHR(10) & CHR(10), "<p>", $Str);
return $Str;
}
开发者ID:a195474368,项目名称:ejw,代码行数:11,代码来源:library.php
示例14: FilterHtml
function FilterHtml($str)
{
$str = str_Replace("'", "´", $str);
//'Str = Replace(Str,",",",")
return $str;
}
开发者ID:a195474368,项目名称:ejw,代码行数:6,代码来源:filter.php
示例15: uploadFile
function uploadFile($dir, $file, $ext = "", $resize = false, $force = false, $fileName = "", $createDir = true, $action = '', $toLower = true, $createThumb = false)
{
$extValid = true;
$error = false;
$errorLine = '';
$thumbName = '';
$thumbDir = '';
//die('aaa'.$force);
//die($file['name']);
//if(!is_dir($dir) && !$force) {die('aaa');}
//print_r($file);
//die();
//echo '[dir: '. $dir .']';
if (!is_dir($dir)) {
if ($createDir) {
mkdir($dir);
} else {
$error = true;
$errorLine = 'Diretorio nao encontrado!';
}
} else {
if ($file['name'] == '' && !$force) {
return array(true, '');
}
}
/*if(!is_dir($dir) && $createDir) {
mkdir($dir);
} else if(!is_dir($dir) && !$createDir){
$error = true;
$errorLine = 'Diretorio nao encontrado!';
}*/
/*print_r($file);
$is_uploaded = is_uploaded_file($file['tmp_name']);
$success = move_uploaded_file($file['tmp_name'], $dir);
echo $is_uploaded;
if($success) {
return 'upload';
} else {
return 'bosta';
}*/
//if($file['size'] <= 5000000) {
if ($toLower) {
$file_explode = explode(".", $file['name']);
$file_explode_end = end($file_explode);
/*
echo '<br><br>+++|';
print_r($file_explode);
echo '|+++';
echo '<br><br>+++|';
print_r($file_explode_end);
echo '|+++';
*/
$fileExt = strtolower($file_explode_end);
// echo '<br><br>+++|';
// print_r($fileExt);
// echo '|+++';
} else {
$fileExt = end(explode(".", $file['name']));
}
if ($ext) {
$extValid = in_array($fileExt, $ext);
}
/*
echo '<br><br>+++|';
print_r($ext);
echo '|+++';
die();
*/
if ($file['name'] && $extValid) {
$fileTemp = $file['tmp_name'];
//echo $fileTemp .'|||';
if ($fileName) {
$filename = $fileName;
} else {
if ($toLower) {
$filename = strtolower($file['name']);
} else {
$filename = $file['name'];
}
}
if (file_exists($dir . $filename)) {
//echo 'AQUIiiii';
$fileNameExt = explode('.', $filename);
$fileExtension = end(explode('.', $filename));
$newFileName = '';
for ($x = 0; $x < count($fileNameExt) - 1; $x++) {
$newFileName .= $fileNameExt[$x] . '.';
}
$newFileName = subStr($newFileName, 0, -1);
$filename = $newFileName . '_' . date('dmyHis') . '.' . $fileExtension;
}
$filename = str_Replace(' ', '_', $filename);
//echo $fileTemp;
if (!is_uploaded_file($fileTemp)) {
$error = true;
$errorLine .= "001 Erro ao efetuar upload do arquivo: " . $file["name"] . "\n";
} else {
//.........这里部分代码省略.........
开发者ID:indirasam,项目名称:aquitemmata,代码行数:101,代码来源:upload-file.php
示例16: str_Replace
<?php
$cookieDomain = str_Replace('www.', '', $_SERVER['SERVER_NAME']);
ini_set("session.cookie_domain", $cookieDomain);
if (defined('ZF2')) {
if (isset($loader)) {
$loader->add('Zend', ZF2);
$loader->add('COM', LIB);
} else {
include ZF2 . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array('COM' => LIB . '/COM', 'Pingpp' => LIB . '/COM/Service/pingpp-php/lib'))));
}
}
if (!class_exists('Zend\\Loader\\AutoloaderFactory')) {
throw new RuntimeException('Unable to load ZF2');
}
开发者ID:onlineshine,项目名称:myzf,代码行数:16,代码来源:init_autoload.php
示例17: ereg_Replace
$weather->set_icao($icao);
if (!$weather->get_metar()) {
continue;
}
//there is no avaiable metar data
$text = new $text_type($weather);
$message = $text->print_pretty();
//delete html tags from phpweather otuput
$message = ereg_Replace("<[^>]*>", "", $message);
//replace special chars in phpweather otuput
$message = str_Replace(" ", " ", $message);
$message = str_Replace("°", "°", $message);
$send_na = false;
//successfully get data for user, not to need send n/a message
/* construct FIFO command */
$fifo_cmd = ":t_uac_from:" . $config->reply_fifo_filename . "\n" . "MESSAGE\n" . $config->metar_from_sip_uri . "\n" . "sip:" . $row->username . "@" . $config->default_domain . "\n" . "p-version: " . $config->psignature . "\n" . "Contact: " . $config->web_contact . "\n" . "Content-Type: text/plain; charset=UTF-8\n\n" . str_Replace("\n.\n", "\n. \n", $message) . "\n.\n\n";
write2fifo($fifo_cmd, $errors, $status);
if ($errors) {
foreach ($errors as $err) {
echo $err . "\n";
}
unset($errors);
continue;
}
/* we accept any status code beginning with 2 as ok */
if (substr($status, 0, 1) != "2") {
echo $status . "\n";
continue;
}
}
if ($send_na) {
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:31,代码来源:send_metar.php
示例18: SortSon
function SortSon($table = '', $fid = '0', $showsons = 1)
{
global $db;
$query = $db->query("select fid,name,sons,class from {$table} where fup='{$fid}' order by list");
while (@extract($db->fetch_array($query))) {
$topico = $this->BlankIcon($class);
$name = str_Replace('"', "", $name);
//$show.="{$topico}<a href='javascript:guide_link($fid);'>$name</a><br>";
$show .= "{$topico}<a href='list.php?fid={$fid}'>{$name}</a><br>";
if ($showsons) {
$show .= $this->SortSon($table, $fid, $showsons);
}
}
return $show;
}
开发者ID:GHubgenius,项目名称:qbbj,代码行数:15,代码来源:class.inc.php
示例19: parseBBCode
static function parseBBCode($text, $parsing = true, $emoticons = true)
{
$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text);
$text = " " . $text;
if (!(strpos($text, "[") && strpos($text, "]"))) {
// Remove padding, return.
$text = substr($text, 1);
return $text;
}
$matches = array();
// PARSING ALL
if ($parsing) {
$randomSuffix = rand();
$matches = array("#\\[class=(.*?)\\](.*?)\\[/class\\]#si" => "<span class=\"\$1\">\$2</span>", "#\\[b\\](.*?)\\[/b\\]#si" => "<b>\$1</b>", "#\\[u\\](.*?)\\[/u\\]#si" => "<u>\$1</u>", "#\\[i\\](.*?)\\[/i\\]#si" => "<i>\$1</i>", "#\\[strike\\](.*?)\\[/strike\\]#si" => "<span class=\"lineThrough\">\$1</span>", "#\\[list\\](.*?)\\[/list\\]#si" => "<ul>\$1</ul>", "#\\[list=(.*?)\\](.*?)\\[/list\\]#si" => "<ul class=\"\$1\">\$2</ul>", "#\\[\\*\\]#si" => "<li>", "#\\[hr\\]#si" => "<hr>", "#\\[bgcolor=(\\#[0-9A-F]{6}|[a-z]+)\\](.*?)\\[/bgcolor\\]#si" => "<font style=\"background-color:\$1\">\$2</font>", "#\\[t_left\\](.*?)\\[/t_left\\]#si" => "<div align=\"left\">\$1</div>", "#\\[t_center\\](.*?)\\[/t_center\\]#si" => "<div align=\"center\">\$1</div>", "#\\[t_right\\](.*?)\\[/t_right\\]#si" => "<div align=\"right\">\$1</div>", "#\\[t_justify\\](.*?)\\[/t_justify\\]#si" => "<div align=\"justify\">\$1</div>", "#\\[img\\](.*?)\\[/img\\]#si" => "<img src=\"\$1\" alt=\"\" title=\"\" border=\"0\">", "#\\[img=(.*?)\\](.*?)\\[/img\\]#si" => "<img src=\"\$2\" align=\"\$1\" alt=\"\" title=\"\" border=\"0\">", "#\\[flash=(.*?)x(.*?)\\](.*?)\\[/flash\\]#si" => "<div id=\"flash" . $randomSuffix . "\" align=\"center\"> </div><script language=\"Javascript\" type=\"text/javascript\">loaderSWF('\$3','flash" . $randomSuffix . "',\$1,\$2);</script>\n", "#\\[doc=(.*?)\\](.*?)\\[/doc\\]#si" => "<a href=\"\$1\" target=\"_blank\" class=\"bbCodeLink\">\$2</a>", "#\\[doc=(.*?)~(.*?)\\](.*?)\\[/doc\\]#si" => "<img src=\"" . _BBCODEICONSPATH . "/\$1\" alt=\"\" border=0 align=\"absmiddle\"> <a href=\"\$2\" target=\"_blank\" class=\"bbCodeLink\">\$3</a>", "#\\[url=([a-z]+?://){1}([a-z0-9\\-\\.,\\?!%\\*_\\#:;~\\&\$@\\/=\\+\\(\\)]+) t=(_blank|_parent)\\](.*?)\\[/url\\]#si" => "<a href=\"\$1\$2\" target=\"_blank\" class=\"bbCodeLink\">\$4</a>", "#\\[url=([a-z0-9\\-\\.,\\?!%\\*_\\#:;~\\&\$@\\/=\\+\\(\\)]+) t=(_blank|_parent)\\](.*?)\\[/url\\]#si" => "<a href=\"\$1\" target=\"_blank\" class=\"bbCodeLink\">\$3</a>", "#\\[email=(.*?)\\](.*?)\\[/email\\]#si" => "<a href=\"mailto:\$1\" class=\"bbCodeLink\">\$2</a>", "#\\[gmaps=([0-9]{1,3})x([0-9]{1,3})\\]([a-z]+?://){1}([a-z0-9\\-\\.,'\\?!%\\*_\\#:;~\\&\$@\\/=\\+\\(\\)maps.google]+)\\[/gmaps\\]#si" => "<iframe width=\"\$1\" height=\"\$2\"\r\n\t\t\t\t\t\t\tframeborder=\"0\" scrolling=\"no\"\r\n\t\t\t\t\t\t\tmarginheight=\"0\" marginwidth=\"0\"\r\n\t\t\t\t\t\t\tsrc=\"\$3\$4\">\r\n\t\t\t\t\t\t</iframe>\n", "#\\[font=(.*?)\\](.*?)\\[/font\\]#si" => "<font face=\"\$1\">\$2</font>", "#\\[size=(.*?)x(.*?)\\](.*?)\\[/size\\]#si" => "<font size=\"\$1\"><span class=\"bbCode\$1\">\$3</span></font>", "#\\[color=(\\#[0-9A-F]{6}|[a-z]+)\\](.*?)\\[/color\\]#si" => "<font color=\"\$1\">\$2</font>");
// EMOTICONS
if ($emoticons) {
$model = new App_Model_Db_Table_Bbcode();
$res = $model->fetchAll();
$num = count($res);
$info = smilesArray($res);
$zz = 0;
if ($num > 0) {
for ($zz = 0; $zz < $num; $zz++) {
$theSmile = $info[$zz]['code'];
$theImage = $info[$zz]['image'];
/* Modified by Fabrizio Parrella */
$theSmile = str_replace('"', '\\"', $theSmile);
$theSmile = preg_quote($theSmile);
$theSmile = str_replace("/", "\\/", $theSmile);
$orig[] = '/\\[' . $theSmile . '\\]/si';
$repl[] = ' <img src="' . _EMOTICONSPATH . '/' . $theImage . '" alt="" border="0" align="absmiddle" /> ';
}
$text = @preg_replace($orig, $repl, $text);
}
}
## End emoticons
} else {
$matches = array("#\\[class=(.*?)\\](.*?)\\[/class\\]#si" => "", "#\\[b\\](.*?)\\[/b\\]#si" => "", "#\\[u\\](.*?)\\[/u\\]#si" => "", "#\\[i\\](.*?)\\[/i\\]#si" => "", "#\\[strike\\](.*?)\\[/strike\\]#si" => "", "#\\[list\\](.*?)\\[/list\\]#si" => "", "#\\[list=(.*?)\\](.*?)\\[/list\\]#si" => "", "#\\[\\*\\]#si" => "", "#\\[hr\\]#si" => "", "#\\[bgcolor=(\\#[0-9A-F]{6}|[a-z]+)\\](.*?)\\[/bgcolor\\]#si" => "", "#\\[t_left\\](.*?)\\[/t_left\\]#si" => "", "#\\[t_center\\](.*?)\\[/t_center\\]#si" => "", "#\\[t_right\\](.*?)\\[/t_right\\]#si" => "", "#\\[t_justify\\](.*?)\\[/t_justify\\]#si" => "", "#\\[img\\](.*?)\\[/img\\]#si" => "", "#\\[img=(.*?)\\](.*?)\\[/img\\]#si" => "", "#\\[flash=(.*?)x(.*?)\\](.*?)\\[/flash\\]#si" => "", "#\\[doc=(.*?)\\](.*?)\\[/doc\\]#si" => "", "#\\[doc=(.*?)~(.*?)\\](.*?)\\[/doc\\]#si" => "", "#\\[url=([a-z]+?://){1}([a-z0-9\\-\\.,\\?!%\\*_\\#:;~\\&\$@\\/=\\+\\(\\)]+) t=(_blank|_parent)\\](.*?)\\[/url\\]#si" => "", "#\\[url=([a-z0-9\\-\\.,\\?!%\\*_\\#:;~\\&\$@\\/=\\+\\(\\)]+) t=(_blank|_parent)\\](.*?)\\[/url\\]#si" => "", "#\\[email=(.*?)\\](.*?)\\[/email\\]#si" => "", "#\\[gmaps=([0-9]{1,3})x([0-9]{1,3})\\]([a-z]+?://){1}([a-z0-9\\-\\.,'\\?!%\\*_\\#:;~\\&\$@\\/=\\+\\(\\)maps.google]+)\\[/gmaps\\]#si" => "", "#\\[font=(.*?)\\](.*?)\\[/font\\]#si" => "", "#\\[size=(.*?)x(.*?)\\](.*?)\\[/size\\]#si" => "", "#\\[color=(\\#[0-9A-F]{6}|[a-z]+)\\](.*?)\\[/color\\]#si" => "");
if ($emoticons) {
// $qry = " SELECT * FROM ".TBL_EMOTICONS." ";
// $res = $this->DBObject->SQL_Query($qry,$this->DBConnection); // ==> your own mysql_query
// $num = $this->DBObject->SQL_NumRows($res); // ==> your own mysql_num_rows
$model = new App_Model_Db_Table_Bbcode();
$res = $model->fetchAll();
$num = count($res);
$info = smilesArray($res);
$zz = 0;
if ($num > 0) {
for ($zz = 0; $zz < $num; $zz++) {
$theSmile = $info[$zz]['code'];
$theImage = $info[$zz]['image'];
/* Modified by Fabrizio Parrella */
$theSmile = str_replace('"', '\\"', $theSmile);
$theSmile = preg_quote($theSmile);
$theSmile = str_replace("/", "\\/", $theSmile);
$orig[] = '/\\[' . $theSmile . '\\]/si';
$repl[] = $theSmile;
}
$text = @preg_replace($orig, $repl, $text);
}
}
## End emoticons
}
## End normal parsing
// REPLACE ALL
$text = @preg_replace(array_keys($matches), array_values($matches), $text);
$text = str_Replace("\n", "<br>", $text);
return $text;
}
开发者ID:hukumonline,项目名称:pmg,代码行数:69,代码来源:Bbcode.php
示例20: str_Replace
<?php
$CONFIG = MSCore::modules()->getModuleConfig($module['module_name']);
$filename = str_Replace(PRFX, '', isset($CONFIG['table']['items']['db_name']) ? $CONFIG['table']['items']['db_name'] : $module['module_name']);
$table = PRFX . $filename;
MSCore::db()->execute('DROP TABLE `' . $table . '`', false);
开发者ID:pers1307,项目名称:modul-slider,代码行数:6,代码来源:uninstall.php
注:本文中的str_Replace函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论