function init() { scb_register_table('p2p'); scb_register_table('p2pmeta'); add_action('admin_notices', array(__CLASS__, 'maybe_install')); add_action('deleted_post', array(__CLASS__, 'deleted_post')); }
static function init() { scb_register_table('p2p'); scb_register_table('p2pmeta'); add_action('deleted_post', array(__CLASS__, 'deleted_object')); add_action('deleted_user', array(__CLASS__, 'deleted_object')); }
function init($args) { self::$args = (object) $args; scb_register_table('app_geodata'); add_action('appthemes_first_run', array(__CLASS__, 'install')); // TODO: hook uninstall somewhere add_action('init', array(__CLASS__, 'add_query_vars')); add_action('parse_query', array(__CLASS__, 'parse_query')); add_filter('posts_clauses', array(__CLASS__, 'posts_clauses'), 10, 2); }
/** * Sets up table. * * @param string $name Table name. * @param string $file Reference to main plugin file. * @param string $columns The SQL columns for the CREATE TABLE statement. * @param array $upgrade_method (optional) * * @return void */ public function __construct($name, $file, $columns, $upgrade_method = 'dbDelta') { $this->name = $name; $this->columns = $columns; $this->upgrade_method = $upgrade_method; scb_register_table($name); if ($file) { scbUtil::add_activation_hook($file, array($this, 'install')); scbUtil::add_uninstall_hook($file, array($this, 'uninstall')); } }
/** * Initialize stats. * * @return void */ public static function init() { self::$args = self::get_args(); self::$stats_data = array(); scb_register_table('app_stats_daily', self::$args['table_daily']); scb_register_table('app_stats_total', self::$args['table_total']); add_action('appthemes_first_run', array(__CLASS__, 'install'), 9); add_action('delete_post', array(__CLASS__, 'delete_post_stats')); add_action('wp_ajax_reset-stats', array(__CLASS__, 'ajax_reset_post_stats')); // Cron $cronjob = new scbCron('', array('callback' => array(__CLASS__, 'clear_daily_stats'), 'schedule' => 'daily')); add_action('appthemes_first_run', array($cronjob, 'reset')); }
function _appthemes_load_features() { if (current_theme_supports('app-wrapping')) { require_once dirname(__FILE__) . '/includes/wrapping.php'; } if (current_theme_supports('app-geo')) { require_once dirname(__FILE__) . '/includes/geo.php'; } if (current_theme_supports('app-login')) { require_once dirname(__FILE__) . '/includes/views-login.php'; list($templates) = get_theme_support('app-login'); new APP_Login($templates['login']); new APP_Registration($templates['register']); new APP_Password_Recovery($templates['recover']); new APP_Password_Reset($templates['reset']); } if (current_theme_supports('app-feed')) { add_filter('request', 'appthemes_modify_feed_content'); } if (current_theme_supports('app-stats')) { list($options) = get_theme_support('app-stats'); scb_register_table('app_stats_daily', $options['table_daily']); scb_register_table('app_stats_total', $options['table_total']); add_action('appthemes_first_run', 'appthemes_install_stats_tables', 9); add_action('wp_ajax_reset-stats', 'appthemes_reset_stats_ajax'); } if (is_admin() && current_theme_supports('app-versions')) { require_once dirname(__FILE__) . '/admin/versions.php'; } if (current_theme_supports('app-search-index')) { require_once dirname(__FILE__) . '/includes/search-index.php'; } if (current_theme_supports('app-comment-counts')) { require_once dirname(__FILE__) . '/includes/comment-counts.php'; } if (current_theme_supports('app-term-counts')) { require_once dirname(__FILE__) . '/includes/term-counts.php'; } if (current_theme_supports('app-plupload')) { require_once dirname(__FILE__) . '/app-plupload/app-plupload.php'; } if (current_theme_supports('app-slider')) { require_once dirname(__FILE__) . '/includes/slider/slider.php'; } if (is_admin() && (current_theme_supports('app-slider') || current_theme_supports('app-attachments-metabox'))) { require_once dirname(__FILE__) . '/admin/class-attachments-metabox.php'; } // init notices new APP_Notices(); }
<?php scb_register_table('app_geodata'); add_action('appthemes_first_run', array('APP_Geo_Query', 'install'), 9); add_action('init', array('APP_Geo_Query', 'add_query_vars')); add_action('parse_query', array('APP_Geo_Query', 'parse_query')); add_filter('posts_clauses', array('APP_Geo_Query', 'posts_clauses'), 10, 2); function appthemes_get_coordinates($post_id, $fallback_to_zero = true) { global $wpdb; $coord = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->app_geodata} WHERE post_id = %d", $post_id)); if (!$coord && $fallback_to_zero) { return (object) array('lat' => 0, 'lng' => 0); } return $coord; } function appthemes_set_coordinates($post_id, $lat, $lng) { global $wpdb; $coord = appthemes_get_coordinates($post_id, false); if (!$coord) { return $wpdb->insert($wpdb->app_geodata, compact('lat', 'lng', 'post_id')); } else { return $wpdb->update($wpdb->app_geodata, compact('lat', 'lng'), compact('post_id')); } } function appthemes_delete_coordinates($post_id) { global $wpdb; return $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->app_geodata} WHERE post_id = %d", $post_id)); }
* Theme functions file * * DO NOT MODIFY THIS FILE. Make a child theme instead: http://codex.wordpress.org/Child_Themes * * @package ClassiPress * @author AppThemes */ // current version $app_theme = 'ClassiPress'; $app_abbr = 'cp'; $app_version = '3.2.1'; $app_db_version = 1320; $app_edition = 'Ultimate Edition'; $app_stats = 'today'; // define rss feed urls $app_rss_feed = 'http://feeds2.feedburner.com/appthemes'; $app_twitter_rss_feed = 'http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=appthemes'; $app_forum_rss_feed = 'http://forums.appthemes.com/external.php?type=RSS2'; // define the transients we use $app_transients = array($app_abbr . '_cat_menu'); define('APP_TD', 'classipress'); // Framework require dirname(__FILE__) . '/framework/load.php'; scb_register_table('app_pop_daily', $app_abbr . '_ad_pop_daily'); scb_register_table('app_pop_total', $app_abbr . '_ad_pop_total'); require dirname(__FILE__) . '/framework/includes/stats.php'; if (is_admin()) { require dirname(__FILE__) . '/framework/admin/importer.php'; } // Theme-specific files require dirname(__FILE__) . '/includes/theme-functions.php';
define('APP_TAX_CAT', 'ad_cat'); } if (!defined('APP_TAX_TAG')) { define('APP_TAX_TAG', 'ad_tag'); } // legacy classipress path variables $upload_dir = wp_upload_dir(); define('UPLOADS_FOLDER', trailingslashit('classipress')); define('CP_UPLOAD_DIR', trailingslashit($upload_dir['basedir']) . UPLOADS_FOLDER); define('FAVICON', get_bloginfo('template_directory') . '/images/favicon.ico'); define('THE_POSITION', 3); // define the db tables we use $app_db_tables = array($app_abbr . '_ad_fields', $app_abbr . '_ad_forms', $app_abbr . '_ad_geocodes', $app_abbr . '_ad_meta', $app_abbr . '_ad_packs', $app_abbr . '_ad_pop_daily', $app_abbr . '_ad_pop_total', $app_abbr . '_coupons', $app_abbr . '_order_info'); // register the db tables foreach ($app_db_tables as $app_db_table) { scb_register_table($app_db_table); } // execute theme actions on theme activation function cp_first_run() { if (isset($_GET['firstrun'])) { do_action('appthemes_first_run'); } } add_action('admin_notices', 'cp_first_run', 9999); // include all the core files include_once TEMPLATEPATH . '/includes/views.php'; include_once TEMPLATEPATH . '/includes/theme-hooks.php'; include_once TEMPLATEPATH . '/includes/theme-cron.php'; include_once TEMPLATEPATH . '/includes/theme-enqueue.php'; include_once TEMPLATEPATH . '/includes/appthemes-functions.php';
// Framework require_once dirname(__FILE__) . '/framework/load.php'; require_once APP_FRAMEWORK_DIR . '/includes/stats.php'; require_once APP_FRAMEWORK_DIR . '/admin/class-meta-box.php'; require_once APP_FRAMEWORK_DIR . '/includes/tables.php'; APP_Mail_From::init(); // define the transients we use $app_transients = array('cp_cat_menu'); // define the db tables we use $app_db_tables = array('cp_ad_fields', 'cp_ad_forms', 'cp_ad_geocodes', 'cp_ad_meta', 'cp_ad_packs', 'cp_ad_pop_daily', 'cp_ad_pop_total', 'cp_coupons', 'cp_order_info'); // register the db tables 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); }