q("DELETE FROM `addon` WHERE `name` = '%s' ",
dbesc($plugin)
);
-
- // define THISPLUGIN, make life easy to plugin devs :-)
- define("THISPLUGIN", 'addon/' . $plugin . '/' . $plugin . '.php');
-
+
@include_once('addon/' . $plugin . '/' . $plugin . '.php');
if(function_exists($plugin . '_uninstall')) {
$func = $plugin . '_uninstall';
function install_plugin($plugin) {
// silently fail if plugin was removed
- // define THISPLUGIN, make life easy to plugin devs :-)
- define("THISPLUGIN", 'addon/' . $plugin . '/' . $plugin . '.php');
-
if(! file_exists('addon/' . $plugin . '/' . $plugin . '.php'))
return false;
logger("Addons: installing " . $plugin);
if(function_exists($plugin . '_install')) {
$func = $plugin . '_install';
$func();
-
+
$plugin_admin = (function_exists($plugin."_plugin_admin")?1:0);
-
+
$r = q("INSERT INTO `addon` (`name`, `installed`, `timestamp`, `plugin_admin`) VALUES ( '%s', 1, %d , %d ) ",
dbesc($plugin),
intval($t),
$fname = 'addon/' . $pl . '/' . $pl . '.php';
- // define THISPLUGIN, make life easy to plugin devs :-)
- define("THISPLUGIN", $fname);
-
if(file_exists($fname)) {
$t = @filemtime($fname);
foreach($installed as $i) {
if(! function_exists('call_hooks')) {
function call_hooks($name, &$data = null) {
+ $stamp1 = microtime(true);
+
$a = get_app();
if((is_array($a->hooks)) && (array_key_exists($name,$a->hooks))) {
foreach($a->hooks[$name] as $hook) {
- // define THISPLUGIN, make life easy to plugin devs :-)
- define("THISPLUGIN", $hook[0]);
@include_once($hook[0]);
if(function_exists($hook[1])) {
$func = $hook[1];
}
}
}
-
}}
if (! function_exists('get_plugin_info')){
function get_plugin_info($plugin){
+
+ $a = get_app();
+
$info=Array(
'name' => $plugin,
'description' => "",
'author' => array(),
'version' => ""
);
-
+
if (!is_file("addon/$plugin/$plugin.php")) return $info;
-
+
+ $stamp1 = microtime(true);
$f = file_get_contents("addon/$plugin/$plugin.php");
+ $a->save_timestamp($stamp1, "file");
+
$r = preg_match("|/\*.*\*/|msU", $f, $m);
-
+
if ($r){
$ll = explode("\n", $m[0]);
foreach( $ll as $l ) {
$info[$k]=$v;
}
}
-
+
}
}
-
+
}
return $info;
}}
/*
* parse theme comment in search of theme infos.
* like
- *
+ *
* * Name: My Theme
* * Description: My Cool Theme
* * Version: 1.2.3
$info['unsupported'] = true;
if (!is_file("view/theme/$theme/theme.php")) return $info;
-
+
+ $a = get_app();
+ $stamp1 = microtime(true);
$f = file_get_contents("view/theme/$theme/theme.php");
+ $a->save_timestamp($stamp1, "file");
+
$r = preg_match("|/\*.*\*/|msU", $f, $m);
-
-
+
if ($r){
$ll = explode("\n", $m[0]);
foreach( $ll as $l ) {