|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Linkverifier Helper class for phpMyFAQ. |
|
4
|
|
|
* |
|
5
|
|
|
* PHP Version 5.5 |
|
6
|
|
|
* |
|
7
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public License, |
|
8
|
|
|
* v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
9
|
|
|
* obtain one at http://mozilla.org/MPL/2.0/. |
|
10
|
|
|
* |
|
11
|
|
|
* @category phpMyFAQ |
|
12
|
|
|
* @author Thorsten Rinne <[email protected]> |
|
13
|
|
|
* @copyright 2012-2015 phpMyFAQ Team |
|
14
|
|
|
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
15
|
|
|
* @link http://www.phpmyfaq.de |
|
16
|
|
|
* @since 2012-09-03 |
|
17
|
|
|
*/ |
|
18
|
|
|
if (!defined('IS_VALID_PHPMYFAQ')) { |
|
19
|
|
|
exit(); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* PMF_Helper_Linkverifier. |
|
24
|
|
|
* |
|
25
|
|
|
* @category phpMyFAQ |
|
26
|
|
|
* @author Thorsten Rinne <[email protected]> |
|
27
|
|
|
* @copyright 2012-2015 phpMyFAQ Team |
|
28
|
|
|
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
29
|
|
|
* @link http://www.phpmyfaq.de |
|
30
|
|
|
* @since 2012-09-03 |
|
31
|
|
|
*/ |
|
32
|
|
|
class PMF_Helper_Linkverifier extends PMF_Helper |
|
33
|
|
|
{ |
|
34
|
|
|
/** |
|
35
|
|
|
* Prints JavaScript needed for AJAX verification on record add/save/clicked on listing. |
|
36
|
|
|
* |
|
37
|
|
|
* @param int $id |
|
38
|
|
|
* @param string $lang |
|
39
|
|
|
*/ |
|
40
|
|
|
public static function linkOndemandJavascript($id, $lang) |
|
41
|
|
|
{ |
|
42
|
|
|
?> |
|
43
|
|
|
<script type="text/javascript"> |
|
44
|
|
|
function ajaxOnDemandVerify(id, lang) |
|
45
|
|
|
{ |
|
46
|
|
|
var target = $('#onDemandVerifyResult'); |
|
47
|
|
|
var url = 'index.php'; |
|
48
|
|
|
var pars = 'action=ajax&ajax=onDemandURL&id=' + id + '&artlang=' + lang + '&lookup=1'; |
|
49
|
|
|
var myAjax = new jQuery.ajax({url: url, |
|
50
|
|
|
type: 'get', |
|
51
|
|
|
data: pars, |
|
52
|
|
|
complete: ajaxOnDemandVerify_success, |
|
53
|
|
|
error: ajaxOnDemandVerify_failure}); |
|
54
|
|
|
//TODO: Assign string |
|
55
|
|
|
target.innerHTML = 'Querying LinkVerifier...'; |
|
56
|
|
|
|
|
57
|
|
|
function ajaxOnDemandVerify_success(XmlRequest) |
|
58
|
|
|
{ |
|
59
|
|
|
target.html(XmlRequest.responseText); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
function ajaxOnDemandVerify_failure(XmlRequest) |
|
63
|
|
|
{ |
|
64
|
|
|
//TODO: Assign string |
|
65
|
|
|
target.html('LinkVerifier failed (url probe timed out?)'); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
ajaxOnDemandVerify(<?php echo $id ?>, '<?php echo $lang ?>'); |
|
70
|
|
|
|
|
71
|
|
|
</script> |
|
72
|
|
|
<?php |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|