<?php
-defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
+defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
// generate a unique code, allows for lenght parameter
if ( ! function_exists( 'dnxcf_get_unique_code' ) ) {
}
}
-// add button in edit pages to help include our form
-function dnxcf_show_form_button() {
- $currentScreen = get_current_screen();
- if ( $currentScreen->parent_base == 'edit' ) {
- echo '<button type="button" id="dnxcf-contact-form" class="button" onclick="dnxcf_send_code()"><span class="dashicons dashicons-testimonial"></span> ' . __( 'Add Contact Form', 'dnxcf' ) . '</button>';
- }
-}
-add_action( 'media_buttons', 'dnxcf_show_form_button', 11 );
-
-// the actual function that outputs our shortcode once the button is pressed
-function dnxcf_insert_shortcode() {
- $currentScreen = get_current_screen();
- if ( $currentScreen->parent_base != 'edit' ) {
- return;
- } ?>
-<script>
- function dnxcf_send_code() {
- //Send the shortcode to the editor
- window.send_to_editor("[dnx_contactform]");
- }
-</script>
- <?php
-}
-add_action( 'admin_footer', 'dnxcf_insert_shortcode' );
-
-
// set default options for the plugin
function dnxcf_set_options() {
$defaults = array(
// 2 = text/html
'dnxcf_content_type' => '1',
'dnxcf_privacy' => '',
- 'dnxcf_latitude' => '38.2704',
- 'dnxcf_longitude' => '16.2971',
- 'dnxcf_apikey' => '',
- 'dnxcf_gmap_message' => '',
'dnxcf_DB_VERSION' => '2',
);
return $defaults;
}
// helper function that sets the current DB Version for comparison
+/*
+ * Latest DB version: 5
+*/
function dnxcf_set_db_version() {
// Define plugin database version. This should only change when new settings are added.
if ( ! defined( 'DNXCF_CURRENT_DB_VERSION' ) ) {
- define( 'DNXCF_CURRENT_DB_VERSION', 4 );
+ define( 'DNXCF_CURRENT_DB_VERSION', 5 );
}
}
add_filter( 'wp_mail_from', 'dnxcf_update_from_email' );
}
+/*
+ * Set the content type for the email
+*/
function dnxcf_update_content_type() {
global $dnxcf_options;
$dnxcf_options = get_option( 'dnxcf_options' );