original_string: private function has_add_block_capability($page, $capability) {
          // Check if the capability exists.
          if (!get_capability_info($capability)) {
              // Debug warning that the capability does not exist, but no more than once per page.
              static $warned = array();
              if (!isset($warned[$this->name()])) {
                  debugging('The block ' .$this->name() . ' does not define the standard capability ' .
                          $capability , DEBUG_DEVELOPER);
                  $warned[$this->name()] = 1;
              }
              // If the capability does not exist, the block can always be added.
              return true;
          } else {
              return has_capability($capability, $page->context);
          }
      }
code: private function has_add_block_capability($page, $capability) {
          // Check if the capability exists.
          if (!get_capability_info($capability)) {
              // Debug warning that the capability does not exist, but no more than once per page.
              static $warned = array();
              if (!isset($warned[$this->name()])) {
                  debugging('The block ' .$this->name() . ' does not define the standard capability ' .
                          $capability , DEBUG_DEVELOPER);
                  $warned[$this->name()] = 1;
              }
              // If the capability does not exist, the block can always be added.
              return true;
          } else {
              return has_capability($capability, $page->context);
          }
      }
code_tokens: private function has_add_block_capability ( $ page , $ capability ) { // Check if the capability exists. if ( ! get_capability_info ( $ capability ) ) { // Debug warning that the capability does not exist, but no more than once per page. static $ warned = array ( ) ; if ( ! isset ( $ warned [ $ this -> name ( ) ] ) ) { debugging ( 'The block ' . $ this -> name ( ) . ' does not define the standard capability ' . $ capability , DEBUG_DEVELOPER ) ; $ warned [ $ this -> name ( ) ] = 1 ; } // If the capability does not exist, the block can always be added. return true ; } else { return has_capability ( $ capability , $ page -> context ) ; } }
docstring: Returns true if the user can add a block to a page.
  
  @param moodle_page $page
  @param string $capability the capability to check
  @return boolean true if user can add a block, false otherwise.
docstring_tokens: Returns true if the user can add a block to a page .