Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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
You can’t perform that action at this time.