Skip to content

Commit

Permalink
Miscellaneous code cleanup.
Browse files Browse the repository at this point in the history
git-svn-id: https://plugins.svn.wordpress.org/broken-link-checker/trunk@636579 b8457f37-d9ea-0310-8a92-e5e31aec5664
  • Loading branch information
whiteshadow committed Dec 10, 2012
1 parent ff9f30c commit 9f8b28b
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions includes/any-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ function delete_wrapped_object(){
$this->container_id
)
);
};
}
}
}

Expand Down Expand Up @@ -605,7 +605,7 @@ function trash_wrapped_object(){
$this->container_id
)
);
};
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion includes/checkers.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class blcChecker extends blcModule {
* Check if this checker knows how to check a particular URL.
*
* @param string $url
* @param array|false $parsed_url The result of parsing $url with parse_url(). See PHP docs for details.
* @param array|bool $parsed_url The result of parsing $url with parse_url(). See PHP docs for details.
* @return bool
*/
function can_check($url, $parsed_url){
Expand Down
12 changes: 7 additions & 5 deletions includes/instances.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class blcLinkInstance {

var $_container = null;
var $_parser = null;
/** @var blcLink|null */
var $_link = null;

/**
Expand All @@ -37,7 +38,8 @@ class blcLinkInstance {
* @return void
*/
function __construct($arg = null){

global $wpdb; /** @var wpdb $wpdb */

if (is_int($arg)){
//Load an instance with ID = $arg from the DB.
$q = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}blc_instances WHERE instance_id=%d LIMIT 1", $arg);
Expand Down Expand Up @@ -183,7 +185,7 @@ function unlink( $url = null ) {
* @return mixed 1 on success, 0 if the instance wasn't found, false on error
*/
function forget(){
global $wpdb;
global $wpdb; /** @var wpdb $wpdb */

if ( !empty($this->instance_id) ) {
$rez = $wpdb->query( $wpdb->prepare("DELETE FROM {$wpdb->prefix}blc_instances WHERE instance_id=%d", $this->instance_id) );
Expand All @@ -200,7 +202,7 @@ function forget(){
* @return bool TRUE on success, FALSE on error
*/
function save(){
global $wpdb;
global $wpdb; /** @var wpdb $wpdb */

//Refresh the locally cached link & container properties, in case
//the objects have changed since they were set.
Expand Down Expand Up @@ -477,10 +479,10 @@ function ui_get_source($context = 'display'){
* @param bool $load_containers Preload containers regardless of purpose. Defaults to false.
* @param bool $load_wrapped_objects Preload wrapped objects regardless of purpose. Defaults to false.
* @param bool $include_invalid Include instances that refer to not-loaded containers or parsers. Defaults to false.
* @return array An array indexed by link ID. Each item of the array will be an array of blcLinkInstance objects.
* @return blcLinkInstance[] An array indexed by link ID. Each item of the array will be an array of blcLinkInstance objects.
*/
function blc_get_instances( $link_ids, $purpose = '', $load_containers = false, $load_wrapped_objects = false, $include_invalid = false ){
global $wpdb;
global $wpdb; /** @var wpdb $wpdb */

if ( empty($link_ids) ){
return array();
Expand Down
4 changes: 2 additions & 2 deletions includes/links.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ function save(){
* @return array
*/
function to_db_format($values){
global $wpdb;
global $wpdb; /** @var wpdb $wpdb */

$dbvalues = array();

Expand Down Expand Up @@ -614,7 +614,7 @@ function edit($new_url){
__('Failed to create a DB entry for the new URL.', 'broken-link-checker')
)
)
);;
);
}

$cnt_okay = $cnt_error = 0;
Expand Down
2 changes: 1 addition & 1 deletion js/jquery.cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @param {String} name The name of the cookie.
* @return The value of the cookie.
* @type String
*
Expand Down
4 changes: 2 additions & 2 deletions modules/parsers/html_link.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function parse($content, $base_url = '', $default_link_text = ''){
'base_url' => $base_url,
'default_link_text' => $default_link_text,
);
$instances = $this->map($content, array(&$this, 'parser_callback'), $params);
$instances = $this->map($content, array($this, 'parser_callback'), $params);

//The parser callback returns NULL when it finds an invalid link. Filter out those nulls
//from the list of instances.
Expand All @@ -56,7 +56,7 @@ function parse($content, $base_url = '', $default_link_text = ''){
* @return blcLinkInstance|null
*/
function parser_callback($link, $params){
extract($params);
$base_url = $params['base_url'];

$url = $raw_url = $link['href'];
$url = trim($url);
Expand Down
5 changes: 5 additions & 0 deletions modules/parsers/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ class blcHTMLImage extends blcParser {

// \1 \2 \3 URL \4
var $img_pattern = '/(<img[\s]+[^>]*src\s*=\s*)([\"\'])([^>]+?)\2([^<>]*>)/i';

/** @var string Used in link editing callbacks. */
private $old_url = '';
/** @var string */
private $new_url = '';

/**
* Parse a string for HTML images - <img src="URL">
Expand Down
1 change: 1 addition & 0 deletions modules/parsers/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ function edit($content, $new_url, $old_url, $old_raw_url){
* Get the link text for printing in the "Broken Links" table.
*
* @param blcLinkInstance $instance
* @param string $context
* @return string HTML
*/
function ui_get_link_text($instance, $context = 'display'){
Expand Down

0 comments on commit 9f8b28b

Please sign in to comment.