/** * Fix Aliases for all languages * @author Howard <*****@*****.**> * @static * @param array $property_data * @param int $property_id */ public static function fix_aliases($property_data, $property_id = 0) { /** fetch property data if property id is setted **/ if ($property_id) { $property_data = self::get_property_raw_data($property_id); } if (!$property_id) { $property_id = $property_data['id']; } $columns = wpl_global::get_multilingual_columns(array('alias'), 'wpl_properties'); foreach ($columns as $column) { $alias = wpl_db::escape(wpl_global::url_encode($property_data[$column])); $query = "UPDATE `#__wpl_properties` SET `{$column}`='{$alias}' WHERE `id`='{$property_id}'"; wpl_db::q($query, 'UPDATE'); } }
/** * Get Multilingual columns for clear cache queries * @author Howard <*****@*****.**> * @static * @param array $columns * @param string $table * @return string */ public static function get_multilingual_query($columns = array(), $table = 'wpl_properties') { $q = ""; $columns = wpl_global::get_multilingual_columns($columns, $table); foreach ($columns as $column) { $q .= "`{$column}`='', "; } return trim($q, ', '); }