*/ class Agendapress_Public { /** * The ID of this plugin. * * @since 1.0.0 * @access private * @var string $plugin_name The ID of this plugin. */ private $plugin_name ; /** * The version of this plugin. * * @since 1.0.0 * @access private * @var string $version The current version of this plugin. */ private $version ; /** * Initialize the class and set its properties. * * @since 1.0.0 * @param string $plugin_name The name of the plugin. * @param string $version The version of this plugin. */ public function __construct( $plugin_name, $version ) { $this->plugin_name = $plugin_name; $this->version = $version; } /** * Register the stylesheets for the public-facing side of the site. * * @since 1.0.0 */ public function enqueue_styles() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in Agendapress_Loader as all of the hooks are defined * in that particular class. * * The Agendapress_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/agendapress-public.css', array(), $this->version, 'all' ); } public function check_lic() { if ( age_fs()->is_not_paying() ) { return 'free'; } } /** * Register the JavaScript for the public-facing side of the site. * * @since 1.0.0 */ public function enqueue_scripts() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in Agendapress_Loader as all of the hooks are defined * in that particular class. * * The Agendapress_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/agendapress-public.js', array( 'jquery' ), $this->version, false ); wp_localize_script( $this->plugin_name, '_agenda', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), ) ); } public function get_data_by_agenda_id( $agenda_id ) { $data = array(); $session = ( get_post_meta( $agenda_id, 'listed_session', true ) ? get_post_meta( $agenda_id, 'listed_session', true ) : array() ); $sessionnew = array(); $speakers = array(); $venues = array(); $organizations = array(); foreach ( $session as $key => $value ) { array_push( $sessionnew, $value->id ); if ( get_post_meta( $value->id, 'speaker', true ) ) { foreach ( get_post_meta( $value->id, 'speaker', true ) as $key => $speake ) { array_push( $speakers, $speake ); } } if ( get_post_meta( $value->id, 'venue', true ) ) { $vn = explode( ':', get_post_meta( $value->id, 'venue', true ) ); array_push( $venues, $vn[0] ); } } foreach ( $speakers as $key => $spw ) { array_push( $organizations, get_post_meta( $spw, 'organization', true ) ); } $data['sessions'] = array_unique( $sessionnew ); $data['speakers'] = array_unique( $speakers ); $data['venues'] = array_unique( $venues ); $data['organizations'] = array_unique( $organizations ); return $data; } public function single_agenda_sortcode( $atts ) { $data = shortcode_atts( array( 'id' => null, 'pop' => false, ), $atts ); if ( !$data['id'] ) { return 'Agenda ID required'; } $html = ''; if ( $data['pop'] ) { $html .= '
| '; //$custom_content .= 'Time'; $custom_content .= ' | '; foreach ( $resources as $key => $resource ) { $custom_content .= ''; $custom_content .= $resource->title; $custom_content .= ' | '; } $custom_content .= '
| ';
$time = new \DateTime( $key );
if ( get_post_meta( $agenda_id, 'clock_type', true ) == 12 ) {
$time = $time->format( 'h:i:s a' );
} else {
$time = $time->format( 'H:i:s' );
}
$custom_content .= ' ';
$custom_content .= $time;
$custom_content .= ' ';
$custom_content .= ' | ';
foreach ( $resources as $key => $resource ) {
$custom_content .= '';
foreach ( $hall as $keyh => $sessions ) {
foreach ( $sessions as $key => $session ) {
if ( $resource->id === $session->resourceId ) {
$session_meta = get_post_meta( $session->id );
$session_type = get_post_meta( $session->id, 'session_type', true );
$session_type = strtolower( str_replace( ' ', '_', $session_type ) );
$style = strtolower( str_replace( ' ', '_', $session_type ) );
$style = $template[$session_type];
if ( $this->check_lic() == 'premium' || $this->check_lic() == 'professional' ) {
$stylex = get_post_meta( $session->id, 'style', true );
if ( $stylex ) {
$stylex = $stylex['default'];
if ( !$stylex['override'] ) {
$style = get_post_meta( $session->id, 'style', true );
if ( $style ) {
$style = $style['default'];
}
}
}
}
$session_container = '';
if ( $style['session_container'] ) {
$session_container = '
background-color: ' . $style['session_container']['bgcolor'] . ';
border-style: ' . $style['session_container']['border_style'] . ';
border-width: ' . $style['session_container']['border_width'] . ';
border-color: ' . $style['session_container']['border_color'] . ';
padding: ' . $style['session_container']['padding'] . ';
margin: ' . $style['session_container']['margin'] . ';
';
}
$title = '';
if ( $style['title'] ) {
$title = '
font-family: ' . $style['title']['font'] . ';
font-size: ' . $style['title']['font_size'] . ';
color: ' . $style['title']['color'] . ';
text-align: ' . $style['title']['font_aligenment'] . ';
font-style: ' . $style['title']['font_style'] . ';
';
}
//print_r($session->start);
$custom_content .= ' ';
$custom_content .= ' ';
if ( $keyh == 0 ) {
$custom_content .= '';
}
}
}
}
$custom_content .= '';
$start = new \DateTime( $session->start );
$start = $start->format( 'h:i:s a' );
$end = new \DateTime( $session->end );
$end = $end->format( 'h:i:s a' );
$custom_content .= ' ';
$session_general_info_summery = get_post_meta( $session->id, 'session_general_info_summery', true );
if ( $session_general_info_summery ) {
$custom_content .= '';
$custom_content .= '' . $start . ' - ' . $end . '';
$custom_content .= ' ';
if ( $style['title'] ) {
if ( $style['title']['heading'] ) {
$custom_content .= '<' . $style['title']['heading'] . '>';
}
}
$custom_content .= $session->title;
if ( $style['title'] ) {
if ( $style['title']['heading'] ) {
$custom_content .= '' . $style['title']['heading'] . '>';
}
}
$custom_content .= '';
$custom_content .= $session_general_info_summery;
$custom_content .= ' ';
}
$session_general_info_aditional_details = get_post_meta( $session->id, 'session_general_info_aditional_details', true );
if ( $session_general_info_aditional_details ) {
$custom_content .= '';
$custom_content .= $session_general_info_aditional_details;
$custom_content .= ' ';
}
$custom_content .= '';
$custom_content .= ' ';
$venue_id = get_post_meta( $session->id, 'venue', true );
$venue_id = explode( ':', $venue_id );
$venue_id = $venue_id[0];
if ( $venue_id ) {
$venue = get_the_title( $venue_id );
if ( isset( $style['venue']['show'] ) ) {
$custom_content .= '';
$speaker_ids = get_post_meta( $session->id, 'speaker', true );
if ( !empty($speaker_ids) ) {
foreach ( $speaker_ids as $key => $speaker_id ) {
$custom_content .= ' ';
$custom_content .= '';
$speaker = get_the_title( $speaker_id );
$organization_id = get_post_meta( $speaker_id, 'organization', true );
$organization = get_the_title( $organization_id );
$speaker_style = $style['speaker'];
if ( isset( $style['speaker']['show'] ) ) {
$custom_content .= ' ';
}
}
$custom_content .= '
';
$custom_content .= ' ';
$custom_content .= '
| ';
}
$custom_content .= '
' . get_post_meta( $post_id, 'job_title', true ) . '
' . get_the_title( get_post_meta( $post_id, 'organization', true ) ) . '
Biography
' . get_post_meta( $post_id, 'job_title', true ) . '
Address is: ' . get_post_meta( $post_id, 'address', true ) . '
'; $html .= 'Phone: ' . get_post_meta( $post_id, 'phone', true ) . '
'; $html .= 'Email: ' . get_post_meta( $post_id, 'email', true ) . '
'; $html .= 'Website: ' . get_post_meta( $post_id, 'website', true ) . '
'; $html .= 'Notes
' . get_post_meta( $post_id, 'venue_general_info_notes', true ) . '
Address is: ' . get_post_meta( $post_id, 'address', true ) . '
'; $html .= 'Phone: ' . get_post_meta( $post_id, 'phone', true ) . '
'; $html .= 'Email: ' . get_post_meta( $post_id, 'email', true ) . '
'; $html .= 'Website: ' . get_post_meta( $post_id, 'website', true ) . '
'; $html .= 'Profile
' . get_post_meta( $post_id, 'organization_general_info_profile', true ) . '