<?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 );
}
- Output for 5.4.0 - 5.4.13
- Parse error: syntax error, unexpected end of file in /in/D1TeP on line 100
Process exited with code 255. - Output for 5.3.0 - 5.3.23
- Parse error: syntax error, unexpected $end in /in/D1TeP on line 100
Process exited with code 255.
preferences:
183.4 ms | 1395 KiB | 45 Q