Ejemplo n.º 1
0
 function mycred_plugin_start_up()
 {
     global $mycred, $mycred_types, $mycred_modules;
     $mycred = new myCRED_Settings();
     $mycred_types = mycred_get_types();
     require_once myCRED_INCLUDES_DIR . 'mycred-shortcodes.php';
     // Load Translation
     $locale = apply_filters('plugin_locale', get_locale(), 'mycred');
     load_textdomain('mycred', WP_LANG_DIR . "/mycred/mycred-{$locale}.mo");
     load_plugin_textdomain('mycred', false, dirname(plugin_basename(__FILE__)) . '/lang/');
     // Adjust the plugin links
     add_filter('plugin_action_links_mycred/mycred.php', 'mycred_plugin_links', 10, 4);
     add_filter('plugin_row_meta', 'mycred_plugin_description_links', 10, 2);
     // Lets start with Multisite
     if (is_multisite()) {
         if (!function_exists('is_plugin_active_for_network')) {
             require_once ABSPATH . '/wp-admin/includes/plugin.php';
         }
         if (is_plugin_active_for_network('mycred/mycred.php')) {
             $network = new myCRED_Network_Module();
             $network->load();
         }
     }
     // Load Settings
     require_once myCRED_MODULES_DIR . 'mycred-module-settings.php';
     foreach ($mycred_types as $type => $title) {
         $mycred_modules[$type]['settings'] = new myCRED_Settings_Module($type);
         $mycred_modules[$type]['settings']->load();
     }
     // Load only hooks that we have use of
     if (defined('JETPACK__PLUGIN_DIR')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-jetpack.php';
     }
     if (class_exists('bbPress')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-bbPress.php';
     }
     if (function_exists('invite_anyone_init')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-invite-anyone.php';
     }
     if (function_exists('wpcf7')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-contact-form7.php';
     }
     if (class_exists('BadgeOS')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-badgeOS.php';
     }
     if (function_exists('vote_poll')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-wp-polls.php';
     }
     if (function_exists('wp_favorite_posts')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-wp-favorite-posts.php';
     }
     if (function_exists('bp_em_init')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-events-manager-light.php';
     }
     if (defined('STARRATING_DEBUG')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-gd-star-rating.php';
     }
     if (defined('SFTOPICS')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-simplepress.php';
     }
     if (function_exists('bp_links_setup_root_component')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-buddypress-links.php';
     }
     if (function_exists('bpa_init') || function_exists('bpgpls_init')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-buddypress-gallery.php';
     }
     if (class_exists('GFForms')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-gravityforms.php';
     }
     if (function_exists('rtmedia_autoloader')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-buddypress-media.php';
     }
     if (function_exists('install_ShareThis')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-sharethis.php';
     }
     if (class_exists('WooCommerce')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-woocommerce.php';
     }
     // Load hooks
     require_once myCRED_MODULES_DIR . 'mycred-module-hooks.php';
     foreach ($mycred_types as $type => $title) {
         $mycred_modules[$type]['hooks'] = new myCRED_Hooks_Module($type);
         $mycred_modules[$type]['hooks']->load();
     }
     // Load log
     require_once myCRED_MODULES_DIR . 'mycred-module-log.php';
     foreach ($mycred_types as $type => $title) {
         $mycred_modules[$type]['log'] = new myCRED_Log_Module($type);
         $mycred_modules[$type]['log']->load();
     }
     // BuddyPress
     if (class_exists('BuddyPress')) {
         require_once myCRED_PLUGINS_DIR . 'mycred-hook-buddypress.php';
         require_once myCRED_MODULES_DIR . 'mycred-module-buddypress.php';
         $mycred_modules['mycred_default']['buddypress'] = new myCRED_BuddyPress_Module('mycred_default');
         $mycred_modules['mycred_default']['buddypress']->load();
     }
     // Load admin
     require_once myCRED_INCLUDES_DIR . 'mycred-admin.php';
     $admin = new myCRED_Admin();
     $admin->load();
     do_action('mycred_pre_init');
 }
Ejemplo n.º 2
0
 function mycred_plugin_start_up()
 {
     global $mycred, $mycred_types, $mycred_modules;
     $mycred = new myCRED_Settings();
     $mycred_types = mycred_get_types();
     require_once myCRED_INCLUDES_DIR . 'mycred-shortcodes.php';
     require_once myCRED_INCLUDES_DIR . 'mycred-referrals.php';
     // Load Translation
     $locale = apply_filters('plugin_locale', get_locale(), 'mycred');
     load_textdomain('mycred', WP_LANG_DIR . "/mycred/mycred-{$locale}.mo");
     load_plugin_textdomain('mycred', false, dirname(plugin_basename(__FILE__)) . '/lang/');
     // Adjust the plugin links
     add_filter('plugin_action_links_mycred/mycred.php', 'mycred_plugin_links', 10, 4);
     add_filter('plugin_row_meta', 'mycred_plugin_description_links', 10, 2);
     // Lets start with Multisite
     if (is_multisite()) {
         if (!function_exists('is_plugin_active_for_network')) {
             require_once ABSPATH . '/wp-admin/includes/plugin.php';
         }
         if (is_plugin_active_for_network('mycred/mycred.php')) {
             $network = new myCRED_Network_Module();
             $network->load();
         }
     }
     // Load Settings
     require_once myCRED_MODULES_DIR . 'mycred-module-settings.php';
     foreach ($mycred_types as $type => $title) {
         $mycred_modules[$type]['settings'] = new myCRED_Settings_Module($type);
         $mycred_modules[$type]['settings']->load();
     }
     // Load hooks
     require_once myCRED_MODULES_DIR . 'mycred-module-hooks.php';
     foreach ($mycred_types as $type => $title) {
         $mycred_modules[$type]['hooks'] = new myCRED_Hooks_Module($type);
         $mycred_modules[$type]['hooks']->load();
     }
     // Load log
     require_once myCRED_MODULES_DIR . 'mycred-module-log.php';
     foreach ($mycred_types as $type => $title) {
         $mycred_modules[$type]['log'] = new myCRED_Log_Module($type);
         $mycred_modules[$type]['log']->load();
     }
     // BuddyPress
     if (class_exists('BuddyPress')) {
         require_once myCRED_MODULES_DIR . 'mycred-module-buddypress.php';
         $mycred_modules['mycred_default']['buddypress'] = new myCRED_BuddyPress_Module('mycred_default');
         $mycred_modules['mycred_default']['buddypress']->load();
     }
     // Load admin
     require_once myCRED_INCLUDES_DIR . 'mycred-admin.php';
     $admin = new myCRED_Admin();
     $admin->load();
     do_action('mycred_pre_init');
 }