shortcodes[] = 'embedyt'; } } /** * Analyse a video shortcode from the plugin for usable video information * * @param string $full_shortcode Full shortcode as found in the post content. * @param string $sc Shortcode found. * @param array $atts Shortcode attributes - already decoded if needed. * @param string $content The shortcode content, i.e. the bit between [sc]content[/sc]. * * @return array An array with the usable information found or else an empty array. */ public function get_info_from_shortcode( $full_shortcode, $sc, $atts = array(), $content = '' ) { $vid = array(); if ( isset( $content ) && ( is_string( $content ) && $content !== '' ) ) { $vid['type'] = 'youtube'; $list = explode( '&', $content ); $vid['url'] = $list[0]; unset( $list[0] ); if ( $list !== array() ) { // Retrieve width/height. foreach ( $list as $key => $value ) { $value = explode( '=', $value ); if ( in_array( $value[0], array( 'width', 'height', 'w', 'h' ), true ) ) { if ( ! empty( $value[1] ) ) { $atts[ $value[0] ] = $value[1]; } unset( $list[ $key ] ); } } $vid = $this->maybe_get_dimensions( $vid, $atts, true ); /* * Any attributes left over are partly real url parts, partly plugin settings, let's * just put them back on... */ if ( $list !== array() ) { $vid['url'] = $vid['url'] . '&' . implode( '&', $list ); } } } return $vid; } } }