I have a PHP-mysql application which is running by portable server (i.e.XAMPP). The client buy additional functions (like Chart, report) after using the gerneral app.
However, for example, there are some links need to be linked from general app to additional function after installing. Those links will be disabled when the addtional function hasn't been installed.
My question is how to solve the above scenario? Really appreciate for any help and Thanks in advance.
A simple solution would be to define a constant, for example PLUGIN_CHART, in the plugin and in the main app just check if the constant exists and is true.
If the plugins are actual functions, another way is to use function_exists() to check if it's available.
There are several ways of going about it, here is a simple way:
Have a directory called plugins. Within that directory create a folder for each plugin you have. For each of your client, put only the plugins they will be using.
Now, instead of linking each possible plugin, check to see if the plugin is loaded (or at least if the directory exists), if it does, create a link!
Related
Is it possible to install a plugin in Wordpress even I haven't admin access. This question has been raised in the interview. I responded as No because a CMS can't provide space for security beach.
I am curious to know that is it really possible?
If you had FTP access you could use the activate_plugin() function. There's very little information out there about this function but it looks fairly simple.
Consider using a function like plugin_basename() to get the path you need.
http://codex.wordpress.org/Function_Reference/plugin_basename
activate_plugin( '/path/to/plugin/file' );
You might be able to if you have access to the DB, or/and if you have write access to the filesystem (through FTP for example). But not through the web interface.
First off, this isn't really a programming question but more of a programming concept question. Basically, I've built a bespoke PHP framework to speed up deployment on my end and I want some kind of plugin system in place that will allow me to add specific features to the base of the framework (like the SQL class or maybe a Twitter package) that will allow me to throw them into a folder and not have to actually edit the base for every new project.
Any ideas of the best way of going about this?
Here is a nicely written post by #ircmaxell on how to do that and what are the options:
Handling Plugins In PHP
Also check out:
Best way to allow plugins for a PHP application
what im doing in my cms:
for each plugin i make a folder latin-named of this plugin's name.
i create a /translations folder in there too. Check here.
have a single php file that has 2 basic functions, the plugin_install and plugin_uninstall (you know, things to happen on install/unistall like tables creation/drop)
create a special page of your system that reads these plugins, installed and not and give an on/off switch so users can install/unistall them.
load these single files mentioned above by a single call to include_once on top of your index page (or administration page) so to include whatever functionality they offer.
enabled plugins will be loaded (include_once) from your main page, and also their functionality, so each plugin can call each other's as well.
Actually i am using sugarCRM open source for my own purpose. That was developed by PHP in MVC format. I want to do some changes in existing file. I cannot modify the any code at any cost, because i cannot understand the flow of the code. In sugar CRM having many folders and files so that was difficult to understand the code flowing.
Exactly what i am expecting is, atleast one module is how is flowing with the code and what is the exact file path...
Very Big thanks in Advance...
Have you checked out the Sugar Developers website? There are tutorials and other information about developing for Sugar.
Sugar Developers website is a great source but you could also use documentation where you could find for each SugarCRM Flavor a Developer Guide, and since 6.3 an API Documentation and a Schema Documentation.
Sugar modules are in /modules but you don't want to edit these as it is not upgrade safe. To make a modification you either use or create the relevant folder in /custom/modules
Most often you will be doing metadata updates (most functionality is metadata driven) in files like editviewdefs.php, listviewdefs.php in the custom folder.
Logic hooks can go in here too, search for logic_hooks.php in the sugar documentation as it shows the way to create the metadata array to reference new PHP functions on hooks like "before_save", "after_save" and others.
Sometimes you can start the customisations in Studio (admin menu) and get examples generated in the custom folder for you.
In drupal, it's possible to create a "build", also known as "install profile" or "distribution" that basically combines several modules and your settings for them. So the next time you setup the same exact site, you don't have to re-configure all the modules.
Does Joomla have a similar concept, and what is it called? Please reference documentation as well if possible.
The concept is very simple - you just need to get a clean installation, install all the extensions you want and configure them the way you need.
Then it is enough to copy the files and the database to a new location and change the settings in the configuration file (configuration.php). That is all.
It is a very simple process and can easily be automated with a simple php script. I once did an asp.net app which was deploying new installations of joomla within seconds.
You could try something like http://www.akeebabackup.com/
This allows you to take a snapshot of a site and export it anywhere.
I have a hosting (hostgator) account with a master directory and multiple subdirectories, each representing a www address. I'd like to know if its possible to create an interface in php that would allow me to update a given file (say, header.php) in a specific folder (my custom wordpress theme which resides in each site) which will be the same in every site.
I currently have to do this via FTP, but its cumbersome b/c I have to open each directory and copy the file to it. So if I have 30 sites to update, its very time consuming. i'd like to just have a list of sites with a checkbox beside each of them (and a "select all" toggle) and run the update on all sites in one click)
Thanks for your input!
PS: I know there are probably chron scripts or interfaces that can do this, but I'll be creating a scriptable (PHP) solution I can package up and send to someone and it just works and is brain-dead simple to use.
Yes, it's possible, you can modify files using PHP's file functions and you can communicate what to update through sockets.
It would be fairly complicated to implement though so I'm not sure what you're asking for.. Yes it's possible but I doubt someone here will give you a copy&paste solution. Do you have a more specific question?
EDIT: an easier solution would be to have a SVN repository so you can simply do it with one line of PHP code:
`svn update`
Any reason you're not using WordPress MU? With it and the child theme functionality built into recent versions of WordPress, your life might be a lot easier.
Yes:
I currently have to do this via FTP,
but its cumbersome b/c I have to open
each directory and copy the file to
it. So if I have 30 sites to update,
its very time consuming. i'd like to
just have a list of sites with a
checkbox beside each of them (and a
"select all" toggle) and run the
update on all sites in one click)
Basically you need to script those FTP actions and provide some logic as to what path and what files. You can then style the entire thing with a simple front end, listing your sites with a checkbox to select.
Doesn't seem difficult, just have to get the FTP path traversal working and file cp'ing down.
Have a look at Phing and search Google for deployment with PHP
If you are hosting multiple WP sites, you really should use WPMU.
I've implemented Uploadify for single / multiple file upload. Works great.
I also use Wordpress.
if its just the header.php and you dont have svn (you could setup an hook which would copy it for you to the right place)
you could write a bash script if you have ssh access