= 4.7 ) { $get_locale = get_user_locale(); } // Traditional WordPress plugin locale filter $locale = apply_filters( 'plugin_locale', $get_locale, 'contact-form-7-worldpay-addon' ); $mofile = sprintf( '%1$s-%2$s.mo', 'contact-form-7-worldpay-addon', $locale ); // Setup paths to current locale file $mofile_global = WP_LANG_DIR . '/plugins/' . basename( CF7WPA_DIR ) . '/' . $mofile; if ( file_exists( $mofile_global ) ) { // Look in global /wp-content/languages/plugin-name folder load_textdomain( 'contact-form-7-worldpay-addon', $mofile_global ); } else { // Load the default language files load_plugin_textdomain( 'contact-form-7-worldpay-addon', false, $cf7wpa_lang_dir ); } } } /** * Function to display admin notice of missing plugin. */ function action__admin_notices_deactive() { echo '
' . '

' . sprintf( /* translators: Contact Form 7 - Worldpay Extension */ __( '

Contact Form 7 is required to use %s.

', 'contact-form-7-worldpay-addon' ), 'Contact Form 7 - Worldpay Addons' ) . '

' . '
'; } function action__init() { add_rewrite_rule( '^cf7wpa-phpinfo(/(.*))?/?$', 'index.php?cf7wpa-phpinfo=$matches[2]', 'top' ); flush_rewrite_rules(); /** * Post Type: Worldpay Addons. */ global $wpdb; $labels = array( 'name' => __( 'Worldpay Addons', 'contact-form-7-worldpay-addon' ), 'singular_name' => __( 'Worldpay Addons', 'contact-form-7-worldpay-addon' ), ); $args = array( 'label' => __( 'Worldpay Addons', 'contact-form-7-worldpay-addon' ), 'labels' => $labels, 'description' => '', 'public' => false, 'publicly_queryable' => false, 'show_ui' => true, 'delete_with_user' => false, 'show_in_rest' => false, 'rest_base' => '', 'has_archive' => false, 'show_in_menu' => 'wpcf7', 'show_in_nav_menus' => false, 'exclude_from_search' => true, 'capability_type' => 'post', 'capabilities' => array( 'read' => true, 'create_posts' => false, 'publish_posts' => false, ), 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array( 'title' ), ); register_post_type( 'cf7wpa_data', $args ); $check = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name='worldpay-thank-you'"); if ($check == '') { $post = array( 'post_name' => 'worldpay-thank-you', 'post_status' => 'publish', 'post_title' => 'Thank you', 'post_type' => 'page', 'post_content' => '[worldpay-transaction-details]', 'post_date' => date('Y-m-d H:i:s'), ); $page = wp_insert_post($post, false); } } } } function CF7WPA() { return CF7WPA::instance(); } CF7WPA();