function process_session($session_slug) { global $TRACE_ENABLED; $pod = new Pod('event_session', $session_slug); $session_youtube_video = $pod->get_field('media_items.youtube_uri'); $session_media_item_title = $pod->get_field('media_items.name'); $subsessions = $pod->get_field('sessions.slug'); if ($subsessions and count($subsessions) == 1) { $subsessions = array(0 => $subsessions); } if ($session_youtube_video and $session_media_item_title) { echo "{$session_youtube_video}|{$session_media_item_title}\n"; } if ($subsessions) { foreach ($subsessions as $session) { process_session($session); } } }
} else { $context = "guide"; $icon = "book"; $taskparent = $taskpod->get_field('parent_guide'); if ($taskparent) { $parent_guide_id = $taskparent[0]['ID']; $taskparent = get_post($parent_guide_id); $title_context = " <small>(" . govintranetpress_custom_title($taskparent->post_title) . ")</small>"; } } } if ($post_type == 'Projects') { $context = "project"; $icon = "road"; $taskpod = new Pod('projects', $post->ID); $projparent = $taskpod->get_field('parent_project'); if ($projparent) { $parent_guide_id = $projparent[0]['ID']; $projparent = get_post($parent_guide_id); $title_context = " <small>(" . govintranetpress_custom_title($projparent->post_title) . ")</small>"; } } if ($post_type == 'News') { $context = "news"; $icon = "star-empty"; } if ($post_type == 'Vacancies') { $context = "job vacancy"; $icon = "random"; } if ($post_type == 'Blog') {
/** * Makes some changes to the <title> tag, by filtering the output of wp_title(). * * If we have a site description and we're viewing the home page or a blog posts * page (when using a static front page), then we will add the site description. * * If we're viewing a search result, then we're going to recreate the title entirely. * We're going to add page numbers to all titles as well, to the middle of a search * result title and the end of all other titles. * * The site title also gets added to all titles. * * @since Twenty Ten 1.0 * * @param string $title Title generated by wp_title() * @param string $separator The separator passed to wp_title(). Twenty Ten uses a * vertical bar, "|", as a separator in header.php. * @return string The new title, ready for the <title> tag. */ function twentyten_filter_wp_title($title, $separator) { // Don't affect wp_title() calls in feeds. if (is_feed()) { return $title; } // The $paged global variable contains the page number of a listing of posts. // The $page global variable contains the page number of a single post that is paged. // We'll display whichever one applies, if we're not looking at the first page. global $paged, $page; if (is_search()) { // If we're a search, let's start over: $title = sprintf(__('Search results for %s', 'twentyten'), '"' . get_search_query() . '"'); // Add a page number if we're on page 2 or more: if ($paged >= 2) { $title .= " {$separator} " . sprintf(__('Page %s', 'twentyten'), $paged); } // Add the site name to the end: //$title .= " $separator " . get_bloginfo( 'name', 'display' ); // We're done. Let's send the new title back to wp_title(): return $title; } // Otherwise, let's start by adding the site name to the end: if (is_front_page()) { $title .= get_bloginfo('name', 'display'); } $slug = pods_url_variable(0); $slug2 = pods_url_variable(1); if ($slug == "task") { $taskpod = new Pod('task', pods_url_variable(1)); $taskparent = $taskpod->get_field('parent_guide'); $title_context = ''; if ($taskparent) { $parent_guide_id = $taskparent[0]['ID']; $taskparent = get_post($parent_guide_id); $title_context = " (" . govintranetpress_custom_title($taskparent->post_title) . ")"; } $title .= $title_context . " - tasks and guides"; } else { if ($slug2 == "projects") { $title .= " - projects"; } else { if ($slug2 == "vacancies") { $title .= " - job vacancies"; } else { if ($slug == "staff") { global $post; $u = $post->post_title; $title .= $u . " - staff profile"; } else { if ($slug == "events") { $title .= " - events"; } else { if ($slug == "glossary") { $title .= " - jargon buster"; } else { if ($slug == "atoz") { $title .= " - A to Z"; } else { if ($slug == "forums") { $title .= " - forums"; } else { if ($slug == "topics") { $title .= " - forum topics"; } else { if ($slug == "replies") { $title .= " - forum replies"; } else { if ($slug == "news") { $title .= " - news"; } else { if ($slug == "blog") { $title .= " - blog"; } } } } } } } } } } } } // If we have a site description and we're on the home/front page, add the description: $site_description = get_bloginfo('description', 'display'); if ($site_description && (is_home() || is_front_page())) { $title .= " {$separator} " . $site_description; } // Add a page number if necessary: if ($paged >= 2 || $page >= 2) { $title .= " {$separator} " . sprintf(__('Page %s', 'twentyten'), max($paged, $page)); } // Return the new title to wp_title(): return trim(preg_replace('/\\[.*\\]/i', '', $title)); }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $items = intval($instance['items']); $pages = $instance['pages']; $tasks = $instance['tasks']; $projects = $instance['projects']; $vacancies = $instance['vacancies']; $news = $instance['news']; $blog = $instance['blog']; $events = $instance['event']; $lastupdated = $instance['lastupdated']; ?> <?php echo $before_widget; ?> <?php if ($title) { echo $before_title . $title . $after_title; } ?> <?php $donefilter = false; $filter = ''; if ($projects == 'on') { $filter .= "post_type = 'projects'"; $donefilter = true; } if ($pages == 'on') { if ($donefilter) { $filter .= " or "; } $filter .= "post_type = 'page'"; $donefilter = true; } if ($tasks == 'on') { if ($donefilter) { $filter .= " or "; } $filter .= "post_type = 'task'"; $donefilter = true; } if ($vacancies == 'on') { if ($donefilter) { $filter .= " or "; } $filter .= "post_type = 'vacancies'"; $donefilter = true; } if ($news == 'on') { if ($donefilter) { $filter .= " or "; } $filter .= "post_type = 'news'"; $donefilter = true; } if ($blog == 'on') { if ($donefilter) { $filter .= " or "; } $filter .= "post_type = 'blog'"; $donefilter = true; } if ($events == 'on') { if ($donefilter) { $filter .= " or "; } $filter .= "post_type = 'event'"; $donefilter = true; } if ($lastupdated == 'on') { $checkdate = 'post_modified'; } else { $checkdate = 'post_date'; } $q = "\n\tselect * \n\tfrom wp_posts \n\twhere (" . $filter . ") and post_status = 'publish'\n\torder by " . $checkdate . " desc\n\tlimit 50;\n\t"; global $wpdb; $rpublished = $wpdb->get_results($q); echo "<ul>"; $k = 0; foreach ($rpublished as $r) { if ($r->post_type == 'page') { if (in_array($r->post_name, array('how-do-i', 'task-by-category', 'news-by-category', 'newspage', 'tagged', 'atoz', 'about', 'home', 'blogs', 'events'))) { continue; } $k++; echo "<li><a href='" . $r->guid . "'>" . govintranetpress_custom_title(get_the_title($r->ID)) . "</a></li>"; } if ($r->post_type == 'task') { $taskpod = new Pod('task', $r->ID); if ($taskpod->get_field('page_type') == 'Task') { $k++; echo "<li><a href='" . site_url() . "/task/" . $taskpod->get_field('slug') . "/'>" . govintranetpress_custom_title($taskpod->get_field('post_title')) . "</a></li>"; } else { if ($taskpod->get_field('page_type') == 'Guide header') { $k++; echo "<li><a href='" . site_url() . "/task/" . $taskpod->get_field('slug') . "/'>" . govintranetpress_custom_title($taskpod->get_field('post_title')) . "</a></li>"; } else { $k++; $pguide = $taskpod->get_field('parent_guide'); $ptaskpod = new Pod('task', $pguide[0]['ID']); echo "<li><a href='" . site_url() . "/task/" . $taskpod->get_field('slug') . "/'>" . govintranetpress_custom_title($taskpod->get_field('post_title')) . " <small>(" . govintranetpress_custom_title($ptaskpod->get_field('post_title')) . ")</small></a></li>"; } } } if ($r->post_type == 'projects') { $projpod = new Pod('projects', $r->ID); if (!$projpod->get_field('parent_project')) { $k++; echo "<li><a href='" . site_url() . "/projects/" . $projpod->get_field('slug') . "/'>" . govintranetpress_custom_title($projpod->get_field('post_title')) . "</a></li>"; } } if ($r->post_type == 'vacancies') { $k++; $vacpod = new Pod('vacancies', $r->ID); echo "<li><a href='" . site_url() . "/vacancies/" . $vacpod->get_field('slug') . "/'>" . govintranetpress_custom_title($vacpod->get_field('post_title')) . "</a></li>"; } if ($r->post_type == 'news') { $k++; $vacpod = new Pod('news', $r->ID); echo "<li><a href='" . site_url() . "/news/" . $vacpod->get_field('slug') . "/'>" . govintranetpress_custom_title($vacpod->get_field('post_title')) . "</a></li>"; } if ($r->post_type == 'blog') { $k++; $vacpod = new Pod('blog', $r->ID); echo "<li><a href='" . site_url() . "/blog/" . $vacpod->get_field('slug') . "/'>" . govintranetpress_custom_title($vacpod->get_field('post_title')) . "</a></li>"; } if ($r->post_type == 'event') { $k++; $vacpod = new Pod('event', $r->ID); echo "<li><a href='" . site_url() . "/event/" . $vacpod->get_field('slug') . "/'>" . govintranetpress_custom_title($vacpod->get_field('post_title')) . "</a></li>"; } if ($k == $items) { break; } } echo "</ul>"; wp_reset_query(); ?> <?php echo $after_widget; ?> <?php }
$categories = new Pod('categories'); $categories->findRecords('', 0, '', 'SELECT name, slug, description FROM wp_pod_tbl_categories WHERE parentid IN (3) ORDER BY name'); $total_cats = $categories->getTotalRows(); echo '<table border=0 width=480><tr><td width="50%" class="pro_contacttd">'; $i = 0; $j = 0; if ($total_cats > 0) { while ($categories->fetchRecord()) { $i++; $j++; if ($i > $total_cats / 2) { echo '</td><td width="50%" class="pro_contacttd">'; $i = 0; } // set our variables $cat_name = $categories->get_field('name'); $cat_slug = $categories->get_field('slug'); $cat_desc = $categories->get_field('description'); $cat_checked = ''; if (strpos($txt_service_interest, $cat_name) !== false) { $cat_checked = 'checked '; } echo <<<HEREDOC \t\t\t\t<input name="txt_service_interest[]" id="txt_service_interest_{$j}" type="checkbox" value="{$cat_name}" class="pro_checkbox" {$cat_checked}/> <label for="txt_service_interest_{$j}">{$cat_name}</label><br /> HEREDOC; } } echo '</td></tr></table>'; echo <<<HEREDOC \t\t<div class="pro_contactrow"> \t\t\t<div class="pro_contactlabel">I am interested in:<br /> <br /> <br /> <br /> <br /> </div>
} $conference_publication_blurb = $pod->get_field('conference_newspaper.blurb'); $conference_publication_cover = honor_ssl_for_attachments($pod->get_field('conference_newspaper.snapshot.guid')); $conference_publication_wp_page = honor_ssl_for_attachments($pod->get_field('conference_newspaper.publication_web_page.guid')); $conference_publication_pdf = $pod->get_field('conference_newspaper.publication_pdf_uri'); $conference_publication_issuu = $pod->get_field('conference_newspaper.issuu_uri'); $research_summary_title = $pod->get_field('research_summary.name'); $research_summary_blurb = $pod->get_field('research_summary.blurb'); // tiles is a multi-select pick field so in theory we could have more // than one tile to display here, however initially we only process the // first one and ignore the rest - later on we should deal with more // complex cases (e.g. as a slider or so) echo var_trace('tiles: ' . var_export($pod->get_field('research_summary.visualization_tiles'), true), $TRACE_PREFIX, $TRACE_ENABLED); $visualization_tiles = $pod->get_field('research_summary.visualization_tiles'); $tile_pod = new Pod('tile', $visualization_tiles[0]['slug']); echo var_trace('tile_image: ' . var_export($tile_pod->get_field('image'), true), $TRACE_PREFIX, $TRACE_ENABLED); $research_summary_tile_image = honor_ssl_for_attachments($tile_pod->get_field('image.guid')); $research_summary_pdf_uri = $pod->get_field('research_summary.data_section_pdf_uri'); ?> <?php get_header(); ?> <div role="main"> <?php if (have_posts()) { the_post(); } ?>
$a = array(); // ******************************************************************* // INITIALIZATION, so to speak // ******************************************************************* // Basically, if we have a $pid, go ahead an get the data from the database, We might end up // replacing that data with data the user is trying to save, but this will make sure we have // all the images and related data.... a good baseline, so to speak $profile = new Pod('vendor_profiles'); //$profile->findRecords( 'id', -1, "t.id = '$pid' and t.vendor = $active_user_id"); $profile->findRecords('id', -1, "t.vendor = {$active_user_id}"); $total = $profile->getTotalRows(); if ($total > 0) { $profile->fetchRecord(); } $title = 'Business Profile Upgrade'; $profile_name = $profile->get_field('name'); $pid = $profile->get_field('id'); $result = pod_query("SELECT full_name, user_contact, user_email FROM ao_vendors WHERE id='{$active_user_id}'"); $row = mysql_fetch_assoc($result); $user_email = $row['user_email']; $user_contact = $row['user_contact']; $full_name = $row['full_name']; // ******************************************************************* // IS THE USER TRYING TO DO THE UPGRADE??? // ******************************************************************* if ($_POST['submitted'] == "1") { $success = false; // pull everything off of $_POST into our $a array. // we're specifically NOT using $_REQUEST here for a tiny bit of security. foreach ($_POST as $key => $value) { $a[$key] = htmlspecialchars(stripslashes($value));
// create our rating box $rating_data = get_ratingbox($fields["rati"]); echo <<<HEREDOC \t\t<div class="menu-featured-vendor" onclick="window.location.href='/profile/{$fields["slug"]}'"> \t\t\t<a href="/profile/{$fields["slug"]}"><img src="{$fields["imag"]}" title="{$fields["summ"]}" /></a> \t\t\t<a href="/profile/{$fields["slug"]}">{$fields["name"]}</a> \t\t\t<!-- <h2 class="guidelist_name"><a href="/profile/{$fields["slug"]}">{$fields["name"]}</a></h2> --> \t\t\t{$rating_data} \t\t</div> \t\t HEREDOC; } ?> </div> <div id="menu-content-guidelist"> <?php $categories = new Pod('categories'); $categories->findRecords('', 0, '', 'SELECT name, slug, short_title, description FROM wp_pod_tbl_categories WHERE hide <> 1 AND priority = 1 ORDER BY sort_order, name'); $total_cats = $categories->getTotalRows(); if ($total_cats > 0) { while ($categories->fetchRecord()) { $cat_name = $categories->get_field('name'); $cat_slug = $categories->get_field('slug'); echo '<div class="menu-guide-list"><a href="/atlanta/', $cat_slug, '">', $cat_name, '</a></div>'; } } ?> <p class="menu-guide-list"> </p> <p class="menu-guide-list"><a href="/atlanta/">more...</a></p> </div>
/** * Shortcode support for WP Posts and Pages * * @param array $tags An associative array of shortcode properties * @since 1.6.7 */ function pods_shortcode($tags) { $defaults = array('name' => null, 'id' => null, 'slug' => null, 'select' => null, 'order' => null, 'orderby' => null, 'limit' => null, 'where' => null, 'search' => true, 'page' => null, 'filters' => false, 'filters_label' => null, 'filters_location' => 'before', 'pagination' => false, 'pagination_label' => null, 'pagination_location' => 'after', 'col' => null, 'template' => null, 'helper' => null); $tags = shortcode_atts($defaults, $tags); $tags = apply_filters('pods_shortcode', $tags); if (empty($tags['name'])) { return '<e>Please provide a Pod name'; } if (empty($tags['template']) && empty($tags['col'])) { return '<e>Please provide either a template or column name'; } // id > slug (if both exist) $id = empty($tags['slug']) ? null : $tags['slug']; $id = empty($tags['id']) ? $id : absint($tags['id']); $pod = new Pod($tags['name'], $id); $found = 0; if (empty($id)) { $params = array(); if (0 < strlen($tags['order'])) { $params['orderby'] = $tags['order']; } if (0 < strlen($tags['orderby'])) { $params['orderby'] = $tags['orderby']; } if (!empty($tags['limit'])) { $params['limit'] = $tags['limit']; } if (0 < strlen($tags['where'])) { $params['where'] = $tags['where']; } if (0 < strlen($tags['select'])) { $params['select'] = $tags['select']; } if (empty($tags['search'])) { $params['search'] = false; } if (0 < absint($tags['page'])) { $params['page'] = absint($tags['page']); } $params = apply_filters('pods_shortcode_findrecords_params', $params); $pod->findRecords($params); $found = $pod->getTotalRows(); } elseif (!empty($tags['col'])) { $val = $pod->get_field($tags['col']); return empty($tags['helper']) ? $val : $pod->pod_helper($tags['helper'], $val); } ob_start(); if (empty($id) && false !== $tags['filters'] && 'before' == $tags['filters_location']) { echo $pod->getFilters($tags['filters'], $tags['filters_label']); } if (empty($id) && 0 < $found && false !== $tags['pagination'] && 'before' == $tags['pagination_location']) { echo $pod->getPagination($tags['pagination_label']); } echo $pod->showTemplate($tags['template']); if (empty($id) && 0 < $found && false !== $tags['pagination'] && 'after' == $tags['pagination_location']) { echo $pod->getPagination($tags['pagination_label']); } if (empty($id) && false !== $tags['filters'] && 'after' == $tags['filters_location']) { echo $pod->getFilters($tags['filters'], $tags['filters_label']); } return ob_get_clean(); }
$equalize = true; //$schit = $_GET['schit']; include TEMPLATEPATH . '/header.php'; ?> <div class="container" id="equalize"> <?php $found_film = false; global $pods; $film_slug = pods_url_variable('last'); $film2 = $film = new Pod('film_info', $film_slug); if (!empty($film->data)) { $found_film = true; // set our variables $id = $film->get_field('id'); $name = $film->get_field('name'); $sliderstill = $film->get_field('sliderstill.guid'); $customposter = $film->get_field('customposter.guid'); $customimage480 = $film->get_field('customimage640.guid'); $image640 = $film->get_field('image640'); $threedee = $film->get_field('threedee'); $rating = $film->get_field('rating'); $length = $film->get_field('length'); $sr = $film->get_field('sr'); $copyright = $film->get_field('copyright'); $director = $film->get_field('director'); $description = $film->get_field('description'); $shortdesc = $film->get_field('shortdesc'); $reviews = $film->get_field('reviews'); $genre = $film->get_field('genre');
function load_vendorimages(&$profile, &$a) { // ********************************************************* // IMAGE PROCESSING // we go ahead and process all the images since we need a // count of the number of slideshow images to determine // if we need to generate the flash slideshow code on the // profile page at all. We check for images in this order: // // 1) Look for images on disk for this profile. // // 2) Look in the profile tables for images that were // uploaded into the WP Media Library via PodsCMS. // ** THIS STEP CAN PROBABLY BE DELETED ** // // 3) Look up the table of images from the v2 website. // ** THIS STEP CAN PROBABLY BE DELETED ** // // ********************************************************* global $img_base_path; global $img_dst_source; global $img_dst_large; global $img_dst_thumb; global $img_dst_logo; global $img_dst_video; global $img_web_source; global $img_web_large; global $img_web_thumb; global $img_web_logo; global $img_web_video; $img_num = 0; $vid_num = 0; $img_nodes = ''; $vid_nodes = ''; $pid = $a['id']; $a['imagelist_source'] = array(); $a['imagelist_large'] = array(); $a['imagelist_thumb'] = array(); $a['imagelist_names'] = array(); $a['videolist_video'] = array(); $a['videolist_names'] = array(); // check to see if their video dir exists if (is_dir("{$img_dst_video}/{$pid}")) { $a_entries = scandir("{$img_dst_video}/{$pid}"); sort($a_entries); foreach ($a_entries as $entry) { if (is_file("{$img_dst_video}/{$pid}/{$entry}")) { $vid_num++; $a['videolist_video'][] = "{$img_web_video}/{$pid}/{$entry}"; $a['videolist_names'][] = $entry; $vid_nodes .= "<video id='v{$vid_num}' source='{$img_web_video}/{$pid}/{$entry}' title='' description='' thumbnail='/media/images/video.jpg' />\n"; } } } //if ($pid == '582' || $pid == '607' || $pid == '608' || $pid == '89' || $pid == '143' || $pid == '593' || $pid == '167') { // check to see if their image dir exists if (is_dir("{$img_dst_thumb}/{$pid}")) { $a_entries = scandir("{$img_dst_thumb}/{$pid}"); sort($a_entries); foreach ($a_entries as $entry) { if (is_file("{$img_dst_thumb}/{$pid}/{$entry}")) { $img_num++; $a['imagelist_source'][] = "{$img_web_source}/{$pid}/{$entry}"; $a['imagelist_large'][] = "{$img_web_large}/{$pid}/{$entry}"; $a['imagelist_thumb'][] = "{$img_web_thumb}/{$pid}/{$entry}"; $a['imagelist_names'][] = $entry; $img_nodes .= "<image id='i{$img_num}' source='{$img_web_large}/{$pid}/{$entry}' title='' description='' thumbnail='{$img_web_thumb}/{$pid}/{$entry}' />\n"; } } } //} // if we DIDN'T get any images from disk, then track down the old v2 images. if ($img_num == 0) { // first figure out which photo to use... $aimg = $profile->get_field('slideshow_images'); if (is_array($aimg)) { foreach ($aimg as $v) { // get the image from the WP Media Library $lib_img = wp_get_attachment_image_src($v['ID'], 'large', false); $img = $lib_img[0]; $img_w = $lib_img[1]; $img_h = $lib_img[2]; $img_alt = $v['guid']; //$img_alt = $img; // get the thumbnail $img_alt = str_replace('.jpg', '-125x125.jpg', $img_alt); $img_alt = str_replace('.jpeg', '-125x125.jpeg', $img_alt); $img_alt = str_replace('.gif', '-125x125.gif', $img_alt); $img_alt = str_replace('.png', '-125x125.png', $img_alt); $img_alt = str_replace('.tif', '-125x125.tif', $img_alt); $img_alt = str_replace('.tiff', '-125x125.tiff', $img_alt); // chop off the URL, this way we are left with a relative path // so we can check if the file exists on disk later. $img_alt = str_replace(get_bloginfo('url') . '/', '', $img_alt); $img = str_replace(get_bloginfo('url') . '/', '', $img); if (!file_exists(ABSPATH . $img_alt)) { $img_alt = $img; } if (file_exists(ABSPATH . $img)) { $img_num++; $a['imagelist_source'][] = '/' . $img; $a['imagelist_large'][] = '/' . $img; $a['imagelist_thumb'][] = '/' . $img_alt; $img = get_bloginfo('url') . '/' . $img; $img_alt = get_bloginfo('url') . '/' . $img_alt; if (strtolower(substr($img, -4)) == '.flv') { $img_nodes .= "<video id='{$img_num}' source='{$img}' title='' description='' thumbnail='{$img_alt}' />\n"; } else { $img_nodes .= "<image id='{$img_num}' source='{$img}' title='' description='' thumbnail='{$img_alt}' />\n"; } } } } } // if we DIDN'T get any images from the v3 fieldset, then track down the old v2 images. if ($img_num == 0) { $images = new Pod('vendor_imagesv2'); $images->findRecords('id', -1, "t.ao2_userid = '{$a['v2id']}'"); $total = $images->getTotalRows(); if ($total > 0) { $img_num = 0; $img_nodes = ''; while ($images->fetchRecord()) { // as part of the conversion to v3, all the v2 images were converted to JPGs and // resized to 600px on the longest side, all lower case. $img_num++; $img_name = strtolower($images->get_field('filename')); $img_name = str_replace('.jpeg', '.jpg', $img_name); $img_name = str_replace('.gif', '.jpg', $img_name); $img_name = str_replace('.png', '.jpg', $img_name); $img_name = str_replace('.bmp', '.jpg', $img_name); $img_name = str_replace('.tif', '.jpg', $img_name); $img_name = str_replace('.tiff', '.jpg', $img_name); $img_name = str_replace('/v2/', '/v2-600/', $img_name); if (file_exists(ABSPATH . $img_name)) { $a['imagelist_source'][] = $img_name; $a['imagelist_large'][] = $img_name; $a['imagelist_thumb'][] = $img_name; $img_name = get_bloginfo('url') . $img_name; $img_nodes .= "<image pid='{$img_dst_thumb}' id='{$img_num}' source='{$img_name}' title='' description='' thumbnail='{$img_name}' />\n"; } } } } $a['image_count'] = $img_num; $a['image_xmlnodes'] = $img_nodes; $a['video_count'] = $vid_num; $a['video_xmlnodes'] = $vid_nodes; }
<?php /* Run the loop for the category page to output the posts. * If you want to overload this in a child theme then include a file * called loop-category.php and that will be used instead. */ $taskitems = new WP_Query(array('post_type' => 'task', 'posts_per_page' => -1, 'cat' => $catid, 'posts_per_page' => 25, 'paged' => $paged, 'orderby' => 'name', 'order' => 'ASC', 'meta_key' => 'page_type', 'meta_value' => array('Task', 'Guide header'))); if ($taskitems->post_count == 0) { echo "<p>Nothing to show.</p>"; } while ($taskitems->have_posts()) { $taskitems->the_post(); $image_url = get_the_post_thumbnail($ID, 'thumbnail', array('class' => 'alignright')); echo "<div class='newsitem'>" . $image_url; echo "<hr>"; $taskpod = new Pod('task', $post->ID); if ($taskpod->get_field('page_type') == 'Task') { $context = "task"; $icon = "question-sign"; } else { $context = "guide"; $icon = "book"; $taskparent = $taskpod->get_field('parent_guide'); $title_context = ''; if ($taskparent) { $parent_guide_id = $taskparent[0]['ID']; $taskparent = get_post($parent_guide_id); $title_context = " (" . govintranetpress_custom_title($taskparent->post_title) . ")"; } } ?> <h3>
<?php } ?> <li class='threecol<?php if (($index + 1) % 4 == 0) { ?> last<?php } ?> '> <a href="<?php echo get_permalink($item['ID']); ?> "> <img src="<?php echo honor_ssl_for_attachments($item_pod->get_field('snapshot.guid')); ?> " /> </a> <p> <a href="<?php echo get_permalink($item['ID']); ?> "> <?php echo $item_pod->get_field('name'); ?> </a> </p> </li> <?php
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $items = intval($instance['items']); $pages = $instance['pages']; $tasks = $instance['tasks']; $projects = $instance['projects']; $vacancies = $instance['vacancies']; $news = $instance['news']; $blog = $instance['blog']; $events = $instance['events']; $trail = intval($instance['trail']); $cache = intval($instance['cache']); ?> <?php echo $before_widget; ?> <?php if ($title) { echo $before_title . $title . $after_title; } ?> <?php $baseurl = home_url(); $hc = new Pod('homepage_control'); $top_pages = $hc->get_field('top_pages'); $num_top_slots = count($top_pages); $to_fill = $items - $num_top_slots; $k = 0; $alreadydone = array(); //display top news stories $hmtl = ''; if ($top_pages) { foreach ($top_pages as $slot) { $k++; $alreadydone[] = $slot['ID']; $thistitle = govintranetpress_custom_title($slot['post_title']); $thisURL = $slot['post_name']; $taskpod = new Pod('task', $thistask); $tasktitle = govintranetpress_custom_title($slot['post_title']); $html .= "<li><a href='" . site_url() . "/task/" . $thisURL . "'>" . $tasktitle . "</a></li>"; } echo "<ul>" . $html . "</ul>"; } $cachedga = get_transient('cached_ga'); if ($cachedga) { // if we have a fresh cache $html = ''; foreach ($cachedga as $result) { if (strpos($result['pagePath'], "show=")) { continue; } if ($k > $items - 1) { break; } $tasktitle = ''; if (substr($result['pagePath'], 0, 6) == '/task/' && $result['pagePath'] != '/task/' && $tasks == 'on') { // only show tasks, but not the tasks landing page $pathparts = explode("/", $result['pagePath']); $thistask = $pathparts[2]; $tasktitle = false; $taskpod = new Pod('task', $thistask); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); if ($taskpod->get_field('parent_guide')) { //if this is a chapter in a guide, we'll display the parent page continue; } if (!$tasktitle) { continue; } if (in_array($taskpod->get_field('ID'), $alreadydone)) { continue; } $k++; } if (substr($result['pagePath'], 0, 10) == '/projects/' && $result['pagePath'] != '/about/projects/' && $projects == 'on') { // only show projects, but not the projects landing page $pathparts = explode("/", $result['pagePath']); $thistask = $pathparts[2]; $taskpod = new Pod('projects', $thistask); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); if ($taskpod->get_field('parent_project')) { continue; } if (!$tasktitle) { continue; } if (in_array($taskpod->get_field('ID'), $alreadydone)) { continue; } $k++; } if (substr($result['pagePath'], 0, 11) == '/vacancies/' && $result['pagePath'] != '/about/vacancies/' && $vacancies == 'on') { // only show vacancies, but not the vacancies landing page $pathparts = explode("/", $result['pagePath']); $thistask = $pathparts[2]; $taskpod = new Pod('vacancies', $thistask); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); if (!$tasktitle) { continue; } if (in_array($taskpod->get_field('ID'), $alreadydone)) { continue; } $k++; } if (substr($result['pagePath'], 0, 6) == '/news/' && $result['pagePath'] != '/news/' && $news == 'on') { // only show news, but not the news landing page $pathparts = explode("/", $result['pagePath']); $thistask = $pathparts[2]; $taskpod = new Pod('news', $thistask); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); if (!$tasktitle) { continue; } if (in_array($taskpod->get_field('ID'), $alreadydone)) { continue; } $k++; } if (substr($result['pagePath'], 0, 6) == '/blog/' && $result['pagePath'] != '/blog/' && $blog == 'on') { // only show news, but not the news landing page $pathparts = explode("/", $result['pagePath']); $thistask = $pathparts[2]; $taskpod = new Pod('blog', $thistask); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); if (!$tasktitle) { continue; } if (in_array($taskpod->get_field('ID'), $alreadydone)) { continue; } $k++; } if (substr($result['pagePath'], 0, 7) == '/event/' && $result['pagePath'] != '/events/' && $events == 'on') { // only show news, but not the news landing page $pathparts = explode("/", $result['pagePath']); $thistask = $pathparts[2]; $taskpod = new Pod('event', $thistask); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); if (!$tasktitle) { continue; } if (in_array($taskpod->get_field('ID'), $alreadydone)) { continue; } $k++; } if ($pages == 'on' && !$tasktitle) { // show pages $pathparts = explode("/", $result['pagePath']); $countparts = count($pathparts) - 2; if ($countparts < 1) { $countparts = 0; } $thistask = $pathparts[intval($countparts)]; if (!in_array($thistask, array('how-do-i', 'tasks', 'task-by-category', 'news-by-category', 'newspage', 'tagged', 'atoz', 'about', 'home', 'events', 'blog', 'activate', 'register', 'members', 'activity', 'forums', 'jargon-buster', 'search-staff', 'staff-directory', 'document-finder'))) { $q = "select post_title, ID from wp_posts where post_name = '" . $thistask . "' and post_status='publish' and post_type='page';"; global $wpdb; $thispage = $wpdb->get_results($q, ARRAY_A); foreach ($thispage as $t) { //echo $t['post_title']; $tasktitle = govintranetpress_custom_title($t['post_title']); $taskid = $t['ID']; } if (!$tasktitle) { continue; } if (in_array($taskid, $alreadydone)) { continue; } $k++; } } if ($tasktitle != '') { $html .= "<li><a href='" . $baseurl . $result['pagePath'] . "'>" . $tasktitle . "</a></li>"; } } } else { ini_set('error_reporting', '0'); // disable all, for security // Developed by Steph Gray http://helpfultechnology.com, December 2009 // Uses the GAPI library by Stig Manning <*****@*****.**>, version 1.3 $gs = new Pod('general_intranet'); $google_analytics_username = $gs->get_field('google_analytics_email'); $google_analytics_password = $gs->get_field('google_password'); $google_analytics_profileid = $gs->get_field('google_analytics_profile_id'); $days_to_trail = $trail; if ($days_to_trail < 1) { $days_to_trail = 1; } $gis = "general_intranet_time_zone"; $tzone = get_option($gis); date_default_timezone_set($tzone); $start_date = date("Y-m-d", time() - 86400 * $days_to_trail); // last x days define('ga_email', $google_analytics_username); define('ga_password', $google_analytics_password); define('ga_profile_id', $google_analytics_profileid); $count = $conf['tab1']['garesultcount'] ? $conf['tab1']['garesultcount'] : 50; require_once 'gapi.class.php'; $ga = new gapi(ga_email, ga_password); $donefilter = false; $filter = ''; if ($projects == 'on') { $filter .= 'ga:pagePath=~/projects/'; $donefilter = true; } if ($tasks == 'on') { if ($donefilter) { $filter .= "||"; } $filter .= 'ga:pagePath=~/task/'; $donefilter = true; } if ($vacancies == 'on') { if ($donefilter) { $filter .= "||"; } $filter .= 'ga:pagePath=~/vacancies/'; $donefilter = true; } if ($news == 'on') { if ($donefilter) { $filter .= "||"; } $filter .= 'ga:pagePath=~/news/'; $donefilter = true; } if ($blog == 'on') { if ($donefilter) { $filter .= "||"; } $filter .= 'ga:pagePath=~/blog/'; $donefilter = true; } if ($events == 'on') { if ($donefilter) { $filter .= "||"; } $filter .= 'ga:pagePath=~/event/'; $donefilter = true; } if ($pages == 'on') { if ($donefilter) { $filter .= "||"; } $filter .= 'ga:pagePath=~/'; $donefilter = true; } $ga->requestReportData(ga_profile_id, array('pagePath'), array('uniquePageviews'), "-uniquePageviews", $filter, $start_date, $enddate, "1", $count); $transga = array(); $html = ''; foreach ($ga->getResults() as $result) { if (strpos($result->getPagePath(), "show=")) { continue; } if ($k > $items - 1) { break; } $tasktitle = ''; $filtered_pagepath = str_replace(@explode(",", $conf['tab1']['gatidypaths']), "", $result->getPagePath()); if (substr($result->getPagePath(), 0, 6) == '/task/' && $result->getPagePath() != '/task/' && $tasks == 'on') { // only show tasks, but not the tasks landing page $pathparts = explode("/", $result->getPagePath()); $thistask = $pathparts[2]; $tasktitle = false; $taskpod = new Pod('task', $thistask); $taskid = $taskpod->get_field('ID'); $taskslug = $taskpod->get_field('post_name'); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); if ($taskpod->get_field('parent_guide')) { $parentpod = $taskpod->get_field('parent_guide'); $taskpod = new Pod('task', $parentpod[0]['ID']); $taskid = $taskpod->get_field('ID'); $taskslug = $taskpod->get_field('post_name'); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); } if (!$tasktitle) { continue; } if (in_array($taskid, $alreadydone)) { continue; } $k++; $transga[]['uniquePageviews'] = $result->getUniquePageviews(); $transga[]['pagePath'] = "/task/" . $taskslug; } if (substr($result->getPagePath(), 0, 10) == '/projects/' && $result->getPagePath() != '/about/projects/' && $projects == 'on') { // only show projects, but not the projects landing page $pathparts = explode("/", $result->getPagePath()); $thistask = $pathparts[2]; $taskpod = new Pod('projects', $thistask); $taskid = $taskpod->get_field('ID'); $taskslug = $taskpod->get_field('post_name'); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); if ($taskpod->get_field('parent_project')) { $parentpod = $taskpod->get_field('parent_project'); $taskpod = new Pod('projects', $parentpod[0]['ID']); $taskid = $taskpod->get_field('ID'); $taskslug = $taskpod->get_field('post_name'); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); } if (!$tasktitle) { continue; } if (in_array($taskid, $alreadydone)) { continue; } $k++; $transga[]['uniquePageviews'] = $result->getUniquePageviews(); $transga[]['pagePath'] = "/projects/" . $taskslug; } if (substr($result->getPagePath(), 0, 11) == '/vacancies/' && $result->getPagePath() != '/about/vacancies/' && $vacancies == 'on') { // only show vacancies, but not the vacancies landing page $pathparts = explode("/", $result->getPagePath()); $thistask = $pathparts[2]; $taskpod = new Pod('vacancies', $thistask); $taskid = $taskpod->get_field('ID'); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); if (!$tasktitle) { continue; } if (in_array($taskpod->get_field('ID'), $alreadydone)) { continue; } $k++; $transga[]['uniquePageviews'] = $result->getUniquePageviews(); $transga[]['pagePath'] = $result->getPagePath(); } if (substr($result->getPagePath(), 0, 6) == '/news/' && $result->getPagePath() != '/news/' && $news == 'on') { // only show news, but not the news landing page $pathparts = explode("/", $result->getPagePath()); $thistask = $pathparts[2]; $taskpod = new Pod('news', $thistask); $taskid = $taskpod->get_field('ID'); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); if (!$tasktitle) { continue; } if (in_array($taskpod->get_field('ID'), $alreadydone)) { continue; } $k++; $transga[]['uniquePageviews'] = $result->getUniquePageviews(); $transga[]['pagePath'] = $result->getPagePath(); } if (substr($result->getPagePath(), 0, 6) == '/blog/' && $result->getPagePath() != '/blog/' && $blog == 'on') { // only show news, but not the news landing page $pathparts = explode("/", $result->getPagePath()); $thistask = $pathparts[2]; $taskpod = new Pod('blog', $thistask); $taskid = $taskpod->get_field('ID'); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); if (!$tasktitle) { continue; } if (in_array($taskpod->get_field('ID'), $alreadydone)) { continue; } $k++; $transga[]['uniquePageviews'] = $result->getUniquePageviews(); $transga[]['pagePath'] = $result->getPagePath(); } if (substr($result->getPagePath(), 0, 7) == '/event/' && $result->getPagePath() != '/events/' && $events == 'on') { // only show news, but not the news landing page $pathparts = explode("/", $result->getPagePath()); $thistask = $pathparts[2]; $taskpod = new Pod('event', $thistask); $taskid = $taskpod->get_field('ID'); $tasktitle = govintranetpress_custom_title($taskpod->get_field('title')); if (!$tasktitle) { continue; } if (in_array($taskpod->get_field('ID'), $alreadydone)) { continue; } $k++; $transga[]['uniquePageviews'] = $result->getUniquePageviews(); $transga[]['pagePath'] = $result->getPagePath(); } if ($pages == 'on' && !$tasktitle) { // show pages $pathparts = explode("/", $result->getPagePath()); $countparts = count($pathparts) - 2; $thistask = $pathparts[intval($countparts)]; if (!in_array($thistask, array('how-do-i', 'task-by-category', 'news-by-category', 'newspage', 'tagged', 'atoz', 'about', 'home', 'events', 'blog', 'activate', 'register', 'members', 'activity', 'forums', 'jargon-buster'))) { $q = "select post_title, ID from wp_posts where post_name = '" . $thistask . "' and post_status='publish' and post_type='page';"; global $wpdb; $thispage = $wpdb->get_results($q, ARRAY_A); foreach ($thispage as $t) { $tasktitle = govintranetpress_custom_title($t['post_title']); $taskid = $t['ID']; } if (!$tasktitle) { continue; } if (in_array($taskid, $alreadydone)) { continue; } $k++; $transga[]['uniquePageviews'] = $result->getUniquePageviews(); $transga[]['pagePath'] = $result->getPagePath(); } else { continue; } } if ($tasktitle != '') { $html .= "<li><a href='" . $baseurl . $result->getPagePath() . "'>" . $tasktitle . "</a></li>"; $alreadydone[] = $taskid; } } set_transient('cached_ga', $transga, 60 * 60 * $cache); // set cache period } if ($k == 0) { $html = "<li>Looks like nobody has visited the intranet recently.</li>"; } // end of popular pages echo "<ul id='ga_" . $_REQUEST['mode'] . "'>" . $html . "</ul>"; wp_reset_query(); ?> <?php echo $after_widget; ?> <?php }
if (empty($pdf_uri)) { $pdf_uri = $pod->get_field('article_pdf_uri'); } } // prepend base URI if (!preg_match('/^https?:\\/\\//i', $pdf_uri) && !empty($pdf_uri)) { // Istanbul newspaper follows different URI template if ($pod->get_field('in_publication.slug') == 'istanbul-city-of-intersections') { $pdf_uri = 'http://v0.urban-age.net/publications/newspapers/' . $pdf_uri; } else { $pdf_uri = "http://v0.urban-age.net/0_downloads/" . $pdf_uri; } } $article_publishing_date = $pod->get_field('publishing_date'); if (!$article_publishing_date) { $article_publishing_date = $publication_pod->get_field('publishing_date'); } $article_tags = $pod->get_field('tags'); $article_authors = $pod->get_field('authors'); // fetch any attachments, replace hostname until we switch to WP+Pods for the whole website $attachments = $pod->get_field('attachments'); /* // legacy code - remove once new website is live and fully tested if(count($attachments)) { foreach($attachments as &$attachment) { $attachment['guid'] = preg_replace('/^https?:\/\/v1\.lsecities\.net/i', 'http://urban-age.net', $attachment['guid']); } } */ ?> <?php
$TRACE_ENABLED = is_user_logged_in(); $TRACE_PREFIX = 'nav-research'; $current_post_id = $post->ID; global $IN_CONTENT_AREA; global $HIDE_CURRENT_PROJECTS, $HIDE_PAST_PROJECTS; $BASE_URI = PODS_BASEURI_RESEARCH_PROJECTS; echo var_trace('HIDE_CURRENT_PROJECTS: ' . $HIDE_CURRENT_PROJECTS, $TRACE_PREFIX, $TRACE_ENABLED); echo var_trace('HIDE_PAST_PROJECTS: ' . $HIDE_PAST_PROJECTS, $TRACE_PREFIX, $TRACE_ENABLED); echo var_trace('post ID: ' . $current_post_id, $TRACE_PREFIX, $TRACE_ENABLED); echo var_trace(var_export($pod, true), $TRACE_PREFIX, $TRACE_ENABLED); $projects_pod = new Pod('research_project'); $current_projects_list = array(); $projects_pod->findRecords(array('where' => 'status.name = "active"')); $current_projects = array(); while ($projects_pod->fetchRecord()) { array_push($current_projects_list, array('slug' => $projects_pod->get_field('slug'), 'name' => $projects_pod->get_field('name'), 'stream' => $projects_pod->get_field('research_stream.name'))); $current_projects[$projects_pod->get_field('research_stream.name')] = array(); } echo var_trace('projects: ' . var_export($current_projects_list, true), $TRACE_PREFIX, $TRACE_ENABLED); foreach ($current_projects_list as $project) { $key = $project['stream']; array_push($current_projects[$key], $project); } echo var_trace('projects (by stream): ' . var_export($current_projects, true), $TRACE_PREFIX, $TRACE_ENABLED); $past_projects_list = array(); $projects_pod->findRecords(array('where' => 'status.name = "completed"')); $past_projects = array(); while ($projects_pod->fetchRecord()) { array_push($past_projects_list, array('slug' => $projects_pod->get_field('slug'), 'name' => $projects_pod->get_field('name'), 'stream' => $projects_pod->get_field('research_stream.name'))); $past_projects[$projects_pod->get_field('research_stream.name')] = array(); }
$nav .= 'Contact Name'; } else { $nav .= '<a href="' . $const['PAGE_LEADS'] . '/byname">Contact Name</a>'; } $nav .= '</p>'; echo '<h2>Lead List Access</h2>'; echo '<p>This page lists all website visitor registrations for which no event date was listed or where the event date falls in the future. '; echo 'You can also <a href="', $const['PAGE_LEADS'], '/download">download all leads</a> as an Excel-compatible CSV file.</p>'; echo '<p> </p>'; echo $nav; $leads = new Pod('user_profiles'); $leads->findRecords($sortby, -1, "t.event_date = '0000-00-00 00:00:00' OR t.event_date >= NOW()"); $total = $leads->getTotalRows(); if ($total > 0) { while ($leads->fetchRecord()) { $lead_name = $leads->get_field('name'); $lead_edate = iif($leads->get_field('event_date') == '0000-00-00 00:00:00', '<i>date not specified</i>', substr($leads->get_field('event_date'), 0, 10)); $lead_idate = substr($leads->get_field('inquire_date'), 0, 10); $lead_contact = iif($leads->get_field('email') != '', '<a href="mailto:' . $leads->get_field('email') . '">' . $leads->get_field('email') . '</a>', '<i>no email given</i>') . ' | '; $lead_contact .= iif($leads->get_field('phone') != '', $leads->get_field('phone'), '<i>no phone given</i>'); $lead_address = $leads->get_field('address') . ', ' . $leads->get_field('city') . ' ' . $leads->get_field('state') . ' ' . $leads->get_field('zipcode'); $lead_interested = ''; $ainterests = array(); if ($leads->get_field('interest_weddings') == '1') { $ainterests[] = 'Weddings'; } if ($leads->get_field('interest_social') == '1') { $ainterests[] = 'Social Events'; } if ($leads->get_field('interest_corporate') == '1') { $ainterests[] = 'Corporate Events';
*/ include_once 'guide-functions.php'; get_header(); $s = mysql_real_escape_string(strip_tags($_GET['s'])); $sqlwhere = "profile_type = 'platinum' " . "AND ((t.name LIKE '%{$s}%') " . "OR (category1 LIKE '%{$s}%') " . "OR (category2 LIKE '%{$s}%') " . "OR (category3 LIKE '%{$s}%') " . "OR (category4 LIKE '%{$s}%') " . "OR (category5 LIKE '%{$s}%') " . ")"; $vp = new Pod('vendor_profiles'); $vp->findRecords('id', -1, $sqlwhere); $total_vps = $vp->getTotalRows(); $avp = array(); if ($total_vps > 0) { ?> <div class="ruled left"><span class="head2 ruled-text-left">Vendors Matching Your Search</span></div> <?php while ($vp->fetchRecord()) { // get our fields from the POD $avp[$vp->get_field('id')] = get_vendorfields($vp); //pod_query("UPDATE wp_pod_tbl_vendor_profiles SET list_views = list_views + 1 WHERE id = " . $vp->get_field('id')); } } //if (in_array($cur_cat, array('venues','dining', 'search')) ) { // show_googlemap($avp); //} shuffle($avp); foreach ($avp as $vid => $fields) { // format our address, if at all $addr = ''; if ($fields["is_venue"]) { $addr = "{$fields['mapaddr']}{$fields['city']}, {$fields['stat']} {$fields['zipc']}"; } // create our rating box $rating_data = get_ratingbox($fields['rati']);
\t\t<loc>http://{$subdomain}.occasionsonline.com/atlanta/{$slug}</loc> \t\t<lastmod>{$stamp}</lastmod> \t\t<changefreq>always</changefreq> \t\t<priority>0.8</priority> \t</url> XMLOUT; } } // ===================================================== // OUTPUT THE SUB-CATEGORIES // ===================================================== $types = new Pod('venue_types'); $types->findRecords('', 0, '', 'SELECT slug FROM wp_pod_tbl_venue_types ORDER BY name'); if ($types->getTotalRows() > 0) { while ($types->fetchRecord()) { $slug = $types->get_field('slug'); echo <<<XMLOUT \t<url> \t\t<loc>http://{$subdomain}.occasionsonline.com/atlanta/venues/{$slug}</loc> \t\t<lastmod>{$stamp}</lastmod> \t\t<changefreq>always</changefreq> \t\t<priority>0.7</priority> \t</url> XMLOUT; } } echo <<<XMLOUT </urlset> XMLOUT ;
<?php /* Template name: News category page */ $catquery = @explode("=", $query_string); if ($catquery[1] == "news") { wp_redirect('/newspage/'); } get_header(); $cat_name = $_GET['cat']; $catpod = new Pod('category', $cat_name); $catname = $catpod->get_field('name'); $catslug = $catpod->get_field('slug'); //echo $catslug; $catid = $catpod->get_field('id'); //echo $catid; ?> <div class="col-lg-7 col-md-8 col-sm-12 white"> <div class="row"> <div class='breadcrumbs'> <a title="Go to Home." href="<?php echo site_url(); ?> /" class="site-home">Home</a> » <a title="Go to News" href="<?php echo site_url(); ?> /newspage/">News</a> » <?php echo $catname;
* URI: /media/objects/events/ */ global $pods; $TRACE_PODS_EVENTS_FRONTPAGE = true; // check if we are getting called via Pods (pods_url_variable is set) $pod_slug = pods_url_variable(3); if ($pod_slug) { $pod = new Pod('event', $pod_slug); } else { $pod_slug = get_post_meta($post->ID, 'pod_slug', true); $pod = new Pod('conference', $pod_slug); } if ($TRACE_PODS_EVENTS_FRONTPAGE) { error_log('pod_slug: ' . $pod_slug); } $button_links = $pod->get_field('links'); $slider = $pod->get_field('slider'); if (!$slider) { $featured_image_uri = get_the_post_thumbnail($post->ID, array(960, 367)); } ?> <?php get_header(); ?> <div role="main"> <?php if (have_posts()) { the_post();
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $largeitems = intval($instance['largeitems']); $mediumitems = intval($instance['mediumitems']); $thumbnailitems = intval($instance['thumbnailitems']); $listitems = intval($instance['listitems']); global $post; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo "<div id='ht-feature-news'>"; //load manual sticky news stories $hc = new Pod('homepage_control'); $top_slot = $hc->get_field('top_news_story'); //forumalate grid of news stories and formats $totalstories = $largeitems + $mediumitems + $thumbnailitems + $listitems; $newsgrid = array(); for ($i = 1; $i <= $totalstories; $i++) { if ($i <= $largeitems) { $newsgrid[] = "L"; } elseif ($i <= $largeitems + $mediumitems) { $newsgrid[] = "M"; } elseif ($i <= $largeitems + $mediumitems + $thumbnailitems) { $newsgrid[] = "T"; } elseif ($i <= $largeitems + $mediumitems + $thumbnailitems + $listitems) { $newsgrid[] = "Li"; } } $siteurl = site_url(); //manual override news stories //display sticky top news stories $num_top_slots = count($top_slot); $to_fill = $totalstories - $num_top_slots; $k = -1; $alreadydone = array(); if ($num_top_slots > 0) { foreach ((array) $top_slot as $slot) { $newspod = new Pod('news', $slot['ID']); if ($newspod->get_field('post_status') != 'publish') { continue; } $k++; $alreadydone[] = $slot['ID']; if (function_exists('get_video_thumbnail')) { $videostill = get_video_thumbnail($slot['ID']); } $thistitle = govintranetpress_custom_title($slot['post_title']); $thisURL = $slot['post_name']; if ($newsgrid[$k] == "L") { $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($slot['ID']), 'newshead'); if ($image_uri != "" && $videostill == '') { echo "<a href='" . $siteurl . "/news/" . $slot['post_name'] . "/'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot) . "' /></a>"; } } if ($newsgrid[$k] == "M") { $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($slot['ID']), 'medium'); if ($image_uri != "" && $videostill == '') { echo "<a href='" . $siteurl . "/news/" . $slot['post_name'] . "/'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot) . "' /></a>"; } } if ($newsgrid[$k] == "T") { $image_uri = "<a class='pull-right' href='" . $siteurl . "/news/" . $slot['post_name'] . "/'>" . get_the_post_thumbnail($slot['ID'], 'thumbnail', array('class' => 'media-object hidden-xs')) . "</a>"; if ($image_uri != "" && $videostill == '') { $image_url = "<a href='" . $siteurl . "/news/" . $slot['post_name'] . "/'>" . $image_uri . "</a>"; } } $thisdate = $slot['post_date']; $post = get_post($slot['ID']); setup_postdata($post); $thisexcerpt = get_the_excerpt(); $thisdate = date("j M Y", strtotime($thisdate)); echo "<h3 class='noborder'><a class='' href='" . $thisURL . "'>" . $thistitle . "</a></h3>"; if ($newsgrid[$k] == "Li") { echo "<p><span class='news_date'>" . $thisdate . ""; echo " <a class='more' href='{$thisURL}' title='{$thistitle}'>Read more</a></span></p>"; } else { echo "<p><span class='news_date'>" . $thisdate . "</span></p>"; } if ($newsgrid[$k] == "T") { echo "<div class='media'>" . $image_url; } echo "<div class='media-body'>"; if ($newsgrid[$k] != "Li") { echo $thisexcerpt . "<p class='news_date'>"; echo "<a class='more' href='{$thisURL}' title='{$thistitle}'>Read more</a></p>"; } echo "</div>"; if ($newsgrid[$k] == "T") { echo "</div>"; } echo "<hr class='light' />\n"; } } //end of stickies //display remaining stories $cquery = array('orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'news', 'posts_per_page' => $totalstories, 'meta_query' => array(array('key' => 'news_listing_type', 'value' => 0))); $news = new WP_Query($cquery); if ($news->post_count == 0) { echo "Nothing to show."; } while ($news->have_posts()) { $news->the_post(); if (in_array($post->ID, $alreadydone)) { //don't show if already in stickies continue; } $k++; if ($k >= $totalstories) { break; } $thistitle = get_the_title($news->ID); $newspod = new Pod('news', $news->ID); $newspod->display('title'); $thisURL = get_permalink($news->ID); if ($newsgrid[$k] == "L") { $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($news->ID), 'newshead'); if ($image_uri != "" && $videostill == '') { echo "<a href='{$thisURL}'><img class='img img-responsive' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot) . "' /></a>"; } } if ($newsgrid[$k] == "M") { $image_uri = wp_get_attachment_image_src(get_post_thumbnail_id($news->ID), 'medium'); if ($image_uri != "" && $videostill == '') { echo "<a href='{$thisURL}'><img class='img' src='{$image_uri[0]}' width='{$image_uri[1]}' height='{$image_uri[2]}' alt='" . govintranetpress_custom_title($slot) . "' /></a>"; } } if ($newsgrid[$k] == "T") { $image_uri = "<a class='pull-right' href='{$thisURL}'>" . get_the_post_thumbnail($news->ID, 'thumbnail', array('class' => 'media-object hidden-xs')) . "</a>"; if ($image_uri != "" && $videostill == '') { $image_url = "<a href='{$thisURL}'>" . $image_uri . "</a>"; } } $thisdate = get_the_date(); $thisexcerpt = get_the_excerpt(); $thisdate = date("j M Y", strtotime($thisdate)); echo "<h3 class='noborder'><a class='' href='" . $thisURL . "'>" . $thistitle . "</a></h3>"; if ($newsgrid[$k] == "Li") { echo "<p><span class='news_date'>" . $thisdate . ""; echo " <a class='more' href='{$thisURL}' title='{$thistitle}'>Read more</a></span></p>"; } else { echo "<p><span class='news_date'>" . $thisdate . "</span></p>"; } if ($newsgrid[$k] == "T") { echo "<div class='media'>" . $image_url; } echo "<div class='media-body'>"; if ($newsgrid[$k] != "Li") { echo $thisexcerpt . "<p class='news_date'>"; echo "<a class='more' href='{$thisURL}' title='{$thistitle}'>Read more</a></p>"; } echo "</div>"; if ($newsgrid[$k] == "T") { echo "</div>"; } echo "<hr class='light' />\n"; } echo "</div>"; wp_reset_query(); ?> <div class="category-block"><p><strong><a title='More in news' class="small" href="<?php echo $siteurl; ?> /newspage/">More in news</a></strong> <i class='glyphicon glyphicon-chevron-right small'></i></p></div> <?php echo $after_widget; }
echo '<p>', $a['desc'], '</p>'; if ($a['offe']) { echo '<div id="special_offer">'; echo '<h2>Special Offer</h2>'; echo '<p>', $a['offe'], '</p>'; echo '</div>'; } //if ($_SERVER['REMOTE_ADDR'] == '76.17.3.14' || $_SERVER['REMOTE_ADDR'] == '74.232.88.164') { // Heather: 74.232.88.164 echo '<div id="special_offer">'; echo '<h2>Customer Reviews</h2>'; $comments = new Pod('comments'); $comments->findRecords('id', -1, "t.vendor = '{$a['id']}'"); $total_comments = $comments->getTotalRows(); if ($total_comments > 0) { while ($comments->fetchRecord()) { $comment = $comments->get_field('comment'); $name = $comments->get_field('name'); $rating = $comments->get_field('rating'); $rating_box = get_ratingbox($rating); echo "{$rating_box}<div class=\"pro_review\"><p>Review by: <b>{$name}</b></p>"; echo "<p>{$comment}</p></div>"; } } $rand1 = rand(1, 9); $rand2 = rand(1, 9); $rand3 = $rand1 * 2; $rand4 = $rand2 * 2; $spam_html = recaptcha_get_html($publickey, null, true); $review_form = <<<HEREDOC \t<p>Please fill out ALL the fields below. Your email is required for verification purposes only and will not be published. All fields are REQUIRED.</p> \t<form action="/profile/{$slug}" method="post">
} ?> <?php the_content(); ?> </div> <div class="col-lg-3 col-md-3 col-sm-12"> <?php the_post_thumbnail('large', array('class' => 'img img-responsive')); echo wpautop("<p class='news_date'>" . get_post_thumbnail_caption() . "</p>"); $thispage = new Pod('page', $id); $relatedpages = $thispage->get_field('page_related_pages'); $relatedtasks = $thispage->get_field('page_related_tasks'); if (taxonomy_exists('team')) { $relatedteams = get_the_terms($id, 'team'); } if ($relatedpages) { foreach ((array) $relatedpages as $r) { if ($r['post_status'] == 'publish' && $r['ID'] != $id) { $html .= "<li><a href='" . $r['guid'] . "'>" . $r['post_title'] . "</a></li>"; } } } if ($relatedtasks) { foreach ((array) $relatedtasks as $r) { if ($r['post_status'] == 'publish' && $r['ID'] != $id) { $html .= "<li><a href='" . site_url() . "/tasks/" . $r['post_name'] . "'>" . $r['post_title'] . "</a></li>";
function process_session($session_slug) { global $TRACE_PODS_EVENT_PROGRAMME; $ALLOWED_TAGS_IN_BLURBS = '<strong><em>'; $pod = new Pod('event_session', $session_slug); $session_id = $pod->get_field('slug'); $session_title = $pod->get_field('name'); $session_subtitle = $pod->get_field('session_subtitle'); $show_times = $pod->get_field('show_times'); $session_start = new DateTime($pod->get_field('start')); $session_start = $session_start->format('H:i'); $session_end = new DateTime($pod->get_field('end')); $session_end = $pod->get_field('end') == '0000-00-00 00:00:00' ? null : $session_end->format('H:i'); if ($pod->get_field('show_times')) { $session_times = is_null($session_end) ? "{$session_start}   " : "{$session_start} — {$session_end}   "; } $hide_title = $pod->get_field('hide_title'); $session_type = $pod->get_field('session_type.slug'); if ($session_type != 'session') { $session_type = "session {$session_type}"; } $session_speakers = $pod->get_field('speakers'); $session_speakers_blurb = strip_tags($pod->get_field('speakers_blurb'), $ALLOWED_TAGS_IN_BLURBS); $session_chairs = $pod->get_field('chairs'); $session_chairs_blurb = strip_tags($pod->get_field('chairs_blurb'), $ALLOWED_TAGS_IN_BLURBS); $session_respondents = $pod->get_field('respondents'); $session_respondents_blurb = strip_tags($pod->get_field('respondents_blurb'), $ALLOWED_TAGS_IN_BLURBS); $session_youtube_video = $pod->get_field('media_items.youtube_uri'); $session_slides = $pod->get_field('media_items.slides_uri'); $subsessions = $pod->get_field('sessions.slug'); if ($subsessions and count($subsessions) == 1) { $subsessions = array(0 => $subsessions); } if ($TRACE_PODS_EVENT_PROGRAMME) { error_log($TRACE_PREFIX . 'session count: ' . count($subsessions)); } if ($TRACE_PODS_EVENT_PROGRAMME) { error_log($TRACE_PREFIX . 'sessions: ' . var_export($subsessions, true)); } echo "<div id='{$session_id}' class='{$session_type}'>"; if ($session_title and !$hide_title) { echo '<h2>' . $session_times . $session_title . '</h2>'; } if ($session_subtitle and !$hide_title) { echo "<h3>{$session_subtitle}</h3>"; } if ($session_chairs) { $caption = count($session_chairs) > 1 ? "Chairs" : "Chair"; echo "<dl class='session-chairs'><dt>{$caption}: </dt><dd>{$session_chairs_blurb}</dd></dl>"; } if ($session_speakers) { echo "<div>{$session_speakers_blurb}</div>"; } if ($session_youtube_video or $session_slides) { echo '<ul class="mediaitems">'; if ($session_youtube_video) { echo "<li class='link video'><a href='http://youtube.com/watch?v={$session_youtube_video}'>Watch video</a></li>"; } if ($session_slides) { echo "<li class='link slides'><a href='http://downloads0.cloud.lsecities.net/{$session_slides}'>Browse slides</a></li>"; } echo '</ul>'; } if ($subsessions) { foreach ($subsessions as $session) { process_session($session); } } echo "</div>"; }
function generate_person_profile($slug, $extra_title, $mode = MODE_FULL_LIST) { $LEGACY_PHOTO_URI_PREFIX = 'http://v0.urban-age.net'; $pod = new Pod('authors', $slug); $fullname = $pod->get_field('name') . ' ' . $pod->get_field('family_name'); $fullname = trim($fullname); $title = $pod->get_field('title'); $fullname_for_heading = $fullname; if ($title) { $fullname_for_heading .= " ({$title})"; } if ($extra_title) { $fullname_for_heading .= ' ' . $extra_title; } $qualifications_list = array_map(function ($string) { return trim($string); }, explode("\n", $pod->get_field('qualifications'))); $profile_photo_uri = $pod->get_field('photo.guid'); $email_address = preg_replace('/\\@/', ' [AT] ', $pod->get_field('email_address')); if (!$profile_photo_uri and $pod->get_field('photo_legacy')) { $profile_photo_uri = $LEGACY_PHOTO_URI_PREFIX . $pod->get_field('photo_legacy'); } $blurb = $pod->get_field('staff_pages_blurb'); $organization = '<span class=\'org\'>' . $pod->get_field('organization') . '</span>'; $role = '<span class=\'role\'>' . $pod->get_field('role') . '</span>'; if ($role and $organization) { $affiliation = $role . ', ' . $organization; } elseif (!$role and $organization) { $affiliation = $organization; } elseif ($role and !$organization) { $affiliation = $role; } $additional_affiliations = $pod->get_field('additional_affiliations'); if ($additional_affiliations) { $additional_affiliations = explode('\\n', $additional_affiliations); foreach ($additional_affiliations as $additional_affiliation) { $affiliation .= "<br />\n" . $additional_affiliation; } } if ($mode == MODE_FULL_LIST) { $output = "<li class='person row vcard' id='p-{$slug}'>"; $output .= " <div class='fourcol profile-photo'>"; if ($profile_photo_uri) { $output .= " <img class='photo' src='{$profile_photo_uri}' alt='{$fullname} - photo'/>"; } else { $output .= " "; } $output .= " </div>"; $output .= " <div class='eightcol last'>"; $output .= " <h1 class='fn'>{$fullname_for_heading}</h1>"; if ($qualifications_list) { $output .= "<div class='qualifications'>"; foreach ($qualifications_list as $qualification) { $output .= "<span>{$qualification}</span> "; } $output = rtrim($output, ' '); $output .= "</div>"; } if ($affiliation) { $output .= " <p>{$affiliation}</p>"; } if ($email_address) { $output .= " <p class='email'>{$email_address}</p>"; } if ($blurb) { $output .= " {$blurb}"; } $output .= " </div>"; $output .= "</li>"; } elseif ($mode == MODE_SUMMARY) { $output = "<li class='person row' id='p-{$slug}-link'>"; $output .= "<a href='#p-{$slug}'>{$fullname}</a>"; $output .= "</li>"; } return $output; }
/** * Export a pod item * * $params['datatype'] string The datatype name * $params['tbl_row_id'] int The item's ID from the wp_pod_tbl_* table * * @param array $params An associative array of parameters * @return int The table row ID * @since 1.12 */ function export_pod_item($params) { if (defined('PODS_STRICT_MODE') && PODS_STRICT_MODE) { $params = pods_sanitize($params); } $params = (object) $params; $data = false; $columns = $this->fields; if (empty($columns) || $this->dtname != $params->datatype) { $pod = $this->load_pod(array('name' => $params->datatype)); $columns = $pod['fields']; if (null === $this->dtname) { $this->dtname = $pod['name']; $this->dt = $pod['id']; $this->fields = $pod['fields']; } } $pod = new Pod($params->datatype, $params->tbl_row_id); if (!empty($pod->data)) { $data = array(); foreach ($columns as $column) { $value = $pod->get_field($column['name']); if (0 < strlen($value)) { $data[$column['name']] = $value; } } $data = apply_filters('export_pod_item', $data, $pod->datatype, $pod->get_field('id')); } return $data; }
function mh_author_box($author_ID = '') { $mh_magazine_lite_options = mh_magazine_lite_theme_options(); if (isset($mh_magazine_lite_options['author_box'])) { if (!$mh_magazine_lite_options['author_box'] && !is_attachment() && get_the_author_meta('description', $author_ID)) { $author_ID = get_the_author_meta('ID'); $ab_output = true; } else { $ab_output = false; } } elseif (!is_attachment() && get_the_author_meta('description', $author_ID)) { $author_ID = get_the_author_meta('ID'); $ab_output = true; } else { $ab_output = false; } if ($ab_output) { $myUser = new Pod('user', $author_ID); $user_city = $myUser->get_field('city'); $user_photo = $myUser->get_field('avartar_photo'); $userPhoto = $user_photo[0]['guid']; $userPhoto = '<img class="avatar avatar-113 photo" src="http://cdn.cdnfarecompare.com/resources/mcms/eventimages/' . basename($userPhoto) . '" height="113" width="113" />'; echo '<section class="author-box">' . "\n"; echo '<div class="author-box-wrap group">' . "\n"; echo '<h3><svg class="icon icon-pencil"><use xlink:href="#icon-pencil"></use></svg>About the Author</h3>'; echo '<div class="author-avatar">' . $userPhoto . '</div>' . "\n"; echo '<h4 class="author-name">' . __('', 'mh-magazine-lite') . esc_attr(get_the_author_meta('display_name', $author_ID)) . '</h4>' . "\n"; echo '<span class="author-city">' . $user_city . '</span>' . "\n"; echo '<div class="author-box-desc">' . wp_kses_post(get_the_author_meta('description', $author_ID)) . '</div>' . "\n"; echo '</div>' . "\n"; echo '</section>' . "\n"; } }
} else { if (function_exists('get_wp_user_avatar')) { $imgsrc = get_wp_user_avatar_src($u['user_id'], 'thumbnail'); if ($directorystyle == 1) { $avatarhtml = "<img class='img img-circle alignleft' src='" . $imgsrc . "' width='66' height='66' alt='" . $displayname . "' />"; } else { $avatarhtml = "<img class='img alignleft' src='" . $imgsrc . "' width='66' height='66' alt='" . $displayname . "' />"; } } else { $avatarhtml = get_avatar($u['user_id'], 66, array('class' => 'alignleft')); $avatarhtml = str_replace("photo", "photo alignleft", $avatarhtml); } $html .= "<div class='col-lg-4 col-md-4 col-sm-6'><div class='indexcard'><a href='" . site_url() . "/staff/" . $user_info->user_nicename . "/'><div class='media'>" . $avatarhtml . "<div class='media-body'><strong>" . $displayname . "</strong>" . $gradedisplay . "<br>"; // display team name(s) $poduser = new Pod('user', $userid); $terms = $poduser->get_field('user_team'); unset($poduser); foreach ($terms as $taxonomy) { //print_r($taxonomy); //echo $taxonomy['name']; $themeid = $taxonomy['term_id']; $themeparent = $taxonomy['parent']; if ($themeparent == 0) { $teamlist = govintranetpress_custom_title($taxonomy['name']); $html .= "" . $teamlist . "<br>"; //echo $teamlist; } else { while ($themeparent != 0) { $newteam = get_term_by('id', $themeparent, 'team'); $themeparent = $newteam->parent; }
/** * @param $import * @param bool $output */ public function heres_the_beef($import, $output = true) { global $wpdb; $api = pods_api(); for ($i = 0; $i < 40000; $i++) { echo " \t"; // extra spaces } $default_data = array('pod' => null, 'table' => null, 'reset' => null, 'update_on' => null, 'where' => null, 'fields' => array(), 'row_filter' => null, 'pre_save' => null, 'post_save' => null, 'sql' => null, 'sort' => null, 'limit' => null, 'page' => null, 'output' => null, 'page_var' => 'ipg', 'bypass_helpers' => false); $default_field_data = array('field' => null, 'filter' => null); if (!is_array($import)) { $import = array($import); } elseif (empty($import)) { die('<h1 style="color:red;font-weight:bold;">ERROR: No imports configured</h1>'); } $import_counter = 0; $total_imports = count($import); $paginated = false; $avg_time = -1; $total_time = 0; $counter = 0; $avg_unit = 100; $avg_counter = 0; foreach ($import as $datatype => $data) { $import_counter++; flush(); @ob_end_flush(); usleep(50000); if (!is_array($data)) { $datatype = $data; $data = array('table' => $data); } if (isset($data[0])) { $data = array('table' => $data[0]); } $data = array_merge($default_data, $data); if (null === $data['pod']) { $data['pod'] = array('name' => $datatype); } if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - <em>" . $data['pod']['name'] . "</em> - <strong>Loading Pod: " . $data['pod']['name'] . "</strong>\n"; } if (2 > count($data['pod'])) { $data['pod'] = $api->load_pod(array('name' => $data['pod']['name'])); } if (empty($data['pod']['fields'])) { continue; } if (null === $data['table']) { $data['table'] = $data['pod']['name']; } if ($data['reset'] === true) { if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - <strong style='color:blue;'>Resetting Pod: " . $data['pod']['name'] . "</strong>\n"; } $api->reset_pod(array('id' => $data['pod']['id'], 'name' => $data['pod']['name'])); } if (null === $data['sort'] && null !== $data['update_on'] && isset($data['fields'][$data['update_on']])) { if (isset($data['fields'][$data['update_on']]['field'])) { $data['sort'] = $data['fields'][$data['update_on']]['field']; } else { $data['sort'] = $data['update_on']; } } $page = 1; if (false !== $data['page_var'] && isset($_GET[$data['page_var']])) { $page = absval($_GET[$data['page_var']]); } if (null === $data['sql']) { $data['sql'] = "SELECT * FROM {$data['table']}" . (null !== $data['where'] ? " WHERE {$data['where']}" : '') . (null !== $data['sort'] ? " ORDER BY {$data['sort']}" : '') . (null !== $data['limit'] ? " LIMIT " . (1 < $page ? ($page - 1) * $data['limit'] . ',' : '') . "{$data['limit']}" : ''); } if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - Getting Results: " . $data['pod']['name'] . "\n"; } if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - Using Query: <small><code>" . $data['sql'] . "</code></small>\n"; } $result = $wpdb->get_results($data['sql'], ARRAY_A); if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - Results Found: " . count($result) . "\n"; } $avg_time = -1; $total_time = 0; $counter = 0; $avg_unit = 100; $avg_counter = 0; $result_count = count($result); $paginated = false; if (false !== $data['page_var'] && $result_count == $data['limit']) { $paginated = "<input type=\"button\" onclick=\"document.location=\\'" . pods_ui_var_update(array($data['page_var'] => $page + 1), false, false) . "\\';\" value=\" Continue Import » \" />"; } if ($result_count < $avg_unit && 5 < $result_count) { $avg_unit = number_format($result_count / 5, 0, '', ''); } elseif (2000 < $result_count && 10 < count($data['pod']['fields'])) { $avg_unit = 40; } $data['count'] = $result_count; timer_start(); if (false !== $output && 1 == $import_counter) { echo "<div style='width:50%;background-color:navy;padding:10px 10px 30px 10px;color:#FFF;position:absolute;top:10px;left:25%;text-align:center;'><p id='progress_status' align='center'>" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - Running Importer..</p><br /><small>This will automatically update every " . $avg_unit . " rows</small></div>\n"; } foreach ($result as $k => $row) { flush(); @ob_end_flush(); usleep(50000); if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - Processing Row #" . ($k + 1) . "\n"; } if (null !== $data['row_filter'] && function_exists($data['row_filter'])) { if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - Filtering <strong>" . $data['row_filter'] . "</strong> on Row #" . ($k + 1) . "\n"; } $row = $data['row_filter']($row, $data); } if (!is_array($row)) { continue; } $params = array('datatype' => $data['pod']['name'], 'columns' => array(), 'bypass_helpers' => $data['bypass_helpers']); foreach ($data['pod']['fields'] as $fk => $field_info) { $field = $field_info['name']; if (!empty($data['fields']) && !isset($data['fields'][$field]) && !in_array($field, $data['fields'])) { continue; } if (isset($data['fields'][$field])) { if (is_array($data['fields'][$field])) { $field_data = $data['fields'][$field]; } else { $field_data = array('field' => $data['fields'][$field]); } } else { $field_data = array(); } if (!is_array($field_data)) { $field = $field_data; $field_data = array(); } $field_data = array_merge($default_field_data, $field_data); if (null === $field_data['field']) { $field_data['field'] = $field; } $data['fields'][$field] = $field_data; $value = ''; if (isset($row[$field_data['field']])) { $value = $row[$field_data['field']]; } if (null !== $field_data['filter']) { if (function_exists($field_data['filter'])) { if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - Filtering <strong>" . $field_data['filter'] . "</strong> on Field: " . $field . "\n"; } $value = $field_data['filter']($value, $row, $data); } else { $value = ''; } } if (1 > strlen($value) && 1 == $field_info['required']) { die('<h1 style="color:red;font-weight:bold;">ERROR: Field Required for <strong>' . $field . '</strong></h1>'); } $params['columns'][$field] = $value; unset($value); unset($field_data); unset($field_info); unset($fk); } if (empty($params['columns'])) { continue; } $params['columns'] = pods_sanitize($params['columns']); if (null !== $data['update_on'] && isset($params['columns'][$data['update_on']])) { if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - Checking for Existing Item\n"; } $check = new Pod($data['pod']['name']); $check->findRecords(array('orderby' => 't.id', 'limit' => 1, 'where' => "t.{$data['update_on']} = '{$params['columns'][$data['update_on']]}'", 'search' => false, 'page' => 1)); if (0 < $check->getTotalRows()) { $check->fetchRecord(); $params['tbl_row_id'] = $check->get_field('id'); $params['pod_id'] = $check->get_pod_id(); if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - Found Existing Item w/ ID: " . $params['tbl_row_id'] . "\n"; } unset($check); } if (!isset($params['tbl_row_id']) && false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - Existing item not found - Creating New\n"; } } if (null !== $data['pre_save'] && function_exists($data['pre_save'])) { if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - Running Pre Save <strong>" . $data['pre_save'] . "</strong> on " . $data['pod']['name'] . "\n"; } $params = $data['pre_save']($params, $row, $data); } $id = $api->save_pod_item($params); if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - <strong>Saved Row #" . ($k + 1) . " w/ ID: " . $id . "</strong>\n"; } $params['tbl_row_id'] = $id; if (null !== $data['post_save'] && function_exists($data['post_save'])) { if (false !== $output) { echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - Running Post Save <strong>" . $data['post_save'] . "</strong> on " . $data['pod']['name'] . "\n"; } $data['post_save']($params, $row, $data); } unset($params); unset($result[$k]); unset($row); wp_cache_flush(); $wpdb->queries = array(); $avg_counter++; $counter++; if ($avg_counter == $avg_unit && false !== $output) { $avg_counter = 0; $avg_time = timer_stop(0, 10); $total_time += $avg_time; $rows_left = $result_count - $counter; $estimated_time_left = $total_time / $counter * $rows_left / 60; $percent_complete = 100 - $rows_left * 100 / $result_count; echo "<script type='text/javascript'>document.getElementById('progress_status').innerHTML = '" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em><br /><strong>" . $percent_complete . "% Complete</strong><br /><strong>Estimated Time Left:</strong> " . $estimated_time_left . " minute(s) or " . $estimated_time_left / 60 . " hours(s)<br /><strong>Time Spent:</strong> " . $total_time / 60 . " minute(s)<br /><strong>Rows Done:</strong> " . ($result_count - $rows_left) . "/" . $result_count . "<br /><strong>Rows Left:</strong> " . $rows_left . "';</script>\n"; echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - <strong>Updated Status:</strong> " . $percent_complete . "% Complete</strong>\n"; } } if (false !== $output) { $avg_counter = 0; $avg_time = timer_stop(0, 10); $total_time += $avg_time; $rows_left = $result_count - $counter; $estimated_time_left = $total_time / $counter * $rows_left / 60; $percent_complete = 100 - $rows_left * 100 / $result_count; echo "<script type='text/javascript'>document.getElementById('progress_status').innerHTML = '" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em><br /><strong style=\\'color:green;\\'>100% Complete</strong><br /><br /><strong>Time Spent:</strong> " . $total_time / 60 . " minute(s)<br /><strong>Rows Imported:</strong> " . $result_count . (false !== $paginated ? "<br /><br />" . $paginated : '') . "';</script>\n"; echo "<br />" . date('Y-m-d h:i:sa') . " - <em>" . $data['pod']['name'] . "</em> - <strong style='color:green;'>Done Importing: " . $data['pod']['name'] . "</strong>\n"; } unset($result); unset($import[$datatype]); unset($datatype); unset($data); wp_cache_flush(); $wpdb->queries = array(); } if (false !== $output) { $avg_counter = 0; $avg_time = timer_stop(0, 10); $total_time += $avg_time; $rows_left = $result_count - $counter; echo "<script type='text/javascript'>document.getElementById('progress_status').innerHTML = '" . date('Y-m-d h:i:sa') . " - <strong style=\\'color:green;\\'>Import Complete</strong><br /><br /><strong>Time Spent:</strong> " . $total_time / 60 . " minute(s)<br /><strong>Rows Imported:</strong> " . $result_count . (false !== $paginated ? "<br /><br />" . $paginated : '') . "';</script>\n"; echo "<br />" . date('Y-m-d h:i:sa') . " - <strong style='color:green;'>Import Complete</strong>\n"; } }