本文整理汇总了PHP中join函数的典型用法代码示例。如果您正苦于以下问题:PHP join函数的具体用法?PHP join怎么用?PHP join使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了join函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:andrewcroce,项目名称:TPL,代码行数:35,代码来源:offcanvas-walker.class.php
示例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;
}
开发者ID:adartk,项目名称:phpsqlitecms,代码行数:64,代码来源:language_redirect.php
示例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));
}
开发者ID:avramishin,项目名称:alishop,代码行数:31,代码来源:TextNotifier.php
示例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);
}
开发者ID:hamaianhnhi,项目名称:shopkeeper148,代码行数:29,代码来源:custom_walker.php
示例5: makeHex
function makeHex($st)
{
for ($i = 0; $i < strlen($st); $i++) {
$hex[] = sprintf("%02X", ord($st[$i]));
}
return join(" ", $hex);
}
开发者ID:igorsimdyanov,项目名称:php7,代码行数:7,代码来源:textbin.php
示例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;
}
开发者ID:necromant2005,项目名称:zf2-jquery-flot,代码行数:27,代码来源:Flot.php
示例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();
}
开发者ID:liucongai,项目名称:AP1,代码行数:34,代码来源:OpusController.class.php
示例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;
}
开发者ID:robStack,项目名称:CoDev,代码行数:30,代码来源:autoload_real.php
示例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);
}
开发者ID:1upon0,项目名称:ui,代码行数:7,代码来源:lib_shortcode.php
示例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);
}
}
开发者ID:laiello,项目名称:mystep-cms,代码行数:26,代码来源:class.php
示例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);
}
开发者ID:alispx,项目名称:calibrefx,代码行数:30,代码来源:Walker_nav_menu.php
示例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);
}
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:26,代码来源:css.php
示例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);
}
开发者ID:thekabal,项目名称:tki,代码行数:45,代码来源:smarty_internal_extension_handler.php
示例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;
}
开发者ID:qinxiao1986,项目名称:complete-laravel4,代码行数:32,代码来源:autoload_real.php
示例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;
}
开发者ID:hongbo819,项目名称:APILJL,代码行数:34,代码来源:Algos.php
示例16: exec
public function exec($statement)
{
if (isset($this->dsn) and stristr($this->dsn, 'anjuke_db') and preg_match('/\\sajk_propertys\\s/i', $statement)) {
if (stristr($statement, 'select CITYID') or stristr($statement, 'insert') or stristr($statement, 'update ')) {
} else {
$dir = '/home/www/logs/propsql';
if (!is_dir($dir)) {
mkdir($dir, 0755, true);
$content = '-=-=-=-=-=-=-=-=-=-=' . PHP_EOL;
$content .= 'DSN: ' . $this->dsn . PHP_EOL;
$content .= 'URI: ' . $_SERVER['REQUEST_URI'] . PHP_EOL;
$content .= 'JOB: ' . var_export($_SERVER['argv'], true) . PHP_EOL;
$content .= 'SQL: ' . $statement . PHP_EOL;
file_put_contents($dir . '/' . date('Ymd'), $content, FILE_APPEND);
}
}
}
if (APF::get_instance()->is_debug_enabled()) {
APF::get_instance()->debug(__CLASS__ . '[' . $this->name . ']' . "->exec: {$statement}");
}
$logger = APF::get_instance()->get_logger();
$logger->debug(__CLASS__, '[' . $this->name . ']->exec: ', $statement);
$stmt = parent::exec($statement);
if ($stmt instanceof PDOStatement) {
$stmt->setFetchMode($this->default_fetch_mode);
} else {
$error_info = parent::errorInfo();
if (parent::errorCode() !== '00000') {
throw new APF_Exception_SqlException(parent::errorCode(), $this->get_name() . ' | ' . $this->config['dsn'] . ' | ' . $statement . ' | ' . join(' | ', $error_info));
}
}
return $stmt;
}
开发者ID:uedcw,项目名称:webstory,代码行数:33,代码来源:PDO.php
示例17: testSaveAction
/**
* @magentoDataFixture Magento/Store/_files/core_fixturestore.php
* @magentoDbIsolation enabled
* @magentoConfigFixture current_store catalog/frontend/flat_catalog_product 1
* @dataProvider saveActionDataProvider
* @param array $inputData
* @param array $defaultAttributes
* @param array $attributesSaved
* @param bool $isSuccess
*/
public function testSaveAction($inputData, $defaultAttributes, $attributesSaved = [], $isSuccess = true)
{
/** @var $store \Magento\Store\Model\Store */
$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Store\\Model\\Store');
$store->load('fixturestore', 'code');
$storeId = $store->getId();
$this->getRequest()->setPostValue($inputData);
$this->getRequest()->setParam('store', $storeId);
$this->getRequest()->setParam('id', 2);
$this->dispatch('backend/catalog/category/save');
if ($isSuccess) {
$this->assertSessionMessages($this->equalTo(['You saved the category.']), \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS);
}
/** @var $category \Magento\Catalog\Model\Category */
$category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Category');
$category->setStoreId($storeId);
$category->load(2);
$errors = [];
foreach ($attributesSaved as $attribute => $value) {
$actualValue = $category->getData($attribute);
if ($value !== $actualValue) {
$errors[] = "value for '{$attribute}' attribute must be '{$value}'" . ", but '{$actualValue}' is found instead";
}
}
foreach ($defaultAttributes as $attribute => $exists) {
if ($exists !== $category->getExistsStoreValueFlag($attribute)) {
if ($exists) {
$errors[] = "custom value for '{$attribute}' attribute is not found";
} else {
$errors[] = "custom value for '{$attribute}' attribute is found, but default one must be used";
}
}
}
$this->assertEmpty($errors, "\n" . join("\n", $errors));
}
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:45,代码来源:CategoryTest.php
示例18: prepareAdd
/**
* Prepare template for single add field
*
* @param $field
* @param bool $isLast
* @return string
*/
protected function prepareAdd($field, $isLast = false)
{
$field = trim($field);
list($name, $type) = explode(':', $field);
$textArr = [" ->add('", $name, "', '", $type, "')", $isLast ? "" : "\n"];
return join('', $textArr);
}
开发者ID:CaporalDead,项目名称:laravel-form-builder,代码行数:14,代码来源:FormGenerator.php
示例19: validerAttribut
function validerAttribut($phraseur, $name, $val, $bal)
{
// Si la balise est inconnue, eviter d'insister
if (!isset($this->dtc->attributs[$bal])) {
return;
}
$a = $this->dtc->attributs[$bal];
if (!isset($a[$name])) {
$bons = join(', ', array_keys($a));
if ($bons) {
$bons = " title=' " . _T('zxml_connus_attributs') . ' : ' . $bons . "'";
}
$bons .= " style='font-weight: bold'";
coordonnees_erreur($this, " <b>{$name}</b> " . _T('zxml_inconnu_attribut') . ' ' . _T('zxml_de') . " <a{$bons}>{$bal}</a> (" . _T('zxml_survoler') . ")");
} else {
$type = $a[$name][0];
if (!preg_match('/^\\w+$/', $type)) {
$this->valider_motif($phraseur, $name, $val, $bal, $type);
} else {
if (method_exists($this, $f = 'validerAttribut_' . $type)) {
$this->{$f}($phraseur, $name, $val, $bal);
}
}
# else spip_log("$type type d'attribut inconnu");
}
}
开发者ID:genma,项目名称:spip_ynh,代码行数:26,代码来源:valider.php
示例20: get_audiotheme_venue_location_ical
/**
* Retrieve a venue's location suitable for an iCal feed.
*
* @since 1.0.0
*
* @param int|object $post Venue post ID or object.
* @return string Venue iCal vCard.
*/
function get_audiotheme_venue_location_ical($venue = null)
{
$venue = get_audiotheme_venue($venue);
$output = $venue->name;
$address = array();
if (!empty($venue->address)) {
$address[] = $venue->address;
}
$locality = empty($venue->city) ? '' : $venue->city;
$locality .= empty($locality) && empty($venue->state) ? '' : ', ';
$locality .= empty($venue->state) ? '' : $venue->state;
if (!empty($locality)) {
$address[] = $locality;
}
if (!empty($venue->country)) {
$address[] = $venue->country;
}
if (!empty($venue->postal_code)) {
$address[] = $venue->postal_code;
}
if (!empty($address)) {
$output .= ', ' . join($address, ', ');
}
return escape_ical_text($output);
}
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:33,代码来源:feed.php
注:本文中的join函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论