????
| Current Path : /home2/morganrand/www/wp-content/plugins/pinwheel-slider/ |
| Current File : /home2/morganrand/www/wp-content/plugins/pinwheel-slider/pinwheel-slider.php |
<?php
/*************************************************************************************************************************
Plugin Name: Pinwheel Slider
Plugin URI: http://slidervilla.com/pinwheel/
Description:Pinwheel Slider adds a horizontal content and image slideshow with middle featured element larger than two side elements. The side image/featured element rotates to center and the one at the center moves to the left/right side with nice animation.
Version: 3.1.6
Author: Tejaswini Deshpande
Author URI: http://tejaswinideshpande.com/
Wordpress version supported: 3.5 and above
*-----------------------------------------*
* Copyright 2010-2017 SliderVilla (email : support@slidervilla.com)
* Upgrade: Using new file.
*********************************************************************************************************************/
// Make sure we don't expose any info if called directly
if ( !function_exists( 'add_action' ) ) {
echo 'Hi there! I\'m just a slider plugin, not much I can do when called directly.';
exit;
}
//defined global variables and constants here
global $slidervillaSliders;
define('PINWHEEL_SLIDER_TABLE','pinwheel_slider'); //Slider TABLE NAME
define('PINWHEEL_SLIDER_META','pinwheel_slider_meta'); //Meta TABLE NAME
define('PINWHEEL_SLIDER_POST_META','pinwheel_slider_postmeta'); //Meta TABLE NAME
define("PINWHEEL_SLIDER_VER","3.1.6",false);//Current Version of Pinwheel Slider
if ( ! defined( 'PINWHEEL_SLIDER_PLUGIN_BASENAME' ) )
define( 'PINWHEEL_SLIDER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
if ( ! defined( 'PINWHEEL_SLIDER_CSS_DIR' ) ){
define( 'PINWHEEL_SLIDER_CSS_DIR', WP_PLUGIN_DIR.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'/css/skins/' );
}
if ( ! defined( 'PINWHEEL_SLIDER_CSS_OUTER' ) ){
define( 'PINWHEEL_SLIDER_CSS_OUTER', WP_PLUGIN_DIR.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'/css/' );
}
if ( ! defined( 'PINWHEEL_SLIDER_INC_DIR' ) ) {
define( 'PINWHEEL_SLIDER_INC_DIR', WP_PLUGIN_DIR.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'/includes/' );
}
if ( ! defined( 'PINWHEEL_STORE_URL' ) )
define( 'PINWHEEL_STORE_URL', 'https://slidervilla.com/club/' );
if ( ! defined( 'PINWHEEL_ITEM_NAME' ) )
define( 'PINWHEEL_ITEM_NAME', 'Pinwheel Slider' );
$slidervillaSliders['pinwheel-slider']=PINWHEEL_SLIDER_VER;
// Create Text Domain For Translations
load_plugin_textdomain('pinwheel-slider', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
require_once (dirname (__FILE__) . '/includes/pinwheel-slider-functions.php');
function install_pinwheel_slider() {
global $wpdb, $table_prefix;
/* Added fro auto update - start */
$installed_ver = get_option( "pinwheel_db_version" );
if( $installed_ver != PINWHEEL_SLIDER_VER ) {
$table_name = $table_prefix.PINWHEEL_SLIDER_TABLE;
if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
$sql = "CREATE TABLE $table_name (
id int(5) NOT NULL AUTO_INCREMENT,
post_id int(11) NOT NULL,
date datetime NOT NULL,
slider_id int(5) NOT NULL DEFAULT '1',
slide_order int(5) NOT NULL DEFAULT '0',
UNIQUE KEY id(id)
);";
$rs = $wpdb->query($sql);
}
//3.1
if($wpdb->get_var("SHOW COLUMNS FROM $table_name LIKE 'expiry'") != 'expiry') {
$sql = "ALTER TABLE $table_name
ADD COLUMN expiry DATE DEFAULT NULL";
$rs1 = $wpdb->query($sql);
}
$meta_table_name = $table_prefix.PINWHEEL_SLIDER_META;
if($wpdb->get_var("show tables like '$meta_table_name'") != $meta_table_name) {
$sql = "CREATE TABLE $meta_table_name (
slider_id int(5) NOT NULL AUTO_INCREMENT,
slider_name varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
UNIQUE KEY slider_id(slider_id)
);";
$rs2 = $wpdb->query($sql);
$sql = "INSERT INTO $meta_table_name (slider_id,slider_name) VALUES('1','Pinwheel Slider');";
$rs3 = $wpdb->query($sql);
}
else{
if($installed_ver<'3.1.2'){
$sql = "ALTER TABLE $meta_table_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci";
$rs3 = $wpdb->query($sql);
}
}
if($wpdb->get_var("SHOW COLUMNS FROM $meta_table_name LIKE 'type'") != 'type') {
// Add Columns
$sql = "ALTER TABLE $meta_table_name
ADD COLUMN type INT(4) NOT NULL,
ADD COLUMN setid INT(4) NOT NULL default '1',
ADD COLUMN param varchar(500)";
$rs5 = $wpdb->query($sql);
}
$slider_postmeta = $table_prefix.PINWHEEL_SLIDER_POST_META;
if($wpdb->get_var("show tables like '$slider_postmeta'") != $slider_postmeta) {
$sql = "CREATE TABLE $slider_postmeta (
post_id int(11) NOT NULL,
slider_id int(5) NOT NULL default '1',
UNIQUE KEY post_id(post_id)
);";
$rs4 = $wpdb->query($sql);
}
// Pinwheel Slider Settings and Options
$default_slider = array();
$default_pinwheel_slider_global_settings = get_pinwheel_slider_global_default_settings();
$default_pinwheel_slider_settings=get_pinwheel_slider_default_settings();
$default_slider = $default_pinwheel_slider_settings;
$glb_slider = $default_pinwheel_slider_global_settings;
$default_scounter='1';
$scounter=get_option('pinwheel_slider_scounter');
if(!isset($scounter) or $scounter=='' or empty($scounter)){
update_option('pinwheel_slider_scounter',$default_scounter);
$scounter=$default_scounter;
}
$fontgarr = array('ptitle_fontg','content_fontg','title_fontg');
for($i=1;$i<=$scounter;$i++){
if ($i==1){
$pinwheel_slider_options='pinwheel_slider_options';
}
else{
$pinwheel_slider_options='pinwheel_slider_options'.$i;
}
$pinwheel_slider_curr=get_option($pinwheel_slider_options);
if(!$pinwheel_slider_curr and $i==1) {
$pinwheel_slider_curr = array();
}
if($pinwheel_slider_curr or $i==1) {
foreach($default_slider as $key=>$value) {
if(!isset($pinwheel_slider_curr[$key])) {
$pinwheel_slider_curr[$key] = $value;
}
if(in_array($key,$fontgarr) && !empty($pinwheel_slider_curr["$key"]) ){
$fname = str_replace( ' ', '+', $pinwheel_slider_curr["$key"] );
$pinwheel_slider_curr[$key]=$fname;
if (strpos($pinwheel_slider_curr["$key"],':') !== false) {
$gfontarr = explode( ':', $pinwheel_slider_curr["$key"] );
$pinwheel_slider_curr["$key"] = str_replace( ' ', '+', $gfontarr[0]);
$pinwheel_slider_curr["$key"."w"] = $gfontarr[1];
}
}
if( $key=='pt_font' && !empty($pinwheel_slider_curr['ptitle_fontg']) ) {
$pinwheel_slider_curr[$key]='google';
}
if( $key=='pc_font' && !empty($pinwheel_slider_curr['content_fontg']) ) {
$pinwheel_slider_curr[$key]='google';
}
if( $key=='st_font' && !empty($pinwheel_slider_curr['title_fontg']) ) {
$pinwheel_slider_curr[$key]='google';
}
}
// Added to unaffect the existing user by the update
if( $pinwheel_slider_curr['crop'] == 0 ) {
$pinwheel_slider_curr['crop']='full';
}
if( $pinwheel_slider_curr['crop'] == 1 ) {
$pinwheel_slider_curr['crop']='large';
}
if( $pinwheel_slider_curr['crop'] == 2 ) {
$pinwheel_slider_curr['crop']='medium';
}
if( $pinwheel_slider_curr['crop'] == 3 ) {
$pinwheel_slider_curr['crop']='thumbnail';
}
update_option($pinwheel_slider_options,$pinwheel_slider_curr);
update_option( "pinwheel_db_version", PINWHEEL_SLIDER_VER );
}
} //end for loop
/* Global settings - start */
$pinwheel_slider_curr=get_option('pinwheel_slider_options');
$garr = array();
if($pinwheel_slider_curr) {
foreach($pinwheel_slider_curr as $key=>$value) {
if($key=='user_level' || $key=='noscript' || $key=='multiple_sliders' || $key=='enque_scripts' || $key=='custom_post' || $key=='remove_metabox' || $key=='css' || $key=='css_js' || $key=='support' || $key == 'cpost_slug') {
$garr[$key] = $value;
}
}
}
$pinwheel_slider_gcurr=get_option('pinwheel_slider_global_options');
if(!$pinwheel_slider_gcurr) {
$pinwheel_slider_gcurr = array();
}
foreach($glb_slider as $key=>$value) {
if(!isset($pinwheel_slider_gcurr[$key])) {
$pinwheel_slider_gcurr[$key] = $value;
}
}
if( count($garr) > 0 ) {
$msliders=0;
foreach($garr as $key=>$value) {
$pinwheel_slider_gcurr[$key] = $value;
if($key=='multiple_sliders') {
$pinwheel_slider_gcurr[$key]=1;
}
if($key=='custom_post') {
$pinwheel_slider_gcurr[$key]=1;
}
}
}
update_option('pinwheel_slider_global_options',$pinwheel_slider_gcurr);
/* Global settings - end */
}
}
register_activation_hook( __FILE__, 'install_pinwheel_slider' );
/* Added for auto update - start */
function pinwheel_update_db_check() {
if (get_option('pinwheel_db_version') != PINWHEEL_SLIDER_VER ) {
install_pinwheel_slider();
}
/* Check whether Pinwheel Slider Options are created (if not) add options */
if(get_option('pinwheel_slider_options') == false) {
$default_pinwheel_slider_settings=get_pinwheel_slider_default_settings();
add_option('pinwheel_slider_options',$default_pinwheel_slider_settings);
}
if(get_option('pinwheel_slider_global_options') == false) {
$default_pinwheel_slider_global_settings = get_pinwheel_slider_global_default_settings();
add_option('pinwheel_slider_global_options',$default_pinwheel_slider_global_settings);
}
}
add_action('plugins_loaded', 'pinwheel_update_db_check');
/* Added for auto update - end */
require_once (dirname (__FILE__) . '/includes/sslider-get-the-image-functions.php');
require_once (PINWHEEL_SLIDER_INC_DIR.'help.php');
//This adds the post to the slider
function pinwheel_add_to_slider($post_id) {
$gpinwheel_slider = get_option('pinwheel_slider_global_options');
$pinwheel_slider = get_option('pinwheel_slider_options');
if(isset($_POST['pinwheel-sldr-verify']) and current_user_can( $gpinwheel_slider['user_level'] ) ) {
global $wpdb, $table_prefix, $post;
$table_name = $table_prefix.PINWHEEL_SLIDER_TABLE;
if( !isset($_POST['pinwheel-slider']) and is_post_on_any_pinwheel_slider($post_id) ){
$sql = "DELETE FROM $table_name where post_id = '$post_id'";
$wpdb->query($sql);
}
if(isset($_POST['pinwheel-slider']) and !isset($_POST['pinwheel_slider_name'])) {
$slider_id = '1';
if(is_post_on_any_pinwheel_slider($post_id)){
$sql = "DELETE FROM $table_name where post_id = '$post_id'";
$wpdb->query($sql);
}
if(isset($_POST['pinwheel-slider']) and $_POST['pinwheel-slider'] == "pinwheel-slider" and !pinwheel_slider($post_id,$slider_id)) {
$dt = date('Y-m-d H:i:s');
$sql = "INSERT INTO $table_name (post_id, date, slider_id) VALUES ('$post_id', '$dt', '$slider_id')";
$wpdb->query($sql);
}
}
if(isset($_POST['pinwheel-slider']) and $_POST['pinwheel-slider'] == "pinwheel-slider" and isset($_POST['pinwheel_slider_name'])){
$slider_id_arr = $_POST['pinwheel_slider_name'];
$post_sliders_data = pinwheel_ss_get_post_sliders($post_id);
foreach($post_sliders_data as $post_slider_data){
if(!in_array($post_slider_data['slider_id'],$slider_id_arr)) {
$sql = "DELETE FROM $table_name where post_id = '$post_id'";
$wpdb->query($sql);
}
}
foreach($slider_id_arr as $slider_id) {
if(!pinwheel_slider($post_id,$slider_id)) {
$dt = date('Y-m-d H:i:s');
$sql = "INSERT INTO $table_name (post_id, date, slider_id) VALUES ('$post_id', '$dt', '$slider_id')";
$wpdb->query($sql);
}
}
}
if(isset($_POST['pinwheel_expiry_actual']) ) {
$expiry=sanitize_text_field($_POST['pinwheel_expiry_actual']);
if(!empty($expiry)){
$date = $expiry;
$dt = date("Y-m-d",strtotime($date));
$wpdb->update($table_name, array('expiry' => $dt), array('post_id' => $post_id));
}
else{
$wpdb->update($table_name, array('expiry' => NULL), array('post_id' => $post_id));
}
}
$table_name = $table_prefix.PINWHEEL_SLIDER_POST_META;
if(isset($_POST['pinwheel_display_slider']) and !isset($_POST['pinwheel_display_slider_name'])) {
$slider_id = '1';
}
if(isset($_POST['pinwheel_display_slider']) and isset($_POST['pinwheel_display_slider_name'])){
$slider_id = $_POST['pinwheel_display_slider_name'];
}
if(isset($_POST['pinwheel_display_slider'])){
if(!pinwheel_ss_post_on_slider($post_id,$slider_id)) {
$sql = "DELETE FROM $table_name where post_id = '$post_id'";
$wpdb->query($sql);
$sql = "INSERT INTO $table_name (post_id, slider_id) VALUES ('$post_id', '$slider_id')";
$wpdb->query($sql);
}
}
$thumbnail_key = (isset($pinwheel_slider['img_pick'][1]) ? $pinwheel_slider['img_pick'][1] : 'pinwheel_slider_thumbnail');
$pinwheel_sslider_thumbnail = get_post_meta($post_id,$thumbnail_key,true);
$post_slider_thumbnail=isset($_POST['pinwheel_sslider_thumbnail'])?$_POST['pinwheel_sslider_thumbnail']:"";
if($pinwheel_sslider_thumbnail != $post_slider_thumbnail) {
update_post_meta($post_id, $thumbnail_key, $post_slider_thumbnail);
}
$pinwheel_link_attr = get_post_meta($post_id,'pinwheel_link_attr',true);
$link_attr=isset($_POST['pinwheel_link_attr'])?html_entity_decode($_POST['pinwheel_link_attr'],ENT_QUOTES):"";
if($pinwheel_link_attr != $link_attr) {
update_post_meta($post_id, 'pinwheel_link_attr', $link_attr);
}
$pinwheel_sslider_link = get_post_meta($post_id,'pinwheel_slide_redirect_url',true);
$link=isset($_POST['pinwheel_sslider_link'])?$_POST['pinwheel_sslider_link']:"";
if($pinwheel_sslider_link != $link) {
update_post_meta($post_id, 'pinwheel_slide_redirect_url', $link);
}
$slide_expiry = get_post_meta($post_id,'_pinwheel_slide_expiry',true);
$post_slide_expiry = isset($_POST['pinwheel_expiry_actual'])?sanitize_text_field($_POST['pinwheel_expiry_actual']):'';
if($slide_expiry != $post_slide_expiry) {
update_post_meta($post_id, '_pinwheel_slide_expiry', $post_slide_expiry);
}
$pinwheel_sslider_nolink = get_post_meta($post_id,'pinwheel_sslider_nolink',true);
$post_pinwheel_sslider_nolink = isset( $_POST['pinwheel_sslider_nolink'] ) ? $_POST['pinwheel_sslider_nolink'] : '';
if($pinwheel_sslider_nolink != $post_pinwheel_sslider_nolink) {
update_post_meta($post_id, 'pinwheel_sslider_nolink', $_POST['pinwheel_sslider_nolink']);
}
$pinwheel_sslider_embedshortcode = get_post_meta($post_id,'_pinwheel_sslider_embedshortcode',true);
$post_pinwheel_sslider_embedshortcode = isset($_POST['pinwheel_sslider_embedshortcode'])?$_POST['pinwheel_sslider_embedshortcode']:"";
if($pinwheel_sslider_embedshortcode != $post_pinwheel_sslider_embedshortcode) {
update_post_meta($post_id, '_pinwheel_sslider_embedshortcode', $post_pinwheel_sslider_embedshortcode);
}
$pinwheel_sslider_youtubeurl = get_post_meta($post_id,'_pinwheel_youtubeurl',true);
$post_pinwheel_sslider_youtubeurl = isset($_POST['pinwheel_sslider_youtubeurl'])?$_POST['pinwheel_sslider_youtubeurl']:"";
if($pinwheel_sslider_youtubeurl != $post_pinwheel_sslider_youtubeurl) {
update_post_meta($post_id, '_pinwheel_youtubeurl', $post_pinwheel_sslider_youtubeurl);
}
$pinwheel_sslider_webmurl = get_post_meta($post_id,'_pinwheel_webmurl',true);
$post_pinwheel_sslider_webmurl = isset($_POST['pinwheel_sslider_webmurl'])?$_POST['pinwheel_sslider_webmurl']:"";
if($pinwheel_sslider_webmurl != $post_pinwheel_sslider_webmurl) {
update_post_meta($post_id, '_pinwheel_webmurl', $post_pinwheel_sslider_webmurl);
}
$pinwheel_sslider_mp4url = get_post_meta($post_id,'_pinwheel_mp4url',true);
$post_pinwheel_sslider_mp4url = isset($_POST['pinwheel_sslider_mp4url'])?$_POST['pinwheel_sslider_mp4url']:"";
if($pinwheel_sslider_mp4url != $post_pinwheel_sslider_mp4url) {
update_post_meta($post_id, '_pinwheel_mp4url', $post_pinwheel_sslider_mp4url);
}
$pinwheel_sslider_oggurl = get_post_meta($post_id,'_pinwheel_oggurl',true);
$post_pinwheel_sslider_oggurl = isset($_POST['pinwheel_sslider_oggurl'])?$_POST['pinwheel_sslider_oggurl']:"";
if($pinwheel_sslider_oggurl != $post_pinwheel_sslider_oggurl) {
update_post_meta($post_id, '_pinwheel_oggurl', $post_pinwheel_sslider_oggurl);
}
$pinwheel_sslider_videourl = get_post_meta($post_id,'_pinwheel_sslider_videourl',true);
$post_pinwheel_sslider_videourl = isset($_POST['_pinwheel_sslider_videourl'])?$_POST['_pinwheel_sslider_videourl']:"";
if($pinwheel_sslider_videourl != $post_pinwheel_sslider_videourl) {
update_post_meta($post_id, '_pinwheel_sslider_videourl', $post_pinwheel_sslider_videourl);
}
$pinwheel_select_set = get_post_meta($post_id,'_pinwheel_select_set',true);
$post_pinwheel_select_set = isset($_POST['pinwheel_select_set'])?$_POST['pinwheel_select_set']:"";
if($pinwheel_select_set != $post_pinwheel_select_set and $post_pinwheel_select_set!='0') {
update_post_meta($post_id, '_pinwheel_select_set', $post_pinwheel_select_set);
}
/* Added For Image Transitions */
$pinwheel_img_transition = get_post_meta($post_id,'_pinwheel_img_transition',true);
$img_transition= isset($_POST['pinwheel_img_transition'])?$_POST['pinwheel_img_transition']:'';
if($pinwheel_img_transition != $img_transition) {
update_post_meta($post_id, '_pinwheel_img_transition', $img_transition);
}
$pinwheel_img_duration = get_post_meta($post_id,'_pinwheel_img_duration',true);
$img_duration= isset($_POST['pinwheel_img_duration'])?$_POST['pinwheel_img_duration']:'';
if($pinwheel_img_duration != $img_duration) {
update_post_meta($post_id, '_pinwheel_img_duration', $img_duration);
}
$pinwheel_img_delay = get_post_meta($post_id,'_pinwheel_img_delay',true);
$img_delay= isset($_POST['pinwheel_img_delay'])?$_POST['pinwheel_img_delay']:'';
if($pinwheel_img_delay != $img_delay) {
update_post_meta($post_id, '_pinwheel_img_delay', $img_delay);
}
/* Added For Title Transitions */
$pinwheel_title_transition = get_post_meta($post_id,'_pinwheel_title_transition',true);
$title_transition= isset($_POST['pinwheel_title_transition'])?$_POST['pinwheel_title_transition']:'';
if($pinwheel_title_transition != $title_transition) {
update_post_meta($post_id, '_pinwheel_title_transition', $title_transition);
}
$pinwheel_title_duration = get_post_meta($post_id,'_pinwheel_title_duration',true);
$title_duration= isset($_POST['pinwheel_title_duration'])?$_POST['pinwheel_title_duration']:'';
if($pinwheel_title_duration != $title_duration) {
update_post_meta($post_id, '_pinwheel_title_duration', $title_duration);
}
$pinwheel_title_delay = get_post_meta($post_id,'_pinwheel_title_delay',true);
$title_delay= isset($_POST['pinwheel_title_delay'])?$_POST['pinwheel_title_delay']:'';
if($pinwheel_title_delay != $title_delay) {
update_post_meta($post_id, '_pinwheel_title_delay', $title_delay);
}
/* Added For Content Transitions */
$pinwheel_content_transition = get_post_meta($post_id,'_pinwheel_content_transition',true);
$content_transition= isset($_POST['pinwheel_content_transition'])?$_POST['pinwheel_content_transition']:'';
if($pinwheel_content_transition != $content_transition) {
update_post_meta($post_id, '_pinwheel_content_transition', $content_transition);
}
$pinwheel_content_duration = get_post_meta($post_id,'_pinwheel_content_duration',true);
$content_duration= isset($_POST['pinwheel_content_duration'])?$_POST['pinwheel_content_duration']:'';
if($pinwheel_content_duration != $content_duration) {
update_post_meta($post_id, '_pinwheel_content_duration', $content_duration);
}
$pinwheel_content_delay = get_post_meta($post_id,'_pinwheel_content_delay',true);
$content_delay= isset($_POST['pinwheel_content_delay'])?$_POST['pinwheel_content_delay']:'';
if($pinwheel_content_delay != $content_delay) {
update_post_meta($post_id, '_pinwheel_content_delay', $content_delay);
}
/* Added for embed shortcode - start */
$pinwheel_disable_image = get_post_meta($post_id,'_pinwheel_disable_image',true);
//3.0 : Debug error
$post_pinwheel_disable_image = isset( $_POST['pinwheel_disable_image'] ) ? $_POST['pinwheel_disable_image'] : '';
if($pinwheel_disable_image != $post_pinwheel_disable_image) {
update_post_meta($post_id, '_pinwheel_disable_image', $post_pinwheel_disable_image);
}
$pinwheel_sslider_eshortcode = get_post_meta($post_id,'_pinwheel_embed_shortcode',true);
$post_pinwheel_sslider_eshortcode = isset($_POST['pinwheel_sslider_eshortcode'])?$_POST['pinwheel_sslider_eshortcode']:"";
if($pinwheel_sslider_eshortcode != $post_pinwheel_sslider_eshortcode) {
update_post_meta($post_id, '_pinwheel_embed_shortcode', $post_pinwheel_sslider_eshortcode);
}
/* Added for embed shortcode -end */
} //pinwheel-sldr-verify
}
//Removes the post from the slider, if you uncheck the checkbox from the edit post screen
function pinwheel_remove_from_slider($post_id) {
if(isset($_POST['pinwheel-sldr-verify'])) {
global $wpdb, $table_prefix;
$table_name = $table_prefix.PINWHEEL_SLIDER_TABLE;
// authorization
if (!current_user_can('edit_post', $post_id))
return $post_id;
// origination and intention
if (!wp_verify_nonce($_POST['pinwheel-sldr-verify'], 'PinwheelSlider'))
return $post_id;
if(empty($_POST['pinwheel-slider']) and is_post_on_any_pinwheel_slider($post_id)) {
$sql = "DELETE FROM $table_name where post_id = '$post_id'";
$wpdb->query($sql);
}
$display_slider = isset( $_POST['pinwheel_display_slider'] ) ? $_POST['pinwheel_display_slider'] : '';
$table_name = $table_prefix.PINWHEEL_SLIDER_POST_META;
if(empty($display_slider) and pinwheel_ss_slider_on_this_post($post_id)){
$sql = "DELETE FROM $table_name where post_id = '$post_id'";
$wpdb->query($sql);
}
}
}
function pinwheel_delete_from_slider_table($post_id){
global $wpdb, $table_prefix;
$table_name = $table_prefix.PINWHEEL_SLIDER_TABLE;
if(is_post_on_any_pinwheel_slider($post_id)) {
$sql = "DELETE FROM $table_name where post_id = '$post_id'";
$wpdb->query($sql);
}
$table_name = $table_prefix.PINWHEEL_SLIDER_POST_META;
if(pinwheel_ss_slider_on_this_post($post_id)) {
$sql = "DELETE FROM $table_name where post_id = '$post_id'";
$wpdb->query($sql);
}
}
// Slider checkbox on the admin page
function pinwheel_slider_edit_custom_box(){
pinwheel_add_to_slider_checkbox();
}
function pinwheel_slider_add_custom_box() {
$gpinwheel_slider = get_option('pinwheel_slider_global_options');
if (current_user_can( $gpinwheel_slider['user_level'] )) {
if( function_exists( 'add_meta_box' ) ) {
$post_types=get_post_types();
$remove_post_type_arr=( isset($gpinwheel_slider['remove_metabox']) ? $gpinwheel_slider['remove_metabox'] : '' );
if(!isset($remove_post_type_arr) or !is_array($remove_post_type_arr) ) $remove_post_type_arr=array();
foreach($post_types as $post_type) {
if(!in_array($post_type,$remove_post_type_arr)){
add_meta_box( 'pinwheel_slider_box', __( 'Pinwheel Slider' , 'pinwheel-slider'), 'pinwheel_slider_edit_custom_box', $post_type, 'advanced' );
}
}
}
}
}
/* Use the admin_menu action to define the custom boxes */
add_action('admin_menu', 'pinwheel_slider_add_custom_box');
function pinwheel_add_to_slider_checkbox() {
global $post;
$pinwheel_slider = get_option('pinwheel_slider_options');
$gpinwheel_slider = get_option('pinwheel_slider_global_options');
//for WPML start
if( function_exists('icl_plugin_action_links') ) {
if( isset($_GET['source_lang']) && isset($_GET['trid']) ) {
global $wpdb, $table_prefix;
$id = $wpdb->get_var( "SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE trid=".$_GET['trid']." AND language_code='".$_GET['source_lang']."'" );
$table_name = $table_prefix.PINWHEEL_SLIDER_TABLE;
$q = "select * from $table_name where post_id=".$id;
$res = $wpdb->get_results($q);
if( count($res) > 0 ) {
$sarr=array();
foreach($res as $re) {
$sarr[] = $re->slider_id;
}
echo "<script type='text/javascript'>";
echo "jQuery(document).ready(function($) {";
echo "jQuery('.pinwheel-psldr-post').prop('checked','true');";
$sliders = pinwheel_ss_get_sliders();
foreach ($sliders as $slider) {
if(in_array($slider['slider_id'],$sarr)) {
echo "jQuery('#pinwheel_slider_name".$slider['slider_id']."').prop('checked','true');";
}
}
echo "});";
echo "</script>";
}
}
}
//for WPML end
if (current_user_can( $gpinwheel_slider['user_level'] )) {
$extra = "";
$post_id = $post->ID;
if(isset($post->ID)) {
$post_id = $post->ID;
if(is_post_on_any_pinwheel_slider($post_id)) { $extra = 'checked="checked"'; }
}
$post_slider_arr = array();
$post_sliders = pinwheel_ss_get_post_sliders($post_id);
if($post_sliders) {
foreach($post_sliders as $post_slider){
$post_slider_arr[] = $post_slider['slider_id'];
}
}
$sliders = pinwheel_ss_get_sliders();
$thumbnail_key = (isset($pinwheel_slider['img_pick'][1]) ? $pinwheel_slider['img_pick'][1] : 'slider_thumbnail');
$pinwheel_sslider_thumbnail= get_post_meta($post_id, $thumbnail_key, true);
$pinwheel_sslider_link= get_post_meta($post_id, 'pinwheel_slide_redirect_url', true);
$pinwheel_sslider_nolink=get_post_meta($post_id, 'pinwheel_sslider_nolink', true);
$pinwheel_link_attr=get_post_meta($post_id, 'pinwheel_link_attr', true);
$pinwheel_embedshortcode=get_post_meta($post_id, '_pinwheel_sslider_embedshortcode', true);
$pinwheel_youtubeurl=get_post_meta($post_id, '_pinwheel_youtubeurl', true);
$pinwheel_mp4url=get_post_meta($post_id, '_pinwheel_mp4url', true);
$pinwheel_webmurl=get_post_meta($post_id, '_pinwheel_webmurl', true);
$pinwheel_oggurl=get_post_meta($post_id, '_pinwheel_oggurl', true);
$pinwheel_sslider_videourl=get_post_meta($post_id, '_pinwheel_sslider_videourl', true);
$pinwheel_select_set=get_post_meta($post_id, '_pinwheel_select_set', true);
/* Transitions */
$pinwheel_img_transition=get_post_meta($post_id, '_pinwheel_img_transition', true);
$pinwheel_img_duration=get_post_meta($post_id, '_pinwheel_img_duration', true);
$pinwheel_img_delay=get_post_meta($post_id, '_pinwheel_img_delay', true);
$pinwheel_title_transition=get_post_meta($post_id, '_pinwheel_title_transition', true);
$pinwheel_title_duration=get_post_meta($post_id, '_pinwheel_title_duration', true);
$pinwheel_title_delay=get_post_meta($post_id, '_pinwheel_title_delay', true);
$pinwheel_content_transition=get_post_meta($post_id, '_pinwheel_content_transition', true);
$pinwheel_content_duration=get_post_meta($post_id, '_pinwheel_content_duration', true);
$pinwheel_content_delay=get_post_meta($post_id, '_pinwheel_content_delay', true);
/* END Transitions */
$pinwheel_disable_image=get_post_meta($post_id, '_pinwheel_disable_image', true);
/* Post Meta Box Style */
wp_enqueue_style( 'pinwheel-meta-box', pinwheel_slider_plugin_url( 'css/css/pinwheel-meta-box.css' ), false, PINWHEEL_SLIDER_VER, 'all');
//Date Picker
wp_enqueue_script( 'jquery-ui-datepicker', false,array('jquery','jQuery-ui-core'),PINWHEEL_SLIDER_VER, true);
wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
$expirydt=get_post_meta($post_id, '_pinwheel_slide_expiry', true);
$wpDateFormat = get_option('date_format');
/*$expiry = pinwheel_ss_get_expiry($post_id);
if(isset($expiry))
$expirydt = date($wpDateFormat, strtotime($expiry));
else
$expirydt="";*/
$dtpicker = pinwheel_dateformat_PHP_to_jQueryUI($wpDateFormat);
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
jQuery('#pinwheel_ExpiryDate').datepicker({
dateFormat : "<?php echo $dtpicker ?>"
});
jQuery("#pinwheel_ExpiryDate").on("change", function(e){
var expDt=jQuery(this).val();
jQuery("#pinwheel_expiry_actual").val(expDt);
if(expDt.length>0){
jQuery("#pinwheel_none").show();
}
else{
jQuery("#pinwheel_none").hide();
}
});
jQuery("#pinwheel_none").on("click", function(e){
jQuery("#pinwheel_ExpiryDate").val("");
jQuery("#pinwheel_ExpiryDate").triggerHandler("change");
e.preventDefault();
return false;
});
jQuery("#pinwheel_basic").css({"height":"auto","color":"#444","background":"#FFFFFF"});
jQuery(".pinwheel-tab").click(function() {
var idex = jQuery(this).index();
jQuery(".pinwheel-tab-content").fadeOut("fast");
jQuery(".pinwheel-tab").css({"height":"17px","color":"#0074a2","background": "#F5F5F5"});
jQuery(".pinwheel-tab-content:eq("+idex+")").fadeIn("fast");
jQuery(this).css({"height":"auto","color":"#444","background":"#FFFFFF"});
});
jQuery(".show-all").click(function() {
jQuery(this).fadeOut("fast");
jQuery(".slider-name").fadeIn("slow");
return false;
});
jQuery('a.pinwheel-help').click(function(e) {
e.preventDefault();
jQuery('#contextual-help-link').click();
jQuery('#tab-link-pinwheel-edtposthelp a').click();
});
// added
jQuery(".pinwheel-add-to-slider").click(function() {
var added = 0;
jQuery(".pinwheel-add-to-slider").each(function() {
if(jQuery(this).prop("checked") == true) { added = added + 1; }
});
if( added >= 1 ) {
jQuery(".pinwheel-psldr-post").prop("checked", true );
} else {
jQuery(".pinwheel-psldr-post").prop("checked", false );
}
});
});
</script>
<div class="pinwheel-tabs">
<div id="pinwheel_basic" class="pinwheel-tab"><?php _e('Basic','pinwheel-slider'); ?></div>
<div id="pinwheel_transitions" class="pinwheel-tab"><?php _e('Transitions','pinwheel-slider'); ?></div>
<div id="pinwheel_advanced" class="pinwheel-tab last"><?php _e('Advanced','pinwheel-slider'); ?></div>
</div>
<div id="pinwheel_basic_tab" class="pinwheel-tab-content" style="padding: 0 10px;background: #ffffff;">
<div class="slider_checkbox">
<table class="form-table" style="margin: 0;">
<tr valign="top">
<a class="pinwheel-help" herf="#"><?php _e('Help ?','pinwheel-slider'); ?></a>
</tr>
<tr valign="top">
<td scope="row">
<input id="pinwheel-slider" name="pinwheel-slider" class="pinwheel-psldr-post" type="checkbox" value="pinwheel-slider" <?php echo $extra;?> >
<label><?php _e('Add this post/page to','pinwheel-slider'); ?></label>
</td>
<td>
<?php $i = 0;
foreach ($sliders as $slider) {
if($i < 3) $display="display:block;"; else $display="display:none;"; ?>
<div style="margin-bottom: 16px;float: left;width: 100%;<?php echo $display;?>" class="slider-name">
<span style="float: left;margin-right: 20px;min-width: 100px;"><?php echo $slider['slider_name'];?></span>
<input id="pinwheel_slider_name<?php echo $slider['slider_id'];?>" name="pinwheel_slider_name[]" class="pinwheel-meta-toggle pinwheel-meta-toggle-round pinwheel-add-to-slider" type="checkbox" value="<?php echo $slider['slider_id'];?>" <?php if(in_array($slider['slider_id'],$post_slider_arr)){echo 'checked';} ?> >
<label for="pinwheel_slider_name<?php echo $slider['slider_id'];?>"></label>
</div>
<?php $i++;
} if($i > 3) { ?>
<a href="" class='show-all'><?php _e('Show All','pinwheel-slider'); ?></a>
<?php } ?>
<input type="hidden" name="pinwheel-sldr-verify" id="pinwheel-sldr-verify" value="<?php echo wp_create_nonce('PinwheelSlider');?>" />
</td>
</tr>
<tr valign="top">
<td scope="row"><label for="pinwheel_sslider_link"><?php _e('Slide Link URL ','pinwheel-slider'); ?></label></td>
<td><input type="text" name="pinwheel_sslider_link" class="pinwheel_sslider_link" value="<?php echo $pinwheel_sslider_link;?>" size="50" /><br /><small><?php _e('If left empty, it will be by default linked to the permalink.','pinwheel-slider'); ?></small> </td>
</tr>
<tr valign="top">
<td scope="row"><label for="pinwheel_sslider_nolink"><?php _e('Disable Slide Link','pinwheel-slider'); ?> </label></td>
<td><input id="pinwheel_sslider_nolink" name="pinwheel_sslider_nolink" class="pinwheel-meta-toggle pinwheel-meta-toggle-round" type="checkbox" value="1" <?php if($pinwheel_sslider_nolink=='1'){echo "checked";}?> >
<label for="pinwheel_sslider_nolink"></label> </td>
</tr>
</table>
</div>
</div>
<div id="pinwheel_transition_tab" class="pinwheel-tab-content" style="display:none;background: #ffffff;">
<table class="form-table">
<tr valign="top">
<th scope="row" colspan="2" class="tab-title">
<label for="pinwheel-slider"><?php _e('Slide Image','pinwheel-slider'); ?> </label>
</th>
</tr>
<tr valign="top">
<td scope="row"><label for="pinwheel_img_transition"><?php _e('Transition','pinwheel-slider'); ?></label></td>
<td> <?php echo get_pinwheel_transitions('pinwheel_img_transition',$pinwheel_img_transition); ?> </td>
</tr>
<tr valign="top">
<td scope="row"><label for="pinwheel_img_duration"><?php _e('Duration (seconds)','pinwheel-slider'); ?> </label></td>
<td><input type="number" name="pinwheel_img_duration" value="<?php echo $pinwheel_img_duration;?>" style="width:60px" /></td>
</tr>
<tr valign="top">
<td scope="row"><label for="pinwheel_img_delay"><?php _e('Delay (seconds)','pinwheel-slider'); ?> </label></td>
<td><input type="number" name="pinwheel_img_delay" value="<?php echo $pinwheel_img_delay;?>" style="width:60px" /></td>
</tr>
</table>
<div style="background: #F5F5F5;margin: 0 10px;">
<table class="form-table">
<tr valign="top">
<th scope="row" colspan="2" class="tab-title" >
<label for="pinwheel-slider"><?php _e('Slide Title','pinwheel-slider'); ?> </label>
</th>
</tr>
<tr valign="top">
<td scope="row"><label for="pinwheel_title_transition"><?php _e('Transition','pinwheel-slider'); ?></label></td>
<td> <?php echo get_pinwheel_transitions('pinwheel_title_transition',$pinwheel_title_transition); ?> </td>
</tr>
<tr valign="top">
<td scope="row"><label for="pinwheel_title_duration"><?php _e('Duration (seconds)','pinwheel-slider'); ?> </label></td>
<td><input type="number" name="pinwheel_title_duration" value="<?php echo $pinwheel_title_duration;?>" style="width:60px" /></td>
</tr>
<tr valign="top">
<td scope="row"><label for="pinwheel_title_delay"><?php _e('Delay (seconds)','pinwheel-slider'); ?> </label></td>
<td><input type="number" name="pinwheel_title_delay" value="<?php echo $pinwheel_title_delay;?>" style="width:60px" /></td>
</tr>
</table>
</div>
<table class="form-table">
<tr valign="top">
<th scope="row" colspan="2" class="tab-title" >
<label for="pinwheel-slider"><?php _e('Slide Content','pinwheel-slider'); ?> </label>
</th>
</tr>
<tr valign="top">
<td scope="row"><label for="pinwheel_content_transition"><?php _e('Transition','pinwheel-slider'); ?></label></td>
<td> <?php echo get_pinwheel_transitions('pinwheel_content_transition',$pinwheel_content_transition); ?> </td>
</tr>
<tr valign="top">
<td scope="row"><label for="pinwheel_content_duration"><?php _e('Duration (seconds)','pinwheel-slider'); ?> </label></td>
<td><input type="number" name="pinwheel_content_duration" value="<?php echo $pinwheel_content_duration;?>" style="width:60px" /></td>
</tr>
<tr valign="top">
<td scope="row"><label for="pinwheel_content_delay"><?php _e('Delay (seconds)','pinwheel-slider'); ?> </label></td>
<td><input type="number" name="pinwheel_content_delay" value="<?php echo $pinwheel_content_delay;?>" style="width:60px" /></td>
</tr>
</table>
</div>
<div id="pinwheel_advanced_tab" class="pinwheel-tab-content" style="display:none;background: #ffffff;padding: 0 10px;">
<?php
$scounter=get_option('pinwheel_slider_scounter');
$settingset_html='<option value="0" selected >Select the Settings</option>';
for($i=1;$i<=$scounter;$i++) {
if($i==$pinwheel_select_set){$selected = 'selected';} else{$selected='';}
if($i==1){
$settings='Default Settings';
$settingset_html =$settingset_html.'<option value="1" '.$selected.'>'.$settings.'</option>';
}
else{
if($settings_set=get_option('pinwheel_slider_options'.$i))
$settingset_html =$settingset_html.'<option value="'.$i.'" '.$selected.'>'.$settings_set['setname'].' (ID '.$i.')</option>';
}
} ?>
<div class="slider_checkbox">
<table class="form-table" style="margin:0;">
<tr valign="top">
<td scope="row"><label for="pinwheel_sslider_thumbnail"><?php _e('Custom Image url','pinwheel-slider'); ?></label></td>
<td><input type="text" name="pinwheel_sslider_thumbnail" class="pinwheel_sslider_thumbnail" value="<?php echo $pinwheel_sslider_thumbnail;?>" size="50" /></td>
</tr>
<!-- Added for disable thumbnail image - Start -->
<tr valign="top">
<td scope="row">
<span style="float: left;margin-right: 20px;min-width: 100px;"><?php _e('Hide Image','pinwheel-slider'); ?> </span>
</td>
<td>
<input id="pinwheel_disable_image" name="pinwheel_disable_image" class="pinwheel-meta-toggle pinwheel-meta-toggle-round" type="checkbox" value="1" <?php if($pinwheel_disable_image=='1'){echo "checked";}?> >
<label for="pinwheel_disable_image"></label>
</td>
</tr>
<!-- Added for disable thumbnail image - end -->
<tr valign="top">
<td scope="row">
<label for="pinwheel_link_attr"><?php _e('Slide Link (anchor) attributes ','pinwheel-slider'); ?></label>
</td>
<td>
<input type="text" name="pinwheel_link_attr" class="pinwheel_link_attr" value="<?php echo htmlentities($pinwheel_link_attr,ENT_QUOTES);?>" size="50" /><br /><small><?php _e('e.g. target="_blank" rel="external nofollow"','pinwheel-slider'); ?></small>
</td>
</tr>
<tr valign="top">
<td scope="row">
<label for="pinwheel_sslider_expiry"><?php _e('Expiry Date','pinwheel-slider'); ?></label>
</td>
<td>
<input type="text" name="pinwheel_sslider_expiry" id="pinwheel_ExpiryDate" class="pinwheel_sslider_expiry" value="<?php echo ((!empty($expirydt))?date_i18n($wpDateFormat, strtotime($expirydt)):'');?>" size="30" /> <input type="hidden" name="pinwheel_expiry_actual" id="pinwheel_expiry_actual" value="<?php echo $expirydt;?>" /><button name="pinwheel_none" id="pinwheel_none"><?php esc_html_e( 'None','pinwheel-slider' );?>
</td>
</tr>
<!-- Added for video - Start -->
<tr valign="top">
<th scope="row"><label for="video"><?php _e('Video URL','pinwheel-slider'); ?> </label><br><br><div style="font-weight:normal;border:1px dashed #ccc;padding:5px;color:#666;line-height:20px;font-size:13px;">webm video, ogg video are the fallback URL used for specific browsers. You can mention your self hosted videos over here.</div></th>
<td>
<table>
<tr>
<td><label for="mp4_video"><?php _e('MP4 Video','pinwheel-slider'); ?></label></td>
<td><input type="text" name="pinwheel_sslider_mp4url" value="<?php echo htmlentities( $pinwheel_mp4url, ENT_QUOTES);?>" size="50" style="width:90%;" /></td>
</tr>
<tr>
<td><label for="webm_video"><?php _e('Webm Video','pinwheel-slider'); ?></label></td>
<td><input type="text" name="pinwheel_sslider_webmurl" value="<?php echo htmlentities( $pinwheel_webmurl, ENT_QUOTES);?>" size="50" style="width:90%;" /></td>
</tr>
<tr>
<td><label for="ogg_video"><?php _e('Ogg Video','pinwheel-slider'); ?></label></td>
<td><input type="text" name="pinwheel_sslider_oggurl" value="<?php echo htmlentities( $pinwheel_oggurl, ENT_QUOTES);?>" size="50" style="width:90%;" /></td>
</tr>
<tr>
<td><label for="Youtube_video"><?php _e('Youtube Video','pinwheel-slider'); ?></label></td>
<td><input type="text" name="pinwheel_sslider_youtubeurl" value="<?php echo htmlentities( $pinwheel_youtubeurl, ENT_QUOTES);?>" size="50" style="width:90%;" /></td>
</tr>
</table>
</td>
</tr>
<!-- Added for embeding any shortcode in slides -->
<tr valign="top">
<th scope="row"><label for="embed_shortcode"><?php _e('Embed Shortcode','pinwheel-slider'); ?> </label><br><br><div style="font-weight:normal;border:1px dashed #ccc;padding:5px;color:#666;line-height:20px;font-size:13px;">You can embed any type of shortcode e.g video shortcode or button shortcode which you want to be overlaid on the slide.</div></th>
<td><textarea rows="4" cols="50" name="pinwheel_sslider_embedshortcode"><?php echo htmlentities( $pinwheel_embedshortcode, ENT_QUOTES);?></textarea></td>
</tr>
</table>
<!-- Added for video - End -->
<table class="form-table" style="width:520px;">
<tr valign="top">
<td scope="row">
<input id="pinwheel_display_slider" name="pinwheel_display_slider" class="pinwheel-meta-toggle pinwheel-meta-toggle-round" type="checkbox" value="1" <?php if(pinwheel_ss_slider_on_this_post($post_id)){echo "checked";}?> >
<label for="pinwheel_display_slider"></label>
<span><?php _e('Force Display Slider','pinwheel-slider'); ?></span>
</td>
<td>
<select name="pinwheel_display_slider_name">
<?php foreach ($sliders as $slider) { ?>
<option value="<?php echo $slider['slider_id'];?>" <?php if(pinwheel_ss_post_on_slider($post_id,$slider['slider_id'])){echo 'selected';} ?>><?php echo $slider['slider_name'];?></option>
<?php } ?>
</select>
</td>
</tr>
<tr valign="top">
<td scope="row">
<label for="pinwheel_setting_set"><?php _e('Force Apply Setting','pinwheel-slider'); ?></label>
</td>
<td>
<select id="pinwheel_select_set" name="pinwheel_select_set"><?php echo $settingset_html;?></select>
</td>
</tr>
</table>
</div>
</div>
<?php }
}
add_action('publish_post', 'pinwheel_add_to_slider');
add_action('publish_page', 'pinwheel_add_to_slider');
add_action('edit_post', 'pinwheel_add_to_slider');
add_action('publish_post', 'pinwheel_remove_from_slider');
add_action('edit_post', 'pinwheel_remove_from_slider');
add_action('deleted_post','pinwheel_delete_from_slider_table');
add_action('edit_attachment', 'pinwheel_add_to_slider');
add_action('delete_attachment','pinwheel_delete_from_slider_table');
function pinwheel_slider_plugin_url( $path = '' ) {
return plugins_url( $path, __FILE__ );
}
add_filter( 'plugin_action_links', 'pinwheel_sslider_plugin_action_links', 10, 2 );
function pinwheel_sslider_plugin_action_links( $links, $file ) {
if ( $file != PINWHEEL_SLIDER_PLUGIN_BASENAME )
return $links;
$url = pinwheel_sslider_admin_url( array( 'page' => 'manage-pinwheel-slider' ) );
$settings_link = '<a href="' . esc_attr( $url ) . '">'
. esc_html( __( 'Manage') ) . '</a>';
array_unshift( $links, $settings_link );
return $links;
}
//New Custom Post Type
$gpinwheel_slider = get_option('pinwheel_slider_global_options');
if( $gpinwheel_slider['custom_post'] == '1' and !post_type_exists('slidervilla') ){
add_action( 'init', 'pinwheel_post_type', 11 );
function pinwheel_post_type() {
$gpinwheel_slider = get_option('pinwheel_slider_global_options');
$labels = array(
'name' => _x('SliderVilla Slides', 'post type general name'),
'singular_name' => _x('SliderVilla Slide', 'post type singular name'),
'add_new' => _x('Add New', 'pinwheel'),
'add_new_item' => __('Add New SliderVilla Slide'),
'edit_item' => __('Edit SliderVilla Slide'),
'new_item' => __('New SliderVilla Slide'),
'all_items' => __('All SliderVilla Slides'),
'view_item' => __('View SliderVilla Slide'),
'search_items' => __('Search SliderVilla Slides'),
'not_found' => __('No SliderVilla slides found'),
'not_found_in_trash' => __('No SliderVilla slides found in Trash'),
'parent_item_colon' => '',
'menu_name' => 'SliderVilla Slides'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array('slug' => $gpinwheel_slider['cpost_slug'],'with_front' => false),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','thumbnail','excerpt','custom-fields')
);
register_post_type('slidervilla',$args);
}
//add filter to ensure the text SliderVilla, or slidervilla, is displayed when user updates a slidervilla
add_filter('post_updated_messages', 'pinwheel_updated_messages');
function pinwheel_updated_messages( $messages ) {
global $post, $post_ID;
$messages['pinwheel'] = array(
0 => '', // Unused. Messages start at index 1.
1 => sprintf( __('SliderVilla Slide updated. <a href="%s">View SliderVilla slide</a>'), esc_url( get_permalink($post_ID) ) ),
2 => __('Custom field updated.'),
3 => __('Custom field deleted.'),
4 => __('SliderVilla Slide updated.'),
/* translators: %s: date and time of the revision */
5 => isset($_GET['revision']) ? sprintf( __('SliderVilla Slide restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
6 => sprintf( __('SliderVilla Slide published. <a href="%s">View SliderVilla slide</a>'), esc_url( get_permalink($post_ID) ) ),
7 => __('Pinwheel saved.'),
8 => sprintf( __('SliderVilla Slide submitted. <a target="_blank" href="%s">Preview SliderVilla slide</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
9 => sprintf( __('SliderVilla Slides scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview SliderVilla slide</a>'),
// translators: Publish box date format, see http://php.net/date
date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
10 => sprintf( __('SliderVilla Slide draft updated. <a target="_blank" href="%s">Preview SliderVilla slide</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
);
return $messages;
}
} //if custom_post is true
require_once (dirname (__FILE__) . '/slider_versions/pinwheel_1.php');
require_once (dirname (__FILE__) . '/settings/settings.php');
require_once (dirname (__FILE__) . '/settings/easy_builder.php');
require_once (dirname (__FILE__) . '/settings/admin-ajax.php');
// Load the auto update class
if( !class_exists( 'PINWHEEL_Plugin_Updater' ) ) {
include( dirname( __FILE__ ) . '/includes/upgrade.php' );
}
//SliderVilla Quicktag
function pinwheel_quicktag_select(){
echo '<option value="pinwheel-slider" >Pinwheel Slider</option>';
}
function pinwheel_quicktag_js(){
echo '<script language="javascript" type="text/javascript" src="'.pinwheel_slider_plugin_url('includes/tinymce/tinymce.js').'"></script>';
}
function pinwheel_plugins_loaded(){
if( !class_exists( 'add_slidervilla_button' ) ) {
include_once (dirname (__FILE__) . '/includes/tinymce/tinymce.php');
}
add_action( 'svquicktag_select', 'pinwheel_quicktag_select' );
add_action( 'svquicktag_js', 'pinwheel_quicktag_js' );
}
add_action( 'plugins_loaded', 'pinwheel_plugins_loaded' );
// Load the new update-notification class
add_action('init', 'pinwheel_update_notification');
function pinwheel_update_notification() {
$license_key = trim( get_option('pinwheel_license_key') );
$edd_updater = new PINWHEEL_Plugin_Updater( PINWHEEL_STORE_URL, __FILE__, array(
'version' => PINWHEEL_SLIDER_VER, // current version number
'license' => $license_key, // license key (used get_option above to retrieve from DB)
'item_name' => PINWHEEL_ITEM_NAME, // name of this plugin
'author' => 'Tejaswini Deshpande' // author of this plugin
)
);
}
?>