Minor cleanup and formatting changes
This commit is contained in:
parent
0af94b5609
commit
949842cee6
|
|
@ -19,10 +19,11 @@ if ( !class_exists('Puc_v4p9_Factory', false) ):
|
|||
protected static $latestCompatibleVersion = '';
|
||||
|
||||
/**
|
||||
* Wrapper method for buildUpdateChecker.
|
||||
* A wrapper method for buildUpdateChecker() that reads the metadata URL from the plugin or theme header.
|
||||
*
|
||||
* @param string $fullPath
|
||||
* @param array
|
||||
* @param string $fullPath Full path to the main plugin file or the theme's style.css.
|
||||
* @param array $args Optional arguments. Keys should match the argument names of the buildUpdateChecker() method.
|
||||
* @return Puc_v4p9_Plugin_UpdateChecker|Puc_v4p9_Theme_UpdateChecker|Puc_v4p9_Vcs_BaseChecker
|
||||
*/
|
||||
public static function buildFromHeader($fullPath, $args = array()) {
|
||||
$fullPath = self::normalizePath($fullPath);
|
||||
|
|
@ -43,6 +44,7 @@ if ( !class_exists('Puc_v4p9_Factory', false) ):
|
|||
$metadataUrl = self::getServiceURI($fullPath);
|
||||
}
|
||||
|
||||
/** @noinspection PhpUndefinedVariableInspection These variables are created by extract(), above. */
|
||||
return self::buildUpdateChecker($metadataUrl, $fullPath, $slug, $checkPeriod, $optionName, $muPluginFile);
|
||||
}
|
||||
|
||||
|
|
@ -218,22 +220,20 @@ if ( !class_exists('Puc_v4p9_Factory', false) ):
|
|||
$seek = array(
|
||||
'github' => 'GitHub URI',
|
||||
'gitlab' => 'GitLab URI',
|
||||
'bucket' => 'BitBucket URI'
|
||||
'bucket' => 'BitBucket URI',
|
||||
);
|
||||
$seek = apply_filters('puc_get_source_uri', $seek);
|
||||
$data = get_file_data($fullPath, $seek);
|
||||
foreach ($data as $key => $uri) {
|
||||
if ( $uri ) return $uri;
|
||||
if ( $uri ) {
|
||||
return $uri;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//URI was not found so trigger an error.
|
||||
trigger_error(
|
||||
sprintf(
|
||||
'Unable to locate uri in header of "%s"',
|
||||
htmlentities( $fullPath )
|
||||
),
|
||||
E_USER_ERROR
|
||||
//URI was not found so throw an error.
|
||||
throw new RuntimeException(
|
||||
sprintf('Unable to locate URI in header of "%s"', htmlentities($fullPath))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue