コード例 #1
0
\t\t</div>
\t\t<div class="pro_contactrow">
\t\t\t<div class="pro_contactlabel"><label for="txt_phone">Phone:</label></div>
\t\t\t<div class="pro_contacttxt"><input name="txt_phone" type="text" size="50" id="txt_phone" value="{$txt_phone}" /></div>
\t\t</div>
\t\t<div class="pro_contactrow">
\t\t\t<div class="pro_contactlabel"><label for="txt_date">Event Date:</label></div>
\t\t\t<div class="pro_contacttxt"><input name="txt_date" type="text" size="50" id="txt_date" value="{$txt_date}"  /></div>
\t\t</div>

\t\t<div class="pro_contactrow">
\t\t\t<div class="pro_contactlabel">Services I am looking for:<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;</div>
HEREDOC;
    $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');
コード例 #2
0
function featuredvendors($title = '<h2>Featured Vendors</h2>', $cat = "", $num_rows = 1, $min = 4)
{
    return;
    $featpod = new Pod('vendor_profiles');
    // leave this here for REFERENCE ONLY, it is not used
    $sql = "SELECT wp_pod_tbl_vendor_profiles.id AS vid, wp_pod_tbl_vendor_profiles.name AS name, wp_pod_tbl_vendor_profiles.slug AS slug, " . "wp_pod_tbl_vendor_profiles.description AS description, v2_profile_image_sm FROM wp_pod_tbl_vendor_profiles " . "JOIN wp_pod ON (wp_pod_tbl_vendor_profiles.id = wp_pod.tbl_row_id) " . "JOIN wp_pod_rel ON (wp_pod.id = wp_pod_rel.pod_id) " . "JOIN wp_pod_tbl_categories ON (wp_pod_rel.tbl_row_id = wp_pod_tbl_categories.id) " . "WHERE " . "wp_pod_rel.field_id = 110 " . "AND profile_type = 'Platinum' ";
    if ($cat == 'services') {
        // leave this here for REFERENCE ONLY, it is not used
        $sql .= "AND wp_pod_tbl_categories.slug NOT IN ('venues','dining', '')";
        $sqlwhere = "profile_type = 'platinum' " . "AND ((category1 NOT IN ('venues','dining', 'uncategorized', '')) " . "OR (category2 NOT IN ('venues','dining', 'uncategorized', '')) " . "OR (category3 NOT IN ('venues','dining', 'uncategorized', '')) " . "OR (category4 NOT IN ('venues','dining', 'uncategorized', '')) " . "OR (category5 NOT IN ('venues','dining', 'uncategorized', '')) " . ")";
    } elseif ($cat != '') {
        // leave this here for REFERENCE ONLY, it is not used
        $sql .= "AND wp_pod_tbl_categories.slug = '{$cat}'";
        $sqlwhere = "profile_type = 'platinum' " . "AND ((category1 = '{$cat}') " . "OR (category2 = '{$cat}') " . "OR (category3 = '{$cat}') " . "OR (category4 = '{$cat}') " . "OR (category5 = '{$cat}') " . ")";
    } else {
    }
    $featpod->findRecords('id', -1, $sqlwhere);
    $total_vps = $featpod->getTotalRows();
    $avp = array();
    // there has to be at least $min vendors to show the featured block
    if ($total_vps >= $min) {
        while ($featpod->fetchRecord()) {
            // make sure we have an ACTUAL image file
            $img = get_ao_image($featpod);
            // make sure the image is square (only square images can be displayed here)
            if (image_is_square($img)) {
                $avp[$featpod->get_field('id')] = get_vendorfields($featpod);
            }
        }
    } else {
        return false;
    }
    // randomize the vendor list
    shuffle($avp);
    // now pull the first x vendors
    $avp = array_slice($avp, 0, $num_rows * 4);
    echo $title;
    $i = 0;
    echo '<div class="featured_block">';
    foreach ($avp as $vid => $fields) {
        $i++;
        // end the block and start a new one if needed
        if ($i == 5) {
            echo '</div><div class="featured_block">';
            $i = 1;
            echo '<br clear="all" />';
        }
        // spit out the image
        echo <<<HEREDOC
\t\t<div class="featured_wrap">
\t\t\t<div class="featured_image"><a href="/profile/{$fields["slug"]}"><img src="{$fields["imag"]}" title="{$fields["name"]}" alt="{$fields["name"]}"/></a></div>
\t\t\t<div class="featured_name"><a href="/profile/{$fields["slug"]}">{$fields["name"]}</a></div>
\t\t</div>
HEREDOC;
    }
    echo '</div><br clear="all" />';
}
コード例 #3
0
if ($a["is_venue"] || $a['showadd'] == '1') {
    show_googlemap(array($a), 0, 11);
}
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);
コード例 #4
0
        echo <<<XMLOUT
\t<url>
\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>
コード例 #5
0
//$pid = pods_url_variable(2);
// this is the "effective" user id, which is not neccessarily the user that is logged in, in the
//		case of admins, wo are able to mascarade as other users.
$active_user_id = get_active_user_id();
// array to hold our profile fields
$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") {
コード例 #6
0
ファイル: PodsMigrate.php プロジェクト: centaurustech/chipin
 /**
  * @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 &raquo;  \" />";
         }
         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";
     }
 }
コード例 #7
0
}
if ($cmd == 'byname') {
    $sortby = 't.name';
    $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>&nbsp;</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';
コード例 #8
0
ファイル: functions.php プロジェクト: natduffy/gicinema
/**
 * 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();
}
コード例 #9
0
<?php

/**
 * @package WordPress
 * @subpackage Default_Theme
 */
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 = '';
コード例 #10
0
// this is the profile ID
$eid = pods_url_variable(2);
// this is the "effective" user id, which is not neccessarily the user that is logged in, in the
//		case of admins, wo are able to mascarade as other users.
$active_user_id = get_active_user_id();
// array to hold our profile fields
$a = array();
// *******************************************************************
// INITIALIZATION, so to speak
// *******************************************************************
// Basically, if we have a $eid, go ahead an get the data from the database, We might end up
//		replacing that data with data the user is trying to save .. a good baseline, so to speak
if ($eid != '' && $eid != 'new') {
    $event = new Pod('events');
    $event->findRecords('id', -1, "t.id = '{$eid}' and t.vendor = {$active_user_id}");
    $total = $event->getTotalRows();
    if ($total > 0) {
        $event->fetchRecord();
        $a = get_eventfields($event);
    }
    $title = 'Edit Event';
} else {
    $eid = 'new';
    $title = 'New Event';
}
// *******************************************************************
// IS THE USER TRYING TO SAVE THE EVENT???
// *******************************************************************
if ($_POST['submitted'] == "1") {
    $success = false;
    // pull everything off of $_POST into our $a array.
コード例 #11
0
function set_profile_status()
{
    // this is the "effective" user id, which is not neccessarily the user that is logged in, in the
    //		case of admins, who are able to mascarade as other users.
    $active_user_id = get_active_user_id();
    $profile = new Pod('vendor_profiles');
    $profile->findRecords('id', -1, "t.vendor = {$active_user_id}");
    $total = $profile->getTotalRows();
    if ($total > 0) {
        $profile->fetchRecord();
        $_SESSION['profile_type'] = $profile->get_field('profile_type');
    } else {
        $_SESSION['profile_type'] = 'New';
    }
}
コード例 #12
0
" <?php 
post_class('ninecol');
?>
>
	<div class="entry-content">
		<?php 
the_content();
?>

    <?php 
if (!empty($pod->data)) {
    ?>
      <div class="article row">
        <div class="ninecol">
          <?php 
    if ($articles_pods->getTotalRows()) {
        ?>
    <dl class="publication-side-toc">
    <?php 
        $sections = array();
        foreach (preg_split("/\n/", $publication_pod->get_field('sections')) as $section_line) {
            preg_match("/^(\\d+)?\\s?(.*)\$/", $section_line, $matches);
            array_push($sections, array('id' => $matches[1], 'title' => $matches[2]));
        }
        if ($TRACE_PODS_ARTICLES) {
            error_log('sections: ' . var_export($sections, true));
        }
        if (!count($sections)) {
            $sections = array("010" => "");
        }
        foreach ($sections as $section) {
コード例 #13
0
<?php

/* Template Name: Events */
include_once 'guide-functions.php';
ao_set_title('Atlanta Bridal Shows, Atlanta Wedding Event, Atlanta Bridal Expos, Atlanta Wedding Trunk Shows');
get_header();
?>
			<div class="post">
				<h2>Bridal Shows and Upcoming Events</h2>
				<p>Browse upcoming Bridal Shows and events happening soon.</p>
<?php 
// get the event list
$e = new Pod('events');
$sqlwhere = "( (approved = 1) AND (date_start >= '" . date("Y-m-d") . "  00:00:00') ) ";
$e->findRecords('t.date_start ASC', -1, $sqlwhere);
if ($e->getTotalRows() > 0) {
    while ($e->fetchRecord()) {
        // get our fields from the POD
        $ae = get_eventfields($e);
        $addr = "{$ae['addr']}, {$ae['city']}, {$ae['stat']} {$ae['zipc']}";
        $nicedate = '<b>' . date("D M j, Y", strtotime($ae['dsta'])) . '</b>';
        if ($ae['dend'] != '0000-00-00 00:00:00' && $ae['dsta'] != $ae['dend']) {
            $nicedate .= ' thru <b>' . date("D M j, Y", strtotime($ae['dend'])) . '</b>';
        }
        echo <<<HEREDOC
\t\t\t<div id="event_{$ae['id']}" class="eventlist_wrap">
\t\t\t\t<div class="eventlist_content">
\t\t\t\t\t<h2 class="eventlist_name">{$ae["name"]}</h2>
\t\t\t\t\t<p class="eventlist_desc">{$ae["desc"]}</p>
\t\t\t\t\t<div class="eventlist_detail">
\t\t\t\t\t\t<div class="eventlist_detailrow">
コード例 #14
0
echo var_trace('datetime_now: ' . $datetime_now->format(DATE_ATOM), $TRACE_PREFIX, $TRACE_ENABLED);
// prepare array with list of upcoming events
$upcoming_events = array();
$events_pod->findRecords(array('where' => 't.date_start > NOW()', 'orderby' => 't.date_start ASC', 'limit' => 5));
while ($events_pod->fetchRecord()) {
    array_push($upcoming_events, array('slug' => $events_pod->get_field('slug'), 'name' => $events_pod->get_field('name'), 'date' => date('d F', strtotime($events_pod->get_field('date_start')))));
}
// prepare array with list of past events, split by year
$events = array();
$current_year = date("Y");
$active_year = $current_year;
// used to set initial active section for jQuery UI accordion
for ($year = 2005; $year <= $current_year; $year++) {
    $events[$year] = array();
    $events_pod->findRecords(array('where' => "YEAR(t.date_start) = {$year} AND t.date_start < NOW()", 'orderby' => 'date_start DESC', 'limit' => -1));
    echo var_trace('events records found: ' . $events_pod->getTotalRows(), $TRACE_PREFIX, $TRACE_ENABLED);
    while ($events_pod->fetchRecord()) {
        // if event is past, add it to array
        if ($events_pod->get_field['date_start'] < $datetime_now) {
            if ($pod_slug == $events_pod->get_field('slug')) {
                $active_year = $year;
            }
            array_push($events[$year], array('slug' => $events_pod->get_field('slug'), 'name' => $events_pod->get_field('name'), 'date' => date('j F', strtotime($events_pod->get_field('date_start')))));
        }
    }
    // if there are no events for this year, remove year's array altogether from full list
    if (!count($events[$year])) {
        $events = array_pop($events);
    }
}
echo var_trace('events array: ' . var_export($events, true), $TRACE_PREFIX, $TRACE_ENABLED);
コード例 #15
0
    if ($total_pops > 0) {
        while ($pops->fetchRecord()) {
            $pops_name = $pops->get_field('name');
            $pops_slug = $pops->get_field('slug');
            echo '<div class="guide-featuredname">&bull;&nbsp;&nbsp;<a href="/profile/', $pops_slug, '">', $pops_name, '</a></div>';
        }
    }
    echo '</div>';
    echo '</div>';
    echo '<div class="clear">&nbsp;</div>';
} elseif ($cur_cat == 'services') {
    // "services" is different in that it can contain subcategories, so get
    //		those subcategories and display them
    $services = new Pod('categories');
    $services->findRecords('', 0, '', 'SELECT name, slug, description FROM wp_pod_tbl_categories WHERE parentid IN (3) AND hide <> 1 ORDER BY name');
    $total_cats = $services->getTotalRows();
    echo '<div class="ruled left"><span class="head3 oo-color-brown ruled-text-left">' . $cur_head . '</span></div>';
    //echo "<h2>$cur_head</h2>";
    echo "<p>{$cur_desc}</p>";
    echo '<table border=0 width=600><tr><td width="50%">';
    $i = 0;
    if ($total_cats > 0) {
        while ($services->fetchRecord()) {
            $i++;
            if ($i > $total_cats / 2) {
                echo '</td><td width="50%">';
                $i = 0;
            }
            // set our variables
            $cat_name = $services->get_field('name');
            $cat_slug = $services->get_field('slug');
コード例 #16
0
    ?>
	<div id="pendingsales">
	<h2>Pending Listings</h2>
<?php 
    echo $PendingSale->showTemplate('pending_list');
    ?>
	</div> <!-- ends div id pendingsales -->
	<?php 
}
?>

<!-- list of sold (sold or leased listings -->

<?php 
$SoldListing = new Pod('listings');
$status_sold = "(status = 'Sold' || status = 'Rented')";
$SoldListing->findRecords('name ASC', 10, $status_sold);
$total_sold = $SoldListing->getTotalRows();
if ($total_sold > 0) {
    ?>
  <div id="soldlistings">
  <h2>Sold or Leased</h2>
  <?php 
    echo $SoldListing->showTemplate('sold_list');
    ?>
  </div><!-- ends div id soldlistings -->
  <?php 
}
?>