CBlogPost :: GetID: Bitrix method

      
<?php 
//  CBlogPost :: GetID()
//  /dist/bitrix/modules/blog/general/blog_post.php:1077

    
public static function GetID($code$blogID)
    {
        
$postID false;
        
$blogID IntVal($blogID);

        
$code preg_replace("/[^a-zA-Z0-9_-]/is"""Trim($code));
        if(
strlen($code) <= || IntVal($blogID) <= 0)
            return 
false;

        if (
            !empty(static::
$arBlogPostIdCache[$blogID."_".$code])
            && 
IntVal(static::$arBlogPostIdCache[$blogID."_".$code]) > 0)
        {
            return static::
$arBlogPostIdCache[$blogID."_".$code];
        }
        else
        {
            
$arFilter = Array("CODE" => $code);
            if(
IntVal($blogID) > 0)
                
$arFilter["BLOG_ID"] = $blogID;
            
$dbPost CBlogPost::GetList(Array(), $arFilterfalse, Array("nTopCount" => 1), Array("ID"));
            if(
$arPost $dbPost->Fetch())
            {
                static::
$arBlogPostIdCache[$blogID."_".$code] = $arPost["ID"];
                
$postID $arPost["ID"];
            }
        }

        return 
$postID;
    }