AnsPress_Query::add_pos( string $type, integer $ref_id, mixed $key )
Description #
Add position of reference in objects.
Parameters #
- $typestring (Required) ids type.
- $ref_idinteger (Required) Reference ID.
- $keymixed (Required) Object key.
Source #
File: includes/class-query.php
public function add_pos( $type, $ref_id, $key ) {
if ( ! isset( $this->pos[ $type ] ) ) {
$this->pos[ $type ] = array();
}
if ( ! isset( $this->pos[ $type ][ $ref_id ] ) ) {
$this->pos[ $type ][ $ref_id ] = $key;
return;
}
$prev_val = $this->pos[ $type ][ $ref_id ];
if ( ! is_array( $prev_val ) ) {
$this->pos[ $type ][ $ref_id ] = array( $prev_val, $key );
return;
}
if ( is_array( $prev_val ) ) {
$this->pos[ $type ][ $ref_id ][] = $key;
}
}
Expand full source code Collapse full source code View on GitHub: includes/class-query.php:274
Add your comment