source: extensions/UserCollections/include/functions.inc.php @ 23551

Last change on this file since 23551 was 23551, checked in by mistic100, 11 years ago

many corrections & optimizations + remove useless code + clean

File size: 2.3 KB
Line 
1<?php
2defined('USER_COLLEC_PATH') or die('Hacking attempt!');
3
4function uc_check_email_validity($mail_address)
5{
6  if (function_exists('email_check_format'))
7  {
8    return email_check_format($mail_address); // Piwigo 2.5
9  }
10  else if (version_compare(PHP_VERSION, '5.2.0') >= 0)
11  {
12    return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false;
13  }
14  else
15  {
16    $atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';   // before  arobase
17    $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name
18    $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i';
19
20    return (bool)preg_match($regex, $mail_address);
21  }
22}
23
24function get_collection_preferred_image_orders()
25{
26  global $conf;
27   
28  return trigger_event('get_category_preferred_image_orders', array(
29    array(l10n('Date added to collection, new &rarr; old'), 'add_date DESC', true),
30    array(l10n('Date added to collection, old &rarr; new'), 'add_date ASC',  true),
31    array(l10n('Photo title, A &rarr; Z'),        'name ASC',             true),
32    array(l10n('Photo title, Z &rarr; A'),        'name DESC',            true),
33    array(l10n('Date created, new &rarr; old'),   'date_creation DESC',   true),
34    array(l10n('Date created, old &rarr; new'),   'date_creation ASC',    true), 
35    array(l10n('Date posted, new &rarr; old'),    'date_available DESC',  true),
36    array(l10n('Date posted, old &rarr; new'),    'date_available ASC',   true),
37    array(l10n('Rating score, high &rarr; low'),  'rating_score DESC',    $conf['rate']),
38    array(l10n('Rating score, low &rarr; high'),  'rating_score ASC',     $conf['rate']),
39    array(l10n('Visits, high &rarr; low'),        'hit DESC',             true),
40    array(l10n('Visits, low &rarr; high'),        'hit ASC',              true),
41    ));
42}
43
44function get_collections_preferred_orders()
45{
46  return array(
47    array(l10n('Name, A &rarr; Z'),               'name ASC',           true),
48    array(l10n('Name, Z &rarr; A'),               'name DESC',          true),
49    array(l10n('Date created, new &rarr; old'),   'date_creation DESC', true),
50    array(l10n('Date created, old &rarr; new'),   'date_creation ASC',  true), 
51    array(l10n('Photos number, high &rarr; low'), 'nb_images DESC',     true),
52    array(l10n('Photos number, low &rarr; high'), 'nb_images ASC',      true),
53    );
54}
55
56?>
Note: See TracBrowser for help on using the repository browser.