示例#1
0
         * @return WPDLib\Components\Base the first component with the second component merged into it
         */
        private static function merge_components($a, $b)
        {
            $args = $a->args;
            $parents = $a->parents;
            $children = $a->children;
            $_args = $b->args;
            $_parents = $b->parents;
            $_children = $b->children;
            $a->args = array_merge($args, $_args);
            $a->parents = array_merge($parents, $_parents);
            $a->children = array_merge_recursive($children, $_children);
            return $a;
        }
        /**
         * Determines the base path and base URL to WPDLib.
         *
         * @since 0.5.0
         */
        private static function determine_base()
        {
            self::$base_dir = str_replace('/inc/WPDLib/Components', '', wp_normalize_path(dirname(__FILE__)));
            self::$base_url = str_replace(WP_CONTENT_DIR, WP_CONTENT_URL, self::$base_dir);
        }
    }
    // automatically load the WPDLib textdomain
    Manager::load_textdomain();
    // automatically create menu from all menu components
    add_action('admin_menu', array('WPDLib\\Components\\Manager', 'create_menu'), 40);
}