Settings → Easy AdSense.
Version: 2.60
Author: Manoj Thulasidas
Author URI: http://www.thulasidas.com
Text Domain: easy-adsenser
*/
/*
Copyright (C) 2008 www.thulasidas.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
if (!class_exists("ezAdSense")) {
class ezAdSense {
var $plugindir, $invite, $locale, $defaults, $ezTran ;
function ezAdSense() { //constructor
if (file_exists (dirname (__FILE__).'/defaults.php')){
include (dirname (__FILE__).'/defaults.php');
$this->defaults = unserialize(base64_decode($str)) ;
}
if (empty($this->defaults)) {
add_action('admin_notices', create_function('', 'if (substr( $_SERVER["PHP_SELF"], -11 ) == "plugins.php"|| $_GET["page"] == "easy-adsenser.php") echo \'
Easy AdSense: Error locating or loading the defaults! Ensure defaults.php exists, or reinstall the plugin.
\';')) ;
}
if ($_POST['translate'] || $_POST['make'] ||
$_POST['savePot'] || $_POST['mailPot']|| $_POST['editMore']) {
if (file_exists (dirname (__FILE__).'/lang/easy-translator.php')){
include (dirname (__FILE__).'/lang/easy-translator.php');
$this->ezTran = new ezTran ;
}
}
}
function init() {
$this->getAdminOptions() ;
}
function setLang() {
$locale = get_locale() ;
$this->locale = $locale ;
$name = basename(dirname(__FILE__)) ;
if(!empty($this->locale) && $this->locale != 'en_US') {
$this->invite = ' Would you like to improve this translation of Easy Adsenser in your langugage (' . $locale .
")? " ;
$moFile = dirname(__FILE__) . '/lang/' . $this->locale . '/' . $name . '.mo';
if(@file_exists($moFile) && is_readable($moFile))
load_textdomain($name, $moFile);
else {
// look for any other similar locale with the same first three characters
$foo = glob(dirname(__FILE__) . '/lang/' . substr($this->locale, 0, 2) .
'*/easy-adsenser.mo') ;
if (!empty($foo)>0) {
$moFile = $foo[0] ;
load_textdomain($name, $moFile);
$this->locale = basename(dirname($moFile)) ;
}
$this->invite = ' Would you like to see ' .
'Easy Adsenser in your langugage (' . $locale .
")? locale .
"</b>, if any) in an easy-to-edit form. You can then generate a translation file and email it to the author all from the same form. Slick, isn\'t it? I will include your translation in the next release.', WIDTH, 350, TITLE, 'How to Translate?', STICKY, 1, CLOSEBTN, true, CLICKCLOSE, true, FIX, [this, 0, 5])\" onmouseout=\"UnTip()\" value ='Please help translate '>" ;
}
}
}
// Returns an array of admin options
function getAdminOptions($reset = false) {
$this->setLang() ;
$mThemeName = get_settings('stylesheet') ;
$mOptions = "ezAdSense" . $mThemeName ;
$this->plugindir = get_option('siteurl') . '/' . PLUGINDIR .
'/' . basename(dirname(__FILE__)) ;
$ezAdSenseAdminOptions =
array('info' => "\n",
'show_leadin' => 'float:right',
'text_leadin' => htmlspecialchars_decode($this->defaults['ezText']),
'show_midtext' => 'float:left',
'text_midtext' => htmlspecialchars_decode($this->defaults['ezText']),
'show_leadout' => 'no',
'text_leadout' => htmlspecialchars_decode($this->defaults['ezText']),
'show_widget' => 'text-align:center',
'text_widget' => htmlspecialchars_decode($this->defaults['ezWidget']),
'show_lu' => 'text-align:center',
'text_lu' => htmlspecialchars_decode($this->defaults['ezLU']),
'title_gsearch' => '',
'text_gsearch' => htmlspecialchars_decode($this->defaults['ezSearch']),
'mc' => 5,
'max_count' => 3,
'max_link' => 1,
'force_midad' => false,
'force_widget' => false,
'allow_feeds' => false,
'kill_pages' => false,
'show_borders' => false,
'border_width' => 1,
'border_color' => 'FF0000',
'border_widget' => false,
'border_lu' => false,
'limit_lu' => 1,
'kill_attach' => false,
'kill_home' => false,
'kill_front' => false,
'kill_cat' => false,
'kill_tag' => false,
'kill_archive' => false
);
$ezAdOptions = get_option($mOptions);
if (empty($ezAdOptions)) {
// try loading the default from the pre 1.3 version, so as not to annoy
// the dudes who have already been using ezAdsenser
$adminOptionsName = "ezAdSenseAdminOptions";
$ezAdOptions = get_option($adminOptionsName);
}
if (!empty($ezAdOptions) && ! $reset) {
foreach ($ezAdOptions as $key => $option)
$ezAdSenseAdminOptions[$key] = $option;
}
update_option($mOptions, $ezAdSenseAdminOptions);
return $ezAdSenseAdminOptions;
}
// Prints out the admin page
function printAdminPage() {
// if the defaults are not loaded, send error message
if (empty($this->defaults)) return ;
$mThemeName = get_settings('stylesheet') ;
$mOptions = "ezAdSense" . $mThemeName ;
$ezAdOptions = $this->getAdminOptions();
if (isset($_POST['update_ezAdSenseSettings'])) {
if (isset($_POST['ezAdSenseShowLeadin']))
$ezAdOptions['show_leadin'] = $_POST['ezAdSenseShowLeadin'];
if (isset($_POST['ezAdSenseTextLeadin']))
$ezAdOptions['text_leadin'] = $_POST['ezAdSenseTextLeadin'];
if (isset($_POST['ezAdSenseShowMidtext']))
$ezAdOptions['show_midtext'] = $_POST['ezAdSenseShowMidtext'];
if (isset($_POST['ezAdSenseTextMidtext']))
$ezAdOptions['text_midtext'] = $_POST['ezAdSenseTextMidtext'];
if (isset($_POST['ezAdSenseShowLeadout']))
$ezAdOptions['show_leadout'] = $_POST['ezAdSenseShowLeadout'];
if (isset($_POST['ezAdSenseTextLeadout']))
$ezAdOptions['text_leadout'] = $_POST['ezAdSenseTextLeadout'];
if (isset($_POST['ezAdSenseShowWidget']))
$ezAdOptions['show_widget'] = $_POST['ezAdSenseShowWidget'];
if (isset($_POST['ezAdWidgetTitle']))
$ezAdOptions['title_widget'] = $_POST['ezAdWidgetTitle'];
if (isset($_POST['ezAdSenseTextWidget']))
$ezAdOptions['text_widget'] = $_POST['ezAdSenseTextWidget'];
if (isset($_POST['ezAdSenseShowLU']))
$ezAdOptions['show_lu'] = $_POST['ezAdSenseShowLU'];
if (isset($_POST['ezAdLUTitle']))
$ezAdOptions['title_lu'] = $_POST['ezAdLUTitle'];
if (isset($_POST['ezAdSenseTextLU']))
$ezAdOptions['text_lu'] = $_POST['ezAdSenseTextLU'];
if (isset($_POST['ezAdSenseShowGSearch'])) {
$title = $_POST['ezAdSenseShowGSearch']; ;
if ($title != 'dark' && $title != 'light' && $title != 'no')
$title = $_POST['ezAdSearchTitle'];
$ezAdOptions['title_gsearch'] = $title;
}
if (isset($_POST['ezAdSenseTextGSearch']))
$ezAdOptions['text_gsearch'] = $_POST['ezAdSenseTextGSearch'];
if (isset($_POST['ezAdSenseMax']))
$ezAdOptions['max_count'] = $_POST['ezAdSenseMax'];
if (isset($_POST['ezAdSenseLinkMax']))
$ezAdOptions['max_link'] = $_POST['ezAdSenseLinkMax'];
$ezAdOptions['force_midad'] = $_POST['ezForceMidAd'];
$ezAdOptions['force_widget'] = $_POST['ezForceWidget'];
$ezAdOptions['allow_feeds'] = $_POST['ezAllowFeeds'];
$ezAdOptions['kill_pages'] = $_POST['ezKillPages'];
$ezAdOptions['kill_home'] = $_POST['ezKillHome'];
$ezAdOptions['kill_attach'] = $_POST['ezKillAttach'];
$ezAdOptions['kill_front'] = $_POST['ezKillFront'];
$ezAdOptions['kill_cat'] = $_POST['ezKillCat'];
$ezAdOptions['kill_tag'] = $_POST['ezKillTag'];
$ezAdOptions['kill_archive'] = $_POST['ezKillArchive'];
$ezAdOptions['show_borders'] = $_POST['ezShowBorders'];
if (isset($_POST['ezBorderWidth']))
$ezAdOptions['border_width'] = intval($_POST['ezBorderWidth']) ;
if (isset($_POST['ezBorderColor']))
$ezAdOptions['border_color'] = strval($_POST['ezBorderColor']) ;
$ezAdOptions['border_widget'] = $_POST['ezBorderWidget'];
$ezAdOptions['border_lu'] = $_POST['ezBorderLU'];
if (isset($_POST['ezLimitLU'])) {
$limit = min(intval($_POST['ezLimitLU']), 3) ;
$ezAdOptions['limit_lu'] = $limit ;
}
$ezAdOptions['info'] = $this->info() ;
if (isset($_POST['ezMC']))
$ezAdOptions['mc'] = floatval($_POST['ezMC']);
update_option($mOptions, $ezAdOptions);
?>
getAdminOptions($reset);
?>
locale = "en_US" ;
$moFile = dirname(__FILE__) . '/lang/easy-adsenser.mo';
// Dodgy..., but hey, it works. Idea from the function
// load_textdomain($domain, $mofile) in /wp-includes/l10n.php
global $l10n;
$version = (float)get_bloginfo('version') ;
if ($version < 2.80)
$l10n['easy-adsenser']->cache_translations = array() ;
else
unset($l10n['easy-adsenser']) ; // this is probably a memory leak!
load_textdomain('easy-adsenser', $moFile);
?>
$half)
array_pop($poses);
$pickme = $poses[floor(sizeof($poses)/2)];
if ($ezAdOptions['force_midad'] || $half > 10)
{ // don't show if you have too few paragraphs
$ezCount++;
$midtext =
stripslashes($ezAdOptions['info'] . "\n" .
'