Check that the post ID exists

@param int
174485
protected function check_object_id( $object_id ) {
		$fetcher = new PostFetcher();
		$post    = $fetcher->get_check( $object_id );
		return $post->ID;
	}
1290998
public function getPost($post_id)
    {
        $this->checkId($post_id);

        return $this->adapter->get(sprintf('/post/%d', $post_id));
    }
1260360
public static function isPageForPostType($postId)
    {
        $postType = get_post_type($postId);
        $option = get_option('page_for_' . $postType);
        $pageContent = get_option('page_for_' . $postType . '_content');

        if ($option && $option === $postId && !$pageContent) {
            return $postType;
        }
        return false;
    }
226555
public function save( $post_id ) 
    {
        /**
         * A note on security:
         * 
         * We need to verify this came from the our screen and with proper authorization,
         * because save_post can be triggered at other times. since metaboxes can 
         * be removed - by having a nonce field in only one metabox there is no 
         * guarantee the nonce will be there. By placing a nonce field in each 
         * metabox you can check if data from that metabox has been sent 
         * (and is actually from where you think it is) prior to processing any data.
         * @see http://wordpress.stackexchange.com/a/49460/25959
         */
        
        // Check if our nonce is set.
        if ( ! isset( $_POST[$this->nonce_name()] ) )
        {
            return $post_id;
        }

        // Verify that the nonce is valid.
        $nonce = filter_input( INPUT_POST, $this->nonce_name() );
        if ( ! wp_verify_nonce( $nonce, $this->action_name() ) )
        {
            return $post_id;
        }
        
        // Bail if this is an autosave (nothing has been submitted)
        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
        {
            return $post_id;
        }
        
        // Check the user's permissions.
        $post_type = filter_input( INPUT_POST, 'post_type' );
        if( in_array( $post_type, $this->settings['post_types'] ) )
        {
            // NOTE: this might not work for custom post types, unless Amarkal
            // is used to register them (custom post types might have labels different 
            // than 'edit_{post_type}'
            $capability = 'edit_'.$post_type;
            if ( !current_user_can( $capability, $post_id ) )
            {
                return $post_id;
            }
        }
        else
        {
            return $post_id;
        }

        // OK, it is safe to process data.
        $old_instance = \get_post_meta( $post_id, $this->settings['id'], true );
        $new_instance = $this->form->updater->update( $old_instance === "" ? array() : $old_instance );
        \update_post_meta( $post_id, $this->settings['id'], $new_instance );
        
        // Callback
        $callable = $this->settings['callback'];
        if(is_callable( $callable ) )
        {
            $callable( $post_id, $new_instance );
        }
    }
257826
static public function exists($params)
    {
        $query = self::none();
        
        if (ctype_digit((string)$params)) {
            $query->where(['id' => $params]);
        } else {
            if (is_array($params))
                $query->where('id IN (?)', $params);
            else
                $query->where('id IN (?)', func_get_args());
        }
        
        return $query->exists();
    }
220958
public function save ($post_ID)
    {
        if (!$this->doSave())
            return;
        if ($post_ID === self::SITE)
            update_option($this->identifier, $this->getPostValue());
        else
            update_post_meta($post_ID, $this->identifier, $this->getPostValue());
    }
1273590
protected function _deleteObject( $post_id ) {
		$post = get_post( $post_id );
		if ( ! $post ) {
			return false;
		}

		$deleted = wp_delete_post( $post_id, true );
		if ( $deleted ) {
			$this->_debug( 'Deleted post with ID: ' . $post_id );
			return true;
		}

		$this->_debug( 'Post removal failed for ID: ' . $post_id );
		return false;
	}
997624
public boolean check(int id) {
    for (Tag tag: getTags()) {
      if (tag.getID() == id)
	return true;
    }
    return false;
  }
65778
def id_exists(api, search_id):
    
    response = utils.checked_api_call(api, 'get_specific', id=search_id)
    return response is not None
931704
public function metaboxSave($value, int $post_id)
    {
        $this->setValue($value);

        $previous = get_post_meta($post_id, $this->getName(), false);

        if (is_null($value) || empty($value)) {
            delete_post_meta($post_id, $this->getName());
        } elseif (empty($previous) && is_array($value)) {
            array_walk($value, function ($val) use ($post_id) {
                add_post_meta($post_id, $this->getName(), $val, false);
            });
        } else {
            delete_post_meta($post_id, $this->getName());

            array_walk($value, function ($val) use ($post_id, $previous) {
                add_post_meta($post_id, $this->getName(), $val, false);
            });
        }
    }
1007791
private function checkParamsPost(Request $request, $params)
    {
        if(empty($params))
        {
            return true;
        }
        return Imi::checkCompareRules($params, function($name) use($request){
            return $request->post($name);
        });
    }
668327
private function checkFormIdInSession()
    {
        if (!isset($_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID])) {
            return false;
        }

        if (!$_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID] === $this->formId) {
            return false;
        }

        return true;
    }
200689
public static function post($name, $int = FALSE) {
    	if ($int) {
    		return (isset($_POST[$name]))?(int)$_POST[$name]:0;    
    	} else {
    		return (isset($_POST[$name]))?$_POST[$name]:FALSE;
    	}
    }
425574
public function save_post_detect_new( $new_status, $old_status, $post ) {

		if ( $post ) {
			self::$old_post_status[ $post->post_type ] = $old_status;
		}

	}
115762
public function exists($id)
    {
        try {
            return !!$this->resource->hExists(static::CACHE_KEY, $id);
        } catch (ConnectionException $e) {
            return false;
        }
    }
813678
def image_exists(self, image_id):
        
        logger.info("checking whether image '%s' exists", image_id)
        logger.debug("image_id = '%s'", image_id)
        try:
            response = self.d.inspect_image(image_id)
        except APIError as ex:
            logger.warning(repr(ex))
            response = False
        else:
            response = response is not None
        logger.debug("image exists: %s", response)
        return response
1223373
private function checkValidity()
    {

        if (!is_writable($this->rssFile)) {
            $this->valid = false;
            return;
        }

        $stmt = $this->db->prepare('SELECT CREATED FROM ' . $this->table . ' ORDER BY CREATED DESC LIMIT 1');
        $stmt->execute();
        $res = $stmt->fetchAll();

        if (count($res) == 0) {
            $this->valid = false;
            return;
        }

        $latestInput = strtotime($res[0]->CREATED);

        $rssCreated = filemtime($this->rssFile);

        if ($latestInput > $rssCreated) {
            $this->valid = false;
        } else {
            $this->valid = true;
        }
    }