本文整理汇总了PHP中array_combine_key函数的典型用法代码示例。如果您正苦于以下问题:PHP array_combine_key函数的具体用法?PHP array_combine_key怎么用?PHP array_combine_key使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array_combine_key函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adjustFields
function adjustFields($fields)
{
if (!($id = $this->getIdValue())) {
$id = null;
}
$fields['position_list']['default'] = $this->_getPositionList($id);
if (isset($id)) {
$fields['layout_anchor_description']['default'] = $this->_describeLayoutAnchor($id);
return $fields;
}
$requested_selectors = array_combine_key($this->_selector_fields, $_GET);
if (!empty($requested_selectors)) {
foreach ($requested_selectors as $selector => $value) {
$fields[$selector]['type'] = 'select';
}
return $fields;
}
foreach ($fields as $key => $field_def) {
if (array_search($key, $this->_selector_fields) === FALSE) {
continue;
}
$fields[$key]['type'] = 'select';
}
return $fields;
}
示例2: export
function export(&$target_set, $args = null)
{
$sample = current($target_set);
$keys = $sample->export_keys();
$dump = array();
foreach ($keys as $key) {
$blank_set[$key] = null;
}
foreach ($target_set as $source) {
$values = $source->getData();
$user_values = array();
if (isset($values['uid']) && $values['uid']) {
$owner = new AMP_System_User_Profile(AMP_Registry::getDbcon(), $values['uid']);
if ($owner->hasData()) {
$owner_data = $owner->getData();
unset($owner_data['id']);
$user_values = array_combine_key($keys, $owner_data);
}
}
$safe_values = array_combine_key($keys, $values);
$dump[$source->id] = array_merge($blank_set, $safe_values, $user_values);
}
require_once 'AMP/Renderer/CSV.php';
$renderer = new AMP_Renderer_CSV();
$file = $renderer->format(array($keys));
$file .= $renderer->format($dump);
$renderer->header(date("Y_m_d__") . get_class($this));
print $file;
exit;
}
示例3: __construct
function __construct(&$source, $criteria = array())
{
$criteria = $source->makeCriteria($criteria);
$this->_source_array = array_combine_key(array_keys(AMPContent_Lookup::instance('galleryMap')), $source->search($criteria));
$this->_init_renderer($source);
$this->_tree = new AMP_System_Data_Tree($source);
}
示例4: adjustFields
function adjustFields($fields)
{
if (!($id = $this->getIdValue())) {
$id = null;
}
$nav_blocks = AMP_lookup('navBlocks');
foreach ($nav_blocks as $block_name => $token) {
$fields['order_tracker_' . $block_name] = array('type' => 'textarea', 'attr' => array('id' => 'order_tracker_amp_content_nav_location_values_' . $block_name));
}
//$fields['position_list']['default'] = $this->_getPositionList( $id );
if (isset($id)) {
$fields['layout_anchor_description']['default'] = $this->_describeLayoutAnchor($id);
return $fields;
}
$requested_selectors = array_combine_key($this->_selector_fields, $_GET);
if (!empty($requested_selectors)) {
foreach ($requested_selectors as $selector => $value) {
$fields[$selector]['type'] = 'select';
}
return $fields;
}
foreach ($fields as $key => $field_def) {
if (array_search($key, $this->_selector_fields) === FALSE) {
continue;
}
$fields[$key]['type'] = 'select';
}
return $fields;
}
示例5: getRequestedValues
function getRequestedValues($action, &$value_set)
{
if (is_string($this->actions[$action])) {
return $value_set[$this->actions[$action]];
}
return array_combine_key($this->actions[$action], $value_set);
}
示例6: _setSortTree
function _setSortTree(&$source, $sort_direction = false)
{
$lookup = new AMPContentLookup_LinkTypeMap();
$lookup_data = $lookup->dataset;
$order = array_keys($lookup_data);
$source = array_combine_key($order, $source);
}
示例7: readPayment
function readPayment($payment_ID)
{
$this->payment->readData($payment_ID);
$this->payment_method = $this->payment->paymentType->getData();
$this->item_record = array_combine_key($this->item_format, $this->payment->getData());
$this->readItem($this->item_record['payment_item_ID']);
$this->readUser($this->payment->getData('user_ID'));
}
示例8: _adjustSetData
function _adjustSetData($data)
{
$allowed_data = array_combine_key($this->adjust_fields, $data);
if (empty($allowed_data)) {
return false;
}
$this->itemdata = array_merge($this->itemdata, $allowed_data);
}
示例9: readData
function readData($id)
{
$sql = "Select * from payment_merchants where id = " . $this->dbcon->qstr($id);
$merchant_record = $this->dbcon->GetRow($sql);
if (!$merchant_record) {
return false;
}
$this->merchant_info = array_combine_key($this->merchant_info_keys, $merchant_record);
return $this->merchant_info;
}
示例10: render_galleries
function render_galleries($source)
{
$galleries = AMP_lookup('galleries_by_image', $source->getName());
if (empty($galleries)) {
return false;
}
$names = array_combine_key($galleries, AMP_lookup('galleries'));
$links = array_map(array($this, 'render_gallery_link'), array_keys($galleries), $names);
return join($this->_renderer->newline(), $links);
}
示例11: AMPSystemLookup_FormsWithEvents
function AMPSystemLookup_FormsWithEvents()
{
$owned_events = AMP_lookup('calendarEventOwner');
if (!$owned_events) {
return;
}
$this->criteria = 'id in( ' . join(',', $owned_events) . ') GROUP BY modin ';
$this->init();
$allowed_forms = array_keys($this->dataset);
$this->dataset = array_combine_key($allowed_forms, AMP_lookup('forms'));
}
示例12: read_request_sizes
function read_request_sizes($action)
{
if ($action == $this->_default_action) {
return;
}
$tainted_values = array_combine_key($this->_action_values[$action], $_REQUEST);
$clear_values = array();
foreach ($this->_action_values[$action] as $key) {
$clear_values[$key] = isset($tainted_values[$key]) && intval($tainted_values[$key]) ? abs(intval($tainted_values[$key])) : 0;
}
if ($action == 'resize') {
if ($this->_keep_proportions) {
if ($clear_values['height'] && $clear_values['width']) {
$requested_proportion = $clear_values['height'] / $clear_values['width'];
if ($this->_image_ref->height / $clear_values['height'] > $this->_image_ref->width / $clear_values['width']) {
$clear_values['width'] = false;
} else {
$clear_values['height'] = false;
}
}
}
if (!$clear_values['width'] && $clear_values['height']) {
$clear_values['width'] = $this->_image_ref->width * ($clear_values['height'] / $this->_image_ref->height);
}
if (!$clear_values['height'] && $clear_values['width']) {
$clear_values['height'] = $this->_image_ref->height * ($clear_values['width'] / $this->_image_ref->width);
}
}
if (isset($clear_values['height']) && !$clear_values['height']) {
$clear_values['height'] = $this->_image_ref->height;
}
if (isset($clear_values['width']) && !$clear_values['width']) {
$clear_values['width'] = $this->_image_ref->width;
}
if ($action == 'crop') {
if (!$clear_values['end_x']) {
$clear_values['end_x'] = $clear_values['start_x'] + $clear_values['width'];
}
if (!$clear_values['end_y']) {
$clear_values['end_y'] = $clear_values['start_y'] + $clear_values['height'];
}
if ($clear_values['end_x'] > $this->_image_ref->width || $clear_values['end_x'] < $clear_values['start_x']) {
$clear_values['end_x'] = $this->_image_ref->width;
}
if ($clear_values['end_y'] > $this->_image_ref->height || $clear_values['end_y'] < $clear_values['start_y']) {
$clear_values['end_y'] = $this->_image_ref->height;
}
if ($clear_values['start_x'] >= $this->_image_ref->width || $clear_values['start_y'] >= $this->_image_ref->height) {
$this->_display->set_action($this->_default_action);
}
}
$this->_image_sizes = $clear_values;
$this->_display->set_sizes($clear_values);
}
示例13: scriptStyle
function scriptStyle($template)
{
if ($styleset = array_combine_key($this->css_template_vars, $this->getStyle())) {
if (isset($styleset['id'])) {
$styleset['id'] = $this->id;
}
$openheart = vsprintf($template, $styleset);
return $openheart;
}
return false;
}
示例14: load_sections
function load_sections($live_only = 0)
{
$allowed_sections = AMP_lookup('sectionMap');
$lookup_name = $live_only ? 'sectionsLive' : 'sections';
$section_names = array_combine_key(array_keys($allowed_sections), AMP_lookup($lookup_name));
$article_locations = $this->_article->getAllSections();
$section_list = array_combine_key($article_locations, $section_names);
asort($section_list);
if (defined('AMP_CUSTOM_ITEM_BLOG_SECTION')) {
unset($section_list[AMP_CUSTOM_ITEM_BLOG_SECTION]);
}
return $section_list;
}
示例15: _addSeparator
function _addSeparator($template, $separator)
{
if ($separator == 'endform') {
return $template . $this->pattern_parts['endform'];
}
$separator_pattern = $this->pattern_parts[$separator];
$separator_template = $separator_pattern;
if (!(strpos($separator_pattern, 'class=') === FALSE)) {
$css_keys = array_combine_key($this->element_css_keys['separator'], $this->element_css_classes);
$separator_template = vsprintf($separator_pattern, $css_keys);
}
return $separator_template . $template;
}