_x('Slidesets','taxonomy general name'), 'singular_name' => _x('Slideset','taxonomy singular name'), 'search_items' => __('Search Slidesets'), 'popular_items' => __('Popular Slidesets'), 'all_items' => __('All Slidesets'), 'parent_item' => __('Parent Slideset'), 'parent_item_colon' => __('Parent Slideset:'), 'separate_items_with_commas' => __('Separate Slidesets with commas'), 'add_or_remove_items' => __('Add or remove tags'), 'choose_from_most_used' => __('Choose from the most used Slidesets'), 'not_found' => __('No Slidesets found'), 'separatewith_commas' => __('Separate Slidesets with commas'), 'edit_item' => __('Edit Slideset'), 'update_item' => __('Update Slideset'), 'add_new_item' => __('Add New Slideset'), 'new_item_name' => __('New Slideset Name'), 'menu_name' => __('Slidesets'), ); $args = array( 'hierarchical' => true, 'show_admin_column' => true, 'labels' => $labels, 'rewrite' => array('slug' => 'slideset'), ); register_taxonomy('slidesets','slides',$args); } add_action('init','aFregslidesets'); } /* C U S T O M P O S T T Y P E =============================== Register Slides post type */ if(!function_exists('aFslds_post_type')){ add_action('init','aFslds_post_type',0); function aFslds_post_type(){ $labels = array( 'name' => _x('Slides','post type general name'), 'singular_name' => _x('Slide','post type singular name'), 'add_new' => __('Add New'), 'add_new_item' => __('Add New'), 'edit_item' => __('Edit Slide'), 'new_item' => __('New Slide'), 'view_item' => __('View Slide'), 'all_items' => __('All Slides'), 'search_items' => __('Search Slides'), 'not_found' => __('No Slides found'), 'not_found_in_trash' => __('No Slides found in Trash'), 'menu_name' => 'Slides' ); $show_in_admin = ''; if(!current_user_can('edit_posts')){ $show_in_admin = false; } else{ $show_in_admin = true; } $supports = array('title','thumbnail','editor','revisions'); $args = array( 'menu_icon' => 'dashicons-images-alt2', 'labels' => $labels, 'public' => false, 'show_ui' => $show_in_admin, 'show_in_menu' => $show_in_admin, 'show_in_admin_bar' => $show_in_admin, 'query_var' => 'slides', 'rewrite' => array('slug'=>'slides'), 'has_archive' => false, 'hierarchical' => false, 'supports' => $supports, 'register_meta_box_cb' => 'aFSMetaBoxes', 'taxonomies' => array('slideset') ); register_post_type('slides',$args); } } /* F U N C T I O N S ================= */ if(!function_exists('aFAutoParam')){ function aFAutoParam($key,$value,$default=NULL){ if(empty($value)){ # If there is no value if($default){ # ...and there is a default $value = $default; # ...use the default } } if(!empty($value)){ # If there is a value and... if((is_string($value)) && (!is_numeric($value)) && ($value!="true") && ($value!="false") && (substr($value,0,1)!= "{")){ # $value is a string and is not a number and is not one of keywords "true" or "false" and is not in curly-brackets $quotes = '"'; } else{ # $value is not a string or is a number or is one of keywords "true" or "false" or is in curly-brackets $quotes = ''; } return $key.": ".$quotes.$value.$quotes.",\n "; # Output with/without quotes } } } if(!function_exists('aFget_posts')){ function aFget_posts($args = null){ $defaults = array( 'numberposts' => 5, 'offset' => 0, 'category' => 0, 'orderby' => 'date', 'order' => 'ASC', 'include' => array(), 'exclude' => array(), 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'suppress_filters' => true ); $r = wp_parse_args($args,$defaults); if(empty($r['post_status'])) $r['post_status'] =('attachment' == $r['post_type'])?'inherit':'publish'; if(!empty($r['numberposts']) && empty($r['posts_per_page'])) $r['posts_per_page'] = $r['numberposts']; if(!empty($r['category'])) $r['cat'] = $r['category']; if(!empty($r['include'])){ $incposts = wp_parse_id_list($r['include']); $r['posts_per_page'] = count($incposts); // only the number of posts included $r['post__in'] = $incposts; }elseif(!empty($r['exclude'])) $r['post__not_in'] = wp_parse_id_list($r['exclude']); $r['ignore_sticky_posts'] = true; $r['no_found_rows'] = true; $aFget_posts = new WP_Query; return $aFget_posts->query($r); } } /* J S & C S S in H E A D ============================== Conditional Styles & Scripts */ $aFSInit = ""; function aFSJSCSS(){ global $post; $aFSOptions = get_option('aFSOpts'); $aFSVals = get_post_custom($post->ID); $aFSDefaultCSS = isset($aFSOptions['aFSDefaultCSS']) ? $aFSOptions['aFSDefaultCSS'][0] : ''; $aFSJSCSSOff = isset($aFSOptions['aFSJSCSSOff']) ? $aFSOptions['aFSJSCSSOff'][0] : ''; $aFSJSCSSOn = isset($aFSVals['aFSJSCSSOn']) ? $aFSVals['aFSJSCSSOn'][0] : ''; wp_register_script('aFSlidesJS',plugins_url('js/addfunc-slides.js?v=2-6',__FILE__)); wp_register_style('aFSlidesCSS',plugins_url('css/addfunc-slides.css',__FILE__)); if(!$aFSJSCSSOff || $aFSJSCSSOn){ if(!$aFSDefaultCSS){ wp_enqueue_style('aFSlidesCSS'); } wp_enqueue_script('aFSlidesJS'); } } add_action('wp_enqueue_scripts','aFSJSCSS'); /* S H O R T C O D E ================= */ function aFSSc($atts){ $aFSMrgd = shortcode_atts(array( 'slideset' => '', 'auto' => '', 'speed' => '', 'prevnext' => '', 'pause' => '', 'tabs' => '', 'tabsfirst' => '', 'stoppable' => '', 'pauseonhover' => '', 'fullscreen' => '', 'swipe' => '', 'class' => '', 'color' => '', 'size' => '', 'height' => '', 'ratio' => '', 'tabsclass' => '', 'order' => 'ASC', 'orderby' => '', 'meta_key' => '', ),$atts,'slides'); extract($aFSMrgd); $aFSOptions = get_option('aFSOpts'); if(!$color){ if(!empty($aFSOptions['aFSDefaultColor'])){ $color = $aFSOptions['aFSDefaultColor']; } } if(empty($size)){ if(!empty($aFSOptions['aFSDefaultSize'])){ $size = $aFSOptions['aFSDefaultSize']; } } $aFSInst = 'aFS'.uniqid(); // http://stackoverflow.com/questions/22873093/generate-different-code-in-wp-footer-for-each-shortcode-instance if(!$orderby){ $orderby = 'meta_value_num'; $meta_key = 'aFSPrior'; } if(($slideset === 'all')||empty($slideset)){ $slideset = ''; $slidesetID = 'all-slides'; } else { $slidesetID = $slideset; } if ((strpos($ratio,':') == true)||(strpos($ratio,'-') == true)||(strpos($ratio,'x') == true)) { preg_match('/\d+/', $ratio, $fstnum); $fst = $fstnum[0]; preg_match('/(\d+)\D*$/', $ratio, $sndnum); $snd = end($sndnum); $prc = ($snd/$fst) * 100; $ratio = $prc."%"; } else { if(($ratio == 'HD')) { $ratio = "56.25%"; } elseif ($ratio == 'half') { $ratio = "50%"; } elseif ($ratio == 'old') { $ratio = "74%"; } elseif ($ratio == 'standard') { $ratio = "75%"; } elseif ($ratio == 'square') { $ratio = "100%"; } elseif ($ratio == 'portrait') { $ratio = "150%"; } } $args = array( 'slidesets' => $slideset, 'post_type' => 'slides', 'order' => $order, 'orderby' => $orderby, 'meta_key' => $meta_key, 'posts_per_page' => -1 ); $aFSPosts = aFget_posts($args); global $post,$aFSInit,$aFDependsOn; $tmp_post = $post; ob_start(); $outputThumbs = ""; $outputLabels = ""; if($tabs && (($tabs != 'labels') && ($tabs != 'true'))){ $outputThumbs = true; } /* Output the thumbnail */ if($tabs && (($tabs != 'thumbnails') && ($tabs != 'true'))){ $outputLabels = true; } /* Output the label */ ?>
>
    ">
  1. ID,'thumbnail',array('alt' => $aFSPost->post_title.' thumbnail')); } /* Output the thumbnail */ ?>
    post_title; ?>
> ID,'aFSldTyp',true); $aFSGetMnImg = get_post_meta($aFSPost->ID,'aFSMnImg',true); $aFSGetMnAlt = get_post_meta($aFSPost->ID,'aFSMnAlt',true); $aFSGetMnLnk = get_post_meta($aFSPost->ID,'aFSMnLnk',true); $aFSGetMTarg = get_post_meta($aFSPost->ID,'aFSMTarg',true)? ' target="_blank"' : ''; $aFSGetBgImg = get_post_meta($aFSPost->ID,'aFSBgImg',true); $aFSGetClass = get_post_meta($aFSPost->ID,'aFSClass',true); ?>
>
> > <?php echo $aFSGetMnAlt; ?>
ID)){ echo ' Edit';} ?>
    ">
  1. ID,'thumbnail',array('alt' => $aFSPost->post_title.' thumbnail')); } ?>
    post_title; ?>
__('Display your Slides in an AddFunc slideshow.','text_domain'),)// Args ); if(!self::$did_script && is_active_widget(false,false,$this->id_base,true)){ add_action('wp_enqueue_scripts','aFSJSCSS'); wp_enqueue_style('aFSlidesCSS'); wp_enqueue_script('aFSlidesJS'); self::$did_script = true; } } public function widget($args,$instance) { $aFSOptions = get_option('aFSOpts'); $slideset = isset($instance['slideset']) ? $instance['slideset'] : ''; $auto = isset($instance['auto']) ? $instance['auto'] : ''; $speed = isset($instance['speed']) ? $instance['speed'] : ''; $prevnext = isset($instance['prevnext']) ? $instance['prevnext'] : ''; $pause = isset($instance['pause']) ? $instance['pause'] : ''; $pagination = isset($instance['pagination']) ? $instance['pagination'] : ''; $tabs = isset($instance['tabs']) ? $instance['tabs'] : ''; $tabsfirst = isset($instance['tabsfirst']) ? $instance['tabsfirst'] : ''; $stoppable = isset($instance['stoppable']) ? $instance['stoppable'] : ''; $pauseonhover = isset($instance['pauseonhover']) ? $instance['pauseonhover'] : ''; $fullscreen = isset($instance['fullscreen']) ? $instance['fullscreen'] : ''; $swipe = isset($instance['swipe']) ? $instance['swipe'] : ''; $class = isset($instance['class']) ? $instance['class'] : ''; $color = isset($instance['color']) ? $instance['color'] : ''; $size = isset($instance['size']) ? $instance['size'] : ''; $height = isset($instance['height']) ? $instance['height'] : ''; $ratio = isset($instance['ratio']) ? $instance['ratio'] : ''; $tabsclass = isset($instance['tabsclass']) ? $instance['tabsclass'] : ''; $order = isset($instance['order']) ? $instance['order'] : ''; $orderby = isset($instance['orderby']) ? $instance['orderby'] : ''; $meta_key = isset($instance['meta_key']) ? $instance['meta_key'] : ''; if(!$color){ if(!empty($aFSOptions['aFSDefaultColor'])){ $color = $aFSOptions['aFSDefaultColor']; } } if(empty($size)){ if(!empty($aFSOptions['aFSDefaultSize'])){ $size = $aFSOptions['aFSDefaultSize']; } } $aFSInst = 'aFS'.uniqid(); $title = apply_filters('widget_title',$instance['title']); echo $args['before_widget']; $termid = get_term($slideset,'slidesets'); $slideset = $termid->slug; if(!$orderby){ $orderby = 'meta_value_num'; $meta_key = 'aFSPrior'; } $order = empty($order)? 'ASC' : 'DESC'; if($pagination){ $tabs = true; } if(empty($swipe)){ $swipe = "horizontal"; } if ((strpos($ratio,':') == true)||(strpos($ratio,'x') == true)) { $fstnum = array(); preg_match('/\d+/', $ratio, $fstnum); $fst = $fstnum[0]; $sndnum = array(); preg_match('/(\d+)\D*$/', $ratio, $sndnum); $snd = end($sndnum); $prc = ($snd/$fst) * 100; $ratio = $prc."%"; } else { if(($ratio == 'HD')) { $ratio = "56.25%"; } elseif ($ratio == 'half') { $ratio = "50%"; } elseif ($ratio == 'old') { $ratio = "74%"; } elseif ($ratio == 'standard') { $ratio = "75%"; } elseif ($ratio == 'square') { $ratio = "100%"; } elseif ($ratio == 'portrait') { $ratio = "150%"; } } $aFSArgs = array( 'slidesets' => $slideset, 'post_type' => 'slides', 'order' => $order, 'orderby' => $orderby, 'meta_key' => $meta_key, 'posts_per_page' => -1 ); $outputThumbs = ""; $outputLabels = ""; if(($pagination==="T")||($pagination==="LT")){ $outputThumbs = true; } /* Output the thumbnail */ if(($pagination==="L")||($pagination==="LT")){ $outputLabels = true; } /* Output the label */ if(($slideset === 'all')||empty($slideset)){ $slideset = ''; $slidesetID = 'all-slides'; } else { $slidesetID = $slideset; } $aFSPosts = aFget_posts($aFSArgs); ?>
" >
    ">
  1. ID,'thumbnail',array('alt' => $aFSPost->post_title.' thumbnail')); } ?>
    post_title; ?>
> ID,'aFSldTyp',true); $aFSGetMnImg = get_post_meta($aFSPost->ID,'aFSMnImg',true); $aFSGetMnAlt = get_post_meta($aFSPost->ID,'aFSMnAlt',true); $aFSGetMnLnk = get_post_meta($aFSPost->ID,'aFSMnLnk',true); $aFSGetMTarg = get_post_meta($aFSPost->ID,'aFSMTarg',true)? ' target="_blank"' : ''; $aFSGetBgImg = get_post_meta($aFSPost->ID,'aFSBgImg',true); $aFSGetClass = get_post_meta($aFSPost->ID,'aFSClass',true); ?>
>
> > <?php echo $aFSGetMnAlt; ?>
ID)){ echo ' Edit';} ?>
    ">
  1. ID,'thumbnail',array('alt' => $aFSPost->post_title.' thumbnail')); } ?>
    post_title; ?>
get_field_id('title') ? $this->get_field_id('title') : ''; $sldstGfid = $this->get_field_id('slideset') ? $this->get_field_id('slideset') : ''; $autoGfid = $this->get_field_id('auto') ? $this->get_field_id('auto') : ''; $speedGfid = $this->get_field_id('speed') ? $this->get_field_id('speed') : ''; $paginationGfid = $this->get_field_id('pagenation') ? $this->get_field_id('pagenation') : $this->get_field_id('pagination') ? $this->get_field_id('pagination') : ''; $tabsfirstGfid = $this->get_field_id('tabsFirst') ? $this->get_field_id('tabsFirst') : $this->get_field_id('tabsfirst') ? $this->get_field_id('tabsfirst') : ''; $prevnextGfid = $this->get_field_id('prevNext') ? $this->get_field_id('prevNext') : $this->get_field_id('prevnext') ? $this->get_field_id('prevnext') : ''; $pauseGfid = $this->get_field_id('pause') ? $this->get_field_id('pause') : ''; $stoppableGfid = $this->get_field_id('stoppable') ? $this->get_field_id('stoppable') : ''; $pauseonhoverGfid = $this->get_field_id('pauseOnHover') ? $this->get_field_id('pauseOnHover') : $this->get_field_id('pauseonhover') ? $this->get_field_id('pauseonhover') : ''; $fullscreenGfid = $this->get_field_id('fullScreen') ? $this->get_field_id('fullScreen') : $this->get_field_id('fullscreen') ? $this->get_field_id('fullscreen') : ''; $swipeGfid = $this->get_field_id('swipe') ? $this->get_field_id('swipe') : ''; $classGfid = $this->get_field_id('class') ? $this->get_field_id('class') : ''; $colorGfid = $this->get_field_id('color') ? $this->get_field_id('color') : ''; $sizeGfid = $this->get_field_id('size') ? $this->get_field_id('size') : ''; $heightGfid = $this->get_field_id('height') ? $this->get_field_id('height') : ''; $ratioGfid = $this->get_field_id('ratio') ? $this->get_field_id('ratio') : ''; $tabsclassGfid = $this->get_field_id('tabsclass') ? $this->get_field_id('tabsclass') : ''; $orderGfid = $this->get_field_id('order') ? $this->get_field_id('order') : ''; $orderbyGfid = $this->get_field_id('orderby') ? $this->get_field_id('orderby') : ''; $titleGfname = $this->get_field_name('title') ? $this->get_field_name('title') : ''; $sldstGfname = $this->get_field_name('slideset') ? $this->get_field_name('slideset') : ''; $autoGfname = $this->get_field_name('auto') ? $this->get_field_name('auto') : ''; $speedGfname = $this->get_field_name('speed') ? $this->get_field_name('speed') : ''; $paginationGfname = $this->get_field_name('pagenation') ? $this->get_field_name('pagenation') : $this->get_field_name('pagination') ? $this->get_field_name('pagination') : ''; $tabsfirstGfname = $this->get_field_name('tabsFirst') ? $this->get_field_name('tabsFirst') : $this->get_field_name('tabsfirst') ? $this->get_field_name('tabsfirst') : ''; $prevnextGfname = $this->get_field_name('prevNext') ? $this->get_field_name('prevNext') : $this->get_field_name('prevnext') ? $this->get_field_name('prevnext') : ''; $pauseGfname = $this->get_field_name('pause') ? $this->get_field_name('pause') : ''; $stoppableGfname = $this->get_field_name('stoppable') ? $this->get_field_name('stoppable') : ''; $pauseonhoverGfname = $this->get_field_name('pauseOnHover') ? $this->get_field_name('pauseOnHover') : $this->get_field_name('pauseonhover') ? $this->get_field_name('pauseonhover') : ''; $fullscreenGfname = $this->get_field_name('fullScreen') ? $this->get_field_name('fullScreen') : $this->get_field_name('fullscreen') ? $this->get_field_name('fullscreen') : ''; $swipeGfname = $this->get_field_name('swipe') ? $this->get_field_name('swipe') : ''; $classGfname = $this->get_field_name('class') ? $this->get_field_name('class') : ''; $colorGfname = $this->get_field_name('color') ? $this->get_field_name('color') : ''; $sizeGfname = $this->get_field_name('size') ? $this->get_field_name('size') : ''; $heightGfname = $this->get_field_name('height') ? $this->get_field_name('height') : ''; $ratioGfname = $this->get_field_name('ratio') ? $this->get_field_name('ratio') : ''; $tabsclassGfname = $this->get_field_name('tabsclass') ? $this->get_field_name('tabsclass') : ''; $orderGfname = $this->get_field_name('order') ? $this->get_field_name('order') : ''; $orderbyGfname = $this->get_field_name('orderby') ? $this->get_field_name('orderby') : ''; ?>

/>
1000 = 1 sec.
/>
/>
/>
/>
/>
/>
/>

"; echo $aFSInit."\n"; echo "\n"; } } add_action('wp_footer','aFSInit'); /* A D M I N I N C L U D E S =========================== */ add_action('admin_menu','aFSAddAdminMenu'); add_action('admin_init','aFSSettingsInit'); function aFSAddAdminMenu(){ add_submenu_page('edit.php?post_type=slides','Slides Settings','Settings','manage_options','slides','aFSOptionsPage'); } function aFSSettingsInit(){ register_setting('aFSOptsPg','aFSOpts'); add_settings_section( 'aFSOptsPgSection', __('','aFS'), 'aFSSettingsSection', 'aFSOptsPg' ); add_settings_field( 'aFSDefaultCSS', __('Don\'t load default stylesheet','aFS'), 'aFSDefaultCSSOpt', 'aFSOptsPg', 'aFSOptsPgSection' ); add_settings_field( 'aFSJSCSSOff', __('Don\'t load JS/CSS on every page','aFS'), 'aFSJSCSSOffOpt', 'aFSOptsPg', 'aFSOptsPgSection' ); add_settings_field( 'aFSDefaultColor', __('Default color of controls','aFS'), 'aFSDefaultColorOpt', 'aFSOptsPg', 'aFSOptsPgSection' ); add_settings_field( 'aFSDefaultSize', __('Default size of controls','aFS'), 'aFSDefaultSizeOpt', 'aFSOptsPg', 'aFSOptsPgSection' ); } function aFSMBInc(){ require_once(plugin_dir_path( __FILE__ ).'metaboxes.php'); } add_action('add_meta_boxes','aFSMBInc'); function aFSAdminInc(){ require_once(plugin_dir_path( __FILE__ ).'settings.php'); require_once(plugin_dir_path( __FILE__ ).'edit-page.php'); require_once(plugin_dir_path( __FILE__ ).'mce-buttons.php'); require_once(plugin_dir_path( __FILE__ ).'help-tab.php'); } add_action('admin_init','aFSAdminInc');