Jump to content

I am so baffled right now! (creating a plugin for script)


Anti-Moronic

Recommended Posts

I have no idea how to approach this.

 

Let's say I have a class with a function:

 

<?php

class someclass{

  function do(){
  
  mysql_query("fdafdsa dfafdsak fdsajlfdsa");

  }


} $someclass= new someclass;

?>

 

Now, that may be updated, but I want to create a plugin that can be 'plugged in' to this class and function.

 

Basically, I may need to amend a newly created field within the database or delete something straight after that query - how do I do this.

 

Currently I call the function like so:

 

<?php

$someclass->do();

?>

 

Is there any way to change that function from within an extended class?

 

Any help is greatly appreciated.

Do you have any advice on how I would amend database queries?

 

What do you do?

 

Basically, in the function do, I run a query, but then I want to be able to change this query, which means storing the query in a string.

 

But where do I store these queries so I can access them in class which extends the parent class of those query definitions?

 

Thanks for you help.

I'm trying to develop my script so that I can easily add plugins later.

 

Thing is, I'm stuck at the part where I have to design the classes so I can extend and easily add/edit/delete functions within them.

 

What I have is:

 

<?php

class override extends someclass{

  function do(){

  mysql_query("query");
  // maybe do something else

  }


} $someclass = new override;

?>

 

So what I'm doing is overriding the old do() with my new do() and still maintaining all functions within the class::someclass - because I can't change the actual code that refers to $someclass->do();

 

..I don't know, is there a better way? How do people create plugins for wordpress, I've searched but I just can't get any answers *showing core php*, same with any popular platform. It's always examples on the platforms native functions.

 

Really, I am totally baffled..

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.