当前位置: 首页>>代码示例>>PHP>>正文


PHP papi_get_qs函数代码示例

本文整理汇总了PHP中papi_get_qs函数的典型用法代码示例。如果您正苦于以下问题:PHP papi_get_qs函数的具体用法?PHP papi_get_qs怎么用?PHP papi_get_qs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了papi_get_qs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: papi_get_post_type

/**
 * Get WordPress post type in various ways.
 *
 * @param  int $post_id
 *
 * @return string
 */
function papi_get_post_type($post_id = null)
{
    if ($post_type = papi_get_or_post('post_type')) {
        return $post_type;
    }
    $post_id = papi_get_post_id($post_id);
    if ($post_id !== 0) {
        return strtolower(get_post_type($post_id));
    }
    $page = papi_get_qs('page');
    if (is_string($page) && strpos(strtolower($page), 'papi-add-new-page,') !== false) {
        $exploded = explode(',', $page);
        if (empty($exploded[1])) {
            return '';
        }
        return $exploded[1];
    }
    // If only `post-new.php` without any querystrings
    // it would be the post post type.
    $req_uri = $_SERVER['REQUEST_URI'];
    $exploded = explode('/', $req_uri);
    $last = end($exploded);
    if ($last === 'post-new.php') {
        return 'post';
    }
    return '';
}
开发者ID:wp-papi,项目名称:papi,代码行数:34,代码来源:post.php

示例2: render_view

 /**
  * Render tools page view.
  */
 public function render_view()
 {
     $page_view = (string) papi_get_qs('view');
     if (empty($page_view)) {
         $page_view = 'management-start';
     }
     $this->view->render($page_view);
 }
开发者ID:ekandreas,项目名称:papi,代码行数:11,代码来源:class-papi-admin-management-pages.php

示例3: prepare_taxonomy_types

 /**
  * Prepare taxonomy types, add standard taxonomy if it should be added.
  *
  * @param  array $taxonomy_types
  *
  * @return array
  */
 protected function prepare_taxonomy_types(array $taxonomy_types)
 {
     $taxonomy = papi_get_qs('taxonomy');
     if (papi_filter_settings_show_standard_taxonomy_type($taxonomy)) {
         $id = sprintf('papi-standard-%s-type', $taxonomy);
         $taxonomy_type = new Papi_Taxonomy_Type($id);
         $taxonomy_type->id = $id;
         $taxonomy_type->name = papi_filter_settings_standard_taxonomy_type_name($taxonomy);
         $taxonomy_type->taxonomy = [$taxonomy];
         $taxonomy_types[] = $taxonomy_type;
     }
     usort($taxonomy_types, function ($a, $b) {
         return strcmp($a->name, $b->name);
     });
     return papi_sort_order(array_reverse($taxonomy_types));
 }
开发者ID:wp-papi,项目名称:papi,代码行数:23,代码来源:class-papi-admin-entry-taxonomy.php

示例4: get_property

 /**
  * Load property from page type.
  *
  * @param  string $slug
  * @param  string $child_slug
  *
  * @return object
  */
 public function get_property($slug, $child_slug = '')
 {
     $page_type_id = str_replace('papi/', '', papi_get_qs('page'));
     if (empty($page_type_id)) {
         $page_types = papi_get_all_page_types(false, null, true);
         $property = null;
         foreach ($page_types as $index => $page_type) {
             if ($property = $page_type->get_property($slug, $child_slug)) {
                 break;
             }
         }
         if (is_null($property)) {
             return;
         }
         return $property;
     }
     $page_type = papi_get_page_type_by_id($page_type_id);
     if ($page_type instanceof Papi_Option_Type === false) {
         return;
     }
     return $page_type->get_property($slug, $child_slug);
 }
开发者ID:KristoferN,项目名称:papi,代码行数:30,代码来源:class-papi-option-page.php

示例5: render

 /**
  * Render the property.
  */
 public function render()
 {
     // Check so the property has a type and capabilities on the property.
     if (!papi_current_user_is_allowed($this->get_option('capabilities'))) {
         return;
     }
     // A disabled property should not be rendered.
     if ($this->disabled()) {
         return;
     }
     // Only render if it's the right language if the definition exist.
     if ($this->get_option('lang') === strtolower(papi_get_qs('lang'))) {
         $render = true;
     } else {
         $render = $this->get_option('lang') === false && papi_is_empty(papi_get_qs('lang'));
     }
     if ($this->display()) {
         $this->display = $this->render_is_allowed_by_rules();
     }
     $this->render_row_html();
     $this->render_hidden_html();
     $this->render_rules_json();
 }
开发者ID:ekandreas,项目名称:papi,代码行数:26,代码来源:class-papi-property.php

示例6: render

 /**
  * Render the property.
  */
 public function render()
 {
     // Check if current user can view the property.
     if (!$this->current_user_can()) {
         return;
     }
     // A disabled property should not be rendered.
     if ($this->disabled()) {
         return;
     }
     // Only render if it's the right language if the definition exist.
     if ($this->get_option('lang') === strtolower(papi_get_qs('lang'))) {
         $this->display = true;
     } else {
         $this->display = $this->get_option('lang') === false && papi_is_empty(papi_get_qs('lang'));
     }
     // Check rules.
     if ($this->display()) {
         $this->display = $this->render_is_allowed_by_rules();
     }
     $this->render_row_html();
     $this->render_hidden_html();
     $this->render_rules_json();
 }
开发者ID:wp-papi,项目名称:papi,代码行数:27,代码来源:class-papi-property.php

示例7: get_property

 /**
  * Load property from page type.
  *
  * @param  string $slug
  * @param  string $child_slug
  *
  * @return object
  */
 public function get_property($slug, $child_slug = '')
 {
     $content_type_id = papi_get_qs('page');
     if (empty($content_type_id)) {
         $property = null;
         $content_types = papi_get_all_content_types(['types' => 'option']);
         foreach ($content_types as $index => $content_type) {
             if ($property = $content_type->get_property($slug, $child_slug)) {
                 $this->option_type = $content_type;
                 break;
             }
         }
         if (is_null($property)) {
             return;
         }
         return $property;
     }
     $content_type = papi_get_content_type_by_id($content_type_id);
     if (!papi_is_option_type($content_type)) {
         return;
     }
     $this->option_type = $content_type;
     return $content_type->get_property($slug, $child_slug);
 }
开发者ID:ekandreas,项目名称:papi,代码行数:32,代码来源:class-papi-option-page.php

示例8: get_property

 /**
  * Load property from page type.
  *
  * @param  string $slug
  * @param  string $child_slug
  *
  * @return null|object
  */
 public function get_property($slug, $child_slug = '')
 {
     $entry_type_id = papi_get_qs('page');
     if (empty($entry_type_id)) {
         $property = null;
         $entry_types = papi_get_all_entry_types(['types' => 'option']);
         foreach ($entry_types as $entry_type) {
             if ($property = $entry_type->get_property($slug, $child_slug)) {
                 break;
             }
         }
         if (is_null($property)) {
             return;
         }
         return $property;
     }
     $entry_type = papi_get_entry_type_by_id($entry_type_id);
     if ($entry_type instanceof Papi_Option_Type === false) {
         return;
     }
     if ($property = $entry_type->get_property($slug, $child_slug)) {
         return $this->prepare_property($property);
     }
 }
开发者ID:wp-papi,项目名称:papi,代码行数:32,代码来源:class-papi-option-store.php

示例9: render_view

 /**
  * Menu callback that loads right view depending on what the `page` query string says.
  */
 public function render_view()
 {
     if (strpos(papi_get_qs('page'), 'papi') !== false) {
         $page = str_replace('papi-', '', papi_get_qs('page'));
         $res = preg_replace('/\\,.*/', '', $page);
         if (is_string($res)) {
             $page_view = $res;
         }
     }
     if (!isset($page_view)) {
         $page_view = null;
     }
     if (!is_null($page_view)) {
         $view = new Papi_Admin_View();
         $view->render($page_view);
     } else {
         echo '<h2>Papi - 404</h2>';
     }
 }
开发者ID:KristoferN,项目名称:papi,代码行数:22,代码来源:class-papi-admin-menu.php

示例10: get_property

 /**
  * Get property html via GET.
  *
  * GET /papi-ajax/?action=get_property
  */
 public function get_property()
 {
     $default_options = Papi_Core_Property::create()->get_options();
     $keys = array_keys(get_object_vars($default_options));
     $options = papi_get_qs($keys, true);
     if ($property = papi_property($options)) {
         ob_start();
         $property->render_ajax_request();
         $html = ob_get_clean();
         wp_send_json(['html' => utf8_encode($html)]);
     } else {
         $this->render_error('No property found');
     }
 }
开发者ID:ekandreas,项目名称:papi,代码行数:19,代码来源:class-papi-admin-ajax.php

示例11: render_ajax_request

 /**
  * Render AJAX request.
  */
 public function render_ajax_request()
 {
     $items = $this->get_settings_properties();
     if (papi_doing_ajax()) {
         $counter = papi_get_qs('counter');
         $this->counter = intval($counter);
     }
     $this->render_properties($items, false);
 }
开发者ID:nlemoine,项目名称:papi,代码行数:12,代码来源:class-papi-property-repeater.php

示例12: papi_get_content_type_id

/**
 * Get content type id.
 *
 * @return string
 */
function papi_get_content_type_id()
{
    $content_type_id = papi_get_qs('content_type');
    /**
     * Change content type id.
     *
     * @param string $content_type_id
     */
    return apply_filters('papi/content_type_id', $content_type_id);
}
开发者ID:ekandreas,项目名称:papi,代码行数:15,代码来源:content.php

示例13: get_terms

 /**
  * Get terms via GET.
  *
  * GET /papi-ajax/?action=get_terms
  */
 public function get_terms()
 {
     $query = papi_get_qs('query') ?: [];
     $query = is_array($query) ? $query : [];
     $taxonomy = papi_get_qs('taxonomy') ?: '';
     $args = array_merge($query, ['fields' => 'id=>name']);
     $terms = [];
     if (taxonomy_exists($taxonomy)) {
         $terms = get_terms($taxonomy, $args);
     }
     wp_send_json($terms);
 }
开发者ID:wp-papi,项目名称:papi,代码行数:17,代码来源:class-papi-admin-ajax.php

示例14: get_entry_type

 /**
  * Get Entry Type instance.
  *
  * @return Papi_Entry_Type|false
  */
 private function get_entry_type()
 {
     if ($this->entry_type instanceof Papi_Entry_Type) {
         return $this->entry_type;
     }
     $entry_type_id = papi_get_entry_type_id();
     // If the entry type id is empty try to load
     // the entry type id from `page` query string.
     //
     // Example:
     //   /wp-admin/options-general.php?page=papi/option/site-option-type
     if (empty($entry_type_id)) {
         $entry_type_id = preg_replace('/^papi\\/\\w+\\//', '', papi_get_qs('page'));
     }
     // Use the default entry type id if empty.
     if (empty($entry_type_id)) {
         $entry_type_id = papi_get_entry_type_id();
     }
     // If no entry type id exists Papi can't setup a entry type.
     if (empty($entry_type_id)) {
         return false;
     }
     return $this->entry_type = papi_get_entry_type_by_id($entry_type_id);
 }
开发者ID:nlemoine,项目名称:papi,代码行数:29,代码来源:class-papi-admin.php

示例15: papi_load_page_type_id

/**
 * Load the content type id on a post types.
 *
 * @param  string $content_type_id
 *
 * @return string
 */
function papi_load_page_type_id($content_type_id = '')
{
    $key = papi_get_page_type_key();
    $post_id = papi_get_post_id();
    $post_type = papi_get_post_type($post_id);
    // If we have a post id we can load the content type id
    // from the post.
    if ($post_id > 0) {
        $meta_value = get_post_meta($post_id, $key, true);
        $content_type_id = empty($meta_value) ? '' : $meta_value;
    }
    // Try to fetch the content type id from `page_type`
    // query string.
    if (empty($content_type_id)) {
        $content_type_id = papi_get_qs('page_type');
    }
    // When using `only_page_type` filter we need to fetch the value since it
    // maybe not always saved in the database.
    if (empty($content_type_id)) {
        $content_type_id = papi_filter_settings_only_page_type($post_type);
    }
    // Load right content type from the parent post id.
    if (empty($content_type_id)) {
        $meta_value = get_post_meta(papi_get_parent_post_id(), $key, true);
        $content_type_id = empty($meta_value) ? '' : $meta_value;
    }
    // Load content type id from the container if it exists.
    if (empty($content_type_id)) {
        $key = sprintf('content_type_id.%s', $post_type);
        if (papi()->exists($key)) {
            return papi()->make($key);
        }
    }
    return $content_type_id;
}
开发者ID:ekandreas,项目名称:papi,代码行数:42,代码来源:page.php


注:本文中的papi_get_qs函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。