Esempio n. 1
1
 /**
  * Returns User Profile Link
  * @author Howard R <*****@*****.**>
  * @static
  * @param int $user_id
  * @param int $target_id
  * @return string
  */
 public static function get_profile_link($user_id = '', $target_id = 0)
 {
     /** fetch currenr user data if user id is empty **/
     if (trim($user_id) == '') {
         $user_id = self::get_cur_user_id();
     }
     $user_data = self::get_user($user_id);
     $home_type = wpl_global::get_wp_option('show_on_front', 'posts');
     $home_id = wpl_global::get_wp_option('page_on_front', 0);
     if (!$target_id) {
         $target_id = wpl_request::getVar('wpltarget', 0);
     }
     if ($target_id) {
         $url = wpl_global::add_qs_var('uid', $user_id, wpl_sef::get_page_link($target_id));
         if ($home_type == 'page' and $home_id == $target_id) {
             $url = wpl_global::add_qs_var('wplview', 'profile_show', $url);
         }
     } else {
         $url = wpl_sef::get_wpl_permalink(true);
         $nosef = wpl_sef::is_permalink_default();
         $wpl_main_page_id = wpl_sef::get_wpl_main_page_id();
         if ($nosef or $home_type == 'page' and $home_id == $wpl_main_page_id) {
             $url = wpl_global::add_qs_var('wplview', 'profile_show', $url);
             $url = wpl_global::add_qs_var('uid', $user_id, $url);
         } else {
             $url .= urlencode($user_data->data->user_login) . '/';
         }
     }
     return $url;
 }
Esempio n. 2
0
 public function show_help_tab($contextual_help, $screen_id, $screen)
 {
     /** Don't run if it's not WPL Page **/
     if ($screen->parent_base != 'WPL_main_menu') {
         return;
     }
     $page = wpl_request::getVar('page', '');
     /** First Validation **/
     if (!trim($page)) {
         return false;
     }
     $tabs = array();
     $path = _wpl_import('assets.helps.' . $page, true, true);
     if (wpl_file::exists($path)) {
         $tabs = (include_once $path);
     }
     /** No Help **/
     if (!is_array($tabs) or is_array($tabs) and !count($tabs)) {
         return false;
     }
     $screen = get_current_screen();
     foreach ($tabs['tabs'] as $tab) {
         /** Add Help Tab **/
         $screen->add_help_tab(array('id' => $tab['id'], 'title' => $tab['title'], 'content' => $tab['content']));
     }
     if (!isset($tabs['sidebar'])) {
         $tabs['sidebar'] = array('content' => '<a class="wpl_contextual_help_tour" href="' . wpl_global::add_qs_var('wpltour', 1) . '">' . __('Introduce Tour', WPL_TEXTDOMAIN) . '</a>');
     }
     $screen->set_help_sidebar($tabs['sidebar']['content']);
 }
Esempio n. 3
0
                                <?php 
echo __('Your property successfully finalized!', WPL_TEXTDOMAIN);
?>
                            </span>
                            <div class="finilize-btn-wp">
                                <?php 
$listing_target_page = wpl_global::get_client() == 1 ? wpl_global::get_setting('backend_listing_target_page') : NULL;
$property_link = wpl_property::get_property_link('', $this->property_id, $listing_target_page);
$new_link = wpl_global::remove_qs_var('pid', wpl_global::get_full_url());
if ($this->kind) {
    $new_link = wpl_global::add_qs_var('kind', $this->kind, $new_link);
}
if (wpl_global::get_client() == 1) {
    $manager_link = wpl_global::add_qs_var('kind', $this->kind, wpl_global::get_wpl_admin_menu('wpl_admin_listings'));
} else {
    $manager_link = wpl_global::add_qs_var('kind', $this->kind, wpl_global::remove_qs_var('wplmethod', wpl_global::remove_qs_var('pid')));
}
?>
                                <a class="wpl-button button-2" target="_blank" href="<?php 
echo $property_link;
?>
"><?php 
echo __('View this listing', WPL_TEXTDOMAIN);
?>
</a>
                                <a class="wpl-button button-2" href="<?php 
echo $new_link;
?>
"><?php 
echo __('Add new listing', WPL_TEXTDOMAIN);
?>
Esempio n. 4
0
<?php

/** no direct access **/
defined('_WPLEXEC') or die('Restricted access');
?>
<div id="wpl_listings_top_tabs_container">
    <ul class="wpl-tabs">
        <?php 
foreach ($this->kinds as $kind) {
    ?>
        <li class="<?php 
    echo $this->kind == $kind['id'] ? 'wpl-selected-tab' : '';
    ?>
" id="wplkind<?php 
    echo $kind['id'];
    ?>
">
            <a href="<?php 
    echo wpl_global::add_qs_var('kind', $kind['id']);
    ?>
"><?php 
    echo __($kind['name'], WPL_TEXTDOMAIN);
    ?>
</a>
        </li>
        <?php 
}
?>
    </ul>
</div>
Esempio n. 5
0
$separator = isset($params['separator']) ? $params['separator'] : ' > ';
$location_level = isset($params['location_level']) ? $params['location_level'] : 1;
$location_id = isset($params['location_id']) ? $params['location_id'] : '';
$load_zipcodes = isset($params['load_zipcodes']) ? $params['load_zipcodes'] : 0;
$location_tree = wpl_locations::get_location_tree($location_id, $location_level - 1);
$levels = count($location_tree) + 1;
$breadcrumb_str = "";
$i = 1;
foreach ($location_tree as $branch) {
    if (trim($branch['name']) == '') {
        continue;
    }
    $link = wpl_global::add_qs_var('level', $levels, $root_url);
    $link = wpl_global::add_qs_var('sf_select_parent', $branch['id'], $link);
    if ($load_zipcodes and $i == 1) {
        $link = wpl_global::add_qs_var('load_zipcodes', 1, $link);
    }
    $breadcrumb_str = $separator . '<a href="' . $link . '">' . (($load_zipcodes and $i == 1) ? $branch['name'] . ' (' . __('Zipcodes', WPL_TEXTDOMAIN) . ')' : $branch['name']) . '</a>' . $breadcrumb_str;
    $levels--;
    $i++;
}
?>
<div class="<?php 
echo $element_class;
?>
" id="<?php 
echo $html_element_id;
?>
">
	<a href="<?php 
echo $root_url;
Esempio n. 6
0
 /**
  * Returns Property Edit Link
  * @author Howard <*****@*****.**>
  * @static
  * @param int $property_id
  * @return boolean|string
  */
 public static function get_property_edit_link($property_id = 0)
 {
     /** first validation **/
     if (!$property_id) {
         return false;
     }
     $target_id = wpl_request::getVar('wpltarget', 0);
     if ($target_id) {
         $url = wpl_global::add_qs_var('pid', $property_id, wpl_sef::get_page_link($target_id));
     } else {
         $url = wpl_global::add_qs_var('pid', $property_id, wpl_global::get_wpl_admin_menu('wpl_admin_add_listing'));
     }
     return $url;
 }
Esempio n. 7
0
', '<?php 
    echo $field->id;
    ?>
');
            }
        }
    });
});

function wpl_parent_is_selected<?php 
    echo $field->id;
    ?>
(parent_id)
{
    var url = "<?php 
    echo wpl_global::add_qs_var('pid', $item_id, wpl_global::get_full_url());
    ?>
";
    
    ajax = wpl_run_ajax_query("<?php 
    echo wpl_global::get_full_url();
    ?>
", "wpl_format=b:listing:ajax&wpl_function=set_parent&item_id=<?php 
    echo $item_id;
    ?>
&parent_id="+parent_id+"&kind=<?php 
    echo $this->kind;
    ?>
&replace=<?php 
    echo $replace;
    ?>
Esempio n. 8
0
echo __('Actions', WPL_TEXTDOMAIN);
?>
</th>
                </tr>
            </thead>
            <tbody>
                <?php 
foreach ($this->notifications as $notification) {
    ?>
                <tr>
                    <td class="size-1"><?php 
    echo $notification->id;
    ?>
</td>
                    <td class="wpl_notification_subject"><a href="<?php 
    echo wpl_global::add_qs_var('tpl', 'modify');
    ?>
&id=<?php 
    echo $notification->id;
    ?>
"><?php 
    echo $notification->subject;
    ?>
</a></td>
                    <td class="wpl_notification_description"><?php 
    echo $notification->description;
    ?>
</td>
                    <td class="manager-wp">
                        <span class="wpl_ajax_loader" id="wpl_ajax_loader_<?php 
    echo $notification->id;
Esempio n. 9
0
    $wpl_data = wpl_users::get_wpl_data($wp_user->ID);
    ?>
                <tr id="item_row<?php 
    echo $wp_user->ID;
    ?>
">
                    <td class="size-1"><?php 
    echo $wp_user->ID;
    ?>
</td>
                    <td>
                        <?php 
    if ($wp_user->id) {
        ?>
                        <a href="<?php 
        echo wpl_global::add_qs_var('id', $wp_user->ID, wpl_global::get_wpl_admin_menu('wpl_admin_profile'));
        ?>
"><?php 
        echo $wp_user->user_login;
        ?>
</a>
                        <?php 
    } else {
        ?>
                        <?php 
        echo $wp_user->user_login;
        ?>
                        <?php 
    }
    ?>
                    </td>
Esempio n. 10
0
<?php

/** no direct access **/
defined('_WPLEXEC') or die('Restricted access');
$this->_wpl_import($this->tpl_path . '.scripts.css');
$this->_wpl_import($this->tpl_path . '.scripts.js');
?>
<div class="wrap wpl-wp pmanager-wp">
    <header>
        <div id="icon-pmanager" class="icon48"></div>
        <h2><?php 
echo __(ucfirst($this->kind_label) . ' Manager', WPL_TEXTDOMAIN);
?>
</h2>
        <button class="wpl-button button-1" onclick="window.location.href = wplj(this).data('href');" data-href="<?php 
echo wpl_global::add_qs_var('kind', $this->kind, wpl_global::get_wpl_admin_menu('wpl_admin_add_listing'));
?>
"><?php 
echo __('Add Listing', WPL_TEXTDOMAIN);
?>
</button>
    </header>
    <?php 
$this->include_tabs();
?>
    <div class="wpl_property_manager_list"><div class="wpl_show_message"></div></div>
    <div class="pmanager-cnt">
        
        <!-- generate search form -->
        <?php 
$this->generate_search_form();
Esempio n. 11
0
 /**
  * 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;
     }
     /** Access **/
     $access = true;
     _wpl_import('libraries.filters');
     @extract(wpl_filters::apply('listing_manager_access', array('kind' => $this->kind, 'user_id' => $current_user_id)));
     if (!$access) {
         /** import message tpl **/
         $this->message = __("You don't have access to this page!", 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;
     $this->client = wpl_global::get_client();
     if ($this->client) {
         $this->backend = true;
         $this->frontend = false;
         $this->add_link = wpl_global::add_qs_var('kind', $this->kind, wpl_global::get_wpl_admin_menu('wpl_admin_add_listing'));
     } else {
         $this->backend = false;
         $this->frontend = true;
         $this->add_link = wpl_global::add_qs_var('kind', $this->kind, wpl_global::add_qs_var('wplmethod', 'wizard'));
     }
     return true;
 }
Esempio n. 12
0
 public function get_pagenum_link($id)
 {
     if (strpos($this->target, '?') === false) {
         if ($this->urlF) {
             return str_replace($this->urlF, $id, $this->target);
         } else {
             return wpl_global::add_qs_var($this->parameterName, $id, $this->target);
         }
     } else {
         return wpl_global::add_qs_var($this->parameterName, $id, $this->target);
     }
 }
Esempio n. 13
0
 /**
  * Returns RSS link of property listing
  * @author Steve A. <*****@*****.**>
  * @static
  * @return string|boolean
  */
 public static function get_property_rss_link()
 {
     $nosef = wpl_sef::is_permalink_default();
     $home_type = wpl_global::get_wp_option('show_on_front', 'posts');
     $home_id = wpl_global::get_wp_option('page_on_front', 0);
     $wpl_main_page_id = wpl_sef::get_wpl_main_page_id();
     if ($nosef or $home_type == 'page' and $home_id == $wpl_main_page_id) {
         $url = wpl_sef::get_wpl_permalink(true);
         $url = wpl_global::add_qs_var('wplview', 'features', $url);
         $url = wpl_global::add_qs_var('wpltype', 'rss', $url);
     } else {
         $url = wpl_sef::get_wpl_permalink(true) . 'features/rss';
     }
     return $url;
 }
Esempio n. 14
0
 public function get_pagenum_link($id)
 {
     if ($this->js_link) {
         return 'javascript:wpl_paginate(' . $id . ');';
     }
     if (strpos($this->target, '?') === false) {
         if ($this->urlF) {
             return str_replace($this->urlF, $id, $this->target);
         } else {
             return wpl_global::add_qs_var($this->parameterName, $id, $this->target);
         }
     } else {
         return wpl_global::add_qs_var($this->parameterName, $id, $this->target);
     }
 }