本文整理汇总了PHP中join函数的典型用法代码示例。如果您正苦于以下问题:PHP join函数的具体用法?PHP join怎么用?PHP join使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了join函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start_el
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
$indent = $depth ? str_repeat("\t", $depth) : '';
$classes = empty($item->classes) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
$class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args, $depth));
/**
* Change WP's default classes to match Foundation's required classes
*/
$class_names = str_replace(array('menu-item-has-children'), array('has-submenu'), $class_names);
// ==========================
$class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : '';
$id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth);
$id = $id ? ' id="' . esc_attr($id) . '"' : '';
$output .= $indent . '<li' . $id . $class_names . '>';
$atts = array();
$atts['title'] = !empty($item->attr_title) ? $item->attr_title : '';
$atts['target'] = !empty($item->target) ? $item->target : '';
$atts['rel'] = !empty($item->xfn) ? $item->xfn : '';
$atts['href'] = !empty($item->url) ? $item->url : '';
$atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args, $depth);
$attributes = '';
foreach ($atts as $attr => $value) {
if (!empty($value)) {
$value = 'href' === $attr ? esc_url($value) : esc_attr($value);
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
$item_output = $args->before;
$item_output .= '<a' . $attributes . '>';
$item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
}
示例2: lang_getfrombrowser
/**
* determines the langauge settings of the browser, details see here:
* http://aktuell.de.selfhtml.org/artikel/php/httpsprache/
*/
function lang_getfrombrowser($allowed_languages, $default_language, $lang_variable = null, $strict_mode = true)
{
// $_SERVER['HTTP_ACCEPT_LANGUAGE'] verwenden, wenn keine Sprachvariable mitgegeben wurde
if ($lang_variable === null && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$lang_variable = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
}
// wurde irgendwelche Information mitgeschickt?
if (empty($lang_variable)) {
// Nein? => Standardsprache zurückgeben
return $default_language;
}
// Den Header auftrennen
$accepted_languages = preg_split('/,\\s*/', $lang_variable);
// Die Standardwerte einstellen
$current_lang = $default_language;
$current_q = 0;
// Nun alle mitgegebenen Sprachen abarbeiten
foreach ($accepted_languages as $accepted_language) {
// Alle Infos über diese Sprache rausholen
$res = preg_match('/^([a-z]{1,8}(?:-[a-z]{1,8})*)' . '(?:;\\s*q=(0(?:\\.[0-9]{1,3})?|1(?:\\.0{1,3})?))?$/i', $accepted_language, $matches);
// war die Syntax gültig?
if (!$res) {
// Nein? Dann ignorieren
continue;
}
// Sprachcode holen und dann sofort in die Einzelteile trennen
$lang_code = explode('-', $matches[1]);
// Wurde eine Qualität mitgegeben?
if (isset($matches[2])) {
// die Qualität benutzen
$lang_quality = (double) $matches[2];
} else {
// Kompabilitätsmodus: Qualität 1 annehmen
$lang_quality = 1.0;
}
// Bis der Sprachcode leer ist...
while (count($lang_code)) {
// mal sehen, ob der Sprachcode angeboten wird
if (in_array(strtolower(join('-', $lang_code)), $allowed_languages)) {
// Qualität anschauen
if ($lang_quality > $current_q) {
// diese Sprache verwenden
$current_lang = strtolower(join('-', $lang_code));
$current_q = $lang_quality;
// Hier die innere while-Schleife verlassen
break;
}
}
// Wenn wir im strengen Modus sind, die Sprache nicht versuchen zu minimalisieren
if ($strict_mode) {
// innere While-Schleife aufbrechen
break;
}
// den rechtesten Teil des Sprachcodes abschneiden
array_pop($lang_code);
}
}
// die gefundene Sprache zurückgeben
return $current_lang;
}
示例3: notify
public function notify($errno, $errstr, $errfile, $errline, $trace)
{
$body = array();
$body[] = $this->_makeSection("", join("\n", array(@$_SERVER['GATEWAY_INTERFACE'] ? "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" : "", "{$errno}: {$errstr}", "at {$errfile} on line {$errline}")));
if ($this->_whatToLog & self::LOG_TRACE && $trace) {
$body[] = $this->_makeSection("TRACE", Debug_ErrorHook_Util::backtraceToString($trace));
}
/*if ($this->_whatToLog & self::LOG_SERVER) {
$body[] = $this->_makeSection("SERVER", Debug_ErrorHook_Util::varExport($_SERVER));
}*/
if (!empty($_COOKIE) && $this->_whatToLog & self::LOG_COOKIE) {
$body[] = $this->_makeSection("COOKIES", Debug_ErrorHook_Util::varExport($_COOKIE));
}
if (!empty($_GET) && $this->_whatToLog & self::LOG_GET) {
$body[] = $this->_makeSection("GET", Debug_ErrorHook_Util::varExport($_GET));
}
if (!empty($_POST) && $this->_whatToLog & self::LOG_POST) {
$body[] = $this->_makeSection("POST", Debug_ErrorHook_Util::varExport($_POST));
}
if (!empty($_SESSION) && $this->_whatToLog & self::LOG_SESSION) {
$body[] = $this->_makeSection("SESSION", Debug_ErrorHook_Util::varExport(@$_SESSION));
}
// Append body suffix?
$suffix = $this->_bodySuffix && is_callable($this->_bodySuffix) ? call_user_func($this->_bodySuffix) : $this->_bodySuffix;
if ($suffix) {
$body[] = $this->_makeSection("ADDITIONAL INFO", $suffix);
}
// Remain only 1st line for subject.
$errstr = preg_replace("/\r?\n.*/s", '', $errstr);
$this->_notifyText("{$errno}: {$errstr} at {$errfile} on line {$errline}", join("\n", $body));
}
示例4: start_el
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
global $wp_query;
$indent = $depth ? str_repeat("\t", $depth) : '';
$class_names = $value = '';
$classes = empty($item->classes) ? array() : (array) $item->classes;
$class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item));
$class_names = ' class="' . esc_attr($class_names) . '"';
$output .= $indent . '<li id="shopkeeper-menu-item-' . $item->ID . '"' . $value . $class_names . '>';
$attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
$attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
$attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
$attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';
$prepend = '';
$append = '';
//$description = ! empty( $item->description ) ? '<span>'.esc_attr( $item->description ).'</span>' : '';
if ($depth != 0) {
$description = $append = $prepend = "";
}
$item_output = $args->before;
$item_output .= '<a' . $attributes . '>';
$item_output .= $args->link_before . $prepend . apply_filters('the_title', $item->title, $item->ID) . $append;
//$item_output .= $description.$args->link_after;
//$item_output .= ' '.$item->background_url.'</a>';
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
apply_filters('walker_nav_menu_start_lvl', $item_output, $depth, $args->background_url = $item->background_url);
}
示例5: makeHex
function makeHex($st)
{
for ($i = 0; $i < strlen($st); $i++) {
$hex[] = sprintf("%02X", ord($st[$i]));
}
return join(" ", $hex);
}
示例6: render
public function render($placeholder, array $options = array())
{
$dataString = '';
$optionsString = '';
//{ label: "sin(x)", data: d1}
$list = array();
foreach ($this->getDatas() as $item) {
$datas = array();
foreach ($item[self::FIELD_DATA] as $key => $value) {
$datas[] = '[' . $key . ', ' . $value . ']';
}
$optionsList = array();
foreach ($item as $name => $value) {
if ($name == self::FIELD_DATA) {
continue;
}
$optionsList[] = $name . ':"' . $value . '"';
}
$list[] = ' {' . join(', ', $optionsList) . (!empty($optionsList) ? ', ' : '') . 'data: [' . join(', ', $datas) . ']}';
}
$dataString = '[' . PHP_EOL . join(', ', $list) . PHP_EOL . ']';
$buffer = '$.plot($("' . $placeholder . '"),' . PHP_EOL;
$buffer .= $dataString . PHP_EOL;
$buffer .= $optionsString ? ', ' . $optionsString . PHP_EOL : '';
$buffer .= ');';
return $buffer;
}
示例7: index
public function index()
{
$opus = D('Opus');
//实例化问题表
$user = D('User');
//实例化用户表
//dump(I('get.'));
/*姓名判断*/
if (I('get.user')) {
$name = I('get.user');
$map['name'] = array('exp', "like '%{$name}%' ");
$ulist = $user->where($map)->select();
$name = '';
foreach ($ulist as $key => $value) {
$name[$key] = $value['id'];
}
$where = join(" or 'user_id' = ", $name);
$map['user_id'] = $where;
unset($map['name']);
}
/*标题判断*/
if (I('get.title')) {
$title = I('get.title');
$map['ques'] = array('exp', "like '%{$title}%' ");
}
$total = $opus->where($map)->count();
$page = new \Think\Page($total, 8);
$oplist = $opus->where($map)->limit($page->firstRow . ',' . $page->listRows)->getOpus();
$pageButton = $page->show();
//dump($oplist);
$this->assign('list', $oplist);
$this->assign('pageButton', $pageButton);
$this->display();
}
示例8: getLoader
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit46390df264f3e25339b844dea17d85e4', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit46390df264f3e25339b844dea17d85e4', 'loadClassLoader'));
$includePaths = (require __DIR__ . '/include_paths.php');
array_push($includePaths, get_include_path());
set_include_path(join(PATH_SEPARATOR, $includePaths));
$map = (require __DIR__ . '/autoload_namespaces.php');
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = (require __DIR__ . '/autoload_psr4.php');
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = (require __DIR__ . '/autoload_classmap.php');
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
$includeFiles = (require __DIR__ . '/autoload_files.php');
foreach ($includeFiles as $file) {
composerRequire46390df264f3e25339b844dea17d85e4($file);
}
return $loader;
}
示例9: register
function register($tag, $func)
{
$tags =& \ui\global_var('shortcode_tags', array());
$tags[] = $tag;
\ui\global_var('shortcode_tags_regx', join('|', array_map('preg_quote', $tags)), 1);
\ui\register_hook('shortcode_tag_' . $tag, $func);
}
示例10: uninstall
public static function uninstall()
{
global $db, $setting, $admin_cat;
$info = self::info();
$db->delete($setting['db']['pre'] . "news_mark");
$db->exec("drop", "table", $setting['db']['pre'] . "news_mark");
$db->delete($setting['db']['pre'] . "admin_cat", array("file", "=", "news_mark.php"));
$db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx']));
deleteCache("admin_cat");
deleteCache("plugin");
$err = array();
if ($db->GetError($err)) {
showInfo($setting['language']['plugin_err_uninstall'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t");
} else {
includeCache("admin_cat");
$admin_cat = toJson($admin_cat, $setting['gen']['charset']);
echo <<<mystep
<script language="javascript">
parent.admin_cat = {$admin_cat};
parent.setNav();
</script>
mystep;
buildParaList("plugin");
echo showInfo($setting['language']['plugin_uninstall_done'], false);
}
}
示例11: start_el
function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0)
{
global $wp_query;
$indent = $depth ? str_repeat("\t", $depth) : '';
$class_names = $value = '';
$classes = empty($item->classes) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
if ($args->has_children) {
$classes[] = 'dropdown';
}
$icon_html = '';
if (isset($item->custom_icon) && !empty($item->custom_icon)) {
$icon_html = '<i class="' . $item->custom_icon . '"></i><span> </span>';
}
$class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args));
$class_names = ' class="' . esc_attr($class_names) . '"';
$id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args);
$id = strlen($id) ? ' id="' . esc_attr($id) . '"' : '';
$output .= $indent . '<li' . $id . $value . $class_names . '>';
$attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
$attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
$attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
$attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';
$item_output = $args->before;
$item_output .= '<a' . $attributes . '>';
$item_output .= $args->link_before . $icon_html . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
}
示例12: read
public function read(DOMElement $e) {
$tn = end(explode(':',$e->tagName));
switch($tn) {
case 'function':
foreach($e->childNodes as $cnn) {
if (typeOf($cnn) == 'DOMElement') {
$cnt = end(explode(':',$cnn->tagName));
if ($cnt == 'from') {
$this->from[] = $cnn->nodeValue;
} elseif ($cnt == 'to') {
$this->to = $cnn->nodeValue;
} else {
printf("Warning: Didn't expect %s here\n", $cnn->nodeName);
}
}
}
printf(__astr("[\b{phprefactor}] Refactoring{%s} --> %s\n"), join(', ',$this->from), $this->to);
break;
default:
printf("I don't know what to do with %s!\n", $tn);
}
}
示例13: _callExternalMethod
/**
* Call external Method
*
* @param \Smarty_Internal_Data $data
* @param string $name external method names
* @param array $args argument array
*
* @return mixed
* @throws SmartyException
*/
public function _callExternalMethod(Smarty_Internal_Data $data, $name, $args)
{
/* @var Smarty $data ->smarty */
$smarty = isset($data->smarty) ? $data->smarty : $data;
if (!isset($smarty->ext->{$name})) {
$class = 'Smarty_Internal_Method_' . ucfirst($name);
if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) {
if (!isset($this->_property_info[$prop = $match[2]])) {
// convert camel case to underscored name
$this->resolvedProperties[$prop] = $pn = strtolower(join('_', preg_split('/([A-Z][^A-Z]*)/', $prop, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE)));
$this->_property_info[$prop] = property_exists($data, $pn) ? 1 : ($data->_objType == 2 && property_exists($smarty, $pn) ? 2 : 0);
}
if ($this->_property_info[$prop]) {
$pn = $this->resolvedProperties[$prop];
if ($match[1] == 'get') {
return $this->_property_info[$prop] == 1 ? $data->{$pn} : $data->smarty->{$pn};
} else {
return $this->_property_info[$prop] == 1 ? $data->{$pn} = $args[0] : ($data->smarty->{$pn} = $args[0]);
}
} elseif (!class_exists($class)) {
throw new SmartyException("property '{$pn}' does not exist.");
}
}
if (class_exists($class)) {
$callback = array($smarty->ext->{$name} = new $class(), $name);
}
} else {
$callback = array($smarty->ext->{$name}, $name);
}
array_unshift($args, $data);
if (isset($callback) && $callback[0]->objMap | $data->_objType) {
return call_user_func_array($callback, $args);
}
return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args);
}
示例14: getLoader
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit0ff06a20d13931ad3d71bf10770c91f3', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit0ff06a20d13931ad3d71bf10770c91f3', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$includePaths = (require __DIR__ . '/include_paths.php');
array_push($includePaths, get_include_path());
set_include_path(join(PATH_SEPARATOR, $includePaths));
$map = (require __DIR__ . '/autoload_namespaces.php');
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = (require __DIR__ . '/autoload_psr4.php');
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = (require __DIR__ . '/autoload_classmap.php');
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
$includeFiles = (require __DIR__ . '/autoload_files.php');
foreach ($includeFiles as $file) {
composerRequire0ff06a20d13931ad3d71bf10770c91f3($file);
}
return $loader;
}
示例15: urlSign
/**
* URL的签名算法,返回一个token字符串
*/
public static function urlSign($paramArr)
{
$options = array('queryParam' => '', 'cryptkey' => '', 'timeInfo' => 0);
if (is_array($paramArr)) {
$options = array_merge($options, $paramArr);
}
extract($options);
if (!$queryParam) {
return '';
}
if (is_string($queryParam)) {
parse_str($queryParam, $queryParam);
}
#对参数数组进行排序,保证参数传入的顺序不同,同样能得到结果
ksort($queryParam);
$queryString = array();
foreach ($queryParam as $key => $val) {
array_push($queryString, $key . '=' . $val);
}
$queryString = join('&', $queryString);
if ($timeInfo) {
//为了获取时间 可逆
$queryString .= "#" . time();
#将时间戳并入
$sign = self::fastEncode(array('value' => $queryString, 'cryptkey' => $cryptkey));
} else {
//没有时间信息 不可逆
$sign = hash_hmac("sha1", $queryString, $cryptkey);
}
return $sign;
}