2011-03-02 30 views
1

通過使用@usedby標記超鏈接不在文檔中。如何@usedby標記在phpdoc中工作

Class Content 
{ 
    /** 
    * simple db class variable 
    * @access public 
    */ 
    var $_db=null; // db 
    /** 
    * s3 class instance 
    */ 
    private $_s3=null; // s3 
    /** 
    * application variable array for creating instance of each object 
    * @var array 
    * @usedby Content::upload() this is compared 
    */ 
    public $application=array(
     'image'=>array(
       'createthumb'=>'createimagethumb' 
       ), 
     'audio'=>array(
       'createthumb'=>'createaudiothumb' 
       ), 
     'video'=>array(
       'createthumb'=>'createvideothumb' 
       ), 
     'link'=>array(
       'createthumb'=>'createlinkthumb' 
       ) 
     ); 
/** 
    * for uploading new content or you can say add new content :) 
    * 
    * @return json of new contents 
    **/ 
    function upload() 
    { 
     if ($_POST['gibname']=='' or $_POST['gibview']=='') { 
      $msg=createmessage(false, 'Please enter gibname and gib view where you want to place content'); 
     } 
     $maxFileSize = 100 * 1024 * 1024; // Max file size 100 MB 
     $thumb = $status =$imgWidth = $imgHeight = ''; 
     $headers = apache_request_headers();  // Get file size from Apache headers 
     $fileSize=(int)$headers['Content-Length']; 
     $fileType = (string)$headers['Content-Type']; // Get MIME type from Apache headers 
     $clientfileType = $fileType; 
     if (preg_match("/^multipart/", $fileType)) $fileType = $_FILES['qqfile']['type']; 
     if ($fileType=='application/octet-stream') $fileType="video/flv"; 
     if ($fileSize == 0) { 
      return array('success'=>false, 'error'=>"File is empty."); 
     }    
     if ($fileSize > $maxFileSize) { 
      return array('success'=>false, 'error'=>"File is too large."); 
     } 
     $pathinfo = pathinfo($_REQUEST['qqfile']);  // Put data of pathinfo() array into $pathinfo  
     $filename = $pathinfo['filename'];// Get file name - eg: myphoto 
     $ext = $pathinfo['extension'];  // Get extension - eg: .jpg 
     if ($ext=='') $ext=substr(strrchr($_FILES['qqfile']['name'], '.'), 1); 
     $originalName = $filename.'.'.$ext; 
     $randName = uniqid();    // Generate unique id for the current object 
     $fileTempName = $randName . '.' . $ext; // Unique file name with extension 
     $fullTempName = "uploads/".$fileTempName;  // Set temp directory where files will be written temporarily  // Complete temp file name and path 
     if (!preg_match("/^multipart/", $clientfileType)) { // Upload the file to temp directory on .net server 
      $input = fopen("php://input", "r"); 
      $fp = fopen($fullTempName, "w"); 
      while ($data = fread($input, 1024)) { 
       fwrite($fp,$data); 
      } 
      fclose($fp); 
      fclose($input);   
     } else 
      move_uploaded_file($_FILES["qqfile"]["tmp_name"], $fullTempName); 
     $objecttype=mb_substr($fileType,0,-mb_strlen(strrchr($fileType,"/"))); 
     //for uploading of link url is neccesssary 
     if ($_POST['url']!='' or $_POST['refername']!='') { 
      $objecttype="link"; 
      $url=$_POST['url']; 
      $filename=$_POST['filename']; 
     } else { 
      $url=CLOUDFRONT.$fileTempName; 
      $filename=$fileTempName; 
     } 
     if (class_exists($objecttype) && $_POST['refername']=='') { 
      $object=new $objecttype(); 
      $str=$this->application[$objecttype]['createthumb']; 
      $thumb=$object->{$str}($fullTempName,$fileType); 
      $thumbnail=$thumb['thumb']; 
      $preview=$thumb['preview']; 
      $imgWidth=$object->imagewidth; 
      $imgHeight=$object->imageheight; 
      $resize=$object->resize; 
     } 
} 

雖然@usedby不是警告即將告訴未知標籤。 phpdocumentor版本是1.4.3 它爲什麼說未知標籤。

回答

3

「@usedby」標記是而不是 phpDocumentor在您的docblocks中查找的代碼文檔標記。有一個「@uses」標籤,指出「此特定元素使用了我在此標籤中列出的那個」。 phpDocumentor會看到這個標籤,在元素的文檔上顯示這個標籤,並鏈接到其他元素,將@usedby標籤放在該元素的文檔中。

總之,你把@uses在ThisElement的文檔塊指向從ThisElement到ThatElement,並phpDocumentor的會把@usedby ThatElement的文檔中,從ThatElement重新指向ThisElement。