Ejemplo n.º 1
0
 /**
  * Constructor function
  * @author Howard R <*****@*****.**>
  * @param type $init
  */
 public function __construct($init = true)
 {
     /** initialize html library **/
     if ($init) {
         $html = $this->getInstance(false);
         $client = wpl_global::get_client();
         add_filter('wp_title', array($html, 'title'), 9999, 2);
         add_action('wp_head', array($html, 'generate_head'), 9999);
         if ($client == 0) {
             /** SET WPL canonical **/
             remove_action('wp_head', 'rel_canonical');
             add_action('wp_head', array($html, 'generate_canonical'), 9999);
             add_action('wp_footer', array($html, 'generate_footer'), 9999);
         } elseif ($client == 1) {
             add_action('in_admin_footer', array($html, 'generate_footer'), 9999);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * For adding styles and scripts
  * @author Howard <*****@*****.**>
  * @return void
  */
 public static function import_styles_scripts()
 {
     $wpl_extensions = new wpl_extensions();
     $javascripts = $wpl_extensions->get_extensions(1, 'javascript', wpl_global::get_client());
     foreach ($javascripts as $javascript) {
         $wpl_extensions->import_javascript($javascript);
     }
     $styles = $wpl_extensions->get_extensions(1, 'style', wpl_global::get_client());
     foreach ($styles as $style) {
         $wpl_extensions->import_style($style);
     }
 }
Ejemplo n.º 3
0
                        <div class="finilize-icon"></div>
                        <div class="message-wp">
                            <span>
                                <?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;
?>
Ejemplo n.º 4
0
 /**
  * Returns some activity with specified criteria
  * @author Howard <*****@*****.**>
  * @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);
 }
Ejemplo n.º 5
0
/** no direct access * */
defined('_WPLEXEC') or die('Restricted access');
if ($type == 'googlemap' and !$done_this) {
    /** WPL Demographic addon **/
    $demographic_objects = array();
    if (wpl_global::check_addon('demographic')) {
        _wpl_import('libraries.addon_demographic');
        $demographic = new wpl_addon_demographic();
        $demographic_objects = wpl_items::get_items($item_id, 'demographic', $kind);
    }
    $w = 450;
    $h = 300;
    $ln_table_col = 'googlemap_ln';
    $lt_table_col = 'googlemap_lt';
    /** Add it on backend only **/
    if (wpl_global::get_client()) {
        $javascript = (object) array('param1' => 'wpl-googlemap-api3', 'param2' => 'http' . (stristr(wpl_global::get_full_url(), 'https://') != '' ? 's' : '') . '://maps.google.com/maps/api/js?libraries=places,drawing&sensor=false', 'external' => true);
        wpl_extensions::import_javascript($javascript);
    }
    ?>
<script type="text/javascript">
wplj(document).ready(function()
{
	try
	{
		wplj(".wpl_listing_all_location_container_locations, .wpl_c_field_42, .wpl_c_post_code, .wpl_c_street_no").change(function()
		{
			wpl_address_creator();
			wpl_code_address(wplj("#wpl_map_address<?php 
    echo $field->id;
    ?>
Ejemplo n.º 6
0
 /**
  * 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;
 }
Ejemplo n.º 7
0
    {
        if ($this->_wpl_client == 'activities') {
            return 'wpl_activity_' . $exploded_str[2] . '_' . $exploded_str[1];
        } else {
            return 'wpl_' . $exploded_str[1] . '_controller';
        }
    }
    /**
     * Returns WPL path of controller
     * @author Howard <*****@*****.**>
     * @return string
     */
    private function get_class_path()
    {
        return 'views.' . $this->_wpl_client . '.' . $this->_wpl_folder . '.' . $this->_wpl_file;
    }
}
$wpl_format = wpl_request::getVar('wpl_format');
if (trim($wpl_format) != '') {
    _wpl_import('libraries.activities');
    $wpl_request_controller = new wpl_request_controller($wpl_format);
    /** actiob fur triggering request **/
    $client = wpl_global::get_client();
    if ($client == 1) {
        $hook = 'wp_loaded';
    } elseif ($client == 0) {
        $hook = 'wp';
    }
    # WordPress Frontend
    add_action($hook, array($wpl_request_controller, 'run'), 1);
}
Ejemplo n.º 8
0
    ?>
" class="propery-wp">
                    <div class="checkbox-wp">
                        <input class="js-pcheckbox" type="checkbox" id="<?php 
    echo $property['data']['id'];
    ?>
" />    
                    </div>

                    <div class="property-image">
                        <?php 
    /** load position3 **/
    wpl_activity::load_position('pmanager_position3', array('wpl_properties' => $this->wpl_properties));
    ?>
                        <?php 
    $listing_target_page = wpl_global::get_client() == 1 ? wpl_global::get_setting('backend_listing_target_page') : NULL;
    ?>
                        <a class="p-links" href="<?php 
    echo wpl_property::get_property_link('', $property['data']['id'], $listing_target_page);
    ?>
"><?php 
    echo __('View this listing', WPL_TEXTDOMAIN);
    ?>
</a>
                    </div>
                    <div class="info-action-wp">
                        <div class="property-detailes">
                            
                            <?php 
    if (isset($property['property_title']) and trim($property['property_title'])) {
        ?>
Ejemplo n.º 9
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;
 }
Ejemplo n.º 10
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 {
         /** Backend **/
         if (wpl_global::get_client()) {
             $url = wpl_global::add_qs_var('pid', $property_id, wpl_global::get_wpl_admin_menu('wpl_admin_add_listing'));
         } else {
             $url = wpl_global::add_qs_var('pid', $property_id, wpl_global::add_qs_var('wplmethod', 'wizard'));
         }
     }
     return $url;
 }