Forum Replies Created

Viewing 15 replies - 61 through 75 (of 111 total)
  • Thread Starter aenea

    (@aenea)

    Hi Yannick,

    I note you have flagged this thread as resolved, however, the inclusion of the category name in the email is still not working for me. (I have upgraded to 5.9.12.5)

    Are you looking into that?

    And, though not urgent, it would be nice to have some response to my suggestions 3, 4 & 5 to let me know whether you may be able to implement them.

    Thanks.

    Thread Starter aenea

    (@aenea)

    Can I make a couple more (non-urgent) requests?

    3. In the email that gets sent to the administrator, could you include only those fields that are not blank? (i.e. only the fields that the user has filled in.)

    There are several fields we don’t use, so having all these fields appear in the email with no content makes the email a bit cluttered. Perhaps this could/should be an option in the settings, in case other administrators want these fields to be included in the email even if they are blank.

    And, regarding the emails that get sent to the submitter:

    4. In the email that gets sent to the submitter when he/she fills in the link suggestion form, could you add in a copy of the details he/she submitted or, at the least, the link they submitted? Some of our users may well submit several link suggestions and having a record of these in their email would help, should they need to make any follow-up queries.

    5. In the email that gets sent to the submitter when their link is approved or rejected, would it be possible to include the link that has been approved/rejected? In the case where someone has submitted more than one link, this would tell them which link this email refers to.

    Thread Starter aenea

    (@aenea)

    Gosh that was quick! Thanks.

    Tried it out and the hyperlink works but the category name is not appearing in the email. Instead, the category ID is now included in brackets,e.g.
    Link Category: ( 67 )

    .lladdlink .form-error {
    <your rules here>
    }

    Works a treat thanks.

    Ah! Think I’ve found it – class= ‘form-error’. When I add this class to the customised Link Library spreadsheet I can change the font color to red.

    Am I correct that this will effect the Link Library forms only?

    Hi Yannick,

    I really appreciate your improvement to the category selection, forcing the submitter to make a selection. Our new Useful Links page just went live on Saturday and already we’ve had one submission without a category selection, so your update will put a stop to that.

    Now, if I could just work out how to display the ‘Required field’ label in red . . . any suggestions for that?

    Thread Starter aenea

    (@aenea)

    Alas, no. The developer has not responded.

    Thread Starter aenea

    (@aenea)

    Yes, using sanitize_text_field is a good idea. Thanks.

    Thread Starter aenea

    (@aenea)

    You’re right, probably best not to use CURL in your code. But might it be possible to provide a hook so that I could include my customised version of ReciprocalLinkChecker in my functions.php so as to avoid having to hack your code every time you release an update?

    I would also recommend returning the more detailed http codes and their meanings, so that the administrator can be alerted to sites that have moved and can distinguish between a link that has timed out and one that really doesn’t exist.

    Here are the changes I have made to ReciprocalLinkChecker.

    Replaced line 381 with the following:
    $reciprocal_result=ajr_check_url($link->link_url);
    and, at line 386, I have added in the following:

    // AJR start insert
    				  if ($check_type == 'broken') {
    				  	if (substr($reciprocal_result,0,3) == '200' ) {
    						echo '<span style="color: #00FF00">' . __( 'OK', 'link-library' ) . '</span><br />';
    					} else {
    						echo '<span style="color: #FF0000">' . __( 'Error '.$reciprocal_result, 'link-library' ) . '</span><br />';
    					}
    				  } else { // AJR end insert

    And here is the code for my CURL based link checker:

    // function ajr_check_url    to check if URL is OK	---------------
    	function ajr_check_url($url) {
    
    	    $ch = curl_init();
        	curl_setopt($ch, CURLOPT_URL, $url);
    	    curl_setopt($ch, CURLOPT_HEADER, 1);
        	curl_setopt($ch , CURLOPT_RETURNTRANSFER, 1);
    		curl_setopt($ch,CURLOPT_TIMEOUT,4);
     		$result = curl_exec($ch);
    		if( !$result) {
    			$code=-1;
    			$text=curl_error($ch);
    		} else {
    			$code=curl_getinfo($ch, CURLINFO_HTTP_CODE);
       		}
    	    curl_close($ch);
    		if ($code > 0) {
    			$text=ajr_get_http_status($code);
    		}
        	return $code.": ".$text;
    	}
    // end functiom ajr_check_url ----------------------------------------
    
    // ajr_get_http_status  -----------------------------------------------
    
    function ajr_get_http_status($code) {
    	 switch ($code) {
                        case 100: $text = 'Continue'; break;
                        case 101: $text = 'Switching Protocols'; break;
                        case 200: $text = 'OK'; break;
                        case 201: $text = 'Created'; break;
                        case 202: $text = 'Accepted'; break;
                        case 203: $text = 'Non-Authoritative Information'; break;
                        case 204: $text = 'No Content'; break;
                        case 205: $text = 'Reset Content'; break;
                        case 206: $text = 'Partial Content'; break;
                        case 300: $text = 'Multiple Choices'; break;
                        case 301: $text = 'Moved Permanently'; break;
                        case 302: $text = 'Moved Temporarily'; break;
                        case 303: $text = 'See Other'; break;
                        case 304: $text = 'Not Modified'; break;
                        case 305: $text = 'Use Proxy'; break;
                        case 400: $text = 'Bad Request'; break;
                        case 401: $text = 'Unauthorized'; break;
                        case 402: $text = 'Payment Required'; break;
                        case 403: $text = 'Forbidden'; break;
                        case 404: $text = 'Not Found'; break;
                        case 405: $text = 'Method Not Allowed'; break;
                        case 406: $text = 'Not Acceptable'; break;
                        case 407: $text = 'Proxy Authentication Required'; break;
                        case 408: $text = 'Request Time-out'; break;
                        case 409: $text = 'Conflict'; break;
                        case 410: $text = 'Gone'; break;
                        case 411: $text = 'Length Required'; break;
                        case 412: $text = 'Precondition Failed'; break;
                        case 413: $text = 'Request Entity Too Large'; break;
                        case 414: $text = 'Request-URI Too Large'; break;
                        case 415: $text = 'Unsupported Media Type'; break;
                        case 500: $text = 'Internal Server Error'; break;
                        case 501: $text = 'Not Implemented'; break;
                        case 502: $text = 'Bad Gateway'; break;
                        case 503: $text = 'Service Unavailable'; break;
                        case 504: $text = 'Gateway Time-out'; break;
                        case 505: $text = 'HTTP Version not supported'; break;
                        default:
    						$text='Unknown http status code';
                            //exit('Unknown http status code "' . htmlentities($code) . '"');
                        break;
    		}
        return $text;
    }
    // end ajr_get_http_status  -----------------------------------
    Thread Starter aenea

    (@aenea)

    Thanks for the suggestions.

    Your first option didn’t help. The second did but, as I increased the timeout I started getting the Internal Server errors again.

    As I investigated things further, it became apparent that your analysis of the response codes from wp_remote_get isn’t sufficient for my purposes. Some of the links that were passing your checks as OK, were actually returning codes 301 (Moved permanently) or 302 (Moved temporarily) both of which require further investigation on my part.
    One of the code 301 sites was actually re-directing to a page that said ‘This web site has been closed’, one of the code 302 sites was re-directing to the wrong page and others were re-directing correctly but, having this information, enables me to update the link to the new URL.

    Also, when the wp_remote_get timed out, your code returned error 403, rather than the fact that it had timed out.

    So, in file link-library-admin.php, when the ReciprocalLinkChecker function is called with $check_type = ‘broken’, I have replaced your call to the CheckReciprocalLink function with a call to a custom function of my own (using curl_exec and curl_getinfo and a CURLOPT_TIMEOUT to prevent Internal Server error when accessing a link takes too long). This function returns both the HTTP code and its meaning and, whenever the code is not equal to 200, I output both code and meaning in the Broken Link Checker Report. This more detailed report alerts me to all the links that need to be checked and then removed or updated.

    So far, this seems to be working well for me. Should you wish, I can provide you with the code of my function and details of the edits I have made to the ReciprocalLinkChecker function.

    Thread Starter aenea

    (@aenea)

    Oops, got one of the links above wrong.
    Should be:
    https://www.theinterpretershouse.com/submissions

    Thread Starter aenea

    (@aenea)

    Not sure if there’s anything further you can do on this but, just in case.

    Three of my links failed the broken link check, two with an Error 403 and the third ‘Website Unreachable’. All three links are valid links, however. I suspect this might be the checker timing out before the web site has responded. Here are the links that failed:

    https://www.scottishreviewofbooks.org/
    https://www.theinterpretershouse.com/submissions
    https://www.shanestrachan.com/

    The first two are the Error 403 ones and the third is the unreachable one.

    If there’s not an easy answer to this, don’t bother with it. I will always do a double check on any links that fail the broken link checker.

    Thread Starter aenea

    (@aenea)

    Success! Many thanks.

    Thread Starter aenea

    (@aenea)

    Yes. Happy to give that a try tomorrow evening. I haven’t used github before but I’m sure I can manage.

    Thread Starter aenea

    (@aenea)

    Alas! I still get the same error.
    No output appears before the error message.
    I guess it’s difficult for you to pin down the problem unless you can reproduce the fault. If you tell me which source file(s) to look into I could attempt some debugging at my end.

Viewing 15 replies - 61 through 75 (of 111 total)