Skip to content

Commit

Permalink
Update rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakiboy committed Nov 8, 2020
1 parent 8f09d50 commit 3f2bfda
Show file tree
Hide file tree
Showing 56 changed files with 81 additions and 73 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jakiboy/vanilleplugin",
"version" : "0.3.2",
"version" : "0.3.3",
"type": "library",
"description": "Framwork for VanillePlugin",
"keywords": ["VanillePlugin","WordPress","WordPress-Plugin","WordPress-Plugin-Framework","jakiboy"],
Expand Down
2 changes: 1 addition & 1 deletion src/VanilleConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/AbstractAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/AbstractShortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Migrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/ResponseXML.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
44 changes: 26 additions & 18 deletions src/inc/Rewrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down Expand Up @@ -35,33 +35,40 @@ public function __construct($rules = '')
}

/**
* Action : init
*
* @access public
* @param string $regex
* @param string $redirect
* @param string $query
* @param string $after
* @return void
*/
public function addRules($regex, $redirect, $after = 'bottom')
public function addRules($regex, $query, $after = 'bottom')
{
// Add rules
add_rewrite_rule($regex, $redirect, $after);
add_rewrite_rule($regex,$query,$after);
}

/**
* Action : init
*
* @access public
* @param string $name
* @param int $places
* @param int $places 8191
* @param mixed $query true
* @return void
*
* EP_ALL : 8191
*/
public function addEndpoint($name, $places)
public function addEndpoint($name, $places = 8191, $query = true)
{
// Add endpoint
add_rewrite_endpoint($name, $places);
add_rewrite_endpoint($name,$places,$query);
}

/**
* @access public
* @param string $vars
* @param array $vars
* @return void
*/
public function addVars($vars = [])
Expand All @@ -71,29 +78,31 @@ public function addVars($vars = [])

/**
* @access public
* @param void
* @param int $priority 90
* @return void
*/
public function applyRules()
public function applyRules($priority = 90)
{
// Apply rules
$this->addFilter('mod_rewrite_rules', [$this, 'getRules'], 90);
$this->flush();
$this->addFilter('mod_rewrite_rules',[$this,'getRules'],$priority);
$this->flush();
}

/**
* @access public
* @param void
* @param int $priority 90
* @return void
*/
public function removeRules()
public function removeRules($priority = 90)
{
// Remove rules
$this->removeFilter('mod_rewrite_rules', [$this, 'getRules'], 90);
$this->flush();
$this->removeFilter('mod_rewrite_rules',[$this,'getRules'],$priority);
$this->flush();
}

/**
* Filter : mod_rewrite_rules
*
* @access public
* @param void
* @return string
Expand All @@ -108,7 +117,7 @@ public function getRules()

/**
* @access public
* @param boolean $force
* @param boolean $force true
* @return void
*/
public function flush($force = true)
Expand All @@ -124,7 +133,6 @@ public function flush($force = true)
public function backup()
{
if ( File::exists( $htaccess = ABSPATH . '/.htaccess') ) {
$date = date('dmY');
if ( !File::exists( $backup = ABSPATH . '.htaccess.backup') ){
File::w($backup, File::r($htaccess));
}
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Stringify.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/inc/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/int/AdminAjaxInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/int/AdminInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/int/AjaxInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/int/CronInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/int/FrontInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/int/MenuInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/int/NoticeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/int/OrmInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/int/OrmQueryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/int/PluginInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
2 changes: 1 addition & 1 deletion src/int/PluginNameSpaceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author : JIHAD SINNAOUR
* @package : VanillePlugin
* @version : 0.3.2
* @version : 0.3.3
* @copyright : (c) 2018 - 2020 JIHAD SINNAOUR <[email protected]>
* @link : https://jakiboy.github.io/VanillePlugin/
* @license : MIT
Expand Down
Loading

0 comments on commit 3f2bfda

Please sign in to comment.