ak; case '#_'. $ph .'EVENTSPAST': //deprecated, erroneous documentation, left for compatability case '#_'. $ph .'EVENTSNEXT': //deprecated, erroneous documentation, left for compatability case '#_'. $ph .'EVENTSALL': //deprecated, erroneous documentation, left for compatability case '#_'. $ph .'PASTEVENTS': case '#_'. $ph .'NEXTEVENTS': case '#_'. $ph .'ALLEVENTS': //convert deprecated placeholders for compatability $result = ($result == '#_'. $ph .'EVENTSPAST') ? '#_'. $ph .'PASTEVENTS':$result; $result = ($result == '#_'. $ph .'EVENTSNEXT') ? '#_'. $ph .'NEXTEVENTS':$result; $result = ($result == '#_'. $ph .'EVENTSALL') ? '#_'. $ph .'ALLEVENTS':$result; //forget it ever happened? :/ if ($result == '#_'. $ph .'PASTEVENTS'){ $scope = 'past'; } elseif ( $result == '#_'. $ph .'NEXTEVENTS' ){ $scope = 'future'; } else{ $scope = 'all'; } $args = array($this->option_name=>$this->term_id, 'scope'=>$scope, 'pagination'=>1, 'ajax'=>0); $args['format_header'] = get_option('dbem_'. $this->option_name .'_event_list_item_header_format'); $args['format_footer'] = get_option('dbem_'. $this->option_name .'_event_list_item_footer_format'); $args['format'] = get_option('dbem_'. $this->option_name .'_event_list_item_format'); $args['no_results_msg'] = get_option('dbem_'. $this->option_name .'_no_events_message'); $args['limit'] = get_option('dbem_'. $this->option_name .'_event_list_limit'); $args['orderby'] = get_option('dbem_'. $this->option_name .'_event_list_orderby'); $args['order'] = get_option('dbem_'. $this->option_name .'_event_list_order'); $args['page'] = (!empty($_REQUEST['pno']) && is_numeric($_REQUEST['pno']) )? $_REQUEST['pno'] : 1; if( $target == 'email' ){ $args['pagination'] = 0; $args['page'] = 1; } $replace = EM_Events::output($args); break; case '#_'. $ph .'NEXTEVENT': $events = EM_Events::get( array($this->option_name=>$this->term_id, 'scope'=>'future', 'limit'=>1, 'orderby'=>'event_start_date,event_start_time') ); $replace = get_option('dbem_'. $this->option_name .'_no_event_message'); foreach($events as $EM_Event){ $replace = $EM_Event->output(get_option('dbem_'. $this->option_name .'_event_single_format')); } break; default: $replace = $full_result; break; } $replaces[$full_result] = apply_filters('em_'. $this->option_name .'_output_placeholder', $replace, $this, $full_result, $target, $placeholder_atts); } krsort($replaces); foreach($replaces as $full_result => $replacement){ $taxonomy_string = str_replace($full_result, $replacement , $taxonomy_string ); } return apply_filters('em_'. $this->option_name .'_output', $taxonomy_string, $this, $format, $target); } function output_excerpt($excerpt_length = 55, $excerpt_more = '[...]', $cut_excerpt = true){ $replace = $this->description; if( !empty($excerpt_length) ){ //shorten content by supplied number - copied from wp_trim_excerpt $replace = strip_shortcodes( $replace ); $replace = str_replace(']]>', ']]>', $replace); $replace = wp_trim_words( $replace, $excerpt_length, $excerpt_more ); } return $replace; } public function placeholder_image( $replace, $placeholders, $key ){ if( $this->get_image_url() != ''){ $image_url = esc_url($this->get_image_url()); if( empty($placeholders[3][$key]) ){ $replace = "".esc_attr($this->name).""; }else{ $image_size = explode(',', $placeholders[3][$key]); if( self::array_is_numeric($image_size) && count($image_size) > 1 ){ if( $this->get_image_id() ){ //get a thumbnail if( get_option('dbem_disable_thumbnails') ){ $image_attr = ''; $image_args = array(); if( empty($image_size[1]) && !empty($image_size[0]) ){ $image_attr = 'width="'.$image_size[0].'"'; $image_args['w'] = $image_size[0]; }elseif( empty($image_size[0]) && !empty($image_size[1]) ){ $image_attr = 'height="'.$image_size[1].'"'; $image_args['h'] = $image_size[1]; }elseif( !empty($image_size[0]) && !empty($image_size[1]) ){ $image_attr = 'width="'.$image_size[0].'" height="'.$image_size[1].'"'; $image_args = array('w'=>$image_size[0], 'h'=>$image_size[1]); } $replace = "".esc_attr($this->name).""; }else{ //since we previously didn't store image ids along with the url to the image (since taxonomies don't allow normal featured images), sometimes we won't be able to do this, which is why we check there's a valid image id first if( $this->option_ms_global ) self::ms_global_switch(); $replace = wp_get_attachment_image($this->get_image_id(), $image_size); if( $this->option_ms_global ) self::ms_global_switch_back(); } } }else{ $replace = "".esc_attr($this->name).""; } } } return $replace; } public function can_manage( $capability_owner = 'edit_event_taxonomy', $capability_admin = false, $user_to_check = false ){ global $em_capabilities_array; //Figure out if this is multisite and require an extra bit of validation $multisite_check = true; $can_manage = current_user_can($capability_owner); //if multisite and supoer admin, just return true if( is_multisite() && em_wp_is_super_admin() ){ return true; } if( EM_MS_GLOBAL && !is_main_site() ){ //User can't admin this bit, as they're on a sub-blog $can_manage = false; if(array_key_exists($capability_owner, $em_capabilities_array) ){ $this->add_error( $em_capabilities_array[$capability_owner]); } } return $can_manage; } }