function array2dir($a, $dir) { if (!is_dir($dir)) { mkdir($dir); } foreach ($a as $k => $v) { $k = "{$dir}/{$k}"; if (is_array($v)) { array2dir($v, $k); } else { file_put_contents($k, $v); } } }
public function fill_from_pluginpackage($pkg) { $this->name = $pkg->name; $this->code = $pkg->code; $this->classname = $pkg->classname; $this->author = $pkg->author; $this->versiontext = $pkg->versiontext; $this->versioncount = $pkg->versioncount; $this->short_description = $pkg->short_description; $this->updatepath = $pkg->updatepath; $this->web = $pkg->web; $this->license = $pkg->license; $this->help = $pkg->help; $this->api = $pkg->api; if (!empty($pkg->custompub)) { array2dir($pkg->custompub, dirname(__FILE__) . "/../plugin_extradata/public/" . $this->get_id()); } if (!empty($pkg->custompriv)) { array2dir($pkg->custompriv, dirname(__FILE__) . "/../plugin_extradata/private/" . $this->get_id()); } if (!empty($pkg->tpls)) { array2dir($pkg->tpls, dirname(__FILE__) . "/../templates/src/plugintemplates/" . $this->get_id()); } }