Guest User

functions.php

a guest
Oct 24th, 2012
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 21.17 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  * basic functions
  5.  * lambda framework v 2.1
  6.  * by www.unitedthemes.com
  7.  * since framework v 1.0
  8.  * based on Skeleton theme
  9.  */
  10.  
  11. define('UT_THEME_INITIAL', 'nevada_'); // DO NOT CHANGE THIS VALUE!
  12.  
  13. #-----------------------------------------------------------------
  14. # default theme constants & repeating variables - do not change!
  15. #-----------------------------------------------------------------
  16. define('UT_THEME_NAME', 'Nevada');
  17. define('UT_THEME_VERSION', '1.3');
  18. define('UT_LAMBDA_VERSION', get_option('lambda_version'));
  19. define('FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/lambda/' );
  20. define('UT_PORTFOLIO_SLUG', 'portfolio'); //This Constant is changeable
  21.  
  22. #-----------------------------------------------------------------
  23. # Theme Activation Hook
  24. #-----------------------------------------------------------------
  25. require_once ( get_template_directory()  . '/functions/theme-activation-hook.php' );
  26.  
  27. $theme_path = get_template_directory_uri();
  28. $theme_options = get_option('option_tree');
  29. $content_width = '940';
  30.  
  31. #-----------------------------------------------------------------
  32. # Check IE
  33. #-----------------------------------------------------------------
  34. $browser = (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) ? true : false;
  35.  
  36. #-----------------------------------------------------------------
  37. # Meta Box Management
  38. #-----------------------------------------------------------------
  39. require_once ( get_template_directory()  . '/lambda/lambda.meta.box.php' );
  40. require_once ( get_template_directory()  . '/lambda/lambda.media.access.php' );
  41. require_once ( get_template_directory()  . '/lambda/lambda.taxonomy.class.php' );
  42. require_once ( get_template_directory()  . '/lambda/lambda.callmetaboxes.php' );
  43.  
  44.  
  45. #-----------------------------------------------------------------
  46. # Meta Box Access
  47. #-----------------------------------------------------------------
  48. $wpalchemy_media_access = NEW WPAlchemy_MediaAccess();
  49.  
  50. #-----------------------------------------------------------------
  51. # Check if Option Tree / Moover Plugin has been already installed,
  52. # if not use our Theme Option Panel
  53. #-----------------------------------------------------------------
  54. if ( !function_exists( 'lambda_is_plugin_active' ) ) {
  55.     function lambda_is_plugin_active( $plugin ) {
  56.         return in_array( $plugin, (array) get_option( 'active_plugins', array() ) );
  57.     }
  58.    
  59.     if(!lambda_is_plugin_active('option-tree/index.php')) {
  60.         require_once ( get_template_directory()  . '/lambda/index.php' );
  61.     }
  62.    
  63.     if(!lambda_is_plugin_active('soundcloud-shortcode/soundcloud-shortcode.php')) {
  64.         require_once ( get_template_directory()  . '/functions/soundcloud.php' );
  65.     }
  66.    
  67.     if(!lambda_is_plugin_active('revslider/revslider.php')) {
  68.         require_once ( get_template_directory()  . '/revslider/revslider.php' );
  69.     }
  70.     if(lambda_is_plugin_active('qtranslate/qtranslate.php')) {
  71.         require_once ( get_template_directory()  . '/functions/lambda.qtranslate.php' );
  72.     }
  73.     if(!lambda_is_plugin_active('qtranslate/qtranslate.php')) {
  74.         require_once ( get_template_directory()  . '/functions/lambda.parsecontent.php' );
  75.     }
  76. }
  77. #-----------------------------------------------------------------
  78. # Admin Stuff
  79. #-----------------------------------------------------------------
  80. if( is_admin() ) {
  81.     require_once ( 'lambda/lambda.admin.functions.php' );
  82. }
  83. require_once ( 'lambda/tinymce/lambda.tinymce.class.php' );
  84.  
  85.  
  86. #-----------------------------------------------------------------
  87. # Needed Functions for Front and Backend
  88. #-----------------------------------------------------------------
  89. require_once ( get_template_directory()  . '/functions/theme-portfolio-init.php' );
  90. require_once ( get_template_directory()  . '/functions/aquaresizer.php' );
  91. require_once ( get_template_directory()  . '/functions/theme-walker.php' );
  92. require_once ( get_template_directory()  . '/functions/theme-functions.php' );
  93. require_once ( get_template_directory()  . '/functions/theme-shortcodes.php' );
  94. require_once ( get_template_directory()  . '/functions/theme-post-formats.php' );
  95. require_once ( get_template_directory()  . '/functions/theme-slider-shortcodes.php' );
  96. require_once ( get_template_directory()  . '/functions/pagecreator-functions.php' );
  97. require_once ( get_template_directory()  . '/lambda/lambda.register.widgets.php' );
  98. require_once ( get_template_directory()  . '/lambda/slidermanager/index.php' );
  99.  
  100. #-----------------------------------------------------------------
  101. # Layout & Form and Misc Functions
  102. #-----------------------------------------------------------------
  103. require_once ( get_template_directory()  . '/functions/theme-layout-functions.php' );
  104. require_once ( get_template_directory()  . '/functions/theme-form-functions.php' );
  105. require_once ( get_template_directory()  . '/functions/theme-java-functions.php' );
  106.  
  107.  
  108. #-----------------------------------------------------------------
  109. # Register Core Stylesheets and set loading Filters
  110. #-----------------------------------------------------------------
  111. if ( !function_exists( 'lambda_registerstyles' ) ) {
  112.  
  113. add_action('get_header', 'lambda_registerstyles');
  114.  
  115. function lambda_registerstyles() {
  116.    
  117.     $custom_font = get_option('option_tree');
  118.        
  119.     global $lambda_meta_data, $theme_options;
  120.     $portfoliometa = $lambda_meta_data->the_meta();
  121.     $color_scheme = (isset($_GET['color_scheme'])) ? '?color_scheme='.$_GET['color_scheme'] : '';
  122.  
  123.    
  124.    
  125.     $stylesheets = wp_enqueue_style('theme', get_stylesheet_directory_uri().'/style.css', UT_THEME_NAME, UT_THEME_VERSION, 'screen, projection');
  126.     $stylesheets .= wp_enqueue_style('layout', get_template_directory_uri().'/layout.css', 'theme', UT_THEME_VERSION, 'screen, projection');
  127.    
  128.     if(isset($theme_options['responsive']) && $theme_options['responsive'] == 'on') {
  129.         $stylesheets .= wp_enqueue_style('responsive', get_template_directory_uri().'/responsive.css', 'theme', UT_THEME_VERSION, 'screen, projection');
  130.     }
  131.    
  132.     $stylesheets .= wp_enqueue_style('style', get_template_directory_uri().'/style.php'.$color_scheme, false, UT_THEME_VERSION, 'screen, projection');
  133.    
  134.     $themecolor = $theme_options['color_scheme'];
  135.     $themecolor = ereg_replace("#", "", $themecolor);
  136.    
  137.     //only for demo
  138.     $themecolor = (isset($_GET['color_scheme'])) ? $_GET['color_scheme'] : $themecolor;
  139.    
  140.     $themefiles = recognized_color_themefiles();
  141.     $themefile = ( isset($themefiles[$themecolor]) ) ? $themefiles[$themecolor] : 'custom.css.php';
  142.     $stylesheets .= wp_enqueue_style('color', get_template_directory_uri().'/css/colors/'.$themefile, false, UT_THEME_VERSION, 'screen, projection');  
  143.    
  144.     $stylesheets .= wp_enqueue_style('formalize', get_template_directory_uri().'/formalize.css', 'theme', UT_THEME_VERSION, 'screen, projection');
  145.     $stylesheets .= wp_enqueue_style('superfish', get_template_directory_uri().'/superfish.css', 'theme', UT_THEME_VERSION, 'screen, projection');
  146.     $stylesheets .= wp_enqueue_style('prettyphoto', get_template_directory_uri().'/css/prettyPhoto.css', 'theme', UT_THEME_VERSION, 'screen, projection');
  147.     $stylesheets .= wp_enqueue_style('nonverblaster', get_template_directory_uri().'/css/nonverblaster.css', 'theme', UT_THEME_VERSION, 'screen, projection');
  148.    
  149.     #-----------------------------------------------------------------
  150.     # Exceptions to reduce scriptloading
  151.     #-----------------------------------------------------------------
  152.     if(isset($theme_options['headline_font_face_type']) && $theme_options['headline_font_face_type'] == 'headline_font_face_google') { 
  153.     $stylesheets .= wp_enqueue_style('google_font', 'http://fonts.googleapis.com/css?family='.$custom_font['headline_font_face_google']['font-family'], 'theme', UT_THEME_VERSION); }
  154.    
  155.     $imageportfolio = (isset($portfoliometa['portfolio_type'])) ? $portfoliometa['portfolio_type'] : '';
  156.    
  157.     $stylesheets .= wp_enqueue_style('flexslider', get_template_directory_uri().'/css/flexslider.css', 'theme', '1.0');
  158.                        
  159.    
  160.     echo apply_filters ('lambda_stylesheets',$stylesheets);
  161. }
  162.  
  163. }
  164.  
  165. #-----------------------------------------------------------------
  166. # Header Core Scripts
  167. #-----------------------------------------------------------------
  168. if ( !function_exists( 'lambda_header_scripts' ) ) {
  169.  
  170.     add_action('init', 'lambda_header_scripts');
  171.     function lambda_header_scripts() {
  172.                
  173.             if(!is_admin()) {
  174.        
  175.                 $javascripts  = wp_enqueue_script('jquery');
  176.  
  177.                 //core scripts
  178.                 $javascripts .= wp_enqueue_script('superfish',get_template_directory_uri() ."/javascripts/superfish.js",array('jquery'),'1.2.3',true);
  179.                 $javascripts .= wp_enqueue_script('carousellite',get_template_directory_uri() ."/javascripts/jquery.jcarousellite.js",array('jquery'),'1.3',true);
  180.                 $javascripts .= wp_enqueue_script('lambdalike',get_template_directory_uri() ."/javascripts/like.js.php",array('jquery'),'1.3',true);
  181.                 $javascripts .= wp_enqueue_script('prettyphoto',get_template_directory_uri() ."/javascripts/jquery.prettyPhoto.js",array('jquery'),'1.3',true);
  182.                 $javascripts .= wp_enqueue_script('fitvid',get_template_directory_uri() ."/javascripts/jquery.fitvids.js",array('jquery'),'1.3',true);
  183.  
  184.                 //only for portfolio
  185.                 $javascripts .= wp_enqueue_script('isotope',get_template_directory_uri() ."/javascripts/jquery.isotope.min.js",array('jquery'),'1.5.09',true);  
  186.                 $javascripts .= wp_enqueue_script('formalize',get_template_directory_uri() ."/javascripts/jquery.formalize.min.js",array('jquery'),'1.2.3',true);
  187.        
  188.                 //only when player is available
  189.                 $javascripts .= wp_enqueue_script('nonverbla',get_template_directory_uri() ."/javascripts/nonverblaster.js",array('jquery'),'1.0',true);
  190.                 $javascripts .= wp_enqueue_script('swfobject');
  191.                                
  192.                 //custom javascript
  193.                 $javascripts .= wp_enqueue_script('dynamicjs',get_template_directory_uri() ."/javascripts/dynamic.js.php",array('jquery'),'1.0',true);
  194.                 $javascripts .= wp_enqueue_script('custom',get_template_directory_uri() ."/javascripts/app.js",array('jquery'),'1.2.3', true);
  195.                
  196.                 echo apply_filters('lambda_javascripts', $javascripts);
  197.             }
  198.            
  199.            
  200.            
  201.     }
  202.  
  203. }
  204.  
  205. #-----------------------------------------------------------------
  206. # Script Exceptions to save Script loading
  207. #-----------------------------------------------------------------
  208. if ( !function_exists( 'script_exceptions' ) ) {
  209.     add_action('get_header', 'script_exceptions');
  210.     function script_exceptions() {
  211.      
  212.         //receive Globals
  213.         global $lambda_meta_data;
  214.         $portfoliometa = $lambda_meta_data->the_meta();
  215.                
  216.         $script_exceptions = '';  
  217.          
  218.          //Flexslider Gallery
  219.         $script_exceptions .= wp_enqueue_script('flexslider',get_template_directory_uri() ."/javascripts/jquery.flexslider.min.js",array('jquery'),'1.8',true);
  220.            
  221.        
  222.         //special scripts for widgets
  223.         if(is_active_widget( false, false, 'lw_twitter', true )) {
  224.         $script_exceptions  .= wp_enqueue_script('twitter',get_template_directory_uri() ."/javascripts/jquery.tweet.js",array('jquery'),'1.0',true); }
  225.                    
  226.        
  227.         // Form enhancement
  228.         if(is_page_template('dynamic-contact-form.php')) {
  229.         $script_exceptions  .= wp_enqueue_script( 'validateform', get_template_directory_uri() .'/javascripts/jquery.validate.min.js', array('jquery'), '1.9'); }          
  230.          
  231.        
  232.         echo apply_filters ('child_add_portfolioscripts',$script_exceptions);
  233.     }
  234. }
  235.  
  236. #-----------------------------------------------------------------
  237. # Load Lambda Setup
  238. #-----------------------------------------------------------------
  239. add_action( 'after_setup_theme', 'lambda_setup' );
  240.  
  241. if ( ! function_exists( 'lambda_setup' ) ):
  242.  
  243. function lambda_setup() {
  244.    
  245.     #-----------------------------------------------------------------
  246.     # Post Formats
  247.     #-----------------------------------------------------------------
  248.     $pformats = array(
  249.                 'audio',
  250.                 'gallery',
  251.                 'link',
  252.                 'quote',
  253.                 'video');
  254.    
  255.     add_theme_support( 'post-formats', $pformats );
  256.        
  257.     #-----------------------------------------------------------------
  258.     # Activate Post Thumbnails & Set Image Sizes
  259.     #-----------------------------------------------------------------
  260.     add_theme_support( 'post-thumbnails' );
  261.     add_image_size( '1col-image', '940', '', true);
  262.     add_image_size( '2col-image', '460', '230', true);
  263.     add_image_size( '3col-image', '420', '210', true);
  264.     add_image_size( '4col-image', '420', '240', true); 
  265.  
  266.     #-----------------------------------------------------------------
  267.     # Design Variables
  268.     #-----------------------------------------------------------------
  269.     $image_frame = array( 'class'   =>  "frame");
  270.    
  271.     // Add default posts and comments RSS feed links to head
  272.     add_theme_support( 'automatic-feed-links' );
  273.    
  274.  
  275.     #-----------------------------------------------------------------
  276.     # Make theme available for translation
  277.     #-----------------------------------------------------------------
  278.     load_theme_textdomain( UT_THEME_NAME, get_template_directory()  . '/languages' );
  279.  
  280.     $locale = get_locale();
  281.     $locale_file = get_template_directory()  . "/languages/$locale.php";
  282.     if ( is_readable( $locale_file ) )
  283.         require_once( $locale_file );
  284.  
  285.  
  286.         // No support for text inside the header image.
  287.         if ( ! defined( 'NO_HEADER_TEXT' ) )
  288.             define( 'NO_HEADER_TEXT', true );
  289.            
  290.         if ( ! defined( 'HEADER_IMAGE_WIDTH') )
  291.             define( 'HEADER_IMAGE_WIDTH', apply_filters( 'lambda_header_image_width',960));
  292.            
  293.            
  294.         if ( ! defined( 'HEADER_IMAGE_HEIGHT') )
  295.             define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'lambda_header_image_height',185 ));
  296.  
  297.  
  298.     }
  299.     endif;
  300.  
  301. #-----------------------------------------------------------------
  302. # Register widgetized areas, including two sidebars and four widget-ready
  303. # columns in the footer and all created Sidebars in Admin Panel
  304. #-----------------------------------------------------------------
  305. if ( !function_exists( 'st_widgets_init' ) ) {
  306.  
  307. function st_widgets_init() {
  308.    
  309.     // The Default Sidebar
  310.     register_sidebar( array(
  311.         'name' => __( 'Default Sidebar', UT_THEME_NAME ),
  312.         'id' => UT_THEME_INITIAL.'sidebar_default',
  313.         'description' => __( 'The Default Sidebar', UT_THEME_NAME ),
  314.         'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  315.         'after_widget' => '</li>',
  316.         'before_title' => '<h3 class="widget-title"><span>',
  317.         'after_title' => '</span></h3>',
  318.     ) );
  319.        
  320.    
  321.     // Register Custom Sidebars
  322.     if (function_exists( 'get_option_tree') ) {
  323.         $sidebars = get_option_tree( 'sidebars', '', false, true, -1 );
  324.             if( !empty( $sidebars ) && is_array( $sidebars ) ){
  325.             $i=1;
  326.             foreach( $sidebars as $num => $sidebar_options ){
  327.                 register_sidebar(array(
  328.                     'name'              => $sidebar_options['title'],
  329.                     'id'                => UT_THEME_INITIAL.'sidebar_'.$num,
  330.                     'description'       => $sidebar_options['sidebardesc'],
  331.                     'before_widget'     => '<li id="%1$s" class="widget-container %2$s">',
  332.                     'after_widget'      => '</li>',
  333.                     'before_title'      => '<h3 class="widget-title"><span>',
  334.                     'after_title'       => '</span></h3>',
  335.                  ));
  336.                  $i++;
  337.             }  
  338.         }  
  339.     }
  340.     // Area 3, located in the footer. Empty by default.
  341.     register_sidebar( array(
  342.         'name' => __( 'First Footer Widget Area', UT_THEME_NAME ),
  343.         'id' => 'first-footer-widget-area',
  344.         'description' => __( 'The first footer widget area', UT_THEME_NAME ),
  345.         'before_widget' => '<div class="%1$s %2$s">',
  346.         'after_widget' => '</div>',
  347.         'before_title' => '<h3 class="widget-title"><span>',
  348.         'after_title' => '</span></h3>',
  349.     ) );
  350.  
  351.     // Area 4, located in the footer. Empty by default.
  352.     register_sidebar( array(
  353.         'name' => __( 'Second Footer Widget Area', UT_THEME_NAME ),
  354.         'id' => 'second-footer-widget-area',
  355.         'description' => __( 'The second footer widget area', UT_THEME_NAME ),
  356.         'before_widget' => '<div class="%1$s %2$s">',
  357.         'after_widget' => '</div>',
  358.         'before_title' => '<h3 class="widget-title"><span>',
  359.         'after_title' => '</span></h3>',
  360.     ) );
  361.  
  362.     // Area 5, located in the footer. Empty by default.
  363.     register_sidebar( array(
  364.         'name' => __( 'Third Footer Widget Area', UT_THEME_NAME ),
  365.         'id' => 'third-footer-widget-area',
  366.         'description' => __( 'The third footer widget area', UT_THEME_NAME ),
  367.         'before_widget' => '<div class="%1$s %2$s">',
  368.         'after_widget' => '</div>',
  369.         'before_title' => '<h3 class="widget-title"><span>',
  370.         'after_title' => '</span></h3>',
  371.     ) );
  372.  
  373.     // Area 6, located in the footer. Empty by default.
  374.     register_sidebar( array(
  375.         'name' => __( 'Fourth Footer Widget Area', UT_THEME_NAME ),
  376.         'id' => 'fourth-footer-widget-area',
  377.         'description' => __( 'The fourth footer widget area', UT_THEME_NAME ),
  378.         'before_widget' => '<div class="%1$s %2$s">',
  379.         'after_widget' => '</div>',
  380.         'before_title' => '<h3 class="widget-title"><span>',
  381.         'after_title' => '</span></h3>',
  382.     ) );
  383.    
  384.     // Area 7, located in the Header. Empty by default.
  385.     register_sidebar( array(
  386.         'name' => __( 'Header Widget Area', UT_THEME_NAME ),
  387.         'id' => 'header-widget-area',
  388.         'description' => __( 'The header widget area. Only for Lambda Social Media Widget', UT_THEME_NAME ),
  389.         'before_widget' => '<div class="%1$s %2$s">',
  390.         'after_widget' => '</div>',
  391.         'before_title' => '<h3 class="widget-title"><span>',
  392.         'after_title' => '</span></h3>',
  393.     ) );
  394.        
  395. }
  396. /** Register sidebars by running lambda_widgets_init() on the widgets_init hook. */
  397. add_action( 'widgets_init', 'st_widgets_init' );
  398.  
  399. }
  400.  
  401.  
  402. if ( ! function_exists( 'lambda_posted_on' ) ) :
  403. #-----------------------------------------------------------------
  404. # Prints HTML with meta information for the current post-date/time and author.
  405. #-----------------------------------------------------------------
  406. function lambda_posted_on() {
  407.     return sprintf( __( '%2$s', UT_THEME_NAME ),
  408.         'meta-prep meta-prep-author',
  409.         sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
  410.             get_permalink(),
  411.             esc_attr( get_the_time() ),
  412.             get_the_date()
  413.         ),
  414.         sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
  415.             get_author_posts_url( get_the_author_meta( 'ID' ) ),
  416.             sprintf( esc_attr__( 'View all posts by %s', UT_THEME_NAME ), get_the_author() ),
  417.             get_the_author()
  418.         )
  419.     );
  420. }
  421.  
  422. endif;
  423.  
  424. if ( ! function_exists( 'lambda_posted_in' ) ) :
  425. /**
  426.  * Prints HTML with meta information for the current post (category, tags and permalink).
  427.  *
  428.  * @since Skeleton 1.0
  429.  */
  430. function lambda_posted_in() {
  431.     // Retrieves tag list of current post, separated by commas.
  432.     $tag_list = get_the_tag_list( '', ', ' );
  433.     if ( $tag_list ) {
  434.         $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', UT_THEME_NAME );
  435.     } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
  436.         $posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', UT_THEME_NAME );
  437.     } else {
  438.         $posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', UT_THEME_NAME );
  439.     }
  440.     // Prints the string, replacing the placeholders.
  441.     printf(
  442.         $posted_in,
  443.         get_the_category_list( ', ' ),
  444.         $tag_list,
  445.         get_permalink(),
  446.         the_title_attribute( 'echo=0' )
  447.     );
  448. }
  449.  
  450. endif;
  451.  
  452.  
  453. // Enable Shortcodes in excerpts and widgets
  454. add_filter('widget_text', 'do_shortcode');
  455. add_filter('the_excerpt', 'do_shortcode');
  456. add_filter('get_the_excerpt', 'do_shortcode');
  457.  
  458.  
  459. if (!function_exists('get_image_path'))  {
  460. function get_image_path() {
  461.     global $post;
  462.     $id = get_post_thumbnail_id();
  463.     // check to see if NextGen Gallery is present
  464.     if(stripos($id,'ngg-') !== false && class_exists('nggdb')){
  465.     $nggImage = nggdb::find_image(str_replace('ngg-','',$id));
  466.     $thumbnail = array(
  467.     $nggImage->imageURL,
  468.     $nggImage->width,
  469.     $nggImage->height
  470.     );
  471.     // otherwise, just get the wp thumbnail
  472.     } else {
  473.         $thumbnail = wp_get_attachment_image_src($id,'full', true);
  474.     }
  475.     $theimage = $thumbnail[0];
  476.     return $theimage;
  477. }
  478. }
  479.  
  480. #-----------------------------------------------------------------
  481. # override default filter for 'textarea' sanitization.
  482. #-----------------------------------------------------------------
  483. add_action('admin_init','optionscheck_change_santiziation', 100);
  484.  
  485. function optionscheck_change_santiziation() {
  486.     remove_filter( 'of_sanitize_textarea', 'of_sanitize_textarea' );
  487.     add_filter( 'of_sanitize_textarea', 'st_custom_sanitize_textarea' );
  488. }
  489.  
  490. function st_custom_sanitize_textarea($input) {
  491.     global $allowedposttags;
  492.     $custom_allowedtags["embed"] = array(
  493.       "src" => array(),
  494.       "type" => array(),
  495.       "allowfullscreen" => array(),
  496.       "allowscriptaccess" => array(),
  497.       "height" => array(),
  498.           "width" => array()
  499.       );
  500.         $custom_allowedtags["script"] = array();
  501.         $custom_allowedtags["a"] = array('href' => array(),'title' => array());
  502.         $custom_allowedtags["img"] = array('src' => array(),'title' => array(),'alt' => array());
  503.         $custom_allowedtags["br"] = array();
  504.         $custom_allowedtags["em"] = array();
  505.         $custom_allowedtags["strong"] = array();
  506.       $custom_allowedtags = array_merge($custom_allowedtags, $allowedposttags);
  507.       $output = wp_kses( $input, $custom_allowedtags);
  508.     return $output;
  509.         $of_custom_allowedtags = array_merge($of_custom_allowedtags, $allowedtags);
  510.         $output = wp_kses( $input, $of_custom_allowedtags);
  511.     return $output;
  512. } ?>
Advertisement
Add Comment
Please, Sign In to add comment