本文整理汇总了PHP中wpl_request::setVar方法的典型用法代码示例。如果您正苦于以下问题:PHP wpl_request::setVar方法的具体用法?PHP wpl_request::setVar怎么用?PHP wpl_request::setVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpl_request
的用法示例。
在下文中一共展示了wpl_request::setVar方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __call
/**
* Calls WPL views
* @author Howard <howard@realtyna.com>
* @param string $method
* @param array $args
* @return mixed
*/
public function __call($method, $args)
{
$ex = explode(':', $method);
$this->_wpl_client = array_search($this->_wpl_clients[$ex[0]], $this->_wpl_clients) ? $this->_wpl_clients[$ex[0]] : 'frontend';
$this->_wpl_folder = $ex[1];
$this->_wpl_file = 'wpl_main';
$this->_wpl_class = 'wpl_' . $ex[1] . '_controller';
$_wpl_function = trim($ex[2]) != '' ? $ex[2] : 'display';
_wpl_import('views.' . $this->_wpl_client . '.' . $this->_wpl_folder . '.' . $this->_wpl_file);
$_wpl_obj = new $this->_wpl_class();
/** parameter of shortcode (setted by user) **/
$instance = (array) $args[0];
/** set the parameters **/
foreach ($instance as $key => $value) {
wpl_request::setVar($key, $value, 'method', $this->parameter_overwrite);
}
if ($this->_wpl_client == 'frontend') {
/** call the function **/
return $_wpl_obj->{$_wpl_function}($instance);
}
if ($this->_wpl_client == 'backend') {
$_wpl_obj->wrapper = 1;
}
/** call the function **/
$_wpl_obj->{$_wpl_function}($instance);
}
示例2: display
public function display($instance = array())
{
$this->uid = wpl_request::getVar('uid', 0);
if (!$this->uid) {
$this->uid = wpl_request::getVar('sf_select_user_id', 0);
wpl_request::setVar('uid', $this->uid);
}
/** check user id **/
if (!$this->uid) {
/** import message tpl **/
$this->message = __("No profile found or it's not available now!", WPL_TEXTDOMAIN);
return parent::render($this->tpl_path, 'message', false, true);
}
/** set the user id to search credentials **/
wpl_request::setVar('sf_select_user_id', $this->uid);
/** set the kind **/
$this->kind = wpl_request::getVar('kind', '0');
wpl_request::setVar('kind', $this->kind);
/** User Type **/
$this->user_type = wpl_users::get_user_user_type($this->uid);
/** trigger event **/
wpl_global::event_handler('profile_show', array('id' => $this->uid, 'kind' => $this->kind));
/** import tpl **/
$this->tpl = wpl_users::get_user_type_tpl($this->tpl_path, $this->tpl, $this->user_type);
/** import tpl **/
return parent::render($this->tpl_path, $this->tpl, false, true);
}
示例3: init_page
/**
* written by Francis
* description: initialize pagination and properties for property manager page
*/
private function init_page()
{
/** global settings **/
$settings = wpl_settings::get_settings();
/** listing settings **/
$this->page_number = wpl_request::getVar('wplpage', 1);
$limit = wpl_request::getVar('limit', $settings['default_page_size']);
$start = wpl_request::getVar('start', ($this->page_number - 1) * $limit);
$orderby = wpl_request::getVar('orderby', $settings['default_orderby']);
$order = wpl_request::getVar('order', $settings['default_order']);
$current_user_id = wpl_users::get_cur_user_id();
$where = array();
/** set page if start var passed **/
$this->page_number = $start / $limit + 1;
wpl_request::setVar('wplpage', $this->page_number);
$this->model = new wpl_property();
/** load user properties **/
if (!wpl_users::is_administrator($current_user_id)) {
$where['sf_select_user_id'] = $current_user_id;
}
/** detect kind **/
$this->kind = wpl_request::getVar('kind', 0);
if (!in_array($this->kind, wpl_flex::get_valid_kinds())) {
/** import message tpl **/
$this->message = __('Invalid Request!', WPL_TEXTDOMAIN);
parent::render($this->tpl_path, 'message');
return false;
}
$this->kind_label = wpl_flex::get_kind_label($this->kind);
$where['sf_select_kind'] = $this->kind;
/** Add search conditions to the where **/
$vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET'));
$where = array_merge($vars, $where);
$this->model->start($start, $limit, $orderby, $order, $where, $this->kind);
$query = $this->model->query();
$properties = $this->model->search($query);
$this->model->finish();
/** get the number of all properties according to our query **/
$properties_count = $this->model->get_properties_count();
/** set pagination according to the number of items and limit **/
$this->pagination = wpl_pagination::get_pagination($properties_count, $limit);
$plisting_fields = $this->model->get_plisting_fields();
$wpl_properties = array();
foreach ($properties as $property) {
$wpl_properties[$property->id] = $this->model->full_render($property->id, $plisting_fields, $property);
}
$this->wpl_properties = $wpl_properties;
return true;
}
示例4: switch_language
/**
* Switch to a new language
* @author Howard <howard@realtyna.com>
* @static
* @param string $language
* @return boolean
*/
public static function switch_language($language)
{
$path = wpl_global::get_language_mo_path($language);
$result = wpl_global::load_textdomain(WPL_TEXTDOMAIN, $path);
if ($result) {
wpl_request::setVar('wpllang', $language);
}
return $result;
}
示例5: display
public function display($instance = array())
{
/** do cronjobs **/
_wpl_import('libraries.events');
wpl_events::do_cronjobs();
/** check access **/
if (!wpl_users::check_access('propertyshow')) {
/** import message tpl **/
$this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN);
return parent::render($this->tpl_path, 'message', false, true);
}
$this->tpl = wpl_request::getVar('tpl', 'default');
/** property listing model **/
$this->model = new wpl_property();
$this->pid = wpl_request::getVar('pid', 0);
$listing_id = wpl_request::getVar('mls_id', 0);
if (trim($listing_id)) {
$this->pid = wpl_property::pid($listing_id);
wpl_request::setVar('pid', $this->pid);
}
$property = $this->model->get_property_raw_data($this->pid);
/** no property found **/
if (!$property or $property['finalized'] == 0 or $property['confirmed'] == 0 or $property['deleted'] == 1 or $property['expired'] >= 1) {
/** import message tpl **/
$this->message = __("No property found or it's not available now!", WPL_TEXTDOMAIN);
return parent::render($this->tpl_path, 'message', false, true);
}
$this->pshow_fields = $this->model->get_pshow_fields('', $property['kind']);
$this->pshow_categories = wpl_flex::get_categories('', '', " AND `enabled`>='1' AND `kind`='" . $property['kind'] . "' AND `pshow`='1'");
$wpl_properties = array();
/** define current index **/
$wpl_properties['current']['data'] = (array) $property;
$wpl_properties['current']['raw'] = (array) $property;
$find_files = array();
$rendered_fields = $this->model->render_property($property, $this->pshow_fields, $find_files, true);
$wpl_properties['current']['rendered_raw'] = $rendered_fields['ids'];
$wpl_properties['current']['materials'] = $rendered_fields['columns'];
foreach ($this->pshow_categories as $pshow_category) {
$pshow_cat_fields = $this->model->get_pshow_fields($pshow_category->id, $property['kind']);
$wpl_properties['current']['rendered'][$pshow_category->id]['self'] = (array) $pshow_category;
$wpl_properties['current']['rendered'][$pshow_category->id]['data'] = $this->model->render_property($property, $pshow_cat_fields);
}
$wpl_properties['current']['items'] = wpl_items::get_items($this->pid, '', $property['kind'], '', 1);
/** property location text **/
$wpl_properties['current']['location_text'] = $this->model->generate_location_text((array) $property);
/** property full link **/
$wpl_properties['current']['property_link'] = $this->model->get_property_link((array) $property);
/** property page title **/
$wpl_properties['current']['property_page_title'] = $this->model->update_property_page_title($property);
/** property title **/
$wpl_properties['current']['property_title'] = $this->model->update_property_title($property);
/** apply filters (This filter must place after all proccess) **/
_wpl_import('libraries.filters');
@extract(wpl_filters::apply('property_listing_after_render', array('wpl_properties' => $wpl_properties)));
$this->wpl_properties = $wpl_properties;
$this->kind = $property['kind'];
$this->property = $wpl_properties['current'];
/** updating the visited times and etc **/
wpl_property::property_visited($this->pid);
/** trigger event **/
wpl_global::event_handler('property_show', array('id' => $this->pid));
/** import tpl **/
$this->tpl = wpl_flex::get_kind_tpl($this->tpl_path, $this->tpl, $this->kind);
return parent::render($this->tpl_path, $this->tpl, false, true);
}
示例6: 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);
}
}
}
}
示例7: set_pcc
private function set_pcc()
{
$pcc = wpl_request::getVar('pcc', '');
setcookie('wplpcc', $pcc, time() + 86400 * 30, '/');
wpl_request::setVar('wplpcc', $pcc, 'COOKIE');
echo json_encode(array('success' => 1));
exit;
}