File wp-app.php
has 858 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Atom Publishing Protocol support for WordPress
*
* @author Original by Elias Torres <http://torrez.us/archives/2006/08/31/491/>
AtomServer
has 51 functions (exceeds 20 allowed). Consider refactoring. Open
class AtomServer {
/**
* ATOM content type.
*
Function handle_request
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function handle_request() {
global $always_authenticate;
if( !empty( $_SERVER['ORIG_PATH_INFO'] ) )
$path = $_SERVER['ORIG_PATH_INFO'];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method get_feed
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_feed($page = 1, $post_type = 'post') {
global $post, $wp, $wp_query, $posts, $wpdb, $blog_id;
log_app('function',"get_feed($page, '$post_type')");
ob_start();
Method create_post
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function create_post() {
global $blog_id, $user_ID;
$this->get_accepted_content_type($this->atom_content_types);
$parser = new AtomParser();
Method create_attachment
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function create_attachment() {
$type = $this->get_accepted_content_type();
if(!current_user_can('upload_files'))
Method put_file
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function put_file($postID) {
// first check if user can upload
if(!current_user_can('upload_files'))
$this->auth_required(__('You do not have permission to upload files.'));
Method handle_request
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handle_request() {
global $always_authenticate;
if( !empty( $_SERVER['ORIG_PATH_INFO'] ) )
$path = $_SERVER['ORIG_PATH_INFO'];
Method echo_entry
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function echo_entry() { ?>
<entry xmlns="<?php echo $this->ATOM_NS ?>"
xmlns:app="<?php echo $this->ATOMPUB_NS ?>" xml:lang="<?php echo get_option('rss_language'); ?>">
<id><?php the_guid($GLOBALS['post']->ID); ?></id>
<?php list($content_type, $content) = prep_atom_text_construct(get_the_title()); ?>
Method put_post
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function put_post($postID) {
// checked for valid content-types (atom+xml)
// quick check and exit
$this->get_accepted_content_type($this->atom_content_types);
Method process_conditionals
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function process_conditionals() {
if(empty($this->params)) return;
if($_SERVER['REQUEST_METHOD'] == 'DELETE') return;
Method AtomServer
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function AtomServer() {
$this->script_name = array_pop(explode('/',$_SERVER['SCRIPT_NAME']));
$this->app_base = get_bloginfo('url') . '/' . $this->script_name . '/';
if ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) {
Method get_service
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_service() {
log_app('function','get_service()');
if( !current_user_can( 'edit_posts' ) )
$this->auth_required( __( 'Sorry, you do not have the right to access this blog.' ) );
Function process_conditionals
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function process_conditionals() {
if(empty($this->params)) return;
if($_SERVER['REQUEST_METHOD'] == 'DELETE') return;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function create_post
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function create_post() {
global $blog_id, $user_ID;
$this->get_accepted_content_type($this->atom_content_types);
$parser = new AtomParser();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method get_file
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_file($postID) {
// check for not found
global $entry;
$this->set_current_entry($postID);
Function get_accepted_content_type
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function get_accepted_content_type($types = null) {
if(!isset($types)) {
$types = $this->media_content_types;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function escape
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function escape(&$array) {
global $wpdb;
foreach ($array as $k => $v) {
if (is_array($v)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function authenticate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function authenticate() {
log_app("authenticate()",print_r($_ENV, true));
// if using mod_rewrite/ENV hack
// http://www.besthostratings.com/articles/http-auth-php-cgi.html
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_feed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function get_feed($page = 1, $post_type = 'post') {
global $post, $wp, $wp_query, $posts, $wpdb, $blog_id;
log_app('function',"get_feed($page, '$post_type')");
ob_start();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_entry
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function get_entry($postID, $post_type = 'post') {
log_app('function',"get_entry($postID, '$post_type')");
ob_start();
switch($post_type) {
case 'post':
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function get_file($postID) {
// check for not found
global $entry;
$this->set_current_entry($postID);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function create_attachment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function create_attachment() {
$type = $this->get_accepted_content_type();
if(!current_user_can('upload_files'))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function echo_entry
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function echo_entry() { ?>
<entry xmlns="<?php echo $this->ATOM_NS ?>"
xmlns:app="<?php echo $this->ATOMPUB_NS ?>" xml:lang="<?php echo get_option('rss_language'); ?>">
<id><?php the_guid($GLOBALS['post']->ID); ?></id>
<?php list($content_type, $content) = prep_atom_text_construct(get_the_title()); ?>
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function put_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function put_file($postID) {
// first check if user can upload
if(!current_user_can('upload_files'))
$this->auth_required(__('You do not have permission to upload files.'));
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"