| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
Plugin Name: Quick Adsense |
| 5 |
Plugin URI: http://techmilieu.com/quick-adsense |
| 6 |
Description: Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post. |
| 7 |
Author: Philip Ze |
| 8 |
Version: 1.8 |
| 9 |
Author URI: http://techmilieu.com/ |
| 10 |
*/ |
| 11 |
|
| 12 |
/* Copyright 2009-2010 Philip Ze [ http://techmilieu.com/quick-adsense ] |
| 13 |
|
| 14 |
This program is free software; you can redistribute it and/or modify |
| 15 |
it under the terms of the GNU General Public License as published by |
| 16 |
the Free Software Foundation; either version 2 of the License, or |
| 17 |
(at your option) any later version. |
| 18 |
|
| 19 |
This program is distributed in the hope that it will be useful, |
| 20 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
GNU General Public License for more details. |
| 23 |
|
| 24 |
You should have received a copy of the GNU General Public License |
| 25 |
along with this program; if not, write to the Free Software |
| 26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 27 |
*/ |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
global $QData; |
| 34 |
$QData['AdsWid'] = 10; /* Ads on Widget */ |
| 35 |
$QData['Ads'] = 10; /* Ads on Post body */ |
| 36 |
$QData['Name'] = 'Quick Adsense'; |
| 37 |
$QData['Version'] = '1.8'; |
| 38 |
$QData['URI'] = 'http://techmilieu.com/quick-adsense'; |
| 39 |
$QData['AdsWidName'] = 'AdsWidget%d (Quick Adsense)'; |
| 40 |
$QData['Default'] = array( |
| 41 |
'AdsDisp'=>'3', |
| 42 |
'BegnAds'=>true,'BegnRnd'=>'1','EndiAds'=>true,'EndiRnd'=>'0', |
| 43 |
'Par1Ads'=>false,'Par1Rnd'=>'0','Par1Nup'=>'0','Par1Con'=>false, |
| 44 |
'Par2Ads'=>false,'Par2Rnd'=>'0','Par2Nup'=>'0','Par2Con'=>false, |
| 45 |
'Par3Ads'=>false,'Par3Rnd'=>'0','Par3Nup'=>'0','Par3Con'=>false, |
| 46 |
'Img1Ads'=>false,'Img1Rnd'=>'0','Img1Nup'=>'0', |
| 47 |
'AppPost'=>true,'AppPage'=>true,'AppHome'=>false,'AppCate'=>false,'AppArch'=>false,'AppTags'=>false,'AppMaxA'=>false,'AppSide'=>false, |
| 48 |
'QckTags'=>true,'QckRnds'=>false,'QckOffs'=>false |
| 49 |
); |
| 50 |
$QData['DefaultAdsOpt'] = array( |
| 51 |
'AdsMargin'=>'10','AdsAlign'=>'2' |
| 52 |
); |
| 53 |
$QData['DefaultAdsName'] = array(); |
| 54 |
for ($i=1;$i<=$QData['Ads'];$i++) { |
| 55 |
array_push($QData['DefaultAdsName'], 'AdsCode'.$i ); |
| 56 |
array_push($QData['DefaultAdsName'], 'AdsAlign'.$i ); |
| 57 |
array_push($QData['DefaultAdsName'], 'AdsMargin'.$i ); |
| 58 |
}; |
| 59 |
for ($i=1;$i<=$QData['AdsWid'];$i++) { |
| 60 |
array_push($QData['DefaultAdsName'], 'WidCode'.$i ); |
| 61 |
}; |
| 62 |
|
| 63 |
function ads_admin_page_inc() { |
| 64 |
include('quick-adsense-admin.php'); |
| 65 |
} |
| 66 |
function ads_admin_page() { |
| 67 |
add_options_page("Quick Adsense Options", "Quick Adsense", 8, basename(__FILE__), "ads_admin_page_inc"); |
| 68 |
} |
| 69 |
function register_ads_settings() { |
| 70 |
global $QData; |
| 71 |
foreach ($QData['Default'] as $key => $value) { |
| 72 |
register_setting( 'qa-options', $key); |
| 73 |
} |
| 74 |
foreach ($QData['DefaultAdsName'] as $key => $value) { |
| 75 |
register_setting( 'qa-options', $value); |
| 76 |
} |
| 77 |
} |
| 78 |
if(is_admin()) { |
| 79 |
add_action('admin_menu', 'ads_admin_page'); |
| 80 |
add_action('admin_init', 'register_ads_settings'); |
| 81 |
} |
| 82 |
|
| 83 |
|
| 84 |
function ads_plugin_links($links,$file) { |
| 85 |
if($file==plugin_basename(__FILE__)) { |
| 86 |
array_unshift($links,'<a href="options-general.php?page='.basename(__FILE__).'">'.__('Setting').'</a>'); |
| 87 |
} |
| 88 |
return $links; |
| 89 |
} |
| 90 |
add_filter('plugin_action_links','ads_plugin_links',10,2); |
| 91 |
|
| 92 |
|
| 93 |
function plugin_activated() { |
| 94 |
global $QData; |
| 95 |
$isold = get_option('AdsDisp'); |
| 96 |
if ( !$isold && is_bool($isold) ) { |
| 97 |
foreach ($QData['Default'] as $key => $value) { |
| 98 |
update_option($key , $value); |
| 99 |
} |
| 100 |
for ($i=1;$i<=$QData['Ads'];$i++) { |
| 101 |
update_option('AdsMargin'.$i, $QData['DefaultAdsOpt']['AdsMargin']); |
| 102 |
update_option('AdsAlign'.$i, $QData['DefaultAdsOpt']['AdsAlign']); |
| 103 |
} |
| 104 |
} |
| 105 |
} |
| 106 |
register_activation_hook( __FILE__, 'plugin_activated' ); |
| 107 |
|
| 108 |
|
| 109 |
function ads_head_java() { |
| 110 |
global $QData; |
| 111 |
if (get_option('QckTags')) { ?> |
| 112 |
<script type="text/javascript"> |
| 113 |
if(typeof(edButtons)!='undefined') { |
| 114 |
var dynads={"all":[ |
| 115 |
<?php for ($i=1;$i<=$QData['Ads'];$i++) { if(get_option('AdsCode'.$i)!=''){echo('"1",');}else{echo('"0",');}; } ?> |
| 116 |
"0"]}; |
| 117 |
for(i=1;i<=<?php echo($QData['Ads']) ?>;i++) { |
| 118 |
if(dynads.all[i-1]=="1") { |
| 119 |
edButtons[edButtons.length]=new edButton("ads"+i.toString(),"Ads"+i.toString(),"\n<!--Ads"+i.toString()+"-->\n","","",-1); |
| 120 |
} |
| 121 |
} |
| 122 |
<?php if(!get_option('QckRnds')){ ?> |
| 123 |
edButtons[edButtons.length]=new edButton("random_ads","RndAds","\n<!--RndAds-->\n","","",-1); |
| 124 |
<?php } ?> |
| 125 |
<?php if(!get_option('QckOffs')){ ?> |
| 126 |
edButtons[edButtons.length]=new edButton("no_ads","NoAds","\n<!--NoAds-->\n","","",-1); |
| 127 |
edButtons[edButtons.length]=new edButton("off_def","OffDef","\n<!--OffDef-->\n","","",-1); |
| 128 |
<?php } ?> |
| 129 |
}; |
| 130 |
</script> |
| 131 |
<?php } |
| 132 |
} |
| 133 |
add_action('admin_head', 'ads_head_java'); |
| 134 |
|
| 135 |
|
| 136 |
$ShownAds = 0; |
| 137 |
$AdsId = array(); |
| 138 |
$beginend = 0; |
| 139 |
|
| 140 |
function process_content($content) |
| 141 |
{ |
| 142 |
global $QData; |
| 143 |
global $ShownAds; |
| 144 |
global $AdsId; |
| 145 |
global $beginend; |
| 146 |
|
| 147 |
/* verifying */ |
| 148 |
if( (strpos($content,'<!--NoAds-->')) || |
| 149 |
(strpos($content,'<!--OffAds-->')) || |
| 150 |
(is_single() && !(get_option('AppPost'))) || |
| 151 |
(is_page() && !(get_option('AppPage'))) || |
| 152 |
(is_home() && !(get_option('AppHome'))) || |
| 153 |
(is_category() && !(get_option('AppCate'))) || |
| 154 |
(is_archive() && !(get_option('AppArch'))) || |
| 155 |
(is_tag() && !(get_option('AppTags'))) ) { |
| 156 |
$content = clean_tags($content); return $content; |
| 157 |
} |
| 158 |
|
| 159 |
$AdsToShow = get_option('AdsDisp'); |
| 160 |
for($i=1;$i<=$QData['AdsWid'];$i++) { |
| 161 |
$wadsid = sanitize_title(sprintf($QData['AdsWidName'],$i)); |
| 162 |
$AdsToShow -= (is_active_widget(true, $wadsid)) ? 1 : 0 ; |
| 163 |
} |
| 164 |
if( $ShownAds >= $AdsToShow ) { $content = clean_tags($content); return $content; }; |
| 165 |
|
| 166 |
if( !count($AdsId) ) { |
| 167 |
for($i=1;$i<=$QData['Ads'];$i++) { |
| 168 |
$tmp = trim(get_option('AdsCode'.$i)); |
| 169 |
if( !empty($tmp) ) { |
| 170 |
array_push($AdsId, $i); |
| 171 |
} |
| 172 |
} |
| 173 |
} |
| 174 |
if( !count($AdsId) ) { $content = clean_tags($content); return $content; }; |
| 175 |
|
| 176 |
/* ... Tidy up content ... */ |
| 177 |
$offdef = strpos($content,'<!--OffDef-->'); |
| 178 |
if( !$offdef ) { |
| 179 |
$AdsIdCus = array(); |
| 180 |
$cusads = 'CusAds'; $cusrnd = 'CusRnd'; |
| 181 |
$begn1 = get_option('BegnAds'); $begn2 = get_option('BegnRnd'); |
| 182 |
$endi1 = get_option('EndiAds'); $endi2 = get_option('EndiRnd'); |
| 183 |
$rc=3; |
| 184 |
for($i=1;$i<=$rc;$i++) { |
| 185 |
$para1[$i] = get_option('Par'.$i.'Ads'); $para2[$i] = get_option('Par'.$i.'Rnd'); $para3[$i] = get_option('Par'.$i.'Nup'); $para4[$i] = get_option('Par'.$i.'Con'); |
| 186 |
} |
| 187 |
$imge1 = get_option('Img1Ads'); $imge2 = get_option('Img1Rnd'); $imge3 = get_option('Img1Nup'); |
| 188 |
if ( $begn2 == 0 ) { $b1 = $cusrnd; } else { $b1 = $cusads.$begn2; array_push($AdsIdCus, $begn2); }; |
| 189 |
if ( $endi2 == 0 ) { $b2 = $cusrnd; } else { $b2 = $cusads.$endi2; array_push($AdsIdCus, $endi2); }; |
| 190 |
for($i=1;$i<=$rc;$i++) { |
| 191 |
if ( $para2[$i] == 0 ) { $b3[$i] = $cusrnd; } else { $b3[$i] = $cusads.$para2[$i]; array_push($AdsIdCus, $para2[$i]); }; |
| 192 |
} |
| 193 |
if ( $imge2 == 0 ) { $b4 = $cusrnd; } else { $b4 = $cusads.$imge2; array_push($AdsIdCus, $imge2); }; |
| 194 |
if( $begn1 ) { |
| 195 |
$content = '<!--'.$b1.'-->'.$content; |
| 196 |
} |
| 197 |
if( $endi1 ) { |
| 198 |
$content = $content.'<!--'.$b2.'-->'; |
| 199 |
} |
| 200 |
for($i=$rc;$i>=1;$i--) { |
| 201 |
if ( $para1[$i] ){ |
| 202 |
$sch = "</p>"; |
| 203 |
$content = str_replace("</P>", $sch, $content); |
| 204 |
$arr = explode($sch, $content); |
| 205 |
if ( (int)$para3[$i] < count($arr) ) { |
| 206 |
$content = implode($sch, array_slice($arr, 0, $para3[$i])).$sch .'<!--'.$b3[$i].'-->'. implode($sch, array_slice($arr, $para3[$i])); |
| 207 |
} elseif ($para4[$i]) { |
| 208 |
$content = implode($sch, $arr).'<!--'.$b3[$i].'-->'; |
| 209 |
} |
| 210 |
} |
| 211 |
} |
| 212 |
if ( $imge1 ){ |
| 213 |
$sch = "<img"; |
| 214 |
$bch = ">"; |
| 215 |
$content = str_replace("<IMG", $sch, $content); |
| 216 |
$arr = explode($sch, $content); |
| 217 |
if ( (int)$imge3 < count($arr) ) { |
| 218 |
$trr = explode($bch, $arr[$imge3]); |
| 219 |
if ( count($trr) ) { |
| 220 |
$arr[$imge3] = implode($bch, array_slice($trr, 0, 1)).$bch. "\n".'<!--'.$b4.'-->'."\n". implode($bch, array_slice($trr, 1)); |
| 221 |
} |
| 222 |
$content = implode($sch, $arr); |
| 223 |
} |
| 224 |
} |
| 225 |
} |
| 226 |
|
| 227 |
/* ... Tidy up content ... */ |
| 228 |
$content = '<!--EmptyClear-->'.$content."\n".'<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>'; |
| 229 |
$content = clean_tags($content, true); |
| 230 |
$ismany = (!is_single() && !is_page()); |
| 231 |
$showall = get_option('AppMaxA'); |
| 232 |
|
| 233 |
/* ... Replace Beginning/End Ads1-10 ... */ |
| 234 |
if( !$offdef ) { |
| 235 |
for( $i=1; $i<=count($AdsIdCus); $i++ ) { |
| 236 |
if( $showall || !$ismany || $beginend != $i ) { |
| 237 |
if( strpos($content, '<!--'.$cusads.$AdsIdCus[$i-1].'-->') && in_array($AdsIdCus[$i-1], $AdsId)) { |
| 238 |
$content = replace_ads( $content, $cusads.$AdsIdCus[$i-1], $AdsIdCus[$i-1] ); $AdsId = del_element($AdsId, array_search($AdsIdCus[$i-1], $AdsId)) ; |
| 239 |
$ShownAds += 1; if( $ShownAds >= $AdsToShow || !count($AdsId) ){ $content = clean_tags($content); return $content; }; |
| 240 |
$beginend = $i; if(!$showall && $ismany){break;} |
| 241 |
} |
| 242 |
} |
| 243 |
} |
| 244 |
} |
| 245 |
|
| 246 |
/* ... Replace Ads1 to Ads10 ... */ |
| 247 |
if( $showall || !$ismany ) { |
| 248 |
$tcn = count($AdsId); $tt = 0; |
| 249 |
for( $i=1; $i<=$tcn; $i++ ) { |
| 250 |
if( strpos($content, '<!--Ads'.$AdsId[$tt].'-->') ) { |
| 251 |
$content = replace_ads( $content, 'Ads'.$AdsId[$tt], $AdsId[$tt] ); $AdsId = del_element($AdsId, $tt) ; |
| 252 |
$ShownAds += 1; if( $ShownAds >= $AdsToShow || !count($AdsId) ){ $content = clean_tags($content); return $content; }; |
| 253 |
} else { |
| 254 |
$tt += 1; |
| 255 |
} |
| 256 |
} |
| 257 |
} |
| 258 |
/* ... Replace Beginning/End random Ads ... */ |
| 259 |
if( strpos($content, '<!--'.$cusrnd.'-->') && ($showall || !$ismany) ) { |
| 260 |
$tcx = count($AdsId); |
| 261 |
$tcy = substr_count($content, '<!--'.$cusrnd.'-->'); |
| 262 |
for( $i=$tcx; $i<=$tcy-1; $i++ ) { |
| 263 |
array_push($AdsId, -1); |
| 264 |
} |
| 265 |
shuffle($AdsId); |
| 266 |
for( $i=1; $i<=$tcy; $i++ ) { |
| 267 |
$content = replace_ads( $content, $cusrnd, $AdsId[0] ); $AdsId = del_element($AdsId, 0) ; |
| 268 |
$ShownAds += 1; if( $ShownAds >= $AdsToShow || !count($AdsId) ){ $content = clean_tags($content); return $content; }; |
| 269 |
} |
| 270 |
} |
| 271 |
/* ... Replace RndAds ... */ |
| 272 |
if( strpos($content, '<!--RndAds-->') && ($showall || !$ismany) ) { |
| 273 |
$AdsIdTmp = array(); |
| 274 |
shuffle($AdsId); |
| 275 |
for( $i=1; $i<=$AdsToShow-$ShownAds; $i++ ) { |
| 276 |
if( $i <= count($AdsId) ) { |
| 277 |
array_push($AdsIdTmp, $AdsId[$i-1]); |
| 278 |
} |
| 279 |
} |
| 280 |
$tcx = count($AdsIdTmp); |
| 281 |
$tcy = substr_count($content, '<!--RndAds-->'); |
| 282 |
for( $i=$tcx; $i<=$tcy-1; $i++ ) { |
| 283 |
array_push($AdsIdTmp, -1); |
| 284 |
} |
| 285 |
shuffle($AdsIdTmp); |
| 286 |
for( $i=1; $i<=$tcy; $i++ ) { |
| 287 |
$tmp = $AdsIdTmp[0]; |
| 288 |
$content = replace_ads( $content, 'RndAds', $AdsIdTmp[0] ); $AdsIdTmp = del_element($AdsIdTmp, 0) ; |
| 289 |
if($tmp != -1){$ShownAds += 1;}; if( $ShownAds >= $AdsToShow || !count($AdsIdTmp) ){ $content = clean_tags($content); return $content; }; |
| 290 |
} |
| 291 |
} |
| 292 |
|
| 293 |
/* ... That's it. DONE :) ... */ |
| 294 |
$content = clean_tags($content); return $content; |
| 295 |
} |
| 296 |
function clean_tags($content, $trimonly = false) { |
| 297 |
global $QData; |
| 298 |
$tagnames = array('EmptyClear','RndAds','NoAds','OffAds','CusRnd'); |
| 299 |
for($i=1;$i<=$QData['Ads'];$i++) { array_push($tagnames, 'CusAds'.$i); array_push($tagnames, 'Ads'.$i); }; |
| 300 |
foreach ($tagnames as $tgn) { |
| 301 |
if(strpos($content,'<!--'.$tgn.'-->') || $tgn=='EmptyClear') { |
| 302 |
if($trimonly) { |
| 303 |
$content = str_replace('<p><!--'.$tgn.'--></p>', '<!--'.$tgn.'-->', $content); |
| 304 |
}else{ |
| 305 |
$content = str_replace(array('<p><!--'.$tgn.'--></p>','<!--'.$tgn.'-->'), '', $content); |
| 306 |
} |
| 307 |
} |
| 308 |
} |
| 309 |
return $content; |
| 310 |
} |
| 311 |
function replace_ads($content, $nme, $adn) { |
| 312 |
if( !strpos($content,'<!--'.$nme.'-->') ) { return $content; } |
| 313 |
global $QData; |
| 314 |
if ($adn != -1) { |
| 315 |
$arr = array('', |
| 316 |
'float:left;margin:%1$dpx %1$dpx %1$dpx 0;', |
| 317 |
'float:none;margin:%1$dpx 0 %1$dpx 0;text-align:center;', |
| 318 |
'float:right;margin:%1$dpx 0 %1$dpx %1$dpx;', |
| 319 |
'float:none;margin:0px;'); |
| 320 |
$adsalign = get_option('AdsAlign'.$adn); |
| 321 |
$adsmargin = get_option('AdsMargin'.$adn); |
| 322 |
$style = sprintf($arr[(int)$adsalign], $adsmargin); |
| 323 |
$adscode = get_option('AdsCode'.$adn); |
| 324 |
$adscode = |
| 325 |
"\n".'<!-- '.$QData['Name'].' Wordpress Plugin: '.$QData['URI'].' -->'."\n". |
| 326 |
'<div style="'.$style.'">'."\n". |
| 327 |
$adscode."\n". |
| 328 |
'</div>'."\n"; |
| 329 |
} else { |
| 330 |
$adscode =''; |
| 331 |
} |
| 332 |
$cont = explode('<!--'.$nme.'-->', $content, 2); |
| 333 |
return $cont[0].$adscode.$cont[1]; |
| 334 |
} |
| 335 |
function del_element($array, $idx) { |
| 336 |
$copy = array(); |
| 337 |
for( $i=0; $i<count($array) ;$i++) { |
| 338 |
if ( $idx != $i ) { |
| 339 |
array_push($copy, $array[$i]); |
| 340 |
} |
| 341 |
} |
| 342 |
return $copy; |
| 343 |
} |
| 344 |
add_filter('the_content', 'process_content'); |
| 345 |
|
| 346 |
|
| 347 |
function ads_widget_register() { |
| 348 |
global $QData; |
| 349 |
if (!function_exists('register_sidebar_widget') || !function_exists('register_widget_control')) { return; }; |
| 350 |
for($i=1;$i<=$QData['AdsWid'];$i++) { |
| 351 |
if(get_option('WidCode'.$i)!='') { |
| 352 |
$displaystr = |
| 353 |
'$cont = get_the_content("",0,"");'. |
| 354 |
'if( !strpos($cont,"<!--OffAds-->") && !(is_home()&&get_option("AppSide")) ) {'. |
| 355 |
'extract($args);'. |
| 356 |
'$title = get_option("WidCode-title-'.$i.'");'. |
| 357 |
'$codetxt = get_option("WidCode'.$i.'");'. |
| 358 |
'echo "\n"."<!-- Quick Adsense Wordpress Plugin: http://techmilieu.com/quick-adsense -->"."\n";'. |
| 359 |
'echo $before_widget."\n";'. |
| 360 |
'if (!empty($title)) { '. |
| 361 |
'echo $before_title.$title.$after_title."\n"; '. |
| 362 |
'};'. |
| 363 |
'echo $codetxt;'. |
| 364 |
'echo "\n".$after_widget;'. |
| 365 |
'}'; |
| 366 |
$controlstr = |
| 367 |
'if ($_POST["WidCodeSubmit'.$i.'"]) {'. |
| 368 |
' update_option_en("WidCode-title-'.$i.'", $_POST["WidCode-title-'.$i.'"], "strip_tags");'. |
| 369 |
' update_option_en("WidCode'.$i.'", $_POST["WidCode'.$i.'"]);'. |
| 370 |
'}'. |
| 371 |
'$title = get_option_en("WidCode-title-'.$i.'");'. |
| 372 |
'$codetxt = get_option_en("WidCode'.$i.'");'. |
| 373 |
'echo "<p><label>'.__('Title:').'</label>";'. |
| 374 |
'echo "<input style=\"width:100%;\" id=\"WidCode-title-'.$i.'\" name=\"WidCode-title-'.$i.'\" type=\"text\" value=\"".$title."\" />";'. |
| 375 |
'echo "<p><textarea style=\"width:100%;height:150px;\" id=\"WidCode'.$i.'\" name=\"WidCode'.$i.'\">".$codetxt."</textarea><br\>";'. |
| 376 |
'echo "<a style=\"font-size:8pt;text-decoration:none\" href=\"options-general.php?page='.basename(__FILE__).'\">'.__('Quick Adsense Setting').'</a></p>";'. |
| 377 |
'echo "<input type=\"hidden\" id=\"WidCodeSubmit'.$i.'\" name=\"WidCodeSubmit'.$i.'\" value=\"true\" />";'; |
| 378 |
$displaycall[$i] = create_function('$args', $displaystr); |
| 379 |
$controlcall[$i] = create_function('', $controlstr); |
| 380 |
$wadsid = sprintf($QData['AdsWidName'],$i); |
| 381 |
register_sidebar_widget($wadsid, $displaycall[$i], "adswidget"); |
| 382 |
register_widget_control($wadsid, $controlcall[$i]); |
| 383 |
} |
| 384 |
} |
| 385 |
} |
| 386 |
function get_option_en($nameid) |
| 387 |
{ |
| 388 |
$txt = get_option($nameid); |
| 389 |
$txt = htmlspecialchars($txt, ENT_QUOTES); |
| 390 |
if(!empty($txt)) { return $txt; }else{ return ""; }; |
| 391 |
} |
| 392 |
function update_option_en($nameid, $text, $opt='') |
| 393 |
{ |
| 394 |
$txt = stripslashes($text); |
| 395 |
if ($opt=='strip_tags') { $txt = strip_tags($txt); }; |
| 396 |
update_option($nameid, $txt); |
| 397 |
if(!empty($txt)) { return $txt; }else{ return ""; }; |
| 398 |
} |
| 399 |
add_action('init', ads_widget_register); |
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
?> |
| 404 |
|