SHARE
TWEET

Untitled

a guest Apr 12th, 2017 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. define( 'ECOUTE_DIR', trailingslashit( get_template_directory() ) );
  3. define( 'ECOUTE_URL', trailingslashit( get_template_directory_uri() ) );
  4. define( 'ECOUTE_VERSION', wp_get_theme()->Version );
  5.  
  6. function ecoute_register_classes( $class )
  7. {
  8.     if ( class_exists( $class ) || false === stripos( $class, 'Ecoute_' ) ) return;
  9.  
  10.     $file = 'class-' . str_replace( '_' , '-', strtolower( $class ) ) . '.php';
  11.     $files = glob( ECOUTE_DIR . '{*' . $file . ',*/*/' . $file . ',*/' . $file . '}', GLOB_BRACE );
  12.  
  13.     if ( isset( $files[0] ) && ( $name = str_replace( ECOUTE_DIR, '', $files[0] ) ) && file_exists( ECOUTE_DIR . $name ) ) {
  14.  
  15.         include ECOUTE_DIR . $name;
  16.     }
  17. }
  18. spl_autoload_register( 'ecoute_register_classes' );
  19.  
  20. if ( isset( $_GET['wsp-device'] ) ) {
  21.     define( 'ECOUTE_DEVICE', $_GET['wsp-device'] );
  22. } else {
  23.     define( 'ECOUTE_DEVICE', isset( $_POST['wsp-device'] ) ? $_POST['wsp-device'] : Ecoute_Device_Detect::get_device() );
  24. }
  25.  
  26. Ecoute_Hooks::hooks();
  27.  
  28. if ( isset( $_POST['action'] ) && stripos( $_POST['action'], 'Ecoute' ) === 0 ) {
  29.  
  30.     $system = explode( '-', $_POST['action'] );
  31.  
  32.     if ( method_exists( $system[0], $system[1] ) ) {
  33.  
  34.         $call = str_replace( '-', '::', $_POST['action'] );
  35.  
  36.         add_action( 'wp_ajax_' . $_POST['action'], $call );
  37.  
  38.         if ( $system[0] != 'Ecoute_Admin_Ajax' ) {
  39.  
  40.             add_action( 'wp_ajax_nopriv_' . $_POST['action'], $call );
  41.         }
  42.     }
  43. }
  44.  
  45. if ( is_admin() ) {
  46.    
  47.     include_once ECOUTE_DIR . 'core/admin/class-tgm-plugin-activation.php';
  48.    
  49.     Ecoute_Admin::init();
  50.    
  51. } else {
  52.    
  53.     add_action( 'wp_enqueue_scripts', array( 'Ecoute_Scripts', 'wp_enqueue_scripts' ) );
  54. }
  55.  
  56. function ecoute_option( $keys )
  57. {
  58.     global $ecoute;
  59.  
  60.     $count = count( $keys );
  61.  
  62.     if ( $count == 1 ) {
  63.  
  64.         return isset( $ecoute[ $keys[0] ] ) ? $ecoute[ $keys[0] ] : '';
  65.  
  66.     } elseif ( $count == 2 ) {
  67.        
  68.         return isset( $ecoute[ $keys[0] ][ $keys[1] ] ) ? $ecoute[ $keys[0] ][ $keys[1] ] : '';
  69.     }
  70.  
  71.     return $ecoute[ $keys[0] ][ $keys[1] ][ $keys[2] ];
  72. }
  73.  
  74. function ecoute_build()
  75. {
  76.     $out = false;
  77.    
  78.     if ( ( isset( $_GET['wsp-build'], $_GET['id'] ) || isset( $_POST['build'] ) ) && current_user_can( 'manage_options' ) ) {
  79.        
  80.         $out = true;
  81.         $id = isset( $_GET['id'] ) ? $_GET['id'] : $_POST['id'];
  82.         $build = isset( $_GET['wsp-build'] ) ? $_GET['wsp-build'] : $_POST['build'];
  83.  
  84.         if ( $build == 'page-build' || $build == 'content' ) {
  85.             $out = $build == 'page-build' && Ecoute_Builder::isBuilderPage( $id ) ? true : Ecoute_Builder::isBuilderContent( $id );
  86.         }
  87.     }
  88.  
  89.     return apply_filters( 'ecoute_build', $out );
  90. }
  91.  
  92. function ecouteWoo()
  93. {
  94.     return class_exists( 'WooCommerce' ) ? true : false;
  95. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top