Tribe__Events__Aggregator__Record__Abstract::setup_meta( array $meta )
Sets up meta fields by de-prefixing them into the array
Contents
Parameters
- $meta
-
(array) (Required) Meta array.
Source
File: src/Tribe/Aggregator/Record/Abstract.php
public function setup_meta( $meta ) {
foreach ( $meta as $key => $value ) {
$key = preg_replace( '/^' . self::$meta_key_prefix . '/', '', $key );
$this->meta[ $key ] = maybe_unserialize( is_array( $value ) ? reset( $value ) : $value );
}
// `source` will be empty when importing .ics files
$this->meta['source'] = ! empty ( $this->meta['source'] ) ? $this->meta['source'] : '';
$original_source = $this->meta['source'];
// Intelligently prepend "http://" if the protocol is missing from the source URL
if ( ! empty( $this->meta['source'] ) && false === strpos( $this->meta['source'], '://' ) ) {
$this->meta['source'] = 'http://' . $this->meta['source'];
}
/**
* Provides an opportunity to set or modify the source URL for an import.
*
* @since 4.5.11
*
* @param string $source
* @param string $original_source
* @param WP_Post $record
* @param array $meta
*/
$this->meta['source'] = apply_filters(
'tribe_aggregator_meta_source',
$this->meta['source'],
$original_source,
$this->post,
$this->meta
);
// This prevents lots of isset checks for no reason
if ( empty( $this->meta['activity'] ) ) {
$this->meta['activity'] = new Tribe__Events__Aggregator__Record__Activity();
}
}