/**
  * Parses query string from current request
  *
  * @since 0.0.3
  *
  * @return array
  */
 private static function query_string()
 {
     $query = pods_v_sanitized('QUERY_STRING', $_SERVER);
     if ($query) {
         return wp_parse_args($query);
     }
 }
Пример #2
0
/**
 *
 */
function pods_deploy_handler()
{
    if (pods_v_sanitized('pods-deploy-submit', 'post')) {
        if (!pods_deploy_dependency_check()) {
            return;
        }
        $remote_url = pods_v_sanitized('remote-url', 'post', false, true);
        $private_key = pods_v_sanitized('private-key', 'post');
        $public_key = pods_v_sanitized('public-key', 'post');
        if ($remote_url && $private_key && $public_key) {
            Pods_Deploy_Auth::save_local_keys($private_key, $public_key);
            pods_deploy($remote_url, $private_key, $public_key);
        } else {
            _e('Keys and URL for remote site not set', 'pods-deploy');
            pods_error(var_dump(array($remote_url, $private_key, $public_key)));
        }
    } elseif (pods_v_sanitized('pods-deploy-key-gen-submit', 'post')) {
        $activate = pods_v_sanitized('allow-deploy', 'post');
        if ($activate) {
            Pods_Deploy_Auth::allow_deploy();
            Pods_Deploy_Auth::generate_keys();
            include 'ui/main.php';
        } else {
            Pods_Deploy_Auth::revoke_keys();
        }
        include_once 'ui/main.php';
    } else {
        include_once 'ui/main.php';
    }
}
/**
 * Build a unique slug
 *
 * @param string $slug The slug value
 * @param string $column_name The column name
 * @param string|array $pod The Pod name or array of Pod data
 * @param int $pod_id The Pod ID
 * @param int $id The item ID
 * @param object $obj (optional)
 *
 * @return string The unique slug name
 * @since 1.7.2
 */
function pods_unique_slug($slug, $column_name, $pod, $pod_id = 0, $id = 0, $obj = null, $strict = true)
{
    $slug = pods_create_slug($slug, $strict);
    $pod_data = array();
    if (is_array($pod)) {
        $pod_data = $pod;
        $pod_id = pods_v_sanitized('id', $pod_data, 0);
        $pod = pods_v_sanitized('name', $pod_data);
    }
    $pod_id = absint($pod_id);
    $id = absint($id);
    if (empty($pod_data)) {
        $pod_data = pods_api()->load_pod(array('id' => $pod_id, 'name' => $pod), false);
    }
    if (empty($pod_data) || empty($pod_id) || empty($pod)) {
        return $slug;
    }
    if ('table' != $pod_data['storage'] || !in_array($pod_data['type'], array('pod', 'table'))) {
        return $slug;
    }
    $check_sql = "\n        SELECT DISTINCT `t`.`{$column_name}` AS `slug`\n        FROM `@wp_pods_{$pod}` AS `t`\n        WHERE `t`.`{$column_name}` = %s AND `t`.`id` != %d\n        LIMIT 1\n    ";
    $slug_check = pods_query(array($check_sql, $slug, $id), $obj);
    if (!empty($slug_check) || apply_filters('pods_unique_slug_is_bad_flat_slug', false, $slug, $column_name, $pod, $pod_id, $id, $pod_data, $obj)) {
        $suffix = 2;
        do {
            $alt_slug = substr($slug, 0, 200 - (strlen($suffix) + 1)) . "-{$suffix}";
            $slug_check = pods_query(array($check_sql, $alt_slug, $id), $obj);
            $suffix++;
        } while (!empty($slug_check) || apply_filters('pods_unique_slug_is_bad_flat_slug', false, $alt_slug, $column_name, $pod, $pod_id, $id, $pod_data, $obj));
        $slug = $alt_slug;
    }
    $slug = apply_filters('pods_unique_slug', $slug, $id, $column_name, $pod, $pod_id, $obj);
    return $slug;
}
Пример #4
0
<?php

/**
 * The template for displaying a single video page.
 *
 * Template Name: Single Video
 */
$video = pods('video', pods_v_sanitized('last', 'url'));
$otherVideos = pods('video', ['where' => 'id != ' . $video->id()]);
$speaker = $video->field('video-speaker');
add_post_meta($video->id, 'description', $video->field('video-description'));
get_header();
?>
	<div class="hero-wrapper dark">
		<div class="single-video-section row">
			<div class="embed-container large-10 large-centered columns">
				<iframe src="http://www.youtube.com/embed/<?php 
echo $video->field('video-id');
?>
?autoplay=0&controls=2&iv_load_policy=1&modestbranding=0&rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
			</div>
		</div>
	</div>
	<div id="primary" class="content-area">
		<div id="content" class="site-content" role="main">
			<div class="video-info row">
				<div class="video-description large-8 columns">
					<h2 class="video-speaker"><?php 
echo get_the_title($speaker['ID']);
?>
</h2>
Пример #5
0
 /**
  * Prepare data to be saved
  *
  * @param array $data
  */
 protected function prepare_data($data)
 {
     $details = pods_v_sanitized('details', $data, [], true);
     $this->data = ['datetime' => current_time('mysql'), 'license' => $this->get_license_id($data['license']), 'url' => pods_v_sanitized('url', $data, null), 'wp_ver' => pods_v_sanitized('wp_version', $details, 0), 'ingot_ver' => pods_v_sanitized('ingot_version', $details, 0), 'php_ver' => pods_v_sanitized('php_version', $details, 0), 'vertical' => pods_v_sanitized('ing_vertical', $details, 0), 'trial' => boolval(pods_v('trial', $data, false, true))];
 }
Пример #6
0
            ?>
                    <li>
                        <div class="pods-field pods-boolean">
                            <?php 
            echo PodsForm::field('built_in_taxonomies_' . $taxonomy, pods_var_raw('built_in_taxonomies_' . $taxonomy, $pod, false), 'boolean', array('boolean_yes_label' => $label . ' <small>(' . $taxonomy . ')</small>'));
            ?>
                        </div>
                    </li>
                    <?php 
        }
        ?>
            </ul>
        </div>
    </div>
    <?php 
    } elseif ('taxonomy' == pods_v_sanitized('type', $pod) && strlen(pods_v_sanitized('object', $pod)) < 1) {
        $fields = $tab_options['advanced'];
        $field_options = PodsForm::fields_setup($fields);
        $field = $pod;
        include PODS_DIR . 'ui/admin/field-option.php';
        ?>
    <div class="pods-field-option-group">
        <p class="pods-field-option-group-label">
            <?php 
        _e('Associated Post Types', 'pods');
        ?>
        </p>

        <div class="pods-pick-values pods-pick-checkbox">
            <ul>
                <?php 
 /**
  * Include main UI view and add scope data into it.
  *
  * @since 0.4.0
  *
  * @return bool|string
  */
 function include_view()
 {
     $keys = Pods_Deploy_Auth::get_keys(true);
     $public_remote = pods_v_sanitized('public', $keys, '');
     $private_remote = pods_v_sanitized('private', $keys, '');
     $deploy_active = Pods_Deploy_Auth::deploy_active();
     wp_enqueue_style('pods-wizard');
     if ($deploy_active) {
         $key_gen_submit = __('Disable Deployments', 'pods-deploy');
         $key_gen_header = __('Click to revoke keys and prevent deployments to this site.', 'pods-deploy');
     } else {
         $key_gen_submit = __('Allow Deployments', 'pods-deploy');
         $key_gen_header = __('Click to generate new keys and allow deployments to this site', 'pods-deploy');
     }
     $form_fields = $this->form_fields();
     $data = compact(array('keys', 'public_local', 'private_local', 'public_remote', 'private_remote', 'deploy_active', 'key_gen_submit', 'key_gen_header', 'form_fields'));
     return pods_view(PODS_DEPLOY_DIR . 'ui/main.php', $data);
 }
 * It requires a Pods Page set up for each Advanced Content type with the name "name_of_Pod/"
 *
 * @see http://pods.io/tutorials/choosing-pods-advanced-content-types-and-pods-pages/
 * @see http://pods.io/tutorials/using-pods-pages-advanced-content-types/
 *
 * @package pods_s
 */
get_header();
?>

	<div id="primary" class="content-area">
		<div id="content" class="site-content" role="main">
			<?php 
//setup Pod object presuming permalink structure of example.com/pod-name/item-name
//get current pod name
$pod_name = pods_v_sanitized(0, 'url');
//set up parameters for Pods object
$params = array('limit' => get_option('posts_per_page', 10));
//get pods object
$pods = pods($pod_name, $params);
?>
			<article>
				<?php 
if ($pods->total() > 0) {
    while ($pods->fetch()) {
        //reset id
        $pods->id = $pods->id();
        //Output template of the same name as Pod, if such a template exists.
        $temp = $pods->template($pod_name);
        if (!is_null($temp)) {
            echo $temp;
Пример #9
0
	<!-- /#side-sortables -->
</div>
<!-- /#side-info-column -->

<div id="post-body">
	<div id="post-body-content">
		<?php 
$more = false;
if ($pod->pod_data['field_index'] != $pod->pod_data['field_id']) {
    foreach ($fields as $k => $field) {
        if ($pod->pod_data['field_index'] != $field['name'] || 'text' != $field['type']) {
            continue;
        }
        $more = true;
        $extra = '';
        $max_length = (int) pods_v_sanitized('maxlength', $field['options'], pods_v_sanitized($field['type'] . '_max_length', $field['options'], 0), true);
        if (0 < $max_length) {
            $extra .= ' maxlength="' . $max_length . '"';
        }
        ?>
			<div id="titlediv">
				<div id="titlewrap">
					<h3><?php 
        echo esc_html($pod->index());
        ?>
</h3>
				</div>
				<!-- /#titlewrap -->
			</div>
			<!-- /#titlediv -->
		<?php 
Пример #10
0
<?php

/**
 * The template for displaying the videos listing page.
 *
 * Template Name: Videos Page
 */
// Get category from URL
$category = pods_v_sanitized(1, 'url');
$params = ['limit' => '0'];
if ($category) {
    $params['where'] = 'category.slug LIKE "' . $category . '"';
}
$videos = pods('video', $params);
get_header();
?>
<div class="hero-wrapper">
	<div class="video-filters-wrapper row">
		<nav class="video-filters large-12 columns">
			<?php 
wp_nav_menu(array('theme_location' => 'video-menu', 'menu_id' => 'video-menu'));
?>
		</nav>
	</div>
</div>
<div id="primary" class="content-area">
	<div id="content" class="site-main" role="main">
		<div class="video-thumbs-wrapper row">
			<div class="video-thumbs large-12 columns">
				<h1><?php 
echo the_title();
<?php

/**
* Simple Example
*/
// get value from input to a form
$keyword = like_escape(pods_v_sanitized('keyword', 'post'));
// set up find parameters, where meta field title matches $keyword
$params = array('where' => 't.post_title LIKE "%' . $keyword . '%" OR my_field.meta_value = "%' . $keyword . '%"');
//search in articles pod
$pod = pods('articles', $params);
//loop through results
if (0 < $pods->total()) {
    while ($pods->fetch()) {
        echo $pods->display('issue');
    }
}
/**
* Adding to where clause conditonally
*/
//set a complete where clause using value from a variable.
$where = 't.user = "******"';
//Add an AND, using a variable, if that variable isn't false
if ($status) {
    $where .= ' AND t.status = "' . $status . '"';
}
$params = array('where', $where, 'limit' => 1);
//use with pods()
$pods = pods('pod_name', $params);
Пример #12
0
<?php

$keys = Pods_Deploy_Auth::get_keys(false);
$public_local = pods_v_sanitized('public', $keys, '');
$private_local = pods_v_sanitized('private', $keys, '');
$keys = Pods_Deploy_Auth::get_keys(true);
$public_remote = pods_v_sanitized('public', $keys, '');
$private_remote = pods_v_sanitized('private', $keys, '');
$deploy_active = Pods_Deploy_Auth::deploy_active();
if ($deploy_active) {
    $key_gen_submit = __('Disable Deployments', 'pods-deploy');
    $key_gen_header = __('Click to revoke keys and prevent deployments to this site.', 'pods-deploy');
} else {
    $key_gen_submit = __('Allow Deployments', 'pods-deploy');
    $key_gen_header = __('Click to generate new keys and allow deployments to this site', 'pods-deploy');
}
?>
<div class="wrap pods-admin">
	<form action="" method="post">

		<div id="icon-pods" class="icon32"><br /></div>

		<?php 
$default = 'deploy';
$tabs = array('deploy' => __('Deploy From This Site', 'pods-deploy'), 'key-gen' => __('Allow Deploying To This Site', 'pods-deploy'));
?>

		<h2 class="nav-tab-wrapper">
			<?php 
foreach ($tabs as $tab => $label) {
    $class = '';