Skip to content

Instantly share code, notes, and snippets.

@q2amarket
Last active August 29, 2015 13:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save q2amarket/8951524 to your computer and use it in GitHub Desktop.
<?php
/*
* These functions will goes to your qa-plugin.php
*/
//registering plugin stuffs
qa_register_plugin_layer('q2am-item-output.php', 'Q2AM Item Layer');
qa_register_plugin_module('page', 'q2am-item-page.php', 'q2am_item_page', 'Q2AM Item Page');
qa_register_plugin_module('module', 'q2am-item-admin.php', 'q2am_item_admin', 'Q2AM Item Settings');
qa_register_plugin_phrases('q2am-Item-lang.php', 'q2am_item_lang');
/*
* Now you can check class in anywhere in the system
* using class_exists or checking in array using
* get_declared_classes() function
*
* You can use this in
* theme file
* another plugin file
* layer
* another class
*
* As far as class is available in the system,
* you can check it anywhere the same way like
* function_exists() for function
*/
//now check if class is exists in the system
if(class_exists('q2am_item_page'))
{
//do the stuffs
}
if(class_exists('q2am_item_page') && class_exists('q2am_item_admin') ....)
{
//do the stuffs
}
//May be we can get list of classes and check in_array
$classes = get_declared_classes();
if(in_array('q2am_item_page', $classes ))
{
//do the stuffs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment