本文整理汇总了PHP中Array_Merge函数的典型用法代码示例。如果您正苦于以下问题:PHP Array_Merge函数的具体用法?PHP Array_Merge怎么用?PHP Array_Merge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Array_Merge函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Load_Options
function Load_Options($options)
{
$options = (array) $options;
// Delete empty values
foreach ($options as $key => $value) {
if (!$value) {
unset($options[$key]);
}
}
// Load options
$this->arr_option = Array_Merge($this->Default_Options(), $options);
}
示例2: addRewriteRules
static function addRewriteRules($rules)
{
if (Is_Array(self::$rewrite_rules) && Is_Array($rules)) {
return Array_Merge(self::$rewrite_rules, $rules);
} else {
return $rules;
}
}
示例3: load_parameters
function load_parameters()
{
// Load Parameters
$_REQUEST = Array_Merge(array('a' => 0, 'h' => 0, 'w' => 0, 'c' => 0, 'g' => 0, 'q' => 80), $_REQUEST);
$this->attachment_id = IntVal($_REQUEST['a']);
if ($this->attachment_id < 1) {
die('I do not think that ' . $this->attachment_id . ' is a valid attachment id.');
}
$this->attachment_file = RealPath(get_attached_file($this->attachment_id));
if (!Is_File($this->attachment_file)) {
die('Could not find this attachment.');
}
$this->dst_height = IntVal($_REQUEST['h']);
if ($this->dst_height < 1) {
$this->dst_height = 0;
}
$this->dst_width = IntVal($_REQUEST['w']);
if ($this->dst_width < 1) {
$this->dst_width = 0;
}
if ($this->dst_width < 1 && $this->dst_height < 1) {
die('New dimensions cannot be less then 1.');
}
$this->crop = IntVal($_REQUEST['c']);
if ($this->crop == 0) {
$this->crop = False;
} else {
$this->crop = True;
}
if ($this->crop && ($this->dst_width < 1 || $this->dst_height < 1)) {
die('If you want something cropped please tell me the dimensions.');
}
$this->grayscale = IntVal($_REQUEST['g']);
if ($this->grayscale == 0) {
$this->grayscale = False;
} else {
$this->grayscale = True;
}
$this->negate = IntVal($_REQUEST['n']);
if ($this->negate == 0) {
$this->negate = False;
} else {
$this->negate = True;
}
$this->dst_qualy = IntVal($_REQUEST['q']);
if ($this->dst_qualy < 1 || $this->dst_qualy > 100) {
$this->dst_qualy = 80;
}
}
示例4: Tree_Parents
function Tree_Parents($TableID, $RowID)
{
/****************************************************************************/
$__args_types = array('string', 'integer');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$Regulars = Regulars();
#-----------------------------------------------------------------------------
if (!Preg_Match($Regulars['ID'], $TableID)) {
return new gException('WRONG_TABLE_ID', 'Неверный идентификатор таблицы');
}
#-----------------------------------------------------------------------------
$Row = DB_Select($TableID, '*', array('UNIQ', 'ID' => $RowID));
#---------------------------------------------------------------------------
switch (ValueOf($Row)) {
case 'error':
return ERROR | @Trigger_Error('[Tree_Parents]: не возможно найти запись');
case 'exception':
return new gException('ROW_NOT_FOUND', 'Запись не найдена');
case 'array':
#-------------------------------------------------------------------------
$Query = SPrintF('SELECT * FROM `%s` `TableA` WHERE `ParentID` = %u AND `ID` != `ParentID` AND EXISTS(SELECT * FROM `%s` `TableB` WHERE `TableB`.`ParentID` = `TableA`.`ID`)', $TableID, $Row['ID'], $TableID);
#-------------------------------------------------------------------------
$IsQuery = DB_Query($Query);
if (Is_Error($IsQuery)) {
return ERROR | @Trigger_Error('[Tree_Parents]: не возможно найти дочерние записи');
}
#-------------------------------------------------------------------------
$Childs = MySQL::Result($IsQuery);
#-------------------------------------------------------------------------
$Result = array($Row['ID']);
#-------------------------------------------------------------------------
foreach ($Childs as $Child) {
#-----------------------------------------------------------------------
$Parents = Tree_Parents($TableID, (int) $Child['ID']);
#-----------------------------------------------------------------------
switch (ValueOf($Parents)) {
case 'error':
return ERROR | @Trigger_Error('[Tree_Parents]: не возможно определить дочерние вхождения записей');
case 'exception':
return ERROR | @Trigger_Error('[Tree_Parents]: запись оказавшаяся дочерней не найдена');
case 'array':
$Result = Array_Merge($Result, $Parents);
break;
default:
return ERROR | @Trigger_Error(101);
}
}
#-------------------------------------------------------------------------
return $Result;
break;
default:
return ERROR | @Trigger_Error(101);
}
}
示例5: HTTP_Send
function HTTP_Send($Target, $Settings, $Get = array(), $Post = array(), $Addins = array())
{
/******************************************************************************/
$__args_types = array('string', 'array', 'array', 'string,array', 'array');
#-------------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/******************************************************************************/
$Default = array('Protocol' => 'tcp', 'Address' => 'localhost', 'Port' => 8080, 'Host' => 'localhost', 'Basic' => '', 'Charset' => 'UTF-8', 'Hidden' => '', 'IsLogging' => TRUE);
#-------------------------------------------------------------------------------
Array_Union($Default, $Settings);
#-------------------------------------------------------------------------------
$IsLogging = (bool) $Default['IsLogging'];
#-------------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return ERROR | @Trigger_Error('[HTTP_Send]: не удалось определить путь временной директории');
}
#-------------------------------------------------------------------------------
$Config = Config();
#-------------------------------------------------------------------------------
$Address = $Default['Address'];
#-------------------------------------------------------------------------------
Debug(SPrintF('[HTTP_Send]: соединяемся с (%s:%u)', $Address, $Default['Port']));
#-------------------------------------------------------------------------------
# https://bugs.php.net/bug.php?id=52913
# пришлось заменить: $Address -> $Default['Host']
$Socket = @FsockOpen(SPrintF('%s://%s', $Protocol = $Default['Protocol'], $Default['Host']), $Port = $Default['Port'], $nError, $sError, $Config['Other']['Libs']['HTTP']['SocketTimeout']);
if (!Is_Resource($Socket)) {
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/logs/http-send.log', $Tmp), SPrintF("%s://%s:%u ошибка соединения\n\n", $Protocol, $Address, $Port));
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error('[HTTP_Send]: не удалось записать данные в лог файл');
}
#-------------------------------------------------------------------------------
return ERROR | @Trigger_Error('[HTTP_Send]: не удалось соединиться с удаленным хостом');
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
# added by lissyara, 2012-01-04 in 08:42:54 MSK, for JBS-130
Stream_Set_TimeOut($Socket, $Config['Other']['Libs']['HTTP']['StreamTimeout']);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Charset = $Default['Charset'];
#-------------------------------------------------------------------------------
$Method = Count($Post) > 0 ? 'POST' : 'GET';
#-------------------------------------------------------------------------------
$Hidden = $Default['Hidden'];
#-------------------------------------------------------------------------------
if (Count($Get)) {
$Target .= SPrintF('?%s', HTTP_Query($Get, $Charset, $Hidden, $IsLogging));
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Headers[] = SPrintF('%s %s HTTP/1.0', $Method, $Target);
#-------------------------------------------------------------------------------
$Headers[] = SPrintF('Host: %s', $Default['Host']);
#-------------------------------------------------------------------------------
$Headers[] = 'Connection: close';
#-------------------------------------------------------------------------------
$Headers = Array_Merge($Headers, $Addins);
#-------------------------------------------------------------------------------
if ($Basic = $Default['Basic']) {
#-------------------------------------------------------------------------------
$Basic = Base64_Encode($Basic);
#-------------------------------------------------------------------------------
$Headers[] = SPrintF('Authorization: Basic %s', $Basic);
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$Body = '';
#-------------------------------------------------------------------------------
if ($Post) {
#-------------------------------------------------------------------------------
if (Is_Array($Post)) {
#-------------------------------------------------------------------------------
if (Count($Post) > 0) {
#-------------------------------------------------------------------------------
$Headers[] = 'Content-Type: application/x-www-form-urlencoded';
#-------------------------------------------------------------------------------
$Body = HTTP_Query($Post, $Charset, $Hidden, $IsLogging);
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
$Body = Mb_Convert_Encoding($Post, $Charset);
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
if ($Length = MB_StrLen($Body, 'ASCII')) {
$Headers[] = SPrintF('Content-Length: %u', $Length);
}
#-------------------------------------------------------------------------------
$Query = SPrintF("%s\r\n\r\n%s", Implode("\r\n", $Headers), $Body);
#-------------------------------------------------------------------------------
Debug(SPrintF("[HTTP_Send]: делаем запрос:\n%s", $Query));
#-------------------------------------------------------------------------------
//.........这里部分代码省略.........
示例6: Related_Terms
static function Related_Terms($attributes = Null)
{
$attributes = Is_Array($attributes) ? $attributes : array();
$attributes = Array_Merge(array('number' => 5), $attributes);
$related_terms = Core::getTagRelatedTerms($attributes);
return Template::load('glossary-related-terms.php', array('attributes' => $attributes, 'related_terms' => $related_terms));
}
示例7: getTagRelatedTerms
static function getTagRelatedTerms($arguments = Null)
{
global $wpdb, $post;
$arguments = Is_Array($arguments) ? $arguments : array();
# Load default arguments
$arguments = (object) Array_Merge(array('term_id' => $post->ID, 'number' => 10, 'taxonomy' => 'glossary-tag'), $arguments);
# apply filter
$arguments = Apply_Filters('glossary_tag_related_terms_arguments', $arguments);
# Get the Tags
$arr_tags = WP_Get_Post_Terms($arguments->term_id, $arguments->taxonomy);
if (empty($arr_tags)) {
return False;
}
# Get term IDs
$arr_term_ids = array();
foreach ($arr_tags as $taxonomy) {
$arr_term_ids[] = $taxonomy->term_taxonomy_id;
}
$str_tag_list = Implode(',', $arr_term_ids);
# The Query to get the related posts
$stmt = " SELECT posts.*,\n COUNT(term_relationships.object_id) AS common_tag_count\n FROM {$wpdb->term_relationships} AS term_relationships,\n {$wpdb->posts} AS posts\n WHERE term_relationships.object_id = posts.id\n AND term_relationships.term_taxonomy_id IN({$str_tag_list})\n AND posts.id != {$arguments->term_id}\n AND posts.post_status = 'publish'\n GROUP BY term_relationships.object_id\n ORDER BY common_tag_count DESC,\n posts.post_date_gmt DESC\n LIMIT 0, {$arguments->number}";
# Put it in a WP_Query
$query = new WP_Query();
$query->posts = $wpdb->Get_Results($stmt);
$query->post_count = Count($query->posts);
$query->Rewind_Posts();
# return
if ($query->post_count == 0) {
return False;
} else {
return $query;
}
}
示例8: isset
$NowDayOfWeek = $DateTimeArray['wday'];
$NowDayOfMonth = $DateTimeArray['mday'];
#-------------------------------------------------------------------------------
isset($Task['Params']['TasksArray']) ? $TasksArray = $Task['Params']['TasksArray'] : ($TasksArray = FALSE);
isset($Task['Params']['NowTask']) ? $NowTask = $Task['Params']['NowTask'] : ($NowTask = FALSE);
$IsEnded = FALSE;
#-------------------------------------------------------------------------------
# Формируем массив задач при первом запуске
if (!$TasksArray && !$NowTask) {
Debug("[Tasks/GC]: Формируем массив задач");
$TasksArray = Array_Keys($Settings['DailyTasks']);
if ($NowDayOfWeek == 1) {
$TasksArray = Array_Merge($TasksArray, Array_Keys($Settings['WeeklyTasks']));
}
if ($NowDayOfMonth == 1) {
$TasksArray = Array_Merge($TasksArray, Array_Keys($Settings['MonthlyTasks']));
}
$Task['Result'] = NULL;
$TaskResult = NULL;
}
#-------------------------------------------------------------------------------
Debug(SPrintF("[Tasks/GC]: Массив задач: %s", Implode(', ', $TasksArray)));
#-------------------------------------------------------------------------------
if ($NowTask) {
$TaskCount = 0;
# Формируем массив параметров для передачи в задачу
# $TaskParams = Array();
# foreach(Array_Keys($Settings) as $Key){
# if(!Is_Array($Settings[$Key]))
# $TaskParams[$Key] = $Settings[$Key];
#-----------------------------------------------------------------------------
示例9: Generate_Gallery_Attributes
public function Generate_Gallery_Attributes($attributes)
{
global $post;
$attributes = Is_Array($attributes) ? $attributes : array();
$gallery_meta = array();
# Get the Gallery Meta settings
if (isset($attributes['id']) && !empty($attributes['id'])) {
$gallery_meta = $this->gallery_post_type->Get_Meta(Null, False, $attributes['id']);
} else {
$attributes['id'] = $post->ID;
if ($post->post_type == $this->gallery_post_type->name) {
$gallery_meta = $this->gallery_post_type->Get_Meta(Null, False, $attributes['id']);
} else {
$gallery_meta = $this->gallery_post_type->Default_Meta();
}
}
# Merge Attributes
$attributes = Array_Merge(array('id' => False, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => isset($attributes['ids']) ? 'post__in' : 'menu_order', 'columns' => 4, 'number' => -1, 'ids' => False, 'include' => False, 'exclude' => False, 'size' => 'thumbnail', 'link' => 'file', 'link_class' => False, 'thumb_width' => False, 'thumb_height' => False, 'thumb_grayscale' => False, 'thumb_negate' => False, 'template' => False), $gallery_meta, $attributes);
# Rename some keys
$attributes = Array_Merge($attributes, array('post_parent' => $attributes['id'], 'posts_per_page' => $attributes['number'], 'include' => $attributes['include'] . $attributes['ids']));
if (!empty($attributes['include'])) {
$attributes['post_parent'] = Null;
}
foreach (array('id', 'number', 'ids') as $field) {
unset($attributes[$field]);
}
return $attributes;
}
示例10: ToArray
function ToArray()
{
/****************************************************************************/
$__args_types = array('string,array');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$Names = Array_Merge($__args__, array('ListElement'));
#-----------------------------------------------------------------------------
$AttribsIDs = array();
#-----------------------------------------------------------------------------
foreach ($__args__ as $__arg__) {
#---------------------------------------------------------------------------
if (Is_Array($__arg__)) {
$AttribsIDs = Array_Merge($AttribsIDs, $__arg__);
}
}
#-----------------------------------------------------------------------------
$Childs = $this->Childs;
#-----------------------------------------------------------------------------
if (Count($Childs) > 0) {
#---------------------------------------------------------------------------
$j = 1;
#---------------------------------------------------------------------------
$Result = array();
#---------------------------------------------------------------------------
foreach ($Childs as $Child) {
#-------------------------------------------------------------------------
$Name = $Child->Name;
#-------------------------------------------------------------------------
if (In_Array($Name, $Names)) {
$Name = SPrintF('%s%06u', $Name, $j++);
}
#-------------------------------------------------------------------------
$Name = $Name != 'UniqID' ? $Name : UniqID('UniqID');
#-------------------------------------------------------------------------
$Result[$Name] = Call_User_Func_Array(array($Child, 'ToArray'), $__args__);
#-------------------------------------------------------------------------
foreach (Array_Keys($Child->Attribs) as $AttribID) {
#-----------------------------------------------------------------------
if (In_Array($AttribID, $AttribsIDs)) {
#---------------------------------------------------------------------
if (!Is_Array($Result[$Name])) {
$Result[$Name] = array();
}
#---------------------------------------------------------------------
$Result[$Name][$AttribID] = $Child->Attribs[$AttribID];
}
}
}
} else {
#---------------------------------------------------------------------------
$Result = $this->Text != '' ? $this->Text : NULL;
#---------------------------------------------------------------------------
$Type = 'string';
#---------------------------------------------------------------------------
if (isset($this->Attribs['type'])) {
$Type = $this->Attribs['type'];
}
#---------------------------------------------------------------------------
@SetType($Result, $Type);
}
#-----------------------------------------------------------------------------
return $Result;
}
示例11: array
$arDefaultUrlTemplatesN404 = array();
$arDefaultVariableAliases404 = array();
$arDefaultVariableAliases = array();
$componentPage = "";
$arComponentVariables = array("meeting_id", "item_id", "page", "action");
if ($arParams["SEF_MODE"] == "Y") {
$arVariables = array();
$arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams["SEF_URL_TEMPLATES"]);
$arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]);
$componentPage = CComponentEngine::ParseComponentPath($arParams["SEF_FOLDER"], $arUrlTemplates, $arVariables);
if (empty($componentPage)) {
$componentPage = "index";
}
CComponentEngine::InitComponentVariables($componentPage, $arComponentVariables, $arVariableAliases, $arVariables);
foreach ($arUrlTemplates as $url => $value) {
$arResult["PATH_TO_" . strToUpper($url)] = $arParams["SEF_FOLDER"] . $value;
}
$arResult["PATH_TO_MEETING_LIST"] = $arParams["SEF_FOLDER"] . $arUrlTemplates["index"];
} else {
$arVariables = array();
$arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases, $arParams["VARIABLE_ALIASES"]);
CComponentEngine::InitComponentVariables(false, $arComponentVariables, $arVariableAliases, $arVariables);
if (array_key_exists($arVariables["page"], $arDefaultUrlTemplates404)) {
$componentPage = $arVariables["page"];
}
if (empty($componentPage)) {
$componentPage = "index";
}
}
$arResult = Array_Merge(array("SEF_MODE" => $arParams["SEF_MODE"], "SEF_FOLDER" => $arParams["SEF_FOLDER"], "VARIABLES" => $arVariables, "ALIASES" => $arParams["SEF_MODE"] == "Y" ? array() : $arVariableAliases, "SET_TITLE" => $arParams["SET_TITLE"], "SET_NAVCHAIN" => $arParams["SET_NAVCHAIN"], "IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"], "IBLOCK_ID" => $arParams["IBLOCK_ID"], "USERGROUPS_MODIFY" => $arParams["USERGROUPS_MODIFY"], "USERGROUPS_RESERVE" => $arParams["USERGROUPS_RESERVE"], "USERGROUPS_CLEAR" => $arParams["USERGROUPS_CLEAR"], "WEEK_HOLIDAYS" => $arParams["WEEK_HOLIDAYS"]), $arResult);
$this->IncludeComponentTemplate($componentPage);
示例12: array
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (Is_Error(System_Load(SPrintF('classes/%sServer.class.php', $Service['Code'])))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Columns = array('ID', 'UserID', 'StatusID', 'ServerID', 'StatusID');
#-------------------------------------------------------------------------------
if ($Service['Code'] == 'ISPsw') {
#-------------------------------------------------------------------------------
$Columns = Array_Merge($Columns, array('IP'));
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
$Columns = Array_Merge($Columns, array('Login', 'Password'));
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$Order = DB_Select(SPrintF('%sOrdersOwners', $Service['Code']), $Columns, array('UNIQ', 'ID' => $ServiceOrderID));
#-------------------------------------------------------------------------------
switch (ValueOf($Order)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'array':
break;
default:
return ERROR | @Trigger_Error(101);
}
示例13: YAMLWalk
function YAMLWalk($source)
{
global $parm;
$destination = array();
if (!is_array($source)) {
$this->YAMLWalkError('freetext', $source);
return $source;
}
foreach ($source as $key => $item) {
// Error 1, usually caused by misplaced or missing semicolon
if (is_numeric($key)) {
$this->YAMLWalkError('numindex', $item);
} else {
//$split=explode(' ',$key);
$split = preg_split('/\\s+/', $key);
if (count($split) == 1) {
// If no split, this must be a property/value assignment
if (is_array($item)) {
$this->YAMLWalkError('arrayvalue', $item);
} else {
$destination[$key] = $item;
}
} else {
// This an entity, like 'column first_name:', where we have
// split the key and renested it. This is where we do real work
//
$type = $split[0];
$name = $split[1];
// KFD 9/26/07, allow $LOGIN group
if ($name == '$LOGIN') {
$name = $parm['APP'];
}
if ($type == "content") {
# KFD 6/30/08
$colnames = array_merge(array('__type' => 'columns'), $item['columns']);
unset($item['columns']);
$values = array();
foreach ($item as $key => $stuff) {
# KFD 1/28/09. After we put line numbers
# into things, we get non-array
# entries. Just skip 'em
if (is_array($stuff)) {
foreach ($stuff as $idx => $array) {
if (is_array($array)) {
$values[] = array_merge(array('__type' => $key), $array);
}
}
}
}
#if(is_array($stuff)) {
# KFD 6/21/08, removed hardcode __type of 'value'
# $values[]=array_merge(array('__type'=>'values'),$stuff);
#}
#else {
# $cols=explode(' ',$key);
# if(count($cols)<2) {
# $this->YAMLWalkError('contentkey',$item);
# }
# else {
# $colnames[] = $cols[1];
# }
#}
#}
//$this->YAMLContent[$name][]=$colnames;
$this->YAMLContent[$name] = Array_Merge(array($colnames), $values);
} else {
$uicolseq = str_pad(++$this->uicolseq, 5, '0', STR_PAD_LEFT);
if (!$item) {
// This is a blank item, you get this if the spec file
// has entries like:
// column description:
// column add1:
// column add2:
$destination[$type][$name] = array('uicolseq' => $uicolseq);
} else {
// A non-blank item, an item with properties, you
// get this with:
// column vendor:
// primary_key: Y
// uisearch: Y
$this->YAMLStack[] = $type;
$this->YAMLStack[] = $name;
$destination[$type][$name] = $this->YAMLWalk($item);
$destination[$type][$name]['uicolseq'] = $uicolseq;
array_pop($this->YAMLStack);
array_pop($this->YAMLStack);
}
$keystub = $name;
if (isset($item['prefix'])) {
$prefix = substr($keystub, 0, strlen($item['prefix']));
if ($item['prefix'] != $prefix) {
$this->YAMLWalkError('prefix', $item);
} else {
$keystub = substr($keystub, strlen($item['prefix']));
}
}
if (isset($item['suffix'])) {
$suffix = substr($keystub, -strlen($item['suffix']));
if ($item['suffix'] != $suffix) {
$this->YAMLWalkError('suffix', $item);
//.........这里部分代码省略.........
示例14: Generate_Gallery_Attributes
function Generate_Gallery_Attributes($attributes)
{
global $post;
// Get the Gallery Meta settings
if (isset($attributes['id']) && !empty($attributes['id'])) {
$gallery_meta = $this->Get_Gallery_Meta(Null, False, $attributes['id']);
} else {
if ($post->post_type == $this->gallery_post_type) {
$attributes['id'] = $post->ID;
$gallery_meta = $this->Get_Gallery_Meta(Null, False, $attributes['id']);
} else {
$gallery_meta = $this->Default_Meta();
}
}
// Merge Attributes
$attributes = Array_Merge(array('id' => False, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => !isset($attributes['ids']) ? 'menu_order' : 'post__in', 'number' => -1, 'ids' => '', 'include' => '', 'exclude' => '', 'size' => 'thumbnail', 'link' => 'file', 'link_class' => '', 'thumb_width' => '', 'thumb_height' => '', 'thumb_grayscale' => False, 'thumb_negate' => False), $gallery_meta, $attributes);
// Rename some keys
$attributes = Array_Merge($attributes, array('post_parent' => $attributes['id'], 'posts_per_page' => $attributes['number'], 'include' => $attributes['include'] . $attributes['ids']));
foreach (array('id', 'number', 'ids') as $field) {
unset($attributes[$field]);
}
#PrintF('<pre>%s</pre>', Print_R ($attributes, True));
return $attributes;
}
示例15: GetUploadedFileSize
#-----------------------------------------------------------------
$Table[] = $Compile['Attribs'][$AttribID];
}
#-------------------------------------------------------------------
$Table[] = 'Подтверждение введенных данных';
#-------------------------------------------------------------------
$FileLength = GetUploadedFileSize('Profiles', $ProfileID);
#-------------------------------------------------------------------
$Table[] = array('Копия документа подтверждающего достоверность данных', $FileLength ? new Tag('TD', array('class' => 'Standard'), new Tag('SPAN', SPrintF('%01.2f Кб.', $FileLength / 1024)), new Tag('A', array('href' => SPrintF('/FileDownload?TypeID=Profiles&FileID=%s', $Profile['ID'])), '[скачать]')) : 'не загружены');
#-------------------------------------------------------------------
$Comp = Comp_Load('Statuses/State', 'Profiles', $Profile);
if (Is_Error($Comp)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------
$Table = Array_Merge($Table, $Comp);
#-------------------------------------------------------------------
$Comp = Comp_Load('Tables/Standard', $Table, array('style' => 'width:500px;'));
if (Is_Error($Comp)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------
$DOM->AddChild('Into', $Comp);
#-------------------------------------------------------------------
if (Is_Error($DOM->Build(FALSE))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------
return array('Status' => 'Ok', 'DOM' => $DOM->Object);
default:
return ERROR | @Trigger_Error(101);