@usedby 标签在 phpdoc 中如何工作

发布于 2024-10-20 02:16:18 字数 4094 浏览 8 评论 0原文

通过使用 @usedby 标签,超链接不会出现在文档中。

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 为什么它说未知标签。

By using @usedby tag hyperlink is not coming in documentation.

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;
        }
}

While @usedby is not the warning is coming telling unknown tag .
phpdocumentor version is 1.4.3
why it is saying the unknown tag .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傻比既视感 2024-10-27 02:16:18

“@usedby”标签不是 phpDocumentor 在您的文档块中查找的代码文档标签。有一个“@uses”标签,表示“这个特定元素使用我在此标签中列出的元素”。 phpDocumentor 将看到此标记,在元素的文档上显示此标记,建立指向其他元素的链接,在该其他元素的文档中放置 @usedby 标记。

简而言之,您将 @uses 放入 ThisElement 的文档块中,以从 ThisElement 指向 ThatElement,并且 phpDocumentor 会将 @usedby 放入 ThatElement 的文档中,以从 ThatElement 指向 ThisElement。

The "@usedby" tag is not a code documentation tag that phpDocumentor looks for in your docblocks. There is a "@uses" tag that says "this particular element uses the one I'm listing in this tag". phpDocumentor will see this tag, show this tag on the element's doc, make a link to the other element, and put a @usedby tag in the documentation for that other element.

In short, you put @uses in ThisElement's docblock to point from ThisElement to ThatElement, and phpDocumentor will put @usedby in ThatElement's documentation to point from ThatElement back to ThisElement.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文