isPluginActive( $class, $constant, $php ); return $result; } private function isPluginActive( $class = '', $constant = '', $plugin = '' ) { $result = false; $result = ( $result || ( '' != $class && class_exists( $class ) ) ); $result = ( $result || ( '' != $constant && defined( $constant ) ) ); //require plugin.php //$result=($result || ($plugin!='' && is_plugin_active($plugin))); return $result; } function getVersion( $pluginId ) { $constant = ''; $version = ''; switch ( $pluginId ) { case TCMP_PLUGINS_WOOCOMMERCE: $constant = 'WOOCOMMERCE_VERSION'; break; case TCMP_PLUGINS_EDD: $constant = 'EDD_SL_VERSION'; break; case TCMP_PLUGINS_WP_ECOMMERCE: $constant = 'WPSC_VERSION'; break; case TCMP_PLUGINS_WP_SPSC: $constant = 'WP_CART_VERSION'; break; case TCMP_PLUGINS_S2MEMBER: $constant = 'WS_PLUGIN__S2MEMBER_VERSION'; break; case TCMP_PLUGINS_MEMBERS: $constant = 'MEMBERS_VERSION'; break; case TCMP_PLUGINS_CART66: $constant = 'CART66_VERSION_NUMBER'; break; case TCMP_PLUGINS_ESHOP: $constant = 'ESHOP_VERSION'; break; case TCMP_PLUGINS_JIGOSHOP: $constant = 'JIGOSHOP_VERSION'; break; case TCMP_PLUGINS_MARKETPRESS: global $mp; $version = $mp->version; break; case TCMP_PLUGINS_SHOPP: $constant = 'ESHOP_VERSION'; break; case TCMP_PLUGINS_SIMPLE_WP_ECOMMERCE: $version = $GLOBALS['it_exchange']['version']; break; case TCMP_PLUGINS_CF7: $constant = 'WPCF7_VERSION'; break; case TCMP_PLUGINS_GRAVITY: $constant = ''; break; } if ( '' == $version && '' != $constant ) { $version = ( defined( $constant ) ? constant( $constant ) : '' ); } return $version; } function getActivePlugins( $ids ) { return $this->getActivePlugins( $ids, true ); } function getPlugins( $ids, $onlyActive = true ) { $array = array(); if ( ! is_array( $ids ) ) { $ids = array( intval( $ids ) ); } foreach ( $ids as $id ) { if ( ! $onlyActive || $this->isActive( $id ) ) { $name = $this->getName( $id ); $version = $this->getVersion( $id ); $v = array( 'id' => $id, 'name' => $name, 'version' => $version, 'active' => $this->isActive( $id ), ); $array[ $name ] = $v; } } ksort( $array ); return $array; } }