本文整理汇总了PHP中wpl_global::event_handler方法的典型用法代码示例。如果您正苦于以下问题:PHP wpl_global::event_handler方法的具体用法?PHP wpl_global::event_handler怎么用?PHP wpl_global::event_handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpl_global
的用法示例。
在下文中一共展示了wpl_global::event_handler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_params
private function save_params()
{
$table = wpl_request::getVar('table');
$id = wpl_request::getVar('id');
$post = wpl_request::get('post');
$keys = (isset($post['wpl_params']) and is_array($post['wpl_params']['keys'])) ? $post['wpl_params']['keys'] : array();
$values = (isset($post['wpl_params']) and is_array($post['wpl_params']['values'])) ? $post['wpl_params']['values'] : array();
$params = array();
foreach ($keys as $key => $value) {
if (trim($value) == '') {
continue;
}
$params[$value] = $values[$key];
}
/** save params **/
wpl_global::set_params($table, $id, $params);
/** trigger event **/
wpl_global::event_handler('params_saved', array('table' => $table, 'id' => $id, 'params' => $params));
$res = 1;
$message = $res ? __('Params Saved.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN);
$data = NULL;
$response = array('success' => $res, 'message' => $message, 'data' => $data);
echo json_encode($response);
exit;
}
示例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: remove_property_type
/**
* Removes property type
* @author Howard R <howard@realtyna.com>
* @static
* @param int $property_type_id
* @return boolean
*/
public static function remove_property_type($property_type_id)
{
/** trigger event **/
wpl_global::event_handler('property_type_removed', array('id' => $property_type_id));
$query = "DELETE FROM `#__wpl_property_types` WHERE `id`='{$property_type_id}'";
$result = wpl_db::q($query);
return $result;
}
示例4: update
/**
* Updates wpl_sort_options table
* @author Howard <howard@realtyna.com>
* @static
* @param string $table
* @param int $id
* @param string $key
* @param string $value
* @return boolean
*/
public static function update($table = 'wpl_sort_options', $id, $key, $value = '')
{
/** first validation **/
if (trim($table) == '' or trim($id) == '' or trim($key) == '') {
return false;
}
/** trigger event **/
wpl_global::event_handler('sort_options_updated', array('id' => $id, 'key' => $value));
return wpl_db::set($table, $id, $key, $value);
}
示例5: insert_listing_type
/**
* Add a new listing type
* @author Howard R <howard@realtyna.com>
* @static
* @param type $parent
* @param type $name
* @param type $gicon
* @return type
*/
public static function insert_listing_type($parent, $name, $gicon = NULL)
{
$query = "INSERT INTO `#__wpl_listing_types` (`parent`,`enabled`,`editable`,`gicon`,`name`) VALUES ('{$parent}','1','2','{$gicon}','{$name}')";
$id = wpl_db::q($query, 'insert');
$query = "UPDATE `#__wpl_listing_types` SET `index`='{$id}.00' WHERE `id`='{$id}'";
wpl_db::q($query);
/** trigger event **/
wpl_global::event_handler('listing_type_added', array('name' => $name));
return $id;
}
示例6: update_file
/**
* Updates a file
* @author Howard R <howard@realtyna.com>
* @static
* @param string $file_name
* @param int $parent_id
* @param array $values
* @return boolean
*/
public static function update_file($file_name, $parent_id, $values = array())
{
/** first validation **/
if (!trim($file_name) or !trim($parent_id) or count($values) == 0) {
return false;
}
$q = '';
foreach ($values as $key => $value) {
$q .= "`{$key}`='{$value}', ";
}
$q = trim($q, ", ");
$file_name = trim($file_name);
$query = "UPDATE `#__wpl_items` SET " . $q . " WHERE `parent_id`='{$parent_id}' AND `item_name`='{$file_name}'";
$affected_rows = wpl_db::q($query, 'update');
/** trigger event **/
wpl_global::event_handler('item_updated', array('file_name' => $file_name, 'parent_id' => $parent_id));
return $affected_rows;
}
示例7: save_room_type
/**
* Adds a new room type
* @author Howard <howard@realtyna.com>
* @static
* @param string $name
* @return int
*/
public static function save_room_type($name)
{
$query = "INSERT INTO `#__wpl_room_types` (`name`,`icon`) VALUES ('{$name}', 'default.png')";
$id = wpl_db::q($query, 'insert');
/** trigger event **/
wpl_global::event_handler('room_type_added', array('id' => $id));
return $id;
}
示例8: gicon_delete
private function gicon_delete($icon)
{
if (trim($icon) == '') {
$icon = wpl_request::getVar('icon');
}
$dest = WPL_ABSPATH . 'assets' . DS . 'img' . DS . 'listing_types' . DS . 'gicon' . DS . $icon;
if (wpl_file::exists($dest)) {
wpl_file::delete($dest);
}
/** trigger event **/
wpl_global::event_handler('gicon_removed', array('icon' => $icon));
exit;
}
示例9: remove_dbst
/**
* Removes a dbst field from dbst table
* @author Howard R <howard@realtyna.com>
* @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);
}
/** trigger event **/
wpl_global::event_handler('dbst_removed', $dbst_id);
wpl_db::delete("wpl_dbst", $dbst_id);
}
示例10: clear_cache
/**
* Removes WPL cached data
* @author Howard <howard@realtyna.com>
* @static
* @param type $cache_type
* @return boolean
*/
public static function clear_cache($cache_type = 'all')
{
/** first validation **/
$cache_type = strtolower($cache_type);
if (trim($cache_type) == '') {
return false;
}
/** import libraries **/
_wpl_import('libraries.property');
_wpl_import('libraries.items');
if ($cache_type == 'unfinalized_properties' or $cache_type == 'all') {
$properties = wpl_db::select("SELECT `id` FROM `#__wpl_properties` WHERE `finalized`='0'", 'loadAssocList');
foreach ($properties as $property) {
wpl_property::purge($property['id']);
}
}
if ($cache_type == 'properties_cached_data' or $cache_type == 'all') {
$q = " `location_text`='', `rendered`='', `alias`=''";
if (wpl_global::check_multilingual_status()) {
$q = self::get_multilingual_query(array('alias', 'location_text', 'rendered'));
}
$query = "UPDATE `#__wpl_properties` SET " . $q;
wpl_db::q($query);
}
if ($cache_type == 'location_texts' or $cache_type == 'all') {
$q = " `location_text`=''";
if (wpl_global::check_multilingual_status()) {
$q = self::get_multilingual_query(array('location_text'));
}
$query = "UPDATE `#__wpl_properties` SET " . $q;
wpl_db::q($query);
}
if ($cache_type == 'listings_thumbnails' or $cache_type == 'all') {
$properties = wpl_db::select("SELECT `id`, `kind` FROM `#__wpl_properties` WHERE `id`>0", 'loadAssocList');
$ext_array = array('jpg', 'jpeg', 'gif', 'png');
foreach ($properties as $property) {
$path = wpl_items::get_path($property['id'], $property['kind']);
$thumbnails = wpl_folder::files($path, 'th.*\\.(' . implode('|', $ext_array) . ')$', 3, true);
foreach ($thumbnails as $thumbnail) {
wpl_file::delete($thumbnail);
}
}
}
if ($cache_type == 'users_cached_data' or $cache_type == 'all') {
$q = " `location_text`='', `rendered`=''";
if (wpl_global::check_multilingual_status()) {
$q = self::get_multilingual_query(array('location_text', 'rendered'), 'wpl_users');
}
$query = "UPDATE `#__wpl_users` SET " . $q;
wpl_db::q($query);
}
if ($cache_type == 'users_thumbnails' or $cache_type == 'all') {
$users = wpl_db::select("SELECT `id` FROM `#__wpl_users` WHERE `id`>0", 'loadAssocList');
$ext_array = array('jpg', 'jpeg', 'gif', 'png');
foreach ($users as $user) {
$path = wpl_items::get_path($user['id'], 2);
$thumbnails = wpl_folder::files($path, 'th.*\\.(' . implode('|', $ext_array) . ')$', 3, true);
foreach ($thumbnails as $thumbnail) {
wpl_file::delete($thumbnail);
}
}
}
/** trigger event **/
wpl_global::event_handler('cache_cleared', array('cache_type' => $cache_type));
return true;
}
示例11: update_package
private function update_package()
{
$sid = wpl_request::getVar('sid');
$tmp_directory = wpl_global::init_tmp_folder();
$dest = $tmp_directory . 'package.zip';
$zip_file = wpl_global::get_web_page('http://billing.realtyna.com/index.php?option=com_rls&view=downloadables&task=download&sid=' . $sid . '&randomkey=' . rand(1, 100));
if (!$zip_file) {
$this->response(array('success' => '0', 'error' => __('Error: #U202, Could not download the update package!', WPL_TEXTDOMAIN), 'message' => ''));
}
if (!class_exists('ZipArchive')) {
$this->response(array('success' => '0', 'error' => __('Error: #U205, Your PHP has no ZipArchive support enabled!', WPL_TEXTDOMAIN), 'message' => ''));
}
if (!wpl_file::write($dest, $zip_file)) {
$this->response(array('success' => '0', 'error' => __('Error: #U203, Could not create the update file!', WPL_TEXTDOMAIN), 'message' => ''));
}
if (!wpl_global::zip_extract($dest, $tmp_directory)) {
$this->response(array('success' => '0', 'error' => __('Error: #U204, Could not extract the update file!', WPL_TEXTDOMAIN), 'message' => ''));
}
$script_file = $tmp_directory . 'installer.php';
if (!wpl_file::exists($script_file)) {
$this->response(array('error' => __("Installer file doesn't exist!", WPL_TEXTDOMAIN), 'message' => ''));
}
if (!is_writable(WPL_ABSPATH . 'WPL.php')) {
$this->response(array('error' => __("PHP doesn't have write access to the files and directories!", WPL_TEXTDOMAIN), 'message' => ''));
}
/** including installer and run the install method **/
include $script_file;
if (!class_exists('wpl_installer')) {
$this->response(array('error' => __("Installer class doesn't exist!", WPL_TEXTDOMAIN), 'message' => ''));
}
/** run install script **/
$wpl_installer = new wpl_installer();
$wpl_installer->path = $tmp_directory;
if (!$wpl_installer->run()) {
$this->response(array('error' => $wpl_installer->error, 'message' => ''));
}
/** Trigger Event **/
wpl_global::event_handler('package_updated', array('package_id' => isset($wpl_installer->addon_id) ? $wpl_installer->addon_id : 0));
$message = $wpl_installer->message ? $wpl_installer->message : __('Addon Updated.', WPL_TEXTDOMAIN);
$this->response(array('error' => '', 'message' => $message));
}
示例12: update_a_exchange_rate
/**
* Update one currency exchange rate
* @author Howard <howard@realtyna.com>
* @static
* @param type $unit_id
* @param type $currency_code
* @return int
*/
public static function update_a_exchange_rate($unit_id, $currency_code)
{
$exchange_rate = self::currency_converter($currency_code, 'USD', 1);
$result = self::update($unit_id, 'tosi', $exchange_rate);
/** trigger event **/
wpl_global::event_handler('exchange_rate_updated', array('unit_id' => $unit_id, 'currency_code' => $currency_code));
if ($result) {
return $exchange_rate;
} else {
return 0;
}
}
示例13: update_activity
/**
* Update Activity by Given ID
* @author Kevin J <kevin@realtyna.com>
* @static
* @param array $information
* @return boolean
*/
public static function update_activity($information)
{
$information = wpl_db::escape($information);
$query = 'UPDATE `#__wpl_activities` SET ';
$query .= "`activity` = '{$information['activity']}',`position` = '{$information['position']}',`enabled` = {$information['enabled']},";
$query .= "`params` = '{$information['params']}',`show_title` = {$information['show_title']},";
$query .= "`title` = '{$information['title']}', `index` = " . (double) $information['index'] . ",";
$query .= "`association_type` = '{$information['association_type']}', `associations` = '{$information['associations']}', `client` = '{$information['client']}'";
$query .= " WHERE `id` = '" . $information['activity_id'] . "'";
/** trigger event **/
wpl_global::event_handler('activity_updated', array('id' => $information['activity_id']));
return wpl_db::q($query);
}
示例14: 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);
}
示例15: delete_location
private function delete_location($level, $location_id)
{
$res = wpl_locations::delete_location($location_id, $level, true);
/** trigger event **/
wpl_global::event_handler('location_deleted', array('level' => $level, 'location_id' => $location_id));
$res = $res ? 1 : 0;
$message = $res ? __('Location(s) Deleted.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN);
$data = NULL;
$response = array('success' => $res, 'message' => $message, 'data' => $data);
echo json_encode($response);
exit;
}