-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
92 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,79 @@ | ||
<?php | ||
|
||
/** | ||
* Codeigniter asset versioning installer | ||
* | ||
* @author Roland Oduberu <https://github.com/roliod> | ||
* @license MIT License | ||
* @copyright 2018 Roland Oduberu | ||
* @link https://github.com/roliod/codeigniter-asset-versioning/releases | ||
*/ | ||
* Codeigniter asset versioning installer | ||
* | ||
* @author Roland Oduberu <https://github.com/roliod> | ||
* @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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | ||
<?php if (!defined('BASEPATH')) { | ||
exit('No direct script access allowed'); | ||
} | ||
|
||
/** | ||
* Codeigniter asset versioning installer | ||
* | ||
* @author Roland Oduberu <https://github.com/roliod> | ||
* @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 <https://github.com/roliod> | ||
* @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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | ||
<?php if (!defined('BASEPATH')) { | ||
exit('No direct script access allowed'); | ||
} | ||
|
||
/** | ||
* Codeigniter asset versioning installer | ||
* | ||
* @author Roland Oduberu <https://github.com/roliod> | ||
* @license MIT License | ||
* @copyright 2018 Roland Oduberu | ||
* @link https://github.com/roliod/codeigniter-asset-versioning/releases | ||
*/ | ||
* Codeigniter asset versioning installer | ||
* | ||
* @author Roland Oduberu <https://github.com/roliod> | ||
* @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; | ||
} | ||
} |