本文整理汇总了PHP中Arrays::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Arrays::remove方法的具体用法?PHP Arrays::remove怎么用?PHP Arrays::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arrays
的用法示例。
在下文中一共展示了Arrays::remove方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSpecialSyntaxKeys
static function getSpecialSyntaxKeys($string)
{
if (preg_match('@^([^\\[]+)((\\[[^\\]]*\\])+)$@', $string, $match)) {
//match[1] = array name, match[2] = all keys
//get names of all keys
preg_match_all('@\\[([^\\]]*)\\]@', $match[2], $matches);
//add array name to beginning of keys list
array_unshift($matches[1], $match[1]);
//clear out empty key items
Arrays::remove($matches[1], '', true);
return $matches[1];
}
}
示例2: implode
static function implode($separator, $array)
{
Arrays::remove($array);
return implode($separator, $array);
}
示例3: attributes
function attributes($x, $name = 'default')
{
if ($this->additionalParsers) {
foreach ($this->additionalParsers as $parser) {
list($x, $name) = call_user_func($parser, $x, $name);
}
}
$classes = \Arrays::remove(explode(' ', $x['class']));
unset($x['class']);
if ($classes) {
$additions[] = 'class="' . implode(' ', $classes) . '"';
}
if ($x['extra']) {
$additions[] = $x['extra'];
}
unset($x['extra']);
$attributeTypes = array('id', 'title', 'alt', 'rows', 'placeholder');
foreach ($attributeTypes as $attribute) {
if ($x[$attribute]) {
$additions[] = $attribute . '="' . $x[$attribute] . '"';
unset($x[$attribute]);
}
}
if ($x) {
//add onclick events
foreach ($x as $k => $v) {
if (strtolower(substr($k, 0, 2)) == 'on') {
$additions[] = $k . '="' . $v . '"';
} elseif (strtolower(substr($k, 0, 5) == 'data-')) {
$additions[] = $k . '="' . htmlspecialchars($v) . '"';
} elseif ($k[0] == '@') {
if ($v !== null) {
$additions[] = substr($k, 1) . '="' . htmlspecialchars($v) . '"';
} else {
$additions[] = substr($k, 1);
}
}
}
}
if ($additions) {
return ' ' . implode(' ', $additions) . ' ';
}
}
示例4: http
/**
@param type indicates whether tag is css, lastCss, js, or lastJs. Optional prefix with "-" or "+" to temporarilty change the tagAddOrder
@param args additional args taken as files. Each file in the passed parameters has the following special syntax:
-starts with http(s): no modding done
-starts with "/": no modding done
-starts with "inline:": file taken to be inline css or js. Code is wrapped in tags before output.
-starts with none of the above: file put in path /instanceToken/type/file; ex: "/public/css/main.css"
-if array, consider first element the tag naming key and the second element the file; Used for ensuring only one tag item of a key, regardless of file, is included.
@note if you don't want to have some tag be unique (ie, you want to include the same js multiple times), don't use this function; instead, just set tag variable (like $bottomJs) directly
*/
protected function addTag($type)
{
if (in_array(substr($type, 0, 1), array('-', '+'))) {
$originalTagAddOrder = $this->tagAddOrder;
$this->tagAddOrder = substr($type, 0, 1);
$type = substr($type, 1);
}
if (in_array($type, array('css', 'lastCss'))) {
$uniqueIn = array('css', 'lastCss');
$folder = 'css';
} else {
$uniqueIn = array('topJs', 'bottomJs', 'lastJs');
$folder = 'js';
}
$files = func_get_args();
array_shift($files);
if ($files) {
if ($this->tagAddOrder == '-') {
krsort($files);
}
$typeArray =& $this->{$type};
foreach ($files as $file) {
if (is_array($file)) {
$key = $file[0];
$file = $file[1];
}
if (preg_match('@^inline:@', $file)) {
$typeArray[] = $file;
} else {
if (substr($file, 0, 1) != '/' && !preg_match('@^http(s)?:@', $file)) {
$file = '/' . $_ENV['urlProjectFileToken'] . '/' . $folder . '/' . $file;
}
foreach ($uniqueIn as $unique) {
Arrays::remove($this->{$unique}, $file);
}
if (!$key) {
if ($this->tagAddOrder == '-') {
array_unshift($typeArray, $file);
} else {
$typeArray[] = $file;
}
} else {
$typeArray[$key] = $file;
unset($key);
}
}
}
}
if ($originalTagAddOrder) {
$this->tagAddOrder = $originalTagAddOrder;
}
}
示例5: explode
static function explode($separator, $string)
{
$array = explode($separator, $string);
Arrays::remove($array);
return array_values($array);
}