/** * Set the different permission for the administrator role. Add all existing permission for this role. * @see wpshop_permissions::permission_list() */ function set_administrator_role_permission() { $adminRole = get_role('administrator'); $permissionList = wpshop_permissions::permission_list(); foreach ($permissionList as $permissionName => $permissionDef) { if ($adminRole != null && !$adminRole->has_cap($permissionName)) { $adminRole->add_cap($permissionName); } } unset($adminRole); }
require WP_PLUGIN_DIR . '/' . WPSHOP_PLUGIN_DIR . '/includes/config.php'; /* * Allow to get errors back when debug mode is set to true */ if (WPSHOP_DEBUG_MODE && (in_array(long2ip(ip2long($_SERVER['REMOTE_ADDR'])), unserialize(WPSHOP_DEBUG_MODE_ALLOWED_IP)) || !empty($_GET['distant_debug_mode']) && $_GET['distant_debug_mode'] == 'eoxia')) { ini_set('display_errors', true); error_reporting(E_ALL); } include_once WPSHOP_LIBRAIRIES_DIR . 'init.class.php'; /* Call main initialisation function */ add_action('init', array('wpshop_init', 'load')); /* Include the main including file */ require WP_PLUGIN_DIR . '/' . WPSHOP_PLUGIN_DIR . '/includes/include.php'; /* Check and set (if needed) administrator(s) permissions' each time the plugin is launched. Admin role has all right */ wpshop_permissions::set_administrator_role_permission(); wpshop_permissions::wpshop_init_roles(); /* Call function to create the main left menu */ add_action('admin_menu', array('wpshop_init', 'admin_menu')); add_action('menu_order', array('wpshop_init', 'admin_menu_order')); add_action('custom_menu_order', array('wpshop_init', 'admin_custom_menu_order')); /* Call function for new wordpress element creating [term (product_category) / post (product)] */ add_action('init', array('wpshop_init', 'add_new_wp_type')); /* Call function allowing to change element front output */ add_action('the_content', array('wpshop_display', 'products_page'), 1); // add_action('archive_template', array('wpshop_categories', 'category_template_switcher')); /* On plugin activation create the default parameters to use the ecommerce */ register_activation_hook(__FILE__, array('wpshop_install', 'install_on_activation')); /* On plugin deactivation call the function to clean the wordpress installation */ register_deactivation_hook(__FILE__, array('wpshop_install', 'uninstall_wpshop')); /* Add the database content */ add_action('admin_init', array('wpshop_install', 'update_wpshop'));
require WP_PLUGIN_DIR . '/' . WPSHOP_PLUGIN_DIR . '/includes/config.php'; /** Allow to get errors back when debug mode is set to true */ if (WPSHOP_DEBUG_MODE && in_array(long2ip(ip2long($_SERVER['REMOTE_ADDR'])), unserialize(WPSHOP_DEBUG_MODE_ALLOWED_IP))) { ini_set('display_errors', true); error_reporting(E_ALL); } include_once WPSHOP_LIBRAIRIES_DIR . 'init.class.php'; $current_installation_step = get_option('wps-installation-current-step', 1); /** Get current plugin version */ $current_db_version = get_option('wpshop_db_options', 0); /** Call main initialisation function */ add_action('init', array('wpshop_init', 'load')); /** Include the main including file */ require WP_PLUGIN_DIR . '/' . WPSHOP_PLUGIN_DIR . '/includes/include.php'; /** Check and set (if needed) administrator(s) permissions' each time the plugin is launched. Admin role has all right */ $wpshop_permissions = new wpshop_permissions(); $wpshop_permissions->set_administrator_role_permission(); $wpshop_permissions->wpshop_init_roles(); /** Call function to create the main left menu */ //if ( ( WPSINSTALLER_STEPS_COUNT <= $current_installation_step ) || ( !empty( $current_db_version ) && !empty( $current_db_version[ 'db_version' ] ) && ( 51 < $current_db_version[ 'db_version' ] ) ) || ( !empty( $_GET ) && !empty( $_GET[ 'installation_state' ] ) && ( "ignored" == $_GET[ 'installation_state' ] ) ) ) { add_action('admin_menu', array('wpshop_init', 'admin_menu')); add_action('menu_order', array('wpshop_init', 'admin_menu_order')); add_action('custom_menu_order', array('wpshop_init', 'admin_custom_menu_order')); /* Call function for new wordpress element creating [term (product_category) / post (product)] */ add_action('init', array('wpshop_init', 'add_new_wp_type')); /* Call function allowing to change element front output */ add_action('the_content', array('wpshop_display', 'products_page'), 1); // add_action('archive_template', array('wpshop_categories', 'category_template_switcher')); //} /** On plugin activation create the default parameters to use the ecommerce */ register_activation_hook(__FILE__, array('wpshop_install', 'install_on_activation'));