Esempio n. 1
0
 /**
  * Check if asset file is processed | or add asset file to processed list
  *
  * @param string $file
  * @param bool   $assign
  */
 private static function assets_check($file, $assign = false)
 {
     @session_start();
     if (self::$run_time == 0) {
         unset($_SESSION);
     }
     self::$run_time++;
     global $post;
     $post_id = !empty($post) ? $post->ID : 0;
     // Check if this is backend or frontend
     $side = WR_Megamenu_Helpers_Functions::is_preview() ? 'admin' : 'wp';
     // $side = 'default';
     if (!$assign) {
         if (in_array($file, @(array) $_SESSION['wr-mm-processed-assets'][$post_id][$side]['assets'])) {
             return;
         }
     } else {
         // store it as processed asset
         $_SESSION['wr-mm-processed-assets'][$post_id]['assets'][$side][] = $file;
     }
 }
Esempio n. 2
0
 /**
  * return shortcode content: if shortcode is disable, return empty
  *
  * @param array $atts
  * @param string $content
  */
 public function element_shortcode($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     if ($arr_params['disabled_el'] == 'yes') {
         if (WR_Megamenu_Helpers_Functions::is_preview()) {
             return '';
             //_e( 'This element is deactivated. It will be hidden at frontend', WR_MEGAMENU_TEXTDOMAIN );
         }
         return '';
     }
     // enqueue script for current element in frontend
     add_action('wp_footer', array(&$this, 'enqueue_assets_frontend'), 1);
     // get full shortcode content
     return $this->element_shortcode_full($atts, $content);
 }