Exemplo n.º 1
0
 /**
  * Register Shortcode For Ajax Content
  * @since: 1.5.0
  */
 public static function register_shortcode_ajax_target($args, $mid_content = null)
 {
     extract(shortcode_atts(array('alias' => ''), $args, 'ess_grid_ajax_target'));
     if ($alias == '') {
         return false;
     }
     //no alias found
     $output_protection = get_option('tp_eg_output_protection', 'none');
     $content = '';
     $grid = new Essential_Grid();
     $grid_id = self::get_id_by_alias($alias);
     if ($grid_id > 0) {
         $grid->init_by_id($grid_id);
         //check if shortcode is allowed
         $is_sc_allowed = $grid->get_param_by_handle('ajax-container-position');
         if ($is_sc_allowed != 'shortcode') {
             return false;
         }
         $content = $grid->output_ajax_container();
     }
     //handle output types
     switch ($output_protection) {
         case 'compress':
             $content = str_replace("\n", '', $content);
             $content = str_replace("\r", '', $content);
             return $content;
             break;
         case 'echo':
             echo $content;
             //bypass the filters
             break;
         default:
             //normal output
             return $content;
             break;
     }
 }