first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
* kc.extension.php
*
*/
if(!defined('ABSPATH')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
?>
<?php if (count($this->errors) > 0) { ?>
<div id="message" class="error">
<p><?php _e('There were some errors with the extensions are activated', 'kingcomposer'); ?>:</p>
<ol>
<?php
foreach ($this->errors as $error) {
echo '<li>'.$error.'</li>';
}
?>
</ol>
</div>
<?php } ?>
<?php
$this->list_table( $items, $actives );
?>

View File

@@ -0,0 +1,104 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
* kc.screen.tmpl.php
*
*/
if(!defined('ABSPATH')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
?>
<div class="wrap">
<?php
if ($this->tab == 'upload') {
do_action('kc_list_extensions_'.$this->tab, $this->page);
} else {
?>
<h1 class="wp-heading-inline"><?php _e('KC Extensions', 'kingcomposer'); ?></h1>
<?php if (empty($_GET['tab']) || $_GET['tab'] == 'store'){ ?>
<a href="#upload-extension" class="upload-view-toggle page-title-action" role="button" aria-expanded="false">
<span class="upload"><?php _e('Upload Extension', 'kingcomposer'); ?></span>
<span class="browse"><?php _e('Browse Plugins', 'kingcomposer'); ?></span>
</a>
<hr class="wp-header-end">
<p><font color="#888"><?php _e('If you have a KC Pro license. You can access all the extensions for free, multiple domains.', 'kingcomposer'); ?><?php
if (!class_exists('kc_pro')) {
echo ' <a href="'.admin_url('admin.php?page=kingcomposer#kc_pro').'">'.__('Go to KC Pro!', 'kingcomposer').'</a>';
} else {
echo ' <a href="'.admin_url('admin.php?page=kingcomposer#kc_product_license').'">'.__('KC Pro license', 'kingcomposer').'</a>';
}
?></font></p>
<div class="upload-plugin-wrap">
<div class="upload-plugin">
<p class="install-help">
<?php _e('If you have an extension in a .zip format, you may install it by uploading it here.', 'kingcomposer'); ?>
</p>
<form method="post" enctype="multipart/form-data" class="wp-upload-form" action="">
<input type="hidden" name="kc-nonce" value="<?php echo wp_create_nonce('kc-nonce'); ?>" />
<label class="screen-reader-text" for="extensionzip"><?php _e('Extension zip file', 'kingcomposer'); ?></label>
<input type="file" name="extensionzip" id="extensionzip" />
<input type="hidden" name="action" value="upload" />
<input type="hidden" name="kc-extension-action" value="upload" />
<input type="submit" name="install-kcextension-submit" class="button" value="Install Now" disabled="" />
</form>
</div>
</div>
<?php } else { ?>
<a href="<?php echo admin_url('admin.php?page=kc-extensions&tab=store'); ?>" class="upload-view-toggle page-title-action" role="button" aria-expanded="false"><span class="upload"><?php _e('Add new', 'kingcomposer'); ?></span></a>
<?php } ?>
<?php if (empty($_GET['tab']) || $_GET['tab'] == 'store'){ ?>
<div class="wp-filter">
<ul class="filter-links">
<li class="kc-extension-all">
<a href="admin.php?page=kc-extensions&tab=store&filter=all" class="<?php
if (empty($_GET['filter']) || $_GET['filter'] == 'all')
echo 'current';
?>">
<?php _e('All extensions', 'kingcomposer'); ?>
</a>
</li>
<li class="kc-extension-store">
<a href="admin.php?page=kc-extensions&tab=store&filter=free" class="<?php
if (!empty($_GET['filter']) && $_GET['filter'] == 'free')
echo 'current';
?>">
<?php _e('Free extensions', 'kingcomposer'); ?>
</a>
</li>
<li class="kc-extension-updates">
<a href="admin.php?page=kc-extensions&tab=store&filter=featured" class="<?php
if (!empty($_GET['filter']) && $_GET['filter'] == 'featured')
echo 'current';
?>">
<?php _e('Featured', 'kingcomposer'); ?>
</a>
</li>
<li class="kc-extension-updates">
<a href="admin.php?page=kc-extensions&tab=installed">
<?php _e('Installed', 'kingcomposer'); ?>
</a>
</li>
</ul>
<form class="search-form search-extensions" method="get" id="kc-extension-search">
<input type="hidden" name="tab" value="<?php echo isset($_GET['tab'])? $_GET['tab'] : ''; ?>">
<input type="hidden" name="page" value="kc-extensions">
<label class="screen-reader-text" for="typeselector"><?php _e('Search extensions by', 'kingcomposer'); ?>:</label>
<label>
<span class="screen-reader-text"><?php _e('Search Extensions', 'kingcomposer'); ?></span>
<input type="search" name="q" class="wp-filter-search" placeholder="<?php _e('Search Extensions', 'kingcomposer'); ?>" value="<?php echo isset($_GET['q']) ? esc_html($_GET['q']) : ''; ?>" aria-describedby="live-search-desc">
</label>
<input type="submit" id="search-submit" class="button hide-if-js" value="<?php _e('Search Extensions', 'kingcomposer'); ?>">
</form>
</div>
<?php } ?>
<form id="extensions-filter" method="post">
<?php do_action('kc_list_extensions_'.$this->tab, $this->page); ?>
<input type="hidden" name="kc-nonce" id="kc-nonce" value="<?php echo wp_create_nonce('kc-nonce'); ?>" />
<input type="hidden" name="kc-extension-action" value="filter" />
</form>
</div>
<?php } ?>
<script type="text/javascript" src="<?php echo esc_url(KC_URL); ?>/assets/js/kc.settings.js"></script>

View File

@@ -0,0 +1,172 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
* kc.store.tmpl.php
*
*/
if(!defined('ABSPATH')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
add_thickbox();
$url = admin_url('admin.php?page=kc-extensions&tab=store');
$query = isset($_GET['q']) && !empty($_GET['q']) ? esc_html(strtolower($_GET['q'])) : '';
$paged = isset($_GET['paged']) && !empty($_GET['paged']) ? esc_attr($_GET['paged']) : 1;
?>
<div class="wp-list-table widefat extension-install">
<?php
if (count($items) > 0) {
for ($i=0; $i < count($items); $i++) {
$item = $items[$i];
?>
<div class="plugin-card plugin-card-<?php echo sanitize_title($item['name']); ?>">
<div class="plugin-card-top">
<div class="name column-name">
<h3>
<?php if (isset($item['details']) && !empty($item['details'])) { ?>
<a href="<?php echo esc_url($item['details']); ?>" class="thickbox open-plugin-details-modal">
<?php } else { ?>
<a href="#" class="">
<?php } ?>
<?php echo esc_html($item['name']); ?>
<?php echo isset($item['featured']) && $item['featured'] == 1 ? '<font title="Featured" color="green">&star;</font>' : ''; ?>
<img src="<?php echo esc_url($item['thumbnail']); ?>" class="plugin-icon" alt="">
</a>
</h3>
</div>
<div class="action-links">
<ul class="plugin-action-buttons">
<li>
<price style="color: green;font-weight: bold;"><?php
echo (!empty($item['currency']) && isset($item['currency']) ? esc_html($item['currency']) : '');
echo (empty($item['price']) || $item['price'] === 0) ? 'Free' : esc_html($item['price']);
?></price>
</li>
<li>
<?php if (!isset($installs[$item['id']])) { ?>
<a class="install-now button" data-verify="<?php
echo (empty($item['price']) || $item['price'] === 0) ? '1' :
(!class_exists('kc_pro') ? '0' : (!empty($key) ? '1' : '2'));
?>" href="#<?php echo esc_html($item['id']); ?>">
<?php _e('Install Now', 'kingcomposer'); ?>
</a>
<?php } else { ?>
<a class="install-now button <?php
echo (
(isset($actives[$item['id']]) && $actives[$item['id']] == 1) ?
'button-link-delete' :
'button-primary'
);
?>" data-verify="1" data-installed="true" href="#<?php echo esc_html($item['id']); ?>">
<?php
echo (isset($actives[$item['id']]) && $actives[$item['id']] == 1) ?
_e('Deactive', 'kingcomposer') :
_e('Active Now', 'kingcomposer');
?>
</a>
<?php } ?>
</li>
<?php if (isset($item['details']) && !empty($item['details'])) { ?>
<li>
<a class="thickbox" href="<?php echo esc_url($item['details']); ?>">
<?php _e('More details', 'kingcomposer'); ?>
</a>
</li>
<?php } ?>
</ul>
</div>
<div class="desc column-description">
<p><?php echo $item['description']; ?></p>
<p class="authors">
<cite>
<?php _e('By', 'kingcomposer'); ?>
<a href="<?php echo esc_url($item['author_link']); ?>" target=_blank>
<?php echo esc_html($item['author']); ?>
</a>
</cite>
</p>
</div>
</div>
<div class="plugin-card-bottom">
<div class="column-updated">
<strong>
<?php _e('Last Updated', 'kingcomposer'); ?>:
</strong>
<?php echo esc_html($item['last_updated']); ?>
</div>
<div class="column-downloaded">
<?php _e('Download', 'kingcomposer'); ?> <?php echo esc_html($item['download']); ?> |
<?php _e('Version', 'kingcomposer'); ?> <?php echo esc_html($item['version']); ?>
</div>
</div>
</div>
<?php
}
} else {
echo '<center><h2 style="color: #888; margin-top: 50px">'.__('No items found', 'kingcomposer').'</h2></center>';;
}
?>
</div>
<?php if ($pages > 1) { ?>
<div class="tablenav bottom">
<div class="tablenav-pages">
<span class="displaying-num"><?php echo $total; ?> <?php _e('items', 'kingcomposer'); ?></span>
<span class="pagination-links">
<?php if($paged == 1) { ?>
<span class="tablenav-pages-navspan" aria-hidden="true">«</span>
<span class="tablenav-pages-navspan" aria-hidden="true"></span>
<?php } else { ?>
<a class="last-page" href="<?php echo esc_url($url); ?>">
<span class="screen-reader-text"><?php _e('First page', 'kingcomposer'); ?></span>
<span aria-hidden="true">«</span>
</a>
<a class="prev-page" href="<?php echo esc_url($url.'&paged='.($paged-1)); ?>">
<span class="screen-reader-text"><?php _e('Prev page', 'kingcomposer'); ?></span>
<span aria-hidden="true"></span>
</a>
<?php } ?>
<span class="screen-reader-text"><?php _e('Current Page', 'kingcomposer'); ?></span>
<span id="table-paging" class="paging-input">
<span class="tablenav-paging-text"><?php _e('Page', 'kingcomposer'); ?> <?php echo $paged; ?> of <span class="total-pages"><?php echo $pages; ?></span></span>
</span>
<?php if($paged < $pages) { ?>
<a class="next-page" href="<?php echo esc_url($url.'&paged='.($paged+1)); ?>">
<span class="screen-reader-text"><?php _e('Next page', 'kingcomposer'); ?></span>
<span aria-hidden="true"></span>
</a>
<a class="last-page" href="<?php echo esc_url($url.'&paged='.$pages); ?>">
<span class="screen-reader-text"><?php _e('Last page', 'kingcomposer'); ?></span>
<span aria-hidden="true">»</span>
</a>
<?php } else { ?>
<span class="tablenav-pages-navspan" aria-hidden="true"></span>
<span class="tablenav-pages-navspan" aria-hidden="true">»</span>
<?php } ?>
</span>
</div>
<br class="clear">
</div>
<?php } ?>
<div id="kc-extension-notice">
<div id="kc-extension-notice-body">
<p>
<?php
if (!class_exists('kc_pro')){
_e('We are sorry! extensions are currently only available for the pro version.', 'kingcomposer');
} else if (empty($key)){
_e('We are sorry! you need to verify your license before using extentions.', 'kingcomposer');
}
?>
</p>
<a href="#close"><i class="dashicons dashicons-no-alt"></i></a>
<a href="<?php echo admin_url('admin.php?page=kingcomposer#').(!class_exists('kc_pro') ? 'kc_pro' : 'kc_product_license'); ?>" class="prim"><?php _e('Go to KC Pro!', 'kingcomposer'); ?></a>
</div>
</div>

View File

@@ -0,0 +1,67 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
* kc.store.tmpl.php
*
*/
if(!defined('ABSPATH')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
?>
<h1><?php _e('Installing Extension from uploaded file', 'kingcomposer'); ?>: <?php echo esc_html($upload[0]); ?></h1>
<?php
if (count($errors) > 0) {
?>
<div class="kc-notice error" style="margin-top:30px;">
<?php foreach ($errors as $error) {
echo '<p>Error: '.esc_html($error).'</p>';
} ?>
</div>
<p>
<a href="<?php echo admin_url('admin.php?page=kc-extensions&tab=installed'); ?>">
<?php _e('Back to extentions', 'kingcomposer'); ?>
</a>
</p>
<div class="upload-plugin" style="display: block;">
<p class="install-help">
<?php _e('If you have an extension in a .zip format, you may install it by uploading it here.', 'kingcomposer'); ?>
</p>
<form method="post" enctype="multipart/form-data" class="wp-upload-form" action="">
<p>
<input type="hidden" name="kc-nonce" value="<?php echo wp_create_nonce('kc-nonce'); ?>" />
<label class="screen-reader-text" for="extensionzip"><?php _e('Extension zip file', 'kingcomposer'); ?></label>
<input type="file" name="extensionzip" id="extensionzip" />
<input type="hidden" name="action" value="upload" />
<input type="hidden" name="action" value="upload" />
<input type="hidden" name="kc-extension-action" value="upload" />
<input type="submit" name="install-kcextension-submit" class="button" value="<?php _e('Install Now', 'kingcomposer'); ?>" disabled="" />
</p>
</form>
</div>
<?php } else {?>
<p><?php _e('Uploading package', 'kingcomposer'); ?></p>
<p><?php _e('Unpacking extension', 'kingcomposer'); ?></p>
<p><?php _e('Installed successful', 'kingcomposer'); ?></p>
<p>
<form method="post" action="<?php echo admin_url('admin.php?page=kc-extensions&tab=installed'); ?>">
<button class="button button-primary"><?php _e('Active Extension', 'kingcomposer'); ?></button>
<input type="hidden" name="action" value="bulk-activate" />
<input type="hidden" name="checked[]" value="<?php echo sanitize_title($upload[1]); ?>" />
<input type="hidden" name="kc-nonce" value="<?php echo wp_create_nonce('kc-nonce'); ?>" />
<input type="hidden" name="kc-extension-action" value="active now" />
</form>
</p>
<p>
<a href="<?php echo admin_url('admin.php?page=kc-extensions&tab=installed'); ?>">
<?php _e('Return to extentions', 'kingcomposer'); ?>
</a>
</p>
<?
}
?>

View File

@@ -0,0 +1,23 @@
-----BEGIN CERTIFICATE-----
MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
+OkuE6N36B9K
-----END CERTIFICATE-----

View File

@@ -0,0 +1,179 @@
<?php
if(!defined('ABSPATH')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
// Add King Composer specific CSS class by filter
add_filter( 'body_class', 'kc_add_body_class' );
function kc_add_body_class( $classes ) {
global $post;
if ( isset($post) && has_shortcode( $post->post_content, 'kc_row' ) ){
$classes[] = 'kingcomposer';
}
$classes[] = 'kc-css-system';
return $classes;
}
//define var kc_script_data
function kc_header_js_var(){
echo '<script type="text/javascript">var kc_script_data={ajax_url:"'. admin_url( 'admin-ajax.php' ) .'"}</script>';
}
add_action('wp_head', 'kc_header_js_var');
//Convert col decimal format to class
function kc_column_width_class( $width ) {
if( empty( $width ) )
return 'kc_col-sm-12';
if( strpos( $width, '%' ) !== false ){
$width = (float)$width;
if( $width < 12 )
return 'kc_col-sm-1';
else if( $width < 18 )
return 'kc_col-sm-2';
else if( $width < 22.5 )
return 'kc_col-of-5';
else if( $width < 29.5 )
return 'kc_col-sm-3';
else if( $width < 37 )
return 'kc_col-sm-4';
else if( $width < 46 )
return 'kc_col-sm-5';
else if( $width < 54.5 )
return 'kc_col-sm-6';
else if( $width < 63 )
return 'kc_col-sm-7';
else if( $width < 71.5 )
return 'kc_col-sm-8';
else if( $width < 79.5 )
return 'kc_col-sm-9';
else if( $width < 87.5 )
return 'kc_col-sm-10';
else if( $width < 95.5 )
return 'kc_col-sm-11';
else return 'kc_col-sm-12';
}
$matches = explode( '/', $width ); $width_class = ''; $n = 12; $m = 12;
if( isset( $matches[0] ) && !empty( $matches[0] ) )
$n = $matches[0];
if( isset( $matches[1] ) && !empty( $matches[1] ) )
$m = $matches[1];
if( $n == 2.4){
$width_class = 'kc_col-of-5';
}else{
if ( $n > 0 && $m > 0 ) {
$value = ceil( ($n / $m) * 12 );
if ( $value > 0 && $value <= 12 ) {
$width_class = 'kc_col-sm-'. $value;
}
}
}
return $width_class;
}
//Return file assets url
function kc_asset_url($file){
$file = KC_URL.'/assets/'.$file;
return esc_url($file);
}
//Check external link
function kc_check_image_external_link($external_link){
if (@GetImageSize($external_link)) {
return true;
} else {
return false;
}
}
/*
* Validate Color to RGBA
* Takes the user's input color value and returns it only if it's a valid color.
*/
function kc_validate_color_rgba($color) {
if ($color == "transparent") {
return $color;
}
$color = str_replace('#','', $color);
if (strlen($color) == 3) {
$color = $color.$color;
}
if (preg_match('/^[a-f0-9]{6}$/i', $color)) {
$color = '#' . $color;
}
return array('hex'=>$color, 'rgba'=> kc_hex2rgba($color));
}
/*
* Takes the color hex value and converts to a rgba.
*/
function kc_hex2rgba($color, $opacity = false) {
$default = 'rgb(0,0,0)';
//Return default if no color provided
if(empty($color))
return $default;
//Sanitize $color if "#" is provided
if ($color[0] == '#' ) {
$color = substr( $color, 1 );
}
//Check if color has 6 or 3 characters and get values
if (strlen($color) == 6) {
$hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
} elseif ( strlen( $color ) == 3 ) {
$hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
} else {
return $default;
}
//Convert hexadec to rgb
$rgb = array_map('hexdec', $hex);
//Check if opacity is set(rgba or rgb)
if($opacity){
if(abs($opacity) > 1)
$opacity = 1.0;
$output = 'rgba('.implode(",",$rgb).','.$opacity.')';
} else {
$output = 'rgb('.implode(",",$rgb).')';
}
//Return rgb(a) color string
return $output;
}
function kc_parse_link( $link, $default = array( 'url' => '', 'title' => '', 'target' => '' ) ){
$result = $default;
$params_link = explode('|', $link);
if( !empty($params_link) ){
$result['url'] = rawurldecode(isset($params_link[0])?$params_link[0]:'#');
$result['title'] = isset($params_link[1])?$params_link[1]:'';
$result['target'] = isset($params_link[2])?$params_link[2]:'';
}
return $result;
}
function kc_basic_layout_css(){
return '*{-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box}div{display: block}.kc-container{width:100%;max-width:1170px;margin:0 auto;padding-left:15px;padding-right:15px;box-sizing:border-box}.kc-row-container:not(.kc-container){padding-left:0;padding-right:0;width:100%;max-width:100%}.kc-elm{float: left;width: 100%;}.kc_wrap-video-bg{height:100%;left:0;overflow:hidden;pointer-events:none;position:absolute;top:0;width:100%;z-index:0}.kc_single_image img{max-width:100%}.kc-video-bg .kc_column{position:relative}.kc-infinite-loop{text-align:center;padding:50px;font-size:18px;color:red;width:100%;display:inline-block}.kc_row:not(.kc_row_inner){clear:both;display:block;width:100%}.kc-wrap-columns,.kc_row_inner{clear:both}.kc_row.kc_row_inner{width: calc(100% + 30px);}.kc_tab_content>.kc_row_inner{width:100%;margin:0}.kc_column,.kc_column_inner{min-height:1px;position:relative;padding-right:15px;padding-left:15px;width:100%;float:left}div.kc_column,div.kc_column_inner{clear:none}div[data-kc-fullheight]{min-height:100vh}html body div[data-kc-parallax=true]{background-position:50% 0;background-size:100%!important;background-repeat:no-repeat!important;background-attachment:fixed!important}div[data-kc-fullwidth]{margin-left:0!important;margin-right:0!important;position:relative;box-sizing:content-box}.kc_text_block{display:inline-block;clear:both;width:100%}@media screen and (min-width:999px){body div[data-kc-equalheight=true],body div[data-kc-equalheight=true]>.kc-container{display:-webkit-flex!important;display:-ms-flexbox!important;display:flex!important}body div[data-kc-equalheight-align=middle]>.kc-container>.kc-wrap-columns>.kc_column>.kc-col-container{display:-webkit-flex!important;display:-ms-flexbox!important;display:flex!important;align-items:center;flex-wrap:wrap;justify-content:center;height:100%}body div[data-kc-equalheight-align=bottom]>.kc-container>.kc-wrap-columns>.kc_column>.kc-col-container{display:-webkit-flex!important;display:-ms-flexbox!important;display:flex!important;align-items:flex-end;flex-wrap:wrap;justify-content:center;height:100%}body div[data-kc-fullheight=middle-content],body div[data-kc-fullheight=middle-content]>.kc-container{display:-webkit-flex;display:-ms-flexbox;display:flex;align-items:center}.kc-wrap-columns,.kc_row_inner{display:-webkit-flex;display:-ms-flexbox;display:flex}.kc_row_inner, .kc-row-container.kc-container .kc-wrap-columns{width: calc(100% + 30px)}}@media screen and (max-width: 767px){body.kc-css-system .kc_column,body.kc-css-system .kc_column_inner{width: 100%}div.kc_row{display: block}}@media screen and (max-width: 999px){.kc_col-sm-3, div.kc_col-of-5{width: 50%}}.kc_col-sm-1{width: 8.33333%}.kc_col-sm-2{width: 16.6667%}div.kc_col-of-5{width: 20%;float: left}.kc_col-sm-3{width: 25%}.kc_col-sm-4{width: 33.3333%}.kc_col-sm-5{width: 41.6667%}.kc_col-sm-6{width: 50%}.kc_col-sm-7{width: 58.3333%}.kc_col-sm-8{width: 66.6667%}.kc_col-sm-9{width: 75%}.kc_col-sm-10{width: 83.3333%}.kc_col-sm-11{width: 91.6667%}.kc_col-sm-12{width: 100%}.kc-off-notice{display:none;}';
}

View File

@@ -0,0 +1,641 @@
<?php
/**
*
* KC ajax front end
* (c) KingComposer.com
*
*/
if(!defined('KC_FILE')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
class kc_ajax_front{
public function __construct(){
$ajax_events = array(
'instagrams_feed' => true,
'twitter_timeline' => true,
'facebook_recent_post' => true
);
foreach ( $ajax_events as $ajax_event => $nopriv ) {
add_action( 'wp_ajax_kc_' . $ajax_event, array( &$this, esc_attr( $ajax_event ) ) );
if ( $nopriv ) {
add_action( 'wp_ajax_nopriv_kc_' . $ajax_event, array( &$this, esc_attr( $ajax_event ) ) );
}
}
}
function facebook_recent_post(){
global $kc;
$output = $header_html = $fb_cover = '';
if( !isset( $_POST['cfg'] ) || empty( $_POST['cfg'] ) ){
wp_send_json( array(
'html' => '',
'header_data' => '',
'message' => __('Fail', 'kingcomposer')
));
exit;
}
$atts = (array) json_decode( base64_decode( $_POST['cfg'] ) );
$fb_app_id = $fb_page_id = $fb_app_secret = $number_post_show = '';
extract( $atts );
$fb_input_data = array(
'fb_page_id' => $fb_page_id,
'fb_app_id' => $kc->secrect_storage( $fb_app_id ),
'fb_app_secret' => $kc->secrect_storage( $fb_app_secret ),
'number_post_show' => $number_post_show
);
$fb_page_info = $this->get_facebook_page_feed( $fb_input_data, true );
if(isset($fb_page_info->id)){
if(isset($fb_page_info->cover->source)){
$fb_cover = 'background-image: url('. $fb_page_info->cover->source. ');';
}
$header_html .= '<div class="fb-header" style="'. esc_attr($fb_cover) .'">
<div class="overlay"></div>
<div class="fb-line-1">
<img class="img-profile" src="https://graph.facebook.com/'. $fb_page_id .'/picture?width=200" />
<span class="username">'. $fb_page_info->username .'</span>
<span class="likes">'. number_format( $fb_page_info->likes ) .' likes</span>
</div>
<div class="fb-line-2">
<a class="like_page" href="'. $fb_page_info->link .'" target="_blank"><i class="fa fa-facebook-square"></i> Like page</a>
<a class="share_page" href="http://www.facebook.com/sharer/sharer.php?u='. $fb_page_info->link .'" target="_blank"><i class="fa fa-share"></i> Share</a>
</div>
</div>';
}else{
$header_html .= __('Can not get page id', 'kingcomposer');
}
$fb_page_posts = $this->get_facebook_page_feed( $fb_input_data );
if ( isset( $open_link_new_window ) && $open_link_new_window == 'yes' ) {
$link_target = ' target="_blank"';
} else {
$link_target = '';
}
if($fb_page_posts){
foreach($fb_page_posts as $data => $value){
$fb_post_id = explode('_', $value->id);
$post_id = $fb_post_id[1];
$output .= '<li>';
if( isset( $show_image ) && $show_image == 'yes' ){
$a_end = '';
if( isset( $value->link ) ){
$output .= '<a href="'. esc_url($value->link) .'" '. $link_target .'>';
$a_end = '</a>';
}
if ( isset( $value->name ) ){
$alt = $value->name;
}
if( isset( $value->full_picture ) ){
$output .= '<img src="'. esc_url( $value->full_picture ) .'" alt="'. $alt .'">';
}
$output .= $a_end;
}
if( isset( $value->message ) ){
// remove emoji's
$_message = preg_replace( '/[\x{1F600}-\x{1F64F}]|[\x{1F300}-\x{1F5FF}]|[\x{1F680}-\x{1F6FF}]|[\x{1F1E0}-\x{1F1FF}]/u', '', $value->message );
$_message = sanitize_text_field( $_message ); // sanitize content
if(!empty($number_of_des) && $number_of_des > 0){
$_message = wp_trim_words( $_message, $number_of_des, $more = null );
}
$output .= '<div class="fb-message">'. $_message .'</div>';
}
if( !empty( $show_time ) || !empty( $show_like_count ) || !empty( $show_comment_count ) ){
$output .= '<div class="fb-post-info">';
$output .= '<a href="https://www.facebook.com/'. $fb_page_id .'/posts/'. $post_id .'" '. $link_target .'>';
if( isset( $show_like_count ) && $show_like_count == 'yes' ){
$output .= '<span class="fb-like"><i class="fa fa-thumbs-o-up"></i> '. ( isset( $value->likes->summary->total_count ) ? $value->likes->summary->total_count : 0) .'</span>';
}
if( isset( $show_comment_count ) && $show_comment_count == 'yes' ){
$output .= '<span class="fb-comment"><i class="fa fa-comment-o"></i> '. ( isset( $value->comments->summary->total_count ) ? $value->comments->summary->total_count : 0) .'</span>';
}
if( isset( $show_time ) && $show_time == 'yes' ){
$_time = strtotime( $value->created_time );
$output .= '<span class="fb-time">'. $this->time_ago( $_time ) .'</span>';
}
$output .= '</a>';
$output .= '</div>';
}
$output .= '</li>';
}
}else{
$output .= __('Warning: Fill correct facebook infomation to show new feed.', 'kingcomposer');
}
$data = array(
'html' => $output,
'header_html' => $header_html,
'message' => __('ok', 'kingcomposer')
);
wp_send_json( $data );
}
function get_facebook_page_feed( $args = array(), $only_info = false ) {
global $kc;
$defaults = array(
'fb_page_id' => 'wordpress',
'number_post_show' => 10
);
$args = wp_parse_args( $args, $defaults );
$fb_page_id = $args['fb_page_id'];
$fb_app_id = !empty( $args['fb_app_id'] ) ? $args['fb_app_id'] : '301439076655535';
$fb_app_secret = !empty( $args['fb_app_secret'] ) ? $args['fb_app_secret'] : 'afddd33dc09cb364c79e8f0a46e7dff6';
$number_post_show = $args['number_post_show'];
if ( isset( $fb_page_id ) && isset( $fb_app_id ) && isset( $fb_app_secret ) && isset( $number_post_show ) ) {
$facebook_page_info_url = 'https://graph.facebook.com/'. $fb_page_id .'/?access_token='. $fb_app_id .'|'. $fb_app_secret;
$facebook_api_url = 'https://graph.facebook.com/' . $fb_page_id . '/posts?&access_token=' . $fb_app_id . '|' . $fb_app_secret . '&fields=id,picture,full_picture,actions,type,from,message,status_type,object_id,name,caption,description,link,created_time,comments.limit(1).summary(true),likes.limit(1).summary(true)&limit=' . $number_post_show;
if($only_info == true){
$result_data = json_decode( $this->file_get_contents( $facebook_page_info_url ) );
}else{
$facebook_data = json_decode( $this->file_get_contents( $facebook_api_url ) );
if( isset( $facebook_data ) && isset( $facebook_data->data ) )
$result_data = $facebook_data->data;
}
if ( isset( $result_data ) ) {
return $result_data;
} else {
return '';
}
} else {
return '';
}
}
function instagrams_feed(){
global $kc;
$html = '';
$count = 1;
if( !isset( $_POST['cfg'] ) || empty( $_POST['cfg'] ) ){
wp_send_json( array(
'html' => '',
'header_data' => '',
'message' => __('Fail', 'kingcomposer')
));
exit;
}
$atts = (array) json_decode( base64_decode( $_POST['cfg'] ) );
$access_token = $username = '';
extract( $atts );
$access_token = $kc->secrect_storage( $access_token );
$ins_feed_data = $this->get_instagrams_feed( $username, $access_token );
if($ins_feed_data)
{
foreach ( $ins_feed_data as $key => $value )
{
switch ($count%$columns_style) {
case '1':
$li_class = 'el-start';
break;
case '0':
$li_class = 'el-end';
break;
default:
$li_class = '';
break;
}
$html .= '<li class="'. esc_attr($li_class) .' loaded">'
.'<a href="'. esc_url( $value->link ) .'" target="_blank">'
.'<img src="'. esc_url( $value->images->$image_size->url ) .'" />'
.'</a></li>';
if($count >= $number_show){
break;
}
$count++;
}
}else{
$html .= __('Warning: Fill correct instagram infomation to show new feed.', 'kingcomposer');
}
$data = array(
'html' => $html,
'message' => __('ok', 'kingcomposer')
);
wp_send_json( $data );
}
/*
* twitter_timeline
* Add this function to wp_ajax_kc_twitter_timeline hook
* Get new tweets update from user
*/
function twitter_timeline() {
global $kc;
if( !isset( $_POST['cfg'] ) || empty( $_POST['cfg'] ) ){
wp_send_json( array(
'html' => '',
'header_data' => '',
'message' => __('Fail', 'kingcomposer')
));
exit;
}
$atts = (array) json_decode( base64_decode( $_POST['cfg'] ) );
extract( $atts );
$output = $css_class = $rand_class = '';
$display_style = (!empty($display_style)) ? $display_style : 1;
$twitter_feed_data = array();
$consumer_key = !empty($consumer_key) ? $kc->secrect_storage( $consumer_key ) : 'tHWsp0yQQioooQZJfXJdGP3d4';
$consumer_secret = !empty($consumer_secret) ? $kc->secrect_storage( $consumer_secret ) : 'bl1kN9xH6nf167d0SJXnv9V5ZXuGXSShr5CeimLXaIGcUEQnsp';
$access_token = !empty($access_token) ? $kc->secrect_storage( $access_token ) : '120290116-vmLx4sPp5O3hjhRxjpl28i0APJkCpg04YVsoZyb7';
$access_token_secrect = !empty($access_token_secrect) ? $kc->secrect_storage( $access_token_secrect ) : 'B9mAhgZhQG0cspt1doF2cxDky40OEatjftRI5NCmQh1pE';
$number_tweet = (!empty( $number_tweet )) ? $number_tweet : 5;
switch ($display_style) {
case '1':
$el_in_start = '<ul>';
$el_in_end = '</ul>';
$el_item_start = '<li>';
$el_item_end = '</li>';
break;
case '2':
$el_in_start = '<div class="kc-tweet-owl owl-carousel owl-theme">';
$el_in_end = '</div>';
$el_item_start = '<div class="item">';
$el_item_end = '</div>';
break;
default:
# code...
break;
}
if (
isset( $username )
&& isset( $consumer_key )
&& isset( $consumer_secret )
&& isset( $access_token )
&& isset( $access_token_secrect )
&& isset( $number_tweet )
){
$twitter_feed_data = $this->get_tweets_feed_data(
$consumer_key,
$consumer_secret,
$access_token,
$access_token_secrect,
$number_tweet,
$username
);
$header_data = '';
if( isset( $show_follow_button ) && $show_follow_button == 'yes' && $display_style == 1 ){
$header_data .= '<div class="tweet_user user_twitter">
<img src="https://twitter.com/' . esc_attr( $username ) . '/profile_image?size=normal" class="twitter_profile_avatar"/>
<a class="kc_twitter_follow" href="https://twitter.com/intent/user?screen_name='. esc_attr( $username ) .'" target="_blank"><i class="fa fa-twitter"></i>Follow Us</a>
<span class="screen_name">@'. esc_html( $username ). '</span>
</div>';
}
if(isset($twitter_feed_data)){
$output .= $el_in_start;
foreach($twitter_feed_data as $tweet){
if( empty( $tweet['text'] ) )
continue;
$latestTweet = $tweet['text'];
//Convert plain text URLs into HTML hyperlinks
$latestTweet = preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1" target="_blank">$1</a>', $latestTweet);
//Convert @username twiter to link clickable
$latestTweet = preg_replace('/(^|\s)@([a-z0-9_]+)/i', '&nbsp;<a href="http://twitter.com/$2" target="_blank">@$2</a>&nbsp;', $latestTweet);
//Automatically create email link from a static text
$latestTweet = preg_replace('/(\S+@\S+\.\S+)/', '&nbsp;<a href="mailto:$1">$1</a>&nbsp;', $latestTweet);
$twitterTime = strtotime( $tweet['created_at'] );
$timeAgo = $this->time_ago( $twitterTime );
$output .= $el_item_start;
if(!empty( $latestTweet )){
$avatar = '';
$has_avatar = '';
if ( isset( $show_avatar ) && $show_avatar == 'yes' ){
//$avatar = '<span class="kc_tweet_icon"><i class="fa fa-twitter"></i></span>';
if(isset($tweet['user']['profile_image_url'])){
$avatar = '<span class="user_twitter"><img src="'. esc_url($tweet['user']['profile_image_url']) .'" /></span>';
$has_avatar = ' show_avatar';
}
}
if($display_style == 1){
$output .= '<div class="tweet_desc' . $has_avatar . '">'. $avatar. '
<span class="name">'. esc_html($tweet['user']['name']) .'</span>
<span class="screen_name">@'. esc_html($tweet['user']['screen_name']) .'</span>
<span class="description">' . $latestTweet . '</span></div>';
}else {
$output .= '<div class="tweet_desc">
<span class="description">' . $latestTweet . '</span></div>';
}
}
$output .= '<div class="twitter-footer' . $has_avatar . '">';
if( isset( $show_time ) && $show_time == 'yes' ){
$output .= '<span class="tweet_date">'. $timeAgo .'</span>';
}
if( isset( $show_reply ) && $show_reply == 'yes' ){
$output .= '<span class="tweet_reply"><a href="https://twitter.com/intent/tweet?in_reply_to='. esc_attr( $tweet['id_str'] ) .'" title="Reply"><i class="fa fa-reply"></i></a></span>';
}
if( isset( $show_retweet ) && $show_retweet == 'yes' ){
$output .= '<span class="tweet_retweet"><a href="https://twitter.com/intent/retweet?tweet_id='. esc_attr( $tweet['id_str'] ) .'" title="Retweet"><i class="fa fa-retweet"></i></a></span>';
}
$output .= '</div>';
$output .= $el_item_end;
}
$output .= $el_in_end;
if( isset( $show_follow_button ) && $show_follow_button == 'yes' && $display_style == 2 ){
$output .= '<div class="tweet_user user_twitter">
<a class="kc_twitter_follow" href="https://twitter.com/intent/user?screen_name='. esc_attr( $username ) .'" target="_blank"><i class="fa fa-twitter"></i>Follow Us</a>
</div>';
}
}
}
$data = array(
'html' => $output,
'header_data' => $header_data,
'message' => __('Ok', 'kingcomposer')
);
wp_send_json( $data );
}
/*
* get_tweets_feed_data
* @ $consumer_key
* @ $consumer_secret
* @ $access_token
* @ $access_token_secret
* @ $number_tweet
* @ $username
* Get new tweets update from user
*/
function get_tweets_feed_data( $consumer_key, $consumer_secret, $access_token, $access_token_secret, $number_tweet, $username ) {
$rd_twitter = kc_random_string( 20 );
$trans_name = 'list_tweets_'.$rd_twitter;
$twitter_cache_time = 10;
if(false === ($twitter_twitter_data = get_transient($trans_name))) {
$twitter_token = get_option('cfTwitterToken_'.$rd_twitter);
// get a new token anyways
delete_option('cfTwitterToken_'.$rd_twitter);
// getting new auth bearer only if we don't have one
if(!$twitter_token) {
// preparing credentials
$twitter_credentials = $consumer_key . ':' . $consumer_secret;
$twitter_to_send = base64_encode( $twitter_credentials );
// http post arguments
$twitter_args = array(
'method' => 'POST',
'httpversion' => '1.1',
'blocking' => true,
'headers' => array(
'Authorization' => 'Basic ' . $twitter_to_send,
'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'
),
'body' => array( 'grant_type' => 'client_credentials' )
);
add_filter('https_ssl_verify', '__return_false');
$twitter_response = wp_remote_post('https://api.twitter.com/oauth2/token', $twitter_args);
$twitter_keys = json_decode(wp_remote_retrieve_body($twitter_response));
if($twitter_keys) {
// saving token to wp_options table
update_option('cfTwitterToken_'.$rd_twitter, $twitter_keys->access_token);
$twitter_token = $twitter_keys->access_token;
}
}
// we have bearer token wether we obtained it from API or from options
$twitter_args = array(
'httpversion' => '1.1',
'blocking' => true,
'headers' => array(
'Authorization' => "Bearer ".$twitter_token
)
);
add_filter('https_ssl_verify', '__return_false');
$twitter_api_url = 'https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name='.$username.'&count='.$number_tweet;
$twitter_response = wp_remote_get($twitter_api_url, $twitter_args);
set_transient($trans_name, wp_remote_retrieve_body($twitter_response), 60 * $twitter_cache_time);
}
@$twitter_feed_data = json_decode(get_transient($trans_name), true);
return $twitter_feed_data;
}
function time_ago($time) {
$periods = array(
__( 'second', 'kingcomposer' ),
__( 'minute', 'kingcomposer' ),
__( 'hour', 'kingcomposer' ),
__( 'day', 'kingcomposer' ),
__( 'week', 'kingcomposer' ),
__( 'month', 'kingcomposer' ),
__( 'year', 'kingcomposer' ),
__( 'decade', 'kingcomposer' )
);
$periods_plural = array(
__( 'seconds', 'kingcomposer' ),
__( 'minutes', 'kingcomposer' ),
__( 'hours', 'kingcomposer' ),
__( 'days', 'kingcomposer' ),
__( 'weeks', 'kingcomposer' ),
__( 'months', 'kingcomposer' ),
__( 'years', 'kingcomposer' ),
__( 'decades', 'kingcomposer' )
);
$lengths = array( '60', '60', '24', '7', '4.35', '12', '10' );
$now = time();
$difference = $now - $time;
$tense = __( 'ago', 'kingcomposer' );
for( $j = 0; $difference >= $lengths[$j] && $j < count( $lengths )-1; $j++ ) {
$difference /= $lengths[$j];
}
$difference = round( $difference );
if( $difference != 1 ) {
$periods[$j] = $periods_plural[$j];
}
return sprintf('%s %s %s', $difference, $periods[$j], $tense);
}
function get_instagrams_feed( $username, $access_token ) {
$ins_url = 'https://api.instagram.com/v1/users/self/?access_token=' . $access_token;
$ins_ch = curl_init();
curl_setopt($ins_ch, CURLOPT_URL, $ins_url);
curl_setopt($ins_ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ins_ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ins_ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ins_ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ins_ch, CURLOPT_CAINFO, KC_PATH . KDS . "includes/frontend/helpers/DigiCertHighAssuranceEVRootCA.cer");
curl_setopt($ins_ch, CURLOPT_FOLLOWLOCATION, 3);
$ins_json_data = curl_exec($ins_ch);
$ins_json_data = json_decode($ins_json_data);
if (isset($ins_json_data->data->username) && ($ins_json_data->data->username == strtolower($username))) {
$ins_user_id = $ins_json_data->data->id;
} else {
$ins_user_id = 0;
}
if ($ins_user_id) {
$ins_api_url = 'https://api.instagram.com/v1/users/' . $ins_user_id . '/media/recent?access_token=' . $access_token;
$ins_ch = curl_init();
curl_setopt($ins_ch, CURLOPT_URL, $ins_api_url);
curl_setopt($ins_ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ins_ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ins_ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ins_ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ins_ch, CURLOPT_CAINFO, KC_PATH. KDS . "includes/frontend/helpers/DigiCertHighAssuranceEVRootCA.cer");
curl_setopt($ins_ch, CURLOPT_FOLLOWLOCATION, 3);
$ins_data = curl_exec($ins_ch);
curl_close($ins_ch);
$ins_data = json_decode($ins_data);
return $ins_data->data;
} else {
return 0;
}
}
function get_instagram_user_id($username, $access_token) {
$ins_url = 'https://api.instagram.com/v1/users/self/?access_token=' . $access_token;
$ins_ch = curl_init();
curl_setopt($ins_ch, CURLOPT_URL, $ins_url);
curl_setopt($ins_ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ins_ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ins_ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ins_ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ins_ch, CURLOPT_CAINFO, KC_PATH. DS . "includes/frontend/helpers/DigiCertHighAssuranceEVRootCA.cer");
curl_setopt($ins_ch, CURLOPT_FOLLOWLOCATION, 3);
$ins_json_data = curl_exec($ins_ch);
$ins_json_data = json_decode($ins_json_data);
if (isset($ins_json_data->data->username) && ($ins_json_data->data->username == $username)) {
return $ins_json_data->data->id;
} else {
return 0;
}
}
function file_get_contents( $url ){
$url_ch = curl_init();
curl_setopt( $url_ch, CURLOPT_URL, $url );
curl_setopt( $url_ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $url_ch, CURLOPT_TIMEOUT, 20 );
curl_setopt( $url_ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $url_ch, CURLOPT_SSL_VERIFYHOST, false );
$_return = curl_exec( $url_ch );
curl_close( $url_ch );
return $_return;
}
}
#Start kc_ajax_front
new kc_ajax_front();

View File

@@ -0,0 +1,245 @@
<?php
/*
* Remove __empty__ code value
*/
function kc_remove_empty_code( $atts ){
$atts_tmp = array();
foreach( $atts as $key => $value ){
if('__empty__' === $value){
$atts_tmp[$key] = '';
}else{
$atts_tmp[$key] = $value;
}
}
return $atts_tmp;
}
//Row filter
function kc_row_filter( $atts ){
if( isset( $atts['video_bg'] ) && $atts['video_bg'] == 'yes' ){
wp_register_script('kc-youtube-iframe-api', 'https://www.youtube.com/iframe_api', null, KC_VERSION, true );
wp_enqueue_script('kc-youtube-iframe-api');
}
return $atts;
}
//Row filter
function kc_column_filter( $atts ){
if( isset( $atts['video_bg'] ) && $atts['video_bg'] == 'yes' ){
wp_register_script('kc-youtube-iframe-api', 'https://www.youtube.com/iframe_api', null, KC_VERSION, true );
wp_enqueue_script('kc-youtube-iframe-api');
}
return $atts;
}
function kc_row_inner_filter( $atts ){
if( isset( $atts['video_bg'] ) && $atts['video_bg'] == 'yes' ){
wp_register_script('kc-youtube-iframe-api', 'https://www.youtube.com/iframe_api', null, KC_VERSION, true );
wp_enqueue_script('kc-youtube-iframe-api');
}
return $atts;
}
//Tab filter
function kc_tabs_filter( $atts = array() ){
if( isset( $atts['type'] ) && $atts['type'] === 'slider_tabs' ){
wp_enqueue_script( 'owl-carousel' );
wp_enqueue_style( 'owl-theme' );
wp_enqueue_style( 'owl-carousel' );
}
return $atts;
}
function kc_tab_filter( $atts = array() ){
// Do your code here
global $kc_tab_id;
if( !isset( $kc_tab_id ) || empty( $kc_tab_id ) )
$kc_tab_id = array();
$i = 1; $_title = sanitize_title( !empty( $atts['title'] ) ? $atts['title'] : 'kc-tab' );
while( in_array( $_title, $kc_tab_id ) )
{
$i++;
$_title = sanitize_title( !empty( $atts['title'] ) ? $atts['title'] : 'kc-tab' ).$i;
}
array_push( $kc_tab_id, $_title );
$atts['tab_id'] = $_title;
return $atts;
}
function kc_box_filter( $atts = array() ){
global $kc_front;
if( isset( $atts['css_code'] ) && !empty( $atts['css_code'] ) ){
$kc_front->add_header_css( $atts['css_code'] );
}
return $atts;
}
function kc_video_play_filter( $atts = array() ){
if( isset( $atts['video_link'] ) && !empty( $atts['video_link'] ) ){
if(preg_match('/youtu\.be/i', $atts['video_link']) || preg_match('/youtube\.com\/watch/i', $atts['video_link'])){
$atts['check_video'] = 'true';
wp_enqueue_script('kc-youtube-api');
}else if( (preg_match('/vimeo\.com/i', $atts['video_link'] )) ){
$atts['check_video'] = 'true';
wp_enqueue_script('kc-vimeo-api');
}else{
$atts['check_video'] = 'false';
}
}else{
$atts['check_video'] = 'false';
}
if( isset( $atts['video_upload'] ) && !empty( $atts['video_upload'] ) ){
$atts['check_video'] = 'true';
}
wp_enqueue_script( 'kc-video-play' );
return $atts;
}
function kc_counter_box_filter( $atts = array() ){
wp_enqueue_script('waypoints');
wp_enqueue_script('counter-up');
return $atts;
}
function kc_carousel_post_filter( $atts = array() ){
$atts = kc_remove_empty_code( $atts );
extract( $atts );
wp_enqueue_script( 'owl-carousel' );
wp_enqueue_style( 'owl-theme' );
wp_enqueue_style( 'owl-carousel' );
return $atts;
}
/*
* Pie chart shortcode custom css
*/
function kc_pie_chart_filter( $atts = array() ){
global $kc_front;
wp_enqueue_script( 'easypie-chart' );
return $atts;
}
function kc_twitter_feed_filter( $atts = array() ){
global $kc_front;
$atts = kc_remove_empty_code( $atts );
extract( $atts );
if( isset( $display_style ) && '2' === $display_style ){
wp_enqueue_script( 'owl-carousel' );
wp_enqueue_style( 'owl-theme' );
wp_enqueue_style( 'owl-carousel' );
}
return $atts;
}
function kc_carousel_images_filter( $atts = array() ){
$atts = kc_remove_empty_code( $atts );
extract( $atts );
wp_enqueue_script( 'owl-carousel' );
wp_enqueue_style( 'owl-theme' );
wp_enqueue_style( 'owl-carousel' );
if( isset( $onclick ) && $onclick == 'lightbox' ){
wp_enqueue_script( 'prettyPhoto' );
wp_enqueue_style( 'prettyPhoto' );
}
return $atts;
}
function kc_image_gallery_filter( $atts = array() ){
global $kc_front;
$atts = kc_remove_empty_code( $atts );
extract( $atts );
wp_enqueue_script( 'masonry' );
if( isset( $click_action ) && 'lightbox' === $click_action ){
wp_enqueue_script( 'prettyPhoto' );
wp_enqueue_style( 'prettyPhoto' );
}
return $atts;
}
function kc_blog_posts_filter( $atts = array() ) {
if ( isset( $atts['layout'] ) && ($atts['layout'] == '1' || $atts['layout'] == '4') ) {
wp_enqueue_script( 'owl-carousel' );
wp_enqueue_style( 'owl-theme' );
wp_enqueue_style( 'owl-carousel' );
}
wp_enqueue_script( 'masonry' );
return $atts;
}
function kc_feature_box_filter( $atts = array() ){
if( isset( $atts['layout'] ) && $atts['layout'] == '2' ){
wp_enqueue_script( 'owl-carousel' );
wp_enqueue_style( 'owl-theme' );
wp_enqueue_style( 'owl-carousel' );
}
return $atts;
}

View File

@@ -0,0 +1,235 @@
/*!
* The Final Countdown for jQuery v2.1.0 (http://hilios.github.io/jQuery.countdown/)
* Copyright (c) 2015 Edson Hilios
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
(function(factory) {
"use strict";
if (typeof define === "function" && define.amd) {
define([ "jquery" ], factory);
} else {
factory(jQuery);
}
})(function($) {
"use strict";
var instances = [], matchers = [], defaultOptions = {
precision: 100,
elapse: false
};
matchers.push(/^[0-9]*$/.source);
matchers.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source);
matchers.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source);
matchers = new RegExp(matchers.join("|"));
function parseDateString(dateString) {
if (dateString instanceof Date) {
return dateString;
}
if (String(dateString).match(matchers)) {
if (String(dateString).match(/^[0-9]*$/)) {
dateString = Number(dateString);
}
if (String(dateString).match(/\-/)) {
dateString = String(dateString).replace(/\-/g, "/");
}
return new Date(dateString);
} else {
throw new Error("Couldn't cast `" + dateString + "` to a date object.");
}
}
var DIRECTIVE_KEY_MAP = {
Y: "years",
m: "months",
n: "daysToMonth",
w: "weeks",
d: "daysToWeek",
D: "totalDays",
H: "hours",
M: "minutes",
S: "seconds"
};
function escapedRegExp(str) {
var sanitize = str.toString().replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
return new RegExp(sanitize);
}
function strftime(offsetObject) {
return function(format) {
var directives = format.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);
if (directives) {
for (var i = 0, len = directives.length; i < len; ++i) {
var directive = directives[i].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/), regexp = escapedRegExp(directive[0]), modifier = directive[1] || "", plural = directive[3] || "", value = null;
directive = directive[2];
if (DIRECTIVE_KEY_MAP.hasOwnProperty(directive)) {
value = DIRECTIVE_KEY_MAP[directive];
value = Number(offsetObject[value]);
}
if (value !== null) {
if (modifier === "!") {
value = pluralize(plural, value);
}
if (modifier === "") {
if (value < 10) {
value = "0" + value.toString();
}
}
format = format.replace(regexp, value.toString());
}
}
}
format = format.replace(/%%/, "%");
return format;
};
}
function pluralize(format, count) {
var plural = "s", singular = "";
if (format) {
format = format.replace(/(:|;|\s)/gi, "").split(/\,/);
if (format.length === 1) {
plural = format[0];
} else {
singular = format[0];
plural = format[1];
}
}
if (Math.abs(count) === 1) {
return singular;
} else {
return plural;
}
}
var Countdown = function(el, finalDate, options) {
this.el = el;
this.$el = $(el);
this.interval = null;
this.offset = {};
this.options = $.extend({}, defaultOptions);
this.instanceNumber = instances.length;
instances.push(this);
this.$el.data("countdown-instance", this.instanceNumber);
if (options) {
if (typeof options === "function") {
this.$el.on("update.countdown", options);
this.$el.on("stoped.countdown", options);
this.$el.on("finish.countdown", options);
} else {
this.options = $.extend({}, defaultOptions, options);
}
}
this.setFinalDate(finalDate);
this.start();
};
$.extend(Countdown.prototype, {
start: function() {
if (this.interval !== null) {
clearInterval(this.interval);
}
var self = this;
this.update();
this.interval = setInterval(function() {
self.update.call(self);
}, this.options.precision);
},
stop: function() {
clearInterval(this.interval);
this.interval = null;
this.dispatchEvent("stoped");
},
toggle: function() {
if (this.interval) {
this.stop();
} else {
this.start();
}
},
pause: function() {
this.stop();
},
resume: function() {
this.start();
},
remove: function() {
this.stop.call(this);
instances[this.instanceNumber] = null;
delete this.$el.data().countdownInstance;
},
setFinalDate: function(value) {
this.finalDate = parseDateString(value);
},
update: function() {
if (this.$el.closest("html").length === 0) {
this.remove();
return;
}
var hasEventsAttached = $._data(this.el, "events") !== undefined, now = new Date(), newTotalSecsLeft;
newTotalSecsLeft = this.finalDate.getTime() - now.getTime();
newTotalSecsLeft = Math.ceil(newTotalSecsLeft / 1e3);
newTotalSecsLeft = !this.options.elapse && newTotalSecsLeft < 0 ? 0 : Math.abs(newTotalSecsLeft);
if (this.totalSecsLeft === newTotalSecsLeft || !hasEventsAttached) {
return;
} else {
this.totalSecsLeft = newTotalSecsLeft;
}
this.elapsed = now >= this.finalDate;
this.offset = {
seconds: this.totalSecsLeft % 60,
minutes: Math.floor(this.totalSecsLeft / 60) % 60,
hours: Math.floor(this.totalSecsLeft / 60 / 60) % 24,
days: Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7,
daysToWeek: Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7,
daysToMonth: Math.floor(this.totalSecsLeft / 60 / 60 / 24 % 30.4368),
totalDays: Math.floor(this.totalSecsLeft / 60 / 60 / 24),
weeks: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 7),
months: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 30.4368),
years: Math.abs(this.finalDate.getFullYear() - now.getFullYear())
};
if (!this.options.elapse && this.totalSecsLeft === 0) {
this.stop();
this.dispatchEvent("finish");
} else {
this.dispatchEvent("update");
}
},
dispatchEvent: function(eventName) {
var event = $.Event(eventName + ".countdown");
event.finalDate = this.finalDate;
event.elapsed = this.elapsed;
event.offset = $.extend({}, this.offset);
event.strftime = strftime(this.offset);
this.$el.trigger(event);
}
});
$.fn.countdown = function() {
var argumentsArray = Array.prototype.slice.call(arguments, 0);
return this.each(function() {
var instanceNumber = $(this).data("countdown-instance");
if (instanceNumber !== undefined) {
var instance = instances[instanceNumber], method = argumentsArray[0];
if (Countdown.prototype.hasOwnProperty(method)) {
instance[method].apply(instance, argumentsArray.slice(1));
} else if (String(method).match(/^[$A-Z_][0-9A-Z_$]*$/i) === null) {
instance.setFinalDate.call(instance, method);
instance.start();
} else {
$.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi, method));
}
} else {
new Countdown(this, argumentsArray[0], argumentsArray[1]);
}
});
};
});

View File

@@ -0,0 +1,22 @@
/*!
* The Final Countdown for jQuery v2.1.0 (http://hilios.github.io/jQuery.countdown/)
* Copyright (c) 2015 Edson Hilios
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){"use strict";function b(a){if(a instanceof Date)return a;if(String(a).match(g))return String(a).match(/^[0-9]*$/)&&(a=Number(a)),String(a).match(/\-/)&&(a=String(a).replace(/\-/g,"/")),new Date(a);throw new Error("Couldn't cast `"+a+"` to a date object.")}function c(a){var b=a.toString().replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");return new RegExp(b)}function d(a){return function(b){var d=b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);if(d)for(var f=0,g=d.length;g>f;++f){var h=d[f].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),j=c(h[0]),k=h[1]||"",l=h[3]||"",m=null;h=h[2],i.hasOwnProperty(h)&&(m=i[h],m=Number(a[m])),null!==m&&("!"===k&&(m=e(l,m)),""===k&&10>m&&(m="0"+m.toString()),b=b.replace(j,m.toString()))}return b=b.replace(/%%/,"%")}}function e(a,b){var c="s",d="";return a&&(a=a.replace(/(:|;|\s)/gi,"").split(/\,/),1===a.length?c=a[0]:(d=a[0],c=a[1])),1===Math.abs(b)?d:c}var f=[],g=[],h={precision:100,elapse:!1};g.push(/^[0-9]*$/.source),g.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g=new RegExp(g.join("|"));var i={Y:"years",m:"months",n:"daysToMonth",w:"weeks",d:"daysToWeek",D:"totalDays",H:"hours",M:"minutes",S:"seconds"},j=function(b,c,d){this.el=b,this.$el=a(b),this.interval=null,this.offset={},this.options=a.extend({},h),this.instanceNumber=f.length,f.push(this),this.$el.data("countdown-instance",this.instanceNumber),d&&("function"==typeof d?(this.$el.on("update.countdown",d),this.$el.on("stoped.countdown",d),this.$el.on("finish.countdown",d)):this.options=a.extend({},h,d)),this.setFinalDate(c),this.start()};a.extend(j.prototype,{start:function(){null!==this.interval&&clearInterval(this.interval);var a=this;this.update(),this.interval=setInterval(function(){a.update.call(a)},this.options.precision)},stop:function(){clearInterval(this.interval),this.interval=null,this.dispatchEvent("stoped")},toggle:function(){this.interval?this.stop():this.start()},pause:function(){this.stop()},resume:function(){this.start()},remove:function(){this.stop.call(this),f[this.instanceNumber]=null,delete this.$el.data().countdownInstance},setFinalDate:function(a){this.finalDate=b(a)},update:function(){if(0===this.$el.closest("html").length)return void this.remove();var b,c=void 0!==a._data(this.el,"events"),d=new Date;b=this.finalDate.getTime()-d.getTime(),b=Math.ceil(b/1e3),b=!this.options.elapse&&0>b?0:Math.abs(b),this.totalSecsLeft!==b&&c&&(this.totalSecsLeft=b,this.elapsed=d>=this.finalDate,this.offset={seconds:this.totalSecsLeft%60,minutes:Math.floor(this.totalSecsLeft/60)%60,hours:Math.floor(this.totalSecsLeft/60/60)%24,days:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToWeek:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToMonth:Math.floor(this.totalSecsLeft/60/60/24%30.4368),totalDays:Math.floor(this.totalSecsLeft/60/60/24),weeks:Math.floor(this.totalSecsLeft/60/60/24/7),months:Math.floor(this.totalSecsLeft/60/60/24/30.4368),years:Math.abs(this.finalDate.getFullYear()-d.getFullYear())},this.options.elapse||0!==this.totalSecsLeft?this.dispatchEvent("update"):(this.stop(),this.dispatchEvent("finish")))},dispatchEvent:function(b){var c=a.Event(b+".countdown");c.finalDate=this.finalDate,c.elapsed=this.elapsed,c.offset=a.extend({},this.offset),c.strftime=d(this.offset),this.$el.trigger(c)}}),a.fn.countdown=function(){var b=Array.prototype.slice.call(arguments,0);return this.each(function(){var c=a(this).data("countdown-instance");if(void 0!==c){var d=f[c],e=b[0];j.prototype.hasOwnProperty(e)?d[e].apply(d,b.slice(1)):null===String(e).match(/^[$A-Z_][0-9A-Z_$]*$/i)?(d.setFinalDate.call(d,e),d.start()):a.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi,e))}else new j(this,b[0],b[1])})}});

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

View File

@@ -0,0 +1,71 @@
/*
* Core Owl Carousel CSS File
* v1.3.3
*/
/* clearfix */
.owl-carousel .owl-wrapper:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
/* display none until init */
.owl-carousel{
display: none;
position: relative;
width: 100%;
-ms-touch-action: pan-y;
}
.owl-carousel .owl-wrapper{
display: none;
position: relative;
-webkit-transform: translate3d(0px, 0px, 0px);
}
.owl-carousel .owl-wrapper-outer{
overflow: hidden;
position: relative;
width: 100%;
}
.owl-carousel .owl-wrapper-outer.autoHeight{
-webkit-transition: height 500ms ease-in-out;
-moz-transition: height 500ms ease-in-out;
-ms-transition: height 500ms ease-in-out;
-o-transition: height 500ms ease-in-out;
transition: height 500ms ease-in-out;
}
.owl-carousel .owl-item{
float: left;
}
.owl-controls .owl-page,
.owl-controls .owl-buttons div{
cursor: pointer;
}
.owl-controls {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
/* mouse grab icon */
.grabbing {
cursor:url(grabbing.png) 8 8, move;
}
/* fix */
.owl-carousel .owl-wrapper,
.owl-carousel .owl-item{
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-webkit-transform: translate3d(0,0,0);
-moz-transform: translate3d(0,0,0);
-ms-transform: translate3d(0,0,0);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,100 @@
if(typeof Object.create!=="function"){Object.create=function(obj){function F(){}
F.prototype=obj;return new F();};}
(function($,window,document){var Carousel={init:function(options,el){var base=this;base.$elem=$(el);base.options=$.extend({},$.fn.owlCarousel.options,base.$elem.data(),options);base.userOptions=options;base.loadContent();},loadContent:function(){var base=this,url;function getData(data){var i,content="";if(typeof base.options.jsonSuccess==="function"){base.options.jsonSuccess.apply(this,[data]);}else{for(i in data.owl){if(data.owl.hasOwnProperty(i)){content+=data.owl[i].item;}}
base.$elem.html(content);}
base.logIn();}
if(typeof base.options.beforeInit==="function"){base.options.beforeInit.apply(this,[base.$elem]);}
if(typeof base.options.jsonPath==="string"){url=base.options.jsonPath;$.getJSON(url,getData);}else{base.logIn();}},logIn:function(){var base=this;base.$elem.data("owl-originalStyles",base.$elem.attr("style"));base.$elem.data("owl-originalClasses",base.$elem.attr("class"));base.$elem.css({opacity:0});base.orignalItems=base.options.items;base.checkBrowser();base.wrapperWidth=0;base.checkVisible=null;base.setVars();},setVars:function(){var base=this;if(base.$elem.children().length===0){return false;}
base.baseClass();base.eventTypes();base.$userItems=base.$elem.children();base.itemsAmount=base.$userItems.length;base.wrapItems();base.$owlItems=base.$elem.find(".owl-item");base.$owlWrapper=base.$elem.find(".owl-wrapper");base.playDirection="next";base.prevItem=0;base.prevArr=[0];base.currentItem=0;base.customEvents();base.onStartup();},onStartup:function(){var base=this;base.updateItems();base.calculateAll();base.buildControls();base.updateControls();base.response();base.moveEvents();base.stopOnHover();base.owlStatus();if(base.options.transitionStyle!==false){base.transitionTypes(base.options.transitionStyle);}
if(base.options.autoPlay===true){base.options.autoPlay=5000;}
base.play();base.$elem.find(".owl-wrapper").css("display","block");if(!base.$elem.is(":visible")){base.watchVisibility();}else{base.$elem.css("opacity",1);}
base.onstartup=false;base.eachMoveUpdate();if(typeof base.options.afterInit==="function"){base.options.afterInit.apply(this,[base.$elem]);}},eachMoveUpdate:function(){var base=this;if(base.options.lazyLoad===true){base.lazyLoad();}
if(base.options.autoHeight===true){base.autoHeight();}
base.onVisibleItems();if(typeof base.options.afterAction==="function"){base.options.afterAction.apply(this,[base.$elem]);}},updateVars:function(){var base=this;if(typeof base.options.beforeUpdate==="function"){base.options.beforeUpdate.apply(this,[base.$elem]);}
base.watchVisibility();base.updateItems();base.calculateAll();base.updatePosition();base.updateControls();base.eachMoveUpdate();if(typeof base.options.afterUpdate==="function"){base.options.afterUpdate.apply(this,[base.$elem]);}},reload:function(){var base=this;window.setTimeout(function(){base.updateVars();},0);},watchVisibility:function(){var base=this;if(base.$elem.is(":visible")===false){base.$elem.css({opacity:0});window.clearInterval(base.autoPlayInterval);window.clearInterval(base.checkVisible);}else{return false;}
base.checkVisible=window.setInterval(function(){if(base.$elem.is(":visible")){base.reload();base.$elem.animate({opacity:1},200);window.clearInterval(base.checkVisible);}},500);},wrapItems:function(){var base=this;base.$userItems.wrapAll("<div class=\"owl-wrapper\">").wrap("<div class=\"owl-item\"></div>");base.$elem.find(".owl-wrapper").wrap("<div class=\"owl-wrapper-outer\">");base.wrapperOuter=base.$elem.find(".owl-wrapper-outer");base.$elem.css("display","block");},baseClass:function(){var base=this,hasBaseClass=base.$elem.hasClass(base.options.baseClass),hasThemeClass=base.$elem.hasClass(base.options.theme);if(!hasBaseClass){base.$elem.addClass(base.options.baseClass);}
if(!hasThemeClass){base.$elem.addClass(base.options.theme);}},updateItems:function(){var base=this,width,i;if(base.options.responsive===false){return false;}
if(base.options.singleItem===true){base.options.items=base.orignalItems=1;base.options.itemsCustom=false;base.options.itemsDesktop=false;base.options.itemsDesktopSmall=false;base.options.itemsTablet=false;base.options.itemsTabletSmall=false;base.options.itemsMobile=false;return false;}
width=$(base.options.responsiveBaseWidth).width();if(width>(base.options.itemsDesktop[0]||base.orignalItems)){base.options.items=base.orignalItems;}
if(base.options.itemsCustom!==false){base.options.itemsCustom.sort(function(a,b){return a[0]-b[0];});for(i=0;i<base.options.itemsCustom.length;i+=1){if(base.options.itemsCustom[i][0]<=width){base.options.items=base.options.itemsCustom[i][1];}}}else{if(width<=base.options.itemsDesktop[0]&&base.options.itemsDesktop!==false){base.options.items=base.options.itemsDesktop[1];}
if(width<=base.options.itemsDesktopSmall[0]&&base.options.itemsDesktopSmall!==false){base.options.items=base.options.itemsDesktopSmall[1];}
if(width<=base.options.itemsTablet[0]&&base.options.itemsTablet!==false){base.options.items=base.options.itemsTablet[1];}
if(width<=base.options.itemsTabletSmall[0]&&base.options.itemsTabletSmall!==false){base.options.items=base.options.itemsTabletSmall[1];}
if(width<=base.options.itemsMobile[0]&&base.options.itemsMobile!==false){base.options.items=base.options.itemsMobile[1];}}
if(base.options.items>base.itemsAmount&&base.options.itemsScaleUp===true){base.options.items=base.itemsAmount;}},response:function(){var base=this,smallDelay,lastWindowWidth;if(base.options.responsive!==true){return false;}
lastWindowWidth=$(window).width();base.resizer=function(){if($(window).width()!==lastWindowWidth){if(base.options.autoPlay!==false){window.clearInterval(base.autoPlayInterval);}
window.clearTimeout(smallDelay);smallDelay=window.setTimeout(function(){lastWindowWidth=$(window).width();base.updateVars();},base.options.responsiveRefreshRate);}};$(window).resize(base.resizer);},updatePosition:function(){var base=this;base.jumpTo(base.currentItem);if(base.options.autoPlay!==false){base.checkAp();}},appendItemsSizes:function(){var base=this,roundPages=0,lastItem=base.itemsAmount-base.options.items;base.$owlItems.each(function(index){var $this=$(this);$this.css({"width":base.itemWidth}).data("owl-item",Number(index));if(index%base.options.items===0||index===lastItem){if(!(index>lastItem)){roundPages+=1;}}
$this.data("owl-roundPages",roundPages);});},appendWrapperSizes:function(){var base=this,width=base.$owlItems.length*base.itemWidth;base.$owlWrapper.css({"width":width*2,"left":0});base.appendItemsSizes();},calculateAll:function(){var base=this;base.calculateWidth();base.appendWrapperSizes();base.loops();base.max();},calculateWidth:function(){var base=this;base.itemWidth=Math.round(base.$elem.width()/ base.options.items);},max:function(){var base=this,maximum=((base.itemsAmount*base.itemWidth)-base.options.items*base.itemWidth)*-1;if(base.options.items>base.itemsAmount){base.maximumItem=0;maximum=0;base.maximumPixels=0;}else{base.maximumItem=base.itemsAmount-base.options.items;base.maximumPixels=maximum;}
return maximum;},min:function(){return 0;},loops:function(){var base=this,prev=0,elWidth=0,i,item,roundPageNum;base.positionsInArray=[0];base.pagesInArray=[];for(i=0;i<base.itemsAmount;i+=1){elWidth+=base.itemWidth;base.positionsInArray.push(-elWidth);if(base.options.scrollPerPage===true){item=$(base.$owlItems[i]);roundPageNum=item.data("owl-roundPages");if(roundPageNum!==prev){base.pagesInArray[prev]=base.positionsInArray[i];prev=roundPageNum;}}}},buildControls:function(){var base=this;if(base.options.navigation===true||base.options.pagination===true){base.owlControls=$("<div class=\"owl-controls\"/>").toggleClass("clickable",!base.browser.isTouch).appendTo(base.$elem);}
if(base.options.pagination===true){base.buildPagination();}
if(base.options.navigation===true){base.buildButtons();}},buildButtons:function(){var base=this,buttonsWrapper=$("<div class=\"owl-buttons\"/>");base.owlControls.append(buttonsWrapper);base.buttonPrev=$("<div/>",{"class":"owl-prev","html":base.options.navigationText[0]||""});base.buttonNext=$("<div/>",{"class":"owl-next","html":base.options.navigationText[1]||""});buttonsWrapper.append(base.buttonPrev).append(base.buttonNext);buttonsWrapper.on("touchstart.owlControls mousedown.owlControls","div[class^=\"owl\"]",function(event){event.preventDefault();});buttonsWrapper.on("touchend.owlControls mouseup.owlControls","div[class^=\"owl\"]",function(event){event.preventDefault();if($(this).hasClass("owl-next")){base.next();}else{base.prev();}});},buildPagination:function(){var base=this;base.paginationWrapper=$("<div class=\"owl-pagination\"/>");base.owlControls.append(base.paginationWrapper);base.paginationWrapper.on("touchend.owlControls mouseup.owlControls",".owl-page",function(event){event.preventDefault();if(Number($(this).data("owl-page"))!==base.currentItem){base.goTo(Number($(this).data("owl-page")),true);}});},updatePagination:function(){var base=this,counter,lastPage,lastItem,i,paginationButton,paginationButtonInner;if(base.options.pagination===false){return false;}
base.paginationWrapper.html("");counter=0;lastPage=base.itemsAmount-base.itemsAmount%base.options.items;for(i=0;i<base.itemsAmount;i+=1){if(i%base.options.items===0){counter+=1;if(lastPage===i){lastItem=base.itemsAmount-base.options.items;}
paginationButton=$("<div/>",{"class":"owl-page"});paginationButtonInner=$("<span></span>",{"text":base.options.paginationNumbers===true?counter:"","class":base.options.paginationNumbers===true?"owl-numbers":""});paginationButton.append(paginationButtonInner);paginationButton.data("owl-page",lastPage===i?lastItem:i);paginationButton.data("owl-roundPages",counter);base.paginationWrapper.append(paginationButton);}}
base.checkPagination();},checkPagination:function(){var base=this;if(base.options.pagination===false){return false;}
base.paginationWrapper.find(".owl-page").each(function(){if($(this).data("owl-roundPages")===$(base.$owlItems[base.currentItem]).data("owl-roundPages")){base.paginationWrapper.find(".owl-page").removeClass("active");$(this).addClass("active");}});},checkNavigation:function(){var base=this;if(base.options.navigation===false){return false;}
if(base.options.rewindNav===false){if(base.currentItem===0&&base.maximumItem===0){base.buttonPrev.addClass("disabled");base.buttonNext.addClass("disabled");}else if(base.currentItem===0&&base.maximumItem!==0){base.buttonPrev.addClass("disabled");base.buttonNext.removeClass("disabled");}else if(base.currentItem===base.maximumItem){base.buttonPrev.removeClass("disabled");base.buttonNext.addClass("disabled");}else if(base.currentItem!==0&&base.currentItem!==base.maximumItem){base.buttonPrev.removeClass("disabled");base.buttonNext.removeClass("disabled");}}},updateControls:function(){var base=this;base.updatePagination();base.checkNavigation();if(base.owlControls){if(base.options.items>=base.itemsAmount){base.owlControls.hide();}else{base.owlControls.show();}}},destroyControls:function(){var base=this;if(base.owlControls){base.owlControls.remove();}},next:function(speed){var base=this;if(base.isTransition){return false;}
base.currentItem+=base.options.scrollPerPage===true?base.options.items:1;if(base.currentItem>base.maximumItem+(base.options.scrollPerPage===true?(base.options.items-1):0)){if(base.options.rewindNav===true){base.currentItem=0;speed="rewind";}else{base.currentItem=base.maximumItem;return false;}}
base.goTo(base.currentItem,speed);},prev:function(speed){var base=this;if(base.isTransition){return false;}
if(base.options.scrollPerPage===true&&base.currentItem>0&&base.currentItem<base.options.items){base.currentItem=0;}else{base.currentItem-=base.options.scrollPerPage===true?base.options.items:1;}
if(base.currentItem<0){if(base.options.rewindNav===true){base.currentItem=base.maximumItem;speed="rewind";}else{base.currentItem=0;return false;}}
base.goTo(base.currentItem,speed);},goTo:function(position,speed,drag){var base=this,goToPixel;if(base.isTransition){return false;}
if(typeof base.options.beforeMove==="function"){base.options.beforeMove.apply(this,[base.$elem]);}
if(position>=base.maximumItem){position=base.maximumItem;}else if(position<=0){position=0;}
base.currentItem=base.owl.currentItem=position;if(base.options.transitionStyle!==false&&drag!=="drag"&&base.options.items===1&&base.browser.support3d===true){base.swapSpeed(0);if(base.browser.support3d===true){base.transition3d(base.positionsInArray[position]);}else{base.css2slide(base.positionsInArray[position],1);}
base.afterGo();base.singleItemTransition();return false;}
goToPixel=base.positionsInArray[position];if(base.browser.support3d===true){base.isCss3Finish=false;if(speed===true){base.swapSpeed("paginationSpeed");window.setTimeout(function(){base.isCss3Finish=true;},base.options.paginationSpeed);}else if(speed==="rewind"){base.swapSpeed(base.options.rewindSpeed);window.setTimeout(function(){base.isCss3Finish=true;},base.options.rewindSpeed);}else{base.swapSpeed("slideSpeed");window.setTimeout(function(){base.isCss3Finish=true;},base.options.slideSpeed);}
base.transition3d(goToPixel);}else{if(speed===true){base.css2slide(goToPixel,base.options.paginationSpeed);}else if(speed==="rewind"){base.css2slide(goToPixel,base.options.rewindSpeed);}else{base.css2slide(goToPixel,base.options.slideSpeed);}}
base.afterGo();},jumpTo:function(position){var base=this;if(typeof base.options.beforeMove==="function"){base.options.beforeMove.apply(this,[base.$elem]);}
if(position>=base.maximumItem||position===-1){position=base.maximumItem;}else if(position<=0){position=0;}
base.swapSpeed(0);if(base.browser.support3d===true){base.transition3d(base.positionsInArray[position]);}else{base.css2slide(base.positionsInArray[position],1);}
base.currentItem=base.owl.currentItem=position;base.afterGo();},afterGo:function(){var base=this;base.prevArr.push(base.currentItem);base.prevItem=base.owl.prevItem=base.prevArr[base.prevArr.length-2];base.prevArr.shift(0);if(base.prevItem!==base.currentItem){base.checkPagination();base.checkNavigation();base.eachMoveUpdate();if(base.options.autoPlay!==false){base.checkAp();}}
if(typeof base.options.afterMove==="function"&&base.prevItem!==base.currentItem){base.options.afterMove.apply(this,[base.$elem]);}},stop:function(){var base=this;base.apStatus="stop";window.clearInterval(base.autoPlayInterval);},checkAp:function(){var base=this;if(base.apStatus!=="stop"){base.play();}},play:function(){var base=this;base.apStatus="play";if(base.options.autoPlay===false){return false;}
window.clearInterval(base.autoPlayInterval);base.autoPlayInterval=window.setInterval(function(){base.next(true);},base.options.autoPlay);},swapSpeed:function(action){var base=this;if(action==="slideSpeed"){base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed));}else if(action==="paginationSpeed"){base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed));}else if(typeof action!=="string"){base.$owlWrapper.css(base.addCssSpeed(action));}},addCssSpeed:function(speed){return{"-webkit-transition":"all "+speed+"ms ease","-moz-transition":"all "+speed+"ms ease","-o-transition":"all "+speed+"ms ease","transition":"all "+speed+"ms ease"};},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"","transition":""};},doTranslate:function(pixels){return{"-webkit-transform":"translate3d("+pixels+"px, 0px, 0px)","-moz-transform":"translate3d("+pixels+"px, 0px, 0px)","-o-transform":"translate3d("+pixels+"px, 0px, 0px)","-ms-transform":"translate3d("+pixels+"px, 0px, 0px)","transform":"translate3d("+pixels+"px, 0px,0px)"};},transition3d:function(value){var base=this;base.$owlWrapper.css(base.doTranslate(value));},css2move:function(value){var base=this;base.$owlWrapper.css({"left":value});},css2slide:function(value,speed){var base=this;base.isCssFinish=false;base.$owlWrapper.stop(true,true).animate({"left":value},{duration:speed||base.options.slideSpeed,complete:function(){base.isCssFinish=true;}});},checkBrowser:function(){var base=this,translate3D="translate3d(0px, 0px, 0px)",tempElem=document.createElement("div"),regex,asSupport,support3d,isTouch;tempElem.style.cssText=" -moz-transform:"+translate3D+"; -ms-transform:"+translate3D+"; -o-transform:"+translate3D+"; -webkit-transform:"+translate3D+"; transform:"+translate3D;regex=/translate3d\(0px, 0px, 0px\)/g;asSupport=tempElem.style.cssText.match(regex);support3d=(asSupport!==null&&asSupport.length===1);isTouch="ontouchstart"in window||window.navigator.msMaxTouchPoints;base.browser={"support3d":support3d,"isTouch":isTouch};},moveEvents:function(){var base=this;if(base.options.mouseDrag!==false||base.options.touchDrag!==false){base.gestures();base.disabledEvents();}},eventTypes:function(){var base=this,types=["s","e","x"];base.ev_types={};if(base.options.mouseDrag===true&&base.options.touchDrag===true){types=["touchstart.owl mousedown.owl","touchmove.owl mousemove.owl","touchend.owl touchcancel.owl mouseup.owl"];}else if(base.options.mouseDrag===false&&base.options.touchDrag===true){types=["touchstart.owl","touchmove.owl","touchend.owl touchcancel.owl"];}else if(base.options.mouseDrag===true&&base.options.touchDrag===false){types=["mousedown.owl","mousemove.owl","mouseup.owl"];}
base.ev_types.start=types[0];base.ev_types.move=types[1];base.ev_types.end=types[2];},disabledEvents:function(){var base=this;base.$elem.on("dragstart.owl",function(event){event.preventDefault();});base.$elem.on("mousedown.disableTextSelect",function(e){if(e.which!==3)
return $(e.target).is('input, textarea, select, option');});},gestures:function(){var base=this,locals={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};base.isCssFinish=true;function getTouches(event){if(event.touches!==undefined){return{x:event.touches[0].pageX,y:event.touches[0].pageY};}
if(event.touches===undefined){if(event.pageX!==undefined){return{x:event.pageX,y:event.pageY};}
if(event.pageX===undefined){return{x:event.clientX,y:event.clientY};}}}
function swapEvents(type){if(type==="on"){$(document).on(base.ev_types.move,dragMove);$(document).on(base.ev_types.end,dragEnd);}else if(type==="off"){$(document).off(base.ev_types.move);$(document).off(base.ev_types.end);}}
function dragStart(event){var ev=event.originalEvent||event||window.event,position;if(ev.which===3){return true;}
if(base.itemsAmount<=base.options.items){return;}
if(base.isCssFinish===false&&!base.options.dragBeforeAnimFinish){return false;}
if(base.isCss3Finish===false&&!base.options.dragBeforeAnimFinish){return false;}
if(base.options.autoPlay!==false){window.clearInterval(base.autoPlayInterval);}
if(base.browser.isTouch!==true&&!base.$owlWrapper.hasClass("grabbing")){base.$owlWrapper.addClass("grabbing");}
base.newPosX=0;base.newRelativeX=0;$(this).css(base.removeTransition());position=$(this).position();locals.relativePos=position.left;locals.offsetX=getTouches(ev).x-position.left;locals.offsetY=getTouches(ev).y-position.top;swapEvents("on");locals.sliding=false;locals.targetElement=ev.target||ev.srcElement;}
function dragMove(event){var ev=event.originalEvent||event||window.event,minSwipe,maxSwipe;base.newPosX=getTouches(ev).x-locals.offsetX;base.newPosY=getTouches(ev).y-locals.offsetY;base.newRelativeX=base.newPosX-locals.relativePos;if(typeof base.options.startDragging==="function"&&locals.dragging!==true&&base.newRelativeX!==0){locals.dragging=true;base.options.startDragging.apply(base,[base.$elem]);}
if((base.newRelativeX>8||base.newRelativeX<-8)&&(base.browser.isTouch===true)){if(ev.preventDefault!==undefined){ev.preventDefault();}else{ev.returnValue=false;}
locals.sliding=true;}
if((base.newPosY>10||base.newPosY<-10)&&locals.sliding===false){$(document).off("touchmove.owl");}
minSwipe=function(){return base.newRelativeX / 5;};maxSwipe=function(){return base.maximumPixels+base.newRelativeX / 5;};base.newPosX=Math.max(Math.min(base.newPosX,minSwipe()),maxSwipe());if(base.browser.support3d===true){base.transition3d(base.newPosX);}else{base.css2move(base.newPosX);}}
function dragEnd(event){var ev=event.originalEvent||event||window.event,newPosition,handlers,owlStopEvent;ev.target=ev.target||ev.srcElement;locals.dragging=false;if(base.browser.isTouch!==true){base.$owlWrapper.removeClass("grabbing");}
if(base.newRelativeX<0){base.dragDirection=base.owl.dragDirection="left";}else{base.dragDirection=base.owl.dragDirection="right";}
if(base.newRelativeX!==0){newPosition=base.getNewPosition();base.goTo(newPosition,false,"drag");if(locals.targetElement===ev.target&&base.browser.isTouch!==true){$(ev.target).on("click.disable",function(ev){ev.stopImmediatePropagation();ev.stopPropagation();ev.preventDefault();$(ev.target).off("click.disable");});handlers=$._data(ev.target,"events").click;owlStopEvent=handlers.pop();handlers.splice(0,0,owlStopEvent);}}
swapEvents("off");}
base.$elem.on(base.ev_types.start,".owl-wrapper",dragStart);},getNewPosition:function(){var base=this,newPosition=base.closestItem();if(newPosition>base.maximumItem){base.currentItem=base.maximumItem;newPosition=base.maximumItem;}else if(base.newPosX>=0){newPosition=0;base.currentItem=0;}
return newPosition;},closestItem:function(){var base=this,array=base.options.scrollPerPage===true?base.pagesInArray:base.positionsInArray,goal=base.newPosX,closest=null;$.each(array,function(i,v){if(goal-(base.itemWidth / 20)>array[i+1]&&goal-(base.itemWidth / 20)<v&&base.moveDirection()==="left"){closest=v;if(base.options.scrollPerPage===true){base.currentItem=$.inArray(closest,base.positionsInArray);}else{base.currentItem=i;}}else if(goal+(base.itemWidth / 20)<v&&goal+(base.itemWidth / 20)>(array[i+1]||array[i]-base.itemWidth)&&base.moveDirection()==="right"){if(base.options.scrollPerPage===true){closest=array[i+1]||array[array.length-1];base.currentItem=$.inArray(closest,base.positionsInArray);}else{closest=array[i+1];base.currentItem=i+1;}}});return base.currentItem;},moveDirection:function(){var base=this,direction;if(base.newRelativeX<0){direction="right";base.playDirection="next";}else{direction="left";base.playDirection="prev";}
return direction;},customEvents:function(){var base=this;base.$elem.on("owl.next",function(){base.next();});base.$elem.on("owl.prev",function(){base.prev();});base.$elem.on("owl.play",function(event,speed){base.options.autoPlay=speed;base.play();base.hoverStatus="play";});base.$elem.on("owl.stop",function(){base.stop();base.hoverStatus="stop";});base.$elem.on("owl.goTo",function(event,item){base.goTo(item);});base.$elem.on("owl.jumpTo",function(event,item){base.jumpTo(item);});},stopOnHover:function(){var base=this;if(base.options.stopOnHover===true&&base.browser.isTouch!==true&&base.options.autoPlay!==false){base.$elem.on("mouseover",function(){base.stop();});base.$elem.on("mouseout",function(){if(base.hoverStatus!=="stop"){base.play();}});}},lazyLoad:function(){var base=this,i,$item,itemNumber,$lazyImg,follow;if(base.options.lazyLoad===false){return false;}
for(i=0;i<base.itemsAmount;i+=1){$item=$(base.$owlItems[i]);if($item.data("owl-loaded")==="loaded"){continue;}
itemNumber=$item.data("owl-item");$lazyImg=$item.find(".lazyOwl");if(typeof $lazyImg.data("src")!=="string"){$item.data("owl-loaded","loaded");continue;}
if($item.data("owl-loaded")===undefined){$lazyImg.hide();$item.addClass("loading").data("owl-loaded","checked");}
if(base.options.lazyFollow===true){follow=itemNumber>=base.currentItem;}else{follow=true;}
if(follow&&itemNumber<base.currentItem+base.options.items&&$lazyImg.length){base.lazyPreload($item,$lazyImg);}}},lazyPreload:function($item,$lazyImg){var base=this,iterations=0,isBackgroundImg;if($lazyImg.prop("tagName")==="DIV"){$lazyImg.css("background-image","url("+$lazyImg.data("src")+")");isBackgroundImg=true;}else{$lazyImg[0].src=$lazyImg.data("src");}
function showImage(){$item.data("owl-loaded","loaded").removeClass("loading");$lazyImg.removeAttr("data-src");if(base.options.lazyEffect==="fade"){$lazyImg.fadeIn(400);}else{$lazyImg.show();}
if(typeof base.options.afterLazyLoad==="function"){base.options.afterLazyLoad.apply(this,[base.$elem]);}}
function checkLazyImage(){iterations+=1;if(base.completeImg($lazyImg.get(0))||isBackgroundImg===true){showImage();}else if(iterations<=100){window.setTimeout(checkLazyImage,100);}else{showImage();}}
checkLazyImage();},autoHeight:function(){var base=this,$currentimg=$(base.$owlItems[base.currentItem]).find("img"),iterations;function addHeight(){var $currentItem=$(base.$owlItems[base.currentItem]).height();base.wrapperOuter.css("height",$currentItem+"px");if(!base.wrapperOuter.hasClass("autoHeight")){window.setTimeout(function(){base.wrapperOuter.addClass("autoHeight");},0);}}
function checkImage(){iterations+=1;if(base.completeImg($currentimg.get(0))){addHeight();}else if(iterations<=100){window.setTimeout(checkImage,100);}else{base.wrapperOuter.css("height","");}}
if($currentimg.get(0)!==undefined){iterations=0;checkImage();}else{addHeight();}},completeImg:function(img){var naturalWidthType;if(!img.complete){return false;}
naturalWidthType=typeof img.naturalWidth;if(naturalWidthType!=="undefined"&&img.naturalWidth===0){return false;}
return true;},onVisibleItems:function(){var base=this,i;if(base.options.addClassActive===true){base.$owlItems.removeClass("active");}
base.visibleItems=[];for(i=base.currentItem;i<base.currentItem+base.options.items;i+=1){base.visibleItems.push(i);if(base.options.addClassActive===true){$(base.$owlItems[i]).addClass("active");}}
base.owl.visibleItems=base.visibleItems;},transitionTypes:function(className){var base=this;base.outClass="owl-"+className+"-out";base.inClass="owl-"+className+"-in";},singleItemTransition:function(){var base=this,outClass=base.outClass,inClass=base.inClass,$currentItem=base.$owlItems.eq(base.currentItem),$prevItem=base.$owlItems.eq(base.prevItem),prevPos=Math.abs(base.positionsInArray[base.currentItem])+base.positionsInArray[base.prevItem],origin=Math.abs(base.positionsInArray[base.currentItem])+base.itemWidth / 2,animEnd='webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend';base.isTransition=true;base.$owlWrapper.addClass('owl-origin').css({"-webkit-transform-origin":origin+"px","-moz-perspective-origin":origin+"px","perspective-origin":origin+"px"});function transStyles(prevPos){return{"position":"relative","left":prevPos+"px"};}
$prevItem.css(transStyles(prevPos,10)).addClass(outClass).on(animEnd,function(){base.endPrev=true;$prevItem.off(animEnd);base.clearTransStyle($prevItem,outClass);});$currentItem.addClass(inClass).on(animEnd,function(){base.endCurrent=true;$currentItem.off(animEnd);base.clearTransStyle($currentItem,inClass);});},clearTransStyle:function(item,classToRemove){var base=this;item.css({"position":"","left":""}).removeClass(classToRemove);if(base.endPrev&&base.endCurrent){base.$owlWrapper.removeClass('owl-origin');base.endPrev=false;base.endCurrent=false;base.isTransition=false;}},owlStatus:function(){var base=this;base.owl={"userOptions":base.userOptions,"baseElement":base.$elem,"userItems":base.$userItems,"owlItems":base.$owlItems,"currentItem":base.currentItem,"prevItem":base.prevItem,"visibleItems":base.visibleItems,"isTouch":base.browser.isTouch,"browser":base.browser,"dragDirection":base.dragDirection};},clearEvents:function(){var base=this;base.$elem.off(".owl owl mousedown.disableTextSelect");$(document).off(".owl owl");$(window).off("resize",base.resizer);},unWrap:function(){var base=this;if(base.$elem.children().length!==0){base.$owlWrapper.unwrap();base.$userItems.unwrap().unwrap();if(base.owlControls){base.owlControls.remove();}}
base.clearEvents();base.$elem.attr("style",base.$elem.data("owl-originalStyles")||"").attr("class",base.$elem.data("owl-originalClasses"));},destroy:function(){var base=this;base.stop();window.clearInterval(base.checkVisible);base.unWrap();base.$elem.removeData();},reinit:function(newOptions){var base=this,options=$.extend({},base.userOptions,newOptions);base.unWrap();base.init(options,base.$elem);},addItem:function(htmlString,targetPosition){var base=this,position;if(!htmlString){return false;}
if(base.$elem.children().length===0){base.$elem.append(htmlString);base.setVars();return false;}
base.unWrap();if(targetPosition===undefined||targetPosition===-1){position=-1;}else{position=targetPosition;}
if(position>=base.$userItems.length||position===-1){base.$userItems.eq(-1).after(htmlString);}else{base.$userItems.eq(position).before(htmlString);}
base.setVars();},removeItem:function(targetPosition){var base=this,position;if(base.$elem.children().length===0){return false;}
if(targetPosition===undefined||targetPosition===-1){position=-1;}else{position=targetPosition;}
base.unWrap();base.$userItems.eq(position).remove();base.setVars();}};$.fn.owlCarousel=function(options){return this.each(function(){if($(this).data("owl-init")===true){return false;}
$(this).data("owl-init",true);var carousel=Object.create(Carousel);carousel.init(options,this);$.data(this,"owlCarousel",carousel);});};$.fn.owlCarousel.options={items:5,itemsCustom:false,itemsDesktop:[1199,4],itemsDesktopSmall:[979,3],itemsTablet:[768,2],itemsTabletSmall:false,itemsMobile:[479,1],singleItem:false,itemsScaleUp:false,slideSpeed:200,paginationSpeed:800,rewindSpeed:1000,autoPlay:false,stopOnHover:false,navigation:false,navigationText:["prev","next"],rewindNav:true,scrollPerPage:false,pagination:true,paginationNumbers:false,responsive:true,responsiveRefreshRate:200,responsiveBaseWidth:window,baseClass:"owl-carousel",theme:"owl-theme",lazyLoad:false,lazyFollow:true,lazyEffect:"fade",autoHeight:false,jsonPath:false,jsonSuccess:false,dragBeforeAnimFinish:true,mouseDrag:true,touchDrag:true,addClassActive:false,transitionStyle:false,beforeUpdate:false,afterUpdate:false,beforeInit:false,afterInit:false,beforeMove:false,afterMove:false,afterAction:false,startDragging:false,afterLazyLoad:false};}(jQuery,window,document));

View File

@@ -0,0 +1,91 @@
/*
* Owl Carousel Owl Demo Theme
* v1.3.3
*/
.owl-theme.left .owl-controls{
margin-top: 0px;
text-align: left;
}
.owl-theme .owl-controls{
margin-top: 20px;
text-align: center;
}
/* Styling Next and Prev buttons */
.owl-theme .owl-controls .owl-buttons div{
color: #FFF;
display: inline-block;
zoom: 1;
*display: inline;/*IE7 life-saver */
margin: 5px;
padding: 3px 10px;
font-size: 8px;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
background: #272727;
filter: Alpha(Opacity=50);/*IE7 fix*/
opacity: 0.5;
}
/* Clickable class fix problem with hover on touch devices */
/* Use it for non-touch hover action */
.owl-theme .owl-controls.clickable .owl-buttons div:hover{
filter: Alpha(Opacity=100);/*IE7 fix*/
opacity: 1;
text-decoration: none;
}
/* Styling Pagination*/
.owl-theme .owl-controls .owl-page{
display: inline-block;
zoom: 1;
*display: inline;/*IE7 life-saver */
}
.owl-theme .owl-controls .owl-page span{
display: block;
width: 8px;
height: 8px;
margin: 5px 3px;
filter: Alpha(Opacity=30);/*IE7 fix*/
opacity: 0.3;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
background: #272727;
}
.owl-theme .owl-controls .owl-page.active span,
.owl-theme .owl-controls.clickable .owl-page:hover span{
filter: Alpha(Opacity=100);/*IE7 fix*/
opacity: 1;
}
.owl-theme.lightbults .owl-controls .owl-page span{
background: #fff;
}
.owl-theme.lightbults .owl-controls .owl-page.active span,
.owl-theme.lightbults .owl-controls.clickable .owl-page:hover span{
filter: Alpha(Opacity=100);/*IE7 fix*/
opacity: 1;
}
/* If PaginationNumbers is true */
.owl-theme .owl-controls .owl-page span.owl-numbers{
height: auto;
width: auto;
color: #FFF;
padding: 2px 10px;
font-size: 12px;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
}
/* preloading images */
.owl-item.loading{
min-height: 150px;
background: url(AjaxLoader.gif) no-repeat center center
}

View File

@@ -0,0 +1,163 @@
/*
* Owl Carousel CSS3 Transitions
* v1.3.2
*/
.owl-origin {
-webkit-perspective: 1200px;
-webkit-perspective-origin-x : 50%;
-webkit-perspective-origin-y : 50%;
-moz-perspective : 1200px;
-moz-perspective-origin-x : 50%;
-moz-perspective-origin-y : 50%;
perspective : 1200px;
}
/* fade */
.owl-fade-out {
z-index: 10;
-webkit-animation: fadeOut .7s both ease;
-moz-animation: fadeOut .7s both ease;
animation: fadeOut .7s both ease;
}
.owl-fade-in {
-webkit-animation: fadeIn .7s both ease;
-moz-animation: fadeIn .7s both ease;
animation: fadeIn .7s both ease;
}
/* backSlide */
.owl-backSlide-out {
-webkit-animation: backSlideOut 1s both ease;
-moz-animation: backSlideOut 1s both ease;
animation: backSlideOut 1s both ease;
}
.owl-backSlide-in {
-webkit-animation: backSlideIn 1s both ease;
-moz-animation: backSlideIn 1s both ease;
animation: backSlideIn 1s both ease;
}
/* goDown */
.owl-goDown-out {
-webkit-animation: scaleToFade .7s ease both;
-moz-animation: scaleToFade .7s ease both;
animation: scaleToFade .7s ease both;
}
.owl-goDown-in {
-webkit-animation: goDown .6s ease both;
-moz-animation: goDown .6s ease both;
animation: goDown .6s ease both;
}
/* scaleUp */
.owl-fadeUp-in {
-webkit-animation: scaleUpFrom .5s ease both;
-moz-animation: scaleUpFrom .5s ease both;
animation: scaleUpFrom .5s ease both;
}
.owl-fadeUp-out {
-webkit-animation: scaleUpTo .5s ease both;
-moz-animation: scaleUpTo .5s ease both;
animation: scaleUpTo .5s ease both;
}
/* Keyframes */
/*empty*/
@-webkit-keyframes empty {
0% {opacity: 1}
}
@-moz-keyframes empty {
0% {opacity: 1}
}
@keyframes empty {
0% {opacity: 1}
}
@-webkit-keyframes fadeIn {
0% { opacity:0; }
100% { opacity:1; }
}
@-moz-keyframes fadeIn {
0% { opacity:0; }
100% { opacity:1; }
}
@keyframes fadeIn {
0% { opacity:0; }
100% { opacity:1; }
}
@-webkit-keyframes fadeOut {
0% { opacity:1; }
100% { opacity:0; }
}
@-moz-keyframes fadeOut {
0% { opacity:1; }
100% { opacity:0; }
}
@keyframes fadeOut {
0% { opacity:1; }
100% { opacity:0; }
}
@-webkit-keyframes backSlideOut {
25% { opacity: .5; -webkit-transform: translateZ(-500px); }
75% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(-200%); }
100% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(-200%); }
}
@-moz-keyframes backSlideOut {
25% { opacity: .5; -moz-transform: translateZ(-500px); }
75% { opacity: .5; -moz-transform: translateZ(-500px) translateX(-200%); }
100% { opacity: .5; -moz-transform: translateZ(-500px) translateX(-200%); }
}
@keyframes backSlideOut {
25% { opacity: .5; transform: translateZ(-500px); }
75% { opacity: .5; transform: translateZ(-500px) translateX(-200%); }
100% { opacity: .5; transform: translateZ(-500px) translateX(-200%); }
}
@-webkit-keyframes backSlideIn {
0%, 25% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(200%); }
75% { opacity: .5; -webkit-transform: translateZ(-500px); }
100% { opacity: 1; -webkit-transform: translateZ(0) translateX(0); }
}
@-moz-keyframes backSlideIn {
0%, 25% { opacity: .5; -moz-transform: translateZ(-500px) translateX(200%); }
75% { opacity: .5; -moz-transform: translateZ(-500px); }
100% { opacity: 1; -moz-transform: translateZ(0) translateX(0); }
}
@keyframes backSlideIn {
0%, 25% { opacity: .5; transform: translateZ(-500px) translateX(200%); }
75% { opacity: .5; transform: translateZ(-500px); }
100% { opacity: 1; transform: translateZ(0) translateX(0); }
}
@-webkit-keyframes scaleToFade {
to { opacity: 0; -webkit-transform: scale(.8); }
}
@-moz-keyframes scaleToFade {
to { opacity: 0; -moz-transform: scale(.8); }
}
@keyframes scaleToFade {
to { opacity: 0; transform: scale(.8); }
}
@-webkit-keyframes goDown {
from { -webkit-transform: translateY(-100%); }
}
@-moz-keyframes goDown {
from { -moz-transform: translateY(-100%); }
}
@keyframes goDown {
from { transform: translateY(-100%); }
}
@-webkit-keyframes scaleUpFrom {
from { opacity: 0; -webkit-transform: scale(1.5); }
}
@-moz-keyframes scaleUpFrom {
from { opacity: 0; -moz-transform: scale(1.5); }
}
@keyframes scaleUpFrom {
from { opacity: 0; transform: scale(1.5); }
}
@-webkit-keyframes scaleUpTo {
to { opacity: 0; -webkit-transform: scale(1.5); }
}
@-moz-keyframes scaleUpTo {
to { opacity: 0; -moz-transform: scale(1.5); }
}
@keyframes scaleUpTo {
to { opacity: 0; transform: scale(1.5); }
}

View File

@@ -0,0 +1,525 @@
/* ------------------------------------------------------------------------
This you can edit.
------------------------------------------------------------------------- */
/* ----------------------------------
Default Theme
----------------------------------- */
div.pp_default .pp_top,
div.pp_default .pp_top .pp_middle,
div.pp_default .pp_top .pp_left,
div.pp_default .pp_top .pp_right,
div.pp_default .pp_bottom,
div.pp_default .pp_bottom .pp_left,
div.pp_default .pp_bottom .pp_middle,
div.pp_default .pp_bottom .pp_right { height: 13px; }
div.pp_default .pp_top .pp_left { background: url(../images/prettyPhoto/default/sprite.png) -78px -93px no-repeat; } /* Top left corner */
div.pp_default .pp_top .pp_middle { background: url(../images/prettyPhoto/default/sprite_x.png) top left repeat-x; } /* Top pattern/color */
div.pp_default .pp_top .pp_right { background: url(../images/prettyPhoto/default/sprite.png) -112px -93px no-repeat; } /* Top right corner */
div.pp_default .pp_content .ppt { color: #f8f8f8; }
div.pp_default .pp_content_container .pp_left { background: url(../images/prettyPhoto/default/sprite_y.png) -7px 0 repeat-y; padding-left: 13px; }
div.pp_default .pp_content_container .pp_right { background: url(../images/prettyPhoto/default/sprite_y.png) top right repeat-y; padding-right: 13px; }
div.pp_default .pp_content { background-color: #fff; } /* Content background */
div.pp_default .pp_next:hover { background: url(../images/prettyPhoto/default/sprite_next.png) center right no-repeat; cursor: pointer; } /* Next button */
div.pp_default .pp_previous:hover { background: url(../images/prettyPhoto/default/sprite_prev.png) center left no-repeat; cursor: pointer; } /* Previous button */
div.pp_default .pp_expand { background: url(../images/prettyPhoto/default/sprite.png) 0 -29px no-repeat; cursor: pointer; width: 28px; height: 28px; } /* Expand button */
div.pp_default .pp_expand:hover { background: url(../images/prettyPhoto/default/sprite.png) 0 -56px no-repeat; cursor: pointer; } /* Expand button hover */
div.pp_default .pp_contract { background: url(../images/prettyPhoto/default/sprite.png) 0 -84px no-repeat; cursor: pointer; width: 28px; height: 28px; } /* Contract button */
div.pp_default .pp_contract:hover { background: url(../images/prettyPhoto/default/sprite.png) 0 -113px no-repeat; cursor: pointer; } /* Contract button hover */
div.pp_default .pp_close { width: 30px; height: 30px; background: url(../images/prettyPhoto/default/sprite.png) 2px 1px no-repeat; cursor: pointer; } /* Close button */
div.pp_default #pp_full_res .pp_inline { color: #000; }
div.pp_default .pp_gallery ul li a { background: url(../images/prettyPhoto/default/default_thumb.png) center center #f8f8f8; border:1px solid #aaa; }
div.pp_default .pp_gallery ul li a:hover,
div.pp_default .pp_gallery ul li.selected a { border-color: #fff; }
div.pp_default .pp_social { margin-top: 7px; }
div.pp_default .pp_gallery a.pp_arrow_previous,
div.pp_default .pp_gallery a.pp_arrow_next { position: static; left: auto; }
div.pp_default .pp_nav .pp_play,
div.pp_default .pp_nav .pp_pause { background: url(../images/prettyPhoto/default/sprite.png) -51px 1px no-repeat; height:30px; width:30px; }
div.pp_default .pp_nav .pp_pause { background-position: -51px -29px; }
div.pp_default .pp_details { position: relative; }
div.pp_default a.pp_arrow_previous,
div.pp_default a.pp_arrow_next { background: url(../images/prettyPhoto/default/sprite.png) -31px -3px no-repeat; height: 20px; margin: 4px 0 0 0; width: 20px; }
div.pp_default a.pp_arrow_next { left: 52px; background-position: -82px -3px; } /* The next arrow in the bottom nav */
div.pp_default .pp_content_container .pp_details { margin-top: 5px; }
div.pp_default .pp_nav { clear: none; height: 30px; width: 110px; position: relative; }
div.pp_default .pp_nav .currentTextHolder{ font-family: Georgia; font-style: italic; color:#999; font-size: 11px; left: 75px; line-height: 25px; margin: 0; padding: 0 0 0 10px; position: absolute; top: 2px; }
div.pp_default .pp_close:hover, div.pp_default .pp_nav .pp_play:hover, div.pp_default .pp_nav .pp_pause:hover, div.pp_default .pp_arrow_next:hover, div.pp_default .pp_arrow_previous:hover { opacity:0.7; }
div.pp_default .pp_description{ font-size: 11px; font-weight: bold; line-height: 14px; margin: 10px 50px 5px 0; }
div.pp_default .pp_bottom .pp_left { background: url(../images/prettyPhoto/default/sprite.png) -78px -127px no-repeat; } /* Bottom left corner */
div.pp_default .pp_bottom .pp_middle { background: url(../images/prettyPhoto/default/sprite_x.png) bottom left repeat-x; } /* Bottom pattern/color */
div.pp_default .pp_bottom .pp_right { background: url(../images/prettyPhoto/default/sprite.png) -112px -127px no-repeat; } /* Bottom right corner */
div.pp_default .pp_loaderIcon { background: url(../images/prettyPhoto/default/loader.gif) center center no-repeat; } /* Loader icon */
/* ----------------------------------
Light Rounded Theme
----------------------------------- */
div.light_rounded .pp_top .pp_left { background: url(../images/prettyPhoto/light_rounded/sprite.png) -88px -53px no-repeat; } /* Top left corner */
div.light_rounded .pp_top .pp_middle { background: #fff; } /* Top pattern/color */
div.light_rounded .pp_top .pp_right { background: url(../images/prettyPhoto/light_rounded/sprite.png) -110px -53px no-repeat; } /* Top right corner */
div.light_rounded .pp_content .ppt { color: #000; }
div.light_rounded .pp_content_container .pp_left,
div.light_rounded .pp_content_container .pp_right { background: #fff; }
div.light_rounded .pp_content { background-color: #fff; } /* Content background */
div.light_rounded .pp_next:hover { background: url(../images/prettyPhoto/light_rounded/btnNext.png) center right no-repeat; cursor: pointer; } /* Next button */
div.light_rounded .pp_previous:hover { background: url(../images/prettyPhoto/light_rounded/btnPrevious.png) center left no-repeat; cursor: pointer; } /* Previous button */
div.light_rounded .pp_expand { background: url(../images/prettyPhoto/light_rounded/sprite.png) -31px -26px no-repeat; cursor: pointer; } /* Expand button */
div.light_rounded .pp_expand:hover { background: url(../images/prettyPhoto/light_rounded/sprite.png) -31px -47px no-repeat; cursor: pointer; } /* Expand button hover */
div.light_rounded .pp_contract { background: url(../images/prettyPhoto/light_rounded/sprite.png) 0 -26px no-repeat; cursor: pointer; } /* Contract button */
div.light_rounded .pp_contract:hover { background: url(../images/prettyPhoto/light_rounded/sprite.png) 0 -47px no-repeat; cursor: pointer; } /* Contract button hover */
div.light_rounded .pp_close { width: 75px; height: 22px; background: url(../images/prettyPhoto/light_rounded/sprite.png) -1px -1px no-repeat; cursor: pointer; } /* Close button */
div.light_rounded .pp_details { position: relative; }
div.light_rounded .pp_description { margin-right: 85px; }
div.light_rounded #pp_full_res .pp_inline { color: #000; }
div.light_rounded .pp_gallery a.pp_arrow_previous,
div.light_rounded .pp_gallery a.pp_arrow_next { margin-top: 12px !important; }
div.light_rounded .pp_nav .pp_play { background: url(../images/prettyPhoto/light_rounded/sprite.png) -1px -100px no-repeat; height: 15px; width: 14px; }
div.light_rounded .pp_nav .pp_pause { background: url(../images/prettyPhoto/light_rounded/sprite.png) -24px -100px no-repeat; height: 15px; width: 14px; }
div.light_rounded .pp_arrow_previous { background: url(../images/prettyPhoto/light_rounded/sprite.png) 0 -71px no-repeat; } /* The previous arrow in the bottom nav */
div.light_rounded .pp_arrow_previous.disabled { background-position: 0 -87px; cursor: default; }
div.light_rounded .pp_arrow_next { background: url(../images/prettyPhoto/light_rounded/sprite.png) -22px -71px no-repeat; } /* The next arrow in the bottom nav */
div.light_rounded .pp_arrow_next.disabled { background-position: -22px -87px; cursor: default; }
div.light_rounded .pp_bottom .pp_left { background: url(../images/prettyPhoto/light_rounded/sprite.png) -88px -80px no-repeat; } /* Bottom left corner */
div.light_rounded .pp_bottom .pp_middle { background: #fff; } /* Bottom pattern/color */
div.light_rounded .pp_bottom .pp_right { background: url(../images/prettyPhoto/light_rounded/sprite.png) -110px -80px no-repeat; } /* Bottom right corner */
div.light_rounded .pp_loaderIcon { background: url(../images/prettyPhoto/light_rounded/loader.gif) center center no-repeat; } /* Loader icon */
/* ----------------------------------
Dark Rounded Theme
----------------------------------- */
div.dark_rounded .pp_top .pp_left { background: url(../images/prettyPhoto/dark_rounded/sprite.png) -88px -53px no-repeat; } /* Top left corner */
div.dark_rounded .pp_top .pp_middle { background: url(../images/prettyPhoto/dark_rounded/contentPattern.png) top left repeat; } /* Top pattern/color */
div.dark_rounded .pp_top .pp_right { background: url(../images/prettyPhoto/dark_rounded/sprite.png) -110px -53px no-repeat; } /* Top right corner */
div.dark_rounded .pp_content_container .pp_left { background: url(../images/prettyPhoto/dark_rounded/contentPattern.png) top left repeat-y; } /* Left Content background */
div.dark_rounded .pp_content_container .pp_right { background: url(../images/prettyPhoto/dark_rounded/contentPattern.png) top right repeat-y; } /* Right Content background */
div.dark_rounded .pp_content { background: url(../images/prettyPhoto/dark_rounded/contentPattern.png) top left repeat; } /* Content background */
div.dark_rounded .pp_next:hover { background: url(../images/prettyPhoto/dark_rounded/btnNext.png) center right no-repeat; cursor: pointer; } /* Next button */
div.dark_rounded .pp_previous:hover { background: url(../images/prettyPhoto/dark_rounded/btnPrevious.png) center left no-repeat; cursor: pointer; } /* Previous button */
div.dark_rounded .pp_expand { background: url(../images/prettyPhoto/dark_rounded/sprite.png) -31px -26px no-repeat; cursor: pointer; } /* Expand button */
div.dark_rounded .pp_expand:hover { background: url(../images/prettyPhoto/dark_rounded/sprite.png) -31px -47px no-repeat; cursor: pointer; } /* Expand button hover */
div.dark_rounded .pp_contract { background: url(../images/prettyPhoto/dark_rounded/sprite.png) 0 -26px no-repeat; cursor: pointer; } /* Contract button */
div.dark_rounded .pp_contract:hover { background: url(../images/prettyPhoto/dark_rounded/sprite.png) 0 -47px no-repeat; cursor: pointer; } /* Contract button hover */
div.dark_rounded .pp_close { width: 75px; height: 22px; background: url(../images/prettyPhoto/dark_rounded/sprite.png) -1px -1px no-repeat; cursor: pointer; } /* Close button */
div.dark_rounded .pp_details { position: relative; }
div.dark_rounded .pp_description { margin-right: 85px; }
div.dark_rounded .currentTextHolder { color: #c4c4c4; }
div.dark_rounded .pp_description { color: #fff; }
div.dark_rounded #pp_full_res .pp_inline { color: #fff; }
div.dark_rounded .pp_gallery a.pp_arrow_previous,
div.dark_rounded .pp_gallery a.pp_arrow_next { margin-top: 12px !important; }
div.dark_rounded .pp_nav .pp_play { background: url(../images/prettyPhoto/dark_rounded/sprite.png) -1px -100px no-repeat; height: 15px; width: 14px; }
div.dark_rounded .pp_nav .pp_pause { background: url(../images/prettyPhoto/dark_rounded/sprite.png) -24px -100px no-repeat; height: 15px; width: 14px; }
div.dark_rounded .pp_arrow_previous { background: url(../images/prettyPhoto/dark_rounded/sprite.png) 0 -71px no-repeat; } /* The previous arrow in the bottom nav */
div.dark_rounded .pp_arrow_previous.disabled { background-position: 0 -87px; cursor: default; }
div.dark_rounded .pp_arrow_next { background: url(../images/prettyPhoto/dark_rounded/sprite.png) -22px -71px no-repeat; } /* The next arrow in the bottom nav */
div.dark_rounded .pp_arrow_next.disabled { background-position: -22px -87px; cursor: default; }
div.dark_rounded .pp_bottom .pp_left { background: url(../images/prettyPhoto/dark_rounded/sprite.png) -88px -80px no-repeat; } /* Bottom left corner */
div.dark_rounded .pp_bottom .pp_middle { background: url(../images/prettyPhoto/dark_rounded/contentPattern.png) top left repeat; } /* Bottom pattern/color */
div.dark_rounded .pp_bottom .pp_right { background: url(../images/prettyPhoto/dark_rounded/sprite.png) -110px -80px no-repeat; } /* Bottom right corner */
div.dark_rounded .pp_loaderIcon { background: url(../images/prettyPhoto/dark_rounded/loader.gif) center center no-repeat; } /* Loader icon */
/* ----------------------------------
Dark Square Theme
----------------------------------- */
div.dark_square .pp_left ,
div.dark_square .pp_middle,
div.dark_square .pp_right,
div.dark_square .pp_content { background: #000; }
div.dark_square .currentTextHolder { color: #c4c4c4; }
div.dark_square .pp_description { color: #fff; }
div.dark_square .pp_loaderIcon { background: url(../images/prettyPhoto/dark_square/loader.gif) center center no-repeat; } /* Loader icon */
div.dark_square .pp_expand { background: url(../images/prettyPhoto/dark_square/sprite.png) -31px -26px no-repeat; cursor: pointer; } /* Expand button */
div.dark_square .pp_expand:hover { background: url(../images/prettyPhoto/dark_square/sprite.png) -31px -47px no-repeat; cursor: pointer; } /* Expand button hover */
div.dark_square .pp_contract { background: url(../images/prettyPhoto/dark_square/sprite.png) 0 -26px no-repeat; cursor: pointer; } /* Contract button */
div.dark_square .pp_contract:hover { background: url(../images/prettyPhoto/dark_square/sprite.png) 0 -47px no-repeat; cursor: pointer; } /* Contract button hover */
div.dark_square .pp_close { width: 75px; height: 22px; background: url(../images/prettyPhoto/dark_square/sprite.png) -1px -1px no-repeat; cursor: pointer; } /* Close button */
div.dark_square .pp_details { position: relative; }
div.dark_square .pp_description { margin: 0 85px 0 0; }
div.dark_square #pp_full_res .pp_inline { color: #fff; }
div.dark_square .pp_gallery a.pp_arrow_previous,
div.dark_square .pp_gallery a.pp_arrow_next { margin-top: 12px !important; }
div.dark_square .pp_nav { clear: none; }
div.dark_square .pp_nav .pp_play { background: url(../images/prettyPhoto/dark_square/sprite.png) -1px -100px no-repeat; height: 15px; width: 14px; }
div.dark_square .pp_nav .pp_pause { background: url(../images/prettyPhoto/dark_square/sprite.png) -24px -100px no-repeat; height: 15px; width: 14px; }
div.dark_square .pp_arrow_previous { background: url(../images/prettyPhoto/dark_square/sprite.png) 0 -71px no-repeat; } /* The previous arrow in the bottom nav */
div.dark_square .pp_arrow_previous.disabled { background-position: 0 -87px; cursor: default; }
div.dark_square .pp_arrow_next { background: url(../images/prettyPhoto/dark_square/sprite.png) -22px -71px no-repeat; } /* The next arrow in the bottom nav */
div.dark_square .pp_arrow_next.disabled { background-position: -22px -87px; cursor: default; }
div.dark_square .pp_next:hover { background: url(../images/prettyPhoto/dark_square/btnNext.png) center right no-repeat; cursor: pointer; } /* Next button */
div.dark_square .pp_previous:hover { background: url(../images/prettyPhoto/dark_square/btnPrevious.png) center left no-repeat; cursor: pointer; } /* Previous button */
/* ----------------------------------
Light Square Theme
----------------------------------- */
div.light_square .pp_left ,
div.light_square .pp_middle,
div.light_square .pp_right,
div.light_square .pp_content { background: #fff; }
div.light_square .pp_content .ppt { color: #000; }
div.light_square .pp_expand { background: url(../images/prettyPhoto/light_square/sprite.png) -31px -26px no-repeat; cursor: pointer; } /* Expand button */
div.light_square .pp_expand:hover { background: url(../images/prettyPhoto/light_square/sprite.png) -31px -47px no-repeat; cursor: pointer; } /* Expand button hover */
div.light_square .pp_contract { background: url(../images/prettyPhoto/light_square/sprite.png) 0 -26px no-repeat; cursor: pointer; } /* Contract button */
div.light_square .pp_contract:hover { background: url(../images/prettyPhoto/light_square/sprite.png) 0 -47px no-repeat; cursor: pointer; } /* Contract button hover */
div.light_square .pp_close { width: 75px; height: 22px; background: url(../images/prettyPhoto/light_square/sprite.png) -1px -1px no-repeat; cursor: pointer; } /* Close button */
div.light_square .pp_details { position: relative; }
div.light_square .pp_description { margin-right: 85px; }
div.light_square #pp_full_res .pp_inline { color: #000; }
div.light_square .pp_gallery a.pp_arrow_previous,
div.light_square .pp_gallery a.pp_arrow_next { margin-top: 12px !important; }
div.light_square .pp_nav .pp_play { background: url(../images/prettyPhoto/light_square/sprite.png) -1px -100px no-repeat; height: 15px; width: 14px; }
div.light_square .pp_nav .pp_pause { background: url(../images/prettyPhoto/light_square/sprite.png) -24px -100px no-repeat; height: 15px; width: 14px; }
div.light_square .pp_arrow_previous { background: url(../images/prettyPhoto/light_square/sprite.png) 0 -71px no-repeat; } /* The previous arrow in the bottom nav */
div.light_square .pp_arrow_previous.disabled { background-position: 0 -87px; cursor: default; }
div.light_square .pp_arrow_next { background: url(../images/prettyPhoto/light_square/sprite.png) -22px -71px no-repeat; } /* The next arrow in the bottom nav */
div.light_square .pp_arrow_next.disabled { background-position: -22px -87px; cursor: default; }
div.light_square .pp_next:hover { background: url(../images/prettyPhoto/light_square/btnNext.png) center right no-repeat; cursor: pointer; } /* Next button */
div.light_square .pp_previous:hover { background: url(../images/prettyPhoto/light_square/btnPrevious.png) center left no-repeat; cursor: pointer; } /* Previous button */
div.light_square .pp_loaderIcon { background: url(../images/prettyPhoto/light_rounded/loader.gif) center center no-repeat; } /* Loader icon */
/* ----------------------------------
Facebook style Theme
----------------------------------- */
div.facebook .pp_top .pp_left { background: url(../images/prettyPhoto/facebook/sprite.png) -88px -53px no-repeat; } /* Top left corner */
div.facebook .pp_top .pp_middle { background: url(../images/prettyPhoto/facebook/contentPatternTop.png) top left repeat-x; } /* Top pattern/color */
div.facebook .pp_top .pp_right { background: url(../images/prettyPhoto/facebook/sprite.png) -110px -53px no-repeat; } /* Top right corner */
div.facebook .pp_content .ppt { color: #000; }
div.facebook .pp_content_container .pp_left { background: url(../images/prettyPhoto/facebook/contentPatternLeft.png) top left repeat-y; } /* Content background */
div.facebook .pp_content_container .pp_right { background: url(../images/prettyPhoto/facebook/contentPatternRight.png) top right repeat-y; } /* Content background */
div.facebook .pp_content { background: #fff; } /* Content background */
div.facebook .pp_expand { background: url(../images/prettyPhoto/facebook/sprite.png) -31px -26px no-repeat; cursor: pointer; } /* Expand button */
div.facebook .pp_expand:hover { background: url(../images/prettyPhoto/facebook/sprite.png) -31px -47px no-repeat; cursor: pointer; } /* Expand button hover */
div.facebook .pp_contract { background: url(../images/prettyPhoto/facebook/sprite.png) 0 -26px no-repeat; cursor: pointer; } /* Contract button */
div.facebook .pp_contract:hover { background: url(../images/prettyPhoto/facebook/sprite.png) 0 -47px no-repeat; cursor: pointer; } /* Contract button hover */
div.facebook .pp_close { width: 22px; height: 22px; background: url(../images/prettyPhoto/facebook/sprite.png) -1px -1px no-repeat; cursor: pointer; } /* Close button */
div.facebook .pp_details { position: relative; }
div.facebook .pp_description { margin: 0 37px 0 0; }
div.facebook #pp_full_res .pp_inline { color: #000; }
div.facebook .pp_loaderIcon { background: url(../images/prettyPhoto/facebook/loader.gif) center center no-repeat; } /* Loader icon */
div.facebook .pp_arrow_previous { background: url(../images/prettyPhoto/facebook/sprite.png) 0 -71px no-repeat; height: 22px; margin-top: 0; width: 22px; } /* The previous arrow in the bottom nav */
div.facebook .pp_arrow_previous.disabled { background-position: 0 -96px; cursor: default; }
div.facebook .pp_arrow_next { background: url(../images/prettyPhoto/facebook/sprite.png) -32px -71px no-repeat; height: 22px; margin-top: 0; width: 22px; } /* The next arrow in the bottom nav */
div.facebook .pp_arrow_next.disabled { background-position: -32px -96px; cursor: default; }
div.facebook .pp_nav { margin-top: 0; }
div.facebook .pp_nav p { font-size: 15px; padding: 0 3px 0 4px; }
div.facebook .pp_nav .pp_play { background: url(../images/prettyPhoto/facebook/sprite.png) -1px -123px no-repeat; height: 22px; width: 22px; }
div.facebook .pp_nav .pp_pause { background: url(../images/prettyPhoto/facebook/sprite.png) -32px -123px no-repeat; height: 22px; width: 22px; }
div.facebook .pp_next:hover { background: url(../images/prettyPhoto/facebook/btnNext.png) center right no-repeat; cursor: pointer; } /* Next button */
div.facebook .pp_previous:hover { background: url(../images/prettyPhoto/facebook/btnPrevious.png) center left no-repeat; cursor: pointer; } /* Previous button */
div.facebook .pp_bottom .pp_left { background: url(../images/prettyPhoto/facebook/sprite.png) -88px -80px no-repeat; } /* Bottom left corner */
div.facebook .pp_bottom .pp_middle { background: url(../images/prettyPhoto/facebook/contentPatternBottom.png) top left repeat-x; } /* Bottom pattern/color */
div.facebook .pp_bottom .pp_right { background: url(../images/prettyPhoto/facebook/sprite.png) -110px -80px no-repeat; } /* Bottom right corner */
/* ------------------------------------------------------------------------
DO NOT CHANGE
------------------------------------------------------------------------- */
div.pp_pic_holder a:focus { outline:none; }
div.pp_overlay {
background: #000;
display: none;
left: 0;
position: absolute;
top: 0;
width: 100%;
z-index: 9500;
}
div.pp_pic_holder {
display: none;
position: absolute;
width: 100px;
z-index: 10000;
}
.pp_top {
height: 20px;
position: relative;
}
* html .pp_top { padding: 0 20px; }
.pp_top .pp_left {
height: 20px;
left: 0;
position: absolute;
width: 20px;
}
.pp_top .pp_middle {
height: 20px;
left: 20px;
position: absolute;
right: 20px;
}
* html .pp_top .pp_middle {
left: 0;
position: static;
}
.pp_top .pp_right {
height: 20px;
left: auto;
position: absolute;
right: 0;
top: 0;
width: 20px;
}
.pp_content { height: 40px; min-width: 40px; }
* html .pp_content { width: 40px; }
.pp_fade { display: none; }
.pp_content_container {
position: relative;
text-align: left;
width: 100%;
}
.pp_content_container .pp_left { padding-left: 20px; }
.pp_content_container .pp_right { padding-right: 20px; }
.pp_content_container .pp_details {
float: left;
margin: 10px 0 2px 0;
}
.pp_description {
display: none;
margin: 0;
}
.pp_social { float: left; margin: 0; }
.pp_social .facebook { float: left; margin-left: 5px; width: 55px; overflow: hidden; }
.pp_social .twitter { float: left; }
.pp_nav {
clear: right;
float: left;
margin: 3px 10px 0 0;
}
.pp_nav p {
float: left;
margin: 2px 4px;
white-space: nowrap;
}
.pp_nav .pp_play,
.pp_nav .pp_pause {
float: left;
margin-right: 4px;
text-indent: -10000px;
}
a.pp_arrow_previous,
a.pp_arrow_next {
display: block;
float: left;
height: 15px;
margin-top: 3px;
overflow: hidden;
text-indent: -10000px;
width: 14px;
}
.pp_hoverContainer {
position: absolute;
top: 0;
width: 100%;
z-index: 2000;
}
.pp_gallery {
display: none;
left: 50%;
margin-top: -50px;
position: absolute;
z-index: 10000;
}
.pp_gallery div {
float: left;
overflow: hidden;
position: relative;
}
.pp_gallery ul {
float: left;
height: 35px;
margin: 0 0 0 5px;
padding: 0;
position: relative;
white-space: nowrap;
}
.pp_gallery ul a {
border: 1px #000 solid;
border: 1px rgba(0,0,0,0.5) solid;
display: block;
float: left;
height: 33px;
overflow: hidden;
}
.pp_gallery ul a:hover,
.pp_gallery li.selected a { border-color: #fff; }
.pp_gallery ul a img { border: 0; }
.pp_gallery li {
display: block;
float: left;
margin: 0 5px 0 0;
padding: 0;
}
.pp_gallery li.default a {
background: url(../images/prettyPhoto/facebook/default_thumbnail.gif) 0 0 no-repeat;
display: block;
height: 33px;
width: 50px;
}
.pp_gallery li.default a img { display: none; }
.pp_gallery .pp_arrow_previous,
.pp_gallery .pp_arrow_next {
margin-top: 7px !important;
}
a.pp_next {
background: url(../images/prettyPhoto/light_rounded/btnNext.png) 10000px 10000px no-repeat;
display: block;
float: right;
height: 100%;
text-indent: -10000px;
width: 49%;
}
a.pp_previous {
background: url(../images/prettyPhoto/light_rounded/btnNext.png) 10000px 10000px no-repeat;
display: block;
float: left;
height: 100%;
text-indent: -10000px;
width: 49%;
}
a.pp_expand,
a.pp_contract {
cursor: pointer;
display: none;
height: 20px;
position: absolute;
right: 30px;
text-indent: -10000px;
top: 10px;
width: 20px;
z-index: 20000;
}
a.pp_close {
position: absolute; right: 0; top: 0;
display: block;
line-height:22px;
text-indent: -10000px;
}
.pp_bottom {
height: 20px;
position: relative;
}
* html .pp_bottom { padding: 0 20px; }
.pp_bottom .pp_left {
height: 20px;
left: 0;
position: absolute;
width: 20px;
}
.pp_bottom .pp_middle {
height: 20px;
left: 20px;
position: absolute;
right: 20px;
}
* html .pp_bottom .pp_middle {
left: 0;
position: static;
}
.pp_bottom .pp_right {
height: 20px;
left: auto;
position: absolute;
right: 0;
top: 0;
width: 20px;
}
.pp_loaderIcon {
display: block;
height: 24px;
left: 50%;
margin: -12px 0 0 -12px;
position: absolute;
top: 50%;
width: 24px;
}
#pp_full_res {
line-height: 1 !important;
}
#pp_full_res .pp_inline {
text-align: left;
}
#pp_full_res .pp_inline p { margin: 0 0 15px 0; }
div.ppt {
color: #fff;
display: none;
font-size: 17px;
margin: 0 0 5px 15px;
z-index: 9999;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1,911 @@
/* ------------------------------------------------------------------------
Class: prettyPhoto
Use: Lightbox clone for jQuery
Author: Stephane Caron (http://www.no-margin-for-errors.com)
Version: 3.1.6
------------------------------------------------------------------------- */
(function($) {
$.prettyPhoto = {version: '3.1.6'};
$.fn.prettyPhoto = function(pp_settings) {
pp_settings = jQuery.extend({
hook: 'rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */
animation_speed: 'fast', /* fast/slow/normal */
ajaxcallback: function() {},
slideshow: 5000, /* false OR interval time in ms */
autoplay_slideshow: false, /* true/false */
opacity: 0.80, /* Value between 0 and 1 */
show_title: true, /* true/false */
allow_resize: true, /* Resize the photos bigger than viewport. true/false */
allow_expand: true, /* Allow the user to expand a resized image. true/false */
default_width: 500,
default_height: 344,
counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
horizontal_padding: 20, /* The padding on each side of the picture */
hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
wmode: 'opaque', /* Set the flash wmode attribute */
autoplay: true, /* Automatically start videos: True/False */
modal: false, /* If set to true, only the close button will close the window */
deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinkc. */
overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
overlay_gallery_max: 30, /* Maximum number of pictures in the overlay gallery */
keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
callback: function(){}, /* Called when prettyPhoto is closed */
ie6_fallback: true,
markup: '<div class="pp_pic_holder"> \
<div class="ppt">&nbsp;</div> \
<div class="pp_top"> \
<div class="pp_left"></div> \
<div class="pp_middle"></div> \
<div class="pp_right"></div> \
</div> \
<div class="pp_content_container"> \
<div class="pp_left"> \
<div class="pp_right"> \
<div class="pp_content"> \
<div class="pp_loaderIcon"></div> \
<div class="pp_fade"> \
<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
<div class="pp_hoverContainer"> \
<a class="pp_next" href="#">next</a> \
<a class="pp_previous" href="#">previous</a> \
</div> \
<div id="pp_full_res"></div> \
<div class="pp_details"> \
<div class="pp_nav"> \
<a href="#" class="pp_arrow_previous">Previous</a> \
<p class="currentTextHolder">0/0</p> \
<a href="#" class="pp_arrow_next">Next</a> \
</div> \
<p class="pp_description"></p> \
<div class="pp_social">{pp_social}</div> \
<a class="pp_close" href="#">Close</a> \
</div> \
</div> \
</div> \
</div> \
</div> \
</div> \
<div class="pp_bottom"> \
<div class="pp_left"></div> \
<div class="pp_middle"></div> \
<div class="pp_right"></div> \
</div> \
</div> \
<div class="pp_overlay"></div>',
gallery_markup: '<div class="pp_gallery"> \
<a href="#" class="pp_arrow_previous">Previous</a> \
<div> \
<ul> \
{gallery} \
</ul> \
</div> \
<a href="#" class="pp_arrow_next">Next</a> \
</div>',
image_markup: '<img id="fullResImage" src="{path}" />',
flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
inline_markup: '<div class="pp_inline">{content}</div>',
custom_markup: '',
social_tools: '<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>' /* html or false to disable */
}, pp_settings);
// Global variables accessible only by prettyPhoto
var matchedObjects = this, percentBased = false, pp_dimensions, pp_open,
// prettyPhoto container specific
pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,
// Window size
windowHeight = $(window).height(), windowWidth = $(window).width(),
// Global elements
pp_slideshow;
doresize = true, scroll_pos = _get_scroll();
// Window/Keyboard events
$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); });
if(pp_settings.keyboard_shortcuts) {
$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){
if(typeof $pp_pic_holder != 'undefined'){
if($pp_pic_holder.is(':visible')){
switch(e.keyCode){
case 37:
$.prettyPhoto.changePage('previous');
e.preventDefault();
break;
case 39:
$.prettyPhoto.changePage('next');
e.preventDefault();
break;
case 27:
if(!settings.modal)
$.prettyPhoto.close();
e.preventDefault();
break;
};
// return false;
};
};
});
};
/**
* Initialize prettyPhoto.
*/
$.prettyPhoto.initialize = function() {
settings = pp_settings;
if(settings.theme == 'pp_default') settings.horizontal_padding = 16;
// Find out if the picture is part of a set
theRel = $(this).attr(settings.hook);
galleryRegExp = /\[(?:.*)\]/;
isSet = (galleryRegExp.exec(theRel)) ? true : false;
// Put the SRCs, TITLEs, ALTs into an array.
pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return $(n).attr('href'); }) : $.makeArray($(this).attr('href'));
pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; }) : $.makeArray($(this).find('img').attr('alt'));
pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('title')) ? $(n).attr('title') : ""; }) : $.makeArray($(this).attr('title'));
if(pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery = false;
set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned
rel_index = (isSet) ? set_position : $("a["+settings.hook+"^='"+theRel+"']").index($(this));
_build_overlay(this); // Build the overlay {this} being the caller
if(settings.allow_resize)
$(window).bind('scroll.prettyphoto',function(){ _center_overlay(); });
$.prettyPhoto.open();
return false;
}
/**
* Opens the prettyPhoto modal box.
* @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths.
* @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles.
* @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions.
*/
$.prettyPhoto.open = function(event) {
if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables
settings = pp_settings;
pp_images = $.makeArray(arguments[0]);
pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
isSet = (pp_images.length > 1) ? true : false;
set_position = (arguments[3])? arguments[3]: 0;
_build_overlay(event.target); // Build the overlay {this} being the caller
}
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden'); // Hide the flash
_checkPosition($(pp_images).size()); // Hide the next/previous links if on first or last images.
$('.pp_loaderIcon').show();
if(settings.deeplinking)
setHashtag();
// Rebuild Facebook Like Button with updated href
if(settings.social_tools){
facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
$pp_pic_holder.find('.pp_social').html(facebook_like_link);
}
// Fade the content in
if($ppt.is(':hidden')) $ppt.css('opacity',0).show();
$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);
// Display the current position
$pp_pic_holder.find('.currentTextHolder').text((set_position+1) + settings.counter_separator_label + $(pp_images).size());
// Set the description
if(typeof pp_descriptions[set_position] != 'undefined' && pp_descriptions[set_position] != ""){
$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
}else{
$pp_pic_holder.find('.pp_description').hide();
}
// Get the dimensions
movie_width = ( parseFloat(getParam('width',pp_images[set_position])) ) ? getParam('width',pp_images[set_position]) : settings.default_width.toString();
movie_height = ( parseFloat(getParam('height',pp_images[set_position])) ) ? getParam('height',pp_images[set_position]) : settings.default_height.toString();
// If the size is % based, calculate according to window dimensions
percentBased=false;
if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); percentBased = true; }
if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); percentBased = true; }
// Fade the holder
$pp_pic_holder.fadeIn(function(){
// Set the title
(settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html('&nbsp;');
imgPreloader = "";
skipInjection = false;
// Inject the proper content
switch(_getFileType(pp_images[set_position])){
case 'image':
imgPreloader = new Image();
// Preload the neighbour images
nextImage = new Image();
if(isSet && set_position < $(pp_images).size() -1) nextImage.src = pp_images[set_position + 1];
prevImage = new Image();
if(isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1];
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g,pp_images[set_position]);
imgPreloader.onload = function(){
// Fit item to viewport
pp_dimensions = _fitToViewport(imgPreloader.width,imgPreloader.height);
_showContent();
};
imgPreloader.onerror = function(){
alert('Image cannot be loaded. Make sure the path is correct and image exist.');
$.prettyPhoto.close();
};
imgPreloader.src = pp_images[set_position];
break;
case 'youtube':
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
// Regular youtube link
movie_id = getParam('v',pp_images[set_position]);
// youtu.be link
if(movie_id == ""){
movie_id = pp_images[set_position].split('youtu.be/');
movie_id = movie_id[1];
if(movie_id.indexOf('?') > 0)
movie_id = movie_id.substr(0,movie_id.indexOf('?')); // Strip anything after the ?
if(movie_id.indexOf('&') > 0)
movie_id = movie_id.substr(0,movie_id.indexOf('&')); // Strip anything after the &
}
movie = 'http://www.youtube.com/embed/'+movie_id;
(getParam('rel',pp_images[set_position])) ? movie+="?rel="+getParam('rel',pp_images[set_position]) : movie+="?rel=1";
if(settings.autoplay) movie += "&autoplay=1";
toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
break;
case 'vimeo':
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
movie_id = pp_images[set_position];
var regExp = /http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;
var match = movie_id.match(regExp);
movie = 'http://player.vimeo.com/video/'+ match[3] +'?title=0&amp;byline=0&amp;portrait=0';
if(settings.autoplay) movie += "&autoplay=1;";
vimeo_width = pp_dimensions['width'] + '/embed/?moog_width='+ pp_dimensions['width'];
toInject = settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);
break;
case 'quicktime':
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
pp_dimensions['height']+=15; pp_dimensions['contentHeight']+=15; pp_dimensions['containerHeight']+=15; // Add space for the control bar
toInject = settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);
break;
case 'flash':
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
flash_vars = pp_images[set_position];
flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);
filename = pp_images[set_position];
filename = filename.substring(0,filename.indexOf('?'));
toInject = settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
break;
case 'iframe':
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
frame_url = pp_images[set_position];
frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);
break;
case 'ajax':
doresize = false; // Make sure the dimensions are not resized.
pp_dimensions = _fitToViewport(movie_width,movie_height);
doresize = true; // Reset the dimensions
skipInjection = true;
$.get(pp_images[set_position],function(responseHTML){
toInject = settings.inline_markup.replace(/{content}/g,responseHTML);
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
_showContent();
});
break;
case 'custom':
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
toInject = settings.custom_markup;
break;
case 'inline':
// to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
myClone = $(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();
doresize = false; // Make sure the dimensions are not resized.
pp_dimensions = _fitToViewport($(myClone).width(),$(myClone).height());
doresize = true; // Reset the dimensions
$(myClone).remove();
toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
break;
};
if(!imgPreloader && !skipInjection){
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
// Show content
_showContent();
};
});
return false;
};
/**
* Change page in the prettyPhoto modal box
* @param direction {String} Direction of the paging, previous or next.
*/
$.prettyPhoto.changePage = function(direction){
currentGalleryPage = 0;
if(direction == 'previous') {
set_position--;
if (set_position < 0) set_position = $(pp_images).size()-1;
}else if(direction == 'next'){
set_position++;
if(set_position > $(pp_images).size()-1) set_position = 0;
}else{
set_position=direction;
};
rel_index = set_position;
if(!doresize) doresize = true; // Allow the resizing of the images
if(settings.allow_expand) {
$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
}
_hideContent(function(){ $.prettyPhoto.open(); });
};
/**
* Change gallery page in the prettyPhoto modal box
* @param direction {String} Direction of the paging, previous or next.
*/
$.prettyPhoto.changeGalleryPage = function(direction){
if(direction=='next'){
currentGalleryPage ++;
if(currentGalleryPage > totalPage) currentGalleryPage = 0;
}else if(direction=='previous'){
currentGalleryPage --;
if(currentGalleryPage < 0) currentGalleryPage = totalPage;
}else{
currentGalleryPage = direction;
};
slide_speed = (direction == 'next' || direction == 'previous') ? settings.animation_speed : 0;
slide_to = currentGalleryPage * (itemsPerPage * itemWidth);
$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);
};
/**
* Start the slideshow...
*/
$.prettyPhoto.startSlideshow = function(){
if(typeof pp_slideshow == 'undefined'){
$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){
$.prettyPhoto.stopSlideshow();
return false;
});
pp_slideshow = setInterval($.prettyPhoto.startSlideshow,settings.slideshow);
}else{
$.prettyPhoto.changePage('next');
};
}
/**
* Stop the slideshow...
*/
$.prettyPhoto.stopSlideshow = function(){
$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){
$.prettyPhoto.startSlideshow();
return false;
});
clearInterval(pp_slideshow);
pp_slideshow=undefined;
}
/**
* Closes prettyPhoto.
*/
$.prettyPhoto.close = function(){
if($pp_overlay.is(":animated")) return;
$.prettyPhoto.stopSlideshow();
$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');
$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){ $(this).remove(); });
$pp_overlay.fadeOut(settings.animation_speed, function(){
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible'); // Show the flash
$(this).remove(); // No more need for the prettyPhoto markup
$(window).unbind('scroll.prettyphoto');
clearHashtag();
settings.callback();
doresize = true;
pp_open = false;
delete settings;
});
};
/**
* Set the proper sizes on the containers and animate the content in.
*/
function _showContent(){
$('.pp_loaderIcon').hide();
// Calculate the opened top position of the pic holder
projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (pp_dimensions['containerHeight']/2));
if(projectedTop < 0) projectedTop = 0;
$ppt.fadeTo(settings.animation_speed,1);
// Resize the content holder
$pp_pic_holder.find('.pp_content')
.animate({
height:pp_dimensions['contentHeight'],
width:pp_dimensions['contentWidth']
},settings.animation_speed);
// Resize picture the holder
$pp_pic_holder.animate({
'top': projectedTop,
'left': ((windowWidth/2) - (pp_dimensions['containerWidth']/2) < 0) ? 0 : (windowWidth/2) - (pp_dimensions['containerWidth']/2),
width:pp_dimensions['containerWidth']
},settings.animation_speed,function(){
$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);
$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); // Fade the new content
// Show the nav
if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); }
if(settings.allow_expand) {
if(pp_dimensions['resized']){ // Fade the resizing link if the image is resized
$('a.pp_expand,a.pp_contract').show();
}else{
$('a.pp_expand').hide();
}
}
if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow();
settings.changepicturecallback(); // Callback!
pp_open = true;
});
_insert_gallery();
pp_settings.ajaxcallback();
};
/**
* Hide the content...DUH!
*/
function _hideContent(callback){
// Fade out the current picture
$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){
$('.pp_loaderIcon').show();
callback();
});
};
/**
* Check the item position in the gallery array, hide or show the navigation links
* @param setCount {integer} The total number of items in the set
*/
function _checkPosition(setCount){
(setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); // Hide the bottom nav if it's not a set.
};
/**
* Resize the item dimensions if it's bigger than the viewport
* @param width {integer} Width of the item to be opened
* @param height {integer} Height of the item to be opened
* @return An array containin the "fitted" dimensions
*/
function _fitToViewport(width,height){
resized = false;
_getDimensions(width,height);
// Define them in case there's no resize needed
imageWidth = width, imageHeight = height;
if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) {
resized = true, fitting = false;
while (!fitting){
if((pp_containerWidth > windowWidth)){
imageWidth = (windowWidth - 200);
imageHeight = (height/width) * imageWidth;
}else if((pp_containerHeight > windowHeight)){
imageHeight = (windowHeight - 200);
imageWidth = (width/height) * imageHeight;
}else{
fitting = true;
};
pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
};
if((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)){
_fitToViewport(pp_containerWidth,pp_containerHeight)
};
_getDimensions(imageWidth,imageHeight);
};
return {
width:Math.floor(imageWidth),
height:Math.floor(imageHeight),
containerHeight:Math.floor(pp_containerHeight),
containerWidth:Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2),
contentHeight:Math.floor(pp_contentHeight),
contentWidth:Math.floor(pp_contentWidth),
resized:resized
};
};
/**
* Get the containers dimensions according to the item size
* @param width {integer} Width of the item to be opened
* @param height {integer} Height of the item to be opened
*/
function _getDimensions(width,height){
width = parseFloat(width);
height = parseFloat(height);
// Get the details height, to do so, I need to clone it since it's invisible
$pp_details = $pp_pic_holder.find('.pp_details');
$pp_details.width(width);
detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
$pp_details = $pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({
'position':'absolute',
'top':-10000
});
detailsHeight += $pp_details.height();
detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details
$pp_details.remove();
// Get the titles height, to do so, I need to clone it since it's invisible
$pp_title = $pp_pic_holder.find('.ppt');
$pp_title.width(width);
titleHeight = parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom'));
$pp_title = $pp_title.clone().appendTo($('body')).css({
'position':'absolute',
'top':-10000
});
titleHeight += $pp_title.height();
$pp_title.remove();
// Get the container size, to resize the holder to the right dimensions
pp_contentHeight = height + detailsHeight;
pp_contentWidth = width;
pp_containerHeight = pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
pp_containerWidth = width;
}
function _getFileType(itemSrc){
if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) {
return 'youtube';
}else if (itemSrc.match(/vimeo\.com/i)) {
return 'vimeo';
}else if(itemSrc.match(/\b.mov\b/i)){
return 'quicktime';
}else if(itemSrc.match(/\b.swf\b/i)){
return 'flash';
}else if(itemSrc.match(/\biframe=true\b/i)){
return 'iframe';
}else if(itemSrc.match(/\bajax=true\b/i)){
return 'ajax';
}else if(itemSrc.match(/\bcustom=true\b/i)){
return 'custom';
}else if(itemSrc.substr(0,1) == '#'){
return 'inline';
}else{
return 'image';
};
};
function _center_overlay(){
if(doresize && typeof $pp_pic_holder != 'undefined') {
scroll_pos = _get_scroll();
contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
projectedTop = (windowHeight/2) + scroll_pos['scrollTop'] - (contentHeight/2);
if(projectedTop < 0) projectedTop = 0;
if(contentHeight > windowHeight)
return;
$pp_pic_holder.css({
'top': projectedTop,
'left': (windowWidth/2) + scroll_pos['scrollLeft'] - (contentwidth/2)
});
};
};
function _get_scroll(){
if (self.pageYOffset) {
return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
} else if (document.body) {// all other Explorers
return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
};
};
function _resize_overlay() {
windowHeight = $(window).height(), windowWidth = $(window).width();
if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height()).width(windowWidth);
};
function _insert_gallery(){
if(isSet && settings.overlay_gallery && _getFileType(pp_images[set_position])=="image") {
itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
navWidth = (settings.theme == "facebook" || settings.theme == "pp_default") ? 50 : 30; // Define the arrow width depending on the theme
itemsPerPage = Math.floor((pp_dimensions['containerWidth'] - 100 - navWidth) / itemWidth);
itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length;
totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1;
// Hide the nav in the case there's no need for links
if(totalPage == 0){
navWidth = 0; // No nav means no width!
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();
}else{
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();
};
galleryWidth = itemsPerPage * itemWidth;
fullGalleryWidth = pp_images.length * itemWidth;
// Set the proper width to the gallery items
$pp_gallery
.css('margin-left',-((galleryWidth/2) + (navWidth/2)))
.find('div:first').width(galleryWidth+5)
.find('ul').width(fullGalleryWidth)
.find('li.selected').removeClass('selected');
goToPage = (Math.floor(set_position/itemsPerPage) < totalPage) ? Math.floor(set_position/itemsPerPage) : totalPage;
$.prettyPhoto.changeGalleryPage(goToPage);
$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');
}else{
$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
// $pp_gallery.hide();
}
}
function _build_overlay(caller){
// Inject Social Tool markup into General markup
if(settings.social_tools)
facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
settings.markup = settings.markup.replace('{pp_social}','');
$('body').append(settings.markup); // Inject the markup
$pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay = $('div.pp_overlay'); // Set my global selectors
// Inject the inline gallery!
if(isSet && settings.overlay_gallery) {
currentGalleryPage = 0;
toInject = "";
for (var i=0; i < pp_images.length; i++) {
if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){
classname = 'default';
img_src = '';
}else{
classname = '';
img_src = pp_images[i];
}
toInject += "<li class='"+classname+"'><a href='#'><img src='" + img_src + "' width='50' alt='' /></a></li>";
};
toInject = settings.gallery_markup.replace(/{gallery}/g,toInject);
$pp_pic_holder.find('#pp_full_res').after(toInject);
$pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors
$pp_gallery.find('.pp_arrow_next').click(function(){
$.prettyPhoto.changeGalleryPage('next');
$.prettyPhoto.stopSlideshow();
return false;
});
$pp_gallery.find('.pp_arrow_previous').click(function(){
$.prettyPhoto.changeGalleryPage('previous');
$.prettyPhoto.stopSlideshow();
return false;
});
$pp_pic_holder.find('.pp_content').hover(
function(){
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
},
function(){
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
});
itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
$pp_gallery_li.each(function(i){
$(this)
.find('a')
.click(function(){
$.prettyPhoto.changePage(i);
$.prettyPhoto.stopSlideshow();
return false;
});
});
};
// Inject the play/pause if it's a slideshow
if(settings.slideshow){
$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){
$.prettyPhoto.startSlideshow();
return false;
});
}
$pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme
$pp_overlay
.css({
'opacity':0,
'height':$(document).height(),
'width':$(window).width()
})
.bind('click',function(){
if(!settings.modal) $.prettyPhoto.close();
});
$('a.pp_close').bind('click',function(){ $.prettyPhoto.close(); return false; });
if(settings.allow_expand) {
$('a.pp_expand').bind('click',function(e){
// Expand the image
if($(this).hasClass('pp_expand')){
$(this).removeClass('pp_expand').addClass('pp_contract');
doresize = false;
}else{
$(this).removeClass('pp_contract').addClass('pp_expand');
doresize = true;
};
_hideContent(function(){ $.prettyPhoto.open(); });
return false;
});
}
$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){
$.prettyPhoto.changePage('previous');
$.prettyPhoto.stopSlideshow();
return false;
});
$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){
$.prettyPhoto.changePage('next');
$.prettyPhoto.stopSlideshow();
return false;
});
_center_overlay(); // Center it
};
if(!pp_alreadyInitialized && getHashtag()){
pp_alreadyInitialized = true;
// Grab the rel index to trigger the click on the correct element
hashIndex = getHashtag();
hashRel = hashIndex;
hashIndex = hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);
hashRel = hashRel.substring(0,hashRel.indexOf('/'));
// Little timeout to make sure all the prettyPhoto initialize scripts has been run.
// Useful in the event the page contain several init scripts.
setTimeout(function(){ $("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50);
}
return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
};
function getHashtag(){
var url = location.href;
hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)) : false;
if(hashtag){ hashtag = hashtag.replace(/<|>/g,''); }
return hashtag;
};
function setHashtag(){
if(typeof theRel == 'undefined') return; // theRel is set on normal calls, it's impossible to deeplink using the API
location.hash = theRel + '/'+rel_index+'/';
};
function clearHashtag(){
if ( location.href.indexOf('#prettyPhoto') !== -1 ) location.hash = "prettyPhoto";
}
function getParam(name,url){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( url );
return ( results == null ) ? "" : results[1];
}
})(jQuery);
var pp_alreadyInitialized = false; // Used for the deep linking to make sure not to call the same function several times.

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,713 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
* kc.extension.php
*
*/
if(!defined('ABSPATH')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
/*
* Extensions class
*/
class kc_extensions {
private $tab = 'store';
private $page = 1;
private $path = '';
private $errors = array();
private $upload_extension = array();
private $api_url = '';
private $scheme = '';
function __construct(){
$this->path = untrailingslashit(ABSPATH).KDS.'wp-content'.KDS.'uploads'.KDS.'kc_extensions'.KDS;
$this->scan_blacklist();
$this->scheme = is_ssl() ? 'https' : 'http';
$this->api_url = $this->scheme.'://extensions.kingcomposer.com/';
if (is_admin()) {
add_action ('admin_menu', array( &$this, 'admin_menu' ), 1);
if (isset($_GET['tab']) && !empty($_GET['tab']))
$this->tab = $_GET['tab'];
if (isset($_GET['page']) && !empty($_GET['page']))
$this->page = $_GET['page'];
add_action('kc_list_extensions_store', array(&$this, 'extensions_store'));
add_action('kc_list_extensions_installed', array(&$this, 'extensions_installed'));
add_action('kc_list_extensions_upload', array(&$this, 'extensions_upload'));
add_action('init', array(&$this, 'process_bulk_action'));
}
$this->load_extensions();
}
public function load_xml($url = '', $arg = array()) {
$options = array(
"http" => array(
"header" => "Referer: ".$_SERVER['HTTP_HOST']."\r\n".
"Scheme: ".$this->scheme."\r\n".
"Cookie: PHPSESSID=".str_replace('=', '', base64_encode($_SERVER['HTTP_HOST']))."\r\n",
"ignore_errors" => true,
));
if (count($arg) > 0) {
$options['http']['header'] .= implode("\r\n", $arg);
}
$context = @stream_context_create($options);
if ($url === null)
return $context;
@libxml_set_streams_context($context);
return @simplexml_load_file($url);
}
public function admin_menu() {
$capability = apply_filters('access_kingcomposer_capability', 'access_kingcomposer');
add_submenu_page(
'kingcomposer',
__('Extensions', 'kingcomposer'),
__('Extensions', 'kingcomposer'),
$capability,
'kc-extensions',
array( &$this, 'screen_display' )
);
}
public function screen_display() {
include 'extensions/kc.screen.tmpl.php';
}
public function extensions_store($page = 1) {
global $kc;
$pdk = $kc->get_pdk();
if (isset($pdk['pack']) && isset($pdk['key']) && $pdk['pack'] != 'trial' && !empty($pdk['key']) && $pdk['stt'] == 1)
$key = $pdk['key'];
else $key = '';
$response = @wp_remote_get(
$this->api_url.'catalog/',
array(
"headers" => array(
"license" => $key,
"pack" => isset($pdk['pack']) ? $pdk['pack'] : '',
"theme" => sanitize_title(basename(get_template_directory())),
"domain" => site_url(),
"time" => time()+604800,
"q" => (isset($_GET['q']) ? $_GET['q'] : ''),
"filter" => (isset($_GET['filter']) ? $_GET['filter'] : ''),
"paged" => (isset($_GET['paged']) ? $_GET['paged'] : ''),
),
'timeout' => 1200,
)
);
if (is_wp_error($response)) {
echo '<center><h2 style="color: #888; margin-top: 50px">'.__('Sorry, Can not connect to server at this time. Please check your internet connection and ', 'kingcomposer').'<a href="#" onclick="window.location.reload()">Try again</a></h2></center>';
return;
}
$data = @json_decode($response['body'], true);
if (!is_array($data)) {
echo '<center><h2 style="color: #888; margin-top: 50px">'.__('Sorry, An error has occurred, we will fix it soon.', 'kingcomposer').'</h2>'.$response['body'].'</center>';
return;
}
$items = $data['items'];
$total = $data['total'];
$pages = $data['pages'];
$installs = $this->load_installed('all');
$actives = (array) get_option( 'kc_active_extensions', array() );
include 'extensions/kc.store.tmpl.php';
}
public function extensions_installed ($page = 1) {
$items = $this->load_installed('all');
$actives = (array) get_option( 'kc_active_extensions', array() );
include 'extensions/kc.installed.tmpl.php';
}
public function extensions_upload ($page = 1) {
$upload = $this->upload_extension;
$errors = $this->errors;
include 'extensions/kc.upload.tmpl.php';
}
public function load_installed ($mod = 'all') {
if (!is_dir($this->path) && !mkdir($this->path, 0755)) {
echo '<center><h2 style="color: #888; margin-top: 50px">'.__('Error, could not create extensions folder '.$this->path, 'kingcomposer').'</h2></center>';
return;
}
$items = array();
$files = scandir($this->path, 0);
foreach ($files as $file) {
if (is_dir($this->path.$file) && $file != '.' && $file != '..') {
if (file_exists($this->path.$file.KDS.'index.php')) {
$data = get_file_data($this->path.$file.KDS.'index.php', array(
'Extension Name',
'Extension Preview',
'Description',
'Version',
'Author',
'Author URI',
));
$items[$file] = array(
'name' => !empty($data[0]) ? $data[0] : 'Unknow',
'Extension Preview' => !empty($data[1]) ? $data[1] : '',
'Description' => !empty($data[2]) ? $data[2] : '',
'Version' => !empty($data[3]) ? $data[3] : '1.0',
'Author' => !empty($data[4]) ? $data[4] : 'Unknow',
'Author URI' => !empty($data[5]) ? $data[5] : '#unknow',
'extension' => sanitize_title($file)
);
}
}
}
return $items;
}
public function load_extensions () {
$actives = (array) get_option( 'kc_active_extensions', array() );
foreach ($actives as $name => $stt) {
if ($stt == 1) {
if (file_exists($this->path.$name.KDS.'index.php')) {
require_once($this->path.$name.KDS.'index.php');
$ex_class = 'kc_extension_'.str_replace('-', '_', sanitize_title($name));
if (class_exists($ex_class)) {
new $ex_class();
} else {
$this->errors[] = 'Could not find the PHP classname "'.$ex_class.'" in the extenstion "/'.$name.KDS.'index.php"';
unset($actives[$name]);
update_option('kc_active_extensions', $actives);
}
} else {
$this->errors[] = 'Could not find the extension file /'.$name.KDS.'index.php';
unset($actives[$name]);
update_option('kc_active_extensions', $actives);
}
}
}
return $this->errors;
}
public function list_table( $items, $actives ) {
$KCExtTable = new KC_Extensions_List();
$KCExtTable->set_data( $items, $actives );
$KCExtTable->prepare_items();
?>
<div class="plugins">
<?php $KCExtTable->display(); ?>
</div>
<?php
}
public function process_bulk_action() {
if (
isset($_POST['action']) &&
isset($_POST['kc-extension-action']) &&
isset($_POST['kc-nonce']) &&
wp_verify_nonce($_POST['kc-nonce'], 'kc-nonce')
){
if (!is_admin() || !current_user_can('upload_files') || !current_user_can('manage_options')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
$actives = (array) get_option( 'kc_active_extensions', array() );
$checked = isset($_POST['checked']) ? (array) $_POST['checked'] : array();
$path = untrailingslashit(ABSPATH).KDS.'wp-content'.KDS.'uploads'.KDS.'kc_extensions'.KDS;
switch ($_POST['action']){
case 'bulk-deactivate' :
foreach( $checked as $ext )
unset( $actives[ $ext ] );
if (!add_option('kc_active_extensions', $actives, null, 'no'))
update_option('kc_active_extensions', $actives );
break;
case 'bulk-activate' :
foreach( $checked as $ext )
$actives[$ext] = 1;
if (!add_option('kc_active_extensions', $actives, null, 'no'))
update_option('kc_active_extensions', $actives );
break;
case 'bulk-update' :
break;
case 'bulk-delete' :
foreach( $checked as $ext ) {
if (is_dir($path.$ext) && kc_remove_dir($path.$ext) && isset($actives[$ext]))
unset($actives[$ext]);
}
update_option('kc_active_extensions', $actives);
break;
case 'upload' :
$this->tab = 'upload';
if (!class_exists('ZipArchive')) {
$this->errors[] = 'Server does not support ZipArchive';
} else if (
(
($_FILES["extensionzip"]["type"] == "application/zip") ||
($_FILES["extensionzip"]["type"] == "application/x-zip") ||
($_FILES["extensionzip"]["type"] == "application/x-zip-compressed")
) &&
($_FILES["extensionzip"]["size"] < 20000000)
) {
if (move_uploaded_file($_FILES['extensionzip']['tmp_name'], $path.$_FILES['extensionzip']['name']) === true) {
$zip = new ZipArchive;
$res = $zip->open($path.$_FILES['extensionzip']['name']);
if ($res === TRUE) {
$ext = $zip->extractTo($path);
if (is_dir($path.'__MACOSX'))
kc_remove_dir($path.'__MACOSX');
if ($ext ===true) {
$ext = trim($zip->getNameIndex(0), KDS);
if (!file_exists($path.$ext.KDS.'index.php'))
$this->errors[] = 'Missing index.php file of extension';
$this->upload_extension[0] = $_FILES['extensionzip']['name'];
$this->upload_extension[1] = $ext;
} else $this->errors[] = 'Could not extract file';
$zip->close();
} else {
$this->errors[] = 'Could not unzip';
}
} else {
$this->errors[] = 'Error upload file';
}
} else {
$this->errors[] = 'Invalid file type';
}
break;
}
}
}
public function scan_blacklist() {
if (is_dir($this->path)) {
if (!is_file($this->path.'index.html')) {
@file_put_contents($this->path.'index.html', '');
}
$blacklist_dirs = array('background-image-cropper', 'XAttacker', 'reup', 'visual');
$files = @scandir($this->path, 0);
if (isset($files) && is_array($files) && count($files) > 0) {
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
if (is_dir($this->path.$file) && in_array($file, $blacklist_dirs)) {
kc_remove_dir($this->path.$file);
}
if (is_file($this->path.$file) && strpos($file, '.zip') !== false) {
@unlink($this->path.$file);
}
}
}
}
}
}
}
class kc_extension {
public $path;
public $url;
public function init($file) {
$this->path = dirname($file);
$this->url = site_url('/wp-content/uploads/kc_extensions/'.basename(dirname($file)));
}
public function map($args) {
global $kc;
if (empty($args) || !is_array($args))
return;
$kc->add_map($args);
}
public function output($name, $callback) {
if (is_callable($callback)) {
add_shortcode ($name, $callback);
}
}
}
new kc_extensions();
if ( ! class_exists( 'WP_List_Table' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
class KC_Extensions_List extends WP_List_Table
{
private $table_data = array();
private $actives = array();
/** Class constructor */
public function __construct() {
parent::__construct( array(
'singular' => __( 'Extension', 'kingcomposer' ), //singular name of the listed records
'plural' => __( 'Extensions', 'kingcomposer' ), //plural name of the listed records
'ajax' => true //should this table support ajax?
) );
}
/**
* @return array
*/
protected function get_table_classes() {
return array( 'widefat', $this->_args['plural'] );
}
/**
* Prepare the items for the table to process
*
* @return Void
*/
public function prepare_items()
{
$columns = $this->get_columns();
$hidden = $this->get_hidden_columns();
$sortable = $this->get_sortable_columns();
$data = $this->table_data;
usort( $data, array( &$this, 'sort_data' ) );
$perPage = 20;
$currentPage = $this->get_pagenum();
$totalItems = count($data);
$this->set_pagination_args( array(
'total_items' => $totalItems,
'per_page' => $perPage
) );
$data = array_slice($data,(($currentPage-1)*$perPage),$perPage);
$this->_column_headers = array($columns, $hidden, $sortable);
$this->items = $data;
}
/**
* Override the parent columns method. Defines the columns to use in your listing table
*
* @return Array
*/
public function get_columns()
{
$columns = array(
'cb' => '<input type="checkbox" />',
'name' => 'Extension Name',
'description' => 'Description'
);
return $columns;
}
/**
* Define which columns are hidden
*
* @return Array
*/
public function get_hidden_columns()
{
return array();
}
/**
* Define the sortable columns
*
* @return Array
*/
public function get_sortable_columns()
{
return array('name' => array('name', false));
}
/**
* Get the table data
*
* @return Array
*/
public function set_data( $items, $actives )
{
$this->table_data = $items;
$this->actives = $actives;
}
/**
* Define what data to show on each column of the table
*
* @param Array $item Data
* @param String $column_name - Current column name
*
* @return Mixed
*/
public function column_default( $item, $column_name )
{
switch( $column_name ) {
case 'name':
case 'description':
return $item[ $column_name ];
default:
return print_r( $item, true ) ;
}
}
/**
* Allows you to sort the data by the variables set in the $_GET
*
* @return Mixed
*/
private function sort_data( $a, $b )
{
// Set defaults
$orderby = 'name';
$order = 'asc';
// If orderby is set, use this as the sort column
if(!empty($_GET['orderby']))
{
$orderby = $_GET['orderby'];
}
// If order is set use this as the order
if(!empty($_GET['order']))
{
$order = $_GET['order'];
}
$result = strcmp( $a[$orderby], $b[$orderby] );
if($order === 'asc')
{
return $result;
}
return -$result;
}
/** Text displayed when no customer data is available */
public function no_items() {
_e( 'No items found', 'kingcomposer' );
}
/**
* Returns an associative array containing the bulk action
*
* @return array
*/
public function get_bulk_actions() {
$actions = array(
'bulk-activate' => 'Activate',
'bulk-deactivate' => 'Deactivate',
'bulk-update' => 'Update',
'bulk-delete' => 'Delete',
);
return $actions;
}
/**
* @global string $status
* @global int $page
* @global string $s
* @global array $totals
*
* @param array $item
*/
public function single_row( $item ) {
global $status, $page, $s, $totals;
$idc = rand(334,4343);
$name = esc_html($item['name']);
$slug = esc_attr($item['extension']);
?>
<tr class="<?php
if (isset($this->actives[$slug]) && $this->actives[$slug] == '1')
echo 'active';
else echo 'inactive';
?>" data-extension="<?php echo $slug; ?>">
<th scope="row" class="check-column">
<label class="screen-reader-text" for="checkbox_<?php echo $idc; ?>">
<?php _e('Select', 'kingcomposer'); ?> <?php echo $name; ?>
</label>
<input type="checkbox" name="checked[]" value="<?php echo $slug; ?>" id="checkbox_<?php echo $idc; ?>">
</th>
<td class="plugin-title column-primary">
<strong><?php echo $name; ?></strong>
<div class="row-actions visible">
<span class="activate">
<a href="#active" class="active" aria-label="Activate <?php echo $name; ?>">
<?php _e('Activate', 'kingcomposer'); ?>
</a> |
</span>
<span class="deactivate">
<a href="#deactive" class="deactive" aria-label="Activate <?php echo $name; ?>">
<?php _e('Deactivate', 'kingcomposer'); ?>
</a> |
</span>
<span class="delete">
<a href="#delete" class="delete" aria-label="Delete <?php echo $name; ?>">
<?php _e('Delete', 'kingcomposer'); ?>
</a>
</span>
</div>
</td>
<td class="column-description desc">
<div class="plugin-description">
<p><?php echo esc_html($item['Description']); ?></p>
</div>
<div class="inactive second plugin-version-author-uri">
<?php _e('Version', 'kingcomposer'); ?> <?php echo esc_html($item['Version']); ?> |
<?php _e('By', 'kingcomposer'); ?>
<a href="<?php echo esc_url($item['Author URI']); ?>" target=_blank>
<?php echo esc_html($item['Author']); ?>
</a>
<?php if (!empty($item['Extension Preview'])) { ?>
|
<a href="<?php echo esc_url($item['Extension Preview']); ?>" target=_blank>
<?php _e('Preview', 'kingcomposer'); ?>
</a>
<?php } ?>
</div>
</td>
</tr>
<?php
}
/**
* Display the table
*
* @since 3.1.0
* @access public
*/
public function display() {
$singular = $this->_args['singular'];
$this->display_tablenav( 'top' );
$this->screen->render_screen_reader_content( 'heading_list' );
?>
<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>" id="kc-extensions-list">
<thead>
<tr>
<?php $this->print_column_headers(); ?>
</tr>
</thead>
<tbody id="the-list"<?php
if ( $singular ) {
echo " data-wp-lists='list:$singular'";
} ?>>
<?php $this->display_rows_or_placeholder(); ?>
</tbody>
<tfoot>
<tr>
<?php $this->print_column_headers( false ); ?>
</tr>
</tfoot>
</table>
<?php
$this->display_tablenav( 'bottom' );
}
}

View File

@@ -0,0 +1,118 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
*
*/
if(!defined('ABSPATH')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
$kc_fonts = get_option('kc-fonts');
if( !is_array( $kc_fonts ) )
$kc_fonts = array();
$count = count($kc_fonts);
?>
<div id="kc-fonts-manager">
<div id="kc-ggf-header">
<h3>
<?php _e('Fonts Manager', 'kingcomposer'); ?>
<small></small>
</h3>
<div id="kc-ggf-hright">
<input type="search" id="kc-ggf-search" placeholder="<?php _e('Search by name', 'kingcomposer'); ?>" />
<i class="sl-magnifier"></i>
</div>
<ul>
<li>
<select id="kc-ggf-filter">
<option value="popularity"><?php _e('Sorting', 'kingcomposer'); ?></option>
<option value="popularity">Popular</option>
<option value="trending">Trending</option>
<option value="style">Style</option>
<option value="alpha">Alpha</option>
</select>
</li>
<li>
<select id="kc-ggf-language">
<option value="">All subsets</option>
<option value="arabic">Arabic</option>
<option value="bengali">Bengali</option>
<option value="cyrillic">Cyrillic</option>
<option value="cyrillic-ext">Cyrillic Extended</option>
<option value="devanagari">Devanagari</option>
<option value="greek">Greek</option>
<option value="greek-ext">Greek Extended</option>
<option value="gujarati">Gujarati</option>
<option value="hebrew">Hebrew</option>
<option value="khmer">Khmer</option>
<option value="latin">Latin</option>
<option value="latin-ext">Latin Extended</option>
<option value="tamil">Tamil</option>
<option value="telugu">Telugu</option>
<option value="thai">Thai</option>
<option value="vietnamese">Vietnamese</option>
</select>
</li>
<li>
<select id="kc-ggf-category">
<option value="">All Categories</option>
<option value="serif">Serif</option>
<option value="sans-serif">Sans Serif</option>
<option value="display">Display</option>
<option value="handwriting">Handwriting</option>
<option value="monospace">Monospace</option>
</select>
</li>
<li class="kc-ggf-added" data-action="my-fonts">
<i class="fa-folder-open" data-action="my-fonts"></i>
<?php _e('Your Fonts', 'kingcomposer'); ?>
(<span data-action="my-fonts"><?php echo $count; ?></span>)
</li>
<li class="kc-ggf-load-time">
<?php _e('Load Time', 'kingcomposer'); ?>
<?php
if( $count < 4 )
echo '<span>Fast</span>';
else if( $count < 6 )
echo '<span class="medium">Medium</span>';
else if( $count < 9 )
echo '<span class="slow">Slow</span>';
else echo '<span class="slow">Very Slow</span>';
?>
</li>
</ul>
</div>
<div id="kc-ggf-my-fonts">
<div id="kc-ggf-mf-header">
<span><?php _e('List fonts used in your site', 'kingcomposer'); ?></span>
<i>(<?php _e('Please remove unused fonts to make your site load faster', 'kingcomposer'); ?>)</i>
<i class="sl-close" data-action="close-my-fonts"></i>
</div>
<div id="kc-ggf-mf-body"></div>
</div>
<div id="kc-ggf-body">
<div id="kc-ggf-pagination-top" class="kc-ggf-pagination"></div>
<div id="kc-ggf-render"><span class="kc-ggf-loading"><i class="fa-spinner fa-spin fa-2x fa-fw"></i></span></div>
<div id="kc-ggf-pagination-bottom" class="kc-ggf-pagination"></div>
</div>
<div id="kc-ggf-footer">
<?php
global $kc;
echo $kc->apply_filters('kc_font_powered_by',__('Powered by Google - Development by KingComposer Team', 'kingcomposer')); ?>.
</div>
</div>
<div id="kc-fonts-manager-resource"></div>
<div id="kc-fonts-manager-api"></div>
<script type="text/javascript">
jQuery('#wpadminbar,#wpfooter,#adminmenuwrap,#adminmenuback,#adminmenumain,#screen-meta').remove();
var kc_fonts_nonce = '<?php echo wp_create_nonce( "kc-fonts-nonce" ); ?>';
var kc_my_fonts = <?php echo json_encode( $kc_fonts ); ?>
</script>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,938 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
*
*/
if(!defined('KC_FILE')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
if( !function_exists('wp_list_widgets') )
require_once(ABSPATH . '/wp-admin/includes/widgets.php');
function kc_admin_enable( $force = false ){
if( $force === true )
return true;
global $post, $kc;
$type = !empty( $post->post_type ) ? $post->post_type:'';
$page = !empty( $_GET['page'] ) ? $_GET['page'] : '';
$allows_types = $kc->get_support_content_types();
if( is_admin() && ( in_array( $type, $allows_types ) || $page == 'kc-mapper' || $kc->is_live() ) )
return true;
else return false;
}
function kc_add_map( $map = array() ){
global $kc;
if( !is_array( $map ) )
return;
$kc->add_map( $map );
}
/*
* Add maps from exported file
*/
function kc_include_map($file) {
if (!file_exists($file))
return;
ob_start();
@include($file);
$data = ob_get_contents();
ob_end_clean();
/*
$handle = fopen($file, 'r' );
$data = fread($handle, filesize($file));
fclose($handle);
*/
$data = @json_decode($data, true);
if (!empty($data) && is_array($data)) {
global $kc;
$kc->add_map($data);
}
}
function kc_remove_map( $name = '' ){
global $kc;
if( empty( $name ) )
return;
$kc->remove_map( $name );
}
function kc_prebuilt_template ($name = '', $pack = '') {
global $kc;
if (empty($name) || empty($pack))
return false;
$kc->prebuilt_template ($name, $pack);
}
function kc_hide_element( $name = '' ){
global $kc;
if( empty( $name ) )
return;
$kc->hide_element( $name );
}
function kc_add_param_type( $name = '', $func = '' ){
global $kc;
if( empty( $name ) || empty( $func ) )
return;
$kc->add_param_type( $name, $func );
}
function kc_add_icon( $source = '' ){
if( !empty( $source ) ){
KingComposer::globe()->add_icon_source( $source );
}
}
function kc_remove_wpautop( $content, $autop = false ) {
if ( $autop ) {
$content = wpautop( preg_replace( '/<\/?p\>/', "\n", $content ) . "\n" );
}
return do_shortcode( shortcode_unautop( $content ) );
}
function kc_validate_options( $plugin_options ){
if( isset( $_POST['kc_options'] ) && !empty( $_POST['kc_options'] ) ){
if( isset( $_POST['re-active-kc-pro'] ) && $_POST['re-active-kc-pro'] == '1' ){
$result = activate_plugin( 'kc_pro/kc_pro.php' );
}
return $plugin_options;
}
}
function kc_youtube_id_from_url( $url = '' ) {
parse_str( parse_url( $url, PHP_URL_QUERY ), $vars );
return isset( $vars['v'] ) ? $vars['v'] : '';
}
function kc_loop_box( $items ){
if( empty( $items ) )
return '';
$output = '';
foreach( $items as $item ){
if( is_object( $item ) && $item->tag != 'text' ){
if( !isset( $item->attributes ) || !is_object( $item->attributes ) )
$item->attributes = new stdClass();
if( !isset( $item->attributes->class ) )
$item->attributes->class = '';
if( $item->tag == 'image' )
$item->tag = 'img';
if( $item->tag == 'icon' )
$item->tag = 'i';
if( $item->tag == 'column' ){
$item->tag = 'div';
$item->attributes->class .= ' '.$item->attributes->cols;
unset( $item->attributes->cols );
}
$output .= '<'.$item->tag;
if( $item->tag == 'img' ){
if( empty( $item->attributes->src ) )
$item->attributes->src = KC_URL.'/assets/images/get_start.jpg';
if( $item->tag == 'img' && !isset( $item->attributes->alt ) )
$item->attributes->alt = '';
}
foreach( $item->attributes as $k => $v ){
if( !empty($v) )$output .= ' '.$k.'="'.trim($v).'"';
}
if( $item->tag == 'img' )
$output .= '/';
$output .= '>';
if( is_array( $item->children ) )
$output .= kc_loop_box( $item->children );
if( $item->tag != 'img' )
$output .= '</'.$item->tag.'>';
}else $output .= $item->content;
}
return $output;
}
function kc_get_terms( $tax = 'category', $key = 'id', $type = '', $default = '' ){
$get_terms = (array) get_terms( $tax, array( 'hide_empty' => false ) );
if( $type != '' ){
$get_terms = kc_get_terms_by_post_type( array($tax), array($type) );
}
$terms = array();
if( $default != '' ){
$terms[] = $default;
}
if ( $key == 'id' ){
foreach ( $get_terms as $term ){
if( isset( $term->term_id ) && isset( $term->name ) ){
$terms[$term->term_id] = $term->name;
}
}
}else if ( $key == 'slug' ){
foreach ( $get_terms as $term ){
if( !empty($term->name) ){
if( isset( $term->slug ) && isset( $term->name ) ){
$terms[$term->slug] = $term->name;
}
}
}
}
return $terms;
}
function kc_filter_search( $s, &$w ) {
global $wpdb;
if ( empty( $s ) )return '';
$q = $w->query_vars;
$n = ! empty( $q['exact'] ) ? '' : '%';
$s = $sa = '';
foreach ( (array) $q['search_terms'] as $t ) {
$t = $wpdb->esc_like( $t );
$l = $n . $t . $n;
$s .= $wpdb->prepare( "{$sa}($wpdb->posts.post_title LIKE %s)", $l );
$sa = ' AND ';
}
if ( ! empty( $s ) )
$s = " AND ({$s}) ";
return $s;
}
function kc_get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) {
if ( ! is_array( $type ) )
$type = explode( ' ', $type );
$button_shorthand = array( 'primary', 'small', 'large' );
$classes = array( 'button' );
foreach ( $type as $t ) {
if ( 'secondary' === $t || 'button-secondary' === $t )
continue;
$classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t;
}
$class = implode( ' ', array_unique( $classes ) );
if ( 'delete' === $type )
$class = 'button-secondary delete';
$text = $text ? $text : __( 'Save Changes' );
// Default the id attribute to $name unless an id was specifically provided in $other_attributes
$id = $name;
if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) {
$id = $other_attributes['id'];
unset( $other_attributes['id'] );
}
$attributes = '';
if ( is_array( $other_attributes ) ) {
foreach ( $other_attributes as $attribute => $value ) {
$attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important
}
} elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string
$attributes = $other_attributes;
}
// Don't output empty name and id attributes.
$name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : '';
$id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$button = '<input type="submit"' . $name_attr . $id_attr . ' class="' . esc_attr( $class );
$button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';
if ( $wrap ) {
$button = '<p class="submit">' . $button . '</p>';
}
return $button;
}
function kc_process_tab_title( $matches ){
if( !empty( $matches[0] ) ){
$tab_atts = shortcode_parse_atts( $matches[0] );
$title = ''; $adv_title = '';$tab_id='';
if ( isset( $tab_atts['title'] ) )
$title = $tab_atts['title'];
if ( isset( $tab_atts['tab_id'] ) )
$tab_id = $tab_atts['tab_id'];
if( isset( $tab_atts['advanced'] ) && $tab_atts['advanced'] === 'yes' ){
if( isset( $tab_atts['adv_title'] ) && !empty( $tab_atts['adv_title'] ) )
$adv_title = base64_decode( $tab_atts['adv_title'] );
$icon=$icon_class=$image=$image_id=$image_url=$image_thumbnail=$image_medium=$image_large=$image_full='';
if( isset( $tab_atts['adv_icon'] ) && !empty( $tab_atts['adv_icon'] ) ){
$icon_class = $tab_atts['adv_icon'];
$icon = '<i class="'.$tab_atts['adv_icon'].'"></i>';
}
if( isset( $tab_atts['adv_image'] ) && !empty( $tab_atts['adv_image'] ) ){
$image_id = $tab_atts['adv_image'];
$image_url = wp_get_attachment_image_src( $image_id, 'full' );
$image_medium = wp_get_attachment_image_src( $image_id, 'medium' );
$image_large = wp_get_attachment_image_src( $image_id, 'large' );
$image_thumbnail = wp_get_attachment_image_src( $image_id, 'thumbnail' );
if( !empty( $image_url ) && isset( $image_url[0] ) ){
$image_url = $image_url[0];
$image_full = $image_url;
}
if( !empty( $image_medium ) && isset( $image_medium[0] ) )
$image_medium = $image_medium[0];
if( !empty( $image_large ) && isset( $image_large[0] ) )
$image_large = $image_large[0];
if( !empty( $image_thumbnail ) && isset( $image_thumbnail[0] ) )
$image_thumbnail = $image_thumbnail[0];
if( !empty( $image_url ) )
$image = '<img src="'.$image_url.'" alt="" />';
}
$adv_title = str_replace( array( '{title}', '{icon}', '{icon_class}', '{image}', '{image_id}', '{image_url}', '{image_thumbnail}', '{image_medium}', '{image_large}', '{image_full}', '{tab_id}' ), array( $title, $icon, $icon_class, $image, $image_id, $image_url, $image_thumbnail, $image_medium, $image_large, $image_full, $tab_id ), $adv_title );
echo '<li>'.$adv_title.'</li>';
}else{
if( isset( $tab_atts['icon_option'] ) && $tab_atts['icon_option'] == 'yes' ){
if(empty($tab_atts['icon']))
$tab_atts['icon'] = 'fa-leaf';
$title = '<i class="'.$tab_atts['icon'].'"></i> '.$title;
}
echo '<li><a href="#'.(isset($tab_atts['tab_id']) ? $tab_atts['tab_id'] : '').'" data-prevent="scroll">'.$title.'</a></li>';
}
}
return $matches[0];
}
function kc_is_using(){
global $post;
$kc_return = false;
if (
!isset( $post ) ||
!isset( $post->ID ) ||
empty( $post->ID ) ||
!get_post_meta( $post->ID , 'kc_data', false )
) {
$kc_return = false;
} else {
$kc_meta = get_post_meta( $post->ID , 'kc_data', true );
if( isset( $kc_meta['mode'] ) && $kc_meta['mode'] == 'kc' ) {
$kc_return = true;
}
}
$kc_return = apply_filters('kc_is_using', $kc_return, $post);
return $kc_return;
}
function kc_js_callback( $callback ){
global $kc;
$kc->js_callback( $callback );
}
function kc_add_content_type( $type = '', $setion = true ){
global $kc;
if( !empty( $type ) )
$kc->add_content_type( $type, $setion );
}
/*
* Return the type of content
*/
function kc_get_post_type(){
global $post;
$type = '';
if( isset( $post ) && isset( $post->post_type ) )
$type = $post->post_type;
return $type;
}
/*
* Get content as raw format
*/
function kc_raw_content( $id = 0 ){
$content = '';
if ( FALSE !== get_post_status( $id ) ) {
$content = get_post_field('post_content_filtered', $id );
if( empty( $content ) )
$content = get_post_field( 'post_content', $id );
}
return $content;
}
function kc_do_shortcode( $content = '' ){
if( empty( $content ) )
return '';
global $kc_front;
if( !isset( $kc_front ) )
return do_shortcode( $content );
else return $kc_front->do_shortcode( $content );
}
function kc_remove_dir ($dirPath = '') {
if (empty($dirPath))
return false;
$dirPath = untrailingslashit($dirPath).KDS;
if ($dirPath == ABSPATH)
return false;
if (! is_dir($dirPath)) {
return false;
}
$files = scandir($dirPath, 1);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
if (is_dir($dirPath.$file)) {
kc_remove_dir($dirPath.$file);
} else {
unlink($dirPath.$file);
}
}
}
if (is_file($dirPath.'.DS_Store'))
unlink($dirPath.'.DS_Store');
return rmdir($dirPath);
}
/*
* Read changelogs from readme.txt
*/
function kc_changelogs(){
$path = KC_PATH.KDS.'readme.txt';
if (file_exists($path)) {
$content = @file_get_contents($path);
$anchor = strpos($content, '== Changelog ==');
if (!empty($content) && $anchor !== false) {
$content = substr($content, $anchor + strlen('== Changelog =='));
$content = explode("\n", $content);
$group = array('newfeatures' => array(), 'improve' => array(), 'bugfixes' => array(), 'changes' => array(), 'remove' => array());
foreach ($content as $n => $line) {
$line = trim($line);
if (substr ($line, 0, 1) == '*') {
$line = trim(substr ($line, 1));
if (strpos($line, '[New]') === 0)
$group['newfeatures'][] = substr ($line, 5);
else if (strpos($line, '[Improve]') === 0)
$group['improve'][] = substr ($line, 9);
else if (strpos($line, '[Fix]') === 0)
$group['bugfixes'][] = substr ($line, 5);
else if (strpos($line, '[Remove]') === 0)
$group['remove'][] = substr ($line, 8);
else $group['changes'][] = $line;
}
else {
foreach ($group as $label => $items) {
if (count($items) > 0) {
echo '<div class="kc-log-type '.esc_attr($label).'"><strong>'.esc_attr($label).'</strong></div>';
echo '<ul>';
foreach ($items as $i => $item) {
if (!empty($item))
echo '<li>'.esc_html($item).'</li>';
}
echo '</ul>';
}
}
$group = array('newfeatures' => array(), 'improve' => array(), 'bugfixes' => array(), 'changes' => array(), 'remove' => array());
if (substr ($line, strlen($line)-1) == '=' && substr ($line, 0, 1) == '=')
echo '<h3 class="kc-log-ver">Version '.substr ($line, 1, strlen($line)-2).'</h3>';
}
}
} else {
_e('Error: Could not read data', 'kingcomposer');
}
} else {
_e('Error: Could not find the file readme.txt', 'kingcomposer');
}
}
/*
* Build list template from prebuilt list
*/
function kc_prerebuilt_templates ($data = array(), $registered = array()) {
if (!isset($data['data']))
return $data;
$lz = array();
foreach ($registered as $name => $path) {
if (!isset($data['data']['term']) || empty($data['data']['term']) || !isset($registered[$data['data']['term']]))
$data['data']['term'] = $name;
$data['data']['terms'][] = array('name' => $name, 'id' => '', 'taxonomy' => $name);
}
$posts = kc_get_template_xml($registered[$data['data']['term']], '', $data['data']['s']);
if (count($posts) > 0) {
$to = (int)$data['data']['paged']*(int)$data['data']['per_page'];
$start = $to-(int)$data['data']['per_page'];
$data['data']['items'] = array();
for($i = $start; $i < $to; $i++){
if (isset($posts[$i]))
$data['data']['items'][] = $posts[$i];
}
$data['data']['total'] = ceil(count($posts)/(int)$data['data']['per_page']);
$data['data']['count'] = count($posts);
$data['stt'] = 1;
$data['message'] = 'Success';
}else{
$data['message'] = '<span style="font-size: 50px;">\\(^Д^)/</span><br /><br /><span style="font-size: 16px">'.__('Oops, there are no template found in package', 'kingcomposer').' <strong>'.$data['data']['term'].'</strong><br /><small><i>'.$registered[$data['data']['term']].'</i></small>';
}
return $data;
}
/*
* Read templates from xml
*/
function kc_get_template_xml($file = '', $id = '', $s = '') {
if (empty($file) || !file_exists($file))
return null;
$xml = simplexml_load_file($file);
$posts = array();
foreach ($xml->channel->item as $item) {
$meta = $item->children('http://wordpress.org/export/1.2/');
$kc_meta = false;
for ($i = 0; $i < count($meta->postmeta); $i++) {
if ($meta->postmeta[$i]->meta_key == 'kc_data') {
$kc_meta = unserialize($meta->postmeta[$i]->meta_value);
break;
}
}
if (!empty($id) && $id == (string)$meta->post_id) {
if ($kc_meta !== false && isset($kc_meta['mode']) && $kc_meta['mode'] == 'kc') {
$content = $item->children('http://purl.org/rss/1.0/modules/content/');
return array((string)$content->encoded, $kc_meta);
}else{
return array(null, null);
}
}
if ($kc_meta !== false && isset($kc_meta['mode']) && $kc_meta['mode'] == 'kc') {
if ($s === '' || strpos(strtolower(html_entity_decode($item->title)), strtolower($s)) !== false) {
$posts[] = array(
'title' => html_entity_decode($item->title),
'preview' => isset($kc_meta['thumbnail']) ? $kc_meta['thumbnail'] : '',
'date' => date('F d, Y', strtotime((string)$item->pubDate)),
'categories' => array(),
'id' => (string)$meta->post_id,
'type' => 'xml'
);
}
}
}
return $posts;
}
/*
* Read templates from xml
*/
function kc_set_transient_xml_attachs() {
global $kc, $wpdb;
$delete_transient = "delete from {$wpdb->options} where option_name like '_transient_kc_attach_xml_%' or option_name like '_transient_timeout_kc_attach_xml_%'";
$xmls = $kc->get_prebuilt_templates();
if (is_array($xmls) && count($xmls) > 0) {
$sizes = 0;
$names = '';
$unique_key = get_option('kc_map_xml_attachments', true);
foreach ($xmls as $file) {
if (file_exists($file)) {
$sizes += filesize($file);
$names .= $file;
}
}
$unique = md5($names).$sizes;
if ($unique_key !== $unique) {
update_option('kc_map_xml_attachments', $unique);
// DELETE transient before adding new fresh bellow
$wpdb->query($delete_transient);
foreach ($xmls as $file) {
if (file_exists($file)) {
$xml = simplexml_load_file($file);
foreach ($xml->channel->item as $item) {
$meta = $item->children('http://wordpress.org/export/1.2/');
if ((string)$meta->post_type == 'attachment') {
$_wp_attached_file = '';
$_wp_attachment_metadata = array();
for ($i = 0; $i < count($meta->postmeta); $i++) {
if ($meta->postmeta[$i]->meta_key == '_wp_attached_file') {
$_wp_attached_file = (string)$meta->postmeta[$i]->meta_value;
}
if ($meta->postmeta[$i]->meta_key == '_wp_attachment_metadata') {
$_wp_attachment_metadata = unserialize($meta->postmeta[$i]->meta_value);
}
}
$serialized_value = maybe_serialize(array(
'url' => (string)$meta->attachment_url,
'metadata' => $_wp_attachment_metadata,
'expiration' => (defined('KC_ATTACHS_XML_EXPIRATION') ? (time()+(int)KC_ATTACHS_XML_EXPIRATION) : 0)
));
$wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", '_transient_kc_attach_xml_'.(string)$meta->post_id, $serialized_value, 'no' ) );
}
}
}
}
}
} else if (get_option('kc_map_xml_attachments')) {
$wpdb->query($delete_transient);
delete_option('kc_map_xml_attachments');
}
}
/*
* preg replace attach url
*/
function kc_images_filter($url = '') {
//$regx = '/\%SITE\_URL\%(.+?)\.(jpg|gif|png|jpeg|JPG|GIF|PNG|JPEG|http)/';
//$regx = '/\%SITE\_URL\%(.+?)\.([A-Za-z0-9\s]+)/i';
$regx = '/\%SITE\_URL\%(.+?)(\'|\"|\)|\ )/i';
return preg_replace_callback($regx, 'kc_images_filter_callback', $url);
}
function kc_images_filter_callback($m) {
return kc_attach_url(KC_SITE.$m[1]).$m[2];
}
/*
* Fix attach urls
*/
function kc_attach_url($url = '') {
if (strpos($url, KC_SITE.'/wp-content') === false)
return $url;
global $kc;
$xmls = $kc->get_prebuilt_templates();
$test_exist = str_replace(
array(KC_SITE . '/wp-content', '/', '\\'),
array(untrailingslashit(WP_CONTENT_DIR), KDS, KDS),
$url
);
if (count($xmls) === 0) {
if (strpos($url, KC_SITE) === 0 && !file_exists($test_exist)) {
return KC_URL.'/assets/images/get_start.jpg';
}
return $url;
}
if (strpos($url, KC_SITE) === 0 && file_exists($test_exist)) {
return $url;
}else{
global $wpdb;
kc_set_transient_xml_attachs();
$xurl = str_replace(KC_SITE, '', esc_url($url));
$posts = $wpdb->get_results("select * from {$wpdb->options} where (option_name like '_transient_kc_attach_xml_%' or option_name like '_transient_timeout_kc_attach_xml_%') and option_value like '%".$xurl."%'");
if (count($posts) > 0) {
$attach = unserialize($posts[0]->option_value);
if (isset($attach['expiration']) && ($attach['expiration'] === 0 || $attach['expiration'] > time())) {
if (isset($attach['url']) &&
strpos($attach['url'], $xurl) !== false &&
strpos($attach['url'], "/wp-content/uploads") !== false
){
$attach['url'] = explode("/wp-content/uploads", $attach['url']);
return $attach['url'][0].$xurl;
}
}else{
delete_transient(str_replace('_transient_', '', $posts[0]->option_name));
}
}
}
return $url;
}
/*
* Return a random string with length
*/
function kc_random_string( $length = 10 ){
$str = "";
$allow_characters = array_merge(range('A','Z'), range('a','z'), range('0','9'));
$_max_length = count($allow_characters) - 1;
for ($i = 0; $i < $length; $i++) {
$rand = mt_rand(0, $_max_length);
$str .= $allow_characters[$rand];
}
return $str;
}
/*
* Get first image in content of a post
*/
function kc_first_image( $content ) {
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
if( isset($matches[1][0]) )
return $matches[1][0];
return false;
}
/*
* Sort screen size as ordering
*/
function kc_screen_sort( array &$array ) {
$screens = array('any', '1000-5000', '1024', '999', '767', '479');
uksort($array, function($key1, $key2) use ($screens) {
return (array_search($key1, $screens) > array_search($key2, $screens));
});
}
/*
* Sort first array base on key as array second
*/
function kc_abasort( array &$array, $order ) {
$order = array('any', '1000-5000', '1024', '999', '767', '479');
uksort($array, function($key1, $key2) use ($order) {
return (array_search($key1, $order) > array_search($key2, $order));
});
}
/*
* Return options for CSS columns
*/
function kc_column_options ( $selector ){
return array(
array(
'screens' => "any,1024,999,767,479",
'Typography' => array(
array('property' => 'color', 'label' => 'Color'),
array('property' => 'font-size', 'label' => 'Font Size'),
array('property' => 'font-weight', 'label' => 'Font Weight'),
array('property' => 'font-style', 'label' => 'Font Style'),
array('property' => 'font-family', 'label' => 'Font Family'),
array('property' => 'text-align', 'label' => 'Text Align'),
array('property' => 'text-shadow', 'label' => 'Text Shadow'),
array('property' => 'text-transform', 'label' => 'Text Transform'),
array('property' => 'text-decoration', 'label' => 'Text Decoration'),
array('property' => 'line-height', 'label' => 'Line Height'),
array('property' => 'letter-spacing', 'label' => 'Letter Spacing'),
array('property' => 'overflow', 'label' => 'Overflow'),
array('property' => 'word-break', 'label' => 'Word Break'),
),
//Background group
'Background' => array(
array('property' => 'background'),
),
//Box group
'Box' => array(
array('property' => 'margin', 'label' => 'Margin'),
array('property' => 'padding', 'label' => 'Padding'),
array('property' => 'border', 'label' => 'Border'),
array('property' => 'width', 'label' => 'Width'),
array('property' => 'height', 'label' => 'Height'),
array('property' => 'border-radius', 'label' => 'Border Radius'),
array('property' => 'float', 'label' => 'Float'),
array('property' => 'display', 'label' => 'Display'),
array('property' => 'box-shadow', 'label' => 'Box Shadow'),
array('property' => 'opacity', 'label' => 'Opacity'),
),
//Box group
'Inside' => array(
array('property' => 'margin', 'label' => 'Margin', 'selector' => $selector),
array('property' => 'padding', 'label' => 'Padding', 'selector' => $selector),
array('property' => 'border', 'label' => 'Border', 'selector' => $selector),
array('property' => 'width', 'label' => 'Width', 'selector' => $selector),
array('property' => 'height', 'label' => 'Height', 'selector' => $selector),
array('property' => 'border-radius', 'label' => 'Border Radius', 'selector' => $selector),
array('property' => 'float', 'label' => 'Float', 'selector' => $selector),
array('property' => 'display', 'label' => 'Display', 'selector' => $selector),
array('property' => 'box-shadow', 'label' => 'Box Shadow', 'selector' => $selector),
array('property' => 'opacity', 'label' => 'Opacity', 'selector' => $selector),
),
//Custom code css
'Custom' => array(
array('property' => 'custom', 'label' => 'Custom CSS')
)
),
);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,47 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
*
*/
if(!defined('ABSPATH')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
$id = isset( $_GET['id'] ) ? esc_attr( $_GET['id'] ) : 0;
if ( FALSE === get_post_status( $id ) ) {
echo '<script type="text/javascript">window.location.href="'.admin_url('/post.php?action=edit&post='.$id).'";</script>';
return;
}
$link = get_permalink( $id );
$data = get_post_meta($id , 'kc_data', true);
if( !is_array( $data ) )
$data = array( "mode" => "kc", "classes" => "", "css" => "" );
$data["mode"] = 'kc';
if( !add_post_meta( $id , 'kc_data' , $data, true ) )
update_post_meta( $id , 'kc_data' , $data );
if( strpos( $link, '?' ) === false )
$link .= '?kc_action=live-editor';
else $link .= '&kc_action=live-editor';
?>
<div id="kc-live-frame-wrp">
<iframe id="kc-live-frame" src="<?php echo esc_url( $link ); ?>"></iframe>
<div id="kc-live-frame-resizer"></div>
</div>
<a href="https://www.youtube.com/watch?v=QQcSldFalnI" target=_blank id="kc-how-responsive-works">
<?php _e('How responsive works?', 'kingcomposer'); ?>
</a>
<div style="height: 0px;width: 0px;overflow:hidden;">
<?php wp_editor( '', 'kc-editor-preload', array( "wpautop" => false, "quicktags" => true ) ); ?>
</div>

View File

@@ -0,0 +1,372 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
*
*/
if(!defined('KC_FILE')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
global $kc;
ob_start();
?>
<div class="wrap about-wrap">
<h1><?php _e('KC Shortcode Mapper', 'kingcomposer'); ?></h1>
<p class="about-text">
<?php _e('Mapping custom 3rd party shortcodes to add & edit by KingComposer', 'kingcomposer'); ?>.
<br />
<?php _e('Shortcodes need to be installed, or you can do it by following', 'kingcomposer'); ?>
<a href="http://docs.kingcomposer.com/display-the-output-of-the-shortcode/" target=_blank>
<?php _e('This Article', 'kingcomposer'); ?>
</a>
</p>
<div id="kc-mapper-list">
<div class="item add-new">
<i class="sl-plus"></i>
<br />
<?php _e('New Shortcode', 'kingcomposer'); ?>
</div>
<div class="item import-export">
<i class="sl-refresh"></i>
<br />
<?php _e('Import / Export', 'kingcomposer'); ?>
</div>
</div>
<pre class=kc-mapper-pre>
// Data stored in wp option "kc_shortcodes_mapper: get_option('kc_shortcodes_mapper', true);
// Use method "kc_include_map" to include exported_map_file in your theme: kc_include_map($path);
</pre>
</div>
<div id="kc-mapper-overlay">
<div id="kc-mapper-settings">
<div id="kc-mapper-screen-add-new" class="kc-mapper-screen">
<h2 class="mp-title"><?php _e('Add new shortcode map', 'kingcomposer'); ?></h2>
<p class="error"></p>
<strong><?php _e('Enter shortcode name or full shortcode string', 'kingcomposer'); ?>:</strong>
<textarea id="kc-mapper-string" class="mmp"></textarea>
<p class="desc">
<?php _e('Example', 'kingcomposer'); ?>: <strong>contact-form-7</strong>
<?php _e('or full string', 'kingcomposer'); ?>
<strong>[contact-form-7 id="1" title="Contact form 1"]</strong>
</p>
<p>
<button class="color mbtn" id="kc-mapper-parse"><i class="fa-flash"></i> <?php _e('Parse Shortcode', 'kingcomposer'); ?></button>
<button class="kc-mapper-settings-close mbtn"><i class="fa-times"></i> <?php _e('Cancel', 'kingcomposer'); ?></button>
</p>
</div>
<div id="kc-mapper-screen-edit" class="kc-mapper-screen">
<div id="kc-mapper-shortcode-info">
<div class="kc-mp-sc-icon">
<div class="icons-preview">
<i class="fa-star"></i>
</div>
<input type="hidden" name="icon" class="kc-param kc-param-icons infp" />
</div>
<div class="kc-mp-sc-info">
<label><?php _e('Shortcode Tag', 'kingcomposer'); ?>:</label>
<input type="text" name="tag" class="infp" />
</div>
<div class="kc-mp-sc-info">
<label><?php _e('Name', 'kingcomposer'); ?>:</label>
<input type="text" name="name" class="infp" />
</div>
<div class="kc-mp-sc-info">
<label><?php _e('Category', 'kingcomposer'); ?>:</label>
<input type="text" name="category" class="infp" />
</div>
<div class="kc-mp-sc-info desc">
<label><?php _e('Description', 'kingcomposer'); ?>:</label>
<input type="text" name="description" class="infp" />
</div>
<div class="kc-mp-sc-info">
<label><?php _e('Include content into', 'kingcomposer'); ?>?:</label>
<input type="checkbox" name="is_container" class="infp" />
</div>
<div class="kc-mp-sc-shortcode-string">
&nbsp;
</div>
</div>
<div id="kc-mapper-fields"></div>
<div id="kc-mapper-fields-preview" class="m-p-body"></div>
<div id="kc-mapper-fields-btn">
<button class="save-fields color mbtn"><i class="fa-check"></i> <?php _e('Save', 'kingcomposer'); ?></button>
<button class="kc-mapper-settings-close mbtn"><i class="fa-times"></i> <?php _e('Cancel', 'kingcomposer'); ?></button>
<button class="kc-mapper-settings-delete mbtn delete"><i class="fa-trash"></i> <?php _e('Delete', 'kingcomposer'); ?></button>
<p>
<?php _e('Need help how to display output of shortcode?', 'kingcomposer'); ?>
<a href="http://docs.kingcomposer.com" target=_blank><?php _e('Check docs', 'kingcomposer'); ?></a>
</p>
</div>
</div>
<div id="kc-mapper-screen-import-export" class="kc-mapper-screen">
<h2 class="mp-title">
<a href="#export" class="active"><?php _e('Export', 'kingcomposer'); ?></a>
<a href="#import"><?php _e('Import', 'kingcomposer'); ?></a>
</h2>
<div class="tab export" style="display: block;">
<h2><?php _e('Export shortcodes mapper', 'kingcomposer'); ?>:</h2>
<textarea name="export" class="mmp"></textarea>
<p class="mmp-files">
<input type="text" name="export-name" placeholder="<?php _e('Enter file name', 'kingcomposer'); ?>" value="shortcode_maps_<?php echo date("F-j-Y-gi"); ?>" class="mmp" />
<button class="mbtn color do-export">
<i class="fa-download"></i> <?php _e('Download File', 'kingcomposer'); ?> (*.kc)
</button>
<button class="kc-mapper-settings-close mbtn">
<i class="fa-times"></i> <?php _e('Cancel', 'kingcomposer'); ?>
</button>
<a href="" class="download-anchor"></a>
</p>
<pre>
// After download exported file, use method kc_include_map($path); to add maps automatically.
// $path is the absolute path of exported_file.kc
</pre>
</div>
<div class="tab import">
<h2><?php _e('Import shortcodes mapper', 'kingcomposer'); ?>:</h2>
<textarea name="import" placeholder="<?php _e('Enter your maps here', 'kingcomposer'); ?>" class="mmp"></textarea>
<p>
<strong><?php _e('Upload the maps file to import', 'kingcomposer'); ?> (*.kc):</strong><br />
<input type="file" class="mbtn" />
</p>
<p>
<input type="checkbox" class="mbtn" id="kc-mapper-import-overwrite" />
<label for="kc-mapper-import-overwrite"><?php _e('Overwrite shortcode if exists?', 'kingcomposer'); ?></label>
</p>
<p>
<button class="mbtn color do-import">
<i class="fa-upload"></i> <?php _e('Import Now', 'kingcomposer'); ?>
</button>
<button class="kc-mapper-settings-close mbtn">
<i class="fa-times"></i> <?php _e('Cancel', 'kingcomposer'); ?>
</button>
</p>
</div>
</div>
</div>
</div>
<?php
$kc_shortcodes_mapper = ob_get_contents();
ob_end_clean();
echo $kc->apply_filters('kc_shortcodes_mapper', $kc_shortcodes_mapper);
?>
<div style="display: none;"><?php wp_editor('', 'kc-editor-preload'); ?></div>
<script type="text/javascript" src="<?php echo esc_url(KC_URL); ?>/assets/js/kc.mapper.js"></script>
<script type="text/javascript">
var kc_mapper_shortcodes = <?php
$mapper = get_option('kc_shortcodes_mapper', true);
if (!$mapper || !is_array($mapper))
echo '{}';
else echo json_encode($mapper);
?>, kc_mapper_nonce = '<?php echo wp_create_nonce( "kc-mapper-nonce" ); ?>';
</script>
<script type="text/html" id="tmpl-kc-mapper-field-template">
<div class="field_row field_row_param<# if (data.name == 'content'){ #> content_include<# } #>">
<h3 class="field-heading">
<span>{{(data.label !== '') ? data.label : data.name}}</span>
<i class="fa-times" data-action="delete-field" title="Delete param"></i>
</h3>
<div class="field-row-body">
<div class="values-fields">
<label><?php _e('Param name', 'kingcomposer'); ?>:</label>
<input name="name" value="{{data.name}}" class="kc-mapper-inp" type="text" <# if (data.name == 'content'){ #> disabled<# } #> />
<p><?php _e('The id of param', 'kingcomposer'); ?></p>
<label><?php _e('Param label', 'kingcomposer'); ?>:</label>
<input name="label" value="{{data.label}}" class="kc-mapper-inp" type="text" />
<p><?php _e('Heading of param', 'kingcomposer'); ?></p>
<label><?php _e('Field type', 'kingcomposer'); ?>:</label>
<#
if (data.level == 1)
{
if (data.name == 'content'){
var fields_support = {
textarea_html: 'Textarea Html',
text: 'Text field',
textarea: 'Textarea',
}
}else{
var fields_support = {
text: 'Text field',
textarea: 'Textarea',
toggle: 'Toggle',
dropdown: 'Dropdown',
radio: 'Radio',
checkbox: 'Checkbox',
radio_image: 'Radio Image',
group: 'Group Fields',
editor: 'Editor',
color_picker: 'Color Picker',
date_picker: 'Date Picker',
icon_picker: 'Icon Picker',
post_taxonomy: 'Post Taxonomy',
number_slider: 'Number Slider',
link: 'Link',
autocomplete: 'Autocomplete',
attach_image: 'Media (return ID)',
attach_images: 'Multiple Media (return IDs)',
attach_image_url: 'Media (return url)',
hidden: 'Hidden'
}
}
} else {
// fields level 2 into group
var fields_support = {
text: 'Text field',
textarea: 'Textarea',
toggle: 'Toggle',
dropdown: 'Dropdown',
radio: 'Radio',
checkbox: 'Checkbox',
radio_image: 'Radio Image',
editor: 'Editor',
color_picker: 'Color Picker',
date_picker: 'Date Picker',
icon_picker: 'Icon Picker',
post_taxonomy: 'Post Taxonomy',
number_slider: 'Number Slider',
link: 'Link',
autocomplete: 'Autocomplete',
attach_image: 'Media (return ID)',
attach_images: 'Multiple Media (return IDs)',
attach_image_url: 'Media (return url)',
hidden: 'Hidden'
}
}
#>
<select name="type" class="kc-mapper-inp">
<#
for (n in fields_support) {
#><option value="{{n}}"<# if (data.type == n){ #> selected<# } #>>{{fields_support[n]}}</option><#
}
#>
</select>
<p><?php _e('Select type for field', 'kingcomposer'); ?></p>
<# if (data.level == 1){ #>
<label><?php _e('Default value', 'kingcomposer'); ?>:</label>
<input name="value" value="{{data.value}}" class="kc-mapper-inp" type="text" />
<p><?php _e('The default value of field', 'kingcomposer'); ?></p>
<label><?php _e('Admin label', 'kingcomposer'); ?>:</label>
<p class="rdo">
<# var randip = parseInt(Math.random()*10000); #>
<input name="admin_label" value="1" <#
if (data.admin_label === true){ #> checked<# }
#> class="kc-mapper-inp" type="checkbox" id="kc-mapper-field-admin-label-{{randip}}" />
<label for="kc-mapper-field-admin-label-{{randip}}">
<?php _e('The value will show in preview', 'kingcomposer'); ?>
</label>
</p>
<# }else{ #>
<p>
<?php _e('Need help how to set default value for field group?', 'kingcomposer'); ?>
<a href="http://docs.kingcomposer.com/available-param-types/group-fields/" target=_blank><?php _e('Check docs', 'kingcomposer'); ?></a>
</p>
<# } #>
<div class="dropdown-relation-hidden"<#
if(['dropdown', 'radio', 'checkbox', 'number_slider', 'autocomplete', 'radio_image'].indexOf(data.type) > -1){
#> style="display: block;"<#
}
#>>
<label><?php _e('Options', 'kingcomposer'); ?>:</label>
<#
var str = "";
if (data.options !== '') {
for (var n in data.options) {
str += n+':'+data.options[n]+"\n"
}
}
#>
<textarea name="options" class="kc-mapper-inp" data-std-type="{{data.type}}" data-std-ops="{{str}}">{{{str}}}</textarea>
<p><?php _e('Separate options by enter new line', 'kingcomposer'); ?></p>
</div>
<label><?php _e('Description', 'kingcomposer'); ?>:</label>
<textarea name="description" class="kc-mapper-inp">{{data.description}}</textarea>
<p><?php _e('Param Description', 'kingcomposer'); ?></p>
<# if (data.level == 1 && data.name != 'content'){ #>
<label><?php _e('Relation', 'kingcomposer'); ?>:</label>
<#
str = "";
if (data.relation !== '') {
for (var n in data.relation) {
str += n+':'+data.relation[n]+"\n"
}
}
#>
<p class="rdo">
<# randip = parseInt(Math.random()*10000); #>
<input name="relation-op" value="1" <#
if (str !== ''){ #> checked<# }
#> class="kc-mapper-inp" type="checkbox" id="kc-mapper-field-admin-label-{{randip}}" />
<label for="kc-mapper-field-admin-label-{{randip}}">
<?php _e('Show or hide depending on the another field (Note: parent field must be placed above this field)', 'kingcomposer'); ?>
</label>
<textarea name="relation" class="kc-mapper-inp" data-std-vl="{{{str}}}" style="margin-top:10px;<#
if (str === ''){ #> display: none;<# }
#>">{{{str}}}</textarea>
<# } #>
</p>
</div>
<div class="groupfields-relation-hidden"<# if (data.type == 'group'){ #> style="display: block;"<#} #>>
<strong><?php _e('Children fields', 'kingcomposer'); ?>:</strong>
<input type="hidden" name="params" value="{{(data.params!=='')?JSON.stringify(data.params):''}}" class="kc-mapper-inp" />
<div class="kc-group-fields-render"></div>
</div>
</div>
</div>
<#
data.callback = function(wrp, data) {
wrp.find('>.field-heading').on('mousedown', function(e)
{
this.clientX = e.clientX;
this.clientY = e.clientY;
}).on('mouseup', function(e) {
if (this.clientX == e.clientX && this.clientY == e.clientY)
{
if (e.target.getAttribute('data-action') == 'delete-field') {
kc_mapper.field.delete(this);
return;
}
var $this = jQuery(this),
cur = $this.parent().find('>.field-row-body').css('display');
$this.parent().parent().find('>.field_row>.field-row-body').hide();
if (cur === 'block')
cur = 'hidden';
else cur = 'block';
$this.parent().find('>.field-row-body').css('display', cur);
}
});
wrp.find('.kc-mapper-inp').on('change', kc_mapper.field.change);
if (data.type == 'group' && data.params !== '' && Object.keys(data.params).length > 0) {
kc_mapper.field.render(
wrp.find('.kc-group-fields-render'),
data.params
);
}
}
#>
</script>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,53 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
*
*/
if(!defined('KC_FILE')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
global $kc;
?>
<div id="kc-right-click-helper"><i class="sl-close"></i></div>
<div style="display:none;" id="kc-storage-prepare">
<div id="kc-css-box-test"></div>
</div>
<img width="50" src="<?php echo KC_URL; ?>/assets/images/drag.png" id="kc-ui-handle-image" />
<img width="50" src="<?php echo KC_URL; ?>/assets/images/drag-copy.png" id="kc-ui-handle-image-copy" />
<div id="kc-undo-deleted-element">
<a href="javascript:void(0)" class="do-action">
<i class="sl-action-undo"></i> <?php _e('Restore deleted items', 'kingcomposer'); ?>
<span class="amount">0</span>
</a>
<div id="drop-to-delete"><span></span></div>
<i class="sl-close"></i>
</div>
<script type="text/html" id="tmpl-kc-top-nav-template">
<?php do_action('kc-top-nav'); ?>
</script>
<script type="text/html" id="tmpl-kc-wp-widgets-template">
<div id="kc-wp-list-widgets"><?php
if( !function_exists( 'submit_button' ) ){
function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
echo kc_get_submit_button( $text, $type, $name, $wrap, $other_attributes );
}
}
ob_start();
wp_list_widgets();
$content = str_replace( array( '<script', '</script>' ), array( '&lt;script', '&lt;/script&gt;' ), ob_get_contents() );
ob_end_clean();
echo $content;
?></div>
</script>
<?php do_action('kc_tmpl_nocache'); ?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
*
*/
if(!defined('ABSPATH')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
global $kc;
$pdk = $kc->check_pdk();
?>
<div class="kc-pro-settings wrap about-wrap">
<?php
if( !is_dir( ABSPATH.KDS.'wp-content'.KDS.'plugins'.KDS.'kc_pro' ) ){
?>
<table class="form-table">
<tbody>
<tr>
<td>
<div id="kc-pro-settings-download-wrp">
<h1 style="margin: 0px;"><?php echo _e( 'Try the KC Pro! now', 'kingcomposer' ); ?></h1>
<h3><?php echo _e( 'Start your free 7-day trial to discover the Front-End Live Editor with leading professional.', 'kingcomposer' ); ?></h3>
<br />
<hr />
<br />
<p>
<input type="hidden" id="kc-nonce-download" value="<?php echo wp_create_nonce('kc-pro-download'); ?>" />
<button class="button button-large button-primary" id="kc-pro-settings-process-download">
<?php _e('Install KC Pro! Automatically', 'kingcomposer'); ?>
<i class="dashicons dashicons-external"></i>
</button>
<span class="kc-pro-direct-download">
&nbsp; Or &nbsp;
<a href="http://bit.ly/kc-pro">
<?php _e('Directly download kc-pro.zip', 'kingcomposer'); ?>
</a>
</span>
</p>
<br />
</div>
</td>
<td>
<p>
<br />
<iframe width="380" height="220" id="kc-pro-settings-video-frame" src="https://www.youtube.com/embed/kFANGxXh6Fw" frameborder="0" allowfullscreen></iframe>
<p class="align-center">
<button class="button" id="kc-pro-settings-larger-video" >
<i class="dashicons dashicons-editor-expand"></i>
<?php _e( 'Larger video size', 'kingcomposer' ); ?>
</button>
</p>
</p>
</td>
</tr>
</tbody>
</table>
<?php
}else{
$plugin_path = 'kc_pro/kc_pro.php';
$active_url = wp_nonce_url( self_admin_url('plugins.php?action=activate&plugin='.$plugin_path), 'activate-plugin_'.$plugin_path );
?>
<p>
<a href="<?php echo $active_url; ?>" class="button button-large button-primary">
<?php _e( 'Active the KC Pro! now', 'kingcomposer' ); ?>
</a>
</p>
<?php } ?>
</div>

View File

@@ -0,0 +1,154 @@
<?php
/**
*
* (i) Sections manager
* (c) KingComposer.com
* (s) since version 2.5
*
*/
class kc_sections{
function __construct(){
$this->register();
if( is_admin() ){
add_filter ('manage_edit-kc-section_columns', array(&$this, 'edit_kc_section_columns'));
add_action ('manage_kc-section_posts_custom_column', array(&$this, 'manage_kc_section_columns'), 10, 2);
}
}
public function edit_kc_section_columns( $columns ) {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Title', 'kingcomposer' ),
'screenshot' => __( 'Preview', 'kingcomposer' ),
'taxonomy-kc-section-category' => __( 'Categories', 'kingcomposer' ),
'date' => __( 'Date', 'kingcomposer' )
);
return $columns;
}
public function manage_kc_section_columns( $column, $post_id ) {
global $post;
switch( $column ) {
case 'screenshot' :
$url = get_the_post_thumbnail_url( $post );
//get thumbnail data
$get_data = get_post_meta ($post->ID , 'kc_data', true);
$thumbnail = '';
if (!empty($get_data) && is_array($get_data))
{
$thumbnail = $get_data['thumbnail'];
}
if( $url ){
echo '<img src="'. esc_url( $url ).'" style="max-width:100%;margin-top:10px;" />';
}else if( $thumbnail != '') {
echo '<img src="'. esc_url( $thumbnail ).'" style="max-width:100%;margin-top:10px;" />';
}else{
echo __('No preview set', 'kingcomposer');
}
break;
/* Just break out of the switch statement for everything else. */
default :
break;
}
}
public function register(){
global $kc;
$labels = array(
'name' => __( 'KC Sections', 'kingcomposer' ),
'singular_name' => __( 'KC Sections', 'kingcomposer' ),
'menu_name' => __( 'KC Sections', 'kingcomposer' ),
'name_admin_bar' => __( 'KC Sections', 'kingcomposer' ),
'add_new' => __( 'Add New', 'kingcomposer' ),
'add_new_item' => __( 'Add New Section', 'kingcomposer' ),
'new_item' => __( 'New KC Section', 'kingcomposer' ),
'edit_item' => __( 'Edit KC Section', 'kingcomposer' ),
'view_item' => __( 'View KC Section', 'kingcomposer' ),
'all_items' => __( 'Sections Manager', 'kingcomposer' ),
'search_items' => __( 'Search sections', 'kingcomposer' ),
'parent_item_colon' => __( 'Parent section:', 'kingcomposer' ),
'not_found' => __( 'No section found.', 'kingcomposer' ),
'not_found_in_trash' => __( 'No section found in Trash.', 'kingcomposer' ),
);
$labels = $kc->apply_filters('kc_section_labels', $labels);
$args = array(
'labels' => $labels,
'public' => true,
'show_in_menu' => 'kingcomposer',
'supports' => array( 'title', 'editor', 'thumbnail' ),
'taxonomies' => array( 'kc-section-category' ),
'rewrite' => array( 'slug' => 'kc-section', 'with_front' => false ),
'exclude_from_search' => true
);
register_post_type( 'kc-section', $args );
register_taxonomy(
'kc-section-category' ,
'kc-section',
array(
'hierarchical' => true,
'labels' => array(
'name' => __('Section Categories', 'kingcomposer' ),
'singular_name' => __('Section Category', 'kingcomposer' ),
'search_items' => __('Search Section Categories', 'kingcomposer' ),
'popular_items' => __('Popular Section Categories', 'kingcomposer' ),
'all_items' => __('All Section Categories', 'kingcomposer' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __('Edit Section Category', 'kingcomposer' ),
'update_item' => __('Update Section Category', 'kingcomposer' ),
'add_new_item' => __('Add New Section Category', 'kingcomposer' ),
'new_item_name' => __('New Section Category Name', 'kingcomposer' ),
'separate_items_with_commas' => __('Separate Section Category with commas', 'kingcomposer' ),
'add_or_remove_items' => __('Add or remove Section Category', 'kingcomposer' ),
'choose_from_most_used' => __('Choose from the most used Section Category', 'kingcomposer' ),
'not_found' => __('No Section Category found.', 'kingcomposer' ),
'menu_name' => __(' Sections Categories', 'kingcomposer' ),
),
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'kc-section-category' )
)
);
$kc->add_content_type('kc-section');
}
}
/*
*
* Activate
*
*/
new kc_sections();

View File

@@ -0,0 +1,450 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
*
*/
if(!defined('ABSPATH')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
wp_enqueue_style('thickbox');
wp_enqueue_script('thickbox');
$kc = KingComposer::globe();
$pdk = $kc->get_pdk();
$settings = $kc->settings();
$plugin_info = get_plugin_data( KC_FILE );
$detail_url = admin_url('/plugin-install.php?tab=plugin-information&amp;plugin=%s&amp;section=changelog&amp;TB_iframe=true&amp;width=772&amp;height=600');
$show_license_tab = false;
if ($kc->plugin_active('kc_pro/kc_pro.php'))
$show_license_tab = true;
if (isset($pdk['pack']) && ($pdk['pack'] == 'commerce' || $pdk['pack'] == 'developer') && $kc->check_pdk() == 1)
$show_license_tab = false;
?>
<div id="kc-settings" class="wrap about-wrap">
<h1><?php
echo $kc->apply_filters('kc_setting_title', __('Welcome to KingComposer Page Builder!', 'kingcomposer')); ?></h1>
<?php
ob_start();
?>
<div class="about-text">
<?php _e('Thank you for using KingComposer page builder. If you need help or have any suggestions, join our community for discussion ', 'kingcomposer'); ?>
<a href="http://bit.ly/kcdiscuss" target=_blank>bit.ly/kcdiscuss</a>
</div>
<?php
$about = ob_get_contents();
ob_end_clean();
echo $kc->apply_filters('kc_setting_about', $about);
ob_start();
?>
<div class="wp-badge kc-badge">
<?php _e('Version', 'kingcomposer'); ?> <?php echo esc_attr( $plugin_info['Version'] ); ?>
</div>
<?php
$version = ob_get_contents();
ob_end_clean();
echo $kc->apply_filters('kc_setting_version', $version);
ob_start();
?>
<h2 class="nav-tab-wrapper">
<a href="#kc_general_setting" class="nav-tab nav-tab-active" id="kc_general_setting-tab">
<?php _e('General Settings', 'kingcomposer'); ?>
</a>
<?php if( $show_license_tab === true ){ ?>
<a href="#kc_product_license" class="nav-tab" id="kc_product_license-tab">
<?php _e('Product License', 'kingcomposer'); ?>
</a>
<?php } ?>
<a href="#kc_pro" class="nav-tab" id="kc_pro-tab">
<?php _e('KC Pro!', 'kingcomposer'); ?>
</a>
<a href="#kc_changelogs" class="nav-tab" id="kc_changelogs-tab">
<?php _e('Changelogs', 'kingcomposer'); ?>
</a>
</h2>
<?php
$tab_nav = ob_get_contents();
ob_end_clean();
echo $kc->apply_filters('kc_setting_tab_nav', $tab_nav);
/*
if (isset($_GET['screen']) && $_GET['screen'] == 'welcome')
{
@session_start();
if (isset($_SESSION['kc_disabled_plugins']) && count($_SESSION['kc_disabled_plugins']) > 0)
{
$list = array();
foreach ($_SESSION['kc_disabled_plugins'] as $name)
{
if (strpos($name, '/') !== false)
{
$name = substr($name, 0, strpos($name, '/')-1);
$list[] = $name;
}
}
echo '<div class="kc-notice"><p>'.__('Notice: To avoid conflict, We have disabled the following plugins: ', 'kingcomposer').'<strong>'.implode(', ', $list).'</strong>. <a href="'.admin_url('/plugins.php').'">'.__('Reactivate plugins', 'kingcomposer').'</a></p></div>';
}
} */
?>
<?php
$update_plugin = get_site_transient( 'update_plugins' );
if ( isset( $update_plugin->response[ KC_BASE ] ) )
{
ob_start();
?>
<div class="kc-updated">
<p>
<i class="dashicons dashicons-update"></i>
<?php _e('There is a new version of KingComposer available', 'kingcomposer'); ?>.
<a href="<?php printf( $detail_url, 'kingcomposer' ); ?>" class="thickbox open-plugin-details-modal" aria-label="<?php printf( __('View version %s details', 'kingcomposer'), $update_plugin->response[ KC_BASE ]->new_version ); ?>">
<?php printf( __('View version %s details', 'kingcomposer'), $update_plugin->response[ KC_BASE ]->new_version ); ?></a> or
<a href="#" class="update-link kc-update-link-ajax" data-slug="kingcomposer">
<?php _e('update now', 'kingcomposer'); ?>
</a>.
</p>
</div>
<?php
$kc_update = ob_get_contents();
ob_end_clean();
echo $kc->apply_filters('kc_setting_update', $kc_update);
}
if ( defined( 'KCP_BASENAME' ) && isset( $update_plugin->response[ KCP_BASENAME ] ) )
{
ob_start();
?>
<div class="kc-updated">
<p>
<i class="dashicons dashicons-update"></i>
<?php _e('There is a new version of KC Pro! available', 'kingcomposer'); ?>.
<a href="<?php printf( $detail_url, 'kc_pro' ); ?>" class="thickbox open-plugin-details-modal" aria-label="<?php printf( __('View version %s details', 'kingcomposer'), $update_plugin->response[ KCP_BASENAME ]->new_version ); ?>">
<?php printf( __('View version %s details', 'kingcomposer'), $update_plugin->response[ KCP_BASENAME ]->new_version ); ?>
</a> or
<a href="#" class="update-link kc-update-link-ajax" data-slug="kc_pro"><?php _e('update now', 'kingcomposer'); ?></a>.
</p>
</div>
<?php
$kc_update_pro = ob_get_contents();
ob_end_clean();
echo $kc->apply_filters('kc_setting_update_pro', $kc_update_pro);
}
?>
<form method="post" action="options.php" enctype="multipart/form-data" id="kc-settings-form" autocomplete="off">
<!-- fake fields are a workaround for chrome autofill getting the wrong fields -->
<input style="display:none" type="text" name="fakeusernameremembered"/>
<input style="display:none" type="password" name="fakepasswordremembered"/>
<?php settings_fields( 'kingcomposer_group' ); ?>
<div id="kc_general_setting" class="group p">
<?php
ob_start();
?>
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<?php _e('Supported Content Types', 'kingcomposer'); ?>:
</th>
<td>
<?php
$post_types = get_post_types( array( 'public' => true ) );
$ignored_types = array('attachment');
$settings_types = $kc->get_content_types();
$required_types = $kc->get_required_content_types();
foreach( $post_types as $type ){
if( !in_array( $type, $ignored_types ) ){
echo '<p class="radio"><input ';
if( in_array( $type, $settings_types ) )
echo 'checked ';
if( in_array( $type, $required_types ) )
echo 'disabled ';
echo'type="checkbox" name="kc_options[content_types][]" value="'.esc_attr($type).'"> ';
echo esc_html( $type );
if( in_array( $type, $required_types ) )
echo ' <i> (required)</i>';
echo '</p>';
}
}
?>
<br />
<span class="description">
<p>
- <?php _e('Besides page and post above, you can set any content type to be available with KingComposer such as gallery, contact form and so on', 'kingcomposer'); ?>.
</p>
<p>
- <?php _e('If your', 'kingcomposer'); ?> <strong>"Custom Post-Type"</strong>
<?php _e('does not show here? Please make sure that has been registered with parameter ', 'kingcomposer'); ?>
<strong>"public = true"</strong>
</p>
<p>
- <?php _e('Put this code on action "init" to force support', 'kingcomposer'); ?>:
<br />
<pre style="background:#fff">
global $kc;
// add single content type
$kc->add_content_type( 'your-post-type-name' );
// add multiple content types
$kc->add_content_type( array( 'type-1', 'type-2' ) );
</pre>
</p>
</span>
</td>
</tr>
<tr>
<th scope="row">
<?php _e('Fonts using', 'kingcomposer'); ?>:
</th>
<td>
<p>
<a href="<?php echo admin_url('admin.php?page=kingcomposer&kc_action=fonts-manager&TB_iframe=true&width=1000&height=600'); ?>" class="button button-large button-primary thickbox" data-title="<?php _e('KingComposer Fonts Manager', 'kingcomposer'); ?>" aria-label="<?php _e('KingComposer Fonts Manager', 'kingcomposer'); ?>">
<i style="float: left;margin-top: 8px;margin-right: 5px;" class="dashicons dashicons-admin-settings"></i>
<?php _e('Open Fonts Manager', 'kingcomposer'); ?>
</a>
</p>
<br />
<ul id="kc-settings-fonts">
<?php
$kc_fonts = get_option('kc-fonts');
if( is_array( $kc_fonts ) && count( $kc_fonts ) > 0 ){
foreach( $kc_fonts as $name => $cf ){
echo '<li><i class="dashicons dashicons-admin-customizer"></i> '.urldecode($name).'</li>';
}
}else{
echo '<li style="border:none;"><i class="dashicons dashicons-warning"></i> No fonts</li>';
}
?>
</ul>
<span class="description">
<p>
<?php _e('List of all external fonts that using in your site. The data is stored in ', 'kingcomposer'); ?><strong style="color: red;">get_option('kc-fonts')</strong>.
</p>
</span>
</td>
</tr>
<tr>
<th scope="row">
<?php _e('Max width container', 'kingcomposer'); ?>:
</th>
<td>
<input type="text" name="kc_options[max_width]" class="regular-text" value="<?php
echo esc_html( $settings['max_width'] );
?>" />
<span class="description">
<p>
<?php _e('The default of container width is 1170px, you can change it to fit with yours', 'kingcomposer'); ?>.
</p>
</span>
</td>
</tr>
<tr>
<th scope="row">
<?php _e('Disable Animate', 'kingcomposer'); ?>:
</th>
<td>
<span class="description">
<p>
<input id="kc-settings-animate" type="checkbox" name="kc_options[animate]" value="disabled"<?php
if( esc_html( $settings['animate'] ) == 'disabled' )
echo ' checked';
?> /> <label for="kc-settings-animate"><?php _e('Disable animate to prevent loading resources and effects', 'kingcomposer'); ?>.</label>
</p>
</span>
</td>
</tr>
<tr>
<th scope="row">
<?php _e('Disable Instantor', 'kingcomposer'); ?>:
</th>
<td>
<span class="description">
<p>
<input id="kc-settings-instantor" type="checkbox" name="kc_options[instantor]" value="disabled"<?php
if(isset($settings['instantor']) && esc_html( $settings['instantor'] ) == 'disabled' )
echo ' checked';
?> /> <label for="kc-settings-instantor"><?php _e('Disable inline text editor on live editor mode', 'kingcomposer'); ?>.</label>
</p>
</span>
</td>
</tr>
<tr>
<th scope="row">
<?php _e('Css Code', 'kingcomposer'); ?>:
</th>
<td>
<textarea name="kc_options[css_code]" cols="100" rows="15"><?php
echo esc_html( $settings['css_code'] );
?></textarea>
<span class="description">
<p>
<?php _e('Add your custom CSS code to modify or apply additional styling to the Front-End', 'kingcomposer'); ?>.
</p>
</span>
</td>
</tr>
</tbody>
</table>
<br />
<p class="submit">
<input type="submit" class="button button-large button-primary" value="<?php _e('Save Change', 'kingcomposer'); ?>" />
</p>
<?php
$kc_general_tab = ob_get_contents();
ob_end_clean();
echo $kc->apply_filters('kc_setting_general', $kc_general_tab);
?>
</div>
<div id="kc_product_license" class="group p" style="display:none">
<?php
ob_start();
?>
<div class="kc-license-notice"></div>
<h3>
<?php _e('Verify your license key for KC Pro!', 'kingcomposer'); ?>
</h3>
<hr />
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<?php _e('Your License Key', 'kingcomposer'); ?>:
</th>
<td>
<input id="kc-pro-license-inp" type="password" class="regular-text kc-license-key" name="kc_options[license]" value="<?php
if( !isset( $pdk['key'] ) || empty( $pdk['key'] ) ){
if( defined('KC_LICENSE') )
echo KC_LICENSE;
}else echo esc_attr( $pdk['key'] );
?>" autocomplete="off" />
<?php
if( $kc->check_pdk() === 1 && $pdk['pack'] != 'trial' ){
echo '<span class="verified"><i class="dashicons dashicons-yes"></i>Verified</span>';
echo '<a href="#" id="kc-revoke-license" class="revoke-website"><i class="dashicons dashicons-dismiss"></i> '.__('Revoke license', 'kingcomposer').' </a>';
}else{
echo '<span class="unverified"><i class="dashicons dashicons-no"></i>Unverified</span>';
}
?>
<a href="#" class="see-key">
<i class="dashicons dashicons-visibility"></i>
<?php _e('see', 'kingcomposer'); ?>
</a>
<input type="hidden" name="sercurity" value="<?php
echo wp_create_nonce('kc-verify-nonce');
?>" />
<span class="description">
<p>
<?php _e('You can find your license by login to', 'kingcomposer'); ?>
<a href="https://kingcomposer.com/my-account/" target=_blank>
<?php _e('My Account', 'kingcomposer'); ?>
</a>.
<?php _e('If you don\'t have an account yet', 'kingcomposer'); ?>
<a href="https://kingcomposer.com/pricing/" target=_blank>
<?php _e('Sign Up Now!', 'kingcomposer'); ?>
</a>
</p>
</span>
</td>
</tr>
<tr>
<th scope="row">
<?php _e('The theme you are using', 'kingcomposer'); ?>:
</th>
<td>
<p>
<input type="text" readonly="true" class="regular-text" value="<?php
echo sanitize_title( basename( get_template_directory() ) );
?>" />
</p>
</td>
</tr>
</tbody>
</table>
<br />
<p class="submit">
<button type="submit" id="kc-settings-verify-btn" class="button button-large button-primary">
<i class="dashicons dashicons-admin-network"></i> <?php _e('Verify your license now', 'kingcomposer'); ?>
</button>
</p>
<?php
$kc_license_tab = ob_get_contents();
ob_end_clean();
echo $kc->apply_filters('kc_setting_license', $kc_license_tab);
?>
</div>
<div id="kc_pro" class="group p" style="display:none">
<?php
ob_start();
?>
<?php do_action('kc-pro-settings-tab'); ?>
<?php
$kc_setting_pro = ob_get_contents();
ob_end_clean();
echo $kc->apply_filters('kc_setting_pro', $kc_setting_pro);
?>
</div>
<div id="kc_changelogs" class="group p" style="display:none">
<?php
ob_start();
?>
<div id="kc_changelogs_body">
<?php kc_changelogs(); ?>
</div>
<?php
$kc_changelogs = ob_get_contents();
ob_end_clean();
echo $kc->apply_filters('kc_setting_changelogs', $kc_changelogs);
?>
</div>
<input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce('_ajax_nonce'); ?>" />
<input type="hidden" name="_ajax_updates_nonce" id="kc-nonce-updates" value="<?php echo wp_create_nonce( 'updates' ); ?>" />
</form>
</div>
<script type="text/javascript" src="<?php echo esc_url(KC_URL); ?>/assets/js/kc.settings.js"></script>
<script type="text/javascript">
window.kc_fonts_update = function( datas ){
jQuery('#kc-settings-fonts').html('');
if( Object.keys(datas).length === 0 ){
jQuery('#kc-settings-fonts').html('<li style="border:none;"><i class="dashicons dashicons-warning"></i> No fonts</li>');
}else{
for( var i in datas ){
jQuery('#kc-settings-fonts').append('<li><i class="dashicons dashicons-admin-customizer"></i> '+decodeURIComponent(i)+'</li>');
}
}
}
window.addEventListener("message", function(arg){
if (arg.data !== undefined)
{
var data = JSON.parse (arg.data);
if (data.action == 'update-plugin')
{
jQuery('#TB_window, #TB_overlay').remove();
jQuery('body.modal-open').removeClass('modal-open');
jQuery('a.kc-update-link-ajax[data-slug="'+data.data.slug+'"]').trigger('click');
}
}
}, false);
</script>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,758 @@
<?php
class kc_tools {
public static function get_css( $value = array() ) {
$css = $prefix = '';
if ( ! empty( $value ) && is_array( $value ) ) {
foreach($value as $class => $style){
$css .= $class.'{';
foreach ( $style as $key => $value ) {
if ( $key == "background-image" ) {
$css .= $key . ":url('" . $value . "');";
} else {
$css .= $key . ":" . $value . ";";
}
}
$css .= '}'."\n";
}
}
return $css;
}
public static function get_list_menu(){
global $post;
$menu_options = array();
$menus = get_terms('nav_menu');
foreach($menus as $menu) {
$menu_options[ $menu->slug ] = $menu->name;
}
return $menu_options;
}
public static function select( $args ) {
$args = wp_parse_args( $args, array(
'id' => '',
'name' => '',
'class' => '',
'multiple' => '',
'size' => '',
'disabled' => '',
'selected' => '',
'none' => '',
'options' => array(),
'style' => '',
'format' => 'keyval', // keyval/idtext
'noselect' => '' // return options without <select> tag
) );
$options = array();
if ( !is_array( $args['options'] ) ) $args['options'] = array();
if ( $args['id'] ) $args['id'] = ' id="' . $args['id'] . '"';
if ( $args['name'] ) $args['name'] = ' name="' . $args['name'] . '"';
if ( $args['class'] ) $args['class'] = ' class="' . $args['class'] . '"';
if ( $args['style'] ) $args['style'] = ' style="' . esc_attr( $args['style'] ) . '"';
if ( $args['multiple'] ) $args['multiple'] = ' multiple="multiple"';
if ( $args['disabled'] ) $args['disabled'] = ' disabled="disabled"';
if ( $args['size'] ) $args['size'] = ' size="' . $args['size'] . '"';
if ( $args['none'] && $args['format'] === 'keyval' ) $args['options'][0] = $args['none'];
if ( $args['none'] && $args['format'] === 'idtext' ) array_unshift( $args['options'], array( 'id' => '0', 'text' => $args['none'] ) );
if ( $args['format'] === 'keyval' ) foreach ( $args['options'] as $id => $text ) {
$options[] = '<option value="' . (string) $id . '">' . (string) $text . '</option>';
} elseif ( $args['format'] === 'idtext' ) foreach ( $args['options'] as $option ) {
if ( isset( $option['id'] ) && isset( $option['text'] ) )
$options[] = '<option value="' . (string) $option['id'] . '">' . (string) $option['text'] . '</option>';
}
$options = implode( '', $options );
$options = str_replace( 'value="' . $args['selected'] . '"', 'value="' . $args['selected'] . '" selected="selected"', $options );
return ( $args['noselect'] ) ? $options : '<select' . $args['id'] . $args['name'] . $args['class'] . $args['multiple'] . $args['size'] . $args['disabled'] . $args['style'] . '>' . $options . '</select>';
}
public static function get_categories() {
$cats = array();
foreach ( (array) get_terms( 'category', array( 'hide_empty' => false ) ) as $cat ) $cats[$cat->slug] = $cat->name;
return $cats;
}
public static function get_types() {
$types = array();
foreach ( (array) get_post_types( '', 'objects' ) as $cpt => $cpt_data ) $types[$cpt] = $cpt_data->label;
return $types;
}
public static function get_users() {
$users = get_users();
// Cache results
set_transient( 'sc/users_cache', $users );
// Prepare data array
$data = array();
// Loop through users
foreach ( $users as $user ) $data[$user->data->ID] = $user->data->display_name;
// Return data
return $data;
}
public static function get_taxonomies() {
$taxes = array();
foreach ( (array) get_taxonomies( '', 'objects' ) as $tax ) $taxes[$tax->name] = $tax->label;
return $taxes;
}
public static function get_terms( $tax = 'category', $key = 'id', $type = '', $default = '' ) {
$get_terms = (array) get_terms( $tax, array( 'hide_empty' => false ) );
if( $type != '' ){
$get_terms = self::get_terms_by_post_type( array($tax), array($type) );
}
$terms = array();
if( $default != '' ){
$terms[] = $default;
}
if ( $key == 'id' ){
foreach ( $get_terms as $term ){
if( isset( $term->term_id ) && isset( $term->name ) ){
$terms[$term->term_id] = $term->name;
}
}
}else if ( $key == 'slug' ){
foreach ( $get_terms as $term ){
if( !empty($term->name) ){
if( isset( $term->slug ) && isset( $term->name ) ){
$terms[$term->slug] = $term->name;
}
}
}
}
return $terms;
}
public static function get_terms_by_post_type( $taxonomies, $post_types ) {
global $wpdb;
$query = $wpdb->prepare(
"SELECT t.*, COUNT(*) from $wpdb->terms AS t
INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id
INNER JOIN $wpdb->term_relationships AS r ON r.term_taxonomy_id = tt.term_taxonomy_id
INNER JOIN $wpdb->posts AS p ON p.ID = r.object_id
WHERE p.post_type IN('%s') AND tt.taxonomy IN('%s')
GROUP BY t.term_id",
join( "', '", $post_types ),
join( "', '", $taxonomies )
);
$_terms = $wpdb->get_results( $query );
return $_terms;
}
public static function get_featured_image( $post, $thumbnail = 'single-post-thumbnail' , $first = true ) {
$featured = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $thumbnail );
if( empty($featured) )
{
if( $first == true )return self::get_first_image( $post->post_content, $post->ID );
else return $kc->default_image();
}
return $featured[0];
}
public static function images_attached( $id ){
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $id,
'exclude' => get_post_thumbnail_id()
);
$attachments = get_posts( $args );
$output = array();
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
$att = wp_get_attachment_image_src($attachment->ID);
if(!empty($att))array_push( $output, $att );
}
}
return $output;
}
public static function get_first_image( $content, $id = null ) {
global $kc;
$first_img = self::get_first_video( $content );
if( $first_img != null ){
if( strpos( $first_img, 'youtube' ) !== false )return $first_img;
}
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
if( !empty($matches [1]) )
if( !empty($matches [1][0]) )
$first_img = $matches [1] [0];
if(empty($first_img)){
if($id != null)$first = self::images_attached( $id );
if( !empty( $first[0] ) )
return $first[0][0];
else $first_img = $kc->default_image();
}
return $first_img;
}
public static function get_first_video( $content ) {
$first_video = null;
$output = preg_match_all('/<ifr'.'ame.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
if( !empty($matches [1]) ){
if( !empty($matches [1][0]) ){
$first_video = $matches [1] [0];
}
}
return $first_video;
}
public static function createImageSize( $source, $attr ){
if (strpos($source, KC_SITE) === false || $source == KC_URL.'/assets/images/get_start.jpg')
return $source;
$attr = explode( 'x', $attr ); $arg = array();
if ( !empty( $attr[2] ) ) {
$arg['w'] = $attr[0];
$arg['h'] = $attr[1];
$arg['a'] = $attr[2];
if( $attr[2] != 'c' ){
$arg['a'] = $attr[2];
$attr = '-'.implode('x',$attr);
}else{
$attr = '-'.$attr[0].'x'.$attr[1].'xc';
}
}else if( !empty( $attr[0] ) && !empty( $attr[1] ) ){
$arg['w'] = $attr[0];
$arg['h'] = $attr[1];
$attr = '-'.$attr[0].'x'.$attr[1].'xc';
}else{
return $source;
}
$source = strrev( $source );
$st = strpos( $source, '.');
if( strpos( $source, strrev( 'images/default.jpg' ) ) === 0 ){
return strrev( $source );
}else if( $st === false ){
return strrev( $source ).$attr;
}else{
$file = str_replace( array( untrailingslashit( site_url() ).'/', '\\', '/' ), array( ABSPATH, KDS, KDS ), strrev( $source ) );
$_return = strrev( substr( $source, 0, $st+1 ).strrev($attr).substr( $source, $st+1 ) );
$__return = str_replace( array( untrailingslashit( site_url() ).'/', '\\', '/' ), array( ABSPATH, KDS, KDS ), $_return );
if( file_exists( $file ) && !file_exists( $__return ) ){
ob_start();
self::processImage( $file, $arg, $__return );
ob_end_clean();
}
return $_return;
}
}
public static function processImage( $localImage, $params = array(), $tempfile ){
$sData = getimagesize($localImage);
$origType = $sData[2];
$mimeType = $sData['mime'];
if(! preg_match('/^image\/(?:gif|jpg|jpeg|png)$/i', $mimeType)){
return "The image being resized is not a valid gif, jpg or png.";
}
if (!function_exists ('imagecreatetruecolor')) {
return 'GD Library Error: imagecreatetruecolor does not exist - please contact your webhost and ask them to install the GD library';
}
if (function_exists ('imagefilter') && defined ('IMG_FILTER_NEGATE')) {
$imageFilters = array (
1 => array (IMG_FILTER_NEGATE, 0),
2 => array (IMG_FILTER_GRAYSCALE, 0),
3 => array (IMG_FILTER_BRIGHTNESS, 1),
4 => array (IMG_FILTER_CONTRAST, 1),
5 => array (IMG_FILTER_COLORIZE, 4),
6 => array (IMG_FILTER_EDGEDETECT, 0),
7 => array (IMG_FILTER_EMBOSS, 0),
8 => array (IMG_FILTER_GAUSSIAN_BLUR, 0),
9 => array (IMG_FILTER_SELECTIVE_BLUR, 0),
10 => array (IMG_FILTER_MEAN_REMOVAL, 0),
11 => array (IMG_FILTER_SMOOTH, 0),
);
}
// get standard input properties
$new_width = (int) abs ($params['w']);
$new_height = (int) abs ($params['h']);
$zoom_crop = !empty( $params['zc'] )?(int) $params['zc']:1;
$quality = !empty( $params['q'] )?(int) $params['q']:100;
$align = !empty( $params['a'] )? $params['a']: 'c';
$filters = !empty( $params['f'] )? $params['f']: '';
$sharpen = !empty( $params['s'] )? (bool)$params['s']: 0;
$canvas_color = !empty( $params['cc'] )? $params['cc']: 'ffffff';
$canvas_trans = !empty( $params['ct'] )? (bool)$params['ct']: 1;
// set default width and height if neither are set already
if ($new_width == 0 && $new_height == 0) {
$new_width = 100;
$new_height = 100;
}
// ensure size limits can not be abused
$new_width = min ($new_width, 1500);
$new_height = min ($new_height, 1500);
// set memory limit to be able to have enough space to resize larger images
ini_set('memory_limit', '300M');
// open the existing image
switch ($mimeType) {
case 'image/jpeg':
$image = imagecreatefromjpeg ($localImage);
break;
case 'image/png':
$image = imagecreatefrompng ($localImage);
break;
case 'image/gif':
$image = imagecreatefromgif ($localImage);
break;
default: $image = false; break;
}
if ($image === false) {
return 'Unable to open image.';
}
// Get original width and height
$width = imagesx ($image);
$height = imagesy ($image);
$origin_x = 0;
$origin_y = 0;
// generate new w/h if not provided
if ($new_width && !$new_height) {
$new_height = floor ($height * ($new_width / $width));
} else if ($new_height && !$new_width) {
$new_width = floor ($width * ($new_height / $height));
}
// scale down and add borders
if ($zoom_crop == 3) {
$final_height = $height * ($new_width / $width);
if ($final_height > $new_height) {
$new_width = $width * ($new_height / $height);
} else {
$new_height = $final_height;
}
}
// create a new true color image
$canvas = imagecreatetruecolor ($new_width, $new_height);
imagealphablending ($canvas, false);
if (strlen($canvas_color) == 3) { //if is 3-char notation, edit string into 6-char notation
$canvas_color = str_repeat(substr($canvas_color, 0, 1), 2) . str_repeat(substr($canvas_color, 1, 1), 2) . str_repeat(substr($canvas_color, 2, 1), 2);
} else if (strlen($canvas_color) != 6) {
$canvas_color = 'ffffff'; // on error return default canvas color
}
$canvas_color_R = hexdec (substr ($canvas_color, 0, 2));
$canvas_color_G = hexdec (substr ($canvas_color, 2, 2));
$canvas_color_B = hexdec (substr ($canvas_color, 4, 2));
// Create a new transparent color for image
// If is a png and PNG_IS_TRANSPARENT is false then remove the alpha transparency
// (and if is set a canvas color show it in the background)
if(preg_match('/^image\/png$/i', $mimeType) && $canvas_trans){
$color = imagecolorallocatealpha ($canvas, $canvas_color_R, $canvas_color_G, $canvas_color_B, 127);
}else{
$color = imagecolorallocatealpha ($canvas, $canvas_color_R, $canvas_color_G, $canvas_color_B, 0);
}
// Completely fill the background of the new image with allocated color.
imagefill ($canvas, 0, 0, $color);
// scale down and add borders
if ($zoom_crop == 2) {
$final_height = $height * ($new_width / $width);
if ($final_height > $new_height) {
$origin_x = $new_width / 2;
$new_width = $width * ($new_height / $height);
$origin_x = round ($origin_x - ($new_width / 2));
} else {
$origin_y = $new_height / 2;
$new_height = $final_height;
$origin_y = round ($origin_y - ($new_height / 2));
}
}
// Restore transparency blending
imagesavealpha ($canvas, true);
if ($zoom_crop > 0) {
$src_x = $src_y = 0;
$src_w = $width;
$src_h = $height;
$cmp_x = $width / $new_width;
$cmp_y = $height / $new_height;
// calculate x or y coordinate and width or height of source
if ($cmp_x > $cmp_y) {
$src_w = round ($width / $cmp_x * $cmp_y);
$src_x = round (($width - ($width / $cmp_x * $cmp_y)) / 2);
} else if ($cmp_y > $cmp_x) {
$src_h = round ($height / $cmp_y * $cmp_x);
$src_y = round (($height - ($height / $cmp_y * $cmp_x)) / 2);
}
// positional cropping!
if ($align) {
if (strpos ($align, 't') !== false) {
$src_y = 0;
}
if (strpos ($align, 'b') !== false) {
$src_y = $height - $src_h;
}
if (strpos ($align, 'l') !== false) {
$src_x = 0;
}
if (strpos ($align, 'r') !== false) {
$src_x = $width - $src_w;
}
}
imagecopyresampled ($canvas, $image, $origin_x, $origin_y, $src_x, $src_y, $new_width, $new_height, $src_w, $src_h);
}
else {
// copy and resize part of an image with resampling
imagecopyresampled ($canvas, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
}
//Straight from Wordpress core code. Reduces filesize by up to 70% for PNG's
if ( (IMAGETYPE_PNG == $origType || IMAGETYPE_GIF == $origType) && function_exists('imageistruecolor') && !imageistruecolor( $image ) && imagecolortransparent( $image ) > 0 ){
imagetruecolortopalette( $canvas, false, imagecolorstotal( $image ) );
}
$imgType = "";
if(preg_match('/^image\/(?:jpg|jpeg)$/i', $mimeType)){
$imgType = 'jpg';
imagejpeg($canvas, $tempfile, 70);
} else if(preg_match('/^image\/png$/i', $mimeType)){
$imgType = 'png';
imagepng($canvas, $tempfile, 7);
} else if(preg_match('/^image\/gif$/i', $mimeType)){
$imgType = 'gif';
imagegif($canvas, $tempfile);
} else {
return "Could not match mime type after verifying it previously.";
}
@imagedestroy($canvas);
@imagedestroy($image);
}
public static function hex2rgb( $hex, $index = 0 ) {
$hex = str_replace("#", "", $hex);
if( strpos( $hex, 'rgb' ) !== false ){
$hex = explode( ',', $hex );
$r = preg_replace("/[^0-9,.]/", "", $hex[0]);
$g = preg_replace("/[^0-9,.]/", "", $hex[1]);
$b = preg_replace("/[^0-9,.]/", "", $hex[2]);
}else if( strlen( $hex ) == 3 ) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
}
$r = ($r-$index>0)?$r-$index:0;
$g = ($g-$index>0)?$g-$index:0;
$b = ($b-$index>0)?$b-$index:0;
return "$r, $g, $b";
}
public static function bsp( $st = '' ){
$pdd = strlen( $st )%4;
if( $pdd > 0 ){
for( $i=1; $i<$pdd; $i++ )
$st .= ' ';
}
return $st;
}
public static function get_posts( $atts ){
$atts = shortcode_atts( array(
'template' => '',
'id' => false,
'class' => '',
'items' => get_option( 'posts_per_page' ),
'gap' => '0',
'post_type' => 'kc-testimonials',
'taxonomy' => 'kc-testimonials-category',
'tax_term' => false,
'order' => 'desc',
'filter' => 'No',
'margin' => 'Yes',
'ignore_sticky_posts' => 'no',
'link_view' => 'no',
'custom_class' => '',
'show_link' => 'yes',
'words' => 30,
'amount' => '',
'category' => '',
'order' => 'DESC',
'offset' => 0,
'orderby' => 'menu_order post_date date title',
'post_parent' => false,
'post_status' => 'publish',
), $atts );
//some shortcodes use amount/items param for limit items.
if( !empty( $atts['amount'] ) ){
$atts['items'] = intval($atts['amount']);
}
if( $atts['amount'] == 0 ){
$atts['items'] = -1;
}
//assign category for work shortcode
if($atts['tax_term'] !=''){
$atts['category'] = $atts['tax_term'];
}
//prepare arguments for get_posts function
$args = array(
'posts_per_page' => intval($atts['items']),
'orderby' => 'menu_order post_date date title',
'order' => $atts['order'],
'post_type' => sanitize_text_field($atts['post_type']),
'post_status' => $atts['post_status'],
'offset' => intval($atts['offset']),
'suppress_filters' => true,
);
//get posts from list IDs
if ( !empty( $atts['id'] )) {
$posts_in = array_map( 'intval', explode( ',', $atts['id'] ) );
$args['post__in'] = $posts_in;
}
if( $atts['ignore_sticky_posts'] === 'yes' ){
$args['ignore_sticky_posts'] = true;
}
//category filter
if( !empty( $atts['category'] ) ){
$args['tax_query'] = array(
array(
'taxonomy' => $atts['taxonomy'],
'field' => 'slug',
'terms' => explode( ',', $atts['category'] )
)
);
}
//return data with list of posts object
return get_posts( $args );
}
public static function register_post_types( $args = array() ){
if( is_array( $args ) ){
foreach( $args as $i => $arg ){
if( !post_type_exists( $arg[1] ) ){
$params = array(
'menu_icon' => $arg[3],
'labels' => array(
'name' => $arg[0],
'singular_name' => $arg[1],
'add_new' => 'Add new '.$arg[2],
'edit_item' => 'Edit '.$arg[2],
'new_item' => 'New '.$arg[2],
'add_new_item' => 'New '.$arg[2],
'view_item' => 'View '.$arg[2],
'search_items' => 'Search '.$arg[2].'s',
'not_found' => 'No '.$arg[2].' found',
'not_found_in_trash' => 'No '.$arg[2].' found in Trash'
),
'public' => true,
'supports' => $arg[4],
'taxonomies' => array( $arg[1].'-category' )
);
if( isset($arg[5]) ){
$params[ 'rewrite' ] = array('slug' => $arg[5], 'with_front' => false);
}
register_post_type(
$arg[1],
$params
);
}
if( !taxonomy_exists( $arg[1].'-category' ) ){
register_taxonomy(
$arg[1].'-category' ,
$arg[1],
array(
'hierarchical' => true,
'labels' => array(
'name' => _x( $arg[2].' Categories', 'taxonomy general name' ),
'singular_name' => _x( $arg[2].' Category', 'taxonomy singular name' ),
'search_items' => 'Search '.$arg[2].' Categories',
'popular_items' => 'Popular '.$arg[2].' Categories',
'all_items' => 'All '.$arg[2].' Categories',
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => 'Edit '.$arg[2].' Category',
'update_item' => 'Update '.$arg[2].' Category',
'add_new_item' => 'Add New '.$arg[2].' Category',
'new_item_name' => 'New '.$arg[2].' Category Name',
'separate_items_with_commas' => 'Separate '.$arg[2].' Category with commas',
'add_or_remove_items' => 'Add or remove '.$arg[2].' Category',
'choose_from_most_used' => 'Choose from the most used '.$arg[2].' Category',
'not_found' => 'No '.$arg[2].' Category found.',
'menu_name' => $arg[2].' Categories',
),
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => $arg[1].'-category' ),
)
);
}
}
}
}
public static function get_cf7_names() {
global $wpdb;
$cf7_list = $wpdb->get_results(
"
SELECT ID, post_title, post_name
FROM $wpdb->posts
WHERE post_type = 'wpcf7_contact_form'
"
);
$cf7_val = array();
if ( $cf7_list ) {
$cf7_val[] = __( 'Select Contact Form', 'kingcomposer' );
foreach ( $cf7_list as $value ) {
$cf7_val[$value->post_name] = $value->post_title;
}
} else {
$cf7_val[0] = __( 'No contact forms found', 'kingcomposer' );
}
return $cf7_val;
}
}

View File

@@ -0,0 +1,456 @@
<?php
/**
* JSMin.php - modified PHP implementation of Douglas Crockford's JSMin.
*
* <code>
* $minifiedJs = JSMin::minify($js);
* </code>
*
* This is a modified port of jsmin.c. Improvements:
*
* Does not choke on some regexp literals containing quote characters. E.g. /'/
*
* Spaces are preserved after some add/sub operators, so they are not mistakenly
* converted to post-inc/dec. E.g. a + ++b -> a+ ++b
*
* Preserves multi-line comments that begin with /*!
*
* PHP 5 or higher is required.
*
* Permission is hereby granted to use this version of the library under the
* same terms as jsmin.c, which has the following license:
*
* --
* Copyright (c) 2002 Douglas Crockford (www.crockford.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The Software shall be used for Good, not Evil.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* --
*
* @package JSMin
* @author Ryan Grove <ryan@wonko.com> (PHP port)
* @author Steve Clay <steve@mrclay.org> (modifications + cleanup)
* @author Andrea Giammarchi <http://www.3site.eu> (spaceBeforeRegExp)
* @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
* @copyright 2008 Ryan Grove <ryan@wonko.com> (PHP port)
* @license http://opensource.org/licenses/mit-license.php MIT License
* @link http://code.google.com/p/jsmin-php/
*/
class JSMin {
const ORD_LF = 10;
const ORD_SPACE = 32;
const ACTION_KEEP_A = 1;
const ACTION_DELETE_A = 2;
const ACTION_DELETE_A_B = 3;
protected $a = "\n";
protected $b = '';
protected $input = '';
protected $inputIndex = 0;
protected $inputLength = 0;
protected $lookAhead = null;
protected $output = '';
protected $lastByteOut = '';
protected $keptComment = '';
/**
* Minify Javascript.
*
* @param string $js Javascript to be minified
*
* @return string
*/
public static function minify($js)
{
$jsmin = new JSMin($js);
return $jsmin->min();
}
/**
* @param string $input
*/
public function __construct($input)
{
$this->input = $input;
}
/**
* Perform minification, return result
*
* @return string
*/
public function min()
{
if ($this->output !== '') { // min already run
return $this->output;
}
$mbIntEnc = null;
if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) {
$mbIntEnc = mb_internal_encoding();
mb_internal_encoding('8bit');
}
if (isset($this->input[0]) && $this->input[0] === "\xef") {
$this->input = substr($this->input, 3);
}
$this->input = str_replace("\r\n", "\n", $this->input);
$this->inputLength = strlen($this->input);
$this->action(self::ACTION_DELETE_A_B);
while ($this->a !== null) {
// determine next command
$command = self::ACTION_KEEP_A; // default
if ($this->a === ' ') {
if (($this->lastByteOut === '+' || $this->lastByteOut === '-')
&& ($this->b === $this->lastByteOut)) {
// Don't delete this space. If we do, the addition/subtraction
// could be parsed as a post-increment
} elseif (! $this->isAlphaNum($this->b)) {
$command = self::ACTION_DELETE_A;
}
} elseif ($this->a === "\n") {
if ($this->b === ' ') {
$command = self::ACTION_DELETE_A_B;
// in case of mbstring.func_overload & 2, must check for null b,
// otherwise mb_strpos will give WARNING
} elseif ($this->b === null
|| (false === strpos('{[(+-!~', $this->b)
&& ! $this->isAlphaNum($this->b))) {
$command = self::ACTION_DELETE_A;
}
} elseif (! $this->isAlphaNum($this->a)) {
if ($this->b === ' '
|| ($this->b === "\n"
&& (false === strpos('}])+-"\'', $this->a)))) {
$command = self::ACTION_DELETE_A_B;
}
}
$this->action($command);
}
$this->output = trim($this->output);
if ($mbIntEnc !== null) {
mb_internal_encoding($mbIntEnc);
}
return $this->output;
}
/**
* ACTION_KEEP_A = Output A. Copy B to A. Get the next B.
* ACTION_DELETE_A = Copy B to A. Get the next B.
* ACTION_DELETE_A_B = Get the next B.
*
* @param int $command
* @throws JSMin_UnterminatedRegExpException|JSMin_UnterminatedStringException
*/
protected function action($command)
{
// make sure we don't compress "a + ++b" to "a+++b", etc.
if ($command === self::ACTION_DELETE_A_B
&& $this->b === ' '
&& ($this->a === '+' || $this->a === '-')) {
// Note: we're at an addition/substraction operator; the inputIndex
// will certainly be a valid index
if ($this->input[$this->inputIndex] === $this->a) {
// This is "+ +" or "- -". Don't delete the space.
$command = self::ACTION_KEEP_A;
}
}
switch ($command) {
case self::ACTION_KEEP_A: // 1
$this->output .= $this->a;
if ($this->keptComment) {
$this->output = rtrim($this->output, "\n");
$this->output .= $this->keptComment;
$this->keptComment = '';
}
$this->lastByteOut = $this->a;
// fallthrough intentional
case self::ACTION_DELETE_A: // 2
$this->a = $this->b;
if ($this->a === "'" || $this->a === '"') { // string literal
$str = $this->a; // in case needed for exception
for(;;) {
$this->output .= $this->a;
$this->lastByteOut = $this->a;
$this->a = $this->get();
if ($this->a === $this->b) { // end quote
break;
}
if ($this->isEOF($this->a)) {
$byte = $this->inputIndex - 1;
throw new JSMin_UnterminatedStringException(
"JSMin: Unterminated String at byte {$byte}: {$str}");
}
$str .= $this->a;
if ($this->a === '\\') {
$this->output .= $this->a;
$this->lastByteOut = $this->a;
$this->a = $this->get();
$str .= $this->a;
}
}
}
// fallthrough intentional
case self::ACTION_DELETE_A_B: // 3
$this->b = $this->next();
if ($this->b === '/' && $this->isRegexpLiteral()) {
$this->output .= $this->a . $this->b;
$pattern = '/'; // keep entire pattern in case we need to report it in the exception
for(;;) {
$this->a = $this->get();
$pattern .= $this->a;
if ($this->a === '[') {
for(;;) {
$this->output .= $this->a;
$this->a = $this->get();
$pattern .= $this->a;
if ($this->a === ']') {
break;
}
if ($this->a === '\\') {
$this->output .= $this->a;
$this->a = $this->get();
$pattern .= $this->a;
}
if ($this->isEOF($this->a)) {
throw new JSMin_UnterminatedRegExpException(
"JSMin: Unterminated set in RegExp at byte "
. $this->inputIndex .": {$pattern}");
}
}
}
if ($this->a === '/') { // end pattern
break; // while (true)
} elseif ($this->a === '\\') {
$this->output .= $this->a;
$this->a = $this->get();
$pattern .= $this->a;
} elseif ($this->isEOF($this->a)) {
$byte = $this->inputIndex - 1;
throw new JSMin_UnterminatedRegExpException(
"JSMin: Unterminated RegExp at byte {$byte}: {$pattern}");
}
$this->output .= $this->a;
$this->lastByteOut = $this->a;
}
$this->b = $this->next();
}
// end case ACTION_DELETE_A_B
}
}
/**
* @return bool
*/
protected function isRegexpLiteral()
{
if (false !== strpos("(,=:[!&|?+-~*{;", $this->a)) {
// we can't divide after these tokens
return true;
}
// check if first non-ws token is "/" (see starts-regex.js)
$length = strlen($this->output);
if ($this->a === ' ' || $this->a === "\n") {
if ($length < 2) { // weird edge case
return true;
}
}
// if the "/" follows a keyword, it must be a regexp, otherwise it's best to assume division
$subject = $this->output . trim($this->a);
if (!preg_match('/(?:case|else|in|return|typeof)$/', $subject, $m)) {
// not a keyword
return false;
}
// can't be sure it's a keyword yet (see not-regexp.js)
$charBeforeKeyword = substr($subject, 0 - strlen($m[0]) - 1, 1);
if ($this->isAlphaNum($charBeforeKeyword)) {
// this is really an identifier ending in a keyword, e.g. "xreturn"
return false;
}
// it's a regexp. Remove unneeded whitespace after keyword
if ($this->a === ' ' || $this->a === "\n") {
$this->a = '';
}
return true;
}
/**
* Return the next character from stdin. Watch out for lookahead. If the character is a control character,
* translate it to a space or linefeed.
*
* @return string
*/
protected function get()
{
$c = $this->lookAhead;
$this->lookAhead = null;
if ($c === null) {
// getc(stdin)
if ($this->inputIndex < $this->inputLength) {
$c = $this->input[$this->inputIndex];
$this->inputIndex += 1;
} else {
$c = null;
}
}
if (ord($c) >= self::ORD_SPACE || $c === "\n" || $c === null) {
return $c;
}
if ($c === "\r") {
return "\n";
}
return ' ';
}
/**
* Does $a indicate end of input?
*
* @param string $a
* @return bool
*/
protected function isEOF($a)
{
return ord($a) <= self::ORD_LF;
}
/**
* Get next char (without getting it). If is ctrl character, translate to a space or newline.
*
* @return string
*/
protected function peek()
{
$this->lookAhead = $this->get();
return $this->lookAhead;
}
/**
* Return true if the character is a letter, digit, underscore, dollar sign, or non-ASCII character.
*
* @param string $c
*
* @return bool
*/
protected function isAlphaNum($c)
{
return (preg_match('/^[a-z0-9A-Z_\\$\\\\]$/', $c) || ord($c) > 126);
}
/**
* Consume a single line comment from input (possibly retaining it)
*/
protected function consumeSingleLineComment()
{
$comment = '';
while (true) {
$get = $this->get();
$comment .= $get;
if (ord($get) <= self::ORD_LF) { // end of line reached
// if IE conditional comment
if (preg_match('/^\\/@(?:cc_on|if|elif|else|end)\\b/', $comment)) {
$this->keptComment .= "/{$comment}";
}
return;
}
}
}
/**
* Consume a multiple line comment from input (possibly retaining it)
*
* @throws JSMin_UnterminatedCommentException
*/
protected function consumeMultipleLineComment()
{
$this->get();
$comment = '';
for(;;) {
$get = $this->get();
if ($get === '*') {
if ($this->peek() === '/') { // end of comment reached
$this->get();
if (0 === strpos($comment, '!')) {
// preserved by YUI Compressor
if (!$this->keptComment) {
// don't prepend a newline if two comments right after one another
$this->keptComment = "\n";
}
$this->keptComment .= "/*!" . substr($comment, 1) . "*/\n";
} else if (preg_match('/^@(?:cc_on|if|elif|else|end)\\b/', $comment)) {
// IE conditional
$this->keptComment .= "/*{$comment}*/";
}
return;
}
} elseif ($get === null) {
throw new JSMin_UnterminatedCommentException(
"JSMin: Unterminated comment at byte {$this->inputIndex}: /*{$comment}");
}
$comment .= $get;
}
}
/**
* Get the next character, skipping over comments. Some comments may be preserved.
*
* @return string
*/
protected function next()
{
$get = $this->get();
if ($get === '/') {
switch ($this->peek()) {
case '/':
$this->consumeSingleLineComment();
$get = "\n";
break;
case '*':
$this->consumeMultipleLineComment();
$get = ' ';
break;
}
}
return $get;
}
}
class JSMin_UnterminatedStringException extends Exception {}
class JSMin_UnterminatedCommentException extends Exception {}
class JSMin_UnterminatedRegExpException extends Exception {}

View File

@@ -0,0 +1,6 @@
<?php
if(!defined('ABSPATH')) {
header('HTTP/1.0 403 Forbidden');
exit;
}

View File

@@ -0,0 +1,239 @@
<?php
/**
*
* King Composer
* (c) KingComposer.com
*
*/
if(!defined('KC_FILE')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
add_action( 'widgets_init', 'kc_register_widgets' );
function kc_register_widgets() {
register_widget( 'kc_widget_content' );
}
class kc_widget_content extends WP_Widget {
function __construct() {
$widget = array( 'classname' => 'kc_widget_content', 'description' => __('Display content is built by KingComposer Page Builder','kingcomposer') );
$control= array( 'width' => 250, 'height' => 350, 'id_base' => 'kc_widget_content' );
parent::__construct('kc_widget_content','KC Content', $widget, $control);
}
function widget( $args, $instance ) {
global $kc, $post, $kc_prevent_infinity_loop;
if (!isset($kc_prevent_infinity_loop))
$kc_prevent_infinity_loop = array();
extract( $args );
$title = empty( $instance['title'] ) ? '' : $instance['title'];
$title_as = empty( $instance['title_as'] ) ? '' : $instance['title_as'];
$id = empty( $instance['id'] ) ? '' : $instance['id'];
$class = empty( $instance['class'] ) ? '' : $instance['class'];
if (strpos ($id, '#') !== false)
{
$id = explode('#', $id);
$id = trim ($id[1]);
if (isset($post) && (is_object($post) && $id == $post->ID) || (isset($kc_prevent_infinity_loop[$id]) && $kc_prevent_infinity_loop[$id] === true))
{
echo '<div class="kc-content-widget">Error: Infinite loop, do not include widget into itself.</div>';
return false;
}
$kc_prevent_infinity_loop[$id] = true;
if($title_as == 'yes')
$title = get_the_title($id);
}else{
echo '<div class="kc-content-widget">Error: Please select a widget content to display</div>';
return false;
}
if( !empty( $instance['class'] ) ){
$before_widget = str_replace( 'class="', 'class="'.$class.' ', $before_widget );
}
echo $before_widget;
if (!empty($title))
{
echo $before_title;
echo $title;
echo $after_title;
}
echo '<div class="kc-content-widget">';
echo $kc->do_shortcode( kc_raw_content($id) );
echo '</div>';
unset ($kc_prevent_infinity_loop[$id]);
echo $after_widget;
}
function update( $new, $old ) {
$inst = $old;
$inst['title'] = strip_tags( $new['title'] );
$inst['title_as'] = strip_tags( $new['title_as'] );
$inst['id'] = strip_tags( $new['id'] );
$inst['class'] = strip_tags( $new['class'] );
return $inst;
}
function form( $instance ) {
$defaults = array(
'title' => __('KC Widget Content', 'kingcomposer'),
'title_as' => '',
'id' => '',
'class' => ''
);
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<!--label class="notice" style="color:red">Notice: Not work on localhost</label-->
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
<?php _e('Title', 'kingcomposer'); ?>:
</label>
<input id="<?php
echo esc_attr( $this->get_field_id( 'title' ) );
?>" name="<?php
echo esc_attr( $this->get_field_name( 'title' ) );
?>" value="<?php
echo esc_attr( $instance['title'] );
?>" class="widefat" type="text" />
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title_as' ) ); ?>">
<?php _e('Use post title', 'kingcomposer'); ?>?:
</label>
<input id="<?php
echo esc_attr( $this->get_field_id( 'title_as' ) );
?>" name="<?php
echo esc_attr( $this->get_field_name( 'title_as' ) );
?>" value="yes"<?php
if (esc_attr( $instance['title_as'] ) == 'yes')
{
echo ' checked="checked"';
}
?>" class="checkbox" type="checkbox" />
</p>
<p class="kc-widget-content-pid">
<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
<?php _e('Content Filters', 'kingcomposer'); ?>:
</label>
<input class="widefat" type="text" onkeyup="<?php
ob_start();
?>
if (this.value.length < 2)
return;
_$ = jQuery;
rst = _$(this.parentNode.parentNode).find('select#<?php echo esc_attr( $this->get_field_id( 'select' ) );?>');
rid = _$(this.parentNode.parentNode).find('input#<?php echo esc_attr( $this->get_field_id( 'id' ) );?>');
rst.show().html('<option>Loading...</option>').off('change').on('change', function(){
rid.attr('value', this.value);
});
_$.post(
ajaxurl,
{
'action': 'kc_suggestion',
'security': '<?php echo wp_create_nonce( "kc-nonce" ); ?>',
's': this.value,
'field_name': 'widget_content'
},
function( result ){
rst.html('');
for( n in result )
{
if (rst.html() === '')
{
rid.attr('value', result[n]+' #'+n);
}
rst.append('<option value="'+result[n]+' #'+n+'">'+result[n]+'</option>');
}
}
);
<?php
$content = ob_get_contents();
ob_end_clean();
echo esc_attr (str_replace (array(" ", " ", "\n"), array('', ' ', ''), $content));
?>" placeholder="<?php _e('Type least 2 characters', 'kingcomposer'); ?>" />
<select style="display:none;width: 100%;max-width: 100%;margin-top: -1px;" id="<?php
echo esc_attr( $this->get_field_id( 'select' ) );
?>" class="widefat"></select>
</p>
<p>
<input id="<?php
echo esc_attr( $this->get_field_id( 'id' ) );
?>" name="<?php
echo esc_attr( $this->get_field_name( 'id' ) );
?>" value="<?php
echo esc_attr( $instance['id'] );
?>" class="widefat" type="text" readonly />
<?php
$id = explode( ':', esc_attr( $instance['id'] ) );
?>
<a class="button" onclick="var id=this.parentNode.getElementsByTagName('input')[0].value.split('#')[1];if(id!=='')window.open(this.href+id);return false;" href="<?php echo admin_url('/post.php?action=edit&post='); ?>" style="margin-top:8px;">
<?php _e('Edit widget', 'kingcomposer'); ?>
</a>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'class' ) ); ?>">
<?php _e('Widget Class', 'kingcomposer'); ?>:
</label>
<input id="<?php
echo esc_attr( $this->get_field_id( 'class' ) );
?>" name="<?php
echo esc_attr( $this->get_field_name( 'class' ) );
?>" value="<?php
echo esc_attr( $instance['class'] );
?>" class="widefat" type="text" />
</p>
<?php
}
}

View File

@@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<html <?php language_attributes(); ?>>
<head>
<?php
wp_head();
?>
</head>
<body <?php body_class(); ?>>
<div id="kc-section-display">
<?php
// Start the loop.
while ( have_posts() ) : the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<?php the_content(); ?>
</div>
</article>
<?php
endwhile;
?>
</div>
<?php wp_footer(); ?>
</body>
</html>