Plugin Directory

Changeset 2051900


Ignore:
Timestamp:
03/17/2019 04:16:04 AM (7 years ago)
Author:
warriorrocker
Message:

Add version 1.0.4 adding new post config endpoint and updated admin styles

Location:
xo-for-angular
Files:
14 edited
18 copied

Legend:

Unmodified
Added
Removed
  • xo-for-angular/tags/1.0.4/Includes/Api/Api.class.php

    r2042983 r2051900  
    6666        $this->Xo->RequireOnce('Includes/Api/Abstract/Responses/PostsGetResponse.class.php');
    6767        $this->Xo->RequireOnce('Includes/Api/Abstract/Responses/PostsFilterResponse.class.php');
     68        $this->Xo->RequireOnce('Includes/Api/Abstract/Responses/PostsConfigResponse.class.php');
    6869        $this->Xo->RequireOnce('Includes/Api/Abstract/Responses/MenusResponse.class.php');
    6970        $this->Xo->RequireOnce('Includes/Api/Abstract/Responses/TermsResponse.class.php');
  • xo-for-angular/tags/1.0.4/Includes/Api/Controllers/PostsController.class.php

    r2044909 r2051900  
    1616     * @return XoApiAbstractPostsGetResponse
    1717     */
    18     function Get($params) {
     18    public function Get($params) {
    1919        // Return an error if the url is missing
    2020        if ((empty($params['postId'])) && (empty($params['url'])))
     
    101101     * @return XoApiAbstractPostsFilterResponse
    102102     */
    103     function Filter($params) {
     103    public function Filter($params) {
    104104        // Collect search vars
    105105        $search = ((!empty($params['search'])) ? $params['search'] : null);
     
    207207        );
    208208    }
     209
     210    /**
     211     * Retrieve the config for a given post type.
     212     *
     213     * @since 1.0.4
     214     *
     215     * @param mixed $params Request object
     216     * @return XoApiAbstractPostsConfigResponse
     217     */
     218    public function Config($params) {
     219        // Return an error if the post type is missing
     220        if (empty($params['postType']))
     221            return new XoApiAbstractPostsConfigResponse(false, __('Missing post id.', 'xo'));
     222
     223        // Get the post type config object
     224        $postTypeConfig = get_post_type_object($params['postType']);
     225
     226        // Return an error if the post type is not found
     227        if (empty($postTypeConfig))
     228            return new XoApiAbstractPostsConfigResponse(false, __('Post type not found.', 'xo'));
     229
     230        // Return an error if the post type is not public
     231        if (!$postTypeConfig->public)
     232            return new XoApiAbstractPostsConfigResponse(false, __('Post type not found.', 'xo'));
     233
     234        // Return success and the post type config
     235        return new XoApiAbstractPostsConfigResponse(
     236            true, __('Successfully located post type config.', 'xo'),
     237            $postTypeConfig
     238        );
     239    }
    209240}
  • xo-for-angular/tags/1.0.4/Includes/Options/Abstract/AdminPage.class.php

    r2042983 r2051900  
    8181        $this->SetCurrentTab();
    8282
    83         echo '<div class="wrap">';
     83        echo '<div class="wrap xo-wrap">';
    8484
    8585        $this->RenderHeading();
     
    146146     */
    147147    function RenderHeading() {
    148         if ($this->pageTitle)
    149             echo '<h1>' . $this->pageTitle . '</h1>';
     148        if (!$this->pageTitle)
     149            return;
     150
     151        echo '<h1 class="xo-heading"><span class="xo-logo"></span>'
     152            . '<span>' . $this->pageTitle . '</span></h1>';
    150153    }
    151154
  • xo-for-angular/tags/1.0.4/Includes/Options/Abstract/SettingsTab.class.php

    r2042983 r2051900  
    1111        settings_errors();
    1212
    13         echo '<form method="post" action="options.php">';
     13        echo '<form class="xo-form" method="post" action="options.php">';
    1414
    1515        settings_fields($this->tabPageSlug);
  • xo-for-angular/tags/1.0.4/Includes/Options/Options.class.php

    r2047166 r2051900  
    4343        $this->InitToolsPage();
    4444        $this->InitToolsPageTabs();
     45
     46        add_action('admin_enqueue_scripts', array($this, 'AddAdminStyles'), 10, 0);
     47    }
     48
     49    function AddAdminStyles() {
     50        $adminCssFile = $this->Xo->GetFile('assets/css/admin.css', true);
     51
     52        if ($adminCssFile)
     53            wp_enqueue_style('admin-styles', $adminCssFile);
    4554    }
    4655
     
    4958            $this->Xo,
    5059            'angular-xo',
    51             $this->Xo->name,
     60            __('General Options', 'xo'),
    5261            $this->Xo->name,
    5362            $this->Xo->name,
  • xo-for-angular/tags/1.0.4/Includes/Options/Tabs/Tools/ExportTab.class.php

    r2043256 r2051900  
    1616     */
    1717    public function Render() {
     18        echo '<div class="xo-form">';
     19
    1820        $this->AddExportSettingsSection();
    1921        $this->AddExportAppConfigSection();
     22
     23        echo '</div>';
    2024    }
    2125
  • xo-for-angular/tags/1.0.4/Includes/Options/Tabs/Tools/ProfileTab.class.php

    r2043256 r2051900  
    1616     */
    1717    public function Render() {
     18        echo '<div class="xo-form">';
     19
    1820        $this->AddGeneralSection();
     21
     22        echo '</div>';
    1923    }
    2024
  • xo-for-angular/tags/1.0.4/Includes/Options/Tabs/Tools/ToolsTab.class.php

    r2043256 r2051900  
    2020
    2121    public function Render() {
     22        echo '<div class="xo-form">';
     23
    2224        $this->AddGeneralSection();
    2325        $this->AddGeneralSectionAppConfigEntrypoint();
    2426        $this->AddGeneralSectionRebuildTemplateCache();
    2527        $this->AddGeneralSectionResetDefaults();
     28
     29        echo '</div>';
    2630    }
    2731
  • xo-for-angular/tags/1.0.4/Includes/Services/Classes/RouteGenerator.class.php

    r2050579 r2051900  
    100100
    101101                // Generate route for a posts hub page which will handle individual post urls
    102                 $routes[] = new XoApiAbstractRoute($post_type_config->rewrite['slug'], $attrs['loadChildren'], 'prefix');
     102                $routes[] = new XoApiAbstractRoute($post_type_config->rewrite['slug'], $attrs['loadChildren'], 'prefix', array(
     103                    'postType' => $post_type
     104                ));
    103105            } else {
    104106                // Get all the published posts of a particular post type
  • xo-for-angular/tags/1.0.4/readme.txt

    r2050579 r2051900  
    44Requires at least: 4.9
    55Tested up to: 5.1
    6 Stable tag: 1.0.3
     6Stable tag: 1.0.4
    77Requires PHP: 7.0.0
    88License: GPLv2 or later
     
    3434== Changelog ==
    3535
     36= 1.0.4 =
     37* Add new API endpoint to retrieve post type config.
     38* Update styles used in admin options.
     39
    3640= 1.0.3 =
    3741* Fix routes output for posts without rewrite base.
     
    4246= 1.0.1 =
    4347* Added link target to menu item output.
    44 * Fix for posts filter api returning results when there is no match.
     48* Fix for posts filter API returning results when there is no match.
    4549
    4650= 1.0.0 =
  • xo-for-angular/tags/1.0.4/xo-angular.php

    r2050579 r2051900  
    44Plugin URI: https://angularxo.io
    55Description: Angular theme development in WordPress with templates and a powerful API.
    6 Version: 1.0.3
     6Version: 1.0.4
    77Author: Travis Brown
    88Author URI: http://www.xodustech.com
  • xo-for-angular/trunk/Includes/Api/Api.class.php

    r2042983 r2051900  
    6666        $this->Xo->RequireOnce('Includes/Api/Abstract/Responses/PostsGetResponse.class.php');
    6767        $this->Xo->RequireOnce('Includes/Api/Abstract/Responses/PostsFilterResponse.class.php');
     68        $this->Xo->RequireOnce('Includes/Api/Abstract/Responses/PostsConfigResponse.class.php');
    6869        $this->Xo->RequireOnce('Includes/Api/Abstract/Responses/MenusResponse.class.php');
    6970        $this->Xo->RequireOnce('Includes/Api/Abstract/Responses/TermsResponse.class.php');
  • xo-for-angular/trunk/Includes/Api/Controllers/PostsController.class.php

    r2044909 r2051900  
    1616     * @return XoApiAbstractPostsGetResponse
    1717     */
    18     function Get($params) {
     18    public function Get($params) {
    1919        // Return an error if the url is missing
    2020        if ((empty($params['postId'])) && (empty($params['url'])))
     
    101101     * @return XoApiAbstractPostsFilterResponse
    102102     */
    103     function Filter($params) {
     103    public function Filter($params) {
    104104        // Collect search vars
    105105        $search = ((!empty($params['search'])) ? $params['search'] : null);
     
    207207        );
    208208    }
     209
     210    /**
     211     * Retrieve the config for a given post type.
     212     *
     213     * @since 1.0.4
     214     *
     215     * @param mixed $params Request object
     216     * @return XoApiAbstractPostsConfigResponse
     217     */
     218    public function Config($params) {
     219        // Return an error if the post type is missing
     220        if (empty($params['postType']))
     221            return new XoApiAbstractPostsConfigResponse(false, __('Missing post id.', 'xo'));
     222
     223        // Get the post type config object
     224        $postTypeConfig = get_post_type_object($params['postType']);
     225
     226        // Return an error if the post type is not found
     227        if (empty($postTypeConfig))
     228            return new XoApiAbstractPostsConfigResponse(false, __('Post type not found.', 'xo'));
     229
     230        // Return an error if the post type is not public
     231        if (!$postTypeConfig->public)
     232            return new XoApiAbstractPostsConfigResponse(false, __('Post type not found.', 'xo'));
     233
     234        // Return success and the post type config
     235        return new XoApiAbstractPostsConfigResponse(
     236            true, __('Successfully located post type config.', 'xo'),
     237            $postTypeConfig
     238        );
     239    }
    209240}
  • xo-for-angular/trunk/Includes/Options/Abstract/AdminPage.class.php

    r2042983 r2051900  
    8181        $this->SetCurrentTab();
    8282
    83         echo '<div class="wrap">';
     83        echo '<div class="wrap xo-wrap">';
    8484
    8585        $this->RenderHeading();
     
    146146     */
    147147    function RenderHeading() {
    148         if ($this->pageTitle)
    149             echo '<h1>' . $this->pageTitle . '</h1>';
     148        if (!$this->pageTitle)
     149            return;
     150
     151        echo '<h1 class="xo-heading"><span class="xo-logo"></span>'
     152            . '<span>' . $this->pageTitle . '</span></h1>';
    150153    }
    151154
  • xo-for-angular/trunk/Includes/Options/Abstract/SettingsTab.class.php

    r2042983 r2051900  
    1111        settings_errors();
    1212
    13         echo '<form method="post" action="options.php">';
     13        echo '<form class="xo-form" method="post" action="options.php">';
    1414
    1515        settings_fields($this->tabPageSlug);
  • xo-for-angular/trunk/Includes/Options/Options.class.php

    r2047166 r2051900  
    4343        $this->InitToolsPage();
    4444        $this->InitToolsPageTabs();
     45
     46        add_action('admin_enqueue_scripts', array($this, 'AddAdminStyles'), 10, 0);
     47    }
     48
     49    function AddAdminStyles() {
     50        $adminCssFile = $this->Xo->GetFile('assets/css/admin.css', true);
     51
     52        if ($adminCssFile)
     53            wp_enqueue_style('admin-styles', $adminCssFile);
    4554    }
    4655
     
    4958            $this->Xo,
    5059            'angular-xo',
    51             $this->Xo->name,
     60            __('General Options', 'xo'),
    5261            $this->Xo->name,
    5362            $this->Xo->name,
  • xo-for-angular/trunk/Includes/Options/Tabs/Tools/ExportTab.class.php

    r2043256 r2051900  
    1616     */
    1717    public function Render() {
     18        echo '<div class="xo-form">';
     19
    1820        $this->AddExportSettingsSection();
    1921        $this->AddExportAppConfigSection();
     22
     23        echo '</div>';
    2024    }
    2125
  • xo-for-angular/trunk/Includes/Options/Tabs/Tools/ProfileTab.class.php

    r2043256 r2051900  
    1616     */
    1717    public function Render() {
     18        echo '<div class="xo-form">';
     19
    1820        $this->AddGeneralSection();
     21
     22        echo '</div>';
    1923    }
    2024
  • xo-for-angular/trunk/Includes/Options/Tabs/Tools/ToolsTab.class.php

    r2043256 r2051900  
    2020
    2121    public function Render() {
     22        echo '<div class="xo-form">';
     23
    2224        $this->AddGeneralSection();
    2325        $this->AddGeneralSectionAppConfigEntrypoint();
    2426        $this->AddGeneralSectionRebuildTemplateCache();
    2527        $this->AddGeneralSectionResetDefaults();
     28
     29        echo '</div>';
    2630    }
    2731
  • xo-for-angular/trunk/Includes/Services/Classes/RouteGenerator.class.php

    r2050579 r2051900  
    100100
    101101                // Generate route for a posts hub page which will handle individual post urls
    102                 $routes[] = new XoApiAbstractRoute($post_type_config->rewrite['slug'], $attrs['loadChildren'], 'prefix');
     102                $routes[] = new XoApiAbstractRoute($post_type_config->rewrite['slug'], $attrs['loadChildren'], 'prefix', array(
     103                    'postType' => $post_type
     104                ));
    103105            } else {
    104106                // Get all the published posts of a particular post type
  • xo-for-angular/trunk/readme.txt

    r2050579 r2051900  
    44Requires at least: 4.9
    55Tested up to: 5.1
    6 Stable tag: 1.0.3
     6Stable tag: 1.0.4
    77Requires PHP: 7.0.0
    88License: GPLv2 or later
     
    3434== Changelog ==
    3535
     36= 1.0.4 =
     37* Add new API endpoint to retrieve post type config.
     38* Update styles used in admin options.
     39
    3640= 1.0.3 =
    3741* Fix routes output for posts without rewrite base.
     
    4246= 1.0.1 =
    4347* Added link target to menu item output.
    44 * Fix for posts filter api returning results when there is no match.
     48* Fix for posts filter API returning results when there is no match.
    4549
    4650= 1.0.0 =
  • xo-for-angular/trunk/xo-angular.php

    r2050579 r2051900  
    44Plugin URI: https://angularxo.io
    55Description: Angular theme development in WordPress with templates and a powerful API.
    6 Version: 1.0.3
     6Version: 1.0.4
    77Author: Travis Brown
    88Author URI: http://www.xodustech.com
Note: See TracChangeset for help on using the changeset viewer.