/** * Constructor. * * @return void */ public function __construct() { // Initialize necessary WR Library classes //Hook Meta Box WR_CF_Init_Meta_Box::hook(); //Hook Post Type WR_CF_Init_Post_Type::hook(); //Hook Assets WR_CF_Init_Assets::hook(); //register post type wordpress WR_Contactform_Helpers_Hook::register_post_type(); // Prepare admin pages if (defined('WP_ADMIN')) { add_action('admin_init', array('WR_CF_Gadget_Base', 'hook'), 100); // add languages add_action('admin_init', array(&$this, 'wr_contactform_languages')); // Register admin menu for IT Contactform Plugin WR_CF_Init_Admin_Menu::hook(); add_action('admin_menu', array('WR_Contactform_Helpers_Hook', 'wr_contactform_register_menus')); // add Filter apply assets add_filter('wr_cf_register_assets', array('WR_Contactform_Helpers_Contactform', 'apply_assets')); // add filter customize the messages add_filter('post_updated_messages', array('WR_Contactform_Helpers_Contactform', 'set_messages')); //Adding "embed form" button add_action('media_buttons', array('WR_Contactform_Helpers_Hook', 'add_form_button'), 20); add_action('restrict_manage_posts', array('WR_Contactform_Helpers_Hook', 'wr_contactform_submissions_filters')); // Load sample forms WR_Contactform_Helpers_Sample_Form::hook(); // Load necessary assets WR_Contactform_Helpers_Hook::load_assets(); } else { global $pagenow; //Hook WR Gadget Base WR_CF_Gadget_Base::hook(); //get short code add_filter('the_content', 'do_shortcode'); // add Filter apply assets add_filter('wr_cf_register_assets', array('WR_Contactform_Helpers_Contactform', 'apply_assets')); //render contactform in frontend add_shortcode('wr_contactform', array(&$this, 'contactform_to_frontend')); //get language contactform in frontend $this->wr_contactform_frontend_languages(); //set content preview add_filter('the_content', array(&$this, 'wr_contactform_front_end_preview')); } }
public static function page_supports_add_form_button() { if (!defined('RG_CURRENT_PAGE')) { define('RG_CURRENT_PAGE', basename($_SERVER['PHP_SELF'])); } $is_post_edit_page = in_array(RG_CURRENT_PAGE, array('post.php', 'page.php', 'page-new.php', 'post-new.php')); WR_CF_Init_Assets::hook(); wp_enqueue_script('jquery'); WR_CF_Init_Assets::load(array('wr-contactform-editor-plugin-css', 'wr-contactform-editor-plugin-js')); add_action('admin_footer', array(__CLASS__, 'add_mce_popup')); $display_add_form_button = apply_filters('wr_contactform_display_add_form_button', $is_post_edit_page); return $display_add_form_button; }