wp/wp-content/themes/IN-MOTION-package-u1/option-tree/includes/ot-functions.php
changeset 0 d970ebf37754
equal deleted inserted replaced
-1:000000000000 0:d970ebf37754
       
     1 <?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' );
       
     2 /**
       
     3  * OptionTree functions
       
     4  *
       
     5  * @package   OptionTree
       
     6  * @author    Derek Herman <derek@valendesigns.com>
       
     7  * @copyright Copyright (c) 2012, Derek Herman
       
     8  * @since     2.0
       
     9  */
       
    10       
       
    11 /**
       
    12  * Get Option.
       
    13  *
       
    14  * Helper function to return the option value.
       
    15  * If no value has been saved, it returns $default.
       
    16  *
       
    17  * @param     string    The option ID.
       
    18  * @param     string    The default option value.
       
    19  * @return    mixed
       
    20  *
       
    21  * @access    public
       
    22  * @since     2.0
       
    23  */
       
    24 if ( ! function_exists( 'ot_get_option' ) ) {
       
    25 
       
    26   function ot_get_option( $option_id, $default = '' ) {
       
    27     
       
    28     /* get the saved options */ 
       
    29     $options = get_option( 'option_tree' );
       
    30     
       
    31     /* look for the saved value */
       
    32     if ( isset( $options[$option_id] ) && '' != $options[$option_id] ) {
       
    33       return $options[$option_id];
       
    34     }
       
    35     
       
    36     return $default;
       
    37     
       
    38   }
       
    39   
       
    40 }
       
    41 
       
    42 /**
       
    43  * Enqueue the dynamic CSS.
       
    44  *
       
    45  * @return    void
       
    46  *
       
    47  * @access    public
       
    48  * @since     2.0
       
    49  */
       
    50 if ( ! function_exists( 'ot_load_dynamic_css' ) ) {
       
    51 
       
    52   function ot_load_dynamic_css() {
       
    53     
       
    54     /* don't load in the admin */
       
    55     if ( is_admin() )
       
    56       return;
       
    57     
       
    58     /* grab a copy of the paths */
       
    59     $ot_css_file_paths = get_option( 'ot_css_file_paths', array() );
       
    60     
       
    61     if ( ! empty( $ot_css_file_paths ) ) {
       
    62       
       
    63       $last_css = '';
       
    64       
       
    65       /* loop through paths */
       
    66       foreach( $ot_css_file_paths as $key => $path ) {
       
    67         
       
    68         if ( '' != $path && file_exists( $path ) ) {
       
    69         
       
    70           $parts = explode( '/wp-content', $path );
       
    71           
       
    72           if ( isset( $parts[1] ) ) {
       
    73             
       
    74             $css = home_url( '/wp-content' . $parts[1] );
       
    75             
       
    76             if ( $last_css !== $css ) {
       
    77               
       
    78               /* enqueue filtered file */
       
    79               wp_enqueue_style( 'ot-dynamic-' . $key, $css, false, OT_VERSION );
       
    80               
       
    81               $last_css = $css;
       
    82               
       
    83             }
       
    84             
       
    85           }
       
    86       
       
    87         }
       
    88         
       
    89       }
       
    90     
       
    91     }
       
    92     
       
    93   }
       
    94   
       
    95 }
       
    96 
       
    97 /* End of file ot-functions.php */
       
    98 /* Location: ./includes/ot-functions.php */