• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP geodir_get_posttypes函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: geodir_post_type_setting_fun

/**
 * function for post type settings.
 *
 * @since 1.0.0
 * @package GeoDirectory
 */
function geodir_post_type_setting_fun()
{
    $post_type_arr = array();
    $post_types = geodir_get_posttypes('object');
    foreach ($post_types as $key => $post_types_obj) {
        $post_type_arr[$key] = $post_types_obj->labels->singular_name;
    }
    return $post_type_arr;
}
开发者ID:jefferose,项目名称:geodirectory,代码行数:15,代码来源:design_settings_array.php


示例2: geodir_add_claim_option_metabox

function geodir_add_claim_option_metabox()
{
    global $post;
    $geodir_post_types = geodir_get_posttypes('array');
    $geodir_posttypes = array_keys($geodir_post_types);
    if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
        $geodir_posttype = $post->post_type;
        $post_typename = ucwords($geodir_post_types[$geodir_posttype]['labels']['singular_name']);
        add_meta_box('geodir_claim_listing_information', $post_typename . ' Claim Settings', 'geodir_claim_listing_information', $geodir_posttype, 'side', 'high');
    }
}
开发者ID:poweronio,项目名称:mbsite,代码行数:11,代码来源:geodir_claim_template_tags.php


示例3: geodir_load_cpt_text_translation

/**
 * Get the cpt texts for translation.
 *
 * @since 1.5.5
 * @package GeoDirectory
 *
 * @param  array $translation_texts Array of text strings.
 * @return array Translation texts.
 */
function geodir_load_cpt_text_translation($translation_texts = array())
{
    $gd_post_types = geodir_get_posttypes('array');
    if (!empty($gd_post_types)) {
        foreach ($gd_post_types as $post_type => $cpt_info) {
            $labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
            $description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
            $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
            if (!empty($labels)) {
                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
                    $translation_texts[] = $labels['name'];
                }
                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
                    $translation_texts[] = $labels['singular_name'];
                }
                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
                    $translation_texts[] = $labels['add_new'];
                }
                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
                    $translation_texts[] = $labels['add_new_item'];
                }
                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
                    $translation_texts[] = $labels['edit_item'];
                }
                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
                    $translation_texts[] = $labels['new_item'];
                }
                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
                    $translation_texts[] = $labels['view_item'];
                }
                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
                    $translation_texts[] = $labels['search_items'];
                }
                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
                    $translation_texts[] = $labels['not_found'];
                }
                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
                    $translation_texts[] = $labels['not_found_in_trash'];
                }
                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
                    $translation_texts[] = $labels['label_post_profile'];
                }
                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
                    $translation_texts[] = $labels['label_post_info'];
                }
                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
                    $translation_texts[] = $labels['label_post_images'];
                }
                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
                    $translation_texts[] = $labels['label_post_map'];
                }
                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
                    $translation_texts[] = $labels['label_reviews'];
                }
                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
                    $translation_texts[] = $labels['label_related_listing'];
                }
            }
            if ($description != '' && !in_array($description, $translation_texts)) {
                $translation_texts[] = normalize_whitespace($description);
            }
            if (!empty($seo)) {
                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
                }
                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
                }
            }
        }
    }
    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
    return $translation_texts;
}
开发者ID:kkoppenhaver,项目名称:geodirectory,代码行数:83,代码来源:general_functions.php


示例4: geodir_claim_after_claim_form_field

/**
 * Display price package list in claim lisitng form.
 *
 * @since 1.1.4
 *
 * @param  string $field Claim listing field name.
 * @return string Display price package list.
 */
function geodir_claim_after_claim_form_field($field = '')
{
    if ($field == 'geodir_user_comments' && geodir_claim_force_upgrade()) {
        $gd_post_types = geodir_get_posttypes();
        $post_id = isset($_REQUEST['post_id']) ? $_REQUEST['post_id'] : '';
        $post_type = get_post_type($post_id);
        if ($post_type != '' && in_array($post_type, $gd_post_types)) {
            $package_list = geodir_claim_payment_package_list($post_type);
            $payment_methods = geodir_claim_payment_methods();
            if (empty($package_list) || empty($payment_methods)) {
                return;
            }
            $package_id = geodir_get_post_meta('package_id', true);
            if (empty($package_id)) {
                $default_package = geodir_get_default_package($post_type);
                $package_id = $default_package->pid;
            }
            $js_script = '';
            ?>
			<div id="gd_claim_pkgs" class="row clearfix gd-claim-pkgs gd-chosen-outer">
				<label><?php 
            _e('Select Package', GEODIRCLAIM_TEXTDOMAIN);
            ?>
 : <span>*</span></label>
				<select name="geodir_claim_pkg" id="geodir_claim_pkg" field_type="select" class="is_required chosen_select">
				<?php 
            foreach ($package_list as $package) {
                ?>
				<option value="<?php 
                echo $package->pid;
                ?>
"><?php 
                echo stripslashes_deep($package->title_desc);
                ?>
</option>
				<?php 
            }
            ?>
				</select>
				<span class="message_error2" id="geodir_claim_pkgInfo"></span>
			</div>
			<div id="gd_claim_payments" class="row clearfix gd-claim-payments gd-chosen-outer">
				<label><?php 
            _e('Select Payment Method', GEODIRCLAIM_TEXTDOMAIN);
            ?>
 : <span>*</span></label>
				<select name="geodir_claim_payment" id="geodir_claim_payment" field_type="select" class="is_required chosen_select">
				<?php 
            $file_content = '';
            $keys = array();
            foreach ($payment_methods as $payment_method) {
                $keys[] = $payment_method['key'];
                if (file_exists(GEODIR_PAYMENT_MANAGER_PATH . $payment_method['key'] . '/' . $payment_method['key'] . '.php')) {
                    ob_start();
                    include_once GEODIR_PAYMENT_MANAGER_PATH . $payment_method['key'] . '/' . $payment_method['key'] . '.php';
                    $file_content .= ob_get_clean();
                }
                ?>
				<option value="<?php 
                echo $payment_method['key'];
                ?>
"><?php 
                echo stripslashes_deep($payment_method['name']);
                ?>
</option>
				<?php 
            }
            $gd_claim_pmkeys = "['" . implode("', '", $keys) . "']";
            $js_script .= 'jQuery("#geodir_claim_payment").attr("onchange", "javascript:gd_claim_change_pmethod(this, ' . $gd_claim_pmkeys . ');"); jQuery("#geodir_claim_payment").trigger("change");';
            ?>
				</select>
				<span class="message_error2" id="geodir_claim_paymentInfo"></span>
				<?php 
            echo $file_content;
            ?>
				<?php 
            $js_script .= '';
            ?>
			</div>
			<script type="text/javascript"><?php 
            echo $js_script;
            ?>
 jQuery("#geodir_claim_form").addClass('gd-claimfrm-upgrade');jQuery(".chosen_select", "#geodir_claim_form").chosen({"disable_search":true});</script>
			<?php 
        }
    }
}
开发者ID:poweronio,项目名称:mbsite,代码行数:95,代码来源:geodir_claim_functions.php


示例5: geodir_home_map_cats_key_value_array

/**
 * Returns All post categories from all GD post types.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @return array Returns post categories as an array.
 */
function geodir_home_map_cats_key_value_array()
{
    $post_types = geodir_get_posttypes('object');
    $return = array();
    if (!empty($post_types)) {
        foreach ($post_types as $key => $post_type) {
            $cpt_name = __($post_type->labels->singular_name, 'geodirectory');
            $post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
            $taxonomies = geodir_get_taxonomies($key);
            $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL;
            $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL;
            if (!empty($cat_terms)) {
                $return['optgroup_start-' . $key] = $post_type_name;
                foreach ($cat_terms as $cat_term) {
                    $return[$key . '_' . $cat_term->term_id] = $cat_term->name;
                }
                $return['optgroup_end-' . $key] = $post_type_name;
            }
        }
    }
    return $return;
}
开发者ID:kkoppenhaver,项目名称:geodirectory,代码行数:29,代码来源:custom_functions.php


示例6: geodir_count_reviews_by_terms

/**
 * Count reviews by terms.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @param bool $force_update Force update option value?. Default.false.
 * @return array Term array data.
 */
function geodir_count_reviews_by_terms($force_update = false)
{
    /**
     * Filter review count option data.
     *
     * @since 1.0.0
     * @param bool $force_update Force update option value?. Default.false.
     */
    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update);
    if (!empty($option_data)) {
        return $option_data;
    }
    $option_data = get_option('geodir_global_review_count');
    if (!$option_data or $force_update) {
        $post_types = geodir_get_posttypes();
        $term_array = array();
        foreach ($post_types as $post_type) {
            $taxonomy = geodir_get_taxonomies($post_type);
            $taxonomy = $taxonomy[0];
            $args = array('hide_empty' => false);
            $terms = get_terms($taxonomy, $args);
            foreach ($terms as $term) {
                $count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
                $children = get_term_children($term->term_id, $taxonomy);
                /*if ( is_array( $children ) ) {
                			foreach ( $children as $child_id ) {
                				$child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
                				$count = $count + $child_count;
                			}
                		}*/
                $term_array[$term->term_id] = $count;
            }
        }
        update_option('geodir_global_review_count', $term_array);
        //clear cache
        wp_cache_delete('geodir_global_review_count');
        return $term_array;
    } else {
        return $option_data;
    }
}
开发者ID:bangjojo,项目名称:wp,代码行数:49,代码来源:general_functions.php


示例7: geodir_single_next_previous_fix

 /**
  * Filters the adjacent post url.
  *
  * @since 1.0.0
  * @package GeoDirectory_Location_Manager
  *
  * @global object $wpdb WordPress Database object.
  * @global string $plugin_prefix Geodirectory plugin table prefix.
  * @global object $post The current post object.
  *
  * @param string $url The adjacent post url.
  * @param string $link Link permalink format.
  * @param string $direction Direction. Ex: Next or Previous.
  * @param object $post The Post object.
  * @return mixed Post url.
  */
 function geodir_single_next_previous_fix($url, $link, $direction, $post)
 {
     global $wpdb, $plugin_prefix, $post;
     $post_type_array = geodir_get_posttypes();
     if (isset($post->post_type) && in_array($post->post_type, $post_type_array)) {
         $post_date = $timestamp = strtotime($post->post_date);
         $where = '';
         $prep_arr = array($post_date);
         if (isset($post->country_slug) && $post->country_slug != '') {
             $where .= " AND post_locations LIKE %s ";
             $prep_arr[] = "%,[" . $post->country_slug . "]";
         }
         if (isset($post->region_slug) && $post->region_slug != '') {
             $where .= " AND post_locations LIKE %s ";
             $prep_arr[] = "%,[" . $post->region_slug . "],%";
         }
         if (isset($post->city_slug) && $post->city_slug != '') {
             $where .= " AND post_locations LIKE %s ";
             $prep_arr[] = "[" . $post->city_slug . "],%";
         }
         $prep_arr[] = $post->ID;
         if ($direction == __('Next', GEODIRLOCATION_TEXTDOMAIN)) {
             $op = '>';
         } else {
             $op = '<';
         }
         $table = $plugin_prefix . $post->post_type . '_detail';
         $pid = $wpdb->get_var($wpdb->prepare("SELECT  post_id FROM " . $table . " WHERE submit_time {$op} %d  AND post_status='publish' {$where} AND post_id !=%d LIMIT 1", $prep_arr));
         if ($pid) {
             $just_url = preg_match("/href=\"([^\"]*)\"/", $url, $matches);
             if (is_array($matches) && isset($matches[1])) {
                 return str_replace($matches[1], get_permalink($pid), $url);
             }
         }
     }
     return $url;
 }
开发者ID:poweronio,项目名称:mbsite,代码行数:53,代码来源:geodir_location_hooks_actions.php


示例8: form

        public function form($instance)
        {
            $instance = wp_parse_args((array) $instance, array('title' => '', 'hood_post_type' => '', 'hood_category' => '', 'category_title' => '', 'list_sort' => '', 'list_order' => '', 'post_number' => '5', 'layout' => 'gridview_onehalf', 'add_location_filter' => '1', 'character_count' => '20'));
            $title = strip_tags($instance['title']);
            $hood_post_type = strip_tags($instance['hood_post_type']);
            $hood_category = strip_tags($instance['hood_category']);
            $category_title = strip_tags($instance['category_title']);
            $list_sort = strip_tags($instance['list_sort']);
            $list_order = strip_tags($instance['list_order']);
            $post_number = strip_tags($instance['post_number']);
            $layout = strip_tags($instance['layout']);
            $add_location_filter = strip_tags($instance['add_location_filter']);
            $character_count = $instance['character_count'];
            ?>
			
			<p>
				<label for="<?php 
            echo $this->get_field_id('title');
            ?>
"><?php 
            _e('Title:', GEODIRLOCATION_TEXTDOMAIN);
            ?>
				
					<input class="widefat" id="<?php 
            echo $this->get_field_id('title');
            ?>
" name="<?php 
            echo $this->get_field_name('title');
            ?>
" type="text" value="<?php 
            echo esc_attr($title);
            ?>
" />
				</label>
			</p>
			
			<p>
					<label for="<?php 
            echo $this->get_field_id('hood_post_type');
            ?>
"><?php 
            _e('Post Type:', GEODIRLOCATION_TEXTDOMAIN);
            ?>
			
					<?php 
            $postypes = geodir_get_posttypes();
            ?>
			
					<select class="widefat" id="<?php 
            echo $this->get_field_id('hood_post_type');
            ?>
" name="<?php 
            echo $this->get_field_name('hood_post_type');
            ?>
" onchange="geodir_change_hood_category_list(this)">
						
			<?php 
            foreach ($postypes as $postypes_obj) {
                ?>
							
									<option <?php 
                if ($hood_post_type == $postypes_obj) {
                    echo 'selected="selected"';
                }
                ?>
 value="<?php 
                echo $postypes_obj;
                ?>
"><?php 
                $extvalue = explode('_', $postypes_obj);
                echo ucfirst($extvalue[1]);
                ?>
</option>
							
			<?php 
            }
            ?>
							
					</select>
					</label>
			</p>
			
			<p id="hood_post_categories">
				<label for="<?php 
            echo $this->get_field_id('hood_category');
            ?>
"><?php 
            _e('Post Category:', GEODIRLOCATION_TEXTDOMAIN);
            ?>
			
			<?php 
            $hood_post_type = $hood_post_type != '' ? $hood_post_type : 'gd_place';
            $category_taxonomy = geodir_get_taxonomies($hood_post_type);
            $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
            ?>
			
				<select class="widefat" id="<?php 
            echo $this->get_field_id('hood_category');
            ?>
" name="<?php 
//.........这里部分代码省略.........
开发者ID:poweronio,项目名称:mbsite,代码行数:101,代码来源:geodir_location_widgets.php


示例9: geodir_ajax_import_csv


//.........这里部分代码省略.........
    $blank_address = 0;
    $upload_files = 0;
    $invalid_post_type = 0;
    $invalid_title = 0;
    $customKeyarray = array();
    $gd_post_info = array();
    $post_location = array();
    $countpost = 0;
    if (!empty($file)) {
        $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL;
        $customKeyarray = $columns;
        if (empty($columns) || !empty($columns) && $columns[0] == '') {
            $return['error'] = CSV_INVAILD_FILE;
            echo json_encode($return);
            exit;
        }
        for ($i = 1; $i <= $importlimit; $i++) {
            $current_index = $tmpCnt + $i;
            if (isset($file[$current_index])) {
                $total_records++;
                $buffer = geodir_str_getcsv($file[$current_index]);
                $post_title = addslashes($buffer[0]);
                $current_post_author = $buffer[1];
                $post_desc = addslashes($buffer[2]);
                $post_cat = array();
                $catids_arr = array();
                $post_cat = trim($buffer[3]);
                // comma seperated category name
                if ($post_cat) {
                    $post_cat_arr = explode(',', $post_cat);
                    for ($c = 0; $c < count($post_cat_arr); $c++) {
                        $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c]));
                        if (!empty($buffer[5])) {
                            if (in_array($buffer[5], geodir_get_posttypes())) {
                                $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5]));
                                if (get_term_by('name', $catid, $p_taxonomy[0])) {
                                    $cat = get_term_by('name', $catid, $p_taxonomy[0]);
                                    $catids_arr[] = $cat->slug;
                                } else {
                                    if (get_term_by('slug', $catid, $p_taxonomy[0])) {
                                        $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
                                        $catids_arr[] = $cat->slug;
                                    } else {
                                        $ret = wp_insert_term($catid, $p_taxonomy[0]);
                                        if ($ret && !is_wp_error($ret)) {
                                            if (get_term_by('name', $catid, $p_taxonomy[0])) {
                                                $cat = get_term_by('name', $catid, $p_taxonomy[0]);
                                                $catids_arr[] = $cat->slug;
                                            } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
                                                $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
                                                $catids_arr[] = $cat->slug;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (!$catids_arr) {
                    $catids_arr[] = 1;
                }
                $post_tags = trim($buffer[4]);
                // comma seperated tags
                $tag_arr = '';
                if ($post_tags) {
开发者ID:kkoppenhaver,项目名称:geodirectory,代码行数:67,代码来源:admin_hooks_actions.php


示例10: geodir_package_meta_box_add

function geodir_package_meta_box_add()
{
    global $post;
    $geodir_post_types = geodir_get_posttypes('array');
    $geodir_posttypes = array_keys($geodir_post_types);
    if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
        $geodir_posttype = $post->post_type;
        $post_typename = ucwords($geodir_post_types[$geodir_posttype]['labels']['singular_name']);
        add_meta_box('geodir_post_package_setting', $post_typename . ' Package Settings', 'geodir_post_package_setting', $geodir_posttype, 'side', 'high');
    }
}
开发者ID:poweronio,项目名称:mbsite,代码行数:11,代码来源:geodir_payment_actions.php


示例11: geodir_core_post_view_extra_class

/**
 * Appends extra HTML classes to the post class.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $post The current post object.
 * @param string $class The old class string.
 * @param string|array $all_postypes The GD post types.
 * @return string The modified post class.
 */
function geodir_core_post_view_extra_class($class, $all_postypes = '')
{
    global $post;
    if (!$all_postypes) {
        $all_postypes = geodir_get_posttypes();
    }
    $gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;
    $gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;
    $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
    if ($gdp_post_id && $gdp_post_type) {
        $append_class = 'gd-post-' . $gdp_post_type;
        $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
        $class = $class != '' ? $class . ' ' . $append_class : $append_class;
    }
    return $class;
}
开发者ID:kkoppenhaver,项目名称:geodirectory,代码行数:26,代码来源:template_functions.php


示例12: geodir_buddypress_get_activity_id

/**
 * set parent activity_id to 1 if listing comment has not parent activity_id.
 *
 * @since 1.0.0
 * @package GeoDirectory_BuddyPress_Integration
 *
 * @param int $activity_id BP activity ID.
 * @return int BP activity ID.
 */
function geodir_buddypress_get_activity_id($activity_id)
{
    if (!$activity_id) {
        $gd_post_types = geodir_get_posttypes('array');
        $comment_post_ID = isset($_POST['comment_post_ID']) ? $_POST['comment_post_ID'] : 0;
        $comment_post = get_post($comment_post_ID);
        if (!empty($comment_post) && isset($comment_post->post_type) && $comment_post->post_type && !empty($gd_post_types) && array_key_exists($comment_post->post_type, $gd_post_types)) {
            $activity_id = 1;
        }
    }
    return $activity_id;
}
开发者ID:poweronio,项目名称:mbsite,代码行数:21,代码来源:gdbuddypress_functions.php


示例13: gdsc_is_post_type_valid

/**
 * Check the post type valid or not.
 *
 * @since 1.0.0
 *
 * @param string $incoming_post_type Post type.
 * @return bool The boolean equivalent or null.
 */
function gdsc_is_post_type_valid($incoming_post_type)
{
    $post_types = geodir_get_posttypes();
    $post_types = array_map('strtolower', $post_types);
    $post_type_found = false;
    foreach ($post_types as $type) {
        if (strtolower($incoming_post_type) == strtolower($type)) {
            $post_type_found = true;
        }
    }
    return $post_type_found;
}
开发者ID:bangjojo,项目名称:wp,代码行数:20,代码来源:shortcode_functions.php


示例14: geodir_get_custom_sort_options

/**
 * Get sort options based on post type.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $wpdb WordPress Database object.
 * @param string $post_type The post type.
 * @return bool|mixed|void Returns sort options when post type available. Otherwise returns false.
 */
function geodir_get_custom_sort_options($post_type = '')
{
    global $wpdb;
    if ($post_type != '') {
        $all_postypes = geodir_get_posttypes();
        if (!in_array($post_type, $all_postypes)) {
            return false;
        }
        $fields = array();
        $fields[] = array('post_type' => $post_type, 'data_type' => '', 'field_type' => 'random', 'site_title' => 'Random', 'htmlvar_name' => 'post_title');
        $fields[] = array('post_type' => $post_type, 'data_type' => '', 'field_type' => 'datetime', 'site_title' => __('Add date', 'geodirectory'), 'htmlvar_name' => 'post_date');
        $fields[] = array('post_type' => $post_type, 'data_type' => '', 'field_type' => 'bigint', 'site_title' => __('Review', 'geodirectory'), 'htmlvar_name' => 'comment_count');
        $fields[] = array('post_type' => $post_type, 'data_type' => '', 'field_type' => 'float', 'site_title' => __('Rating', 'geodirectory'), 'htmlvar_name' => 'overall_rating');
        $fields[] = array('post_type' => $post_type, 'data_type' => '', 'field_type' => 'text', 'site_title' => __('Title', 'geodirectory'), 'htmlvar_name' => 'post_title');
        /**
         * Hook to add custom sort options.
         *
         * @since 1.0.0
         * @param array $fields Unmodified sort options array.
         * @param string $post_type Post type.
         */
        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
    }
    return false;
}
开发者ID:bangjojo,项目名称:wp,代码行数:34,代码来源:custom_fields_functions.php


示例15: gdlist_get_all_reviewed_posts

function gdlist_get_all_reviewed_posts()
{
    $p_ids = gdlist_get_user_reviewed_posts();
    $post_types = geodir_get_posttypes();
    $all_posts = array();
    if ($p_ids) {
        $query_args = array('post_type' => $post_types, 'posts_per_page' => 100);
        $query_args['post__in'] = $p_ids;
        $listings = new WP_Query($query_args);
        if ($listings) {
            while ($listings->have_posts()) {
                $listings->the_post();
                $all_posts[get_the_ID()] = get_the_title();
            }
        }
        wp_reset_postdata();
    }
    return $all_posts;
}
开发者ID:poweronio,项目名称:mbsite,代码行数:19,代码来源:geodir_list_manager.php


示例16: geodir_function_post_updated

/**
 * Called when post updated.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @param int $post_ID The post ID.
 * @param object $post_after The post object after update.
 * @param object $post_before The post object before update.
 */
function geodir_function_post_updated($post_ID, $post_after, $post_before)
{
    $post_type = get_post_type($post_ID);
    if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
        // send notification to client when post moves from draft to publish
        if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
            $post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
            $post_author_data = get_userdata($post_author_id);
            $to_name = geodir_get_client_name($post_author_id);
            $from_email = geodir_get_site_email_id();
            $from_name = get_site_emailName();
            $to_email = $post_author_data->user_email;
            if (!is_email($to_email) && !empty($post_author_data->user_email)) {
                $to_email = $post_author_data->user_email;
            }
            $message_type = 'listing_published';
            if (get_option('geodir_post_published_email_subject') == '') {
                update_option('geodir_post_published_email_subject', __('Listing Published Successfully', GEODIRECTORY_TEXTDOMAIN));
            }
            if (get_option('geodir_post_published_email_content') == '') {
                update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", GEODIRECTORY_TEXTDOMAIN));
            }
            /**
             * Called before sending the email when listing gets published.
             *
             * @since 1.0.0
             * @package GeoDirectory
             * @param object $post_after The post object after update.
             * @param object $post_before The post object before update.
             */
            do_action('geodir_before_listing_published_email', $post_after, $post_before);
            if (is_email($to_email)) {
                geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
            }
            /**
             * Called after sending the email when listing gets published.
             *
             * @since 1.0.0
             * @package GeoDirectory
             * @param object $post_after The post object after update.
             * @param object $post_before The post object before update.
             */
            do_action('geodir_after_listing_published_email', $post_after, $post_before);
        }
    }
}
开发者ID:jefferose,项目名称:geodirectory,代码行数:55,代码来源:post_functions.php


示例17: __

            <div class="geodir-search">

                <?php 
$default_search_for_text = SEARCH_FOR_TEXT;
if (get_option('geodir_search_field_default_text')) {
    $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
}
$default_near_text = NEAR_TEXT;
if (get_option('geodir_near_field_default_text')) {
    $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
}
$default_search_button_label = __('Search', 'geodirectory');
if (get_option('geodir_search_button_label')) {
    $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
}
$post_types = geodir_get_posttypes('object');
if (!empty($post_types) && count((array) $post_types) > 1) {
    ?>
                    <select name="stype" class="search_by_post">
                        <?php 
    foreach ($post_types as $post_type => $info) {
        global $wpdb;
        $has_posts = '';
        $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
        if (!$has_posts) {
            continue;
        }
        ?>

                            <option data-label="<?php 
        echo get_post_type_archive_link($post_type);
开发者ID:kkoppenhaver,项目名称:geodirectory,代码行数:31,代码来源:listing-filter-form.php


示例18: geodir_location_delete_by_id

/**
 * Remove location and its data using location ID.
 *
 * @since 1.0.0
 * @package GeoDirectory_Location_Manager
 *
 * @global object $wpdb WordPress Database object.
 * @global string $plugin_prefix Geodirectory plugin table prefix.
 *
 * @param int $id Location ID.
 * @return bool Returns true when successful deletion.
 */
function geodir_location_delete_by_id($id)
{
    global $wpdb, $plugin_prefix;
    if (!current_user_can('manage_options') || !$id > 0) {
        return false;
    }
    $geodir_posttypes = geodir_get_posttypes();
    do_action('geodir_location_before_delete', $id);
    $location_info = $wpdb->get_row($wpdb->prepare("SELECT city_slug, is_default FROM " . POST_LOCATION_TABLE . " WHERE location_id = %d", array($id)));
    if (!empty($location_info) && !empty($location_info->is_default)) {
        return false;
        // Default location
    }
    foreach ($geodir_posttypes as $geodir_posttype) {
        $table = $plugin_prefix . $geodir_posttype . '_detail';
        $rows = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE post_location_id = %d", array($id)));
        if (!empty($rows)) {
            foreach ($rows as $row) {
                wp_delete_post($row->post_id);
                // Delete post
            }
        }
    }
    // Remove neighbourhood location
    $wpdb->query($wpdb->prepare("DELETE FROM " . POST_NEIGHBOURHOOD_TABLE . " WHERE hood_location_id = %d", array($id)));
    // Remove current location data
    if (!empty($location_info) && !empty($location_info->city_slug) && isset($_SESSION['gd_city']) && $_SESSION['gd_city'] == $location_info->city_slug) {
        unset($_SESSION['gd_multi_location'], $_SESSION['gd_city'], $_SESSION['gd_region'], $_SESSION['gd_country']);
    }
    // Remove post location data
    $wpdb->query($wpdb->prepare("DELETE FROM " . POST_LOCATION_TABLE . " WHERE location_id = %d", array($id)));
    do_action('geodir_location_after_delete', $id);
    return true;
}
开发者ID:poweronio,项目名称:mbsite,代码行数:46,代码来源:geodir_location_functions.php


示例19: geodir_no_rating_rating_fields

/**
 * Modify rating fields when rating disabled.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $post The current post object.
 */
function geodir_no_rating_rating_fields()
{
    global $post;
    $post_types = geodir_get_posttypes();
    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
            echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
            if (get_option('geodir_reviewrating_enable_images')) {
                geodir_reviewrating_rating_img_html();
            }
        } else {
            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
        }
    }
}
开发者ID:kkoppenhaver,项目名称:geodirectory,代码行数:22,代码来源:geodirectory_hooks_actions.php


示例20: gd_fix_address_detail_table_limit

/**
 * Fixes the address field limit of 30 to 50 in details table.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $wpdb WordPress Database object.
 */
function gd_fix_address_detail_table_limit()
{
    global $wpdb;
    $all_postypes = geodir_get_posttypes();
    if (!empty($all_postypes)) {
        foreach ($all_postypes as $key) {
            // update each GD CTP
            @$wpdb->query(" 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP geodir_get_taxonomies函数代码示例发布时间:2022-05-15
下一篇:
PHP geodir_get_default_location函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap