Completed
Pull Request — 1.11.x (#1459)
by José
164:59 queued 133:05
created
main/inc/lib/social.lib.php 4 patches
Doc Comments   +14 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,6 +63,8 @@  discard block
 block discarded – undo
63 63
      * @param int user id
64 64
      * @param int user friend id
65 65
      * @param string
66
+     * @param integer $user_id
67
+     * @param integer $user_friend
66 68
      * @author isaac flores paz
67 69
      */
68 70
     public static function get_relation_between_contacts($user_id, $user_friend)
@@ -94,6 +96,8 @@  discard block
 block discarded – undo
94 96
      * @param int group id
95 97
      * @param string name to search
96 98
      * @param bool true will load firstname, lastname, and image name
99
+     * @param integer $user_id
100
+     * @param integer $id_group
97 101
      * @return array
98 102
      * @author Julio Montoya <[email protected]> Cleaning code, function renamed, $load_extra_info option added
99 103
      * @author isaac flores paz
@@ -170,6 +174,9 @@  discard block
 block discarded – undo
170 174
      * @param int user friend id
171 175
      * @param string title of the message
172 176
      * @param string content of the message
177
+     * @param integer $user_id
178
+     * @param string $message_title
179
+     * @param string $message_content
173 180
      * @return boolean
174 181
      * @author isaac flores paz
175 182
      * @author Julio Montoya <[email protected]> Cleaning code
@@ -241,6 +248,7 @@  discard block
 block discarded – undo
241 248
      * Get number messages of the inbox
242 249
      * @author isaac flores paz
243 250
      * @param int user receiver id
251
+     * @param integer $user_receiver_id
244 252
      * @return int
245 253
      */
246 254
     public static function get_message_number_invitation_by_user_id($user_receiver_id)
@@ -283,6 +291,7 @@  discard block
 block discarded – undo
283 291
      * Get invitation list sent by user
284 292
      * @author Julio Montoya <[email protected]>
285 293
      * @param int user id
294
+     * @param integer $user_id
286 295
      * @return array()
287 296
      */
288 297
     public static function get_list_invitation_sent_by_user_id($user_id)
@@ -325,6 +334,7 @@  discard block
 block discarded – undo
325 334
      * Denies invitation
326 335
      * @param int user sender id
327 336
      * @param int user receiver id
337
+     * @param integer $user_receiver_id
328 338
      * @author isaac flores paz
329 339
      * @author Julio Montoya <[email protected]> Cleaning code
330 340
      */
@@ -360,7 +370,7 @@  discard block
 block discarded – undo
360 370
      * @author Isaac Flores Paz <[email protected]>
361 371
      * @author Julio Montoya <[email protected]> Cleaning code
362 372
      * @param void
363
-     * @return string message invitation
373
+     * @return false|null message invitation
364 374
      */
365 375
     public static function send_invitation_friend_user($userfriend_id, $subject_message = '', $content_message = '')
366 376
     {
@@ -1229,7 +1239,7 @@  discard block
 block discarded – undo
1229 1239
      * @param string $messageContent of the message
1230 1240
      * @param int $messageId id parent
1231 1241
      * @param string $messageStatus status type of message
1232
-     * @return boolean
1242
+     * @return false|string
1233 1243
      * @author Yannick Warnier
1234 1244
      */
1235 1245
     public static function sendWallMessage($userId, $friendId, $messageContent, $messageId = 0, $messageStatus = '')
@@ -1318,7 +1328,7 @@  discard block
 block discarded – undo
1318 1328
      * Gets all messages from someone's wall (within specific limits)
1319 1329
      * @param int $userId id of wall shown
1320 1330
      * @param string $messageStatus status wall message
1321
-     * @param int|string $parentId id message (Post main)
1331
+     * @param integer|null $parentId id message (Post main)
1322 1332
      * @param date $start Date from which we want to show the messages, in UTC time
1323 1333
      * @param int $limit Limit for the number of parent messages we want to show
1324 1334
      * @param int $offset Wall message query offset
@@ -1647,7 +1657,7 @@  discard block
 block discarded – undo
1647 1657
     /**
1648 1658
     * Delete messages delete logic
1649 1659
     * @param int $id id message to delete.
1650
-    * @return bool status query
1660
+    * @return Statement|null status query
1651 1661
     */
1652 1662
     public static function deleteMessage($id)
1653 1663
     {
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
         if ($course_visibility != COURSE_VISIBILITY_HIDDEN &&
511 511
             ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)
512 512
         ) {
513
-           $result .= '<span class="title">' . $course_title . '<span>';
513
+            $result .= '<span class="title">' . $course_title . '<span>';
514 514
         } else {
515 515
             $result .= $course_title." "." ".get_lang('CourseClosed')."";
516 516
         }
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
             }
1415 1415
             $media .= '<div class="user-image">';
1416 1416
             $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] .
1417
-                       '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>';
1417
+                        '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>';
1418 1418
             $media .= '</div>';
1419 1419
             $media .= '<div class="user-data">';
1420 1420
             $media .= '<div class="username">' . '<a href="'.$url.'">'.$nameComplete.'</a></div>';
@@ -1645,10 +1645,10 @@  discard block
 block discarded – undo
1645 1645
         return $name;
1646 1646
     }
1647 1647
     /**
1648
-    * Delete messages delete logic
1649
-    * @param int $id id message to delete.
1650
-    * @return bool status query
1651
-    */
1648
+     * Delete messages delete logic
1649
+     * @param int $id id message to delete.
1650
+     * @return bool status query
1651
+     */
1652 1652
     public static function deleteMessage($id)
1653 1653
     {
1654 1654
         $id = intval($id);
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1761,7 +1761,9 @@
 block discarded – undo
1761 1761
             $friendHtml.= '<ul class="nav nav-list">';
1762 1762
             $j = 1;
1763 1763
             for ($k=0; $k < $number_friends; $k++) {
1764
-                if ($j > $number_of_images) break;
1764
+                if ($j > $number_of_images) {
1765
+                    break;
1766
+                }
1765 1767
 
1766 1768
                 if (isset($friends[$k])) {
1767 1769
                     $friend = $friends[$k];
Please login to merge, or discard this patch.
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
                     friend_user_id<>'.((int) $user_id).' AND
114 114
                     user_id='.((int) $user_id);
115 115
         if (isset($id_group) && $id_group > 0) {
116
-            $sql.=' AND relation_type='.$id_group;
116
+            $sql .= ' AND relation_type='.$id_group;
117 117
         }
118 118
         if (isset($search_name)) {
119 119
             $search_name = trim($search_name);
120 120
             $search_name = str_replace(' ', '', $search_name);
121
-            $sql.=' AND friend_user_id IN (
121
+            $sql .= ' AND friend_user_id IN (
122 122
                 SELECT user_id FROM '.$tbl_my_user.'
123 123
                 WHERE
124 124
                     firstName LIKE "%'.Database::escape_string($search_name).'%" OR
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
     {
433 433
         $user_info = api_get_user_info($userId);
434 434
         $success = get_lang('MessageSentTo');
435
-        $success.= ' : '.api_get_person_name($user_info['firstName'], $user_info['lastName']);
435
+        $success .= ' : '.api_get_person_name($user_info['firstName'], $user_info['lastName']);
436 436
 
437 437
         if (isset($subject) && isset($content) && isset($userId)) {
438 438
             $result = MessageManager::send_message($userId, $subject, $content);
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
         $user_in_course_status = CourseManager :: get_user_in_course_status(api_get_user_id(), $course_code);
499 499
 
500 500
         //$valor = api_get_settings_params();
501
-        $course_path = api_get_path(SYS_COURSE_PATH).$course_directory;   // course path
501
+        $course_path = api_get_path(SYS_COURSE_PATH).$course_directory; // course path
502 502
         if (api_get_setting('course_images_in_courses_list') === 'true') {
503 503
             if (file_exists($course_path.'/course-pic85x85.png')) {
504 504
                 $image = $my_course['course_info']['course_image'];
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
         if ($course_visibility != COURSE_VISIBILITY_HIDDEN &&
527 527
             ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)
528 528
         ) {
529
-           $result .= '<span class="title">' . $course_title . '<span>';
529
+           $result .= '<span class="title">'.$course_title.'<span>';
530 530
         } else {
531 531
             $result .= $course_title." ".get_lang('CourseClosed');
532 532
         }
@@ -734,57 +734,57 @@  discard block
 block discarded – undo
734 734
             $links = '<ul class="nav nav-pills nav-stacked">';
735 735
             $active = $show == 'home' ? 'active' : null;
736 736
             $links .= '
737
-                <li class="home-icon ' . $active . '">
738
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
739
-                        ' . $homeIcon . ' ' . get_lang('Home') . '
737
+                <li class="home-icon ' . $active.'">
738
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php">
739
+                        ' . $homeIcon.' '.get_lang('Home').'
740 740
                     </a>
741 741
                 </li>';
742 742
             $active = $show == 'messages' ? 'active' : null;
743 743
             $links .= '
744
-                <li class="messages-icon ' . $active . '">
745
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">
746
-                        ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
744
+                <li class="messages-icon ' . $active.'">
745
+                    <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social">
746
+                        ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.'
747 747
                     </a>
748 748
                 </li>';
749 749
 
750 750
             //Invitations
751 751
             $active = $show == 'invitations' ? 'active' : null;
752 752
             $links .= '
753
-                <li class="invitations-icon ' . $active . '">
754
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">
755
-                        ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
753
+                <li class="invitations-icon ' . $active.'">
754
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php">
755
+                        ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
756 756
                     </a>
757 757
                 </li>';
758 758
 
759 759
             //Shared profile and groups
760 760
             $active = $show == 'shared_profile' ? 'active' : null;
761 761
             $links .= '
762
-                <li class="shared-profile-icon' . $active . '">
763
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">
764
-                        ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
762
+                <li class="shared-profile-icon' . $active.'">
763
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php">
764
+                        ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
765 765
                     </a>
766 766
                 </li>';
767 767
             $active = $show == 'friends' ? 'active' : null;
768 768
             $links .= '
769
-                <li class="friends-icon ' . $active . '">
770
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
771
-                        ' . $friendsIcon . ' ' . get_lang('Friends') . '
769
+                <li class="friends-icon ' . $active.'">
770
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php">
771
+                        ' . $friendsIcon.' '.get_lang('Friends').'
772 772
                     </a>
773 773
                 </li>';
774 774
             $active = $show == 'browse_groups' ? 'active' : null;
775 775
             $links .= '
776
-                <li class="browse-groups-icon ' . $active . '">
777
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
778
-                        ' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
776
+                <li class="browse-groups-icon ' . $active.'">
777
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php">
778
+                        ' . $groupsIcon.' '.get_lang('SocialGroups').'
779 779
                     </a>
780 780
                 </li>';
781 781
 
782 782
             //Search users
783 783
             $active = $show == 'search' ? 'active' : null;
784 784
             $links .= '
785
-                <li class="search-icon ' . $active . '">
786
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">
787
-                        ' . $searchIcon . ' ' . get_lang('Search') . '
785
+                <li class="search-icon ' . $active.'">
786
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php">
787
+                        ' . $searchIcon.' '.get_lang('Search').'
788 788
                     </a>
789 789
                 </li>';
790 790
 
@@ -792,9 +792,9 @@  discard block
 block discarded – undo
792 792
             $active = $show == 'myfiles' ? 'active' : null;
793 793
 
794 794
             $myFiles = '
795
-                <li class="myfiles-icon ' . $active . '">
796
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
797
-                        ' . $filesIcon . ' ' . get_lang('MyFiles') . '
795
+                <li class="myfiles-icon ' . $active.'">
796
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php">
797
+                        ' . $filesIcon.' '.get_lang('MyFiles').'
798 798
                     </a>
799 799
                 </li>';
800 800
 
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
                 $myFiles = '';
803 803
             }
804 804
             $links .= $myFiles;
805
-            $links .='</ul>';
805
+            $links .= '</ul>';
806 806
 
807 807
             $html .= Display::panelCollapse(
808 808
                 get_lang('SocialNetwork'),
@@ -823,57 +823,57 @@  discard block
 block discarded – undo
823 823
         }
824 824
 
825 825
         if ($show == 'shared_profile') {
826
-            $links =  '<ul class="nav nav-pills nav-stacked">';
826
+            $links = '<ul class="nav nav-pills nav-stacked">';
827 827
             // My own profile
828 828
             if ($show_full_profile && $user_id == intval(api_get_user_id())) {
829 829
                 $links .= '
830
-                    <li class="home-icon ' . $active . '">
831
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
832
-                            ' . $homeIcon . ' ' . get_lang('Home') . '
830
+                    <li class="home-icon ' . $active.'">
831
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php">
832
+                            ' . $homeIcon.' '.get_lang('Home').'
833 833
                         </a>
834 834
                     </li>
835
-                    <li class="messages-icon ' . $active . '">
836
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">
837
-                            ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
835
+                    <li class="messages-icon ' . $active.'">
836
+                        <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social">
837
+                            ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.'
838 838
                         </a>
839 839
                     </li>';
840 840
                 $active = $show == 'invitations' ? 'active' : null;
841 841
                 $links .= '
842
-                    <li class="invitations-icon' . $active . '">
843
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">
844
-                            ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
842
+                    <li class="invitations-icon' . $active.'">
843
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php">
844
+                            ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
845 845
                         </a>
846 846
                     </li>';
847 847
 
848 848
                 $links .= '
849 849
                     <li class="shared-profile-icon active">
850
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">
851
-                            ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
850
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php">
851
+                            ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
852 852
                         </a>
853 853
                     </li>
854 854
                     <li class="friends-icon">
855
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
856
-                            ' . $friendsIcon . ' ' . get_lang('Friends') . '
855
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php">
856
+                            ' . $friendsIcon.' '.get_lang('Friends').'
857 857
                         </a>
858 858
                     </li>
859 859
                     <li class="browse-groups-icon">
860
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
861
-                            ' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
860
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php">
861
+                            ' . $groupsIcon.' '.get_lang('SocialGroups').'
862 862
                         </a>
863 863
                     </li>';
864 864
                 $active = $show == 'search' ? 'active' : null;
865 865
                 $links .= '
866
-                    <li class="search-icon ' . $active . '">
867
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">
868
-                            ' . $searchIcon . ' ' . get_lang('Search') . '
866
+                    <li class="search-icon ' . $active.'">
867
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php">
868
+                            ' . $searchIcon.' '.get_lang('Search').'
869 869
                         </a>
870 870
                     </li>';
871 871
                 $active = $show == 'myfiles' ? 'active' : null;
872 872
 
873 873
                 $myFiles = '
874
-                    <li class="myfiles-icon ' . $active . '">
875
-                     <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
876
-                            ' . $filesIcon . ' ' . get_lang('MyFiles') . '
874
+                    <li class="myfiles-icon ' . $active.'">
875
+                     <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php">
876
+                            ' . $filesIcon.' '.get_lang('MyFiles').'
877 877
                         </a>
878 878
                     </li>';
879 879
 
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
                 $links .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/invitations.php">'.Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation')).'&nbsp;&nbsp;'.get_lang('YouAlreadySentAnInvitation').'</a></li>';
920 920
             } else {
921 921
                 if (!$show_full_profile) {
922
-                    $links .= '<li><a class="btn-to-send-invitation" href="#" data-send-to="' . $user_id . '" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a></li>';
922
+                    $links .= '<li><a class="btn-to-send-invitation" href="#" data-send-to="'.$user_id.'" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a></li>';
923 923
                 }
924 924
             }
925 925
 
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
         foreach ($user_list as $uid) {
1027 1027
             $user_info = api_get_user_info($uid, $checkIfUserOnline = true);
1028 1028
             $lastname = $user_info['lastname'];
1029
-            $firstname =  $user_info['firstname'];
1029
+            $firstname = $user_info['firstname'];
1030 1030
             $completeName = $firstname.', '.$lastname;
1031 1031
 
1032 1032
             $user_rol = $user_info['status'] == 1 ? Display::return_icon('teacher.png', get_lang('Teacher'), null, ICON_SIZE_TINY) : Display::return_icon('user.png', get_lang('Student'), null, ICON_SIZE_TINY);
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
             }
1045 1045
             $img = '<img class="img-responsive img-circle" title="'.$completeName.'" alt="'.$completeName.'" src="'.$userPicture.'">';
1046 1046
 
1047
-            $url =  null;
1047
+            $url = null;
1048 1048
             // Anonymous users can't have access to the profile
1049 1049
             if (!api_is_anonymous()) {
1050 1050
                 if (api_get_setting('allow_social_tool') === 'true') {
@@ -1199,13 +1199,13 @@  discard block
 block discarded – undo
1199 1199
             case SOCIAL_CENTER_PLUGIN:
1200 1200
                 $social_plugins = array(1, 2);
1201 1201
                 if (is_array($social_plugins) && count($social_plugins) > 0) {
1202
-                    $content.= '<div id="social-plugins">';
1202
+                    $content .= '<div id="social-plugins">';
1203 1203
                     foreach ($social_plugins as $plugin) {
1204
-                        $content.= '<div class="social-plugin-item">';
1205
-                        $content.= $plugin;
1206
-                        $content.= '</div>';
1204
+                        $content .= '<div class="social-plugin-item">';
1205
+                        $content .= $plugin;
1206
+                        $content .= '</div>';
1207 1207
                     }
1208
-                    $content.= '</div>';
1208
+                    $content .= '</div>';
1209 1209
                 }
1210 1210
                 break;
1211 1211
             case SOCIAL_LEFT_PLUGIN:
@@ -1276,12 +1276,12 @@  discard block
 block discarded – undo
1276 1276
         if (!in_array($extension, $allowedTypes)) {
1277 1277
             $flag = false;
1278 1278
         } else {
1279
-            $newFileName = uniqid('') . '.' . $extension;
1279
+            $newFileName = uniqid('').'.'.$extension;
1280 1280
             if (!file_exists($pathMessageAttach)) {
1281 1281
                 @mkdir($pathMessageAttach, api_get_permissions_for_new_directories(), true);
1282 1282
             }
1283 1283
 
1284
-            $newPath = $pathMessageAttach . $newFileName;
1284
+            $newPath = $pathMessageAttach.$newFileName;
1285 1285
             if (is_uploaded_file($fileAttach['tmp_name'])) {
1286 1286
                 @copy($fileAttach['tmp_name'], $newPath);
1287 1287
             }
@@ -1290,9 +1290,9 @@  discard block
 block discarded – undo
1290 1290
             $medium = self::resize_picture($newPath, IMAGE_WALL_MEDIUM_SIZE);
1291 1291
 
1292 1292
             $big = new Image($newPath);
1293
-            $ok = $small && $small->send_image($pathMessageAttach . IMAGE_WALL_SMALL . '_' . $newFileName) &&
1294
-                $medium && $medium->send_image($pathMessageAttach . IMAGE_WALL_MEDIUM .'_' . $newFileName) &&
1295
-                $big && $big->send_image($pathMessageAttach . IMAGE_WALL_BIG . '_' . $newFileName);
1293
+            $ok = $small && $small->send_image($pathMessageAttach.IMAGE_WALL_SMALL.'_'.$newFileName) &&
1294
+                $medium && $medium->send_image($pathMessageAttach.IMAGE_WALL_MEDIUM.'_'.$newFileName) &&
1295
+                $big && $big->send_image($pathMessageAttach.IMAGE_WALL_BIG.'_'.$newFileName);
1296 1296
 
1297 1297
             // Insert
1298 1298
             $newFileName = $social.$newFileName;
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
             $start = '0000-00-00';
1387 1387
         }
1388 1388
 
1389
-        $isOwnWall = (api_get_user_id() == $userId  && $userId == $friendId);
1389
+        $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId);
1390 1390
         $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL, $idMessage, $start, $limit, $offset);
1391 1391
         $formattedList = '<div class="sub-mediapost">';
1392 1392
         $users = array();
@@ -1401,20 +1401,20 @@  discard block
 block discarded – undo
1401 1401
             }
1402 1402
 
1403 1403
             $nameComplete = api_is_western_name_order()
1404
-                ? $users[$userIdLoop]['firstname'] .' ' . $users[$userIdLoop]['lastname']
1405
-                : $users[$userIdLoop]['lastname'] . ' ' . $users[$userIdLoop]['firstname'];
1404
+                ? $users[$userIdLoop]['firstname'].' '.$users[$userIdLoop]['lastname']
1405
+                : $users[$userIdLoop]['lastname'].' '.$users[$userIdLoop]['firstname'];
1406 1406
             $url = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$userIdLoop;
1407 1407
             $media = '';
1408 1408
             $media .= '<div class="rep-post">';
1409 1409
             $media .= '<div class="col-md-2 col-xs-2 social-post-answers">';
1410 1410
             $media .= '<div class="user-image pull-right">';
1411
-            $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] .
1411
+            $media .= '<a href="'.$url.'" ><img src="'.$users[$userIdLoop]['avatar'].
1412 1412
                        '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>';
1413 1413
             $media .= '</div>';
1414 1414
             $media .= '</div>';
1415 1415
             $media .= '<div class="col-md-9 col-xs-9 social-post-answers">';
1416 1416
             $media .= '<div class="user-data">';
1417
-            $media .= '<div class="username">' . '<a href="'.$url.'">'.$nameComplete.'</a> <span>'.Security::remove_XSS($message['content']).'</span></div>';
1417
+            $media .= '<div class="username">'.'<a href="'.$url.'">'.$nameComplete.'</a> <span>'.Security::remove_XSS($message['content']).'</span></div>';
1418 1418
             $media .= '<div class="time timeago" title="'.$date.'">'.$date.'</div>';
1419 1419
             $media .= '<br />';
1420 1420
             $media .= '</div>';
@@ -1457,12 +1457,12 @@  discard block
 block discarded – undo
1457 1457
      * @param   int     $offset     Wall messages offset
1458 1458
      * @return  array   $data       return user's starting wall messages along with message extra data
1459 1459
      */
1460
-    public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset= 0)
1460
+    public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset = 0)
1461 1461
     {
1462 1462
         if (empty($start)) {
1463 1463
             $start = '0000-00-00';
1464 1464
         }
1465
-        $isOwnWall = (api_get_user_id() == $userId  && $userId == $friendId);
1465
+        $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId);
1466 1466
         $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL_POST, null, $start, $limit, $offset);
1467 1467
         $users = array();
1468 1468
         $data = array();
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
 
1522 1522
         $htmlReceiver = '';
1523 1523
         if ($authorId != $receiverId) {
1524
-            $htmlReceiver = ' > <a href="'.$urlReceiver.'">' . $nameCompleteReceiver . '</a> ';
1524
+            $htmlReceiver = ' > <a href="'.$urlReceiver.'">'.$nameCompleteReceiver.'</a> ';
1525 1525
         }
1526 1526
 
1527 1527
         $wallImage = '';
@@ -1556,7 +1556,7 @@  discard block
 block discarded – undo
1556 1556
         $html .= '<div class="img-post">';
1557 1557
         $html .= $wallImage;
1558 1558
         $html .= '</div>';
1559
-        $html .= '<p>'. Security::remove_XSS($message['content']).'</p>';
1559
+        $html .= '<p>'.Security::remove_XSS($message['content']).'</p>';
1560 1560
         $html .= '</div>';
1561 1561
         $html .= '</div>'; // end mediaPost
1562 1562
 
@@ -1732,18 +1732,18 @@  discard block
 block discarded – undo
1732 1732
         if ($number_friends != 0) {
1733 1733
             if ($number_friends > $number_of_images) {
1734 1734
                 if (api_get_user_id() == $user_id) {
1735
-                    $friendHtml.= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>';
1735
+                    $friendHtml .= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>';
1736 1736
                 } else {
1737
-                    $friendHtml.= ' <span>'
1737
+                    $friendHtml .= ' <span>'
1738 1738
                         .'<a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php'
1739 1739
                         .'?view=friends&height=390&width=610&user_id='.$user_id.'"'
1740 1740
                         .'class="ajax" data-title="'.get_lang('SeeAll').'" title="'.get_lang('SeeAll').'" >'.get_lang('SeeAll').'</a></span>';
1741 1741
                 }
1742 1742
             }
1743 1743
 
1744
-            $friendHtml.= '<ul class="nav nav-list">';
1744
+            $friendHtml .= '<ul class="nav nav-list">';
1745 1745
             $j = 1;
1746
-            for ($k=0; $k < $number_friends; $k++) {
1746
+            for ($k = 0; $k < $number_friends; $k++) {
1747 1747
                 if ($j > $number_of_images) break;
1748 1748
 
1749 1749
                 if (isset($friends[$k])) {
@@ -1757,26 +1757,26 @@  discard block
 block discarded – undo
1757 1757
                         $statusIcon = Display::span('', array('class' => 'offline_user_in_text'));
1758 1758
                     }
1759 1759
 
1760
-                    $friendHtml.= '<li>';
1761
-                    $friendHtml.= '<div>';
1760
+                    $friendHtml .= '<li>';
1761
+                    $friendHtml .= '<div>';
1762 1762
 
1763 1763
                     // the height = 92 must be the same in the image_friend_network span style in default.css
1764 1764
                     $friends_profile = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_SMALL);
1765
-                    $friendHtml.= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>';
1765
+                    $friendHtml .= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>';
1766 1766
                     $link_shared = (empty($link_shared)) ? '' : '&'.$link_shared;
1767
-                    $friendHtml.= $statusIcon .'<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '">' . $name_user .'</a>';
1768
-                    $friendHtml.= '</div>';
1769
-                    $friendHtml.= '</li>';
1767
+                    $friendHtml .= $statusIcon.'<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'">'.$name_user.'</a>';
1768
+                    $friendHtml .= '</div>';
1769
+                    $friendHtml .= '</li>';
1770 1770
                 }
1771 1771
                 $j++;
1772 1772
             }
1773
-            $friendHtml.='</ul>';
1773
+            $friendHtml .= '</ul>';
1774 1774
         } else {
1775
-            $friendHtml.= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />'
1776
-                .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>';
1775
+            $friendHtml .= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />'
1776
+                .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>';
1777 1777
         }
1778 1778
 
1779
-        $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' (' . $number_friends . ')' );
1779
+        $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' ('.$number_friends.')');
1780 1780
 
1781 1781
         return $friendHtml;
1782 1782
     }
@@ -1797,9 +1797,9 @@  discard block
 block discarded – undo
1797 1797
 
1798 1798
         if ($number_friends != 0) {
1799 1799
 
1800
-            $friendHtml.= '<div class="list-group">';
1800
+            $friendHtml .= '<div class="list-group">';
1801 1801
             $j = 1;
1802
-            for ($k=0; $k < $number_friends; $k++) {
1802
+            for ($k = 0; $k < $number_friends; $k++) {
1803 1803
                 if ($j > $number_of_images) {
1804 1804
                     break;
1805 1805
                 }
@@ -1809,11 +1809,11 @@  discard block
 block discarded – undo
1809 1809
                     $user_info_friend = api_get_user_info($friend['friend_user_id'], true);
1810 1810
 
1811 1811
                     if ($user_info_friend['user_is_online']) {
1812
-                        $statusIcon = Display::return_icon('statusonline.png',get_lang('Online'));
1813
-                        $status=1;
1812
+                        $statusIcon = Display::return_icon('statusonline.png', get_lang('Online'));
1813
+                        $status = 1;
1814 1814
                     } else {
1815
-                        $statusIcon = Display::return_icon('statusoffline.png',get_lang('Offline'));
1816
-                        $status=0;
1815
+                        $statusIcon = Display::return_icon('statusoffline.png', get_lang('Offline'));
1816
+                        $status = 0;
1817 1817
                     }
1818 1818
 
1819 1819
                     $friendAvatarMedium = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_MEDIUM);
@@ -1822,24 +1822,24 @@  discard block
 block discarded – undo
1822 1822
                     $showLinkToChat = api_is_global_chat_enabled() &&
1823 1823
                         $friend['friend_user_id'] != api_get_user_id();
1824 1824
 
1825
-                    if ($showLinkToChat){
1825
+                    if ($showLinkToChat) {
1826 1826
                         $friendHtml .= '<a onclick="javascript:chatWith(\''.$friend['friend_user_id'].'\', \''.$name_user.'\', \''.$status.'\',\''.$friendAvatarSmall.'\')" href="javascript:void(0);" class="list-group-item">';
1827
-                        $friendHtml .=  $friend_avatar.' <span class="username">' . $name_user . '</span>';
1828
-                        $friendHtml .= '<span class="status">' . $statusIcon . '</span>';
1827
+                        $friendHtml .= $friend_avatar.' <span class="username">'.$name_user.'</span>';
1828
+                        $friendHtml .= '<span class="status">'.$statusIcon.'</span>';
1829 1829
                     } else {
1830 1830
                         $link_shared = empty($link_shared) ? '' : '&'.$link_shared;
1831
-                        $friendHtml .= '<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '" class="list-group-item">';
1832
-                        $friendHtml .=  $friend_avatar.' <span class="username-all">' . $name_user . '</span>';
1831
+                        $friendHtml .= '<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'" class="list-group-item">';
1832
+                        $friendHtml .= $friend_avatar.' <span class="username-all">'.$name_user.'</span>';
1833 1833
                     }
1834 1834
 
1835 1835
                     $friendHtml .= '</a>';
1836 1836
                 }
1837 1837
                 $j++;
1838 1838
             }
1839
-            $friendHtml.='</div>';
1839
+            $friendHtml .= '</div>';
1840 1840
         } else {
1841
-            $friendHtml.= '<div class="help">'.get_lang('NoFriendsInYourContactList').' '
1842
-                .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>';
1841
+            $friendHtml .= '<div class="help">'.get_lang('NoFriendsInYourContactList').' '
1842
+                .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>';
1843 1843
         }
1844 1844
 
1845 1845
         return $friendHtml;
@@ -1857,7 +1857,7 @@  discard block
 block discarded – undo
1857 1857
                 'post',
1858 1858
                 api_get_path(WEB_CODE_PATH).'social/profile.php'.$userId,
1859 1859
                 null,
1860
-                array('enctype' => 'multipart/form-data') ,
1860
+                array('enctype' => 'multipart/form-data'),
1861 1861
                 FormValidator::LAYOUT_HORIZONTAL
1862 1862
             );
1863 1863
 
Please login to merge, or discard this patch.
main/inc/lib/sortable_table.class.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -443,6 +443,7 @@
 block discarded – undo
443 443
      * @param bool       hide navigation optionally
444 444
      * @param int        content per page when show navigation (optional)
445 445
      * @param bool       sort data optionally
446
+     * @param boolean $visibility_options
446 447
      * @return string    grid html
447 448
      */
448 449
     public function display_simple_grid($visibility_options, $hide_navigation = true, $per_page = 20, $sort_data = true, $grid_class = array())
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
     }
340 340
 
341 341
     /**
342
-    * This function shows the content of a table in a grid.
343
-    * Should not be use to edit information (edit/delete rows) only.
344
-    **/
342
+     * This function shows the content of a table in a grid.
343
+     * Should not be use to edit information (edit/delete rows) only.
344
+     **/
345 345
     public function display_grid()
346 346
     {
347 347
 
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
                 //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction'];
791 791
                 $my_get_direction = $_GET[$tablename.'_direction'];
792 792
                 if (!in_array($my_get_direction, array('ASC', 'DESC'))) {
793
-                     $param[$tablename.'_direction'] =  'ASC';
793
+                        $param[$tablename.'_direction'] =  'ASC';
794 794
                 } else {
795 795
                     $param[$tablename.'_direction'] = $my_get_direction;
796 796
                 }
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
         if (is_array($row)) {
918 918
             foreach ($row as & $value) {
919 919
                 if (empty($value)) {
920
-                     $value = '-';
920
+                        $value = '-';
921 921
                 }
922 922
             }
923 923
         }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             $params['spacesBeforeSeparator'] = '';
216 216
             $params['spacesAfterSeparator'] = '';
217 217
             $query_vars = array_keys($_GET);
218
-            $query_vars_needed = array ($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page');
218
+            $query_vars_needed = array($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page');
219 219
             if (count($this->additional_parameters) > 0) {
220 220
                 $query_vars_needed = array_merge($query_vars_needed, array_keys($this->additional_parameters));
221 221
             }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
         if (!$empty_table) {
287 287
             if (!empty($this->additional_parameters)) {
288
-                foreach($this->additional_parameters as $key => $value) {
288
+                foreach ($this->additional_parameters as $key => $value) {
289 289
                     $html .= '<input type="hidden" name ="'.Security::remove_XSS($key).'" value ="'.Security::remove_XSS($value).'" />';
290 290
                 }
291 291
             }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                     $html .= '<li><a data-action ="'.$action.'" href="#" onclick="javascript:action_click(this, \''.$table_id.'\');">'.$label.'</a></li>';
311 311
                 }
312 312
                 $html .= '</ul>';
313
-                $html .= '</div>';//btn-group
313
+                $html .= '</div>'; //btn-group
314 314
                 $html .= '</div>'; //toolbar
315 315
             } else {
316 316
                 $html .= $form;
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
             }
335 335
         }
336 336
 
337
-        return '<div class="table-responsive">' . $html . '</div>';
337
+        return '<div class="table-responsive">'.$html.'</div>';
338 338
     }
339 339
 
340 340
     /**
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
             $html .= '<div class="clear"></div>';
390 390
             if (count($this->form_actions) > 0) {
391
-                $script= '<script>
391
+                $script = '<script>
392 392
                             /*<![CDATA[*/
393 393
                             function setCheckbox(value) {
394 394
                                  d = document.form_'.$this->table_name.';
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
             }
411 411
         }
412 412
         // Getting the items of the table
413
-        $items = $this->get_clean_html(false);    //no sort
413
+        $items = $this->get_clean_html(false); //no sort
414 414
 
415 415
         // Generation of style classes must be improved. Maybe we need a a table name to create style on the fly:
416 416
         // i.e: .whoisonline_table_grid_container instead of  .grid_container
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 
479 479
             $html .= '<div class="clear"></div>';
480 480
             if (count($this->form_actions) > 0) {
481
-                $script= '<script>
481
+                $script = '<script>
482 482
                             /*<![CDATA[*/
483 483
                             function setCheckbox(value) {
484 484
                                  d = document.form_'.$this->table_name.';
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
                     $counter = 0;
587 587
                     foreach ($row as $index => $rowInfo) {
588 588
                         if (!isset($this->columnsToHide[$index])) {
589
-                            $newRow[$counter] = $rowInfo ;
589
+                            $newRow[$counter] = $rowInfo;
590 590
                             $counter++;
591 591
                         }
592 592
                     }
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
         }
602 602
 
603 603
         if ($this->odd_even_rows_enabled == true) {
604
-            $this->altRowAttributes(0, array ('class' => 'row_odd'), array ('class' => 'row_even'), true);
604
+            $this->altRowAttributes(0, array('class' => 'row_odd'), array('class' => 'row_even'), true);
605 605
         }
606 606
 
607 607
         foreach ($this->th_attributes as $column => $attributes) {
@@ -663,11 +663,11 @@  discard block
 block discarded – undo
663 663
         }
664 664
         $result[] = '<select name="'.$this->param_prefix.'per_page" onchange="javascript: this.form.submit();">';
665 665
         for ($nr = 10; $nr <= min(50, $total_number_of_items); $nr += 10) {
666
-            $result[] = '<option value="'.$nr.'" '. ($nr == $this->per_page ? 'selected="selected"' : '').'>'.$nr.'</option>';
666
+            $result[] = '<option value="'.$nr.'" '.($nr == $this->per_page ? 'selected="selected"' : '').'>'.$nr.'</option>';
667 667
         }
668 668
         // @todo no limits
669 669
         //if ($total_number_of_items < 500) {
670
-            $result[] = '<option value="'.$total_number_of_items.'" '. ($total_number_of_items == $this->per_page ? 'selected="selected"' : '').'>'.api_ucfirst(get_lang('All')).'</option>';
670
+            $result[] = '<option value="'.$total_number_of_items.'" '.($total_number_of_items == $this->per_page ? 'selected="selected"' : '').'>'.api_ucfirst(get_lang('All')).'</option>';
671 671
         //}
672 672
         $result[] = '</select>';
673 673
         $result[] = '<noscript>';
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
      */
786 786
     public function get_additional_url_paramstring()
787 787
     {
788
-        $param_string_parts = array ();
788
+        $param_string_parts = array();
789 789
         if (is_array($this->additional_parameters) && count($this->additional_parameters) > 0) {
790 790
             foreach ($this->additional_parameters as $key => & $value) {
791 791
                 $param_string_parts[] = urlencode($key).'='.urlencode($value);
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
                 //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction'];
799 799
                 $my_get_direction = $_GET[$tablename.'_direction'];
800 800
                 if (!in_array($my_get_direction, array('ASC', 'DESC'))) {
801
-                     $param[$tablename.'_direction'] =  'ASC';
801
+                     $param[$tablename.'_direction'] = 'ASC';
802 802
                 } else {
803 803
                     $param[$tablename.'_direction'] = $my_get_direction;
804 804
                 }
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
             if (isset($_GET[$tablename.'_column'])) {
813 813
                 $param[$tablename.'_column'] = intval($_GET[$tablename.'_column']);
814 814
             }
815
-            $param_string_parts = array ();
815
+            $param_string_parts = array();
816 816
             foreach ($param as $key => & $value) {
817 817
                 $param_string_parts[] = urlencode($key).'='.urlencode($value);
818 818
             }
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
         $param[$this->param_prefix.'page_nr'] = $this->page_nr;
834 834
         $param[$this->param_prefix.'per_page'] = $this->per_page;
835 835
         $param[$this->param_prefix.'column'] = $this->column;
836
-        $param_string_parts = array ();
836
+        $param_string_parts = array();
837 837
         foreach ($param as $key => & $value) {
838 838
             $param_string_parts[] = urlencode($key).'='.urlencode($value);
839 839
         }
Please login to merge, or discard this patch.
main/inc/lib/specific_fields_manager.lib.php 3 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
 /**
102 102
  * @param array $conditions a list of condition (exemple : status=>STUDENT)
103
- * @param array $order_by a list of fields on which sort
103
+ * @param string[] $order_by a list of fields on which sort
104 104
  * @return array An array with all users of the platform.
105 105
  */
106 106
 function get_specific_field_values_list(
@@ -235,6 +235,7 @@  discard block
 block discarded – undo
235 235
  * @param   string  Course code
236 236
  * @param   string  Tool ID
237 237
  * @param   int     Internal ID used in specific tool table
238
+ * @param string $tool_id
238 239
  */
239 240
 function delete_all_values_for_item($course_id, $tool_id, $ref_id) {
240 241
   $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
@@ -248,6 +249,7 @@  discard block
 block discarded – undo
248 249
  * Defaults to the first letter of the name, otherwise iterate through available
249 250
  * letters
250 251
  * @param   string  Name
252
+ * @param string $name
251 253
  * @return  string  One-letter code, upper-case
252 254
  */
253 255
 function get_specific_field_code_from_name($name) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 function delete_specific_field($id)
43 43
 {
44 44
     $table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
45
-    $id = (int)$id;
45
+    $id = (int) $id;
46 46
     if (!is_numeric($id)) {
47 47
         return false;
48 48
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 function edit_specific_field($id, $name)
61 61
 {
62 62
     $table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
63
-    $id = (int)$id;
63
+    $id = (int) $id;
64 64
     if (!is_numeric($id)) {
65 65
         return false;
66 66
     }
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -237,10 +237,10 @@
 block discarded – undo
237 237
  * @param   int     Internal ID used in specific tool table
238 238
  */
239 239
 function delete_all_values_for_item($course_id, $tool_id, $ref_id) {
240
-  $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
241
-  $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s';
242
-  $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id);
243
-  Database::query($sql);
240
+    $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
241
+    $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s';
242
+    $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id);
243
+    Database::query($sql);
244 244
 }
245 245
 
246 246
 /**
Please login to merge, or discard this patch.
main/inc/lib/statsUtils.lib.inc.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -85,6 +85,7 @@
 block discarded – undo
85 85
     /**
86 86
      * @author Sebastien Piraux <[email protected]>
87 87
      * @param sql : a sql query (as a string)
88
+     * @param integer $X
88 89
      * @desc Return many results of a query in a X column tab
89 90
      * in $resu[$i][0], $resu[$i][1],$resu[$i][2],...
90 91
      * this function is more 'standard' but use a little
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -107,14 +107,14 @@
 block discarded – undo
107 107
         return $resu;
108 108
     }
109 109
 
110
-	/**
111
-	 * @author Sebastien Piraux <[email protected]>
112
-	 * @param sql : a sql query (as a string)
113
-	 * @return hours_array
114
-	 * @desc        Return an assoc array.  Keys are the hours, values are
115
-	 * the number of time this hours was found.
116
-	 * key 'total' return the sum of all number of time hours
117
-	 * appear
110
+    /**
111
+     * @author Sebastien Piraux <[email protected]>
112
+     * @param sql : a sql query (as a string)
113
+     * @return hours_array
114
+     * @desc        Return an assoc array.  Keys are the hours, values are
115
+     * the number of time this hours was found.
116
+     * key 'total' return the sum of all number of time hours
117
+     * appear
118 118
      */
119 119
     public static function hoursTab($sql)
120 120
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             $last_day = -1;
156 156
             while ($row = Database::fetch_row($res)) {
157 157
                 $date_array = getdate($row[0]);
158
-                $display_date = $date_array['mday'] . ' ' . $MonthsShort[$date_array['mon'] - 1] . ' ' . $date_array['year'];
158
+                $display_date = $date_array['mday'].' '.$MonthsShort[$date_array['mon'] - 1].' '.$date_array['year'];
159 159
                 if ($date_array['mday'] == $last_day) {
160 160
                     $days_array[$display_date]++;
161 161
                 } else {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                     &nbsp;
222 222
                 </td>
223 223
                 <td width='10%'>
224
-                    <b>" . get_lang('Hits') . "</b>
224
+                    <b>".get_lang('Hits')."</b>
225 225
                 </td>
226 226
                 <td width='15%'>
227 227
                     <b>%</b>
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                     echo "<img src='".Display::returnIconPath('bar_1m.gif')."' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
250 250
                 }
251 251
                 if ($pourcent != 100) {
252
-                    echo "<img src='".Display::returnIconPath('bar_1r.gif')."' width='" . ($maxSize - $barwidth) . "' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
252
+                    echo "<img src='".Display::returnIconPath('bar_1r.gif')."' width='".($maxSize - $barwidth)."' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
253 253
                 }
254 254
                 echo "<img src='".Display::returnIconPath('bar_1.gif')."' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />
255 255
                     </td>
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
         }
266 266
         echo "<tr bgcolor='#E6E6E6'>
267 267
                 <td width='15%' align='center'>
268
-                    " . get_lang('Total') . "
268
+                    " . get_lang('Total')."
269 269
                 </td>
270 270
                 <td align='right' width='60%'>
271 271
                     &nbsp;
272 272
                 </td>
273 273
                 <td align='center' width='10%'>
274
-                    " . $period_array['total'] . "
274
+                    " . $period_array['total']."
275 275
                 </td>
276 276
                 <td width='15%'>
277 277
                     &nbsp;
Please login to merge, or discard this patch.
main/inc/lib/sub_language.class.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,6 +18,7 @@  discard block
 block discarded – undo
18 18
      * Get all files of lang folder (forum.inc.php,gradebook.inc.php,notebook.inc.php)
19 19
      * @param String The lang path folder  (/var/www/my_lms/main/lang/spanish)
20 20
      * @param bool true if we only want the "subname" trad4all instead of  trad4all.inc.php
21
+     * @param string $path
21 22
      *
22 23
      * @return Array All file of lang folder
23 24
      */
@@ -68,6 +69,7 @@  discard block
 block discarded – undo
68 69
     /**
69 70
      * Get all information of language
70 71
      * @param Integer The parent id(Language father id)
72
+     * @param integer $parent_id
71 73
      * @return Array All information about language
72 74
      */
73 75
     public static function get_all_information_of_language($parent_id)
@@ -86,6 +88,7 @@  discard block
 block discarded – undo
86 88
     /**
87 89
      * Get all information of chamilo file
88 90
      * @param String The chamilo path file (/var/www/chamilo/main/lang/spanish/gradebook.inc.php)
91
+     * @param string $system_path_file
89 92
      * @patam Bool Whether we want to remove the '$' prefix in the results or not
90 93
      * @return Array Contains all information of chamilo file
91 94
      */
@@ -345,7 +348,7 @@  discard block
 block discarded – undo
345 348
     /**
346 349
      * Make available the language
347 350
      * @param Integer The language id
348
-     * @return void
351
+     * @return boolean
349 352
      */
350 353
     public static function make_available_language($language_id)
351 354
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@
 block discarded – undo
29 29
                 while (($file = readdir($dh)) !== false) {
30 30
                     if ($file[0] <> '.' && substr($file, -4, strlen($file)) == '.php') {
31 31
                         if ($only_main_name) {
32
-                            if ($file != '' && strpos($file, '.inc.php'))
33
-                                $content_dir[] = substr($file, 0, strpos($file, '.inc.php'));
32
+                            if ($file != '' && strpos($file, '.inc.php')) {
33
+                                                            $content_dir[] = substr($file, 0, strpos($file, '.inc.php'));
34
+                            }
34 35
                         } else {
35 36
                             $content_dir[] = $file;
36 37
                         }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     public static function getAllLanguages()
22 22
     {
23 23
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
24
-        $sql = 'SELECT * FROM ' . $table;
24
+        $sql = 'SELECT * FROM '.$table;
25 25
         $rs = Database::query($sql);
26 26
         $all_languages = [];
27 27
         while ($row = Database::fetch_array($rs, 'ASSOC')) {
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
     public static function get_all_information_of_sub_language($parent_id, $sub_language_id)
71 71
     {
72 72
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
73
-        $sql = 'SELECT * FROM ' . $table . '
73
+        $sql = 'SELECT * FROM '.$table.'
74 74
                 WHERE
75 75
                     parent_id= ' . intval($parent_id).' AND
76
-                    id= ' . intval($sub_language_id) . '';
76
+                    id= ' . intval($sub_language_id).'';
77 77
         $rs = Database::query($sql);
78 78
         $all_information = array();
79 79
         while ($row = Database::fetch_array($rs, 'ASSOC')) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     public static function get_all_information_of_language($parent_id)
92 92
     {
93 93
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
94
-        $sql = 'SELECT * FROM ' . $table . ' WHERE id = "' . intval($parent_id) . '"';
94
+        $sql = 'SELECT * FROM '.$table.' WHERE id = "'.intval($parent_id).'"';
95 95
         $rs = Database::query($sql);
96 96
         $all_information = array();
97 97
         while ($row = Database::fetch_array($rs, 'ASSOC')) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public static function add_file_in_language_directory($system_path_file)
139 139
     {
140
-        $return_value = @file_put_contents($system_path_file, '<?php' . PHP_EOL);
140
+        $return_value = @file_put_contents($system_path_file, '<?php'.PHP_EOL);
141 141
 
142 142
         return $return_value;
143 143
     }
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
     public static function write_data_in_file($path_file, $new_term, $new_variable)
153 153
     {
154 154
         $return_value = false;
155
-        $new_data = $new_variable . '=' . $new_term;
155
+        $new_data = $new_variable.'='.$new_term;
156 156
         $resource = @fopen($path_file, "a");
157 157
         if (file_exists($path_file) && $resource) {
158
-            if (fwrite($resource, $new_data . PHP_EOL) === false) {
158
+            if (fwrite($resource, $new_data.PHP_EOL) === false) {
159 159
                 //not allow to write
160 160
                 $return_value = false;
161 161
             } else {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         if (empty($sub_language_dir)) {
178 178
             return false;
179 179
         }
180
-        $dir = api_get_path(SYS_LANG_PATH) . $sub_language_dir;
180
+        $dir = api_get_path(SYS_LANG_PATH).$sub_language_dir;
181 181
         if (is_dir($dir)) {
182 182
             return true;
183 183
         } //even if the dir already exists, we reach the objective of having the directory there
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
             return false;
202 202
         }
203 203
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
204
-        $sql = 'SELECT dokeos_folder FROM ' . $table . '
205
-                WHERE parent_id = ' . $parent_id . ' and id = ' . $sub_language_id;
204
+        $sql = 'SELECT dokeos_folder FROM '.$table.'
205
+                WHERE parent_id = ' . $parent_id.' and id = '.$sub_language_id;
206 206
         $res = Database::query($sql);
207 207
         if ($res === false or Database::num_rows($res) < 1) {
208 208
             return false;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         if ($res === false) {
213 213
             return false;
214 214
         } //can't delete dir, so do not delete language record
215
-        $sql = 'DELETE FROM ' . $table . '
215
+        $sql = 'DELETE FROM '.$table.'
216 216
                 WHERE id= ' . intval($sub_language_id);
217 217
         $res = Database::query($sql);
218 218
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         if (empty($sub_language_dir)) {
230 230
             return false;
231 231
         }
232
-        $dir = api_get_path(SYS_LANG_PATH) . $sub_language_dir;
232
+        $dir = api_get_path(SYS_LANG_PATH).$sub_language_dir;
233 233
         if (!is_dir($dir)) {
234 234
             return true;
235 235
         } //even if the dir does not exist, we reach the objective of not having the directory there
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
         if (count($content) > 0) {
239 239
             foreach ($content as $value_content) {
240
-                $path_file = $dir . '/' . $value_content;
240
+                $path_file = $dir.'/'.$value_content;
241 241
                 unlink($path_file);
242 242
             }
243 243
             return @rmdir($dir);
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
     {
256 256
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
257 257
         $sql = 'SELECT count(*) as count
258
-                FROM ' . $table . '
259
-                WHERE id="' . intval($language_id) . '"';
258
+                FROM ' . $table.'
259
+                WHERE id="' . intval($language_id).'"';
260 260
         $rs = Database::query($sql);
261 261
         if (Database::num_rows($rs) > 0) {
262 262
             if (Database::result($rs, 0, 'count') == 1) {
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
     {
279 279
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
280 280
         $sql = 'SELECT original_name
281
-                FROM ' . $table . '
282
-                WHERE id= ' . intval($language_id) . '';
281
+                FROM ' . $table.'
282
+                WHERE id= ' . intval($language_id).'';
283 283
         $rs = Database::query($sql);
284 284
         if (Database::num_rows($rs) > 0) {
285 285
             return Database::result($rs, 0, 'original_name');
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
     public static function check_if_language_is_sub_language($language_id)
298 298
     {
299 299
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
300
-        $sql = 'SELECT count(*) AS count FROM ' . $table . '
301
-                WHERE id = ' . intval($language_id) . ' AND NOT ISNULL(parent_id)';
300
+        $sql = 'SELECT count(*) AS count FROM '.$table.'
301
+                WHERE id = ' . intval($language_id).' AND NOT ISNULL(parent_id)';
302 302
         $rs = Database::query($sql);
303 303
 
304 304
         if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') == 1) {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
     {
317 317
         $language_info = self::get_all_information_of_language($language_id);
318 318
         $table = Database :: get_main_table(TABLE_MAIN_USER);
319
-        $sql = 'SELECT count(*) AS count FROM ' . $table . '
319
+        $sql = 'SELECT count(*) AS count FROM '.$table.'
320 320
                 WHERE language ="' . Database::escape_string($language_info['english_name']).'"';
321 321
         $rs = Database::query($sql);
322 322
         if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') >= 1) {
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
     public static function check_if_language_is_father($language_id)
335 335
     {
336 336
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
337
-        $sql = 'SELECT count(*) AS count FROM ' . $table . '
338
-                WHERE parent_id= ' . intval($language_id) . ' AND NOT ISNULL(parent_id);';
337
+        $sql = 'SELECT count(*) AS count FROM '.$table.'
338
+                WHERE parent_id= ' . intval($language_id).' AND NOT ISNULL(parent_id);';
339 339
         $rs = Database::query($sql);
340 340
 
341 341
         if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') == 1) {
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
     {
355 355
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
356 356
         $sql = "UPDATE $tbl_admin_languages SET available='0'
357
-                WHERE id = " . intval($language_id) . "";
357
+                WHERE id = ".intval($language_id)."";
358 358
         $result = Database::query($sql);
359 359
 
360 360
         return $result !== false; //only return false on sql error
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     {
370 370
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
371 371
         $sql = "UPDATE $tbl_admin_languages SET available='1'
372
-                WHERE id = " . intval($language_id) . "";
372
+                WHERE id = ".intval($language_id)."";
373 373
         $result = Database::query($sql);
374 374
 
375 375
         return $result !== false; //only return false on sql error
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
         }
388 388
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
389 389
         $tbl_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
390
-        $sql = "SELECT english_name FROM " . $tbl_admin_languages . "
391
-                WHERE id= " . intval($language_id) . "";
390
+        $sql = "SELECT english_name FROM ".$tbl_admin_languages."
391
+                WHERE id= " . intval($language_id)."";
392 392
         $result = Database::query($sql);
393 393
         $lang = Database::fetch_array($result);
394
-        $sql_update_2 = "UPDATE " . $tbl_settings_current . " SET selected_value='" . $lang['english_name'] . "'
394
+        $sql_update_2 = "UPDATE ".$tbl_settings_current." SET selected_value='".$lang['english_name']."'
395 395
                          WHERE variable='platformLanguage'";
396 396
         $result_2 = Database::query($sql_update_2);
397 397
         Event::addEvent(
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
     {
412 412
         $name = api_get_setting('platformLanguage');
413 413
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
414
-        $sql = "SELECT id FROM " . $tbl_admin_languages . " WHERE english_name ='$name'";
414
+        $sql = "SELECT id FROM ".$tbl_admin_languages." WHERE english_name ='$name'";
415 415
         $res = Database::query($sql);
416 416
         if (Database::num_rows($res) < 1) {
417 417
             return false;
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
     {
431 431
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
432 432
         $sql = "SELECT dokeos_folder
433
-                FROM " . $tbl_admin_languages . "
433
+                FROM " . $tbl_admin_languages."
434 434
                 WHERE id = (
435
-                    SELECT parent_id FROM " . $tbl_admin_languages . "
436
-                    WHERE dokeos_folder = '" . Database::escape_string($language_path) . "'
435
+                    SELECT parent_id FROM " . $tbl_admin_languages."
436
+                    WHERE dokeos_folder = '" . Database::escape_string($language_path)."'
437 437
                 )
438 438
                 ";
439 439
         $result = Database::query($sql);
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
         $adminLanguagesTable = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
456 456
         // select language - if case several languages match, get the last (more recent) one
457 457
         $sql = "SELECT english_name
458
-                FROM " . $adminLanguagesTable . "
458
+                FROM " . $adminLanguagesTable."
459 459
                 WHERE
460 460
                     isocode ='$isocode' AND
461 461
                     available = 1
Please login to merge, or discard this patch.
main/inc/lib/system/web/request.class.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -31,6 +31,10 @@
 block discarded – undo
31 31
         return $method == 'GET';
32 32
     }
33 33
 
34
+    /**
35
+     * @param string $key
36
+     * @param string $default
37
+     */
34 38
     public static function post($key, $default = null)
35 39
     {
36 40
         return isset($_POST[$key]) ? $_POST[$key] : $default;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default;
16 16
     }
17 17
 
18
-    public static function has($key){
18
+    public static function has($key) {
19 19
         return isset($_REQUEST[$key]);
20 20
     }
21 21
 
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
  * @author Patrick Cool
17 17
  * @author René Haentjens, added CSV file import (October 2004)
18 18
  * @package chamilo.link
19
-
20 19
  */
21 20
 
22 21
 // Including libraries
Please login to merge, or discard this patch.
main/inc/lib/table_sort.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 	 * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC)
81 81
 	 * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column.
82 82
 	 * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3]
83
-	 * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
83
+	 * @param integer $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
84 84
 	 * @return array The sorted dataset
85 85
 	 * @author [email protected]
86 86
 	 */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
                 $new_data_order = array();
159 159
                 if (!empty($docs_to_sort)) {
160
-                    foreach($docs_to_sort as $id => $document) {
160
+                    foreach ($docs_to_sort as $id => $document) {
161 161
                         if (isset($new_data[$id])) {
162 162
                             $new_data_order[] = $new_data[$id];
163 163
                         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 }
166 166
 
167 167
                 if (!empty($folder_to_sort)) {
168
-                    foreach($folder_to_sort as $id => $document) {
168
+                    foreach ($folder_to_sort as $id => $document) {
169 169
                         if (isset($new_data[$id])) {
170 170
                             $new_data_order[] = $new_data[$id];
171 171
                         }
Please login to merge, or discard this patch.
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
 class TableSort
16 16
 {
17 17
     /**
18
-    * Sorts 2-dimensional table.
19
-    * @param array $data The data to be sorted.
20
-    * @param int $column The column on which the data should be sorted (default = 0)
21
-    * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC)
22
-    * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC,
23
-    * SORT_STRING,SORT_DATE,SORT_IMAGE)
24
-    * @return array The sorted dataset
25
-    * @author [email protected]
26
-    */
27
-	public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR)
18
+     * Sorts 2-dimensional table.
19
+     * @param array $data The data to be sorted.
20
+     * @param int $column The column on which the data should be sorted (default = 0)
21
+     * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC)
22
+     * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC,
23
+     * SORT_STRING,SORT_DATE,SORT_IMAGE)
24
+     * @return array The sorted dataset
25
+     * @author [email protected]
26
+     */
27
+    public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR)
28 28
     {
29 29
         if (!is_array($data) || empty($data)) {
30 30
             return array();
@@ -71,20 +71,20 @@  discard block
 block discarded – undo
71 71
         usort($data, create_function('$a, $b', $compare_function));
72 72
 
73 73
         return $data;
74
-	}
74
+    }
75 75
 
76
-	/**
77
-	 * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted.
78
-	 * @param array $data The data to be sorted.
79
-	 * @param int $column The column on which the data should be sorted (default = 0)
80
-	 * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC)
81
-	 * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column.
82
-	 * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3]
83
-	 * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
84
-	 * @return array The sorted dataset
85
-	 * @author [email protected]
86
-	 */
87
-	public static function sort_table_config(
76
+    /**
77
+     * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted.
78
+     * @param array $data The data to be sorted.
79
+     * @param int $column The column on which the data should be sorted (default = 0)
80
+     * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC)
81
+     * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column.
82
+     * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3]
83
+     * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
84
+     * @return array The sorted dataset
85
+     * @author [email protected]
86
+     */
87
+    public static function sort_table_config(
88 88
         $data,
89 89
         $column = 0,
90 90
         $direction = SORT_ASC,
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
             if (!empty($data)) {
133 133
                 foreach ($data as $document) {
134 134
                     if ($document['type'] == 'folder') {
135
-                      $docs_to_sort[$document['id']]   = api_strtolower($document['name']);
135
+                        $docs_to_sort[$document['id']]   = api_strtolower($document['name']);
136 136
                     } else {
137
-                      $folder_to_sort[$document['id']] = api_strtolower($document['name']);
137
+                        $folder_to_sort[$document['id']] = api_strtolower($document['name']);
138 138
                     }
139 139
                     $new_data[$document['id']] = $document;
140 140
                 }
@@ -196,91 +196,91 @@  discard block
 block discarded – undo
196 196
             usort($data, create_function('$a, $b', $compare_function));
197 197
         }
198 198
 
199
-		if (is_array($column_show) && !empty($column_show)) {
199
+        if (is_array($column_show) && !empty($column_show)) {
200 200
 
201
-			// We show only the columns data that were set up on the $column_show array
202
-			$new_order_data = array();
203
-			$count_data = count($data);
204
-			$count_column_show = count($column_show);
205
-			for ($j = 0; $j < $count_data; $j++) {
206
-				$k = 0;
207
-				for ($i = 0; $i < $count_column_show; $i++) {
208
-					if ($column_show[$i]) {
209
-						$new_order_data[$j][$k] = $data[$j][$i];
210
-					}
211
-					$k++;
212
-				}
213
-			}
214
-			// Replace the multi-arrays
215
-			$data = $new_order_data;
216
-		}
201
+            // We show only the columns data that were set up on the $column_show array
202
+            $new_order_data = array();
203
+            $count_data = count($data);
204
+            $count_column_show = count($column_show);
205
+            for ($j = 0; $j < $count_data; $j++) {
206
+                $k = 0;
207
+                for ($i = 0; $i < $count_column_show; $i++) {
208
+                    if ($column_show[$i]) {
209
+                        $new_order_data[$j][$k] = $data[$j][$i];
210
+                    }
211
+                    $k++;
212
+                }
213
+            }
214
+            // Replace the multi-arrays
215
+            $data = $new_order_data;
216
+        }
217 217
 
218
-		return $data;
219
-	}
218
+        return $data;
219
+    }
220 220
 
221
-	/**
222
-	 * Checks whether a column of a 2D-array contains only numeric values
223
-	 * @param array $data		The data-array
224
-	 * @param int $column		The index of the column to check
225
-	 * @return bool				TRUE if column contains only dates, FALSE otherwise
226
-	 * @todo Take locale into account (eg decimal point or comma ?)
227
-	 * @author [email protected]
228
-	 */
229
-	private static function is_numeric_column(& $data, $column)
221
+    /**
222
+     * Checks whether a column of a 2D-array contains only numeric values
223
+     * @param array $data		The data-array
224
+     * @param int $column		The index of the column to check
225
+     * @return bool				TRUE if column contains only dates, FALSE otherwise
226
+     * @todo Take locale into account (eg decimal point or comma ?)
227
+     * @author [email protected]
228
+     */
229
+    private static function is_numeric_column(& $data, $column)
230 230
     {
231
-		$is_numeric = true;
232
-		foreach ($data as $index => & $row) {
233
-			$is_numeric &= is_numeric(strip_tags($row[$column]));
234
-			if (!$is_numeric) {
235
-				break;
236
-			}
237
-		}
238
-		return $is_numeric;
239
-	}
231
+        $is_numeric = true;
232
+        foreach ($data as $index => & $row) {
233
+            $is_numeric &= is_numeric(strip_tags($row[$column]));
234
+            if (!$is_numeric) {
235
+                break;
236
+            }
237
+        }
238
+        return $is_numeric;
239
+    }
240 240
 
241
-	/**
242
-	 * Checks whether a column of a 2D-array contains only dates (GNU date syntax)
243
-	 * @param array $data		The data-array
244
-	 * @param int $column		The index of the column to check
245
-	 * @return bool				TRUE if column contains only dates, FALSE otherwise
246
-	 * @author [email protected]
247
-	 */
248
-	private static function is_date_column(& $data, $column)
241
+    /**
242
+     * Checks whether a column of a 2D-array contains only dates (GNU date syntax)
243
+     * @param array $data		The data-array
244
+     * @param int $column		The index of the column to check
245
+     * @return bool				TRUE if column contains only dates, FALSE otherwise
246
+     * @author [email protected]
247
+     */
248
+    private static function is_date_column(& $data, $column)
249 249
     {
250
-		$is_date = true;
251
-		foreach ($data as $index => & $row) {
252
-			if (strlen(strip_tags($row[$column])) != 0) {
253
-				$check_date = strtotime(strip_tags($row[$column]));
254
-				// strtotime Returns a timestamp on success, FALSE otherwise.
255
-				// Previous to PHP 5.1.0, this function would return -1 on failure.
256
-				$is_date &= ($check_date != -1 && $check_date);
257
-			} else {
258
-				$is_date &= false;
259
-			}
260
-			if (!$is_date) {
261
-				break;
262
-			}
263
-		}
264
-		return $is_date;
265
-	}
250
+        $is_date = true;
251
+        foreach ($data as $index => & $row) {
252
+            if (strlen(strip_tags($row[$column])) != 0) {
253
+                $check_date = strtotime(strip_tags($row[$column]));
254
+                // strtotime Returns a timestamp on success, FALSE otherwise.
255
+                // Previous to PHP 5.1.0, this function would return -1 on failure.
256
+                $is_date &= ($check_date != -1 && $check_date);
257
+            } else {
258
+                $is_date &= false;
259
+            }
260
+            if (!$is_date) {
261
+                break;
262
+            }
263
+        }
264
+        return $is_date;
265
+    }
266 266
 
267
-	/**
268
-	 * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>)
269
-	 * @param array $data		The data-array
270
-	 * @param int $column		The index of the column to check
271
-	 * @return bool				TRUE if column contains only images, FALSE otherwise
272
-	 * @author [email protected]
273
-	 */
274
-	private static function is_image_column(& $data, $column)
267
+    /**
268
+     * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>)
269
+     * @param array $data		The data-array
270
+     * @param int $column		The index of the column to check
271
+     * @return bool				TRUE if column contains only images, FALSE otherwise
272
+     * @author [email protected]
273
+     */
274
+    private static function is_image_column(& $data, $column)
275 275
     {
276
-		$is_image = true;
277
-		foreach ($data as $index => & $row) {
278
-			$is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag
279
-			$is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values
280
-			if (!$is_image) {
281
-				break;
282
-			}
283
-		}
284
-		return $is_image;
285
-	}
276
+        $is_image = true;
277
+        foreach ($data as $index => & $row) {
278
+            $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag
279
+            $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values
280
+            if (!$is_image) {
281
+                break;
282
+            }
283
+        }
284
+        return $is_image;
285
+    }
286 286
 }
Please login to merge, or discard this patch.
main/inc/lib/template.lib.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -330,6 +330,7 @@  discard block
 block discarded – undo
330 330
     /**
331 331
      * Sets the footer visibility
332 332
      * @param bool true if we show the footer
333
+     * @param boolean $status
333 334
      */
334 335
     public function set_footer($status)
335 336
     {
@@ -370,6 +371,7 @@  discard block
 block discarded – undo
370 371
     /**
371 372
      * Sets the header visibility
372 373
      * @param bool true if we show the header
374
+     * @param boolean $status
373 375
      */
374 376
     public function set_header($status)
375 377
     {
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -338,7 +338,7 @@
 block discarded – undo
338 338
 
339 339
         if (empty($certificatesItem) && empty($searchItem)) {
340 340
             return null;
341
-        }else{
341
+        } else{
342 342
             $content.= $certificatesItem;
343 343
             $content.= $searchItem;
344 344
         }
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
                 $content = '<div class="help">';
277 277
                 $content .= Display::url(
278 278
                     Display::return_icon('help.large.png', get_lang('Help')),
279
-                    api_get_path(WEB_CODE_PATH) . 'help/help.php?open=' . $help,
279
+                    api_get_path(WEB_CODE_PATH).'help/help.php?open='.$help,
280 280
                     [
281 281
                         'class' => 'ajax',
282 282
                         'data-title' => get_lang('Help')
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
             'web_course' => api_get_path(WEB_COURSE_PATH),
491 491
             'web_main' => api_get_path(WEB_CODE_PATH),
492 492
             'web_css' => api_get_path(WEB_CSS_PATH),
493
-            'web_css_theme' => api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/',
493
+            'web_css_theme' => api_get_path(WEB_CSS_PATH).'themes/'.$this->theme.'/',
494 494
             'web_ajax' => api_get_path(WEB_AJAX_PATH),
495 495
             'web_img' => api_get_path(WEB_IMG_PATH),
496 496
             'web_plugin' => api_get_path(WEB_PLUGIN_PATH),
@@ -548,12 +548,12 @@  discard block
 block discarded – undo
548 548
         foreach ($bowerCSSFiles as $file) {
549 549
             $css[] = api_get_path(WEB_PATH).'web/assets/'.$file;
550 550
         }
551
-        $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/bootstrap-select/css/bootstrap-select.min.css';
552
-        $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chosen/chosen.css';
553
-        $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/style.css';
551
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/bootstrap-select/css/bootstrap-select.min.css';
552
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chosen/chosen.css';
553
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css';
554 554
 
555 555
         if (api_is_global_chat_enabled()) {
556
-            $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chat/css/chat.css';
556
+            $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chat/css/chat.css';
557 557
         }
558 558
 
559 559
         //THEME CSS STYLE
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 
598 598
         if (is_file(api_get_path(SYS_CSS_PATH).'themes/'.$this->theme.'/editor.css')) {
599 599
             $css[] = api_get_path(WEB_CSS_PATH).'themes/'.$this->theme.'/editor.css';
600
-        }else{
600
+        } else {
601 601
             $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'editor.css');
602 602
         }
603 603
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 
633 633
             $style_print = '';
634 634
             if (is_readable(api_get_path(SYS_CSS_PATH).$this->theme.'/print.css')) {
635
-                $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH) . $this->theme . '/print.css'),
635
+                $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->theme.'/print.css'),
636 636
                     'print');
637 637
             }
638 638
             $this->assign('css_style_print', $style_print);
@@ -655,10 +655,10 @@  discard block
 block discarded – undo
655 655
 
656 656
         $isoCode = api_get_language_isocode();
657 657
 
658
-        $selectLink = 'bootstrap-select/js/i18n/defaults-' . $isoCode . '_' . strtoupper($isoCode) . '.min.js';
658
+        $selectLink = 'bootstrap-select/js/i18n/defaults-'.$isoCode.'_'.strtoupper($isoCode).'.min.js';
659 659
 
660 660
         if ($isoCode == 'en') {
661
-            $selectLink = 'bootstrap-select/js/i18n/defaults-' . $isoCode . '_US.min.js';
661
+            $selectLink = 'bootstrap-select/js/i18n/defaults-'.$isoCode.'_US.min.js';
662 662
         }
663 663
         // JS files
664 664
         $js_files = array(
@@ -710,8 +710,8 @@  discard block
 block discarded – undo
710 710
         }
711 711
 
712 712
         if ($isoCode != 'en') {
713
-            $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-' . $isoCode . '.js';
714
-            $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-' . $isoCode . '.min.js';
713
+            $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-'.$isoCode.'.js';
714
+            $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-'.$isoCode.'.min.js';
715 715
         }
716 716
 
717 717
         foreach ($bowerJsFiles as $file) {
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
         }
793 793
 
794 794
         $this->assign('online_button', Display::return_icon('statusonline.png', null, null, ICON_SIZE_ATOM));
795
-        $this->assign('offline_button',Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM));
795
+        $this->assign('offline_button', Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM));
796 796
 
797 797
         // Get language iso-code for this page - ignore errors
798 798
         $this->assign('document_language', api_get_language_isocode());
@@ -851,14 +851,14 @@  discard block
 block discarded – undo
851 851
         $this->assign('section_name', 'section-'.$this_section);
852 852
 
853 853
         //Defaul root chamilo favicon
854
-        $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_PATH) . 'favicon.ico" type="image/x-icon" />';
854
+        $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_PATH).'favicon.ico" type="image/x-icon" />';
855 855
 
856 856
         //Added to verify if in the current Chamilo Theme exist a favicon
857
-        $favicoThemeUrl = api_get_path(SYS_CSS_PATH) . 'themes/' . $this->theme . '/images/';
857
+        $favicoThemeUrl = api_get_path(SYS_CSS_PATH).'themes/'.$this->theme.'/images/';
858 858
 
859 859
         //If exist pick the current chamilo theme favicon
860
-        if (is_file($favicoThemeUrl . 'favicon.ico')) {
861
-            $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_CSS_PATH). 'themes/' . $this->theme . '/images/favicon.ico" type="image/x-icon" />';
860
+        if (is_file($favicoThemeUrl.'favicon.ico')) {
861
+            $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_CSS_PATH).'themes/'.$this->theme.'/images/favicon.ico" type="image/x-icon" />';
862 862
         }
863 863
 
864 864
         if (api_is_multiple_url_enabled()) {
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
         if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) {
889 889
             $rightFloatMenu = '<div class="report">
890 890
 		<a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank">
891
-                    '. $iconBug . '
891
+                    '. $iconBug.'
892 892
                 </a>
893 893
 		</div>';
894 894
         }
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
             $url = api_get_path(WEB_CODE_PATH).'ticket/new_ticket.php?project_id=1&'.$courseParams;
905 905
             $rightFloatMenu .= '<div class="report">
906 906
 		        <a href="'.$url.'" target="_blank">
907
-                    '. $iconTicket . '
907
+                    '. $iconTicket.'
908 908
                 </a>
909 909
 		    </div>';
910 910
         }
@@ -1023,13 +1023,13 @@  discard block
 block discarded – undo
1023 1023
         $socialMeta = '';
1024 1024
         $metaTitle = api_get_setting('meta_title');
1025 1025
         if (!empty($metaTitle)) {
1026
-            $socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n";
1026
+            $socialMeta .= '<meta name="twitter:card" content="summary" />'."\n";
1027 1027
             $metaSite = api_get_setting('meta_twitter_site');
1028 1028
             if (!empty($metaSite)) {
1029
-                $socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n";
1029
+                $socialMeta .= '<meta name="twitter:site" content="'.$metaSite.'" />'."\n";
1030 1030
                 $metaCreator = api_get_setting('meta_twitter_creator');
1031 1031
                 if (!empty($metaCreator)) {
1032
-                    $socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n";
1032
+                    $socialMeta .= '<meta name="twitter:creator" content="'.$metaCreator.'" />'."\n";
1033 1033
                 }
1034 1034
             }
1035 1035
 
@@ -1041,19 +1041,19 @@  discard block
 block discarded – undo
1041 1041
             if (!$userId && !$skillId) {
1042 1042
                 // no combination of user and skill ID has been defined,
1043 1043
                 // so print the normal OpenGraph meta tags
1044
-                $socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n";
1045
-                $socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n";
1044
+                $socialMeta .= '<meta property="og:title" content="'.$metaTitle.'" />'."\n";
1045
+                $socialMeta .= '<meta property="og:url" content="'.api_get_path(WEB_PATH).'" />'."\n";
1046 1046
 
1047 1047
                 $metaDescription = api_get_setting('meta_description');
1048 1048
                 if (!empty($metaDescription)) {
1049
-                    $socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n";
1049
+                    $socialMeta .= '<meta property="og:description" content="'.$metaDescription.'" />'."\n";
1050 1050
                 }
1051 1051
 
1052 1052
                 $metaImage = api_get_setting('meta_image_path');
1053 1053
                 if (!empty($metaImage)) {
1054
-                    if (is_file(api_get_path(SYS_PATH) . $metaImage)) {
1055
-                        $path = api_get_path(WEB_PATH) . $metaImage;
1056
-                        $socialMeta .= '<meta property="og:image" content="' . $path . '" />' . "\n";
1054
+                    if (is_file(api_get_path(SYS_PATH).$metaImage)) {
1055
+                        $path = api_get_path(WEB_PATH).$metaImage;
1056
+                        $socialMeta .= '<meta property="og:image" content="'.$path.'" />'."\n";
1057 1057
                     }
1058 1058
                 }
1059 1059
             }
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
         // Tutor name
1088 1088
         if (api_get_setting('show_tutor_data') == 'true') {
1089 1089
             // Course manager
1090
-            $courseId  = api_get_course_int_id();
1090
+            $courseId = api_get_course_int_id();
1091 1091
             $id_session = api_get_session_id();
1092 1092
             if (!empty($courseId)) {
1093 1093
                 $tutor_data = '';
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
             $courseId = api_get_course_int_id();
1120 1120
             if (!empty($courseId)) {
1121 1121
                 $teacher_data = '';
1122
-                $mail= CourseManager::get_emails_of_tutors_to_course($courseId);
1122
+                $mail = CourseManager::get_emails_of_tutors_to_course($courseId);
1123 1123
                 if (!empty($mail)) {
1124 1124
                     $teachers_parsed = array();
1125 1125
                     foreach ($mail as $value) {
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
                     'sessionVar'   => basename(__FILE__, '.php'),
1376 1376
                     'imageOptions' => array(
1377 1377
                         'font_size' => 20,
1378
-                        'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/',
1378
+                        'font_path' => api_get_path(SYS_FONTS_PATH).'opensans/',
1379 1379
                         'font_file' => 'OpenSans-Regular.ttf',
1380 1380
                         //'output' => 'gif'
1381 1381
                     )
Please login to merge, or discard this patch.
main/inc/lib/text.lib.php 4 patches
Doc Comments   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,6 +52,7 @@  discard block
 block discarded – undo
52 52
  * Converts the text of a html-document to a given encoding, the meta-tag is changed accordingly.
53 53
  * @param string $string                The input full-html document.
54 54
  * @param string                        The new encoding value to be set.
55
+ * @param string $encoding
55 56
  */
56 57
 function api_set_encoding_html(&$string, $encoding) {
57 58
     $old_encoding = api_detect_encoding_html($string);
@@ -74,7 +75,7 @@  discard block
 block discarded – undo
74 75
  * Returns the title of a html document.
75 76
  * @param string $string                The contents of the input document.
76 77
  * @param string $input_encoding        The encoding of the input document. If the value is not set, it is detected.
77
- * @param string $$output_encoding      The encoding of the retrieved title. If the value is not set, the system encoding is assumend.
78
+ * @param string $output_encoding      The encoding of the retrieved title. If the value is not set, the system encoding is assumend.
78 79
  * @return string                       The retrieved title, html-entities and extra-whitespace between the words are cleaned.
79 80
  */
80 81
 function api_get_title_html(&$string, $output_encoding = null, $input_encoding = null) {
@@ -433,7 +434,7 @@  discard block
 block discarded – undo
433 434
  * @since wordpress  2.8.1
434 435
  * @access private
435 436
  *
436
- * @param string|array $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles.
437
+ * @param string[] $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles.
437 438
  * @param string $subject The string being searched and replaced on, otherwise known as the haystack.
438 439
  * @return string The string with the replaced svalues.
439 440
  */
@@ -628,6 +629,7 @@  discard block
 block discarded – undo
628 629
  * @param string    The text to "cut"
629 630
  * @param int       Count of chars
630 631
  * @param bool      Whether to embed in a <span title="...">...</span>
632
+ * @param integer $maxchar
631 633
  * @return string
632 634
  * */
633 635
 function cut($text, $maxchar, $embed = false) {
@@ -645,7 +647,7 @@  discard block
 block discarded – undo
645 647
  *
646 648
  * @param mixed     Number to convert
647 649
  * @param int       Decimal points 0=never, 1=if needed, 2=always
648
- * @return mixed    An integer or a float depends on the parameter
650
+ * @return string|null    An integer or a float depends on the parameter
649 651
  */
650 652
 function float_format($number, $flag = 1) {
651 653
     if (is_numeric($number)) {
@@ -689,7 +691,7 @@  discard block
 block discarded – undo
689 691
 /**
690 692
  * Gets the week from a day
691 693
  * @param   string   Date in UTC (2010-01-01 12:12:12)
692
- * @return  int      Returns an integer with the week number of the year
694
+ * @return  string      Returns an integer with the week number of the year
693 695
  */
694 696
 function get_week_from_day($date) {
695 697
     if (!empty($date)) {
@@ -739,6 +741,9 @@  discard block
 block discarded – undo
739 741
 	return $output.$end;
740 742
 }
741 743
 
744
+/**
745
+ * @param string $glue
746
+ */
742 747
 function implode_with_key($glue, $array) {
743 748
     if (!empty($array)) {
744 749
         $string = '';
@@ -817,7 +822,7 @@  discard block
 block discarded – undo
817 822
 /**
818 823
  * @param string $string
819 824
  * @param bool $capitalizeFirstCharacter
820
- * @return mixed
825
+ * @return string
821 826
  */
822 827
 function underScoreToCamelCase($string, $capitalizeFirstCharacter = true)
823 828
 {
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
     if (@preg_match('/(.*<head.*)(<meta[^>]*content=[^>]*>)(.*<\/head>.*)/si', $string, $matches)) {
59 59
         $meta = $matches[2];
60 60
         if (@preg_match("/(<meta[^>]*charset=)(.*)([\"';][^>]*>)/si", $meta, $matches1)) {
61
-            $meta = $matches1[1] . $encoding . $matches1[3];
62
-            $string = $matches[1] . $meta . $matches[3];
61
+            $meta = $matches1[1].$encoding.$matches1[3];
62
+            $string = $matches[1].$meta.$matches[3];
63 63
         } else {
64
-            $string = $matches[1] . '<meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/>' . $matches[3];
64
+            $string = $matches[1].'<meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/>'.$matches[3];
65 65
         }
66 66
     } else {
67 67
         $count = 1;
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
     if (!preg_match(_PCRE_XML_ENCODING, $string)) {
169 169
         if (strpos($matches[0], 'standalone') !== false) {
170 170
             // The encoding option should precede the standalone option, othewise DOMDocument fails to load the document.
171
-            $replace = str_replace('standalone', ' encoding="'.$to_encoding.'" standalone' , $matches[0]);
171
+            $replace = str_replace('standalone', ' encoding="'.$to_encoding.'" standalone', $matches[0]);
172 172
         } else {
173
-            $replace = str_replace('?>', ' encoding="'.$to_encoding.'"?>' , $matches[0]);
173
+            $replace = str_replace('?>', ' encoding="'.$to_encoding.'"?>', $matches[0]);
174 174
         }
175 175
         return api_convert_encoding(str_replace($matches[0], $replace, $string), $to_encoding, $from_encoding);
176 176
     }
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 function _make_url_clickable_cb($matches) {
336 336
     $url = $matches[2];
337 337
 
338
-    if ( ')' == $matches[3] && strpos( $url, '(' ) ) {
338
+    if (')' == $matches[3] && strpos($url, '(')) {
339 339
         // If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL.
340 340
         // Then we can let the parenthesis balancer do its thing below.
341 341
         $url .= $matches[3];
@@ -345,16 +345,16 @@  discard block
 block discarded – undo
345 345
     }
346 346
 
347 347
     // Include parentheses in the URL only if paired
348
-    while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) {
349
-        $suffix = strrchr( $url, ')' ) . $suffix;
350
-        $url = substr( $url, 0, strrpos( $url, ')' ) );
348
+    while (substr_count($url, '(') < substr_count($url, ')')) {
349
+        $suffix = strrchr($url, ')').$suffix;
350
+        $url = substr($url, 0, strrpos($url, ')'));
351 351
     }
352 352
 
353 353
     $url = esc_url($url);
354
-    if ( empty($url) )
354
+    if (empty($url))
355 355
         return $matches[0];
356 356
 
357
-    return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;
357
+    return $matches[1]."<a href=\"$url\" rel=\"nofollow\">$url</a>".$suffix;
358 358
 }
359 359
 
360 360
 /**
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
  * @param string $_context Private. Use esc_url_raw() for database usage.
375 375
  * @return string The cleaned $url after the 'clean_url' filter is applied.
376 376
  */
377
-function esc_url( $url, $protocols = null, $_context = 'display' ) {
377
+function esc_url($url, $protocols = null, $_context = 'display') {
378 378
     //$original_url = $url;
379 379
 
380
-    if ( '' == $url )
380
+    if ('' == $url)
381 381
         return $url;
382 382
     $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
383 383
     $strip = array('%0d', '%0a', '%0D', '%0A');
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
      * presume it needs http:// appended (unless a relative
388 388
      * link starting with /, # or ? or a php file).
389 389
      */
390
-    if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
391
-        ! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
392
-        $url = 'http://' . $url;
390
+    if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) &&
391
+        !preg_match('/^[a-z0-9-]+?\.php/i', $url))
392
+        $url = 'http://'.$url;
393 393
 
394 394
     return Security::remove_XSS($url);
395 395
 
@@ -437,12 +437,12 @@  discard block
 block discarded – undo
437 437
  * @param string $subject The string being searched and replaced on, otherwise known as the haystack.
438 438
  * @return string The string with the replaced svalues.
439 439
  */
440
-function _deep_replace( $search, $subject ) {
440
+function _deep_replace($search, $subject) {
441 441
     $subject = (string) $subject;
442 442
 
443 443
     $count = 1;
444
-    while ( $count ) {
445
-        $subject = str_replace( $search, '', $subject, $count );
444
+    while ($count) {
445
+        $subject = str_replace($search, '', $subject, $count);
446 446
     }
447 447
 
448 448
     return $subject;
@@ -464,17 +464,17 @@  discard block
 block discarded – undo
464 464
 function _make_web_ftp_clickable_cb($matches) {
465 465
     $ret = '';
466 466
     $dest = $matches[2];
467
-    $dest = 'http://' . $dest;
467
+    $dest = 'http://'.$dest;
468 468
     $dest = esc_url($dest);
469
-    if ( empty($dest) )
469
+    if (empty($dest))
470 470
         return $matches[0];
471 471
 
472 472
     // removed trailing [.,;:)] from URL
473
-    if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) {
473
+    if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) {
474 474
         $ret = substr($dest, -1);
475
-        $dest = substr($dest, 0, strlen($dest)-1);
475
+        $dest = substr($dest, 0, strlen($dest) - 1);
476 476
     }
477
-    return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
477
+    return $matches[1]."<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
478 478
 }
479 479
 
480 480
 /**
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
  * @return string HTML A element with email address.
491 491
  */
492 492
 function _make_email_clickable_cb($matches) {
493
-    $email = $matches[2] . '@' . $matches[3];
494
-    return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
493
+    $email = $matches[2].'@'.$matches[3];
494
+    return $matches[1]."<a href=\"mailto:$email\">$email</a>";
495 495
 }
496 496
 
497 497
 /**
@@ -505,30 +505,30 @@  discard block
 block discarded – undo
505 505
  * @param string $text Content to convert URIs.
506 506
  * @return string Content with converted URIs.
507 507
  */
508
-function make_clickable( $text ) {
508
+function make_clickable($text) {
509 509
     $r = '';
510
-    $textarr = preg_split( '/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // split out HTML tags
510
+    $textarr = preg_split('/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // split out HTML tags
511 511
     $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
512
-    foreach ( $textarr as $piece ) {
512
+    foreach ($textarr as $piece) {
513 513
 
514
-        if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) )
514
+        if (preg_match('|^<code[\s>]|i', $piece) || preg_match('|^<pre[\s>]|i', $piece))
515 515
             $nested_code_pre++;
516
-        elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre )
516
+        elseif (('</code>' === strtolower($piece) || '</pre>' === strtolower($piece)) && $nested_code_pre)
517 517
             $nested_code_pre--;
518 518
 
519
-        if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
519
+        if ($nested_code_pre || empty($piece) || ($piece[0] === '<' && !preg_match('|^<\s*[\w]{1,20}+://|', $piece))) {
520 520
             $r .= $piece;
521 521
             continue;
522 522
         }
523 523
 
524 524
         // Long strings might contain expensive edge cases ...
525
-        if ( 10000 < strlen( $piece ) ) {
525
+        if (10000 < strlen($piece)) {
526 526
             // ... break it up
527
-            foreach ( _split_str_by_whitespace( $piece, 2100 ) as $chunk ) { // 2100: Extra room for scheme and leading and trailing paretheses
528
-                if ( 2101 < strlen( $chunk ) ) {
527
+            foreach (_split_str_by_whitespace($piece, 2100) as $chunk) { // 2100: Extra room for scheme and leading and trailing paretheses
528
+                if (2101 < strlen($chunk)) {
529 529
                     $r .= $chunk; // Too big, no whitespace: bail.
530 530
                 } else {
531
-                    $r .= make_clickable( $chunk );
531
+                    $r .= make_clickable($chunk);
532 532
                 }
533 533
             }
534 534
         } else {
@@ -549,18 +549,18 @@  discard block
 block discarded – undo
549 549
 			~xS'; // The regex is a non-anchored pattern and does not have a single fixed starting character.
550 550
             // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
551 551
 
552
-            $ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret );
552
+            $ret = preg_replace_callback($url_clickable, '_make_url_clickable_cb', $ret);
553 553
 
554
-            $ret = preg_replace_callback( '#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret );
555
-            $ret = preg_replace_callback( '#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret );
554
+            $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret);
555
+            $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
556 556
 
557
-            $ret = substr( $ret, 1, -1 ); // Remove our whitespace padding.
557
+            $ret = substr($ret, 1, -1); // Remove our whitespace padding.
558 558
             $r .= $ret;
559 559
         }
560 560
     }
561 561
 
562 562
     // Cleanup of accidental links within links
563
-    $r = preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r );
563
+    $r = preg_replace('#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r);
564 564
     return $r;
565 565
 }
566 566
 
@@ -595,27 +595,27 @@  discard block
 block discarded – undo
595 595
  * @param int $goal The desired chunk length.
596 596
  * @return array Numeric array of chunks.
597 597
  */
598
-function _split_str_by_whitespace( $string, $goal ) {
598
+function _split_str_by_whitespace($string, $goal) {
599 599
     $chunks = array();
600 600
 
601
-    $string_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" );
601
+    $string_nullspace = strtr($string, "\r\n\t\v\f ", "\000\000\000\000\000\000");
602 602
 
603
-    while ( $goal < strlen( $string_nullspace ) ) {
604
-        $pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" );
603
+    while ($goal < strlen($string_nullspace)) {
604
+        $pos = strrpos(substr($string_nullspace, 0, $goal + 1), "\000");
605 605
 
606
-        if ( false === $pos ) {
607
-            $pos = strpos( $string_nullspace, "\000", $goal + 1 );
608
-            if ( false === $pos ) {
606
+        if (false === $pos) {
607
+            $pos = strpos($string_nullspace, "\000", $goal + 1);
608
+            if (false === $pos) {
609 609
                 break;
610 610
             }
611 611
         }
612 612
 
613
-        $chunks[] = substr( $string, 0, $pos + 1 );
614
-        $string = substr( $string, $pos + 1 );
615
-        $string_nullspace = substr( $string_nullspace, $pos + 1 );
613
+        $chunks[] = substr($string, 0, $pos + 1);
614
+        $string = substr($string, $pos + 1);
615
+        $string_nullspace = substr($string_nullspace, $pos + 1);
616 616
     }
617 617
 
618
-    if ( $string ) {
618
+    if ($string) {
619 619
         $chunks[] = $string;
620 620
     }
621 621
 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
  */
694 694
 function get_week_from_day($date) {
695 695
     if (!empty($date)) {
696
-       $time = api_strtotime($date,'UTC');
696
+       $time = api_strtotime($date, 'UTC');
697 697
        return date('W', $time);
698 698
     } else {
699 699
         return date('W');
@@ -710,17 +710,17 @@  discard block
 block discarded – undo
710 710
  * @return a reduce string
711 711
  */
712 712
 
713
-function substrwords($text,$maxchar,$end='...')
713
+function substrwords($text, $maxchar, $end = '...')
714 714
 {
715
-	if(strlen($text)>$maxchar)
715
+	if (strlen($text) > $maxchar)
716 716
 	{
717
-		$words=explode(" ",$text);
717
+		$words = explode(" ", $text);
718 718
 		$output = '';
719
-		$i=0;
720
-		while(1)
719
+		$i = 0;
720
+		while (1)
721 721
 		{
722
-			$length = (strlen($output)+strlen($words[$i]));
723
-			if($length>$maxchar)
722
+			$length = (strlen($output) + strlen($words[$i]));
723
+			if ($length > $maxchar)
724 724
 			{
725 725
 				break;
726 726
 			}
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 function implode_with_key($glue, $array) {
743 743
     if (!empty($array)) {
744 744
         $string = '';
745
-        foreach($array as $key => $value) {
745
+        foreach ($array as $key => $value) {
746 746
             if (empty($value)) {
747 747
                 $value = 'null';
748 748
             }
@@ -764,13 +764,13 @@  discard block
 block discarded – undo
764 764
 {
765 765
     $file_size = intval($file_size);
766 766
     if ($file_size >= 1073741824) {
767
-        $file_size = round($file_size / 1073741824 * 100) / 100 . 'G';
768
-    } elseif($file_size >= 1048576) {
769
-        $file_size = round($file_size / 1048576 * 100) / 100 . 'M';
770
-    } elseif($file_size >= 1024) {
771
-        $file_size = round($file_size / 1024 * 100) / 100 . 'k';
767
+        $file_size = round($file_size / 1073741824 * 100) / 100.'G';
768
+    } elseif ($file_size >= 1048576) {
769
+        $file_size = round($file_size / 1048576 * 100) / 100.'M';
770
+    } elseif ($file_size >= 1024) {
771
+        $file_size = round($file_size / 1024 * 100) / 100.'k';
772 772
     } else {
773
-        $file_size = $file_size . 'B';
773
+        $file_size = $file_size.'B';
774 774
     }
775 775
     return $file_size;
776 776
 }
@@ -779,18 +779,18 @@  discard block
 block discarded – undo
779 779
 {
780 780
     $year	 = '0000';
781 781
     $month = $day = $hours = $minutes = $seconds = '00';
782
-    if (isset($array['Y']) && (isset($array['F']) || isset($array['M']))  && isset($array['d']) && isset($array['H']) && isset($array['i'])) {
782
+    if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) {
783 783
         $year = $array['Y'];
784
-        $month = isset($array['F'])?$array['F']:$array['M'];
785
-        if (intval($month) < 10 ) $month = '0'.$month;
784
+        $month = isset($array['F']) ? $array['F'] : $array['M'];
785
+        if (intval($month) < 10) $month = '0'.$month;
786 786
         $day = $array['d'];
787
-        if (intval($day) < 10 ) $day = '0'.$day;
787
+        if (intval($day) < 10) $day = '0'.$day;
788 788
         $hours = $array['H'];
789
-        if (intval($hours) < 10 ) $hours = '0'.$hours;
789
+        if (intval($hours) < 10) $hours = '0'.$hours;
790 790
         $minutes = $array['i'];
791
-        if (intval($minutes) < 10 ) $minutes = '0'.$minutes;
791
+        if (intval($minutes) < 10) $minutes = '0'.$minutes;
792 792
     }
793
-    if (checkdate($month,$day,$year)) {
793
+    if (checkdate($month, $day, $year)) {
794 794
         $datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds;
795 795
     }
796 796
     return $datetime;
Please login to merge, or discard this patch.
Braces   +31 added lines, -20 removed lines patch added patch discarded remove patch
@@ -351,8 +351,9 @@  discard block
 block discarded – undo
351 351
     }
352 352
 
353 353
     $url = esc_url($url);
354
-    if ( empty($url) )
355
-        return $matches[0];
354
+    if ( empty($url) ) {
355
+            return $matches[0];
356
+    }
356 357
 
357 358
     return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;
358 359
 }
@@ -377,8 +378,9 @@  discard block
 block discarded – undo
377 378
 function esc_url( $url, $protocols = null, $_context = 'display' ) {
378 379
     //$original_url = $url;
379 380
 
380
-    if ( '' == $url )
381
-        return $url;
381
+    if ( '' == $url ) {
382
+            return $url;
383
+    }
382 384
     $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
383 385
     $strip = array('%0d', '%0a', '%0D', '%0A');
384 386
     $url = _deep_replace($strip, $url);
@@ -388,8 +390,9 @@  discard block
 block discarded – undo
388 390
      * link starting with /, # or ? or a php file).
389 391
      */
390 392
     if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
391
-        ! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
392
-        $url = 'http://' . $url;
393
+        ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) {
394
+            $url = 'http://' . $url;
395
+    }
393 396
 
394 397
     return Security::remove_XSS($url);
395 398
 
@@ -466,8 +469,9 @@  discard block
 block discarded – undo
466 469
     $dest = $matches[2];
467 470
     $dest = 'http://' . $dest;
468 471
     $dest = esc_url($dest);
469
-    if ( empty($dest) )
470
-        return $matches[0];
472
+    if ( empty($dest) ) {
473
+            return $matches[0];
474
+    }
471 475
 
472 476
     // removed trailing [.,;:)] from URL
473 477
     if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) {
@@ -511,10 +515,11 @@  discard block
 block discarded – undo
511 515
     $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
512 516
     foreach ( $textarr as $piece ) {
513 517
 
514
-        if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) )
515
-            $nested_code_pre++;
516
-        elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre )
517
-            $nested_code_pre--;
518
+        if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) {
519
+                    $nested_code_pre++;
520
+        } elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) {
521
+                    $nested_code_pre--;
522
+        }
518 523
 
519 524
         if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
520 525
             $r .= $piece;
@@ -723,15 +728,13 @@  discard block
 block discarded – undo
723 728
 			if($length>$maxchar)
724 729
 			{
725 730
 				break;
726
-			}
727
-			else
731
+			} else
728 732
 			{
729 733
 				$output = $output." ".$words[$i];
730 734
 				$i++;
731 735
 			};
732 736
 		};
733
-	}
734
-	else
737
+	} else
735 738
 	{
736 739
 		$output = $text;
737 740
 		return $output;
@@ -782,13 +785,21 @@  discard block
 block discarded – undo
782 785
     if (isset($array['Y']) && (isset($array['F']) || isset($array['M']))  && isset($array['d']) && isset($array['H']) && isset($array['i'])) {
783 786
         $year = $array['Y'];
784 787
         $month = isset($array['F'])?$array['F']:$array['M'];
785
-        if (intval($month) < 10 ) $month = '0'.$month;
788
+        if (intval($month) < 10 ) {
789
+            $month = '0'.$month;
790
+        }
786 791
         $day = $array['d'];
787
-        if (intval($day) < 10 ) $day = '0'.$day;
792
+        if (intval($day) < 10 ) {
793
+            $day = '0'.$day;
794
+        }
788 795
         $hours = $array['H'];
789
-        if (intval($hours) < 10 ) $hours = '0'.$hours;
796
+        if (intval($hours) < 10 ) {
797
+            $hours = '0'.$hours;
798
+        }
790 799
         $minutes = $array['i'];
791
-        if (intval($minutes) < 10 ) $minutes = '0'.$minutes;
800
+        if (intval($minutes) < 10 ) {
801
+            $minutes = '0'.$minutes;
802
+        }
792 803
     }
793 804
     if (checkdate($month,$day,$year)) {
794 805
         $datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds;
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -693,8 +693,8 @@  discard block
 block discarded – undo
693 693
  */
694 694
 function get_week_from_day($date) {
695 695
     if (!empty($date)) {
696
-       $time = api_strtotime($date,'UTC');
697
-       return date('W', $time);
696
+        $time = api_strtotime($date,'UTC');
697
+        return date('W', $time);
698 698
     } else {
699 699
         return date('W');
700 700
     }
@@ -712,31 +712,31 @@  discard block
 block discarded – undo
712 712
 
713 713
 function substrwords($text,$maxchar,$end='...')
714 714
 {
715
-	if(strlen($text)>$maxchar)
716
-	{
717
-		$words=explode(" ",$text);
718
-		$output = '';
719
-		$i=0;
720
-		while(1)
721
-		{
722
-			$length = (strlen($output)+strlen($words[$i]));
723
-			if($length>$maxchar)
724
-			{
725
-				break;
726
-			}
727
-			else
728
-			{
729
-				$output = $output." ".$words[$i];
730
-				$i++;
731
-			};
732
-		};
733
-	}
734
-	else
735
-	{
736
-		$output = $text;
737
-		return $output;
738
-	}
739
-	return $output.$end;
715
+    if(strlen($text)>$maxchar)
716
+    {
717
+        $words=explode(" ",$text);
718
+        $output = '';
719
+        $i=0;
720
+        while(1)
721
+        {
722
+            $length = (strlen($output)+strlen($words[$i]));
723
+            if($length>$maxchar)
724
+            {
725
+                break;
726
+            }
727
+            else
728
+            {
729
+                $output = $output." ".$words[$i];
730
+                $i++;
731
+            };
732
+        };
733
+    }
734
+    else
735
+    {
736
+        $output = $text;
737
+        return $output;
738
+    }
739
+    return $output.$end;
740 740
 }
741 741
 
742 742
 function implode_with_key($glue, $array) {
Please login to merge, or discard this patch.