original_string: function _processCollectedTags($source)
          {
              $to_replace = array();
              $ordered = array();
              foreach(self::$tag_collections as $tag_name=>$tags)
              {
  //              if this block has a collection order use it
                  if(isset(self::$_tag_order[$tag_name]) === true)
                  {
                      $pos = self::$_tag_order[$tag_name];
                      $ordered[$pos] = $tags;
                      continue;
                  }
  //              the source should be modified by the collection script
                  $tag_func_name = ucwords(str_replace(array('_', '-'), ' ', $tag_name));
                  $tag_func_name = strtolower(substr($tag_func_name, 0, 1)).substr($tag_func_name, 1);
                  $tag_func_name = str_replace(' ', '', $this->_options['tag_callback_prefix'].$tag_func_name);
                  if($this->_options['tag_global_callback'] !== false)
                  {
                      $tags = call_user_func($this->_options['tag_global_callback'], 'collection', $tag_func_name, $tags, $source);
                  }
                  else
                  {
                      $tags = call_user_func($tag_func_name, $tags, $source);
                  }
                  
                  if($tags === -1)
                  {
                      $source = self::throwError($tag_name, 'tag collection parsed however callback "'.$tag_func_name.'" returned -1.');
                  }
                  else if(is_array($tags) === false)
                  {
                      $source = self::throwError($tag_name, 'tag collection parsed however callback "'.$tag_func_name.'" did not return the array of process tags.');
                  }
                  else if(count($tags) > 0)
                  {
  //                  input the parsed tags back into the source or store for re-intergration
                      foreach ($tags as $key => $tag)
                      {
                          if(strpos($source, $tag['tag']) !== false)
                          {
                              $source = str_replace($tag['tag'], $tag['parsed'], $source);
                          }
                          else
                          {
  //                          do a reverse tag lookup here as the tag was not found in the source, thus it must be buried and un processed
                              array_push($to_replace, $tag);
                          }
                      }
                  }
              }
              foreach($ordered as $key=>$tags)
              {
  //              the source should be modified by the collection script
                  $tag_func_name = ucwords(str_replace(array('_', '-'), ' ', $tag_name));
                  $tag_func_name = strtolower(substr($tag_func_name, 0, 1)).substr($tag_func_name, 1);
                  $tag_func_name = str_replace(' ', '', $this->_options['tag_callback_prefix'].$tag_func_name);
                  $tags = call_user_func($tag_func_name, $tags);
                  if($tags === -1)
                  {
                      $source = self::throwError($tag['name'], 'tag collection parsed however callback "'.$tag_func_name.'" returned -1.');
                  }
              }
              return $this->_doBuriedReplacements($to_replace, $source);
          }
code: function _processCollectedTags($source)
          {
              $to_replace = array();
              $ordered = array();
              foreach(self::$tag_collections as $tag_name=>$tags)
              {
  //              if this block has a collection order use it
                  if(isset(self::$_tag_order[$tag_name]) === true)
                  {
                      $pos = self::$_tag_order[$tag_name];
                      $ordered[$pos] = $tags;
                      continue;
                  }
  //              the source should be modified by the collection script
                  $tag_func_name = ucwords(str_replace(array('_', '-'), ' ', $tag_name));
                  $tag_func_name = strtolower(substr($tag_func_name, 0, 1)).substr($tag_func_name, 1);
                  $tag_func_name = str_replace(' ', '', $this->_options['tag_callback_prefix'].$tag_func_name);
                  if($this->_options['tag_global_callback'] !== false)
                  {
                      $tags = call_user_func($this->_options['tag_global_callback'], 'collection', $tag_func_name, $tags, $source);
                  }
                  else
                  {
                      $tags = call_user_func($tag_func_name, $tags, $source);
                  }
                  
                  if($tags === -1)
                  {
                      $source = self::throwError($tag_name, 'tag collection parsed however callback "'.$tag_func_name.'" returned -1.');
                  }
                  else if(is_array($tags) === false)
                  {
                      $source = self::throwError($tag_name, 'tag collection parsed however callback "'.$tag_func_name.'" did not return the array of process tags.');
                  }
                  else if(count($tags) > 0)
                  {
  //                  input the parsed tags back into the source or store for re-intergration
                      foreach ($tags as $key => $tag)
                      {
                          if(strpos($source, $tag['tag']) !== false)
                          {
                              $source = str_replace($tag['tag'], $tag['parsed'], $source);
                          }
                          else
                          {
  //                          do a reverse tag lookup here as the tag was not found in the source, thus it must be buried and un processed
                              array_push($to_replace, $tag);
                          }
                      }
                  }
              }
              foreach($ordered as $key=>$tags)
              {
  //              the source should be modified by the collection script
                  $tag_func_name = ucwords(str_replace(array('_', '-'), ' ', $tag_name));
                  $tag_func_name = strtolower(substr($tag_func_name, 0, 1)).substr($tag_func_name, 1);
                  $tag_func_name = str_replace(' ', '', $this->_options['tag_callback_prefix'].$tag_func_name);
                  $tags = call_user_func($tag_func_name, $tags);
                  if($tags === -1)
                  {
                      $source = self::throwError($tag['name'], 'tag collection parsed however callback "'.$tag_func_name.'" returned -1.');
                  }
              }
              return $this->_doBuriedReplacements($to_replace, $source);
          }
code_tokens: function _processCollectedTags ( $ source ) { $ to_replace = array ( ) ; $ ordered = array ( ) ; foreach ( self :: $ tag_collections as $ tag_name => $ tags ) { //              if this block has a collection order use it if ( isset ( self :: $ _tag_order [ $ tag_name ] ) === true ) { $ pos = self :: $ _tag_order [ $ tag_name ] ; $ ordered [ $ pos ] = $ tags ; continue ; } //              the source should be modified by the collection script $ tag_func_name = ucwords ( str_replace ( array ( '_' , '-' ) , ' ' , $ tag_name ) ) ; $ tag_func_name = strtolower ( substr ( $ tag_func_name , 0 , 1 ) ) . substr ( $ tag_func_name , 1 ) ; $ tag_func_name = str_replace ( ' ' , '' , $ this -> _options [ 'tag_callback_prefix' ] . $ tag_func_name ) ; if ( $ this -> _options [ 'tag_global_callback' ] !== false ) { $ tags = call_user_func ( $ this -> _options [ 'tag_global_callback' ] , 'collection' , $ tag_func_name , $ tags , $ source ) ; } else { $ tags = call_user_func ( $ tag_func_name , $ tags , $ source ) ; } if ( $ tags === - 1 ) { $ source = self :: throwError ( $ tag_name , 'tag collection parsed however callback "' . $ tag_func_name . '" returned -1.' ) ; } else if ( is_array ( $ tags ) === false ) { $ source = self :: throwError ( $ tag_name , 'tag collection parsed however callback "' . $ tag_func_name . '" did not return the array of process tags.' ) ; } else if ( count ( $ tags ) > 0 ) { //                  input the parsed tags back into the source or store for re-intergration foreach ( $ tags as $ key => $ tag ) { if ( strpos ( $ source , $ tag [ 'tag' ] ) !== false ) { $ source = str_replace ( $ tag [ 'tag' ] , $ tag [ 'parsed' ] , $ source ) ; } else { //                          do a reverse tag lookup here as the tag was not found in the source, thus it must be buried and un processed array_push ( $ to_replace , $ tag ) ; } } } } foreach ( $ ordered as $ key => $ tags ) { //              the source should be modified by the collection script $ tag_func_name = ucwords ( str_replace ( array ( '_' , '-' ) , ' ' , $ tag_name ) ) ; $ tag_func_name = strtolower ( substr ( $ tag_func_name , 0 , 1 ) ) . substr ( $ tag_func_name , 1 ) ; $ tag_func_name = str_replace ( ' ' , '' , $ this -> _options [ 'tag_callback_prefix' ] . $ tag_func_name ) ; $ tags = call_user_func ( $ tag_func_name , $ tags ) ; if ( $ tags === - 1 ) { $ source = self :: throwError ( $ tag [ 'name' ] , 'tag collection parsed however callback "' . $ tag_func_name . '" returned -1.' ) ; } } return $ this -> _doBuriedReplacements ( $ to_replace , $ source ) ; }
docstring: Process collected blocks. These are different types of block that are required to be processed as a group.
  Usual reasons for doing this are to reduce resources and sql queries.
  
  @param string $source The source of the output.
  @return string
docstring_tokens: Process collected blocks . These are different types of block that are required to be processed as a group . Usual reasons for doing this are to reduce resources and sql queries .