本文整理汇总了PHP中array_merge_recursive_distinct函数的典型用法代码示例。如果您正苦于以下问题:PHP array_merge_recursive_distinct函数的具体用法?PHP array_merge_recursive_distinct怎么用?PHP array_merge_recursive_distinct使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array_merge_recursive_distinct函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array_merge_recursive_distinct
/**
* Merges any number of arrays / parameters recursively, replacing
* entries with string keys with values from latter arrays.
* If the entry or the next value to be assigned is an array, then it
* automagically treats both arguments as an array.
* Numeric entries are appended, not replaced, but only if they are
* unique
*
* calling: result = array_merge_recursive_distinct(a1, a2, ... aN)
**/
function array_merge_recursive_distinct()
{
$arrays = func_get_args();
$base = array_shift($arrays);
if (!is_array($base)) {
$base = empty($base) ? array() : array($base);
}
foreach ($arrays as $append) {
if (!is_array($append)) {
$append = array($append);
}
foreach ($append as $key => $value) {
if (!array_key_exists($key, $base) and !is_numeric($key)) {
$base[$key] = $append[$key];
continue;
}
if (is_array($value) or is_array($base[$key])) {
$base[$key] = array_merge_recursive_distinct($base[$key], $append[$key]);
} else {
if (is_numeric($key)) {
if (!in_array($value, $base)) {
$base[] = $value;
}
} else {
$base[$key] = $value;
}
}
}
}
return $base;
}
示例2: registerTaxonomy
/**
* Registers a taxonomy
*
* @param string $slug the slug of the taxonomy
* @param string $singular singular name
* @param string $plural plural name
* @param string $letter letter after "Übergeordnete" and "Neue" -> Could be "n" or "s"
* @param array $config override the configuration with this array
* @param array $types the types to be assigned (defaults to array("post"))
*/
public static function registerTaxonomy($slug, $singular, $plural, $letter = '', $config = array(), $types = array('post'))
{
if (!is_array($types)) {
$types = array($types);
}
$labels = array('name' => $singular, 'singular_name' => $singular, 'search_items' => $plural . ' suchen', 'popular_items' => '', 'all_items' => 'Alle ' . $plural, 'view_item' => $singular . ' ansehen', 'parent_item' => 'Übergeordnete' . $letter . ' ' . $singular, 'parent_item_colon' => 'Übergeordnete' . $letter . ' ' . $singular . ':', 'edit_item' => $singular . ' bearbeiten', 'update_item' => $singular . ' speichern', 'add_new_item' => 'Neue' . $letter . ' ' . $singular . ' hinzufügen', 'new_item_name' => 'Neue' . $letter . ' ' . $singular, 'separate_items_with_commas' => $plural . ' durch Komma trennen', 'add_or_remove_items' => $plural . ' hinzufügen oder entfernen', 'menu_name' => $plural);
$defaults = array('hierarchical' => true, 'public' => true, 'labels' => $labels, 'also_show_in_menu' => false, 'submenu_page_url' => 'edit-tags.php?taxonomy=' . $slug, 'submenu_priority' => 10);
$arguments = array_merge_recursive_distinct($defaults, $config);
if ($arguments['also_show_in_menu'] !== false) {
add_action('admin_menu', function () use($slug, $arguments, $types) {
add_submenu_page($arguments['also_show_in_menu'], $arguments['labels']['name'], $arguments['labels']['menu_name'], 'manage_categories', $arguments['submenu_page_url']);
}, $arguments['submenu_priority']);
// show submenu entry in 'show_in_menu' menu
add_action('parent_file', function ($parentFile) use($arguments, $types) {
if ($parentFile == 'edit.php?post_type=' . $types[0]) {
$parentFile = $arguments['also_show_in_menu'];
}
return $parentFile;
});
}
register_taxonomy($slug, $types, $arguments);
// make sure it works as suggested by codex (http://codex.wordpress.org/Function_Reference/register_taxonomy#Usage "better be safe than sorry")
foreach ($types as $type) {
register_taxonomy_for_object_type($slug, $type);
}
}
示例3: array_merge_recursive_distinct
/**
* Merges an array recursively over writting the previous value of an identical associated key.
* @param array $array1 Array which will be overwritten.
* @param array $array2 Array who will overwrite.
* @return array
*/
function array_merge_recursive_distinct($array1, $array2)
{
$merged = $array1;
foreach ($array2 as $key => &$value) {
$merged[$key] = is_array($value) && isset($merged[$key]) && is_array($merged[$key]) ? array_merge_recursive_distinct($merged[$key], $value) : $value;
}
return $merged;
}
示例4: array_merge_recursive_distinct
function array_merge_recursive_distinct(array &$array1, array &$array2)
{
$merged = $array1;
foreach ($array2 as $key => &$value) {
if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
$merged[$key] = array_merge_recursive_distinct($merged[$key], $value);
} else {
$merged[$key] = $value;
}
}
return $merged;
}
示例5: getOrderList
/**
* Return all active orders with existing e-mail-adresses
*
* @dependencies
* @return array
*/
public function getOrderList()
{
// Load dependencies
$this->system->orders->loadAll();
$this->system->emails->loadOrderMailCount();
$data = array_merge_recursive_distinct($this->system->order->loadAll()->getOrder(), $this->system->email->loadOrderMailCount()->getOrder());
foreach ($data as $row) {
if ($row['has_active_tariff'] == 1 && isset($row['mail_addresses']) && $row['mail_addresses'] > 0) {
$return[$row['ordnr']] = ['oeid' => $row['oeid'], 'cus_company' => $row['cus_company'], 'cus_first_name' => $row['cus_first_name'], 'cus_last_name' => $row['cus_last_name'], 'mail_addresses' => $row['mail_addresses']];
}
}
return $return;
}
示例6: resolve_prefabs
function resolve_prefabs($item, &$schema)
{
if (isset($item["prefab"])) {
$prefabs = explode(" ", $item["prefab"]);
foreach ($prefabs as $prefab) {
$prefab_data = $schema["prefabs"][$prefab];
if (is_array($prefab_data)) {
$item = array_merge_recursive_distinct($item, resolve_prefabs($prefab_data, $schema));
}
}
}
return $item;
}
示例7: values
function values($form_name)
{
global $wpdb;
$rows = $wpdb->get_results($wpdb->prepare("SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name LIKE %s ", 'skip_framework_value_' . $form_name . '%'));
$start_field = strlen('skip_framework_value_' . $form_name . '_');
$values = array();
foreach ($rows as $row) {
$values_new = array();
$length_field = strlen($row->option_name);
$field_name = substr($row->option_name, $start_field, $length_field);
$fieldname_array = split(SKIP_DELIMITER, $field_name);
$values_new[$fieldname_array[0]] = _reconstruct_value($fieldname_array, $row->option_value);
$values = array_merge_recursive_distinct($values, $values_new);
}
return $values;
}
示例8: func_get_args
/**
* Normally recursive merging of arrays
* @return array
*/
function &array_merge_recursive_distinct()
{
$aArrays = func_get_args();
$aMerged = $aArrays[0];
for ($i = 1; $i < count($aArrays); $i++) {
if (is_array($aArrays[$i])) {
foreach ($aArrays[$i] as $key => $val) {
if (is_array($aArrays[$i][$key])) {
if (isset($aMerged[$key])) {
$aMerged[$key] = is_array($aMerged[$key]) ? array_merge_recursive_distinct($aMerged[$key], $aArrays[$i][$key]) : $aArrays[$i][$key];
} else {
$aMerged[$key] = $aArrays[$i][$key];
}
} else {
$aMerged[$key] = $val;
}
}
}
}
return $aMerged;
}
示例9: getConfig
/**
* Load the configuration from the various YML files.
*/
public function getConfig()
{
$config = array();
// Read the config
$config['general'] = array_merge($this->parseConfigYaml('config.yml'), $this->parseConfigYaml('config_local.yml'));
$config['taxonomy'] = $this->parseConfigYaml('taxonomy.yml');
$tempContentTypes = $this->parseConfigYaml('contenttypes.yml');
$config['menu'] = $this->parseConfigYaml('menu.yml');
$config['routing'] = $this->parseConfigYaml('routing.yml');
$config['permissions'] = $this->parseConfigYaml('permissions.yml');
$config['extensions'] = array();
// fetch the theme config. requires special treatment due to the path
$this->app['resources']->initializeConfig($config);
$paths = $this->app['resources']->getPaths();
$themeConfigFile = $paths['themepath'] . '/config.yml';
$config['theme'] = $this->parseConfigYaml($themeConfigFile, array(), false);
// @todo: If no config files can be found, get them from bolt.cm/files/default/
$this->paths = $this->app['resources']->getPaths();
$this->setDefaults();
// Make sure old settings for 'contentsCss' are still picked up correctly
if (isset($config['general']['wysiwyg']['ck']['contentsCss'])) {
$config['general']['wysiwyg']['ck']['contentsCss'] = array(1 => $config['general']['wysiwyg']['ck']['contentsCss']);
}
// Make sure old settings for 'accept_file_types' are not still picked up. Before 1.5.4 we used to store them
// as a regex-like string, and we switched to an array. If we find the old style, fall back to the defaults.
if (isset($config['general']['accept_file_types']) && !is_array($config['general']['accept_file_types'])) {
unset($config['general']['accept_file_types']);
}
// Merge the array with the defaults. Setting the required values that aren't already set.
$config['general'] = array_merge_recursive_distinct($this->defaultConfig, $config['general']);
// Make sure the cookie_domain for the sessions is set properly.
if (empty($config['general']['cookies_domain'])) {
if (isset($_SERVER['HTTP_HOST'])) {
$hostname = $_SERVER['HTTP_HOST'];
} elseif (isset($_SERVER['SERVER_NAME'])) {
$hostname = $_SERVER['SERVER_NAME'];
} else {
$hostname = '';
}
// Don't set the domain for a cookie on a "TLD" - like 'localhost', or if the server_name is an IP-address
if (strpos($hostname, '.') > 0 && preg_match("/[a-z0-9]/i", $hostname)) {
if (preg_match("/^www[0-9]*./", $hostname)) {
$config['general']['cookies_domain'] = '.' . preg_replace("/^www[0-9]*./", '', $hostname);
} else {
$config['general']['cookies_domain'] = '.' . $hostname;
}
// Make sure we don't have consecutive '.'-s in the cookies_domain..
$config['general']['cookies_domain'] = str_replace('..', '.', $config['general']['cookies_domain']);
} else {
$config['general']['cookies_domain'] = '';
}
}
// Make sure Bolt's mount point is OK:
$config['general']['branding']['path'] = '/' . safeString($config['general']['branding']['path']);
// Make sure $config['taxonomy'] is an array. (if the file is empty, YAML parses it as NULL)
if (empty($config['taxonomy'])) {
$config['taxonomy'] = array();
}
// Clean up taxonomies
foreach ($config['taxonomy'] as $key => $value) {
if (!isset($config['taxonomy'][$key]['name'])) {
$config['taxonomy'][$key]['name'] = ucwords($config['taxonomy'][$key]['slug']);
}
if (!isset($config['taxonomy'][$key]['singular_name'])) {
if (isset($config['taxonomy'][$key]['singular_slug'])) {
$config['taxonomy'][$key]['singular_name'] = ucwords($config['taxonomy'][$key]['singular_slug']);
} else {
$config['taxonomy'][$key]['singular_name'] = ucwords($config['taxonomy'][$key]['slug']);
}
}
if (!isset($config['taxonomy'][$key]['slug'])) {
$config['taxonomy'][$key]['slug'] = strtolower(safeString($config['taxonomy'][$key]['name']));
}
if (!isset($config['taxonomy'][$key]['singular_slug'])) {
$config['taxonomy'][$key]['singular_slug'] = strtolower(safeString($config['taxonomy'][$key]['singular_name']));
}
if (!isset($config['taxonomy'][$key]['has_sortorder'])) {
$config['taxonomy'][$key]['has_sortorder'] = false;
}
// Make sure the options are $key => $value pairs, and not have implied integers for keys.
if (!empty($config['taxonomy'][$key]['options']) && is_array($config['taxonomy'][$key]['options'])) {
$options = array();
// FIXME using $value variable seems bad idea because of outer loop uses too
foreach ($config['taxonomy'][$key]['options'] as $optionkey => $value) {
if (is_numeric($optionkey)) {
$optionkey = makeSlug($value);
// was: strtolower(safeString($value));
}
$options[$optionkey] = $value;
}
$config['taxonomy'][$key]['options'] = $options;
}
// If taxonomy is like tags, set 'tagcloud' to true by default.
if ($config['taxonomy'][$key]['behaves_like'] == 'tags' && !isset($config['taxonomy'][$key]['tagcloud'])) {
$config['taxonomy'][$key]['tagcloud'] = true;
}
}
//.........这里部分代码省略.........
示例10: LoadServers
/**
* Load server settings from specified ini file
*
* @param string $cfgfile ini file to load from
* @return array server config block (also stored as $this->servers)
*/
function LoadServers($assign = true)
{
//Profiler::StartTimer("ConfigManager::LoadServers()");
$servers = array();
// new method
$this->LoadSettings($this->locations["config"] . "/servers.ini");
$this->role = $this->GetRoleFromHostname();
$servers = array_merge_recursive_distinct($servers, $this->GetRoleSettings("default"));
$servers = array_merge_recursive_distinct($servers, $this->GetRoleSettings($this->role));
$this->locations = $this->getlocations();
// DISABLED - old method, had better caching of combined role config
/*
if (file_exists($cfgfile)) {
$mtime = filemtime($cfgfile);
if (!empty($mtime)) {
// NOTE - This uses APC directly, since the datamanager object requires this function to execute before initializing
$apckey = $cfgfile . "." . $mtime;
//print "check apc for '$apckey'<br />";
if ($this->apcenabled && ($apccontents = apc_fetch($apckey)) != false) {
//print "found in apc, unserialize ($apccontents)<br />";
$servers = unserialize($apccontents);
} else {
//print "not found in apc, parse it<br />";
$settings = parse_ini_file($cfgfile, true);
Logger::Info("Loading server config: $hostname");
// First load the defaults
if (!empty($settings["default"])) {
array_set_multi($servers, $settings["default"]);
}
// set the role
//$servers["role"] = ($settings["mapping"][$hostname]) ? $settings["mapping"][$hostname] : "live"; // default to live so the site will work if /etc/hostname is missing
// If our host is part of a grouping, load those settings up
if (!empty($settings["mapping"]) && !empty($settings["mapping"][$hostname]) && !empty($settings[$settings["mapping"][$hostname]])) {
Logger::Info("$hostname is currently in the '" . $settings["mapping"][$hostname] . "' group");
array_set_multi($servers, $settings[$settings["mapping"][$hostname]]);
}
// And finally, load any host-specific settings
if (!empty($settings[$hostname])) {
array_set_multi($servers, $settings[$hostname]);
}
if ($this->apcenabled) {
apc_store($apckey, serialize($servers));
}
}
}
}
*/
if ($assign) {
$this->servers =& $servers;
if (!empty($this->servers["role"])) {
// ini file specified overridden role
$this->role = $this->servers["role"];
}
}
//Profiler::StopTimer("ConfigManager::LoadServers()");
// set logger/profiler settings
if (isset($this->servers["logger"]["enabled"]) && empty($this->servers["logger"]["enabled"])) {
Logger::$enabled = false;
}
if (isset($this->servers["profiler"]["enabled"]) && empty($this->servers["profiler"]["enabled"])) {
Profiler::$enabled = false;
}
// Update locations to reflect any new settings we got from the ini file
$this->locations = $this->getLocations();
// Merge any path settings from the config file into our environment
if (!empty($this->servers["elation"]["path"])) {
$elationpath = explode(":", $this->servers["elation"]["path"]);
$oldincludepath = get_include_path();
$includepath = explode(":", $oldincludepath);
$newincludepath = implode(":", array_merge(array_diff($elationpath, $includepath), $includepath));
if ($newincludepath != $oldincludepath) {
// set_include_path($newincludepath);
}
}
// Merge any settings which are overridden by a dev cookie
if (!empty($_COOKIE["tf-dev"])) {
$tfdev = json_decode($_COOKIE["tf-dev"], true);
if (!empty($tfdev["serveroverrides"])) {
$this->SetServerOverride($tfdev["serveroverrides"]);
}
}
return $servers;
}
示例11: array
<?php
include 'config.php';
require_once './system/bootstrap.php';
require_once './system/anti-framework/AF.php';
$default_config = array('log' => array('type' => 'AF_Log_Array', 'params' => array('register_shutdown' => true)), 'db' => array('master' => array('dsn' => 'mysql:dbname=REPLACE_ME;host=127.0.0.1', 'username' => 'root', 'password' => 'password', 'identifier' => 'test')));
$config = array_merge_recursive_distinct($default_config, $config);
AF::setConfig($config);
try {
AF::bootstrap(AF::PAGE_GEN);
} catch (PDOException $e) {
die('Error connection to database: ' . $e->getMessage());
}
$table = new AF_Table('wp_options', 'option_name');
//echo '<pre>';
//var_dump();
$results = $table->get('siteurl', AF::DELAY_SAFE);
?>
<!doctype html>
<html>
<head>
<title>Ideas</title>
<style>
@import url("reset.css");
.topic {
background: #eee;
padding: 20px;
margin-bottom: 2em;
clear: both;
overflow: auto;
示例12: getNumberHtml
/**
* Get the HTML output of an <input> element of type 'number'.
*
* @since 4.8.1
* @param string|int $value The input element's value.
* @param array $args Data for the input element.
* @return string The input element HTML.
*/
public static function getNumberHtml($value, $args = array())
{
$defaults = array('type' => 'number', 'class' => '', 'placeholder' => isset($args['label']) ? $args['label'] : '', 'min' => 0, 'max' => '', 'step' => 1);
$args = array_merge_recursive_distinct($defaults, $args);
return sprintf('<input id="%1$s" type="%2$s" name="%3$s" value="%4$s" class="%5$s" placeholder="%6$s" min="%7$s" max="%8$s" step="%9$s" />', esc_attr($args['id']), $args['type'], $args['name'], esc_attr($value), $args['class'], $args['placeholder'], $args['min'], $args['max'], $args['step']);
}
示例13: __construct
//.........这里部分代码省略.........
$this->data = $formattedFilesData;
}
}
if (!empty($this->data)) {
$this->params["data"] = $this->data;
}
/*
* Soma em $this->data os dados necessários
*
* Os dados que estiverem na Session no seguinte endereço serão
* acrescentados em $this->data.
*
* $_SESSION["Sys"]
* ["addToThisData"]
* [$modelName]
* [$campo] = $valor;
*/
/**
* Cada form tem um id. Se foi enviado um $_POST[formId], vai adiante
* para inserir dados em $this->data.
*/
//pr($this->params);
if (!empty($this->params["post"]["formId"])) {
/**
* Pega o valor a ser incrementado em $this->data e guarda em $toAdd
*/
if (!empty($_SESSION["Sys"]["addToThisData"][$this->params["post"]["formId"]])) {
$toAdd = $_SESSION["Sys"]["addToThisData"][$this->params["post"]["formId"]];
}
/**
* Se $this->data existe e ha algo a ser inserido
*/
if (!empty($this->data) and !empty($toAdd)) {
$this->data = array_merge_recursive_distinct($toAdd, $this->data);
} else {
if (!empty($toAdd)) {
if ($this->params["url"] !== $_SESSION["Sys"]["options"]["addToThisData"][$this->params["post"]["formId"]]["destLocation"]) {
unset($_SESSION["Sys"]["addToThisData"][$this->params["post"]["formId"]]);
} else {
$this->data = $toAdd;
}
}
}
} else {
if (!empty($_SESSION["Sys"]["addToThisData"])) {
$toAdd = $_SESSION["Sys"]["addToThisData"];
}
/**
* Se $this->data existe e ha algo a ser inserido
*/
if (!empty($this->data) and !empty($toAdd)) {
$this->data = array_merge_recursive_distinct($toAdd, $this->data);
} else {
if (!empty($toAdd)) {
//echo $this->params["post"]["formId"]."";
/*
if( $this->params["url"] !== $_SESSION["Sys"]["options"]["addToThisData"]["destLocation"] ){
unset( $_SESSION["Sys"]["addToThisData"] );
} else {
$this->data = $toAdd;
}
*
*/
}
}
}
示例14: AddSource
function AddSource($sourcetype, $cfg)
{
if (!empty($cfg)) {
Profiler::StartTimer("DataManager::Init() - Add source: {$sourcetype}", 3);
// Check to see if we have a wrapper for this sourcetype in include/datawrappers/*wrapper_class.php
// If it exists, include the code for it and initialize
$includefile = "include/datawrappers/" . strtolower($sourcetype) . "wrapper_class.php";
if (file_exists_in_path($includefile)) {
include_once $includefile;
foreach ($cfg as $sourcename => $sourcecfg) {
Profiler::StartTimer(" - {$sourcetype}({$sourcename})", 3);
// Server groups get special handling at this level so they can be applied to all types
if (!empty($sourcecfg["group"]) && ($group = $this->GetGroup($sourcecfg["group"])) !== NULL) {
Logger::Notice("Merged source group '{$sourcecfg['group']}' into {$sourcename}");
$sourcecfg = array_merge_recursive($sourcecfg, $group);
}
// If this source references another source, load those settings underneath, and override with my own
if (!empty($sourcecfg["source"])) {
$othercfg = array_get($this->cfg->servers["sources"], $sourcecfg["source"]);
if (!empty($othercfg)) {
$sourcecfg = array_merge_recursive_distinct($othercfg, $sourcecfg);
}
}
$classname = $sourcetype . "wrapper";
$sourcewrapper = new $classname($sourcename, $sourcecfg, true);
if (!empty($sourcecfg["cache"]) && $sourcecfg["cache"] != "none") {
if ($cacheobj = array_get($this->caches, $sourcecfg["cache"])) {
$sourcewrapper->SetCacheServer($cacheobj, any($sourcecfg["cachepolicy"], true));
}
}
array_set($this->sources, $sourcetype . "." . $sourcename, $sourcewrapper);
Logger::Notice("Added source '{$sourcetype}.{$sourcename}': " . $sourcecfg["host"]);
Profiler::StopTimer(" - {$sourcetype}({$sourcename})");
}
} else {
Logger::Debug("Tried to instantiate source '{$sourcetype}', but couldn't find class");
}
Profiler::StopTimer("DataManager::Init() - Add source: {$sourcetype}");
}
}
示例15: array
$box_title = $user['display_name'];
}
} else {
$user = array();
$deleteLabel = "";
}
$fields_default = ['user_name' => ['type' => 'text', 'label' => 'Username', 'display' => 'disabled', 'validator' => ['minLength' => 1, 'maxLength' => 25, 'label' => 'Username'], 'placeholder' => 'Please enter the user name'], 'display_name' => ['type' => 'text', 'label' => 'Display Name', 'display' => 'disabled', 'validator' => ['minLength' => 1, 'maxLength' => 50, 'label' => 'Display name'], 'placeholder' => 'Please enter the display name'], 'email' => ['type' => 'text', 'label' => 'Email', 'display' => 'disabled', 'icon' => 'fa fa-envelope', 'icon_link' => 'mailto: {{value}}', 'validator' => ['minLength' => 1, 'maxLength' => 150, 'email' => true, 'label' => 'Email'], 'placeholder' => 'Email goes here'], 'title' => ['type' => 'text', 'label' => 'Title', 'display' => 'disabled', 'validator' => ['minLength' => 1, 'maxLength' => 100, 'label' => 'Title'], 'default' => 'New User'], 'sign_up_stamp' => ['type' => 'text', 'label' => 'Registered Since', 'display' => 'disabled', 'icon' => 'fa fa-calendar', 'preprocess' => 'formatSignInDate'], 'last_sign_in_stamp' => ['type' => 'text', 'label' => 'Last Sign-in', 'display' => 'disabled', 'icon' => 'fa fa-calendar', 'preprocess' => 'formatSignInDate', 'default' => 0], 'password' => ['type' => 'password', 'label' => 'Password', 'display' => 'hidden', 'icon' => 'fa fa-key', 'validator' => ['minLength' => 8, 'maxLength' => 50, 'label' => 'Password', 'passwordMatch' => 'passwordc']], 'passwordc' => ['type' => 'password', 'label' => 'Confirm password', 'display' => 'hidden', 'icon' => 'fa fa-key', 'validator' => ['minLength' => 8, 'maxLength' => 50, 'label' => 'Password']], 'groups' => ['display' => 'disabled']];
$fields = array_merge_recursive_distinct($fields_default, $get['fields']);
// Buttons (optional)
// submit: display the submission button for this form.
// edit: display the edit button for panel mode.
// disable: display the enable/disable button.
// delete: display the deletion button.
// activate: display the activate button for inactive users.
$buttons_default = ["btn_submit" => ["type" => "submit", "label" => $button_submit_text, "display" => "hidden", "style" => "success", "size" => "lg"], "btn_edit" => ["type" => "launch", "label" => "Edit", "icon" => "fa fa-edit", "display" => "show"], "btn_activate" => ["type" => "button", "label" => "Activate", "icon" => "fa fa-bolt", "display" => isset($user['active']) && $user['active'] == '0' ? "show" : "hidden", "style" => "success"], "btn_disable" => ["type" => "button", "label" => "Disable", "icon" => "fa fa-minus-circle", "display" => isset($user['enabled']) && $user['enabled'] == '1' ? "show" : "hidden", "style" => "warning"], "btn_enable" => ["type" => "button", "label" => "Enable", "icon" => "fa fa-plus-circle", "display" => isset($user['enabled']) && $user['enabled'] == '1' ? "hidden" : "show", "style" => "warning"], "btn_delete" => ["type" => "launch", "label" => "Delete", "icon" => "fa fa-trash-o", "display" => "show", "data" => array("label" => $deleteLabel), "style" => "danger"], "btn_cancel" => ["type" => "cancel", "label" => "Cancel", "display" => $get['render_mode'] == 'modal' ? "show" : "hidden", "style" => "link", "size" => "lg"]];
$buttons = array_merge_recursive_distinct($buttons_default, $get['buttons']);
$template = "";
if ($get['render_mode'] == "modal") {
$template .= "<div id='{$get['box_id']}' class='modal fade'>\n <div class='modal-dialog'>\n <div class='modal-content'>\n <div class='modal-header'>\n <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>×</button>\n <h4 class='modal-title'>{$box_title}</h4>\n </div>\n <div class='modal-body'>\n <form method='post' action='{$target}'>";
} else {
if ($get['render_mode'] == "panel") {
$template .= "<div class='panel panel-primary'>\n <div class='panel-heading'>\n <h2 class='panel-title pull-left'>{$box_title}</h2>\n <div class='clearfix'></div>\n </div>\n <div class='panel-body'>\n <form method='post' action='{$target}'>";
} else {
echo "Invalid render mode.";
exit;
}
}
// Load CSRF token
$csrf_token = $loggedInUser->csrf_token;
$template .= "<input type='hidden' name='csrf_token' value='{$csrf_token}'/>";
$template .= "\n<div class='dialog-alert'>\n</div>\n<div class='row'>\n <div class='col-sm-6'>\n {{user_name}}\n </div>\n <div class='col-sm-6'>\n {{display_name}}\n </div> \n</div>\n<div class='row'>\n <div class='col-sm-6'>\n {{email}}\n </div>\n <div class='col-sm-6'>\n {{title}}\n </div> \n</div>\n<div class='row'>\n <div class='col-sm-6'>\n {{last_sign_in_stamp}}\n </div>\n <div class='col-sm-6'>\n {{sign_up_stamp}}\n </div> \n</div>\n<div class='row'>\n <div class='col-sm-6'>\n {{password}}\n {{passwordc}}\n </div>";