@ 2013-04-10T10:42:12Z <?php
/*
Plugin Name: Smart WP Directory
Plugin URI:
Description: TODO Description
Version: 0.1
Author: hodak
Author URI: http://hodak.pl
License: TODO
*/
/* ***********
prefix used for pretty much everything: swd_
*********** */
// Cron hook for pending_payment
add_action( 'swd_pending_payment_cron_hook', 'swd_cron_for_pending_payment' );
// Cron hook for regular daily checking
add_action( 'swd_regular_cron_hook', 'swd_regular_cron' );
register_activation_hook( __FILE__, 'swd_activate' );
register_deactivation_hook( __FILE__, 'swd_deactivate' );
// custom post type and taxonomies
// I also add here regular cron
add_action( 'init', 'swd_custom_post_types_and_tax' );
// styles and scripts
add_action( 'wp_enqueue_scripts', 'swd_add_stylesheets_and_scripts' );
// cleaning needed for google maps api, it's better not to ask
add_filter( 'clean_url', 'so_handle_038', 99, 3 );
add_action( 'init', 'app_output_buffer' );
add_filter( 'login_redirect', 'swd_redirect_after_login', 10, 3 );
// pages needed for plugin - user-panel, paypal etc.
add_action( 'init', 'swd_include_pages' );
add_action( 'init', 'swd_hide_admin_bar' );
// dev todo
add_action( 'init', 'swd_todo_dev_init' );
// Hooks when publishing swd_record: adding start and end date.
add_action('new_to_publish', 'swd_run_when_published');
add_action('draft_to_publish', 'swd_run_when_published');
add_action('pending_to_publish', 'swd_run_when_published');
// Hook before deleting post - we also need to delete media
add_action( 'before_delete_post', 'swd_before_delete_post' );
// Redirecting certain templates to plugin templates
add_filter( 'page_template', 'swd_page_templates' );
add_filter( 'template_include', 'swd_templates' );
// Fix pagination
add_filter( 'pre_get_posts', 'swd_modify_archive_query' );
function swd_activate() {
// Company role with some capabilities for swd_record
/*
*** VERY IMPORTANT SECURITY NOTE ***
We also give capability 'upload_files'.
This is potentially very serious security issue - be extra cautious.
This capability is unfortunately necessary for uploading photos.
*** END OF VERY IMPORTANT SECURITY NOTE ***
*/
swd_add_company_role();
// Create User Panel Page on first activation
if( false == get_option( 'swd_general_options' ) ) {
$user_panel_id = wp_insert_post( array(
'post_type' => 'page',
'post_title' => 'User Panel',
'post_status' => 'publish',
) );
// Create main directory page for viewing
$swd_directory_page = wp_insert_post( array(
'post_type' => 'page',
'post_title' => 'Companies',
'post_status' => 'publish',
) );
// Add default settings
$default_general_options = array(
'user_panel' => $user_panel_id,
'directory_page' => $swd_directory_page,
'posts_per_page' => 10,
'excerpt_length' => 100,
'description_length' => 500,
'gmaps_api' => '',
'currency_code' => 'USD', // PayPal
);
add_option( 'swd_general_options', $default_general_options );
}
if( false == get_option( 'swd_payment_options' ) ) {
$default_payment_options = array(
'paypal_username' => '',
'paypal_password' => '',
'paypal_signature' => '',
'paypal_mode' => false,
);
add_option( 'swd_payment_options', $default_payment_options );
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.4.13 0.003 0.080 16.45 5.4.12 0.010 0.067 16.46 5.4.11 0.013 0.067 16.39 5.4.10 0.010 0.053 16.50 5.4.9 0.000 0.077 16.43 5.4.8 0.000 0.060 16.37 5.4.7 0.010 0.073 16.45 5.4.6 0.007 0.050 16.46 5.4.5 0.003 0.073 16.38 5.4.4 0.007 0.053 16.43 5.4.3 0.010 0.070 16.45 5.4.2 0.010 0.047 16.36 5.4.1 0.010 0.070 16.64 5.4.0 0.003 0.053 15.71 5.3.23 0.013 0.067 14.64 5.3.22 0.000 0.053 14.61 5.3.21 0.010 0.060 14.59 5.3.20 0.003 0.080 14.63 5.3.19 0.003 0.077 14.60 5.3.18 0.013 0.063 14.59 5.3.17 0.003 0.077 14.61 5.3.16 0.007 0.047 14.65 5.3.15 0.000 0.053 14.59 5.3.14 0.010 0.077 14.60 5.3.13 0.000 0.053 14.59 5.3.12 0.000 0.057 14.57 5.3.11 0.000 0.080 14.58 5.3.10 0.010 0.050 14.20 5.3.9 0.007 0.077 14.06 5.3.8 0.003 0.060 13.98 5.3.7 0.013 0.047 14.07 5.3.6 0.003 0.040 14.09 5.3.5 0.007 0.070 13.96 5.3.4 0.007 0.040 14.01 5.3.3 0.007 0.040 13.93 5.3.2 0.007 0.033 13.73 5.3.1 0.007 0.070 13.61 5.3.0 0.007 0.043 13.65
preferences:dark mode live preview
141.43 ms | 1386 KiB | 7 Q