Code Duplication    Length = 7-10 lines in 7 locations

main/admin/index.php 1 location

@@ 431-440 (lines=10) @@
428
    $blocks['version_check']['class'] = 'block-admin-version_check';
429
430
    // Check Hook Event for Admin Block Object
431
    if (!empty($hook)) {
432
        // If not empty, then notify Post process to Hook Observers for Admin Block
433
        $hook->setEventData(array('blocks' => $blocks));
434
        $data = $hook->notifyAdminBlock(HOOK_EVENT_TYPE_POST);
435
        // Check if blocks data is not null
436
        if (isset($data['blocks'])) {
437
            // Get modified blocks
438
            $blocks = $data['blocks'];
439
        }
440
    }
441
}
442
$admin_ajax_url = api_get_path(WEB_AJAX_PATH) . 'admin.ajax.php';
443

main/inc/lib/notification.lib.php 2 locations

@@ 202-208 (lines=7) @@
199
                break;
200
        }
201
202
        if (!empty($hook)) {
203
            $hook->setEventData(array('title' => $newTitle));
204
            $data = $hook->notifyNotificationTitle(HOOK_EVENT_TYPE_POST);
205
            if (isset($data['title'])) {
206
                $newTitle = $data['title'];
207
            }
208
        }
209
210
        return $newTitle;
211
    }
@@ 436-442 (lines=7) @@
433
                Display::url($preference_url, $preference_url)
434
            ).'</i>';
435
436
        if (!empty($hook)) {
437
            $hook->setEventData(array('content' => $content));
438
            $data = $hook->notifyNotificationContent(HOOK_EVENT_TYPE_POST);
439
            if (isset($data['content'])) {
440
                $content = $data['content'];
441
            }
442
        }
443
444
        return $content;
445
    }

main/webservices/access_url.php 2 locations

@@ 100-106 (lines=7) @@
97
98
/** @var HookWSRegistration $hook */
99
$hook = HookWSRegistration::create();
100
if (!empty($hook)) {
101
    $hook->setEventData(array('server' => $server));
102
    $res = $hook->notifyWSRegistration(HOOK_EVENT_TYPE_PRE);
103
    if (!empty($res['server'])) {
104
        $server = $res['server'];
105
    }
106
}
107
108
$server->soap_defencoding = 'UTF-8';
109
@@ 435-441 (lines=7) @@
432
/* Delete user from group Web Service end */
433
434
// Add more webservices through hooks from plugins
435
if (!empty($hook)) {
436
    $hook->setEventData(array('server' => $server));
437
    $res = $hook->notifyWSRegistration(HOOK_EVENT_TYPE_POST);
438
    if (!empty($res['server'])) {
439
        $server = $res['server'];
440
    }
441
}
442
443
// Use the request to (try to) invoke the service
444
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input');

main/webservices/registration.soap.php 2 locations

@@ 105-111 (lines=7) @@
102
103
/** @var HookWSRegistration $hook */
104
$hook = HookWSRegistration::create();
105
if (!empty($hook)) {
106
    $hook->setEventData(array('server' => $server));
107
    $res = $hook->notifyWSRegistration(HOOK_EVENT_TYPE_PRE);
108
    if (!empty($res['server'])) {
109
        $server = $res['server'];
110
    }
111
}
112
113
$server->soap_defencoding = 'UTF-8';
114
@@ 6784-6790 (lines=7) @@
6781
/* Delete user from group Web Service end */
6782
6783
// Add more webservices through hooks from plugins
6784
if (!empty($hook)) {
6785
    $hook->setEventData(array('server' => $server));
6786
    $res = $hook->notifyWSRegistration(HOOK_EVENT_TYPE_POST);
6787
    if (!empty($res['server'])) {
6788
        $server = $res['server'];
6789
    }
6790
}
6791
6792
// Use the request to (try to) invoke the service
6793
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input');