function page_loaded() { $this->init_tabs(); do_action('tabs_' . $this->pagehook, $this); appthemes_add_instance(array('APP_ToolTips' => array($this->pagehook))); parent::page_loaded(); }
/** * Setups CSV importer. * * @return void */ function cp_csv_importer() { $fields = array('title' => 'post_title', 'description' => 'post_content', 'status' => 'post_status', 'author' => 'post_author', 'date' => 'post_date', 'slug' => 'post_name'); $args = array('taxonomies' => array(APP_TAX_CAT, APP_TAX_TAG), 'custom_fields' => array('id' => 'cp_sys_ad_conf_id', 'expire_date' => 'cp_sys_expire_date', 'duration' => 'cp_sys_ad_duration', 'total_cost' => 'cp_sys_total_ad_cost', 'price' => 'cp_price', 'street' => 'cp_street', 'city' => 'cp_city', 'zipcode' => 'cp_zipcode', 'state' => 'cp_state', 'country' => 'cp_country'), 'attachments' => true); $args = apply_filters('cp_csv_importer_args', $args); appthemes_add_instance(array('CP_Importer' => array(APP_POST_TYPE, $fields, $args))); }
/** * Setup admin menu pages for Form Layouts & Custom Fields. * * @return void */ function appthemes_admin_options() { global $page_hook, $submenu; $pages = array('app-settings', 'app-email', 'app-pricing'); if (!empty($_GET['page']) && in_array($_GET['page'], $pages)) { appthemes_add_instance(array('APP_ToolTips' => array($page_hook))); } add_submenu_page('edit.php?post_type=' . APP_POST_TYPE, __('Forms', APP_TD), __('Forms', APP_TD), 'manage_options', 'layouts', 'cp_form_layouts'); add_submenu_page('edit.php?post_type=' . APP_POST_TYPE, __('Custom Fields', APP_TD), __('Custom Fields', APP_TD), 'manage_options', 'fields', 'cp_custom_fields'); // re-order the menu items $submenu['edit.php?post_type=' . APP_POST_TYPE] = _cp_reorder_menu($submenu['edit.php?post_type=' . APP_POST_TYPE], 'layouts', 2); $submenu['edit.php?post_type=' . APP_POST_TYPE] = _cp_reorder_menu($submenu['edit.php?post_type=' . APP_POST_TYPE], 'fields', 3); do_action('appthemes_add_submenu_page'); }
/** * Adds a class instance into global variable $app_instances that holds an array of instances. * * @param string|object|array $class A class name, class object, or array of class names or objects. * @param array An array of arguments to be used positionally when instantiating the object. Only used * if $class is a string * * @return bool Boolean True on success, False on failure */ function appthemes_add_instance($class, $args = array()) { global $app_instances; if (!isset($app_instances)) { $app_instances = array(); } if (is_array($class)) { foreach ($class as $class_name => $class_args) { if (is_int($class_name)) { appthemes_add_instance($class_args); } else { appthemes_add_instance($class_name, $class_args); } } } else { if (is_object($class)) { $app_instances[get_class($class)] = $class; } else { if (is_string($class) && class_exists($class)) { $args = !is_array($args) ? array($args) : $args; $app_instances[$class] = appthemes_instantiate_class($class, $args); } else { return false; } } } return true; }
foreach ($app_db_tables as $app_db_table) { scb_register_table($app_db_table); } scb_register_table('app_pop_daily', 'cp_ad_pop_daily'); scb_register_table('app_pop_total', 'cp_ad_pop_total'); $load_files = array('checkout/load.php', 'payments/load.php', 'reports/load.php', 'widgets/load.php', 'admin/addons-mp/load.php', 'options.php', 'appthemes-functions.php', 'actions.php', 'categories.php', 'comments.php', 'core.php', 'cron.php', 'custom-forms.php', 'deprecated.php', 'enqueue.php', 'emails.php', 'functions.php', 'hooks.php', 'images.php', 'packages.php', 'payments.php', 'profile.php', 'search.php', 'security.php', 'stats.php', 'views.php', 'views-checkout.php', 'widgets.php', 'theme-support.php', 'customizer.php', 'utils.php', 'checkout/form-progress/load.php'); appthemes_load_files(dirname(__FILE__) . '/includes/', $load_files); $load_classes = array('CP_Blog_Archive', 'CP_Posts_Tag_Archive', 'CP_Post_Single', 'CP_Author_Archive', 'CP_Ads_Tag_Archive', 'CP_Ads_Archive', 'CP_Ads_Home', 'CP_Ads_Categories', 'CP_Add_New', 'CP_Renew_Listing', 'CP_Ad_Single', 'CP_Edit_Item', 'CP_Membership', 'CP_User_Dashboard', 'CP_User_Dashboard_Orders', 'CP_User_Profile', 'CP_Order', 'CP_Membership_Form_Select', 'CP_Membership_Form_Preview', 'CP_Listing_Form_Select_Category', 'CP_Listing_Form_Edit', 'CP_Listing_Form_Details', 'CP_Listing_Form_Preview', 'CP_Listing_Form_Submit_Free', 'CP_Gateway_Select', 'CP_Gateway_Process', 'CP_Order_Summary', 'CP_Widget_125_Ads', 'CP_Widget_Ad_Categories', 'CP_Widget_Ad_Sub_Categories', 'CP_Widget_Ads_Tag_Cloud', 'CP_Widget_Blog_Posts', 'CP_Widget_Facebook', 'CP_Widget_Featured_Ads', 'CP_Widget_Search', 'CP_Widget_Sold_Ads', 'CP_Widget_Top_Ads_Today', 'CP_Widget_Top_Ads_Overall'); appthemes_add_instance($load_classes); // Admin only if (is_admin()) { require_once APP_FRAMEWORK_DIR . '/admin/importer.php'; $load_files = array('admin.php', 'dashboard.php', 'enqueue.php', 'install.php', 'importer.php', 'listing-single.php', 'listing-list.php', 'options.php', 'package-single.php', 'package-list.php', 'settings.php', 'system-info.php', 'updates.php'); appthemes_load_files(dirname(__FILE__) . '/includes/admin/', $load_files); $load_classes = array('CP_Theme_Dashboard', 'CP_Theme_Settings_General' => $cp_options, 'CP_Theme_Settings_Emails' => $cp_options, 'CP_Theme_Settings_Pricing' => $cp_options, 'CP_Theme_System_Info', 'CP_Listing_Package_General_Metabox', 'CP_Membership_Package_General_Metabox', 'CP_Listing_Attachments_Metabox', 'CP_Listing_Media' => array('_app_media', __('Attachments', APP_TD), APP_POST_TYPE, 'normal', 'low'), 'CP_Listing_Author_Metabox', 'CP_Listing_Info_Metabox', 'CP_Listing_Custom_Forms_Metabox', 'CP_Listing_Pricing_Metabox'); appthemes_add_instance($load_classes); // integrate custom permalinks in WP permalinks page $settings = appthemes_get_instance('CP_Theme_Settings_General'); add_action('admin_init', array($settings, 'init_integrated_options'), 10); } // Frontend only if (!is_admin()) { cp_load_all_page_templates(); } // Constants define('CP_DASHBOARD_URL', get_permalink(CP_User_Dashboard::get_id())); define('CP_DASHBOARD_ORDERS_URL', get_permalink(CP_User_Dashboard_Orders::get_id())); define('CP_PROFILE_URL', get_permalink(CP_User_Profile::get_id())); define('CP_EDIT_URL', get_permalink(CP_Edit_Item::get_id())); define('CP_ADD_NEW_URL', get_permalink(CP_Add_New::get_id())); define('CP_MEMBERSHIP_PURCHASE_URL', get_permalink(CP_Membership::get_id()));
/** * Build Search Index for past items * * @return void */ function _cp_setup_build_search_index() { if (!current_theme_supports('app-search-index')) { return; } appthemes_add_instance('APP_Build_Search_Index'); }
/** * Load tooltips for the current screen. * Avoids loading multiple tooltip instances on metaboxes. */ public function init_tooltips() { if (!appthemes_get_instance('APP_ToolTips')) { appthemes_add_instance(array('APP_ToolTips' => array(get_current_screen()->id))); } }