REGISTER or LOGIN to have the annoying ads removed.
Thread Rating:
  • 4 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My Ad Manager v1.2
#34
(May 22, 2012, 09:04 PM)labrocca Wrote: Plugins works perfectly fine for latest MyBB version. I use it all the time with zero problems.

Please explain the issues you're having.

The html comment tokens the myads function looks for to replace with the ad code don't exist and the plugin does not insert these tokens into any template so the ads never get inserted.

I've since fixed the plugin myself by adding some code to insert these tokens into the templates.

As a side note recommendation from another programmer. I also replaced the pointless preg_replace() the plugin was using to do so the actual insertion. preg_replace() is for regex, the plugin needs no regex to do a simple literal text replace; str_replace() is much faster in this case.

PHP Code:
//New replacer
$page str_replace('<!-- start: footer -->','<!-- start: footer --><div class="footerad" align="center">'.$mybb->settings['footad'].'</div>',$page);
//Original replacer
$page preg_replace('#'.preg_quote('<!-- start: footer -->').'#'"<!-- start: footer --><div class=\"footerad\" align=\"center\">"$mybb->settings['footad'] ."</div>"$page); 

Top line is both easier to read and performs better. Both because the usage of str_replace over regex. Plus the fundamental difference between single and double quotes, which is bigger than most people realize. A string in double quotes has to be parsed, which makes your concatenating with it puzzling, while single quotes are not parsed and simply interpreted as is.

These are drops in the bucket sure, saving microseconds. These things add up however, and you should always aim for good code.
Reply


Messages In This Thread
My Ad Manager v1.2 - by Xerotic - Dec 17, 2011, 07:45 PM
RE: My Ad Manager v1.2 - by Philly - Jan 11, 2012, 11:45 PM
RE: My Ad Manager v1.2 - by Bdoom - Jan 15, 2012, 03:15 PM
RE: My Ad Manager v1.2 - by DOOM - Jan 21, 2012, 03:39 AM
RE: My Ad Manager v1.2 - by RzGBlade - Jan 30, 2012, 07:57 PM
RE: My Ad Manager v1.2 - by skindu26 - Feb 03, 2012, 02:03 AM
RE: My Ad Manager v1.2 - by labrocca - Feb 03, 2012, 01:37 PM
RE: My Ad Manager v1.2 - by manchester10 - Feb 12, 2012, 07:23 PM
RE: My Ad Manager v1.2 - by datchison - Mar 04, 2012, 11:48 PM
RE: My Ad Manager v1.2 - by creativefreak - Mar 05, 2012, 10:04 AM
RE: My Ad Manager v1.2 - by DJNilo - Mar 10, 2012, 03:04 AM
RE: My Ad Manager v1.2 - by WallBB - Mar 16, 2012, 12:28 AM
RE: My Ad Manager v1.2 - by dalawh - Mar 17, 2012, 02:20 AM
RE: My Ad Manager v1.2 - by Lani - Mar 26, 2012, 10:19 AM
RE: My Ad Manager v1.2 - by cclautti - Apr 04, 2012, 02:11 PM
RE: My Ad Manager v1.2 - by labrocca - Apr 04, 2012, 03:25 PM
RE: My Ad Manager v1.2 - by cclautti - Apr 04, 2012, 03:56 PM
RE: My Ad Manager v1.2 - by labrocca - Apr 04, 2012, 03:59 PM
RE: My Ad Manager v1.2 - by cclautti - Apr 05, 2012, 03:39 PM
RE: My Ad Manager v1.2 - by DrizzyAmerica - Apr 16, 2012, 06:20 PM
RE: My Ad Manager v1.2 - by dalawh - Apr 19, 2012, 06:45 PM
RE: My Ad Manager v1.2 - by sljralcordo - Apr 23, 2012, 07:37 PM
RE: My Ad Manager v1.2 - by dalawh - Apr 27, 2012, 01:50 AM
RE: My Ad Manager v1.2 - by Oliver Evans - Apr 27, 2012, 08:14 AM
RE: My Ad Manager v1.2 - by Vazity - Apr 27, 2012, 03:53 PM
RE: My Ad Manager v1.2 - by labrocca - Apr 27, 2012, 05:53 PM
RE: My Ad Manager v1.2 - by dalawh - Apr 30, 2012, 09:12 PM
RE: My Ad Manager v1.2 - by dalawh - May 02, 2012, 10:07 PM
RE: My Ad Manager v1.2 - by Buddy - May 03, 2012, 03:36 AM
RE: My Ad Manager v1.2 - by WallBB - May 07, 2012, 12:23 PM
RE: My Ad Manager v1.2 - by dalawh - May 07, 2012, 03:03 PM
RE: My Ad Manager v1.2 - by ExiledVip3r - May 22, 2012, 07:25 PM
RE: My Ad Manager v1.2 - by labrocca - May 22, 2012, 09:04 PM
RE: My Ad Manager v1.2 - by ExiledVip3r - May 22, 2012, 11:00 PM
RE: My Ad Manager v1.2 - by labrocca - May 23, 2012, 02:27 AM
RE: My Ad Manager v1.2 - by ExiledVip3r - May 23, 2012, 02:18 PM
RE: My Ad Manager v1.2 - by Rebel Energy - May 10, 2014, 02:28 PM
RE: My Ad Manager v1.2 - by Lieutenant Kitty - May 26, 2012, 08:59 AM
RE: My Ad Manager v1.2 - by FBI - Jun 09, 2012, 07:36 PM
RE: My Ad Manager v1.2 - by creativefreak - Jun 10, 2012, 01:55 PM
RE: My Ad Manager v1.2 - by gemmk1 - Jun 20, 2012, 09:24 AM
RE: My Ad Manager v1.2 - by Freethepain - Jul 26, 2012, 05:18 AM
RE: My Ad Manager v1.2 - by mindaugas355 - Sep 21, 2012, 01:07 PM
RE: My Ad Manager v1.2 - by Scar - Oct 04, 2012, 01:31 PM
RE: My Ad Manager v1.2 - by Imtiax - Nov 11, 2012, 01:10 PM
RE: My Ad Manager v1.2 - by rbse - Nov 27, 2012, 04:17 PM
RE: My Ad Manager v1.2 - by Fatekid - Jan 02, 2013, 07:50 PM
RE: My Ad Manager v1.2 - by Dextra - Feb 20, 2013, 01:44 PM
RE: My Ad Manager v1.2 - by TheSpeedyFeed - Mar 08, 2013, 11:09 PM
RE: My Ad Manager v1.2 - by 3KB - Mar 27, 2013, 10:17 AM
RE: My Ad Manager v1.2 - by jmms - Nov 24, 2013, 01:50 AM
RE: My Ad Manager v1.2 - by jmms - Nov 24, 2013, 01:28 PM
RE: My Ad Manager v1.2 - by jmms - Nov 25, 2013, 09:51 AM
RE: My Ad Manager v1.2 - by jmms - Nov 25, 2013, 04:50 PM
RE: My Ad Manager v1.2 - by ChiefNacho - Dec 01, 2013, 11:14 PM
RE: My Ad Manager v1.2 - by theawesomeadam - May 25, 2014, 02:29 PM
RE: My Ad Manager v1.2 - by HecticMate - Oct 02, 2014, 03:23 PM
RE: My Ad Manager v1.2 - by teknoemin - Mar 20, 2015, 04:33 PM
RE: My Ad Manager v1.2 - by elkeko3000 - Mar 27, 2015, 05:20 PM
RE: My Ad Manager v1.2 - by Drakit - Apr 25, 2015, 03:06 AM
RE: My Ad Manager v1.2 - by Rexx - Jan 16, 2016, 10:39 PM
RE: My Ad Manager v1.2 - by Pixeljunk - Feb 17, 2016, 11:28 AM
RE: My Ad Manager v1.2 - by siry - Sep 05, 2016, 11:05 PM
RE: My Ad Manager v1.2 - by ricardoespiao - Dec 10, 2016, 09:05 PM
RE: My Ad Manager v1.2 - by z3rfy - Mar 15, 2017, 05:30 PM
RE: My Ad Manager v1.2 - by dhyep - May 06, 2017, 06:33 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)