本文整理汇总了PHP中wpl_global::get_the_ID方法的典型用法代码示例。如果您正苦于以下问题:PHP wpl_global::get_the_ID方法的具体用法?PHP wpl_global::get_the_ID怎么用?PHP wpl_global::get_the_ID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpl_global
的用法示例。
在下文中一共展示了wpl_global::get_the_ID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_view
/**
* Sets WPL view to wplview variable. This function sets other parameters as well in $_REQUEST
* @author Howard R <howard@realtyna.com>
* @static
* @return void
*/
public static function set_view()
{
/** set view **/
$wplview = wpl_request::getVar('wplview', '');
if (trim($wplview) != '') {
return;
}
/** checking wordpress post type (post, page, any kind of posts and ...) **/
if (!is_page() and !is_single()) {
return;
}
/** getting the post id and post content **/
$post_id = wpl_global::get_the_ID();
$post_content = wpl_db::get('post_content', 'posts', 'id', $post_id);
$wplview = '';
if (strpos($post_content, '[wpl_property_listings') !== false or strpos($post_content, '[WPL') !== false) {
$wplview = 'property_listing';
} elseif (strpos($post_content, '[wpl_property_show') !== false) {
$wplview = 'property_show';
} elseif (strpos($post_content, '[wpl_profile_listing') !== false) {
$wplview = 'profile_listing';
} elseif (strpos($post_content, '[wpl_profile_show') !== false) {
$wplview = 'profile_show';
} elseif (strpos($post_content, '[wpl_my_profile') !== false) {
$wplview = 'profile_wizard';
} elseif (strpos($post_content, '[wpl_add_edit_listing') !== false) {
$wplview = 'property_wizard';
} elseif (strpos($post_content, '[wpl_listing_manager') !== false) {
$wplview = 'property_manager';
} elseif (strpos($post_content, '[wpl_payments') !== false) {
$wplview = 'payments';
} elseif (strpos($post_content, '[wpl_addon_') !== false) {
$pos1 = strpos($post_content, '[wpl_addon_');
$pos2 = strpos($post_content, ' ', $pos1);
if ($pos2 === false) {
$pos2 = strpos($post_content, ']', $pos1);
}
$shortcode = trim(substr($post_content, $pos1, $pos2 - $pos1), '[_ ]');
$shortcode = str_replace('wpl_', '', $shortcode);
$wplview = $shortcode;
} elseif (strpos($post_content, '[wpl_custom_') !== false) {
$wplview = 'wpl_custom_view';
}
/** set view **/
if (trim($wplview) != '') {
wpl_request::setVar('wplview', $wplview);
}
$pattern = get_shortcode_regex();
preg_match('/' . $pattern . '/s', $post_content, $matches);
$wpl_shortcodes = array('WPL', 'wpl_property_listings', 'wpl_property_show', 'wpl_profile_listing', 'wpl_profile_show', 'wpl_my_profile', 'wpl_add_edit_listing', 'wpl_listing_manager');
if (is_array($matches) and isset($matches[2]) and in_array($matches[2], $wpl_shortcodes)) {
$shortcode = $matches[0];
$params_str = trim($matches[3], ', ');
if (trim($params_str) != '') {
$attributes = shortcode_parse_atts($params_str);
foreach ($attributes as $key => $value) {
if (trim($key) == '') {
continue;
}
wpl_request::setVar($key, $value, 'method', false);
}
}
}
}
示例2: get_activities
/**
* Returns some activity with specified criteria
* @author Howard <howard@realtyna.com>
* @static
* @param string $position
* @param int $enabled
* @param string $condition
* @param string $result
* @return objects
*/
public static function get_activities($position, $enabled = 1, $condition = '', $result = 'loadObjectList')
{
if (trim($condition) == '') {
$client = wpl_global::get_client();
$condition = " AND `client` IN ({$client}, 2)";
if (trim($position) != '') {
$condition .= " AND `position`='{$position}'";
}
if (trim($enabled) != '') {
$condition .= " AND `enabled`>='{$enabled}'";
}
/** page associations **/
if (is_page()) {
$post_id = wpl_global::get_the_ID();
if ($post_id) {
$condition .= " AND (`association_type`='1' OR (`association_type`='2' AND `associations` LIKE '%[" . $post_id . "]%') OR (`association_type`='3' AND `associations` NOT LIKE '%[" . $post_id . "]%'))";
}
}
$condition .= " ORDER BY `index` ASC, `ID` DESC";
}
$query = "SELECT * FROM `#__wpl_activities` WHERE 1 " . $condition;
return wpl_db::select($query, $result);
}