CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-app.php

Summary

Maintainability
F
6 days
Test Coverage

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/>
Severity: Major
Found in Web.Admin/2014/wordpress/wp-app.php - About 2 days to fix

    AtomServer has 51 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class AtomServer {
    
        /**
         * ATOM content type.
         *
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-app.php - About 7 hrs to fix

      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'];
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-app.php - About 3 hrs to fix

      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();
      
      
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-app.php - About 2 hrs to fix

        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();
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-app.php - About 1 hr to fix

          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'))
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-app.php - About 1 hr to fix

            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.'));
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-app.php - About 1 hr to fix

              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'];
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-app.php - About 1 hr to fix

                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()); ?>
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-app.php - About 1 hr to fix

                  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);
                  
                  
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-app.php - About 1 hr to fix

                    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;
                    
                    
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-app.php - About 1 hr to fix

                      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' ) {
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-app.php - About 1 hr to fix

                        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.' ) );
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-app.php - About 1 hr to fix

                          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;
                          
                          
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/wp-app.php - About 1 hr to fix

                          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();
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/wp-app.php - About 1 hr to fix

                          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);
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/wp-app.php - About 1 hr to fix

                            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;
                                    }
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-app.php - About 55 mins to fix

                            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)) {
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-app.php - About 45 mins to fix

                            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
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-app.php - About 45 mins to fix

                            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();
                            
                            
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-app.php - About 35 mins to fix

                            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':
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-app.php - About 35 mins to fix

                            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);
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-app.php - About 35 mins to fix

                            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'))
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-app.php - About 25 mins to fix

                            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()); ?>
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-app.php - About 25 mins to fix

                            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.'));
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-app.php - About 25 mins to fix

                            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

                            There are no issues that match your filters.

                            Category
                            Status