mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -05:00
Add support for webfonts in themes
This commit is contained in:
parent
bef6333ba3
commit
314af35b7a
@ -21,6 +21,11 @@ FileETag MTime Size
|
|||||||
ExpiresByType image/gif "access plus 1 year"
|
ExpiresByType image/gif "access plus 1 year"
|
||||||
ExpiresByType image/png "access plus 1 year"
|
ExpiresByType image/png "access plus 1 year"
|
||||||
ExpiresByType image/x-icon "access plus 1 year"
|
ExpiresByType image/x-icon "access plus 1 year"
|
||||||
|
ExpiresByType application/font-woff "access plus 1 year"
|
||||||
|
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
|
||||||
|
ExpiresByType application/x-font-ttf "access plus 1 year"
|
||||||
|
ExpiresByType font/opentype "access plus 1 year"
|
||||||
|
ExpiresByType image/svg+xml "access plus 1 year"
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
#AuthType Basic
|
#AuthType Basic
|
||||||
|
@ -70,6 +70,7 @@ $route['themes/:any/css/:any'] = 'theme_assets/css';
|
|||||||
$route['themes/:any/images/:any'] = 'theme_assets/images';
|
$route['themes/:any/images/:any'] = 'theme_assets/images';
|
||||||
$route['themes/:any/img/:any'] = 'theme_assets/images';
|
$route['themes/:any/img/:any'] = 'theme_assets/images';
|
||||||
$route['themes/:any/js/:any'] = 'theme_assets/js';
|
$route['themes/:any/js/:any'] = 'theme_assets/js';
|
||||||
|
$route['themes/:any/fonts/:any'] = 'theme_assets/fonts';
|
||||||
|
|
||||||
/* End of file routes.php */
|
/* End of file routes.php */
|
||||||
/* Location: ./application/config/routes.php */
|
/* Location: ./application/config/routes.php */
|
||||||
|
@ -45,6 +45,44 @@ class Theme_assets extends CI_Controller
|
|||||||
readfile($file_path);
|
readfile($file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fonts()
|
||||||
|
{
|
||||||
|
$font_file = $this->uri->segment(4);
|
||||||
|
//file path
|
||||||
|
$file_path = 'themes/' . $this->theme . '/fonts/' . $font_file;
|
||||||
|
|
||||||
|
//no fallback to default, since default has no such fonts
|
||||||
|
//since no fallbcack, there is no doucle checking for file
|
||||||
|
if (!file_exists($file_path))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//send
|
||||||
|
$path_parts = pathinfo(dirname(dirname(dirname(__FILE__))) . '/' . $file_path );
|
||||||
|
if ( $path_parts['extension'] == "woff" ) {
|
||||||
|
header('Content-type: application/font-woff');
|
||||||
|
}
|
||||||
|
if ( $path_parts['extension'] == "eot" ) {
|
||||||
|
header('Content-type: application/vnd.ms-fontobject');
|
||||||
|
}
|
||||||
|
if ( $path_parts['extension'] == "ttf" || $path_parts['extension'] == "ttc" ) {
|
||||||
|
header('Content-type: application/x-font-ttf');
|
||||||
|
}
|
||||||
|
if ( $path_parts['extension'] == "otf" ) {
|
||||||
|
header('Content-type: font/opentype');
|
||||||
|
}
|
||||||
|
if ( $path_parts['extension'] == "svg" ) {
|
||||||
|
header('Content-type: image/svg+xml');
|
||||||
|
}
|
||||||
|
if ( $path_parts['extension'] == "svgz" ) {
|
||||||
|
header("Content-Encoding: gzip");
|
||||||
|
header('Content-type: image/svg+xml');
|
||||||
|
}
|
||||||
|
$this->_expires_header(1);
|
||||||
|
readfile($file_path);
|
||||||
|
}
|
||||||
|
|
||||||
function images()
|
function images()
|
||||||
{
|
{
|
||||||
$image_file = $this->uri->segment(4);
|
$image_file = $this->uri->segment(4);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user