'', 'type' => '' ), $paras ); // Add content to parameter array $paras[ 'content' ] = $content; // Call function to generate code return do_shortcode( ave_generate_embed_code( $paras ) ); } add_shortcode( 'vine', 'ave_embed_shortcode' ); /** * Generate embed code * * Generate the Vine embed code based on supplied parameters * * @since 1.0 * * @param string $paras Array of parameters * @return string Vine code */ function ave_generate_embed_code( $paras ) { extract( $paras ); $options = ave_get_options(); // If no ID is specified used the content parameter // However, strip down the URL to leave just the ID if ( !isset( $id ) ) { $id = str_replace( 'vine.co/v/', '', $content ); $id = str_replace( 'https://', '', $id ); $id = str_replace( 'http://', '', $id ); $id = str_replace( '/embed', '', $id ); } // Generate video type $type = strtolower( $type ); if ( ( $type != 'simple' ) && ( $type != 'postcard' ) ) { $type = $options[ 'type' ]; } // Get size if ( ( !isset( $size ) ) or ( !is_numeric( $size ) ) ) { $size = $options[ 'size' ]; } // Build a URL for the embed $url = 'https://vine.co/v/' . $id . '/embed/' . $type; // Put code together, including metadata $code = '' . "\n"; $code .= '' . "\n"; $code .= '' . "\n"; $code .= '' . "\n"; $code .= '' . "\n"; $code .= '' . "\n"; // Add comment wrap $code = "\n" . '' . "\n" . $code; $code .= '' . "\n"; return $code; } ?>