/** * Data validation * @return boolean */ public function validate() { if (wpl_global::check_addon('mobile_application') == false) { $this->error = "Addon mobile application not installed"; return false; } return true; }
/** * Detects WPL view from URL (Query String) * @author Howard R <*****@*****.**> * @static * @param string $query_string * @param string $separator * @return string */ public static function get_view($query_string = '', $separator = '') { /** first validations **/ if (trim($query_string) == '') { $query_string = wpl_global::get_wp_qvar('wpl_qs'); } if (trim($separator) == '') { $separator = wpl_global::get_setting('sef_main_separator'); } if (trim($query_string) != '') { $ex = explode($separator, $query_string); if (trim($ex[0]) == '') { $view = 'property_listing'; } else { $exp = explode('-', $ex[0]); if (is_numeric($exp[0])) { $view = 'property_show'; } elseif ($ex[0] == 'features') { $view = 'features'; } elseif ($ex[0] == 'v') { if ($ex[1] == 'members') { $view = 'addon_membership'; } elseif ($ex[1] == 'manager') { $view = 'property_manager'; } else { $view = $ex[1]; } } elseif ($ex[0] == 'search' and wpl_global::check_addon('save_searches')) { /** Import Library **/ _wpl_import('libraries.addon_save_searches'); $save_searches = new wpl_addon_save_searches(); $exp = explode('-', $ex[1]); $search_id = $exp[0]; $save_search = $save_searches->get($search_id); $criteria = json_decode($save_search['criteria'], true); $view = 'property_listing'; foreach ($criteria as $key => $value) { wpl_request::setVar($key, $value); } } elseif ($ex[0] == 'crm') { $view = 'addon_crm'; } elseif (strpos($ex[0], ':') === false) { $view = 'profile_show'; } else { $view = 'property_listing'; } } } else { $view = wpl_request::getVar('wplview', ''); if (trim($view) == '') { self::set_view(); } $view = wpl_request::getVar('wplview', ''); } /** Set View **/ wpl_request::setVar('wplview', $view); return $view; }
define('DS', DIRECTORY_SEPARATOR); } /** WPL ABS PATH **/ define('WPL_ABSPATH', dirname(__FILE__) . DS); define('WPL_BASENAME', basename(WPL_ABSPATH)); define('WPL_UP_ABSPATH', ABSPATH . 'wp-content' . DS . 'uploads' . DS . 'WPL' . DS); define('WPL_TEXTDOMAIN', 'wpl'); /** WPL textdomain for language **/ define('WPL_VERSION', '2.3.0'); /** WPL version **/ require WPL_ABSPATH . 'config.php'; _wpl_import('global'); _wpl_import('libraries.request'); _wpl_import('libraries.file'); _wpl_import('libraries.folder'); _wpl_import('libraries.db'); _wpl_import('libraries.html'); _wpl_import('libraries.sef'); _wpl_import('libraries.property'); _wpl_import('libraries.users'); _wpl_import('controller'); _wpl_import('extensions'); /** include addon libraries **/ if (wpl_global::check_addon('pro')) { _wpl_import('libraries.addon_pro'); } if (wpl_global::check_addon('franchise')) { _wpl_import('libraries.addon_franchise'); } /** request controller **/ _wpl_import('request_controller');
/** * Uninstalling WPL * @author Howard <*****@*****.**> * @return boolean */ public function uninstall_wpl() { $tables = wpl_db::select('SHOW TABLES'); $database = wpl_db::get_DBO(); foreach ($tables as $table_name => $table) { if (strpos($table_name, $database->prefix . 'wpl_') !== false) { /** drop table **/ wpl_db::q("DROP TABLE `{$table_name}`"); } } /** delete options **/ wpl_db::q("DELETE FROM `#__options` WHERE `option_name` LIKE 'wpl_%' AND `option_name` NOT LIKE 'wpl_theme%'", 'delete'); /** remove WPL upload directory **/ if (function_exists('is_multisite') and is_multisite() and wpl_global::check_addon('multisite')) { $original_blog_id = wpl_global::get_current_blog_id(); // Get all blogs $blogs = wpl_db::select("SELECT `blog_id` FROM `#__blogs`", 'loadColumn'); foreach ($blogs as $blog) { if (!isset($blog->blog_id)) { continue; } switch_to_blog($blog->blog_id); $upload_path = wpl_global::get_upload_base_path($blog->blog_id); if (wpl_folder::exists($upload_path)) { wpl_folder::delete($upload_path); } } switch_to_blog($original_blog_id); } else { $upload_path = wpl_global::get_upload_base_path(); if (wpl_file::exists($upload_path)) { wpl_file::delete($upload_path); } } return true; }
/** * Generates wizard form using dbst fields * @author Howard R <*****@*****.**> * @param objects $fields * @param array $values * @param int $item_id * @param array $finds * @return void */ public function generate_wizard_form($fields, $values, $item_id = 0, &$finds = array()) { /** first validation **/ if (!$fields) { return; } /** get files **/ $path = WPL_ABSPATH . DS . 'libraries' . DS . 'dbst_wizard'; $files = array(); if (wpl_folder::exists($path)) { $files = wpl_folder::files($path, '.php$', false, false); } $wpllangs = wpl_global::check_multilingual_status() ? wpl_addon_pro::get_wpl_languages() : array(); $has_more_details = false; foreach ($fields as $key => $field) { if (!$field) { return; } $done_this = false; $type = $field->type; $label = $field->name; $mandatory = $field->mandatory; $options = json_decode($field->options, true); $value = isset($values[$field->table_column]) ? stripslashes($values[$field->table_column]) : NULL; $kind = isset($values['kind']) ? $values['kind'] : NULL; $display = ''; /** Specific **/ if (trim($field->listing_specific) != '') { $specified_listings = explode(',', trim($field->listing_specific, ', ')); self::$category_listing_specific_array[$field->id] = $specified_listings; if (!in_array($values['listing'], $specified_listings)) { $display = 'display: none;'; } } elseif (trim($field->property_type_specific) != '') { $specified_property_types = explode(',', trim($field->property_type_specific, ', ')); self::$category_property_type_specific_array[$field->id] = $specified_property_types; if (!in_array($values['property_type'], $specified_property_types)) { $display = 'display: none;'; } } elseif (trim($field->user_specific) != '') { $specified_user_types = explode(',', trim($field->user_specific, ', ')); self::$category_user_specific_array[$field->id] = $specified_user_types; if (!in_array($values['membership_type'], $specified_user_types)) { $display = 'display: none;'; } } elseif (isset($options['access'])) { foreach ($options['access'] as $access) { if (!wpl_global::check_access($access)) { $display = 'display: none;'; break; } } } /** More Details **/ if ($type == 'more_details' and !$has_more_details) { echo '<div class="wpl_listing_field_container wpl-pwizard-prow-' . $type . '" id="wpl_listing_field_container' . $field->id . '">'; echo '<label for="wpl_c_' . $field->id . '"><span>' . __($label, WPL_TEXTDOMAIN) . '</span></label>'; echo '<div id="wpl_more_details' . $field->id . '" style="display: none;" class="wpl-fields-more-details-block">'; $has_more_details = true; } elseif ($type == 'more_details' and $has_more_details) { /** Only one details field is acceptable in each category **/ continue; } /** Accesses **/ if (isset($field->accesses) and trim($field->accesses) != '' and wpl_global::check_addon('membership')) { $accesses = explode(',', trim($field->accesses, ', ')); $cur_membership_id = wpl_users::get_user_membership(); if (!in_array($cur_membership_id, $accesses) and trim($field->accesses_message) == '') { continue; } elseif (!in_array($cur_membership_id, $accesses) and trim($field->accesses_message) != '') { echo '<div class="prow wpl_listing_field_container prow-' . $type . '" id="wpl_listing_field_container' . $field->id . '" style="' . $display . '">'; echo '<label for="wpl_c_' . $field->id . '">' . __($label, WPL_TEXTDOMAIN) . '</label>'; echo '<span class="wpl-access-blocked-message">' . __($field->accesses_message, WPL_TEXTDOMAIN) . '</span>'; echo '</div>'; continue; } } /** js validation **/ self::$wizard_js_validation[$field->id] = self::generate_js_validation($field); if (isset($finds[$type])) { echo '<div class="prow wpl_listing_field_container prow-' . $type . '" id="wpl_listing_field_container' . $field->id . '" style="' . $display . '">'; include $path . DS . $finds[$type]; echo '</div>'; continue; } echo '<div class="prow wpl_listing_field_container prow-' . $type . '" id="wpl_listing_field_container' . $field->id . '" style="' . $display . '">'; foreach ($files as $file) { include $path . DS . $file; if ($done_this) { $finds[$type] = $file; break; } } echo '</div>'; } if ($has_more_details) { echo '</div></div>'; } }
private function save_dbst() { $dbst_id = wpl_request::getVar('dbst_id', 0); $post = wpl_request::get('post'); $mode = 'edit'; /** insert new field **/ if (!$dbst_id) { $mode = 'add'; $dbst_id = wpl_flex::create_default_dbst(); } $q = ''; foreach ($post as $field => $value) { if (substr($field, 0, 4) != 'fld_') { continue; } $key = substr($field, 4); if (trim($key) == '') { continue; } $q .= "`{$key}`='{$value}', "; } /** add options to query **/ $options = wpl_flex::get_encoded_options($post, 'opt_', wpl_flex::get_field_options($dbst_id)); $q .= "`options`='" . wpl_db::escape($options) . "', "; $q = trim($q, ", "); $query = "UPDATE `#__wpl_dbst` SET " . $q . " WHERE `id`='{$dbst_id}'"; wpl_db::q($query, 'update'); $dbst_type = wpl_flex::get_dbst_key('type', $dbst_id); $dbst_kind = wpl_flex::get_dbst_key('kind', $dbst_id); /** run queries **/ if ($mode == 'add') { wpl_flex::run_dbst_type_queries($dbst_id, $dbst_type, $dbst_kind, 'add'); } /** Multilingual **/ if (wpl_global::check_addon('pro')) { wpl_addon_pro::multilingual($dbst_id); } /** trigger event **/ wpl_global::event_handler('dbst_modified', array('id' => $dbst_id, 'mode' => $mode, 'kind' => $dbst_kind, 'type' => $dbst_type)); /** echo response **/ echo json_encode(array('success' => 1, 'message' => __('Field saved.', WPL_TEXTDOMAIN), 'data' => NULL)); exit; }
/** * Check Multilingual Status * @author Howard <*****@*****.**> * @static * @return boolean */ public static function check_multilingual_status() { $pro = wpl_global::check_addon('pro'); $status = 0; if ($pro) { $status = wpl_global::get_setting('multilingual_status'); } if ($pro and $status) { return true; } else { return false; } }
function wpl_generate_rss() { var rss = ''; rss = wpl_update_qs('wplpage', '', wpl_listing_request_str); rss = wpl_update_qs('wplview', '', rss); rss = wpl_update_qs('wplpagination', '', rss); window.open("<?php echo wpl_property::get_property_rss_link(); ?> ?"+rss); } <?php if (wpl_global::check_addon('aps')) { ?> function map_view_toggle_listing() { if(wplj('.map_view_handler').hasClass('op')) { wplj('.wpl_property_listing_list_view_container').animate({'margin-right': '-220px'}, function() { wplj('.map_view_handler').toggleClass('op'); }); } else { wplj('.wpl_property_listing_list_view_container').animate({'margin-right': '0.5%'}, function() { wplj('.map_view_handler').toggleClass('op');
$latitude = $location_point[0]; $longitude = $location_point[1]; } else { $latitude = isset($vars['sf_radiussearch_lat']) ? $vars['sf_radiussearch_lat'] : 0; $longitude = isset($vars['sf_radiussearch_lng']) ? $vars['sf_radiussearch_lng'] : 0; } if ($latitude and $longitude and $radius and $unit_id) { $unit = wpl_units::get_unit($unit_id); if ($unit) { $tosi = 6371 * 1000 / $unit['tosi']; $radius_si = $radius * $unit['tosi']; $query .= " AND (( " . $tosi . " * acos( cos( radians(" . $latitude . ") ) * cos( radians( googlemap_lt ) ) * cos( radians( googlemap_ln ) - radians(" . $longitude . ") ) + sin( radians(" . $latitude . ") ) * sin( radians( googlemap_lt ) ) ) ) < " . $radius . ") AND `show_address`='1'"; } } $done_this = true; } elseif ($format == 'polygonsearch' and wpl_global::check_addon('aps') and !$done_this) { /** importing library **/ _wpl_import('libraries.addon_aps'); $raw_points = isset($vars['sf_polygonsearchpoints']) ? $vars['sf_polygonsearchpoints'] : '[]'; if (version_compare(wpl_db::version(), '5.6.1', '>=')) { $sql_function = 'ST_Contains'; } else { $sql_function = 'Contains'; } $APS = new wpl_addon_aps(); $polygons = $APS->toPolygons($raw_points); $qq = array(); foreach ($polygons as $polygon) { $polygon_str = ''; foreach ($polygon as $polygon_point) { $polygon_str .= $polygon_point[1] . ' ' . $polygon_point[0] . ', ';
$this->properties_str = $this->_wpl_render($this->tpl_path . '.assets.default_listings', true); if ($this->wplraw == 1) { echo $this->properties_str; exit; } $this->listview_str = $this->_wpl_render($this->tpl_path . '.assets.default_listings_listview', true); if ($this->wplraw == 2) { echo json_encode(array('total_pages' => $this->total_pages, 'current_page' => $this->page_number, 'html' => $this->listview_str)); exit; } $this->_wpl_import($this->tpl_path . '.scripts.js', true, true); if ($this->wplpagination == 'scroll' and $this->property_listview and wpl_global::check_addon('pro')) { $this->_wpl_import($this->tpl_path . '.scripts.js_scroll', true, true); } /** Save Search Add-on **/ if (wpl_global::check_addon('save_searches')) { $this->_wpl_import($this->tpl_path . '.scripts.addon_save_searches', true, true); } ?> <div class="wpl_property_listing_container <?php if (isset($this->property_css_class) and $this->property_css_class == 'map_box') { echo 'wpl-property-listing-mapview'; } ?> " id="wpl_property_listing_container"> <?php /** load position1 **/ wpl_activity::load_position('plisting_position1', array('wpl_properties' => $this->wpl_properties)); ?> <?php
$this->overviewmap = isset($params['overviewmap']) ? $params['overviewmap'] : 0; $this->show_marker = 1; /** unset current key **/ unset($wpl_properties['current']); $this->markers = wpl_property::render_markers($wpl_properties); /** load js codes **/ $this->_wpl_import($this->tpl_path . '.scripts.js', true, true); $this->_wpl_import($this->tpl_path . '.scripts.default', true, true); /** Demographic **/ $this->demographic_status = isset($params['demographic']) ? $params['demographic'] : 0; if ($this->demographic_status and wpl_global::check_addon('demographic')) { $this->_wpl_import($this->tpl_path . '.scripts.addon_demographic', true, true); } /** Map Search **/ $this->map_search_status = isset($params['map_search']) ? $params['map_search'] : 0; if ($this->map_search_status and wpl_global::check_addon('aps')) { $this->_wpl_import($this->tpl_path . '.scripts.addon_aps', true, true); } ?> <div class="wpl_googlemap_container wpl_googlemap_plisting" id="wpl_googlemap_container<?php echo $this->activity_id; ?> " data-wpl-height="<?php echo $this->map_height; ?> "> <div class="wpl_map_canvas" id="wpl_map_canvas<?php echo $this->activity_id; ?> " style="height: <?php echo $this->map_height;
?> value="<?php echo $property_type['id']; ?> "><?php echo __($property_type['name'], WPL_TEXTDOMAIN); ?> </option> <?php } ?> </select> </div> <?php if (wpl_global::check_addon('complex')) { ?> <div> <label for="<?php echo $this->get_field_id('data_parent'); ?> "><?php echo __('Parent', WPL_TEXTDOMAIN); ?> : </label> <input type="text" id="<?php echo $this->get_field_id('data_parent'); ?> " title="<?php echo __('Listing ID of parent property', WPL_TEXTDOMAIN); ?>
/** * Add watermark to an image * @author Francis R <*****@*****.**> * @param string $source: source file string path * @param string $dest : destination file string path * @param int $watermark: 0 if watermark is disable, 1 if watermark is enable * @param array $options: array consist of status, opacity, position and user_logo * @return string : destination file path */ public static function add_watermark_image($source, $dest, $options = '') { if ($options == '') { $options['status'] = 0; } if ($options['status'] != 1) { return; } $filename = $source; //default path for watermark $watermark = WPL_ABSPATH . 'assets' . DS . 'img' . DS . 'system' . DS; if (trim($options['url']) != '') { $watermark .= trim($options['url']); } if (!wpl_file::exists($watermark)) { return; } $source = strtolower($source); $extension = wpl_file::getExt($source); $w_extension = wpl_file::getExt($watermark); list($w_width, $w_height, $w_type, $w_attr) = getimagesize($filename); list($markwidth, $markheight, $w_type1, $w_attr1) = getimagesize($watermark); switch ($extension) { case 'jpg': case 'jpeg': $w_dest = imagecreatefromjpeg($filename); break; case 'gif': $w_dest = imagecreatefromgif($filename); break; case 'png': $w_dest = imagecreatefrompng($filename); break; default: return; } switch ($w_extension) { case 'jpg': case 'jpeg': $w_src = imagecreatefromjpeg($watermark); break; case 'gif': $w_src = imagecreatefromgif($watermark); break; case 'png': $w_src = imagecreatefrompng($watermark); break; default: return; } // Copy and merge $opacity = $options['opacity']; $position = strtolower($options['position']); switch ($position) { case 'center': wpl_images::imagecopymerge_alpha($w_dest, $w_src, $w_width - $markwidth >> 1, $w_height - $markheight >> 1, 0, 0, $markwidth, $markheight, $opacity); break; case 'left': wpl_images::imagecopymerge_alpha($w_dest, $w_src, $w_width - $markwidth > 1, $w_height - $markheight >> 1, 0, 0, $markwidth, $markheight, $opacity); break; case 'right': wpl_images::imagecopymerge_alpha($w_dest, $w_src, $w_width - $markwidth, $w_height - $markheight >> 1, 0, 0, $markwidth, $markheight, $opacity); break; case 'top': wpl_images::imagecopymerge_alpha($w_dest, $w_src, $w_width - $markwidth >> 1, $w_height - $markheight > 1, 0, 0, $markwidth, $markheight, $opacity); break; case 'bottom': wpl_images::imagecopymerge_alpha($w_dest, $w_src, $w_width - $markwidth >> 1, $w_height - $markheight, 0, 0, $markwidth, $markheight, $opacity); break; case 'top-left': wpl_images::imagecopymerge_alpha($w_dest, $w_src, $w_width - $markwidth > 1, $w_height - $markheight > 1, 0, 0, $markwidth, $markheight, $opacity); break; case 'top-right': wpl_images::imagecopymerge_alpha($w_dest, $w_src, $w_width - $markwidth, $w_height - $markheight > 1, 0, 0, $markwidth, $markheight, $opacity); break; case 'bottom-left': wpl_images::imagecopymerge_alpha($w_dest, $w_src, $w_width - $markwidth > 1, $w_height - $markheight, 0, 0, $markwidth, $markheight, $opacity); break; case 'bottom-right': wpl_images::imagecopymerge_alpha($w_dest, $w_src, $w_width - $markwidth, $w_height - $markheight, 0, 0, $markwidth, $markheight, $opacity); break; } if ($extension == 'jpg' || $extension == 'jpeg') { $quality = 95; if (wpl_global::check_addon('optimizer') && wpl_global::get_client() === 0) { $quality = wpl_addon_optimizer::optimize_image(wpl_addon_optimizer::IMAGE_JPEG, $w_dest); } ob_start(); imagejpeg($w_dest, NULL, $quality); $out_image = ob_get_clean(); wpl_file::write($dest, $out_image); } elseif ($extension == 'png') { $quality = 9; if (wpl_global::check_addon('optimizer') && wpl_global::get_client() === 0) { $quality = wpl_addon_optimizer::optimize_image(wpl_addon_optimizer::IMAGE_PNG, $w_dest); } ob_start(); imagepng($w_dest, NULL, $quality); $out_image = ob_get_clean(); wpl_file::write($dest, $out_image); } elseif ($extension == 'gif') { ob_start(); imagegif($w_dest); $out_image = ob_get_clean(); wpl_file::write($dest, $out_image); } imagedestroy($w_src); imagedestroy($w_dest); // Return Destination return $source; }
$return['field_id'] = $field->id; $return['type'] = $field->type; $return['name'] = __($field->name, WPL_TEXTDOMAIN); $rendered_price = wpl_render::render_price($value, $values[$field->table_column . '_unit']); $return['value'] = $rendered_price; $return['price_only'] = $rendered_price; $price_period = array(); if (isset($values[$field->table_column . '_period'])) { $price_period = wpl_property::render_field($values[$field->table_column . '_period'], wpl_flex::get_dbst_id($field->table_column . '_period', $field->kind)); } if (isset($price_period['value'])) { $return['value'] .= ' ' . $price_period['value']; $return['price_period'] = $price_period['value']; } /** Add "From" to Vacation Rental Properties **/ if (wpl_global::check_addon('calendar')) { $listing_types = wpl_global::get_listing_types_by_parent(3); foreach ($listing_types as $listing) { $vacational_listing_types[] = $listing['id']; } if (is_array($vacational_listing_types) and in_array($values['listing'], $vacational_listing_types)) { $return['value'] = __('From', WPL_TEXTDOMAIN) . ' ' . $return['value']; } } if (isset($options['if_zero']) and $options['if_zero'] == 2 and !trim($value)) { $return['value'] = __($options['call_text'], WPL_TEXTDOMAIN); } if (isset($options['if_zero']) and !$options['if_zero'] and !trim($value)) { $return = array(); } $done_this = true;
<?php } else { ?> <?php echo $wp_user->user_login; ?> <?php } ?> </td> <td><?php echo is_object($wpl_data) ? $wpl_data->first_name . ' ' . $wpl_data->last_name : ''; ?> </td> <?php if (wpl_global::check_addon('membership')) { ?> <td> <?php if ($wp_user->id) { ?> <select data-without-chosen name="membership_id_<?php echo $wp_user->ID; ?> " id="membership_id_<?php echo $wp_user->ID; ?> " onChange="wpl_change_membership(<?php echo $wp_user->ID; ?> );" autocomplete="off">
echo $field->table_name; ?> ', '<?php echo $field->table_column; ?> ', meta, '<?php echo $item_id; ?> ', '<?php echo $field->id; ?> '); } var meta_desc_pro_addon = <?php echo wpl_global::check_addon('pro') ? '1' : '0'; ?> ; function meta_desc_manual() { if (!wplj("#wpl_c_<?php echo $field->id; ?> _manual").is(':checked')) { wplj("#wpl_c_<?php echo $field->id; ?> ").attr('disabled', 'disabled'); if (meta_desc_pro_addon) { ajax_save('<?php
public function generate_tab($tpl = 'internal_setting_advanced') { /** checking PRO addon **/ if (!wpl_global::check_addon('membership')) { echo __('Membership addon must be installed for this!', WPL_TEXTDOMAIN); return; } if ($tpl == 'internal_setting_crm' && !wpl_global::check_addon('crm')) { echo __('CRM addon must be installed for this!', WPL_TEXTDOMAIN); return; } /** include the layout **/ parent::render($this->tpl_path, $tpl); }
$addons[9] = array('name' => 'Demographic Info', 'id' => '12', 'addon_name' => 'demographic', 'description' => 'WPL Add-on for drawing and defining regions on the map for different demographic status.', 'readmore_link' => 'http://wpl.realtyna.com/redirect.php?action=download&item=demographic', 'button_text' => 'Download'); $addons[10] = array('name' => 'Optimizer', 'id' => '17', 'addon_name' => 'optimizer', 'description' => 'Optimize property images and speed up your website.', 'readmore_link' => 'http://wpl.realtyna.com/redirect.php?action=download&item=optimizer', 'button_text' => 'Download'); ?> <div class="side-7 side-ni-addons"> <div class="panel-wp"> <h3><?php echo __('Optional Add Ons', WPL_TEXTDOMAIN); ?> </h3> <div class="panel-body"> <div class="wpl-ni-addons-wp wpl_ni_addons_container"> <?php $i = 0; foreach ($addons as $addon) { if (wpl_global::check_addon($addon['addon_name'])) { continue; } $i++; ?> <div class="wpl-ni-addon-row wpl_ni_addon_container" id="wpl_ni_addons_container<?php echo $addon['id']; ?> "> <div class="wpl_ni_addon_subject"> <span class="wpl_ni_addons_addon_name"><?php echo $addon['name']; ?> </span> <a class="readmore_link" href="<?php echo $addon['readmore_link'];
?> " name="<?php echo $this->get_field_name('data'); ?> [image_height]" value="<?php echo isset($instance['data']['image_height']) ? $instance['data']['image_height'] : '230'; ?> " /> </div> <h4><?php echo __('Filter Profiles'); ?> </h4> <?php if (wpl_global::check_addon('pro')) { ?> <?php $membership_types = wpl_users::get_membership_types(); ?> <div> <label for="<?php echo $this->get_field_id('data_user_type'); ?> "><?php echo __('User Type', WPL_TEXTDOMAIN); ?> : </label> <select id="<?php echo $this->get_field_id('data_user_type'); ?>
<?php } else { ?> <label for="wpl_c_<?php echo $field->id; ?> "><?php echo __($label, WPL_TEXTDOMAIN); if (in_array($mandatory, array(1, 2))) { ?> <span class="required-star">*</span><?php } ?> </label> <?php if (isset($options['advanced_editor']) and $options['advanced_editor'] and wpl_global::check_addon('pro')) { ?> <div class="wpl-pwizard-editor"> <?php wp_editor(stripslashes($value), 'tinymce_wpl_c_' . $field->id, array('teeny' => false, 'quicktags' => false)); ?> </div> <input class="wpl-button button-1 wpl-save-btn" type="button" onclick="ajax_save('<?php echo $field->table_name; ?> ', '<?php echo $field->table_column; ?> ', wpl_get_tinymce_content('tinymce_wpl_c_<?php echo $field->id; ?>
/** * This is a function for loading property manager by shortcode * @author Howard R <*****@*****.**> * @static * @param array $instance * @return string */ public static function load_listing_manager($instance = array()) { /** PRO Addon **/ if (!wpl_global::check_addon('PRO')) { return __('PRO addon must be installed for this!', WPL_TEXTDOMAIN); } return wpl_html::load_view('b:listings:manager', $instance); }
/** * Removes a dbst field from dbst table * @author Howard R <*****@*****.**> * @static * @param int $dbst_id * @return boolean */ public static function remove_dbst($dbst_id) { /** first validation **/ if (!$dbst_id) { return false; } /** Multilingual **/ if (wpl_global::check_addon('pro')) { wpl_addon_pro::remove_multilingual($dbst_id); } wpl_db::delete("wpl_dbst", $dbst_id); }
echo isset($this->options->report_abuse) ? $this->options->report_abuse : '0'; ?> " /> <?php } ?> </div> <div class="fanc-row"> <label for="wpl_o_crm"><?php echo __('CRM', WPL_TEXTDOMAIN); ?> </label> <?php if (!wpl_global::check_addon('crm')) { ?> <span id="wpl_o_crm" class="gray_tip"><?php echo __('CRM addon must be installed for this!', WPL_TEXTDOMAIN); ?> </span> <?php } else { ?> <input <?php if (isset($this->options->crm) and $this->options->crm == '1') { echo 'checked="checked""'; } ?> class="text_box" name="option[crm]" type="checkbox" id="wpl_o_crm" value="<?php echo isset($this->options->crm) ? $this->options->crm : '0';
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); $this->profiles_str = $this->_wpl_render($this->tpl_path . '.assets.default_profiles', true); if ($this->wplraw == 1) { echo $this->profiles_str; exit; } $this->listview_str = $this->_wpl_render($this->tpl_path . '.assets.default_profiles_listview', true); if ($this->wplraw == 2) { echo json_encode(array('total_pages' => $this->total_pages, 'current_page' => $this->page_number, 'html' => $this->listview_str)); exit; } $this->_wpl_import($this->tpl_path . '.scripts.js', true, true); if ($this->wplpagination == 'scroll' and $this->property_listview and wpl_global::check_addon('pro')) { $this->_wpl_import($this->tpl_path . '.scripts.js_scroll', true, true); } ?> <div id="wpl_profile_listing_main_container"> <?php if (is_active_sidebar('wpl-profile-listing-top')) { ?> <div class="wpl_plisting_top_sidebar_container"> <?php dynamic_sidebar('wpl-profile-listing-top'); ?> </div> <?php }
/** no direct access * */ defined('_WPLEXEC') or die('Restricted access'); _wpl_import($this->tpl_path . '.scripts.css'); _wpl_import($this->tpl_path . '.scripts.js'); _wpl_import('libraries.activities'); ?> <div class="wrap wpl-wp wpl-dashboard-wp"> <header> <div class="wpl-icon-header wpl-icon-dashboard"></div> <h2> <?php echo __('WPL', WPL_TEXTDOMAIN); ?> <?php echo wpl_global::check_addon('pro') ? 'PRO' : 'Basic'; ?> <span class="wpl-dashboard-ver">v<?php echo wpl_global::wpl_version(); ?> </span> </h2> </header> <div id="dashboard-links-wp"> <ul> <?php foreach ($this->submenus as $submenu) { ?> <li class="link-<?php echo $submenu->id;
/** * This function is for importing/updating properties into the WPL. It uses WPL standard format for importing * This function must call in everywhere that we need to import properties like MLS and IMPORTER Addons. * @author Howard <*****@*****.**> * @static * @param array $properties_to_import * @param string $wpl_unique_field * @param int $user_id * @param string $source * @param boolean $finalize * @param array $log_params * @return array property IDs */ public static function import($properties_to_import, $wpl_unique_field = 'mls_id', $user_id = '', $source = 'mls', $finalize = true, $log_params = array()) { if (!$user_id) { $user_id = wpl_users::get_cur_user_id(); } $pids = array(); $added = array(); // Used for logging results $updated = array(); // Used for logging results /** model **/ $model = new wpl_property(); $possible_columns = wpl_db::columns('wpl_properties'); foreach ($properties_to_import as $property_to_import) { $q = ''; $unique_value = ''; foreach ($property_to_import as $key => $row) { $wpl_field = $row['wpl_table_column'] ? $row['wpl_table_column'] : $key; $wpl_value = $row['wpl_value'] ? $row['wpl_value'] : ''; /** validation table column **/ if (!in_array($wpl_field, $possible_columns)) { continue; } /** set unique value **/ if ($wpl_field == $wpl_unique_field) { $unique_value = $wpl_value; } /** set user id value **/ if ($wpl_field == 'user_id') { $user_id = $wpl_value; } $q .= "`{$wpl_field}`='" . wpl_db::escape($wpl_value) . "',"; } $exists = $model->get_properties_count(" AND `{$wpl_unique_field}`='{$unique_value}'"); if (!$exists) { $pid = $model->create_property_default($user_id); } else { $pid = $model->pid($unique_value, $wpl_unique_field); } /** add property id to return **/ $pids[] = $pid; /** Add source and last sync date **/ if (in_array('source', $possible_columns) and in_array('last_sync_date', $possible_columns)) { $q .= "`source`='{$source}',"; $q .= "`last_sync_date`='" . date('Y-m-d H:i:s') . "',"; } $q = trim($q, ', '); $query = "UPDATE `#__wpl_properties` SET " . $q . " WHERE `id`='" . $pid . "'"; wpl_db::q($query); if ($finalize) { $mode = $exists ? 'edit' : 'add'; $model->finalize($pid, $mode, $user_id); } if ($exists) { $added[] = $unique_value; } else { $updated[] = $unique_value; } } /** Creating Log **/ if ($source == 'mls' and wpl_global::check_addon('mls')) { _wpl_import('libraries.addon_mls'); if (method_exists('wpl_addon_mls', 'log')) { wpl_addon_mls::log($added, $updated, $log_params); } } return $pids; }
/** * Load Registered Widget with Shortcode * @author Howard <*****@*****.**> * @param array $atts * @return string */ public function load_widget_instance($atts) { if (!wpl_global::check_addon('pro')) { return __('Pro addon must be installed for this!', WPL_TEXTDOMAIN); } extract(shortcode_atts(array('id' => ''), $atts)); ob_start(); wpl_widget::widget_instance($id); $output = ob_get_contents(); ob_end_clean(); return $output; }
</span> <?php } else { ?> <input class="text_box" name="option[google_place_radius]" type="text" id="wpl_o_google_place_radius" value="<?php echo isset($this->options->google_place_radius) ? $this->options->google_place_radius : '1000'; ?> " /> <?php } ?> </div> </div> </div> <?php if (wpl_global::check_addon('demographic')) { ?> <div class="fanc-accordion"> <h4 class="fanc-accordion-title" id="wpl_accordion3"><?php echo __('Demographic', WPL_TEXTDOMAIN); ?> </h4> <div class="wpl-accordions-cnt" id="wpl_accordion3_cnt"> <div class="fanc-row"> <label for="wpl_o_demographic"><?php echo __('Demographic', WPL_TEXTDOMAIN); ?> </label> <select class="text_box" name="option[demographic]" id="wpl_o_demographic"> <option value="0" <?php if (isset($this->options->demographic) && $this->options->demographic == 0) {
/** * Changes Membership of a user * @author Howard R <*****@*****.**> * @static * @param int $user_id * @param int $membership_id * @param boolean $trigger_event */ public static function change_membership($user_id, $membership_id = -1, $trigger_event = true) { $user_data = wpl_users::get_wpl_data($user_id); /** Add user to WPL if not added **/ if (!$user_data) { wpl_users::add_user_to_wpl($user_id); $user_data = wpl_users::get_wpl_data($user_id); } $method = (isset($user_data->membership_id) and $user_data->membership_id != $membership_id) ? 'membership_changed' : 'access_updated'; $membership_data = wpl_users::get_wpl_data($membership_id); $query1 = ''; foreach ($membership_data as $key => $value) { if (substr($key, 0, 7) != 'access_' and substr($key, 0, 8) != 'maccess_') { continue; } $query1 .= "`{$key}`='{$value}', "; } $query1 = trim($query1, ', '); $query = "UPDATE `#__wpl_users` SET " . $query1 . ", `membership_id`='" . $membership_id . "' WHERE `id`='" . $user_id . "'"; wpl_db::q($query); /** user assigned to a new group **/ if ($method == 'membership_changed' and wpl_global::check_addon('membership')) { /** Import library **/ _wpl_import('libraries.addon_membership'); $membership = new wpl_addon_membership(); $membership->update_expiry_date($user_id, NULL, true); } /** trigger event **/ $params = array('user_id' => $user_id, 'previous_membership' => $user_data->membership_id, 'new_membership' => $membership_id); if ($trigger_event and $method == 'access_updated') { wpl_global::event_handler('user_access_updated', $params); } elseif ($trigger_event and $method == 'membership_changed') { wpl_global::event_handler('user_membership_changed', $params); } }
$this->map_height = isset($params['map_height']) ? $params['map_height'] : 480; $this->default_lt = isset($params['default_lt']) ? $params['default_lt'] : '38.685516'; $this->default_ln = isset($params['default_ln']) ? $params['default_ln'] : '-101.073324'; $this->default_zoom = isset($params['default_zoom']) ? $params['default_zoom'] : '4'; $this->infowindow_event = isset($params['infowindow_event']) ? $params['infowindow_event'] : 'click'; $this->overviewmap = isset($params['overviewmap']) ? $params['overviewmap'] : 0; $this->show_marker = 1; /** unset current key **/ unset($wpl_properties['current']); $this->markers = wpl_property::render_markers($wpl_properties); /** load js codes **/ $this->_wpl_import($this->tpl_path . '.scripts.js', true, true); $this->_wpl_import($this->tpl_path . '.scripts.default', true, true); /** Demographic **/ $this->demographic_status = isset($params['demographic']) ? $params['demographic'] : 0; if ($this->demographic_status and wpl_global::check_addon('demographic')) { $this->_wpl_import($this->tpl_path . '.scripts.addon_demographic', true, true); } ?> <div class="wpl_googlemap_container wpl_googlemap_plisting" id="wpl_googlemap_container<?php echo $this->activity_id; ?> "> <div class="wpl_map_canvas" id="wpl_map_canvas<?php echo $this->activity_id; ?> " style="height: <?php echo $this->map_height; ?> px;"></div> </div>