public static function get_instance() { if (self::$_instance == NULL) { $class = __CLASS__; self::$_instance = new $class(); } return self::$_instance; }
public function admin_menu() { if (is_admin()) { $pollAdminObj = YOP_POLL_Poll_Admin::get_instance(); if (function_exists('add_menu_page')) { $page = add_object_page(__yop_poll('Yop Poll'), __yop_poll('Yop Poll'), 'edit_own_yop_polls', 'yop-polls', array($pollAdminObj, 'manage_polls'), YOP_POLL_URL . "images/yop-poll-admin-menu-icon16.png"); if ($page) { $this->add_action("load-{$page}", 'manage_pages_load'); add_action("load-{$page}", array($pollAdminObj, 'manage_load_polls')); if (function_exists('add_submenu_page')) { if (current_user_can('edit_own_yop_polls')) { $subpage = add_submenu_page('yop-polls', __yop_poll('All Polls'), __yop_poll('All Polls'), 'edit_own_yop_polls', 'yop-polls', array($pollAdminObj, 'manage_polls')); if ($subpage) { $this->add_action("load-{$subpage}", 'manage_pages_load'); add_action("load-{$subpage}", array($pollAdminObj, 'manage_load_polls')); } $subpage = add_submenu_page('yop-polls', __yop_poll('Add New'), __yop_poll('Add New'), 'edit_own_yop_polls', 'yop-polls-add-new', array(&$pollAdminObj, 'manage_polls')); if ($subpage) { $this->add_action("load-{$subpage}", 'manage_pages_load'); add_action("load-{$subpage}", array($pollAdminObj, 'manage_load_polls')); } } if (current_user_can('manage_yop_polls_imports')) { $importObj = YOP_POLL_Imports_Admin::get_instance(); $subpage = add_submenu_page('yop-polls', __yop_poll('Import'), __yop_poll('Import'), 'view_yop_polls_imports', 'yop-polls-imports', array(&$importObj, "manage_imports")); if ($subpage) { $this->add_action("load-{$subpage}", "manage_pages_load"); add_action("load-{$subpage}", array($importObj, 'manage_load_imports')); } } if (current_user_can('view_yop_polls_logs')) { $logsObj = YOP_POLL_Logs_Admin::get_instance(); $subpage = add_submenu_page('yop-polls', __yop_poll('Logs'), __yop_poll('Logs'), 'view_yop_polls_logs', 'yop-polls-logs', array(&$logsObj, "manage_logs")); if ($subpage) { $this->add_action("load-{$subpage}", "manage_pages_load"); add_action("load-{$subpage}", array($logsObj, 'manage_load_logs')); } } if (current_user_can('manage_yop_polls_options')) { $genOptObj = YOP_POLL_General_Options::get_instance(); $subpage = add_submenu_page('yop-polls', __yop_poll('Options'), __yop_poll('Options'), 'manage_yop_polls_options', 'yop-polls-options', array(&$genOptObj, "manage_options")); if ($subpage) { $this->add_action("load-{$subpage}", "manage_pages_load"); add_action("load-{$subpage}", array($genOptObj, 'manage_load_general_options')); } } if (current_user_can('edit_yop_polls_templates')) { $templatesObj = YOP_POLL_Templates_Admin::get_instance(); $subpage = add_submenu_page('yop-polls', __yop_poll('Templates'), __yop_poll('Templates'), 'edit_yop_polls_templates', 'yop-polls-templates', array(&$templatesObj, "manage_templates")); if ($subpage) { $this->add_action("load-{$subpage}", "manage_pages_load"); add_action("load-{$subpage}", array($templatesObj, 'manage_load_templates')); } } if (current_user_can('manage_yop_polls_bans')) { $bansObj = YOP_POLL_Ban_Admin::get_instance(); $subpage = add_submenu_page('yop-polls', __yop_poll('Bans'), __yop_poll('Bans'), 'manage_yop_polls_bans', 'yop-polls-bans', array(&$bansObj, "manage_bans")); if ($subpage) { $this->add_action("load-{$subpage}", "manage_pages_load"); add_action("load-{$subpage}", array($bansObj, 'manage_load_bans')); } } if (current_user_can('help_yop_poll_page')) { $proObj = YOP_POLL_Pro_Admin::get_instance(); $subpage = add_submenu_page('yop-polls', __yop_poll("Help"), __yop_poll("Help"), 'help_yop_poll_page', 'yop-polls-help', array(&$proObj, "yop_poll_help")); if ($subpage) { $this->add_action("load-{$subpage}", "manage_pages_load"); } } if (current_user_can('become_yop_poll_pro')) { $proObj = YOP_POLL_Pro_Admin::get_instance(); $subpage = add_submenu_page('yop-polls', __yop_poll("Upgrade to Pro"), __yop_poll("Upgrade to Pro"), 'become_yop_poll_pro', 'yop-polls-become-pro', array(&$proObj, "manage_pages")); if ($subpage) { $this->add_action("load-{$subpage}", "manage_pages_load"); } } } } } } }