This commit is contained in:
Rachit Bhargava
2024-01-10 11:53:33 -05:00
parent 83d223b0df
commit 054b4fffc9
16481 changed files with 0 additions and 3473867 deletions

View File

@@ -1,16 +0,0 @@
<?php
/**
* Google Optimize page-hiding snippet
*/
function AsyncHide(){
?>
<style>.async-hide { opacity: 0 !important} </style>
<script>(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,'async-hide','dataLayer',4000,
{'GTM-MJH5WQQ':true});</script>
<?php
}

View File

@@ -1,98 +0,0 @@
.th-options-panel-details-box {
width: 300px;
background-color: #fff;
float: right;
border: 1px solid #dddddd;
}
#optionsframework {
float: left;
}
.th-options-panel-details-box h3 {
cursor: default;
background-color: #f1f1f1;
border-bottom: 1px solid #ddd;
margin: 0;
font-size: 14px;
text-transform: uppercase;
text-align: center;
line-height: 36px;
}
.heading {
padding: 10px 12px;
border: 1px solid #ddd;
background: #f1f1f1;
}
.option-panel-btn {
margin: 5px;
text-align: center;
}
.option-btn-demo {
background-color:#44c767;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
border:1px solid #44D155;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:arial;
font-size:16px;
padding: 15px 0;
width: 280px;
text-decoration:none;
}
.option-btn-demo:hover {
background-color:#5ef285;
color: #fff;
}
.option-btn-demo:active {
position:relative;
top:1px;
}
.option-btn-details {
background-color: #00ACEB;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: 1px solid #5CB6F3;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: arial;
font-size: 16px;
padding: 15px 0;
width: 280px;
text-decoration: none;
}
.option-btn-details:hover {
background-color: #5bd1fc;
color: #fff;
}
.option-btn-details:active {
position:relative;
top:1px;
}
.option-btn-documentation {
background-color:#e4685d;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
border:1px solid #ffffff;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:arial;
font-size:16px;
padding: 15px 0;
width: 280px;
text-decoration:none;
}
.option-btn-documentation:hover {
background-color:#ff8882;
color: #fff;
}
.option-btn-documentation:active {
position:relative;
top:1px;
}

View File

@@ -1,224 +0,0 @@
/* Options Framework Admin Styles */
#optionsframework {
max-width:840px;
background:#fff;
}
#optionsframework h3 {
cursor: default;
background-color: #f1f1f1;
border-bottom: 1px solid #ddd;
}
#optionsframework p {
margin-bottom:0;
padding-bottom:10px;
}
#optionsframework .section {
padding:10px 10px 0;
}
#optionsframework .group {
padding-bottom:40px;
}
#optionsframework .section .controls {
float: left;
min-width:350px;
width: 54%;
padding-right:2%;
}
#optionsframework .section .explain {
max-width:38%;
float: left;
font-size: 12px;
line-height:16px;
color: #777;
}
#optionsframework .section-checkbox .controls {
width: 98%;
}
#optionsframework .section-checkbox .explain {
max-width:94%;
}
#optionsframework .controls input[type=text] {
width:100%;
}
#optionsframework .controls input[type=text].wp-color-picker {
width: 65px;
}
#optionsframework .controls select, #optionsframework .controls textarea {
margin-bottom:10px;
width:100%;
}
#optionsframework .section-radio label, #optionsframework .section-multicheck label {
float:left;
max-width:90%;
line-height: 16px;
margin-bottom: 5px;
}
#optionsframework input.checkbox, #optionsframework input.of-radio {
margin: 0 10px 5px 0;
float:left;
clear:both;
}
#optionsframework .section-typography .controls {
float:none;
width:auto;
}
#optionsframework .section-typography .explain {
float:none;
width:auto;
}
#optionsframework .controls .of-typography-size {
width:80px;
float:left
}
#optionsframework .controls .of-typography-unit {
width:50px;
margin-left:5px;
float:left
}
#optionsframework .controls .of-typography-face {
width:100px;
margin-left:5px;
float:left
}
#optionsframework .controls .of-typography-style {
width:80px;
margin-left:5px;
margin-right:5px;
float:left
}
#optionsframework .section-typography .wp-picker-container {
margin-top:2px;
}
#optionsframework .of-background-properties {
clear:both;
margin-top: 18px;
}
#optionsframework .controls .of-background-repeat {
width:125px;
margin-right:5px;
float:left
}
#optionsframework .controls .of-background-position {
width:125px;
margin-right:5px;
float:left
}
#optionsframework .controls .of-background-attachment {
width:125px;
margin-right:5px;
float:left
}
#optionsframework .section-background .wp-picker-container {
margin-bottom:10px;
}
#optionsframework .controls .of-radio-img-img {
border:3px solid #f9f9f9;
margin:0 5px 10px 0;
display:none;
cursor:pointer;
float:left;
}
#optionsframework .controls .of-radio-img-selected {
border:3px solid #ccc
}
#optionsframework .controls .of-radio-img-img:hover {
opacity:.8;
}
#optionsframework .controls .of-border-width {
width:80px;
float:left
}
#optionsframework .controls .of-border-style {
width:120px;
float:left
}
#optionsframework .hide {
display:none;
}
#optionsframework .of-option-image {
max-width:340px;
margin:3px 0 18px 0;
}
#optionsframework .mini .controls select, #optionsframework .section .mini .controls {
width: 140px;
}
#optionsframework .mini .controls input, #optionsframework .mini .controls {
min-width:140px;
width: 140px;
}
#optionsframework .mini .explain {
max-width:74%;
}
/* Editor */
#optionsframework .section-editor .explain {
max-width: 98%;
float:none;
margin-bottom:5px;
}
/* Image Uploader */
#optionsframework .controls input.upload {
width:80%;
}
#optionsframework .screenshot {
float:left;
margin-left:1px;
position:relative;
width:344px;
margin-top:3px;
}
#optionsframework .screenshot img {
background:#fafafa;
border-color:#ccc #eee #eee #ccc;
border-style:solid;
border-width:1px;
float:left;
max-width:334px;
padding:4px;
margin-bottom:10px;
}
#optionsframework .screenshot .remove-image {
background:url("../images/ico-delete.png") no-repeat;
border:medium none;
bottom:4px;
display:block;
float:left;
height:16px;
padding:0;
position:absolute;
left:-4px;
text-indent:-9999px;
width:16px;
}
#optionsframework .screenshot .no_image .file_link {
margin-left: 20px;
}
#optionsframework .screenshot .no_image .remove-button {
bottom: 0px;
}
#optionsframework .reset-button {
float:left;
cursor:pointer;
}
/* Bottom Section */
#optionsframework-submit {
padding: 7px 10px;
border-top: 1px solid #ddd;
background-color: #f1f1f1;
}
#optionsframework .button-primary {
float:right;
}
#optionsframework .section:after {
content: "";
display: table;
}
#optionsframework .section:after {
clear: both;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 715 B

View File

@@ -1,333 +0,0 @@
<?php
/**
* @package Options_Framework
* @author Devin Price <devin@wptheming.com>
* @license GPL-2.0+
* @link http://wptheming.com
* @copyright 2010-2014 WP Theming
*/
class Options_Framework_Admin {
/**
* Page hook for the options screen
*
* @since 1.7.0
* @type string
*/
protected $options_screen = null;
/**
* Hook in the scripts and styles
*
* @since 1.7.0
*/
public function init() {
// Gets options to load
$options = & Options_Framework::_optionsframework_options();
// Checks if options are available
if ( $options ) {
// Add the options page and menu item.
add_action( 'admin_menu', array( $this, 'add_custom_options_page' ) );
// Add the required scripts and styles
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
// Settings need to be registered after admin_init
add_action( 'admin_init', array( $this, 'settings_init' ) );
// Adds options menu to the admin bar
add_action( 'wp_before_admin_bar_render', array( $this, 'optionsframework_admin_bar' ) );
}
}
/**
* Registers the settings
*
* @since 1.7.0
*/
function settings_init() {
// Load Options Framework Settings
$optionsframework_settings = get_option( 'optionsframework' );
// Registers the settings fields and callback
register_setting( 'optionsframework', $optionsframework_settings['id'], array ( $this, 'validate_options' ) );
// Displays notice after options save
add_action( 'optionsframework_after_validate', array( $this, 'save_options_notice' ) );
}
/*
* Define menu options
*
* Examples usage:
*
* add_filter( 'optionsframework_menu', function( $menu ) {
* $menu['page_title'] = 'The Options';
* $menu['menu_title'] = 'The Options';
* return $menu;
* });
*
* @since 1.7.0
*
*/
static function menu_settings() {
$menu = array(
// Modes: submenu, menu
'mode' => 'submenu',
// Submenu default settings
'page_title' => __( 'Theme Options', 'textdomain'),
'menu_title' => __('Theme Options', 'textdomain'),
'capability' => 'edit_theme_options',
'menu_slug' => 'options-framework',
'parent_slug' => 'themes.php',
// Menu default settings
'icon_url' => 'dashicons-admin-generic',
'position' => '61'
);
return apply_filters( 'optionsframework_menu', $menu );
}
/**
* Add a subpage called "Theme Options" to the appearance menu.
*
* @since 1.7.0
*/
function add_custom_options_page() {
$menu = $this->menu_settings();
$this->options_screen = add_theme_page( $menu['page_title'], $menu['menu_title'], $menu['capability'], $menu['menu_slug'], array( $this, 'options_page' ) );
}
/**
* Loads the required stylesheets
*
* @since 1.7.0
*/
function enqueue_admin_styles( $hook ) {
if ( $this->options_screen != $hook )
return;
wp_enqueue_style( 'optionsframework', OPTIONS_FRAMEWORK_DIRECTORY . 'css/optionsframework.css', array(), Options_Framework::VERSION );
wp_enqueue_style( 'wp-color-picker' );
}
/**
* Loads the required javascript
*
* @since 1.7.0
*/
function enqueue_admin_scripts( $hook ) {
if ( $this->options_screen != $hook )
return;
// Enqueue custom option panel JS
wp_enqueue_script( 'options-custom', OPTIONS_FRAMEWORK_DIRECTORY . 'js/options-custom.js', array( 'jquery','wp-color-picker' ), Options_Framework::VERSION );
// Inline scripts from options-interface.php
add_action( 'admin_head', array( $this, 'of_admin_head' ) );
}
function of_admin_head() {
// Hook to add custom scripts
do_action( 'optionsframework_custom_scripts' );
}
/**
* Builds out the options panel.
*
* If we were using the Settings API as it was intended we would use
* do_settings_sections here. But as we don't want the settings wrapped in a table,
* we'll call our own custom optionsframework_fields. See options-interface.php
* for specifics on how each individual field is generated.
*
* Nonces are provided using the settings_fields()
*
* @since 1.7.0
*/
function options_page() { ?>
<div id="optionsframework-wrap" class="wrap">
<?php $menu = $this->menu_settings(); ?>
<h2><?php echo esc_html( $menu['page_title'] ); ?></h2>
<h2 class="nav-tab-wrapper">
<?php echo Options_Framework_Interface::optionsframework_tabs(); ?>
</h2>
<?php settings_errors( 'options-framework' ); ?>
<div id="optionsframework-metabox" class="metabox-holder">
<div id="optionsframework" class="postbox">
<form action="options.php" method="post">
<?php settings_fields( 'optionsframework' ); ?>
<?php Options_Framework_Interface::optionsframework_fields(); /* Settings */ ?>
<div id="optionsframework-submit">
<input type="submit" class="button-primary" name="update" value="<?php esc_attr_e( 'Save Options', 'textdomain' ); ?>" />
<input type="submit" class="reset-button button-secondary" name="reset" value="<?php esc_attr_e( 'Restore Defaults', 'textdomain' ); ?>" onclick="return confirm( '<?php print esc_js( __( 'Click OK to reset. Any theme settings will be lost!', 'textdomain' ) ); ?>' );" />
<div class="clear"></div>
</div>
</form>
</div> <!-- / #container -->
</div>
<?php do_action( 'optionsframework_after' ); ?>
</div> <!-- / .wrap -->
<?php
}
/**
* Validate Options.
*
* This runs after the submit/reset button has been clicked and
* validates the inputs.
*
* @uses $_POST['reset'] to restore default options
*/
function validate_options( $input ) {
/*
* Restore Defaults.
*
* In the event that the user clicked the "Restore Defaults"
* button, the options defined in the theme's options.php
* file will be added to the option for the active theme.
*/
if ( isset( $_POST['reset'] ) ) {
add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'textdomain' ), 'updated fade' );
return $this->get_default_values();
}
/*
* Update Settings
*
* This used to check for $_POST['update'], but has been updated
* to be compatible with the theme customizer introduced in WordPress 3.4
*/
$clean = array();
$options = & Options_Framework::_optionsframework_options();
foreach ( $options as $option ) {
if ( ! isset( $option['id'] ) ) {
continue;
}
if ( ! isset( $option['type'] ) ) {
continue;
}
$id = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower( $option['id'] ) );
// Set checkbox to false if it wasn't sent in the $_POST
if ( 'checkbox' == $option['type'] && ! isset( $input[$id] ) ) {
$input[$id] = false;
}
// Set each item in the multicheck to false if it wasn't sent in the $_POST
if ( 'multicheck' == $option['type'] && ! isset( $input[$id] ) ) {
foreach ( $option['options'] as $key => $value ) {
$input[$id][$key] = false;
}
}
// For a value to be submitted to database it must pass through a sanitization filter
if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
$clean[$id] = apply_filters( 'of_sanitize_' . $option['type'], $input[$id], $option );
}
}
// Hook to run after validation
do_action( 'optionsframework_after_validate', $clean );
return $clean;
}
/**
* Display message when options have been saved
*/
function save_options_notice() {
add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'textdomain' ), 'updated fade' );
}
/**
* Get the default values for all the theme options
*
* Get an array of all default values as set in
* options.php. The 'id','std' and 'type' keys need
* to be defined in the configuration array. In the
* event that these keys are not present the option
* will not be included in this function's output.
*
* @return array Re-keyed options configuration array.
*
*/
function get_default_values() {
$output = array();
$config = & Options_Framework::_optionsframework_options();
foreach ( (array) $config as $option ) {
if ( ! isset( $option['id'] ) ) {
continue;
}
if ( ! isset( $option['std'] ) ) {
continue;
}
if ( ! isset( $option['type'] ) ) {
continue;
}
if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
$output[$option['id']] = apply_filters( 'of_sanitize_' . $option['type'], $option['std'], $option );
}
}
return $output;
}
/**
* Add options menu item to admin bar
*/
function optionsframework_admin_bar() {
$menu = $this->menu_settings();
global $wp_admin_bar;
if ( 'menu' == $menu['mode'] ) {
$href = admin_url( 'admin.php?page=' . $menu['menu_slug'] );
} else {
$href = admin_url( 'themes.php?page=' . $menu['menu_slug'] );
}
$args = array(
'parent' => 'appearance',
'id' => 'of_theme_options',
'title' => $menu['menu_title'],
'href' => $href
);
$wp_admin_bar->add_menu( apply_filters( 'optionsframework_admin_bar', $args ) );
}
}

View File

@@ -1,122 +0,0 @@
<?php
/**
* @package Options_Framework
* @author Devin Price <devin@wptheming.com>
* @license GPL-2.0+
* @link http://wptheming.com
* @copyright 2010-2014 WP Theming
*/
class Options_Framework {
/**
* Plugin version, used for cache-busting of style and script file references.
*
* @since 1.7.0
* @type string
*/
const VERSION = '1.8.0';
/**
* Initialize the plugin.
*
* @since 1.7.0
*/
public function init() {
// Needs to run every time in case theme has been changed
add_action( 'admin_init', array( $this, 'set_theme_option' ) );
}
/**
* Sets option defaults
*
* @since 1.7.0
*/
function set_theme_option() {
// Load settings
$optionsframework_settings = get_option( 'optionsframework' );
// Updates the unique option id in the database if it has changed
if ( function_exists( 'optionsframework_option_name' ) ) {
optionsframework_option_name();
}
elseif ( has_action( 'optionsframework_option_name' ) ) {
do_action( 'optionsframework_option_name' );
}
// If the developer hasn't explicitly set an option id, we'll use a default
else {
$default_themename = get_option( 'stylesheet' );
$default_themename = preg_replace( "/\W/", "_", strtolower($default_themename ) );
$default_themename = 'optionsframework_' . $default_themename;
if ( isset( $optionsframework_settings['id'] ) ) {
if ( $optionsframework_settings['id'] == $default_themename ) {
// All good, using default theme id
} else {
$optionsframework_settings['id'] = $default_themename;
update_option( 'optionsframework', $optionsframework_settings );
}
}
else {
$optionsframework_settings['id'] = $default_themename;
update_option( 'optionsframework', $optionsframework_settings );
}
}
}
/**
* Wrapper for optionsframework_options()
*
* Allows for manipulating or setting options via 'of_options' filter
* For example:
*
* <code>
* add_filter( 'of_options', function( $options ) {
* $options[] = array(
* 'name' => 'Input Text Mini',
* 'desc' => 'A mini text input field.',
* 'id' => 'example_text_mini',
* 'std' => 'Default',
* 'class' => 'mini',
* 'type' => 'text'
* );
*
* return $options;
* });
* </code>
*
* Also allows for setting options via a return statement in the
* options.php file. For example (in options.php):
*
* <code>
* return array(...);
* </code>
*
* @return array (by reference)
*/
static function &_optionsframework_options() {
static $options = null;
if ( !$options ) {
// Load options from options.php file (if it exists)
$location = apply_filters( 'options_framework_location', array( 'options.php' ) );
if ( $optionsfile = locate_template( $location ) ) {
$maybe_options = require_once $optionsfile;
if ( is_array( $maybe_options ) ) {
$options = $maybe_options;
} else if ( function_exists( 'optionsframework_options' ) ) {
$options = optionsframework_options();
}
}
// Allow setting/manipulating options via filters
$options = apply_filters( 'of_options', $options );
}
return $options;
}
}

View File

@@ -1,428 +0,0 @@
<?php
/**
* @package Options_Framework
* @author Devin Price <devin@wptheming.com>
* @license GPL-2.0+
* @link http://wptheming.com
* @copyright 2010-2014 WP Theming
*/
class Options_Framework_Interface {
/**
* Generates the tabs that are used in the options menu
*/
static function optionsframework_tabs() {
$counter = 0;
$options = & Options_Framework::_optionsframework_options();
$menu = '';
foreach ( $options as $value ) {
// Heading for Navigation
if ( $value['type'] == "heading" ) {
$counter++;
$class = '';
$class = ! empty( $value['id'] ) ? $value['id'] : $value['name'];
$class = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower($class) ) . '-tab';
$menu .= '<a id="options-group-'. $counter . '-tab" class="nav-tab ' . $class .'" title="' . esc_attr( $value['name'] ) . '" href="' . esc_attr( '#options-group-'. $counter ) . '">' . esc_html( $value['name'] ) . '</a>';
}
}
return $menu;
}
/**
* Generates the options fields that are used in the form.
*/
static function optionsframework_fields() {
global $allowedtags;
$optionsframework_settings = get_option( 'optionsframework' );
// Gets the unique option id
if ( isset( $optionsframework_settings['id'] ) ) {
$option_name = $optionsframework_settings['id'];
}
else {
$option_name = 'optionsframework';
};
$settings = get_option($option_name);
$options = & Options_Framework::_optionsframework_options();
$counter = 0;
$menu = '';
foreach ( $options as $value ) {
$val = '';
$select_value = '';
$output = '';
// Wrap all options
if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) ) {
// Keep all ids lowercase with no spaces
$value['id'] = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($value['id']) );
$id = 'section-' . $value['id'];
$class = 'section';
if ( isset( $value['type'] ) ) {
$class .= ' section-' . $value['type'];
}
if ( isset( $value['class'] ) ) {
$class .= ' ' . $value['class'];
}
$output .= '<div id="' . esc_attr( $id ) .'" class="' . esc_attr( $class ) . '">'."\n";
if ( isset( $value['name'] ) ) {
$output .= '<h4 class="heading">' . esc_html( $value['name'] ) . '</h4>' . "\n";
}
if ( $value['type'] != 'editor' ) {
$output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
}
else {
$output .= '<div class="option">' . "\n" . '<div>' . "\n";
}
}
// Set default value to $val
if ( isset( $value['std'] ) ) {
$val = $value['std'];
}
// If the option is already saved, override $val
if ( ( $value['type'] != 'heading' ) && ( $value['type'] != 'info') ) {
if ( isset( $settings[($value['id'])]) ) {
$val = $settings[($value['id'])];
// Striping slashes of non-array options
if ( !is_array($val) ) {
$val = stripslashes( $val );
}
}
}
// If there is a description save it for labels
$explain_value = '';
if ( isset( $value['desc'] ) ) {
$explain_value = $value['desc'];
}
// Set the placeholder if one exists
$placeholder = '';
if ( isset( $value['placeholder'] ) ) {
$placeholder = ' placeholder="' . esc_attr( $value['placeholder'] ) . '"';
}
if ( has_filter( 'optionsframework_' . $value['type'] ) ) {
$output .= apply_filters( 'optionsframework_' . $value['type'], $option_name, $value, $val );
}
switch ( $value['type'] ) {
// Basic text input
case 'text':
$output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="text" value="' . esc_attr( $val ) . '"' . $placeholder . ' />';
break;
// Password input
case 'password':
$output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="password" value="' . esc_attr( $val ) . '" />';
break;
// Textarea
case 'textarea':
$rows = '8';
if ( isset( $value['settings']['rows'] ) ) {
$custom_rows = $value['settings']['rows'];
if ( is_numeric( $custom_rows ) ) {
$rows = $custom_rows;
}
}
$val = stripslashes( $val );
$output .= '<textarea id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" rows="' . $rows . '"' . $placeholder . '>' . esc_textarea( $val ) . '</textarea>';
break;
// Select Box
case 'select':
$output .= '<select class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" id="' . esc_attr( $value['id'] ) . '">';
foreach ($value['options'] as $key => $option ) {
$output .= '<option'. selected( $val, $key, false ) .' value="' . esc_attr( $key ) . '">' . esc_html( $option ) . '</option>';
}
$output .= '</select>';
break;
// Radio Box
case "radio":
$name = $option_name .'['. $value['id'] .']';
foreach ($value['options'] as $key => $option) {
$id = $option_name . '-' . $value['id'] .'-'. $key;
$output .= '<input class="of-input of-radio" type="radio" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" value="'. esc_attr( $key ) . '" '. checked( $val, $key, false) .' /><label for="' . esc_attr( $id ) . '">' . esc_html( $option ) . '</label>';
}
break;
// Image Selectors
case "images":
$name = $option_name .'['. $value['id'] .']';
foreach ( $value['options'] as $key => $option ) {
$selected = '';
if ( $val != '' && ($val == $key) ) {
$selected = ' of-radio-img-selected';
}
$output .= '<input type="radio" id="' . esc_attr( $value['id'] .'_'. $key) . '" class="of-radio-img-radio" value="' . esc_attr( $key ) . '" name="' . esc_attr( $name ) . '" '. checked( $val, $key, false ) .' />';
$output .= '<div class="of-radio-img-label">' . esc_html( $key ) . '</div>';
$output .= '<img src="' . esc_url( $option ) . '" alt="' . $option .'" class="of-radio-img-img' . $selected .'" onclick="document.getElementById(\''. esc_attr($value['id'] .'_'. $key) .'\').checked=true;" />';
}
break;
// Checkbox
case "checkbox":
$output .= '<input id="' . esc_attr( $value['id'] ) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" '. checked( $val, 1, false) .' />';
$output .= '<label class="explain" for="' . esc_attr( $value['id'] ) . '">' . wp_kses( $explain_value, $allowedtags) . '</label>';
break;
// Multicheck
case "multicheck":
foreach ($value['options'] as $key => $option) {
$checked = '';
$label = $option;
$option = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($key));
$id = $option_name . '-' . $value['id'] . '-'. $option;
$name = $option_name . '[' . $value['id'] . '][' . $option .']';
if ( isset($val[$option]) ) {
$checked = checked($val[$option], 1, false);
}
$output .= '<input id="' . esc_attr( $id ) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr( $name ) . '" ' . $checked . ' /><label for="' . esc_attr( $id ) . '">' . esc_html( $label ) . '</label>';
}
break;
// Color picker
case "color":
$default_color = '';
if ( isset($value['std']) ) {
if ( $val != $value['std'] )
$default_color = ' data-default-color="' .$value['std'] . '" ';
}
$output .= '<input name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" id="' . esc_attr( $value['id'] ) . '" class="of-color" type="text" value="' . esc_attr( $val ) . '"' . $default_color .' />';
break;
// Uploader
case "upload":
$output .= Options_Framework_Media_Uploader::optionsframework_uploader( $value['id'], $val, null );
break;
// Typography
case 'typography':
unset( $font_size, $font_style, $font_face, $font_color );
$typography_defaults = array(
'size' => '',
'face' => '',
'style' => '',
'color' => ''
);
$typography_stored = wp_parse_args( $val, $typography_defaults );
$typography_options = array(
'sizes' => of_recognized_font_sizes(),
'faces' => of_recognized_font_faces(),
'styles' => of_recognized_font_styles(),
'color' => true
);
if ( isset( $value['options'] ) ) {
$typography_options = wp_parse_args( $value['options'], $typography_options );
}
// Font Size
if ( $typography_options['sizes'] ) {
$font_size = '<select class="of-typography of-typography-size" name="' . esc_attr( $option_name . '[' . $value['id'] . '][size]' ) . '" id="' . esc_attr( $value['id'] . '_size' ) . '">';
$sizes = $typography_options['sizes'];
foreach ( $sizes as $i ) {
$size = $i . 'px';
$font_size .= '<option value="' . esc_attr( $size ) . '" ' . selected( $typography_stored['size'], $size, false ) . '>' . esc_html( $size ) . '</option>';
}
$font_size .= '</select>';
}
// Font Face
if ( $typography_options['faces'] ) {
$font_face = '<select class="of-typography of-typography-face" name="' . esc_attr( $option_name . '[' . $value['id'] . '][face]' ) . '" id="' . esc_attr( $value['id'] . '_face' ) . '">';
$faces = $typography_options['faces'];
foreach ( $faces as $key => $face ) {
$font_face .= '<option value="' . esc_attr( $key ) . '" ' . selected( $typography_stored['face'], $key, false ) . '>' . esc_html( $face ) . '</option>';
}
$font_face .= '</select>';
}
// Font Styles
if ( $typography_options['styles'] ) {
$font_style = '<select class="of-typography of-typography-style" name="'.$option_name.'['.$value['id'].'][style]" id="'. $value['id'].'_style">';
$styles = $typography_options['styles'];
foreach ( $styles as $key => $style ) {
$font_style .= '<option value="' . esc_attr( $key ) . '" ' . selected( $typography_stored['style'], $key, false ) . '>'. $style .'</option>';
}
$font_style .= '</select>';
}
// Font Color
if ( $typography_options['color'] ) {
$default_color = '';
if ( isset($value['std']['color']) ) {
if ( $val != $value['std']['color'] )
$default_color = ' data-default-color="' .$value['std']['color'] . '" ';
}
$font_color = '<input name="' . esc_attr( $option_name . '[' . $value['id'] . '][color]' ) . '" id="' . esc_attr( $value['id'] . '_color' ) . '" class="of-color of-typography-color type="text" value="' . esc_attr( $typography_stored['color'] ) . '"' . $default_color .' />';
}
// Allow modification/injection of typography fields
$typography_fields = compact( 'font_size', 'font_face', 'font_style', 'font_color' );
$typography_fields = apply_filters( 'of_typography_fields', $typography_fields, $typography_stored, $option_name, $value );
$output .= implode( '', $typography_fields );
break;
// Background
case 'background':
$background = $val;
// Background Color
$default_color = '';
if ( isset( $value['std']['color'] ) ) {
if ( $val != $value['std']['color'] )
$default_color = ' data-default-color="' .$value['std']['color'] . '" ';
}
$output .= '<input name="' . esc_attr( $option_name . '[' . $value['id'] . '][color]' ) . '" id="' . esc_attr( $value['id'] . '_color' ) . '" class="of-color of-background-color" type="text" value="' . esc_attr( $background['color'] ) . '"' . $default_color .' />';
// Background Image
if ( !isset($background['image']) ) {
$background['image'] = '';
}
$output .= Options_Framework_Media_Uploader::optionsframework_uploader( $value['id'], $background['image'], null, esc_attr( $option_name . '[' . $value['id'] . '][image]' ) );
$class = 'of-background-properties';
if ( '' == $background['image'] ) {
$class .= ' hide';
}
$output .= '<div class="' . esc_attr( $class ) . '">';
// Background Repeat
$output .= '<select class="of-background of-background-repeat" name="' . esc_attr( $option_name . '[' . $value['id'] . '][repeat]' ) . '" id="' . esc_attr( $value['id'] . '_repeat' ) . '">';
$repeats = of_recognized_background_repeat();
foreach ($repeats as $key => $repeat) {
$output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['repeat'], $key, false ) . '>'. esc_html( $repeat ) . '</option>';
}
$output .= '</select>';
// Background Position
$output .= '<select class="of-background of-background-position" name="' . esc_attr( $option_name . '[' . $value['id'] . '][position]' ) . '" id="' . esc_attr( $value['id'] . '_position' ) . '">';
$positions = of_recognized_background_position();
foreach ($positions as $key=>$position) {
$output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['position'], $key, false ) . '>'. esc_html( $position ) . '</option>';
}
$output .= '</select>';
// Background Attachment
$output .= '<select class="of-background of-background-attachment" name="' . esc_attr( $option_name . '[' . $value['id'] . '][attachment]' ) . '" id="' . esc_attr( $value['id'] . '_attachment' ) . '">';
$attachments = of_recognized_background_attachment();
foreach ($attachments as $key => $attachment) {
$output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $background['attachment'], $key, false ) . '>' . esc_html( $attachment ) . '</option>';
}
$output .= '</select>';
$output .= '</div>';
break;
// Editor
case 'editor':
$output .= '<div class="explain">' . wp_kses( $explain_value, $allowedtags ) . '</div>'."\n";
echo $output;
$textarea_name = esc_attr( $option_name . '[' . $value['id'] . ']' );
$default_editor_settings = array(
'textarea_name' => $textarea_name,
'media_buttons' => false,
'tinymce' => array( 'plugins' => 'wordpress' )
);
$editor_settings = array();
if ( isset( $value['settings'] ) ) {
$editor_settings = $value['settings'];
}
$editor_settings = array_merge( $default_editor_settings, $editor_settings );
wp_editor( $val, $value['id'], $editor_settings );
$output = '';
break;
// Info
case "info":
$id = '';
$class = 'section';
if ( isset( $value['id'] ) ) {
$id = 'id="' . esc_attr( $value['id'] ) . '" ';
}
if ( isset( $value['type'] ) ) {
$class .= ' section-' . $value['type'];
}
if ( isset( $value['class'] ) ) {
$class .= ' ' . $value['class'];
}
$output .= '<div ' . $id . 'class="' . esc_attr( $class ) . '">' . "\n";
if ( isset($value['name']) ) {
$output .= '<h4 class="heading">' . esc_html( $value['name'] ) . '</h4>' . "\n";
}
if ( isset( $value['desc'] ) ) {
$output .= apply_filters('of_sanitize_info', $value['desc'] ) . "\n";
}
$output .= '</div>' . "\n";
break;
// Heading for Navigation
case "heading":
$counter++;
if ( $counter >= 2 ) {
$output .= '</div>'."\n";
}
$class = '';
$class = ! empty( $value['id'] ) ? $value['id'] : $value['name'];
$class = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($class) );
$output .= '<div id="options-group-' . $counter . '" class="group ' . $class . '">';
$output .= '<h3>' . esc_html( $value['name'] ) . '</h3>' . "\n";
break;
}
if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) ) {
$output .= '</div>';
if ( ( $value['type'] != "checkbox" ) && ( $value['type'] != "editor" ) ) {
$output .= '<div class="explain">' . wp_kses( $explain_value, $allowedtags) . '</div>'."\n";
}
$output .= '</div></div>'."\n";
}
echo $output;
}
// Outputs closing div if there tabs
if ( Options_Framework_Interface::optionsframework_tabs() != '' ) {
echo '</div>';
}
}
}

View File

@@ -1,123 +0,0 @@
<?php
/**
* @package Options_Framework
* @author Devin Price <devin@wptheming.com>
* @license GPL-2.0+
* @link http://wptheming.com
* @copyright 2010-2014 WP Theming
*/
class Options_Framework_Media_Uploader {
/**
* Initialize the media uploader class
*
* @since 1.7.0
*/
public function init() {
add_action( 'admin_enqueue_scripts', array( $this, 'optionsframework_media_scripts' ) );
}
/**
* Media Uploader Using the WordPress Media Library.
*
* Parameters:
*
* string $_id - A token to identify this field (the name).
* string $_value - The value of the field, if present.
* string $_desc - An optional description of the field.
*
*/
static function optionsframework_uploader( $_id, $_value, $_desc = '', $_name = '' ) {
$optionsframework_settings = get_option( 'optionsframework' );
// Gets the unique option id
$option_name = $optionsframework_settings['id'];
$output = '';
$id = '';
$class = '';
$int = '';
$value = '';
$name = '';
$id = strip_tags( strtolower( $_id ) );
// If a value is passed and we don't have a stored value, use the value that's passed through.
if ( $_value != '' && $value == '' ) {
$value = $_value;
}
if ($_name != '') {
$name = $_name;
}
else {
$name = $option_name.'['.$id.']';
}
if ( $value ) {
$class = ' has-file';
}
$output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="'.$name.'" value="' . $value . '" placeholder="' . __('No file chosen', 'textdomain') .'" />' . "\n";
if ( function_exists( 'wp_enqueue_media' ) ) {
if ( ( $value == '' ) ) {
$output .= '<input id="upload-' . $id . '" class="upload-button button" type="button" value="' . __( 'Upload', 'textdomain' ) . '" />' . "\n";
} else {
$output .= '<input id="remove-' . $id . '" class="remove-file button" type="button" value="' . __( 'Remove', 'textdomain' ) . '" />' . "\n";
}
} else {
$output .= '<p><i>' . __( 'Upgrade your version of WordPress for full media support.', 'textdomain' ) . '</i></p>';
}
if ( $_desc != '' ) {
$output .= '<span class="of-metabox-desc">' . $_desc . '</span>' . "\n";
}
$output .= '<div class="screenshot" id="' . $id . '-image">' . "\n";
if ( $value != '' ) {
$remove = '<a class="remove-image">Remove</a>';
$image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $value );
if ( $image ) {
$output .= '<img src="' . $value . '" alt="" />' . $remove;
} else {
$parts = explode( "/", $value );
for( $i = 0; $i < sizeof( $parts ); ++$i ) {
$title = $parts[$i];
}
// No output preview if it's not an image.
$output .= '';
// Standard generic output if it's not an image.
$title = __( 'View File', 'textdomain' );
$output .= '<div class="no-image"><span class="file_link"><a href="' . $value . '" target="_blank" rel="external">'.$title.'</a></span></div>';
}
}
$output .= '</div>' . "\n";
return $output;
}
/**
* Enqueue scripts for file uploader
*/
function optionsframework_media_scripts( $hook ) {
$menu = Options_Framework_Admin::menu_settings();
if ( substr( $hook, -strlen( $menu['menu_slug'] ) ) !== $menu['menu_slug'] )
return;
if ( function_exists( 'wp_enqueue_media' ) )
wp_enqueue_media();
wp_register_script( 'of-media-uploader', OPTIONS_FRAMEWORK_DIRECTORY .'js/media-uploader.js', array( 'jquery' ), Options_Framework::VERSION );
wp_enqueue_script( 'of-media-uploader' );
wp_localize_script( 'of-media-uploader', 'optionsframework_l10n', array(
'upload' => __( 'Upload', 'textdomain' ),
'remove' => __( 'Remove', 'textdomain' )
) );
}
}

View File

@@ -1,385 +0,0 @@
<?php
/**
* @package Options_Framework
* @author Devin Price <devin@wptheming.com>
* @license GPL-2.0+
* @link http://wptheming.com
* @copyright 2010-2014 WP Theming
*/
/* Text */
add_filter( 'of_sanitize_text', 'sanitize_text_field' );
/* Password */
add_filter( 'of_sanitize_password', 'sanitize_text_field' );
/* Textarea */
function of_sanitize_textarea( $input) {
global $allowedposttags;
$output = wp_kses( $input, $allowedposttags);
return $output;
}
add_filter( 'of_sanitize_textarea', 'of_sanitize_textarea' );
/* Select */
add_filter( 'of_sanitize_select', 'of_sanitize_enum', 10, 2 );
/* Radio */
add_filter( 'of_sanitize_radio', 'of_sanitize_enum', 10, 2 );
/* Images */
add_filter( 'of_sanitize_images', 'of_sanitize_enum', 10, 2 );
/* Checkbox */
function of_sanitize_checkbox( $input ) {
if ( $input ) {
$output = '1';
} else {
$output = false;
}
return $output;
}
add_filter( 'of_sanitize_checkbox', 'of_sanitize_checkbox' );
/* Multicheck */
function of_sanitize_multicheck( $input, $option ) {
$output = '';
if ( is_array( $input ) ) {
foreach( $option['options'] as $key => $value ) {
$output[$key] = false;
}
foreach( $input as $key => $value ) {
if ( array_key_exists( $key, $option['options'] ) && $value ) {
$output[$key] = "1";
}
}
}
return $output;
}
add_filter( 'of_sanitize_multicheck', 'of_sanitize_multicheck', 10, 2 );
/* Color Picker */
add_filter( 'of_sanitize_color', 'of_sanitize_hex' );
/* Uploader */
function of_sanitize_upload( $input ) {
$output = '';
$filetype = wp_check_filetype( $input );
if ( $filetype["ext"] ) {
$output = esc_url( $input );
}
return $output;
}
add_filter( 'of_sanitize_upload', 'of_sanitize_upload' );
/* Editor */
function of_sanitize_editor( $input ) {
if ( current_user_can( 'unfiltered_html' ) ) {
$output = $input;
}
else {
global $allowedtags;
$output = wpautop(wp_kses( $input, $allowedtags));
}
return $output;
}
add_filter( 'of_sanitize_editor', 'of_sanitize_editor' );
/* Allowed Tags */
function of_sanitize_allowedtags( $input ) {
global $allowedtags;
$output = wpautop( wp_kses( $input, $allowedtags ) );
return $output;
}
/* Allowed Post Tags */
function of_sanitize_allowedposttags( $input ) {
global $allowedposttags;
$output = wpautop( wp_kses( $input, $allowedposttags) );
return $output;
}
add_filter( 'of_sanitize_info', 'of_sanitize_allowedposttags' );
/* Check that the key value sent is valid */
function of_sanitize_enum( $input, $option ) {
$output = '';
if ( array_key_exists( $input, $option['options'] ) ) {
$output = $input;
}
return $output;
}
/* Background */
function of_sanitize_background( $input ) {
$output = wp_parse_args( $input, array(
'color' => '',
'image' => '',
'repeat' => 'repeat',
'position' => 'top center',
'attachment' => 'scroll'
) );
$output['color'] = apply_filters( 'of_sanitize_hex', $input['color'] );
$output['image'] = apply_filters( 'of_sanitize_upload', $input['image'] );
$output['repeat'] = apply_filters( 'of_background_repeat', $input['repeat'] );
$output['position'] = apply_filters( 'of_background_position', $input['position'] );
$output['attachment'] = apply_filters( 'of_background_attachment', $input['attachment'] );
return $output;
}
add_filter( 'of_sanitize_background', 'of_sanitize_background' );
function of_sanitize_background_repeat( $value ) {
$recognized = of_recognized_background_repeat();
if ( array_key_exists( $value, $recognized ) ) {
return $value;
}
return apply_filters( 'of_default_background_repeat', current( $recognized ) );
}
add_filter( 'of_background_repeat', 'of_sanitize_background_repeat' );
function of_sanitize_background_position( $value ) {
$recognized = of_recognized_background_position();
if ( array_key_exists( $value, $recognized ) ) {
return $value;
}
return apply_filters( 'of_default_background_position', current( $recognized ) );
}
add_filter( 'of_background_position', 'of_sanitize_background_position' );
function of_sanitize_background_attachment( $value ) {
$recognized = of_recognized_background_attachment();
if ( array_key_exists( $value, $recognized ) ) {
return $value;
}
return apply_filters( 'of_default_background_attachment', current( $recognized ) );
}
add_filter( 'of_background_attachment', 'of_sanitize_background_attachment' );
/* Typography */
function of_sanitize_typography( $input, $option ) {
$output = wp_parse_args( $input, array(
'size' => '',
'face' => '',
'style' => '',
'color' => ''
) );
if ( isset( $option['options']['faces'] ) && isset( $input['face'] ) ) {
if ( !( array_key_exists( $input['face'], $option['options']['faces'] ) ) ) {
$output['face'] = '';
}
}
else {
$output['face'] = apply_filters( 'of_font_face', $output['face'] );
}
$output['size'] = apply_filters( 'of_font_size', $output['size'] );
$output['style'] = apply_filters( 'of_font_style', $output['style'] );
$output['color'] = apply_filters( 'of_sanitize_color', $output['color'] );
return $output;
}
add_filter( 'of_sanitize_typography', 'of_sanitize_typography', 10, 2 );
function of_sanitize_font_size( $value ) {
$recognized = of_recognized_font_sizes();
$value_check = preg_replace('/px/','', $value);
if ( in_array( (int) $value_check, $recognized ) ) {
return $value;
}
return apply_filters( 'of_default_font_size', $recognized );
}
add_filter( 'of_font_size', 'of_sanitize_font_size' );
function of_sanitize_font_style( $value ) {
$recognized = of_recognized_font_styles();
if ( array_key_exists( $value, $recognized ) ) {
return $value;
}
return apply_filters( 'of_default_font_style', current( $recognized ) );
}
add_filter( 'of_font_style', 'of_sanitize_font_style' );
function of_sanitize_font_face( $value ) {
$recognized = of_recognized_font_faces();
if ( array_key_exists( $value, $recognized ) ) {
return $value;
}
return apply_filters( 'of_default_font_face', current( $recognized ) );
}
add_filter( 'of_font_face', 'of_sanitize_font_face' );
/**
* Get recognized background repeat settings
*
* @return array
*
*/
function of_recognized_background_repeat() {
$default = array(
'no-repeat' => __( 'No Repeat', 'textdomain' ),
'repeat-x' => __( 'Repeat Horizontally', 'textdomain' ),
'repeat-y' => __( 'Repeat Vertically', 'textdomain' ),
'repeat' => __( 'Repeat All', 'textdomain' ),
);
return apply_filters( 'of_recognized_background_repeat', $default );
}
/**
* Get recognized background positions
*
* @return array
*
*/
function of_recognized_background_position() {
$default = array(
'top left' => __( 'Top Left', 'textdomain' ),
'top center' => __( 'Top Center', 'textdomain' ),
'top right' => __( 'Top Right', 'textdomain' ),
'center left' => __( 'Middle Left', 'textdomain' ),
'center center' => __( 'Middle Center', 'textdomain' ),
'center right' => __( 'Middle Right', 'textdomain' ),
'bottom left' => __( 'Bottom Left', 'textdomain' ),
'bottom center' => __( 'Bottom Center', 'textdomain' ),
'bottom right' => __( 'Bottom Right', 'textdomain')
);
return apply_filters( 'of_recognized_background_position', $default );
}
/**
* Get recognized background attachment
*
* @return array
*
*/
function of_recognized_background_attachment() {
$default = array(
'scroll' => __( 'Scroll Normally', 'textdomain' ),
'fixed' => __( 'Fixed in Place', 'textdomain')
);
return apply_filters( 'of_recognized_background_attachment', $default );
}
/**
* Sanitize a color represented in hexidecimal notation.
*
* @param string Color in hexidecimal notation. "#" may or may not be prepended to the string.
* @param string The value that this function should return if it cannot be recognized as a color.
* @return string
*
*/
function of_sanitize_hex( $hex, $default = '' ) {
if ( of_validate_hex( $hex ) ) {
return $hex;
}
return $default;
}
/**
* Get recognized font sizes.
*
* Returns an indexed array of all recognized font sizes.
* Values are integers and represent a range of sizes from
* smallest to largest.
*
* @return array
*/
function of_recognized_font_sizes() {
$sizes = range( 9, 71 );
$sizes = apply_filters( 'of_recognized_font_sizes', $sizes );
$sizes = array_map( 'absint', $sizes );
return $sizes;
}
/**
* Get recognized font faces.
*
* Returns an array of all recognized font faces.
* Keys are intended to be stored in the database
* while values are ready for display in in html.
*
* @return array
*
*/
function of_recognized_font_faces() {
$default = array(
'arial' => 'Arial',
'verdana' => 'Verdana, Geneva',
'trebuchet' => 'Trebuchet',
'georgia' => 'Georgia',
'times' => 'Times New Roman',
'tahoma' => 'Tahoma, Geneva',
'palatino' => 'Palatino',
'helvetica' => 'Helvetica*'
);
return apply_filters( 'of_recognized_font_faces', $default );
}
/**
* Get recognized font styles.
*
* Returns an array of all recognized font styles.
* Keys are intended to be stored in the database
* while values are ready for display in in html.
*
* @return array
*
*/
function of_recognized_font_styles() {
$default = array(
'normal' => __( 'Normal', 'textdomain' ),
'italic' => __( 'Italic', 'textdomain' ),
'bold' => __( 'Bold', 'textdomain' ),
'bold italic' => __( 'Bold Italic', 'textdomain' )
);
return apply_filters( 'of_recognized_font_styles', $default );
}
/**
* Is a given string a color formatted in hexidecimal notation?
*
* @param string Color in hexidecimal notation. "#" may or may not be prepended to the string.
* @return bool
*
*/
function of_validate_hex( $hex ) {
$hex = trim( $hex );
/* Strip recognized prefixes. */
if ( 0 === strpos( $hex, '#' ) ) {
$hex = substr( $hex, 1 );
}
elseif ( 0 === strpos( $hex, '%23' ) ) {
$hex = substr( $hex, 3 );
}
/* Regex match. */
if ( 0 === preg_match( '/^[0-9a-fA-F]{6}$/', $hex ) ) {
return false;
}
else {
return true;
}
}

View File

@@ -1,79 +0,0 @@
jQuery(document).ready(function($){
var optionsframework_upload;
var optionsframework_selector;
function optionsframework_add_file(event, selector) {
var upload = $(".uploaded-file"), frame;
var $el = $(this);
optionsframework_selector = selector;
event.preventDefault();
// If the media frame already exists, reopen it.
if ( optionsframework_upload ) {
optionsframework_upload.open();
} else {
// Create the media frame.
optionsframework_upload = wp.media.frames.optionsframework_upload = wp.media({
// Set the title of the modal.
title: $el.data('choose'),
// Customize the submit button.
button: {
// Set the text of the button.
text: $el.data('update'),
// Tell the button not to close the modal, since we're
// going to refresh the page when the image is selected.
close: false
}
});
// When an image is selected, run a callback.
optionsframework_upload.on( 'select', function() {
// Grab the selected attachment.
var attachment = optionsframework_upload.state().get('selection').first();
optionsframework_upload.close();
optionsframework_selector.find('.upload').val(attachment.attributes.url);
if ( attachment.attributes.type == 'image' ) {
optionsframework_selector.find('.screenshot').empty().hide().append('<img src="' + attachment.attributes.url + '"><a class="remove-image">Remove</a>').slideDown('fast');
}
optionsframework_selector.find('.upload-button').unbind().addClass('remove-file').removeClass('upload-button').val(optionsframework_l10n.remove);
optionsframework_selector.find('.of-background-properties').slideDown();
optionsframework_selector.find('.remove-image, .remove-file').on('click', function() {
optionsframework_remove_file( $(this).parents('.section') );
});
});
}
// Finally, open the modal.
optionsframework_upload.open();
}
function optionsframework_remove_file(selector) {
selector.find('.remove-image').hide();
selector.find('.upload').val('');
selector.find('.of-background-properties').hide();
selector.find('.screenshot').slideUp();
selector.find('.remove-file').unbind().addClass('upload-button').removeClass('remove-file').val(optionsframework_l10n.upload);
// We don't display the upload button if .upload-notice is present
// This means the user doesn't have the WordPress 3.5 Media Library Support
if ( $('.section-upload .upload-notice').length > 0 ) {
$('.upload-button').remove();
}
selector.find('.upload-button').on('click', function(event) {
optionsframework_add_file(event, $(this).parents('.section'));
});
}
$('.remove-image, .remove-file').on('click', function() {
optionsframework_remove_file( $(this).parents('.section') );
});
$('.upload-button').click( function( event ) {
optionsframework_add_file(event, $(this).parents('.section'));
});
});

View File

@@ -1,71 +0,0 @@
/**
* Custom scripts needed for the colorpicker, image button selectors,
* and navigation tabs.
*/
jQuery(document).ready(function($) {
// Loads the color pickers
$('.of-color').wpColorPicker();
// Image Options
$('.of-radio-img-img').click(function(){
$(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected');
$(this).addClass('of-radio-img-selected');
});
$('.of-radio-img-label').hide();
$('.of-radio-img-img').show();
$('.of-radio-img-radio').hide();
// Loads tabbed sections if they exist
if ( $('.nav-tab-wrapper').length > 0 ) {
options_framework_tabs();
}
function options_framework_tabs() {
var $group = $('.group'),
$navtabs = $('.nav-tab-wrapper a'),
active_tab = '';
// Hides all the .group sections to start
$group.hide();
// Find if a selected tab is saved in localStorage
if ( typeof(localStorage) != 'undefined' ) {
active_tab = localStorage.getItem('active_tab');
}
// If active tab is saved and exists, load it's .group
if ( active_tab != '' && $(active_tab).length ) {
$(active_tab).fadeIn();
$(active_tab + '-tab').addClass('nav-tab-active');
} else {
$('.group:first').fadeIn();
$('.nav-tab-wrapper a:first').addClass('nav-tab-active');
}
// Bind tabs clicks
$navtabs.click(function(e) {
e.preventDefault();
// Remove active class from all tabs
$navtabs.removeClass('nav-tab-active');
$(this).addClass('nav-tab-active').blur();
if (typeof(localStorage) != 'undefined' ) {
localStorage.setItem('active_tab', $(this).attr('href') );
}
var selected = $(this).attr('href');
$group.hide();
$(selected).fadeIn();
});
}
});

View File

@@ -1,96 +0,0 @@
<?php
/**
* Options Framework
*
* @package Options Framework
* @author Devin Price <devin@wptheming.com>
* @license GPL-2.0+
* @link http://wptheming.com
* @copyright 2010-2014 WP Theming
*
* @wordpress-plugin
* Plugin Name: Options Framework
* Plugin URI: http://wptheming.com
* Description: A framework for building theme options.
* Version: 1.8.0
* Author: Devin Price
* Author URI: http://wptheming.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: optionsframework
* Domain Path: /languages
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// Don't load if optionsframework_init is already defined
if (is_admin() && ! function_exists( 'optionsframework_init' ) ) :
function optionsframework_init() {
// If user can't edit theme options, exit
if ( ! current_user_can( 'edit_theme_options' ) )
return;
// Loads the required Options Framework classes.
require plugin_dir_path( __FILE__ ) . 'includes/class-options-framework.php';
require plugin_dir_path( __FILE__ ) . 'includes/class-options-framework-admin.php';
require plugin_dir_path( __FILE__ ) . 'includes/class-options-interface.php';
require plugin_dir_path( __FILE__ ) . 'includes/class-options-media-uploader.php';
require plugin_dir_path( __FILE__ ) . 'includes/class-options-sanitization.php';
// Instantiate the main plugin class.
$options_framework = new Options_Framework;
$options_framework->init();
// Instantiate the options page.
$options_framework_admin = new Options_Framework_Admin;
$options_framework_admin->init();
// Instantiate the media uploader class
$options_framework_media_uploader = new Options_Framework_Media_Uploader;
$options_framework_media_uploader->init();
}
add_action( 'init', 'optionsframework_init', 20 );
endif;
/**
* Helper function to return the theme option value.
* If no value has been saved, it returns $default.
* Needed because options are saved as serialized strings.
*
* Not in a class to support backwards compatibility in themes.
*/
if ( ! function_exists( 'of_get_option' ) ) :
function of_get_option( $name, $default = false ) {
$phoneNumber = get_option('cta_tel',true);
if($name==="thbusiness_telephone_num" && isset($phoneNumber)){
return $phoneNumber;
}
$config = get_option( 'optionsframework' );
if ( ! isset( $config['id'] ) ) {
return $default;
}
$options = get_option( $config['id'] );
if ( isset( $options[$name] ) ) {
return $options[$name];
}
return $default;
}
endif;

View File

@@ -1,90 +0,0 @@
<?php
/**
* Options Framework
*
* @package Options Framework
* @author Devin Price <devin@wptheming.com>
* @license GPL-2.0+
* @link http://wptheming.com
* @copyright 2010-2014 WP Theming
*
* @wordpress-plugin
* Plugin Name: Options Framework
* Plugin URI: http://wptheming.com
* Description: A framework for building theme options.
* Version: 1.8.0
* Author: Devin Price
* Author URI: http://wptheming.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: optionsframework
* Domain Path: /languages
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// Don't load if optionsframework_init is already defined
if (is_admin() && ! function_exists( 'optionsframework_init' ) ) :
function optionsframework_init() {
// If user can't edit theme options, exit
if ( ! current_user_can( 'edit_theme_options' ) )
return;
// Loads the required Options Framework classes.
require plugin_dir_path( __FILE__ ) . 'includes/class-options-framework.php';
require plugin_dir_path( __FILE__ ) . 'includes/class-options-framework-admin.php';
require plugin_dir_path( __FILE__ ) . 'includes/class-options-interface.php';
require plugin_dir_path( __FILE__ ) . 'includes/class-options-media-uploader.php';
require plugin_dir_path( __FILE__ ) . 'includes/class-options-sanitization.php';
// Instantiate the main plugin class.
$options_framework = new Options_Framework;
$options_framework->init();
// Instantiate the options page.
$options_framework_admin = new Options_Framework_Admin;
$options_framework_admin->init();
// Instantiate the media uploader class
$options_framework_media_uploader = new Options_Framework_Media_Uploader;
$options_framework_media_uploader->init();
}
add_action( 'init', 'optionsframework_init', 20 );
endif;
/**
* Helper function to return the theme option value.
* If no value has been saved, it returns $default.
* Needed because options are saved as serialized strings.
*
* Not in a class to support backwards compatibility in themes.
*/
if ( ! function_exists( 'of_get_option' ) ) :
function of_get_option( $name, $default = false ) {
$config = get_option( 'optionsframework' );
if ( ! isset( $config['id'] ) ) {
return $default;
}
$options = get_option( $config['id'] );
if ( isset( $options[$name] ) ) {
return $options[$name];
}
return $default;
}
endif;

View File

@@ -1,60 +0,0 @@
<?php
function CookieData() { ?>
<script type="text/javascript">
jQuery(document).ready(function(){
function setCookie(name, value, days){
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
var expires = "; expires=" + date.toGMTString();
document.cookie = name + "=" + value + expires;
}
function getParam(p){
var match = RegExp('[?&]' + p + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
var gclid = getParam('gclid');
var CustomField1 = getParam('CustomField1');
var CustomField2 = getParam('CustomField2');
var CustomField3 = getParam('CustomField3');
var CustomField4 = getParam('CustomField4');
var cid = getParam('cid');
if(gclid){
var gclsrc = getParam('gclsrc');
if(!gclsrc || gclsrc.indexOf('aw') !== -1){
setCookie('gclid', gclid, 90);
}
}
function readCookie(name) {
var match = document.cookie.match(new RegExp(name + '=([^;]+)'));
if (match) {
return match[1];
}
return undefined;
}
jQuery('input[name="gclid_data"]').val(readCookie('gclid'));
jQuery('input[name="CustomField1"]').val(readCookie('CustomField1'));
jQuery('input[name="CustomField2"]').val(readCookie('CustomField2'));
jQuery('input[name="CustomField3"]').val(readCookie('CustomField3'));
jQuery('input[name="CustomField4"]').val(readCookie('CustomField4'));
jQuery('input[name="cid"]').val(readCookie('cid'));
});
</script>
<?php
}

View File

@@ -1,125 +0,0 @@
<?php
/**
* Sample implementation of the Custom Header feature
* http://codex.wordpress.org/Custom_Headers
*
* You can add an optional custom header image to header.php like so ...
*
* @package thbusiness
*/
/**
* Setup the WordPress core custom header feature.
*
* @uses thbusiness_header_style()
* @uses thbusiness_admin_header_style()
* @uses thbusiness_admin_header_image()
*/
function thbusiness_custom_header_setup() {
add_theme_support( 'custom-header', apply_filters( 'thbusiness_custom_header_args', array(
'default-image' => '',
'default-text-color' => '888888',
'width' => 1500,
'height' => 300,
'flex-height' => true,
'wp-head-callback' => 'thbusiness_header_style',
'admin-head-callback' => 'thbusiness_admin_header_style',
'admin-preview-callback' => 'thbusiness_admin_header_image',
) ) );
}
add_action( 'after_setup_theme', 'thbusiness_custom_header_setup' );
if ( ! function_exists( 'thbusiness_header_style' ) ) :
/**
* Styles the header image and text displayed on the blog
*
* @see thbusiness_custom_header_setup().
*/
function thbusiness_header_style() {
$header_text_color = get_header_textcolor();
// If no custom options for text are set, let's bail
// get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value
if ( HEADER_TEXTCOLOR == $header_text_color ) {
return;
}
// If we get this far, we have custom styles. Let's do this.
?>
<style type="text/css">
<?php
// Has the text been hidden?
if ( 'blank' == $header_text_color ) :
?>
.site-title,
.site-description {
position: absolute;
clip: rect(1px, 1px, 1px, 1px);
}
<?php
// If the user has set a custom color for the text use that
else :
?>
.site-title a,
.site-description {
color: #<?php echo $header_text_color; ?>;
}
<?php endif; ?>
</style>
<?php
}
endif; // thbusiness_header_style
if ( ! function_exists( 'thbusiness_admin_header_style' ) ) :
/**
* Styles the header image displayed on the Appearance > Header admin panel.
*
* @see thbusiness_custom_header_setup().
*/
function thbusiness_admin_header_style() {
?>
<style type="text/css">
.appearance_page_custom-header #headimg {
border: none;
}
#headimg h1,
#desc {
font-family: 'Open Sans', 'Lucida Grande', sans-serif;}
#headimg h1 {
margin: 15px 0 0 0;
}
#headimg h1 a {
font-size: 36px;
font-weight: bold;
text-decoration: none;
}
#desc {
font-size: 12px;
margin: 5px 0 10px 0;
}
#headimg img {
}
</style>
<?php
}
endif; // thbusiness_admin_header_style
if ( ! function_exists( 'thbusiness_admin_header_image' ) ) :
/**
* Custom header image markup displayed on the Appearance > Header admin panel.
*
* @see thbusiness_custom_header_setup().
*/
function thbusiness_admin_header_image() {
$style = sprintf( ' style="color:#%s;"', get_header_textcolor() );
?>
<div id="headimg">
<h1 class="displaying-header-text"><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
<div class="displaying-header-text" id="desc"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
<?php if ( get_header_image() ) : ?>
<img src="<?php header_image(); ?>" alt="<?php bloginfo( 'name' ); ?>" >
<?php endif; ?>
</div>
<?php
}
endif; // thbusiness_admin_header_image

View File

@@ -1,149 +0,0 @@
<?php
/**
* thbusiness Theme Customizer
*
* @package thbusiness
*/
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function thbusiness_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->add_setting (
'thbusiness_main_color',
array(
'default' => '#eb5937',
'transport' => 'refresh'
)
);
$wp_customize->add_control (
new WP_Customize_Color_Control (
$wp_customize,
'thbusiness_main_color',
array (
'label' => 'Site Main Color',
'section' => 'colors',
'settings' => 'thbusiness_main_color'
)
)
);
}
add_action( 'customize_register', 'thbusiness_customize_register' );
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function thbusiness_customize_preview_js() {
wp_enqueue_script( 'thbusiness_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true );
}
add_action( 'customize_preview_init', 'thbusiness_customize_preview_js' );
/**
* Writes out the CSS as defined by the values in the Theme Customizer
* to the `head` element of the header template.
*
* @package thbusiness
*/
function thbusiness_customize_css() {
$color = get_theme_mod( 'thbusiness_main_color' );
if ( $color != '#eb5937 ') :
?>
<style type="text/css">
<?php
echo
'a:hover,
a:focus,
a:active {
color: '.$color.';
}
blockquote {
border-left: 3px solid '.$color.';
}
.main-navigation ul ul {
border-top: 3px solid '.$color.';
}
.main-navigation li:hover > a {
border-bottom: 3px solid '.$color.';
}
.main-navigation a:hover,
.main-navigation ul li.current-menu-item a,
.main-navigation ul li.current_page_ancestor a,
.main-navigation ul li.current-menu-ancestor a,
.main-navigation ul li.current_page_item a,
.main-navigation ul li:hover > a {
color: '.$color.';
}
.widget-title {
border-bottom: 3px solid '.$color.';
}
.th-services-box:hover .th-services-icon {
border: 1px solid '.$color.';
color: '.$color.';
}
.th-services-box:hover .th-morelink {
background: '.$color.';
}
.th-morelink {
color: '.$color.';
}
.th-morelink:visited {
color: '.$color.';
}
.call-to-action-button {
background: '.$color.';
}
.singlepage-widget-moretag {
background: '.$color.';
}
.moretag {
background: '.$color.';
}
.comment-author .fn,
.comment-author .url,
.comment-reply-link,
.comment-reply-login {
color: '.$color.';
}
a:hover.page-numbers {
background-color: '.$color.';
}
.paging-navigation .current {
background-color: '.$color.';
}
.page-links span a{
background: '.$color.';
}
.page-links a:hover {
background: '.$color.';
}
.site-footer a:hover {
color: '.$color.';
}
.th-search-box-container {
border-top: 3px solid '.$color.';
}
.topbar-icon {
background: '.$color.';
}
#th-search-form input[type="submit"] {
background-color: '.$color.';
}';
?>
</style>
<?php
endif;
}
add_action( 'wp_head', 'thbusiness_customize_css' );

View File

@@ -1,165 +0,0 @@
#customize-control-custom_slide_img_1,
#customize-control-custom_slide_img_2,
#customize-control-custom_slide_img_3,
#customize-control-custom_slide_img_4,
#customize-control-custom_slide_img_5, {
margin-top: 10px;
padding-top: 20px;
border-top: 1px solid #ccc;
}
#customize-theme-controls .accordion-section-title {
/*background: #333;*/
}
.accordion-section-title:after, .handlediv, .item-edit, .sidebar-name-arrow, .widget-action {
color: #DEDEDE;
}
.wp-full-overlay-sidebar {
background: #EFEFEF;
}
#customize-controls .control-section .accordion-section-title:focus, #customize-controls .control-section .accordion-section-title:hover, #customize-controls .control-section.open .accordion-section-title, #customize-controls .control-section:hover>.accordion-section-title {
background: #f5f5f5;
}
#customize-theme-controls .control-section .accordion-section-title:focus:after, #customize-theme-controls .control-section .accordion-section-title:hover:after, #customize-theme-controls .control-section.open .accordion-section-title:after, #customize-theme-controls .control-section:hover>.accordion-section-title:after {
color: #555;
}
.customize-control-checkbox label {
font-weight: bold;
font-size: 14px;
}
.customize-control-description {
font-weight: normal;
}
#customize-theme-controls .accordion-section-title {
color: #555;
}
.customize-control select {
min-width: 98%;
}
.control-section h3.accordion-section-title:before {
right: 0;
content: '\f105';
border: none;
background: 0 0;
font: 400 16px/1 FontAwesome;
speak: none;
display: block;
padding: 0;
text-indent: 0;
position: relative;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-decoration: none!important;
margin: 2px 17px 0 15px;
float: left;
width: 23px;
color: #333;
}
.nav-menus-php .item-edit:before, .widget-top a.widget-action:before {
content: '';
}
.control-section h3.accordion-section-title {
padding-left: 0;
}
#accordion-panel-widgets .control-section h3.accordion-section-title:before {
content: none;
}
#accordion-panel-widgets .control-section h3.accordion-section-title {
padding-left: 20px;
}
#accordion-panel-nav_menus .control-section h3.accordion-section-title:before {
content: none;
}
#accordion-panel-nav_menus .control-section h3.accordion-section-title {
padding-left: 20px;
}
/* Icons */
/* Site Identity */
#accordion-section-title_tagline h3.accordion-section-title:before {
content: '\f19c';
}
/* General Settings */
#accordion-section-thbusiness_general_settings h3.accordion-section-title:before {
content: '\f085';
}
/* Homepage Settings */
#accordion-panel-thbusiness_home_settings h3.accordion-section-title:before {
content: '\f015';
font-size: 20px;
}
/* Post/Page Settings */
#accordion-section-thbusiness_post_page_settings h3.accordion-section-title:before {
content: '\f0f6';
}
/* Site Styling */
#accordion-panel-thbusiness_styling h3.accordion-section-title:before {
content: '\f1fc';
}
/* Social Media */
#accordion-section-thbusiness_social_media h3.accordion-section-title:before {
content: '\f0c0';
}
/* Menus */
#accordion-panel-nav_menus h3.accordion-section-title:before {
content: '\f0c9';
}
/* Widgets */
#accordion-panel-widgets h3.accordion-section-title:before {
content: '\f009';
}
/* Background Image */
#accordion-section-background_image h3.accordion-section-title:before {
content: '\f03e';
}
/* Custom CSS */
#accordion-section-thbusiness_custom_css h3.accordion-section-title:before {
content: '\f044';
}
/* Static Frontpage */
#accordion-section-static_front_page h3.accordion-section-title:before {
content: '\f108';
}
/* Featured Slider */
#accordion-section-thbusiness_slider h3.accordion-section-title:before {
content: '\f24d';
}
#accordion-section-thbusiness_pro_details h3.accordion-section-title:before {
content: '\f219';
}
#accordion-section-thbusiness_topbar_settings h3.accordion-section-title:before {
content: '\f09d';
}
#accordion-section-header_image h3.accordion-section-title:before {
content: '\f1c5';
}

View File

@@ -1,34 +0,0 @@
<?php
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Thbusiness_Custom_Content' ) ) :
class Thbusiness_Custom_Content extends WP_Customize_Control {
// Whitelist content parameter
public $content = '';
/**
* Render the control's content.
*
* Allows the content to be overriden without having to rewrite the wrapper.
*
* @since 1.0.0
* @return void
*/
public function render_content() {
if ( isset( $this->label ) ) {
echo '<span class="customize-control-title">' . $this->label . '</span>';
}
if ( isset( $this->content ) ) {
echo $this->content;
}
if ( isset( $this->description ) ) {
echo '<span class="description customize-control-description">' . $this->description . '</span>';
}
}
}
endif;

File diff suppressed because it is too large Load Diff

View File

@@ -1,176 +0,0 @@
<?php
/**
* Custom functions that act independently of the theme templates
*
* Eventually, some of the functionality here could be replaced by core features
*
* @package thbusiness
*/
/**
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
*
* @param array $args Configuration arguments.
* @return array
*/
function thbusiness_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'thbusiness_page_menu_args' );
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function thbusiness_body_classes( $classes ) {
// Adds a class of group-blog to blogs with more than 1 published author.
if ( is_multi_author() ) {
$classes[] = 'group-blog';
}
return $classes;
}
add_filter( 'body_class', 'thbusiness_body_classes' );
/**
* Filters wp_title to print a neat <title> tag based on what is being viewed.
*
* @param string $title Default title text for current view.
* @param string $sep Optional separator.
* @return string The filtered title.
*/
function thbusiness_wp_title( $title, $sep ) {
if ( is_feed() ) {
return $title;
}
global $page, $paged;
// Add the blog name
$title .= get_bloginfo( 'name', 'display' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) {
$title .= " $sep $site_description";
}
// Add a page number if necessary:
if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
$title .= " $sep " . sprintf( __( 'Page %s', 'thbusiness' ), max( $paged, $page ) );
}
return $title;
}
add_filter( 'wp_title', 'thbusiness_wp_title', 10, 2 );
/**
* Sets the authordata global when viewing an author archive.
*
* This provides backwards compatibility with
* http://core.trac.wordpress.org/changeset/25574
*
* It removes the need to call the_post() and rewind_posts() in an author
* template to print information about the author.
*
* @global WP_Query $wp_query WordPress Query object.
* @return void
*/
function thbusiness_setup_author() {
global $wp_query;
if ( $wp_query->is_author() && isset( $wp_query->post ) ) {
$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
}
}
add_action( 'wp', 'thbusiness_setup_author' );
/**
* Sets the post excerpt length to 70 words.
*
* function tied to the excerpt_length filter hook.
*
* @uses filter excerpt_length
*/
function thbusiness_excerpt_length( $length ) {
return 70;
}
add_filter( 'excerpt_length', 'thbusiness_excerpt_length' );
/**
* Replaces content [...] with ...
*/
function thbusiness_excerpt_more() {
return '&hellip; ';
}
add_filter( 'excerpt_more', 'thbusiness_excerpt_more' );
/**
* Custom length excerpt
*/
function thbusiness_excerpt( $limit ) {
return wp_trim_words( get_the_excerpt(), $limit );
}
/**
* thbusiness slider function inserts a slider.
*/
if ( !function_exists( 'thbusiness_homepage_slider' ) ) :
function thbusiness_homepage_slider() {
global $post;
?>
<section class="slider"><!--<?php echo do_shortcode('[extras]'); ?>-->
<div class="flexslider">
<?php
for( $i = 1; $i <= 5; $i++ ) {
$thbusiness_slider_title = of_get_option( 'thbusiness_slider_title'.$i , '' );
$thbusiness_slider_text = of_get_option( 'thbusiness_slider_text'.$i , '' );
$thbusiness_slider_image = of_get_option( 'thbusiness_slider_image'.$i , '' );
$thbusiness_mobilehero_image = of_get_option( 'thbusiness_mobilehero_image'.$i , '' );
$thbusiness_slider_link = of_get_option( 'thbusiness_slider_link'.$i , '#' );
$thbusiness_slider_link_text = of_get_option( 'thbusiness_slider_link_text'.$i , 'Read More' );
?>
<?php if( !empty( $thbusiness_header_title ) || !empty( $thbusiness_slider_text ) || !empty( $thbusiness_slider_image ) ) : ?>
<div class="th-slider-container">
<!--<p class="web-hide">Hurry! Offer ends in</p><div id="defaultCountdown"></div><div id="counter-container"></div>-->
<?php if( !empty( $thbusiness_slider_link_text ) ) { ?>
<div class="th-slider-readmore-button">
<a href="<?php echo esc_url( $thbusiness_slider_link );?>" id="Home-Order-Now"><?php echo $thbusiness_slider_link_text; ?></a>
</div><!-- .th-slider-readmore-button -->
<?php } ?>
<figure>
<img alt="<?php echo esc_attr( $thbusiness_slider_title ); ?>" src="<?php echo esc_url( $thbusiness_slider_image ); ?>" class="site-hero">
<a href="<?php echo esc_url( $thbusiness_slider_link ); ?>"><img alt="<?php echo esc_attr( $thbusiness_mobilehero_image ); ?>" src="<?php echo esc_url( $thbusiness_mobilehero_image ); ?>" class="mobile-hero"></a>
</figure>
<?php if( !empty( $thbusiness_slider_text ) ) { ?>
<div class="th-slider-details-container">
<div class="th-slider-description">
<?php echo do_shortcode( '[contact-form-7 id="3977" title="Google_LP"]' ) ?>
</div><!-- .th-slider-description -->
</div><!-- .th-slider-details-container -->
<?php } ?>
</div>
<?php endif; ?>
<?php } ?>
</div>
</section>
<?php }
endif;

View File

@@ -1,31 +0,0 @@
<?php
function gtm_output() { ?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MJH5WQQ');</script>
<!-- End Google Tag Manager -->
<?php
}
function gtm_noscript_output() { ?>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MJH5WQQ"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<?php
}
function gtm_datalayer_init() {?>
<script>window.dataLayer = window.dataLayer || [];</script>
<?php
}

View File

@@ -1,19 +0,0 @@
<?php
/**
* Jetpack Compatibility File
* See: http://jetpack.me/
*
* @package thbusiness
*/
/**
* Add theme support for Infinite Scroll.
* See: http://jetpack.me/support/infinite-scroll/
*/
function thbusiness_jetpack_setup() {
add_theme_support( 'infinite-scroll', array(
'container' => 'main',
'footer' => 'page',
) );
}
add_action( 'after_setup_theme', 'thbusiness_jetpack_setup' );

View File

@@ -1,177 +0,0 @@
<?php
/**
* Custom template tags for this theme.
*
* Eventually, some of the functionality here could be replaced by core features.
*
* @package thbusiness
*/
if ( ! function_exists( 'thbusiness_paging_nav' ) ) :
/**
* Display navigation to next/previous set of posts when applicable.
* Based on paging nav function from Twenty Fourteen
*/
function thbusiness_paging_nav() {
// Don't print empty markup if there's only one page.
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
return;
}
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array();
$url_parts = explode( '?', $pagenum_link );
if ( isset( $url_parts[1] ) ) {
wp_parse_str( $url_parts[1], $query_args );
}
$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%';
// Set up paginated links.
$links = paginate_links( array(
'base' => $pagenum_link,
'format' => $format,
'total' => $GLOBALS['wp_query']->max_num_pages,
'current' => $paged,
'mid_size' => 3,
'add_args' => array_map( 'urlencode', $query_args ),
'prev_text' => __( '<span class="meta-nav-prev"></span> Previous', 'thbusiness' ),
'next_text' => __( 'Next <span class="meta-nav-next"></span>', 'thbusiness' ),
'type' => 'list',
) );
if ( $links ) :
?>
<nav class="navigation paging-navigation" role="navigation">
<h2 class="screen-reader-text"><?php _e( 'Posts navigation', 'thbusiness' ); ?></h2>
<?php echo $links; ?>
</nav><!-- .navigation -->
<?php
endif;
}
endif;
if ( ! function_exists( 'thbusiness_post_nav' ) ) :
/**
* Display navigation to next/previous post when applicable.
*/
function thbusiness_post_nav() {
// Don't print empty markup if there's nowhere to navigate.
$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) {
return;
}
?>
<nav class="navigation post-navigation" role="navigation">
<h2 class="screen-reader-text"><?php _e( 'Post navigation', 'thbusiness' ); ?></h2>
<div class="nav-links">
<?php
previous_post_link( '<div class="nav-previous">%link</div>', _x( '<span class="meta-nav">&larr;</span> %title', 'Previous post link', 'thbusiness' ) );
next_post_link( '<div class="nav-next">%link</div>', _x( '%title <span class="meta-nav">&rarr;</span>', 'Next post link', 'thbusiness' ) );
?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
endif;
if ( ! function_exists( 'thbusiness_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function thbusiness_posted_on() {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
printf( '<span class="posted-on">%1$s</span><span class="byline">%2$s</span>' ,
sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
esc_url( get_permalink() ),
$time_string
),
sprintf( '',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_html( get_the_author() )
)
);
}
endif;
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function thbusiness_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'thbusiness_categories' ) ) ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories( array(
'fields' => 'ids',
'hide_empty' => 1,
// We only need to know if there is more than one category.
'number' => 2,
) );
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'thbusiness_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so thbusiness_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so thbusiness_categorized_blog should return false.
return false;
}
}
/**
* Flush out the transients used in thbusiness_categorized_blog.
*/
function thbusiness_category_transient_flusher() {
// Like, beat it. Dig?
delete_transient( 'thbusiness_categories' );
}
add_action( 'edit_category', 'thbusiness_category_transient_flusher' );
add_action( 'save_post', 'thbusiness_category_transient_flusher' );
/**
* Get the featured image if exists.
* @return void
*/
function thbusiness_featured_image() {
if ( post_password_required() || ! has_post_thumbnail() ) {
return;
}
if ( is_singular() ) : ?>
<div class="article-featured-image">
<?php the_post_thumbnail(); ?>
</div>
<?php else : ?>
<div class="article-preview-image">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'featured-large' ); ?></a>
</div>
<?php endif;
}

View File

@@ -1,80 +0,0 @@
<?php
/**
* THBusiness info page
*
* @package THBusiness
*/
add_action('admin_menu', 'thbusiness_theme_info');
function thbusiness_theme_info() {
add_theme_page('THBusiness WordPress Theme Information', 'THBusiness Info', 'edit_theme_options', 'thbusiness-info', 'thbusiness_info_display_content');
}
function thbusiness_info_display_content() { ?>
<div class="thbusiness-theme-info">
<?php
$thbusiness_details = wp_get_theme();
$version = $thbusiness_details->get( 'Version' );
$name = $thbusiness_details->get( 'Name' );
$description = $thbusiness_details->get( 'Description' );
?>
<div class="thbusiness-info-header">
<h1 class="thbusiness-info-title">
<?php echo strtoupper( $name ) . ' ' . $version; ?>
</h1>
</div>
<div class="thbusiness-info-body">
<div class="thbusiness-theme-description">
<p>
<?php echo $description; ?>
</p>
</div>
<div class="thbusiness-info-blocks">
<div class="thbusiness-info-block aw-n-margin">
<span class="dashicons dashicons-visibility"></span>
<a href="<?php echo esc_url('http://themezhut.com/demo/thbusiness/'); ?>" target="_blank"><?php _e( 'View Demo', 'thbusiness' ); ?></a>
</div>
<div class="thbusiness-info-block">
<span class="dashicons dashicons-book-alt"></span>
<a href="<?php echo esc_url('http://themezhut.com/thbusiness-theme-documentation/'); ?>" target="_blank"><?php _e( 'Documentation', 'thbusiness' ); ?></a>
</div>
<div class="thbusiness-info-block">
<span class="dashicons dashicons-businessman"></span>
<a href="<?php echo esc_url('https://wordpress.org/support/theme/thbusiness'); ?>" target="_blank"><?php _e( 'Get Support', 'thbusiness' ); ?></a>
</div>
<div class="thbusiness-info-block aw-n-margin">
<span class="dashicons dashicons-admin-generic"></span>
<a href="<?php echo admin_url('customize.php'); ?>"><?php _e( 'Customize Site', 'thbusiness' ); ?></a>
</div>
<div class="thbusiness-info-block">
<span class="dashicons dashicons-awards"></span>
<a href="<?php echo esc_url('http://themezhut.com/themes/thbusiness-pro/'); ?>" target="_blank"><?php _e( 'THBusiness Pro', 'thbusiness' ); ?></a>
</div>
<div class="thbusiness-info-block">
<span class="dashicons dashicons-search"></span>
<a href="<?php echo esc_url('http://themezhut.com/demo/thbusiness-pro/'); ?>" target="_blank"><?php _e( 'THBusiness Pro Demo', 'thbusiness' ); ?></a>
</div>
</div>
</div>
</div>
<?php }
add_action( 'admin_menu', 'thbusiness_options_menu_item' );
function thbusiness_options_menu_item() {
add_theme_page( 'THBusiness Options', 'Theme Options', 'manage_options', 'theme-options', 'thbusiness_options_page', 'dashicons-admin-generic', 100 );
}
function thbusiness_options_page() { ?>
<div class="thbusiness-theme-info thbusiness-options">
<p><?php _e( 'As per the new guidelines to remove theme options panels of the themes that are available on WordPress.org, we have completely removed the "Theme Options" panel with the new THBusiness 2.0 update. All the settings and options are now located in the theme customizer. Go to <b>"Appearence > Customize"</b> to find the Customizer or please use the "Contact Us" link below if you have run into any issues with the update.', 'thbusiness' ); ?></p>
<p><a href="<?php echo admin_url('customize.php'); ?>"><?php _e( 'Go to customizer.', 'thbusiness' ); ?></a></p>
<a href="<?php echo esc_url('http://themezhut.com/contact/'); ?>" target="_blank"><?php _e( 'Contact Us', 'thbusiness' ); ?></a>
</div>
<?php }

View File

@@ -1,59 +0,0 @@
<div class="top-bar">
<div class="container">
<div class="row">
<div class="col-md-8 col-xs-12 col-sm-12">
<p class="phonetext">
<?php
$promo_default = of_get_option('thbusiness_telephone_text', '');
$promo_custom = get_post_meta(get_the_ID(), 'promo-text', true);
if (!empty($promo_custom)) :
$promo_default = $promo_custom;
echo $promo_default;
else:
echo $promo_default;
endif;
?>
</p>
</div>
<div class="col-md-4 col-xs-12 col-sm-12 phonenumber">
<div class="existing-customer">Existing Customer<br/><a href="http://medicalalertsupport.com/">Click Here</a>
</div>
<?php $tp_num = of_get_option('thbusiness_telephone_num', '');?>
<p><a href="tel: <?php echo do_shortcode('[op]') ?>"><?php echo do_shortcode('[op]'); ?></a>
</p>
</div>
</div>
</div>
</div>
<div class="phonetext-mobile">
<div class="mobile-text-left">
<?php
$promo_default = of_get_option('thbusiness_telephone_text', '');
$promo_custom = get_post_meta(get_the_ID(), 'promo-text', true);
if (isset($_COOKIE["SESStopoffer"])) {
echo do_shortcode('[campaign_special]');
} elseif (!empty($promo_custom)) {
$promo_default = $promo_custom;
echo $promo_default;
} else {
echo $promo_default;
}
?>
</div>
<div class="mobile-icon-right">
<a href="tel: <?php echo do_shortcode('[op]') ?>">Call <?php echo do_shortcode('[op]'); ?> for our latest offer.</a>
</div>
</div>

View File

@@ -1,729 +0,0 @@
<?php
/**
* Contains all the functions related to widgets.
*
* @package thbusiness.
*/
/**
* Widget to display pages as services.
*/
class Thbusiness_Services_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'thbusiness_services_widget', // Base ID
__( 'THBusiness Services Widget', 'thbusiness' ), // Name
array( 'description' => __( 'Displays pages as services. Best for Business Template Top/Bottom Area.', 'thbusiness' ), ) // Args
);
}
public function form( $instance ) {
for ( $i=0; $i<6; $i++ ) {
$var = 'page_id'.$i;
$icons = 'icon'.$i;
$defaults[$icons] = '';
$defaults[$var] = '';
}
$instance = wp_parse_args( (array) $instance, $defaults );
for ( $i=0; $i<6; $i++ ) {
$var = 'page_id'.$i;
$var = absint( $instance[ $var ] );
}
?>
<?php _e( 'If there is not an icon it will display the featured image of the page as the icon.<br /> Give the name of the font awesome icon to the Icon input field.You can find the icon names from the readme.txt <br /> eg: fa-angle-double-up', 'thbusiness' ); ?>
<?php for( $i=0; $i<6; $i++) { ?>
<?php $j = $i+1; ?>
<p>
<label for="<?php echo $this->get_field_id( 'icon'.$i ); ?>"><?php _e( 'Icon ', 'thbusiness' ); echo $j; ?>:</label>
<input class="widefat" id="<?php echo $this->get_field_id( 'icon'.$i ); ?>" name="<?php echo $this->get_field_name( 'icon'.$i ); ?>" value="<?php echo esc_attr( $instance[ 'icon'.$i ] ); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'page_id'.$i ); ?>"><?php _e( 'Page ', 'thbusiness' ); echo $j; ?>:</label>
<?php wp_dropdown_pages( array( 'show_option_none' =>' ','name' => $this->get_field_name( 'page_id'.$i ), 'selected' => $instance[ 'page_id'.$i ] ) ); ?>
</p>
<?php
}
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
for( $i=0; $i<6; $i++ ) {
$var = 'page_id'.$i;
$instance[ $var ] = absint( $new_instance[ $var ] );
$instance[ 'icon'.$i ] = strip_tags( $new_instance[ 'icon'.$i ] );
}
return $instance;
}
function widget( $args, $instance ) {
extract( $args );
extract( $instance );
global $post;
$page_array = array();
for( $i=0; $i<6; $i++ ) {
$icon = 'icon'.$i;
$var = 'page_id'.$i;
$icons[] = isset( $instance[ $icon ] ) ? $instance[ $icon ] : '';
$page_id = isset( $instance[ $var ] ) ? $instance[ $var ] : '';
if( !empty( $page_id ) ) {
array_push( $page_array, $page_id );// Push the page id in the array
}
}
$get_services_pages = new WP_Query( array(
'posts_per_page' => -1,
'post_type' => array( 'page' ),
'post__in' => $page_array,
'orderby' => 'post__in'
) );
?>
<div class="container-fluid th-business-page-widget">
<div class="container">
<div class="row">
<?php echo $before_widget; ?>
<?php
$k = 1;
$i = 0;
?>
<?php while ($get_services_pages->have_posts()) : $get_services_pages->the_post(); ?>
<?php
if ( $k==3 ) {
$class="col-xs-12 col-sm-6 col-md-4 col-lg-4 th-clear-third";
} elseif ( $k==4 ) {
$class="col-xs-12 col-sm-6 col-md-4 col-lg-4 th-clear-fourth";
} else {
$class="col-xs-12 col-sm-6 col-md-4 col-lg-4";
}
?>
<div class="<?php echo $class; ?>">
<div class="th-services-box">
<?php if( ( has_post_thumbnail() ) && ( empty ($icons[$i]) ) ) { ?>
<div class="th-services-image">
<?php the_post_thumbnail( 'small' ); ?>
</div>
<?php } elseif( !empty($icons[$i]) ) { ?>
<div class="th-services-icon">
<i class="fa th-fa-services-custom <?php echo esc_attr( $icons[$i] ); ?>"></i>
</div>
<?php } ?>
<?php echo $before_title; ?><a title="<?php the_title_attribute(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a><?php echo $after_title; ?>
<article class="th-front-page-summery">
<?php
if ( empty( $post->post_excerpt ) ) {
echo thbusiness_excerpt(30);
} else {
echo the_excerpt();
}
?>
</article>
<div class="th-morelink-sep"><a class="th-morelink" title="<?php the_title_attribute(); ?>" href="<?php the_permalink(); ?>"><?php _e( 'Read More', 'thbusiness' ) ?></a></div>
</div><!-- .thbusiness-services-boxset -->
</div>
<?php
$k++;
$i++;
?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php echo $after_widget; ?>
</div><!-- .row -->
</div><!-- .container -->
</div><!-- .container-fluid -->
<?php }
}
function thbusiness_register_services_widget() {
register_widget( 'Thbusiness_Services_Widget' );
}
add_action( 'widgets_init', 'thbusiness_register_services_widget' );
/**
* Widget to display pages as Recent Work.
*/
class Thbusiness_RecentWork_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'thbusiness_recentwork_widget', // Base ID
__( 'THBusiness Recent Work Widget', 'thbusiness' ), // Name
array( 'description' => __( 'Displays pages as recent work.Featured image of the page will show up first. Best for Business Template Top/Bottom Area.', 'thbusiness' ), ) // Args
);
}
public function form( $instance ) {
for ( $i=0; $i<4; $i++ ) {
$var = 'page_id'.$i;
$defaults[$var] = '';
}
$att_defaults = $defaults;
$att_defaults['title'] = '';
$att_defaults['show_page_titles'] = 1;
$att_defaults['show_page_excerpts'] = 0;
$instance = wp_parse_args( (array) $instance, $att_defaults );
for ( $i=0; $i<4; $i++ ) {
$var = 'page_id'.$i;
$var = absint( $instance[ $var ] );
}
$title = esc_attr( $instance[ 'title' ] );
$show_page_titles = $instance['show_page_titles'] ? 'checked="checked"' : '';
$show_page_excerpts = $instance['show_page_excerpts'] ? 'checked="checked"' : '';
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'thbusiness' ); ?></label>
<input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
</p>
<p>
<input class="checkbox" type="checkbox" <?php echo $show_page_titles; ?> id="<?php echo $this->get_field_id( 'show_page_titles' ); ?>" name="<?php echo $this->get_field_name( 'show_page_titles' ); ?>" />
<label for="<?php echo $this->get_field_id( 'show_page_titles' ); ?>"><?php _e( 'Display page titles.', 'thbusiness' ); ?></label>
</p>
<p>
<input class="checkbox" type="checkbox" <?php echo $show_page_excerpts; ?> id="<?php echo $this->get_field_id( 'show_page_excerpts' ); ?>" name="<?php echo $this->get_field_name( 'show_page_excerpts' ); ?>" />
<label for="<?php echo $this->get_field_id( 'show_page_excerpts' ); ?>"><?php _e( 'Display page excerpts.', 'thbusiness' ); ?></label>
</p>
<?php for( $i=0; $i<4; $i++) { ?>
<p>
<label for="<?php echo $this->get_field_id( key($defaults) ); ?>"><?php _e( 'Page', 'thbusiness' ); ?>:</label>
<?php wp_dropdown_pages( array( 'show_option_none' =>' ','name' => $this->get_field_name( key($defaults) ), 'selected' => $instance[key($defaults)] ) ); ?>
</p>
<?php
next( $defaults );// forwards the key of $defaults array
}
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] );
$instance[ 'show_page_titles' ] = isset( $new_instance[ 'show_page_titles' ] ) ? 1 : 0;
$instance[ 'show_page_excerpts' ] = isset( $new_instance[ 'show_page_excerpts' ] ) ? 1 : 0;
for( $i=0; $i<4; $i++ ) {
$var = 'page_id'.$i;
$instance[ $var] = absint( $new_instance[ $var ] );
}
return $instance;
}
function widget( $args, $instance ) {
extract( $args );
extract( $instance );
global $post;
$title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : '';
$show_page_titles = isset( $instance['show_page_titles'] ) ? $instance['show_page_titles'] : false;
$show_page_excerpts = isset( $instance['show_page_excerpts'] ) ? $instance['show_page_excerpts'] : false;
$page_array = array();
for( $i=0; $i<4; $i++ ) {
$var = 'page_id'.$i;
$page_id = isset( $instance[ $var ] ) ? $instance[ $var ] : '';
if( !empty( $page_id ) )
array_push( $page_array, $page_id );// Push the page id in the array
}
$get_services_pages = new WP_Query( array(
'posts_per_page' => -1,
'post_type' => array( 'page' ),
'post__in' => $page_array,
'orderby' => 'post__in'
) );
?>
<div class="container-fluid th-business-page-widget">
<div class="container">
<div class="row">
<?php echo $before_widget; ?>
<?php if ( !empty($title) ) {
echo $before_title . esc_html($title) . $after_title;
} ?>
<?php while ($get_services_pages->have_posts()) : $get_services_pages->the_post(); ?>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
<div class="th-recentwork-box">
<?php if ( has_post_thumbnail() ) : ?>
<div class="recentwork-image"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'featured' ); ?></a></div>
<?php endif; ?>
<?php if ( ( $show_page_titles == true ) || ( ! has_post_thumbnail() ) ) : ?>
<div class="th-recentwork-title"><h1><a title="<?php the_title_attribute(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1></div>
<?php endif; ?>
<?php if ( ( $show_page_excerpts == true ) || ( ! has_post_thumbnail() ) ) : ?>
<article class="th-front-page-summery">
<?php
if ( empty( $post->post_excerpt ) ) {
echo thbusiness_excerpt(30);
} else {
echo the_excerpt();
}
?>
</article>
<?php endif; ?>
</div><!-- .thbusiness-services-box -->
</div><!-- .col-xs-12 .col-sm-6 .col-md-3 .col-lg-3 -->
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php echo $after_widget; ?>
</div><!-- .row -->
</div><!-- .container -->
</div><!-- .container-fluid -->
<?php }
}
function thbusiness_register_recentwork_widget() {
register_widget( 'Thbusiness_RecentWork_Widget' );
}
add_action( 'widgets_init', 'thbusiness_register_recentwork_widget');
/**
* Widget to display call to action.
*/
class Thbusiness_CallTo_Action extends WP_Widget {
function __construct() {
parent::__construct(
'thbusiness_callto_action', // Base ID
__( 'THBusiness Call To Action', 'thbusiness' ), // Name
array( 'description' => __( 'Displays a call to action widget.Best for Business Template Top/Bottom Area.', 'thbusiness' ), ) // Args
);
}
public function form( $instance ) {
$thbusiness_defaults[ 'action_title' ] = '';
$thbusiness_defaults[ 'action_text' ] = '';
$thbusiness_defaults[ 'button_text' ] = '';
$thbusiness_defaults[ 'button_url' ] = '';
$instance = wp_parse_args( (array) $instance, $thbusiness_defaults );
$action_title = esc_textarea( $instance['action_title'] );
$action_text = esc_textarea( $instance['action_text'] );
$button_text = esc_attr( $instance['button_text'] );
$button_url = esc_url( $instance['button_url'] );
?>
<p><?php _e( 'Call to Action Main Text','thbusiness' ); ?></p>
<textarea class="widefat" rows="3" cols="20" id="<?php echo $this->get_field_id('action_title'); ?>" name="<?php echo $this->get_field_name('action_title'); ?>"><?php echo $action_title; ?></textarea>
<p><?php _e( 'Call to Action Additional Text','thbusiness' ); ?></p>
<textarea class="widefat" rows="3" cols="20" id="<?php echo $this->get_field_id('action_text'); ?>" name="<?php echo $this->get_field_name('action_text'); ?>"><?php echo $action_text; ?></textarea>
<p>
<label for="<?php echo $this->get_field_id('button_text'); ?>"><?php _e( 'Button Text:', 'thbusiness' ); ?></label>
<input id="<?php echo $this->get_field_id('button_text'); ?>" name="<?php echo $this->get_field_name('button_text'); ?>" type="text" value="<?php echo $button_text; ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('button_url'); ?>"><?php _e( 'Button Redirect Link:', 'thbusiness' ); ?></label>
<input id="<?php echo $this->get_field_id('button_url'); ?>" name="<?php echo $this->get_field_name('button_url'); ?>" type="text" value="<?php echo $button_url; ?>" />
</p>
<?php }
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
if ( current_user_can( 'unfiltered_html' ) )
$instance['action_title'] = $new_instance['action_title'];
else
$instance['action_title'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['action_title']) ) );
if ( current_user_can('unfiltered_html') )
$instance['action_text'] = $new_instance['action_text'];
else
$instance['action_text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['action_text']) ) );
$instance[ 'button_text' ] = strip_tags( $new_instance[ 'button_text' ] );
$instance[ 'button_url' ] = esc_url_raw( $new_instance[ 'button_url' ] );
return $instance;
}
public function widget( $args, $instance ) {
extract( $args );
extract( $instance );
global $post;
$action_title = empty( $instance[ 'action_title' ] ) ? '' : $instance[ 'action_title' ];
$action_text = empty( $instance[ 'action_text' ] ) ? '' : $instance[ 'action_text' ];
$button_text = isset( $instance[ 'button_text' ] ) ? $instance[ 'button_text' ] : '';
$button_url = isset( $instance[ 'button_url' ] ) ? $instance[ 'button_url' ] : '#';
echo $before_widget; ?>
<div class="container-fluid call-to-action-wrapper">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
<div class="call-to-action-content">
<?php if( !empty( $action_title) ) { ?>
<h3><?php echo esc_html( $action_title ); ?></h3>
<?php } ?>
<?php if( !empty( $action_text ) ) { ?>
<p><?php echo esc_html( $action_text ); ?></p>
<?php } ?>
</div><!-- .call-to-action-content -->
</div><!-- col-xs-9 col-sm-9 col-md-9 col-lg-9 -->
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
<img src="wp-content/themes/thbusiness/images/retail.png" style="display:block; margin:12px auto" alt="Retail Value: $95 Yours Free" />
</div>
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
<?php if( !empty($button_text) ) { ?>
<a class="call-to-action-button-callout-wdg" href="<?php echo $button_url; ?>" title="<?php echo esc_attr( $button_text ); ?>"><?php echo esc_html( $button_text ); ?></a><br><p><strong class="call-to-action-content-phone">or call<div class="mNumber"><a href="tel: <?php echo do_shortcode('[op]') ?>"><?php echo do_shortcode('[op]');?></a></div><div class="dNumber"> <a href="tel: <?php echo do_shortcode('[op]') ?>"><?php echo do_shortcode('[op]');?></a> </div> <span></span></strong></p>
<?php } ?>
</div><!-- col-xs-3 col-sm-3 col-md-3 col-lg-3 -->
</div><!-- .row -->
</div><!-- .container -->
</div><!-- .container-fluid -->
<?php echo $after_widget;
}
}
function thbusiness_register_callto_action_widget() {
register_widget( 'Thbusiness_CallTo_Action' );
}
add_action( 'widgets_init', 'thbusiness_register_callto_action_widget' );
/**
* Widget to display a Single Page inside the business page.
*/
class Thbusiness_SinglePage_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'thbusiness_singlepage_widget', // Base ID
__( 'THBusiness Single Page Widget', 'thbusiness' ), // Name
array( 'description' => __( 'Displays a single Page along with the featured image.', 'thbusiness' ), ) // Args
);
}
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'page_id' => '', 'title' => '', 'disable_feature_image' => 0 ) );
$title = esc_attr( $instance[ 'title' ] );
$page_id = absint( $instance[ 'page_id' ] );
$disable_feature_image = $instance['disable_feature_image'] ? 'checked="checked"' : '';
?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title' , 'thbusiness' ); ?>:</label>
<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" />
</p>
<p><?php _e( 'Displays the page title if this title field is empty', 'thbusiness' ); ?></p>
<p>
<label for="<?php echo $this->get_field_id( 'page_id' ); ?>"><?php _e( 'Page', 'thbusiness' ); ?></label>
<?php wp_dropdown_pages( array( 'name' => $this->get_field_name( 'page_id' ), 'selected' => $instance['page_id'] ) ); ?>
</p>
<p>
<input class="checkbox" type="checkbox" <?php echo $disable_feature_image; ?> id="<?php echo $this->get_field_id('disable_feature_image'); ?>" name="<?php echo $this->get_field_name('disable_feature_image'); ?>" /> <label for="<?php echo $this->get_field_id('disable_feature_image'); ?>"><?php _e( 'Remove Featured image', 'thbusiness' ); ?></label>
</p>
<?php }
function update( $new_instance , $old_instance ) {
$instance = $old_instance;
$instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] );
$instance[ 'page_id' ] = absint( $new_instance[ 'page_id' ] );
$instance[ 'disable_feature_image' ] = isset( $new_instance[ 'disable_feature_image' ] ) ? 1 : 0;
return $instance;
}
public function widget( $args, $instance ) {
extract( $args );
extract( $instance );
global $post;
$title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : '';
$page_id = isset( $instance[ 'page_id' ] ) ? $instance[ 'page_id' ] : '';
$disable_feature_image = !empty( $instance[ 'disable_feature_image' ] ) ? 'true' : 'false';
if( $page_id ) :
$the_query = new WP_Query( 'page_id='.$page_id );
while( $the_query->have_posts() ):$the_query->the_post();
$page_name = get_the_title();
$before_widget; ?>
<div class="th-singlepage-widget">
<?php if ( $title ) { ?>
<?php echo $before_title; ?><a href="<?php the_permalink(); ?>" title="<?php echo $title; ?>"><?php echo esc_attr( $title ); ?></a><?php echo $after_title; ?>
<?php } else { ?>
<?php echo $before_title; ?><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a><?php echo $after_title; ?>
<?php } ?>
<?php
if( has_post_thumbnail() && $disable_feature_image != "true" ) { ?>
<div class="th-singlepage-widget-image">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'large' ); ?></a>
</div>
<?php } ?>
<article class="th-front-page-summery">
<?php echo thbusiness_excerpt(45); ?>
</article>
<a class="singlepage-widget-moretag" title="<?php the_title_attribute(); ?>" href="<?php the_permalink(); ?>"><?php _e( 'Read More', 'thbusiness' ) ?></a>
</div><!-- th-singlepage-widget -->
<?php
$after_widget;
endwhile;
// Reset Post Data
wp_reset_postdata();
endif;
}
}
function thbusiness_register_singlepage_widget() {
register_widget( 'Thbusiness_SinglePage_Widget' );
}
add_action( 'widgets_init', 'thbusiness_register_singlepage_widget' );
/**
* Widget to display testimonial.
*/
class Thbusiness_Testimonial_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'thbusiness_testimonial', // Base ID
__( 'THBusiness Testimonial', 'thbusiness' ), // Name
array( 'description' => __( 'Displays a testimonial.Best for Business Template Left/Right Area.', 'thbusiness' ), ) // Args
);
}
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'image' => '', 'description' => '', 'name' => '', 'designation' => '', 'company_name' => '', 'company_url' => '' ) );
$title = strip_tags( $instance['title'] );
$image = strip_tags( $instance['image'] );
$description = esc_textarea( $instance['description'] );
$name = strip_tags( $instance['name'] );
$designation = strip_tags( $instance['designation'] );
$company_name = strip_tags( $instance['company_name'] );
$company_url = strip_tags( $instance['company_url'] );
?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'thbusiness' ); ?>:</label>
<input class="widefat" type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr($title); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'description' ); ?>"><?php _e( 'Description', 'thbusiness' ); ?>:</label>
<textarea class="widefat" cols="20" rows="8" id="<?php echo $this->get_field_id( 'description' ); ?>" name="<?php echo $this->get_field_name( 'description' )?>"><?php echo $description; ?></textarea>
</p>
<p>
<label for="<?php echo $this->get_field_id('name'); ?>"><?php _e( 'Name', 'thbusiness' ); ?>:</label>
<input class="widefat" id="<?php echo $this->get_field_id('name'); ?>" name="<?php echo $this->get_field_name('name'); ?>" type="text" value="<?php echo esc_attr($name); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'designation' ); ?>"><?php _e( 'designation', 'thbusiness' ); ?>:</label>
<input class="widefat" type="text" id="<?php echo $this->get_field_id( 'designation' ); ?>" name="<?php echo $this->get_field_name( 'designation' ); ?>" value="<?php echo esc_attr($designation); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'company_name' ); ?>"><?php _e( 'Company Name', 'thbusiness' ); ?>:</label>
<input class="widefat" type="text" id="<?php echo $this->get_field_id( 'company_name' ); ?>" name="<?php echo $this->get_field_name( 'company_name' ); ?>" value="<?php echo esc_attr($company_name); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'company_url' ); ?>"><?php _e( 'Company Url', 'thbusiness' ); ?>:</label>
<input class="widefat" type="text" id="<?php echo $this->get_field_id( 'company_url' ); ?>" name="<?php echo $this->get_field_name( 'company_url' ); ?>" value="<?php echo esc_url_raw($company_url); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('image'); ?>"><?php _e( 'Image URL', 'thbusiness' ); ?>:</label>
<input class="widefat" type="text" name="<?php echo $this->get_field_name('image'); ?>" value="<?php echo esc_url($image); ?>" />
</p>
<?php }
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] );
$instance[ 'description' ] = strip_tags( $new_instance[ 'description' ] );
$instance[ 'name' ] = strip_tags( $new_instance[ 'name' ] );
$instance[ 'designation' ] = strip_tags( $new_instance[ 'designation' ] );
$instance[ 'company_name' ] = strip_tags( $new_instance[ 'company_name' ] );
$instance[ 'company_url' ] = strip_tags( $new_instance[ 'company_url' ] );
$instance[ 'image' ] = strip_tags( $new_instance[ 'image' ] );
if ( current_user_can('unfiltered_html') )
$instance['description'] = $new_instance['description'];
else
$instance['description'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['description']) ) ); // wp_filter_post_kses() expects slashed
$instance['filter'] = isset($new_instance['filter']);
return $instance;
}
public function widget( $args, $instance ) {
extract($args);
$title = apply_filters( 'title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
$description = apply_filters( 'description', empty( $instance['description'] ) ? '' : $instance['description'], $instance );
$name = apply_filters( 'name', empty( $instance['name'] ) ? '' : $instance['name'], $instance, $this->id_base );
$company_name = apply_filters( 'company_name', empty( $instance['company_name'] ) ? '' : $instance['company_name'], $instance, $this->id_base );
$company_url = apply_filters( 'company_url', empty( $instance['company_url'] ) ? '' : $instance['company_url'], $instance, $this->id_base );
$designation = apply_filters( 'designation', empty( $instance['designation'] ) ? '' : $instance['designation'], $instance, $this->id_base );
$image = apply_filters( 'image', empty( $instance['image'] ) ? '' : $instance['image'], $instance, $this->id_base );
echo $before_widget;
?>
<div class="th-testimonial-widget">
<?php if ( !empty( $title ) ) { echo $before_title. esc_html( $title ) . $after_title; } ?>
<article>
<div class="th-testimonial-image">
<img src="<?php echo esc_url($image)?>" title="<?php echo esc_attr($name); ?>" alt="<?php echo esc_attr($name); ?>" />
</div>
<div class="testimonial-content">
<p><?php echo esc_html( $description ); ?></p>
<div class="testimonial-meta"> <strong><?php echo esc_html( $name ); ?>,</strong> <?php echo esc_html( $designation ); echo ''; ?> <a href="<?php echo esc_url($company_url); ?>" title="<?php echo $company_name; ?>" target="_blank"> <?php echo esc_html( $company_name ); ?></a> </div>
</div>
</article>
</div>
<?php }
}
function thbusiness_register_testimonial_widget() {
register_widget( 'Thbusiness_Testimonial_Widget' );
}
add_action( 'widgets_init', 'thbusiness_register_testimonial_widget' );
/**
* Widget to display clients list or featured images list.
*/
class Thbusiness_Featured_Images extends WP_Widget {
function __construct() {
parent::__construct(
'thbusiness_featured_images', // Base ID
__( 'THBusiness Featured Images', 'thbusiness' ), // Name
array( 'description' => __( 'Displays images.You can show customer logos or any other images by this widget.Best for Business Template Top/Bottom Area.', 'thbusiness' ), ) // Args
);
}
public function form( $instance ) {
for ( $i=0; $i<4; $i++ ) {
$image_url = 'image_url'.$i;
$image_redirect_url = 'image_redirect_url'.$i;
$defaults[$image_url] = '';
$defaults[$image_redirect_url] = '';
}
$title = 'title';
$defaults[$title] = '';
$instance = wp_parse_args( (array) $instance, $defaults );
$title = strip_tags($instance['title']);
for ( $i=0; $i<4; $i++ ) {
$image_url = 'image_url'.$i;
$image_redirect_url = 'image_redirect_url'.$i;
$instance[ $image_url ] = esc_url( $instance[ $image_url ] );
$instance[ $image_redirect_url ] = esc_url( $instance[ $image_redirect_url ] );
}
?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'thbusiness' ); ?></label>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $title ); ?>" />
</p>
<?php for( $i=0; $i<4; $i++ ) { ?>
<?php $j = $i+1; ?>
<p>
<label for="<?php echo $this->get_field_id( 'image_url'.$i ); ?>"><?php _e( 'Image Link ', 'thbusiness' ); echo $j; ?></label>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('image_url'.$i); ?>" name="<?php echo $this->get_field_name( 'image_url'.$i ); ?>" value="<?php echo esc_url($instance['image_url'.$i]); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'image_redirect_url'.$i ); ?>"><?php _e( 'Image Redirect Link ', 'thbusiness' ); echo $j; ?></label>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('image_redirect_url'.$i); ?>" name="<?php echo $this->get_field_name( 'image_redirect_url'.$i ); ?>" value="<?php echo esc_url($instance['image_redirect_url'.$i]); ?>" />
</p>
<?php } ?>
<?php }
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
for( $i=0; $i<4; $i++ ) {
$instance['image_url'.$i] = esc_url( $new_instance['image_url'.$i] );
$instance['image_redirect_url'.$i] = esc_url( $new_instance['image_redirect_url'.$i] );
}
return $instance;
}
public function widget( $args, $instance ) {
extract($args);
$title = apply_filters('widget_title', $instance['title'] );
for ( $i=0; $i<4; $i++ ) {
$image_url[] = isset( $instance['image_url'.$i] ) ? esc_url( $instance['image_url'.$i] ) : '';
$image_redirect_url[] = isset( $instance['image_redirect_url'.$i] ) ? esc_url( $instance['image_redirect_url'.$i]) : '';
}
?>
<div class="th-clients">
<div class="container-fluid">
<div class="container">
<div class="row">
<?php echo $before_title.$title.$after_title; ?>
<?php for( $i=0; $i<4; $i++ ) { ?>
<div class="col-xs-6 col-sm-3 col-md-3 col-lg-3">
<div class="th-client-item-image">
<a href="<?php echo $image_redirect_url[$i]; ?>"><img src="<?php echo $image_url[$i]; ?>" /></a>
</div>
</div><!-- col-xs-12 col-sm-6 col-md-3 col-lg-3 -->
<?php } ?>
</div><!-- row -->
</div><!--container -->
</div><!--container-fluid -->
</div><!-- .th_clients -->
<?php
}
}
function thbusiness_featured_images() {
register_widget( 'Thbusiness_Featured_Images' );
}
add_action( 'widgets_init', 'thbusiness_featured_images' );