Skip to content

Commit c03e22e

Browse files
committed
Screenshots added and autoloader improved
1 parent f44d773 commit c03e22e

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed
143 KB
Loading
146 KB
Loading

WordPress Plugin/EnvatoToolkit/Controllers/class.MainController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ protected function checkRequirements()
197197
*/
198198
protected function loadDependencies()
199199
{
200-
$objAutoload = new AutoLoad();
200+
$objAutoload = new AutoLoad($this->conf);
201201
spl_autoload_register(array(&$objAutoload, 'includeClassFile'));
202202
}
203203

WordPress Plugin/EnvatoToolkit/Models/class.AutoLoad.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212

1313
class AutoLoad
1414
{
15-
private $debugMode = 0;
15+
protected $debugMode = 0;
16+
protected $conf = NULL;
1617

17-
public function __construct()
18+
public function __construct(Configuration &$paramConf)
1819
{
19-
// Nothing here
20+
$this->conf = $paramConf;
2021
}
2122

2223
/**
@@ -83,8 +84,13 @@ private function getFilePathAndNameFromNamespaceAndClass($paramClassOrInterface)
8384
{
8485
// Then separate namespace and class name
8586
$namespace = substr($className, 0, $lastNamespacePosition);
87+
88+
// Replace 'EnvatoToolkit' folder name with $this->pluginDirname
89+
// Note: we need that for the scenario in case if the plugin stays in 'plugins/envato-toolkit' folder instead of 'plugins/EnvatoToolkit'
90+
$namespace = str_replace('EnvatoToolkit\\', $this->conf->getPluginDirname().'\\', $namespace);
91+
8692
$className = substr($className, $lastNamespacePosition + 1);
87-
$filePath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
93+
$filePath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR;
8894
}
8995

9096
// Check if this is an interface or a class and set specific prefix to it

WordPress Plugin/EnvatoToolkit/readme.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
=== Envato Toolkit ===
22
Contributors: KestutisIT
3-
Website Link: https://profiles.wordpress.org/KestutisIT
3+
Donate link: https://profiles.wordpress.org/KestutisIT
4+
Website link: https://profiles.wordpress.org/KestutisIT
45
Tags: Envato Toolkit, Purchase code validation, update checker, Envato API
56
Requires at least: 4.6
67
Tested up to: 4.8

0 commit comments

Comments
 (0)