diff --git a/install.php b/install.php index 0e2c924..8564a91 100644 --- a/install.php +++ b/install.php @@ -1,79 +1,79 @@ -* @license MIT License -* @copyright 2018 Roland Oduberu -* @link https://github.com/roliod/codeigniter-asset-versioning/releases -*/ + * Codeigniter asset versioning installer + * + * @author Roland Oduberu + * @license MIT License + * @copyright 2018 Roland Oduberu + * @link https://github.com/roliod/codeigniter-asset-versioning/releases + */ $installer = new Installer(); $installer->install(); -Class Installer +class Installer { - public $helper_to_path; - public $library_to_path; - public $helper_from_path; - public $library_form_path; + public $helper_to_path; + public $library_to_path; + public $helper_from_path; + public $library_form_path; - public function __construct() - { - $this->library_to_path = "application/libraries/asset.php"; - $this->helper_to_path = "application/helpers/asset_helper.php"; - $this->library_form_path = "vendor/roliod/codeigniter-asset-versioning/src/libraries/asset.php"; - $this->helper_from_path = "vendor/roliod/codeigniter-asset-versioning/src/helpers/asset_helper.php"; - } - - public function install() - { - $this->copy_helper(); - $this->copy_library(); - } + public function __construct() + { + $this->library_to_path = "application/libraries/asset.php"; + $this->helper_to_path = "application/helpers/asset_helper.php"; + $this->library_form_path = "vendor/roliod/codeigniter-asset-versioning/src/libraries/asset.php"; + $this->helper_from_path = "vendor/roliod/codeigniter-asset-versioning/src/helpers/asset_helper.php"; + } - public function copy_helper() - { - if ($this->exists($this->helper_to_path)) { - return $this; + public function install() + { + $this->copy_helper(); + $this->copy_library(); } - $this->copy_file($this->helper_from_path, $this->helper_to_path); + public function copy_helper() + { + if ($this->exists($this->helper_to_path)) { + return $this; + } - return $this; - } + $this->copy_file($this->helper_from_path, $this->helper_to_path); - public function copy_library() - { - if ($this->exists($this->library_to_path)) { - return $this; + return $this; } - $this->copy_file($this->library_form_path, $this->library_to_path); + public function copy_library() + { + if ($this->exists($this->library_to_path)) { + return $this; + } + + $this->copy_file($this->library_form_path, $this->library_to_path); - return $this; - } + return $this; + } - /** - * Check if file exists - * - * @param string $file path - * @return bool - */ - public function exists($path) - { - return (bool)file_exists($path); - } + /** + * Check if file exists + * + * @param string $file path + * @return bool + */ + public function exists($path) + { + return (bool) file_exists($path); + } - /** - * Recursive Copy - * - * @param string $src - * @param string $dst - */ - public function copy_file($from, $to) - { - copy($from, $to); - } + /** + * Recursive Copy + * + * @param string $src + * @param string $dst + */ + public function copy_file($from, $to) + { + copy($from, $to); + } } diff --git a/src/helpers/asset_helper.php b/src/helpers/asset_helper.php index 4b193e4..d2e6acd 100644 --- a/src/helpers/asset_helper.php +++ b/src/helpers/asset_helper.php @@ -1,22 +1,22 @@ - -* @license MIT License -* @copyright 2018 Roland Oduberu -* @link https://github.com/roliod/codeigniter-asset-versioning/releases -*/ - -if (! function_exists('version_url')) { - - function version_url($path = '') - { - $CI =& get_instance(); - $CI->load->library('asset'); + * Codeigniter asset versioning installer + * + * @author Roland Oduberu + * @license MIT License + * @copyright 2018 Roland Oduberu + * @link https://github.com/roliod/codeigniter-asset-versioning/releases + */ - return $CI->asset->version_url($path); - } +if (!function_exists('version_url')) { + function version_url($path = '') + { + $CI = &get_instance(); + $CI->load->library('asset'); + return $CI->asset->version_url($path); + } } diff --git a/src/libraries/asset.php b/src/libraries/asset.php index 14b468f..9ce2d24 100644 --- a/src/libraries/asset.php +++ b/src/libraries/asset.php @@ -1,23 +1,23 @@ - -* @license MIT License -* @copyright 2018 Roland Oduberu -* @link https://github.com/roliod/codeigniter-asset-versioning/releases -*/ + * Codeigniter asset versioning installer + * + * @author Roland Oduberu + * @license MIT License + * @copyright 2018 Roland Oduberu + * @link https://github.com/roliod/codeigniter-asset-versioning/releases + */ class asset extends CI_Model { + public function version_url($path = '') + { + $base_url = $this->config->item('base_url'); + $version = filemtime(FCPATH . $path); - public function version_url($path = '') - { - $base_url = $this->config->item('base_url'); - $version = filemtime(FCPATH . $path); - - return $base_url . '/' . $path . '?v=' . $version; - } - + return $base_url . '/' . $path . '?v=' . $version; + } }