elements_manager->create_element_instance( $_widget ); if ( isset( $_widget['templateID'] ) ) { $type = UAEL_Helper::get_global_widget_type( $_widget['templateID'], 1 ); $element_class = $type->get_class_name(); try { $widget = new $element_class( $_widget, array() ); } catch ( \Exception $e ) { return null; } } $settings = $widget->get_settings(); $content_schema_warning = false; $enable_schema = $settings['schema_support']; $video_link = $this->get_video_link( $settings ); $is_custom_thumbnail = 'yes' === $settings['show_image_overlay'] ? true : false; $custom_thumbnail_url = isset( $settings['image_overlay']['url'] ) ? $settings['image_overlay']['url'] : ''; if ( 'yes' === $enable_schema && ( ( '' === $settings['schema_title'] || '' === $settings['schema_description'] || ( ! $is_custom_thumbnail && '' === $settings['schema_thumbnail']['url'] ) || '' === $settings['schema_upload_date'] ) || ( $is_custom_thumbnail && '' === $custom_thumbnail_url ) ) ) { $content_schema_warning = true; } if ( 'yes' === $enable_schema && false === $content_schema_warning ) { $upload_date = new \DateTime( $settings['schema_upload_date'] ); $video_data = array( '@context' => 'https://schema.org', '@type' => 'VideoObject', 'name' => $settings['schema_title'], 'description' => $settings['schema_description'], 'thumbnailUrl' => ( $is_custom_thumbnail ) ? $custom_thumbnail_url : $settings['schema_thumbnail']['url'], 'uploadDate' => $upload_date->format( 'Y-m-d\TH:i:s\Z' ), 'contentUrl' => $video_link, 'embedUrl' => $video_link, ); } } UAEL_Helper::print_json_schema( $video_data ); } } /** * Get widget name. * * @since 1.36.5 * @access public * @param array $data The builder content. * @param int $post_id The post ID. */ public function get_widget_data( $data, $post_id ) { Plugin::$instance->db->iterate_data( $data, function ( $element ) use ( &$widgets ) { $type = UAEL_Helper::get_widget_type( $element ); if ( 'uael-video' === $type ) { self::$all_video_widgets[] = $element; } return $element; } ); return $data; } }