diff --git a/system/Helpers/html_helper.php b/system/Helpers/html_helper.php index aa8ae6c9434a..fb5fbc213170 100755 --- a/system/Helpers/html_helper.php +++ b/system/Helpers/html_helper.php @@ -329,400 +329,400 @@ function link_tag($href = '', string $rel = 'stylesheet', string $type = 'text/c return $link . "/>"; } - +} // ------------------------------------------------------------------------ - if ( ! function_exists('video')) - { - - /** - * Video - * - * Geneartes a video element to embed videos. The video element can - * contain one or more video sources - * - * @param mixed $src Either a source string or an array of sources - * @param string $unsupportedMessage The message to display - * if the media tag is not supported by the browser - * @param string $attributes HTML attributes - * @param array $tracks - * @param bool $indexPage - * @return string - * - */ - function video($src, string $unsupportedMessage = '', string $attributes = '', array $tracks = [], bool $indexPage = false): string - { - if (is_array($src)) - { - return _media('video', $src, $unsupportedMessage, $attributes, $tracks); - } +if ( ! function_exists('video')) +{ - $video = ''; - } - - $media .= "\n"; + $media .= '>'; + } + else + { + $media .= ' ' . $attributes . '>'; + } - foreach ($types as $option) - { - $media .= _space_indent() . $option . "\n"; - } + $media .= "\n"; - if ( ! empty($tracks)) - { - foreach ($tracks as $track) - { - $media .= _space_indent() . $track . "\n"; - } - } + foreach ($types as $option) + { + $media .= _space_indent() . $option . "\n"; + } - if ( ! empty($unsupportedMessage)) + if ( ! empty($tracks)) + { + foreach ($tracks as $track) { - $media .= _space_indent() . $unsupportedMessage . "\n"; + $media .= _space_indent() . $track . "\n"; } + } - $media .= '\n"; - - return $media; + if ( ! empty($unsupportedMessage)) + { + $media .= _space_indent() . $unsupportedMessage . "\n"; } - } + $media .= '\n"; - // ------------------------------------------------------------------------ + return $media; + } - if ( ! function_exists('source')) - { +} - /** - * Source - * - * Generates a source element that specifies multiple media resources - * for either audio or video element - * - * @param string $src The path of the media resource - * @param string $type The MIME-type of the resource with - * optional codecs parameters - * @param string $attributes HTML attributes - * @param bool $indexPage - * @return string - */ - function source(string $src, string $type = 'unknown', string $attributes = '', bool $indexPage = false): string - { - if ( ! _has_protocol($src)) - if ($indexPage === true) - { - $src = site_url($src); - } - else - { - $src = slash_item('baseURL') . $src; - } + // ------------------------------------------------------------------------ - $source = ''; - } +if ( ! function_exists('track')) +{ + /** + * Track + * + * Generates a track element to specify timed tracks. The tracks are + * formatted in WebVTT format. + * + * @param string $src The path of the .VTT file + * @param string $kind + * @param string $srcLanguage + * @param string $label + * @return string + */ + function track(string $src, string $kind, string $srcLanguage, string $label): string + { + return ''; } - // ------------------------------------------------------------------------ - - if ( ! function_exists('object')) - { +} - /** - * Object - * - * Generates an object element that represents the media - * as either image or a resource plugin such as audio, video, - * Java applets, ActiveX, PDF and Flash - * - * @param string $data A resource URL - * @param string $type Content-type of the resource - * @param string $attributes HTML attributes - * @param array $params - * @param bool $indexPage - * - * @return string - */ - function object(string $data, string $type = 'unknown', string $attributes = '', array $params = [], bool $indexPage = false): string - { - if ( ! _has_protocol($data)) - if ($indexPage === true) - { - $data = site_url($data); - } - else - { - $data = slash_item('baseURL') . $data; - } + // ------------------------------------------------------------------------ - $object = ''; +if ( ! function_exists('object')) +{ - if ( ! empty($params)) + /** + * Object + * + * Generates an object element that represents the media + * as either image or a resource plugin such as audio, video, + * Java applets, ActiveX, PDF and Flash + * + * @param string $data A resource URL + * @param string $type Content-type of the resource + * @param string $attributes HTML attributes + * @param array $params + * @param bool $indexPage + * + * @return string + */ + function object(string $data, string $type = 'unknown', string $attributes = '', array $params = [], bool $indexPage = false): string + { + if ( ! _has_protocol($data)) + if ($indexPage === true) { - $object .= "\n"; + $data = site_url($data); } - - foreach ($params as $param) + else { - $object .= _space_indent() . $param . "\n"; + $data = slash_item('baseURL') . $data; } - $object .= "\n"; + $object = ''; + + if ( ! empty($params)) + { + $object .= "\n"; + } - return $object; + foreach ($params as $param) + { + $object .= _space_indent() . $param . "\n"; } + $object .= "\n"; + + return $object; } - // ------------------------------------------------------------------------ +} - if ( ! function_exists('param')) - { + // ------------------------------------------------------------------------ - /** - * Param - * - * Generates a param element that defines parameters - * for the object element. - * - * @param string $name The name of the parameter - * @param string $value The value of the parameter - * @param string $type The MIME-type - * @param string $attributes HTML attributes - * @return string - */ - function param(string $name, string $value, string $type = 'ref', string $attributes = ''): string - { - return ''; - } +if ( ! function_exists('param')) +{ + /** + * Param + * + * Generates a param element that defines parameters + * for the object element. + * + * @param string $name The name of the parameter + * @param string $value The value of the parameter + * @param string $type The MIME-type + * @param string $attributes HTML attributes + * @return string + */ + function param(string $name, string $value, string $type = 'ref', string $attributes = ''): string + { + return ''; } - // ------------------------------------------------------------------------ +} - if ( ! function_exists('embed')) - { + // ------------------------------------------------------------------------ - /** - * Embed - * - * Generates an embed element - * - * @param string $src The path of the resource to embed - * @param string $type MIME-type - * @param string $attributes HTML attributes - * @param bool $indexPage - * @return string - */ - function embed(string $src, string $type='unknown', string $attributes = '', bool $indexPage = false): string - { - if ( ! _has_protocol($src)) - if ($indexPage === true) - { - $src = site_url($src); - } - else - { - $src = slash_item('baseURL') . $src; - } +if ( ! function_exists('embed')) +{ - return '\n"; - } + /** + * Embed + * + * Generates an embed element + * + * @param string $src The path of the resource to embed + * @param string $type MIME-type + * @param string $attributes HTML attributes + * @param bool $indexPage + * @return string + */ + function embed(string $src, string $type='unknown', string $attributes = '', bool $indexPage = false): string + { + if ( ! _has_protocol($src)) + if ($indexPage === true) + { + $src = site_url($src); + } + else + { + $src = slash_item('baseURL') . $src; + } + return '\n"; } - // ------------------------------------------------------------------------ +} - if ( ! function_exists('_has_protocol')) - { +// ------------------------------------------------------------------------ - function _has_protocol($url) - { - return preg_match('#^([a-z]+:)?//#i', $url); - } +if ( ! function_exists('_has_protocol')) +{ + function _has_protocol($url) + { + return preg_match('#^([a-z]+:)?//#i', $url); } - // ------------------------------------------------------------------------ +} - if ( ! function_exists('_space_indent')) - { +// ------------------------------------------------------------------------ - function _space_indent($depth = 2) - { - return str_repeat(' ', $depth); - } +if ( ! function_exists('_space_indent')) +{ + function _space_indent($depth = 2) + { + return str_repeat(' ', $depth); } + } + // ------------------------------------------------------------------------