| 1 |
<?php |
| 2 |
/* |
| 3 |
* Plugin Name: ShortBuild |
| 4 |
* Plugin URI: |
| 5 |
* Description: Shortbuild plugin is comptible for Themeansar themes. |
| 6 |
* Version: 1.6.16 |
| 7 |
* Author: themeansar |
| 8 |
* Author URI: https://themeansar.com |
| 9 |
* License: GPL-2.0+ |
| 10 |
* Tested up to: 7.0 |
| 11 |
* Requires: 4.6 or higher |
| 12 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 13 |
* Text Domain: shortbuild |
| 14 |
* Domain Path: /languages |
| 15 |
*/ |
| 16 |
|
| 17 |
define( 'SBP_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 18 |
define( 'SBP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
define( 'SBP_PLUGIN_PLUGIN_NAME', 'shortbuild' ); |
| 23 |
define( 'SBP_PLUGIN_VERSION', '1.6.15' ); |
| 24 |
define( 'SBP_PLUGIN_TEMPLATE_URL', SBP_PLUGIN_URL.'inc/demo/' ); |
| 25 |
|
| 26 |
require SBP_PLUGIN_DIR . 'inc/init.php'; |
| 27 |
/** |
| 28 |
* Begins execution of the plugin. |
| 29 |
* |
| 30 |
* Since everything within the plugin is registered via hooks, |
| 31 |
* then kicking off the plugin from this point in the file does |
| 32 |
* not affect the page life cycle. |
| 33 |
* |
| 34 |
* @since 1.0.2 |
| 35 |
*/ |
| 36 |
if( !function_exists( 'run_shortbuild_bu')){ |
| 37 |
|
| 38 |
function run_shortbuild_bu() { |
| 39 |
|
| 40 |
return Shortbuild_Bu::instance(); |
| 41 |
} |
| 42 |
run_shortbuild_bu()->run(); |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
$theme_name = wp_get_theme(); |
| 47 |
if('Businessup' == $theme_name->name){ |
| 48 |
register_activation_hook( __FILE__, 'sbp_bu_page_installation_function'); |
| 49 |
function sbp_bu_page_installation_function() |
| 50 |
{ |
| 51 |
|
| 52 |
$item_details_page = get_option('item_details_page'); |
| 53 |
if(!$item_details_page){ |
| 54 |
require_once('inc/short/pages/home.php'); |
| 55 |
update_option( 'item_details_page', 'Done' ); |
| 56 |
} |
| 57 |
|
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
function sbp_activate() { |
| 62 |
$theme = wp_get_theme(); |
| 63 |
if ( 'Short' == $theme->name ){ |
| 64 |
require_once('inc/short/features/customizer.php'); |
| 65 |
require_once('inc/short/sections/homepage.php'); |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
if ( 'Bagility' == $theme->name ){ |
| 70 |
require_once('inc/bagility/features/customizer.php'); |
| 71 |
require_once('inc/bagility/sections/homepage.php'); |
| 72 |
} |
| 73 |
|
| 74 |
} |
| 75 |
add_action( 'init', 'sbp_activate' ); |
| 76 |
|
| 77 |
function sbp_enqueue(){ |
| 78 |
wp_enqueue_style('sbp-custom-controls-css', plugin_dir_url(__FILE__) . 'assets/css/customizer.css', false, '1.0.0'); |
| 79 |
} |
| 80 |
add_action('admin_enqueue_scripts', 'sbp_enqueue'); |
| 81 |
|
| 82 |
|
| 83 |
function sbp_customizer_section_live_preview() { |
| 84 |
wp_enqueue_script( |
| 85 |
'sbp-section-customizer-preview', plugin_dir_url(__FILE__) . 'assets/js/customizer.js', array( |
| 86 |
'jquery', |
| 87 |
'customize-preview', |
| 88 |
), 999, true |
| 89 |
); |
| 90 |
} |
| 91 |
add_action( 'customize_preview_init', 'sbp_customizer_section_live_preview' ); |
| 92 |
|
| 93 |
|
| 94 |
$theme = wp_get_theme(); |
| 95 |
if ( 'Short' == $theme->name || 'Bagility' == $theme->name ){ |
| 96 |
register_activation_hook( __FILE__, 'sbp_page_installation_function'); |
| 97 |
function sbp_page_installation_function() |
| 98 |
{ |
| 99 |
$item_details_page = get_option('item_details_page'); |
| 100 |
if(!$item_details_page){ |
| 101 |
require_once('inc/short/pages/home.php'); |
| 102 |
require_once('inc/short/pages/about.php'); |
| 103 |
require_once('inc/short/pages/blog.php'); |
| 104 |
require_once('inc/short/pages/contact.php'); |
| 105 |
update_option( 'item_details_page', 'Done' ); |
| 106 |
} |
| 107 |
} |
| 108 |
} |
| 109 |
|
| 110 |
function shortbuild_news_excerpt() { |
| 111 |
global $post; |
| 112 |
$excerpt = get_the_content(); |
| 113 |
$excerpt = strip_tags(preg_replace(" (\[.*?\])", '', $excerpt)); |
| 114 |
$excerpt = strip_shortcodes($excerpt); |
| 115 |
$original_len = strlen($excerpt); |
| 116 |
$short_excerpt_length = get_theme_mod('short_excerpt_length',180); |
| 117 |
$excerpt = substr($excerpt, 0, $short_excerpt_length); |
| 118 |
$len = strlen($excerpt); |
| 119 |
if ($original_len > 275) { |
| 120 |
$excerpt = $excerpt; |
| 121 |
return $excerpt . '<div class="news-excerpt-btn"><a href="' . esc_url(get_permalink()) . '" class="more-link">' . esc_html__("Read More", "shortbuild") . '</a></div>'; |
| 122 |
} else { |
| 123 |
return $excerpt; |
| 124 |
} |
| 125 |
} |