Recent Topics

Execute php code plugin

Started by on Mar 26, 2008 – Contents updated: Mar 26, 2008

Mar 26, 2008 20:05    

Is there a plugin that will allow you to execute php code currently?

Mar 26, 2008 21:37

No, and there will never be

Apr 09, 2008 01:56

errr... I can actually imagine that there will someday be...

This will require super strong 'I'm the admin and I'm gonna jeopardize my own site' privileges though...

Apr 09, 2008 01:58

One cool use of this is that you can put some "hacks" into a PHP widget and you might be able to migrate them from one version to another.

quard, can you give an example of how you would use this? I mean where would you need to have the PHP code executed?

May 30, 2008 23:10

Well, I've been thinking on this kind of plugin as a way to integrate content using some code I have, can't find anything like this and would be very helpfull......

Jan 28, 2009 06:23

Been a while since I checked the site for help, but hey that what happens when you've been running b2 for a few years!

One of the reasons I wanted to run php as a widget/plugin was so that I could do things like run a php countdown timer on the sidebar. Instead of modifying my main php code, I'd love to run widgets like the php countdown timer so that when I wanted to do it, I could just click it on or off.

I know there's a countdown widget now, but I prefer the one I was using on my site.

Jan 28, 2009 06:32

Hi guard,

You can either use a FreeHTML widget to do an iframe pointing to the script or you can very easily create a widget (plugin) with the script.
A FreePHP is a tremendous hazard for the security of your blog.

Show me the script and I'll show you how to do a widget.

Good luck

Jan 28, 2009 18:49

Afwas: thanks! I really appreciate the help. Here's what I put in my index.main.php to get a countdown timer for days of Xmas Music Left in a year. I'd like to create a widget that allows in the settings to change:
Title of Countdown
Hrs Min sec mnth day fields
sideItemTitle

<div class="bSideItem">
<h3 class="sideItemTitle">Days of Xmas Music Left:</h3><h1>
<?php
$target = mktime(0, 0, 0, 12, 26, 2009) ; // hrs, min, sec, mth, day, year,
$today = time () ;
$difference =($target-$today) ;
$days =(int) ($difference/86400) ;
print $days;
?></h1>

Also, is it possible to add the bSideItem and div classes to the widget itself so the main.php will never have to be edited if I want to change the widget?

Jan 28, 2009 19:00

Hi quard,

Look at that. A FreePHP widget would hardly help here. Especially if you set your alarms every few days. I will look into this asap.

Have a nice day

Jan 28, 2009 22:46

Thanks, I'll try it out soon!

Jan 29, 2009 04:19

hey, there's a countdown plugin from edb..

Jan 29, 2009 05:13

As I said earlier, I know there's a countdown widget , but I prefer the php one I was using on my site.

Jan 29, 2009 05:33

With this plugin I want to show how easy it is to write a widget. That is, this code is commented in a way that someone with moderate knowledge of PHP and some time to investigate the program flow can write a widget on his own.
Secondly and not less important I want to warn for a FreePHP thingy. Whatever way you do that it has the internal risk of someone blowing your blog away. Of course that some one could do the same in various other ways, but making a FreePHP widget is like inviting hackers to test it to its limits.

As stated earlier, if you want a widget like this - a countdown thingy - you're far better off investing that little more time. The widget has a setting where you can add a new date. With a FreePHP solution you'd be hacking the code every now and again. You're able to easily maintain larger chunks of code. The plugin has direct access to all of the other blog code (variables, functions, classes, caches). And it's still relatively safe.

Have fun

Jan 29, 2009 06:20

Afwas: thanks again, appreciate it. I will definitely play around with it!

Jan 30, 2009 00:18

Slightly Related: can I make multiple widgets from one plugin?

The thing I'm doing was a huge skintag that basically built the entire sidebar. I'd like to make it be individual widgets so that, depending on circumstances, I could choose these 5 but not those 4 sidebar bits. So I started thinking "damn now I gotta figure out how to make widgets again THEN figure out how to make multiple widgets if that is possible" and along comes a widget making example.

So does anyone know if I can make multiple widgets?

(Sorry for not even trying yet but holy cow the plugin itself just went over 100K and isn't even close to useful :( )


Form is loading...

powered by b2evolution free blog software – This forum is powered by b2evolution CMS, a complete engine for your website.