Mortgage calculator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
1.5 KiB

<?php
/**
* @package Mortgage_Calccode
* @version 1.0
*/
/*
Plugin Name: Mortgage Calccode
Description: Adds a <code>[mortgage]</code> shortcode.
Author: Alexander Yakovlev
Version: 1.0
Author URI: https://oreolek.ru/
*/
function calculator() {
$out = '';
wp_enqueue_style( 'mortgage-style', plugin_dir_url( __FILE__ ) . '/style.css' );
wp_enqueue_style( 'mortgage-font', 'https://fonts.googleapis.com/css?family=Open+Sans:300,400' );
$myfile = fopen(__DIR__.'/index.html', "r") or die("Unable to open file!");
$out = fread($myfile,filesize(__DIR__.'/index.html'));
fclose($myfile);
return $out;
}
add_shortcode('mortgage', 'calculator');
add_action( 'wp_enqueue_scripts', 'calculator_scripts' );
function calculator_scripts()
{
wp_register_script( 'tether', 'https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js',array('jquery') );
wp_enqueue_script( 'tether' );
wp_register_script( 'bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/js/bootstrap.min.js', array('jquery') );
wp_enqueue_script( 'bootstrap' );
wp_register_script( 'inputmask', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.4/jquery.inputmask.bundle.min.js', array('jquery') );
wp_enqueue_script( 'inputmask' );
wp_register_script( 'mortgage-script', plugin_dir_url( __FILE__ ) . '/custom.js', array('jquery'), '1.1.0', true );
wp_enqueue_script( 'mortgage-script' );
wp_add_inline_script(
'mortgage-script',
'window.mortgage_script = "'.plugin_dir_url( __FILE__ ).'/send.php";',
'before'
);
}