示例#1
0
 /**
  * Singleton handling for a basic pods_data() request
  *
  * @param string $pod Pod name
  * @param integer $id Pod Item ID
  * @param bool $strict If true throws an error if a pod is not found.
  *
  * @return \PodsData
  *
  * @since 2.3.5
  */
 public static function init($pod = null, $id = 0, $strict = true)
 {
     if (true !== $pod && null !== $pod || 0 != $id) {
         return new PodsData($pod, $id, $strict);
     } elseif (!is_object(self::$instance)) {
         self::$instance = new PodsData();
     } else {
         $vars = get_class_vars(__CLASS__);
         foreach ($vars as $var => $default) {
             if ('api' == $var) {
                 continue;
             }
             self::$instance->{$var} = $default;
         }
     }
     return self::$instance;
 }