file = $file;
$this->plgDir = dirname($file);
$this->plgURL = plugin_dir_url($file);
$this->siteUrl = site_url();
$this->wpRoot = parse_url($this->siteUrl, PHP_URL_PATH);
if (empty($this->wpRoot) || $this->wpRoot == DIRECTORY_SEPARATOR) {
$this->wpRoot = "";
}
else {
$this->wpRoot .= DIRECTORY_SEPARATOR;
}
$this->siteUrl .= '/';
$this->keyEp = $this->key . '-ep';
$this->endPoint = $this->siteUrl . $this->keyEp;
$this->isPro = file_exists("{$this->plgDir}/admin/options-advanced.php");
}
if ($this->isPro) {
$this->strPro = 'Pro';
}
else {
$this->strPro = 'Lite';
}
}
static function isEmptyHtaccess($data) {
if (empty($data)) {
return true;
}
$lines = explode("\n", $data);
foreach ($lines as $l) {
$l = trim($l);
if (empty($l)) {
continue;
}
if ($l[0] == '#') {
continue;
}
return false;
}
return true;
}
function mkHtaccess() {
$file = ABSPATH . ".htaccess";
$data = "
# BEGIN WordPress: Inserted by $this->name
You already have an .htaccess file ($file) with these contents:
$currentData
Please edit it and add the standard WordPress directives (pointing all missing files to index.php). Here is what you need to add:
$data"; } } // No htaccess or it is empty. Safe to create a default one. $url = wp_nonce_url('plugin-install.php', 'plugin-install'); $creds = request_filesystem_credentials($url, '', false, false, ABSPATH); if ($creds !== false) { WP_Filesystem($creds); global $wp_filesystem; if (!empty($wp_filesystem)) { $abspath = trailingslashit($wp_filesystem->abspath()); $file = "{$abspath}.htaccess"; if ($wp_filesystem->put_contents($file, "$currentData\n$data")) { return "A default
.htaccess has been created for you.";
}
}
}
else {
// Cannot create a new one.
$data = htmlspecialchars($data);
return "You do not have an .htaccess file and it does not look like I can create one for you. Please create $file and add the standard WordPress directives (pointing all missing files to index.php). Here is what you need to add:
$data"; } } static function install($dir, $mOptions) { $ezOptions = get_option($mOptions); if (empty($ezOptions)) { // create the necessary tables $GLOBALS['isInstallingWP'] = true; chdir($dir . '/admin'); require_once('dbSetup.php'); $ezOptions['isSetup'] = true; } update_option($mOptions, $ezOptions); } static function uninstall($mOptions) { delete_option($mOptions); } function printAdminPage() { ?>
Loading... Please wait!