plgDir = dirname(__FILE__);
$this->plgURL = plugin_dir_url(__FILE__);
$this->isPro = file_exists("{$this->plgDir}/admin/options-advanced.php");
$this->slug = EZWP::getSlug("{$this->plgDir}/admin");
$this->plgName = EZWP::getPlgName("{$this->plgDir}/admin");
require_once 'EzTran.php';
$this->ezTran = new EzTran(__FILE__, $this->plgName, $this->slug);
$this->ezTran->setLang();
}
function getQuery($atts) {
$query = "";
$vars = array("id" => "", "code" => "", "key" => "");
$vars = shortcode_atts($vars, $atts);
foreach ($vars as $k => $v) {
if (!empty($v)) {
$query = "&$k=$v";
return $query;
}
}
}
function addAdminPage() {
add_options_page($this->plgName, $this->plgName, 'activate_plugins', basename(__FILE__), array($this, 'printAdminPage'));
}
function addWidgets() {
$widgetFile = "{$this->plgDir}/{$this->slug}-widget.php";
if (file_exists($widgetFile)) {
require_once $widgetFile;
}
return;
}
static function install() {
require_once 'admin/Migrator.php';
$migrator = new Migrator();
$migrator->migrate();
return;
}
function printAdminPage() {
$isPro = $this->isPro;
$installImg = $this->plgURL . "admin/img/install.png";
echo "
";
require $this->plgDir . '/admin/no-ajax.php';
if (!empty($_POST['ezadsense_force_admin'])) {
update_option('ezadsense_force_admin', true);
}
$forceAdmin = get_option('ezadsense_force_admin');
$src = plugins_url("admin/index.php", __FILE__);
if (!$forceAdmin && !@file_get_contents($src)) {
?>
This plugin needs direct access to its files so that they can be loaded in an iFrame. Looks like you have some security setting denying the required access. If you have an .htaccess file in your wp-content or wp-content/pluginsfolder, please remove it or modify it to allow access to the php files in plgDir; ?>/.
If you would like the plugin to try to open the admin page, please set the option here:
Note that if the plugin still cannot load the admin page after forcing it, you may see a blank or error page here upon reload. If that happens, please deactivate and delete the plugin. It is not compatible with your blog setup.
";
?>
";
}
static function switchTheme() {
$oldTheme = EZWP::getGenOption('theme');
$newTheme = get_option('stylesheet');
global $wpdb;
$table = $wpdb->prefix . "ez_adsense_options";
$sql = "INSERT IGNORE INTO $table (plugin_slug, theme, provider, optionset, name, value) SELECT plugin_slug, '$newTheme', provider, optionset, name, value FROM $table s WHERE theme = '$oldTheme'";
if ($wpdb->query($sql) === false) {
// A warning may be shown, but not being able to create the options
// is not serious enough. They will become defaults anyway.
}
EZWP::putGenOption('theme', $newTheme);
}
function verifyDB() {
global $wpdb;
$table = $wpdb->prefix . "ez_adsense_options";
if ($wpdb->get_var("SHOW TABLES LIKE '$table'") != $table) {
$this->install();
}
}
}
//End Class GoogleAdSense
}
else {
$ezFamily = array("google-adsense/google-adsense.php",
"google-adsense-lite/google-adsense.php",
"google-adsense-pro/google-adsense.php",
"easy-adsense/easy-adsense.php",
"easy-adsense-pro/easy-adsense.php",
"easy-adsense-lite/easy-adsense.php",
"easy-adsense-lite/easy-adsense-lite.php",
"adsense-now/adsense-now.php",
"adsense-now-pro/adsense-now.php",
"adsense-now-lite/adsense-now.php",
"adsense-now-lite/adsense-now-lite.php");
$ezActive = array();
foreach ($ezFamily as $lite) {
$ezKillLite = new EzKillLite($lite);
$liteName = $ezKillLite->deny();
if (!empty($liteName)) {
$ezActive[$lite] = $liteName;
}
}
if (count($ezActive) > 1) {
$ezAdminNotice = '
';
foreach ($ezActive as $k => $p) {
$ezAdminNotice .= "$k: {$p} \n";
}
$ezAdminNotice .= "
";
EzKillLite::$adminNotice .= '
Ads EZ Family of Plugins: Please have only one of these plugins active.
' . $ezAdminNotice . 'Otherwise they will interfere with each other and work as the last one.
';
add_action('admin_notices', array('EzKillLite', 'admin_notices'));
}
}
if (class_exists("GoogleAdSense")) {
$gAd = new GoogleAdSense();
if (isset($gAd)) {
if (method_exists($gAd, 'verifyDB')) {
$gAd->verifyDB();
}
add_action('admin_menu', array($gAd, 'addAdminPage'));
$gAd->addWidgets();
$file = dirname(__FILE__) . "/{$gAd->slug}.php";
register_activation_hook($file, array("GoogleAdSense", 'install'));
add_action('switch_theme', array("GoogleAdSense", 'switchTheme'));
}
}
}
else {
require plugin_dir_path(__FILE__) . 'EzGA.php';
EzGA::doPluginActions();
}