/** * @param WP_User|int|string|null $user * @param array $args */ function __construct($user, $args = array()) { if (!is_null($user)) { $this->_user = WPLib_Users::get_user($user); } $args = wp_parse_args($args, array('model' => array('user' => $user))); parent::__construct($args); }
/** * @param WP_Term|int|null $term * @param array $args */ function __construct($term, $args = array()) { $args = wp_parse_args($args, array('model' => array('term' => $term))); parent::__construct($args); }
/** * @param WPLib_Item_Base $item * * @return string|null */ static function get_module_filepath($item) { $reflector = new ReflectionClass($item); $filepath = WPLib::maybe_make_abspath_relative($reflector->getFileName()); foreach (self::get_module_classes($item->app_class()) as $module_class => $module_filepath) { if (0 === strpos($filepath, $module_filepath)) { return $module_filepath; } } return null; }
/** * @param WP_Post|int|null $post * @param array $args */ function __construct($post, $args = array()) { $args = wp_parse_args($args, array('model' => array('post' => $post))); parent::__construct($args); }