├── .ci-ignore
├── .distignore
├── .github
├── FUNDING.yml
└── workflows
│ ├── deploy.yml
│ └── linting.yml
├── .wordpress-org
├── icon.svg
└── screenshot-1.png
├── README.md
├── actions.php
├── admin-bar.php
├── admin
├── admin-html.php
├── admin.php
├── css
│ └── admin.css
├── fields.php
├── functions.php
└── js
│ └── admin.js
├── docs
├── _sidebar.md
├── .nojekyll
├── index.html
├── index.md
├── installation.md
└── readme.md
├── jamstack-preview-and-deployments.php
├── package.json
├── preview
├── preview.php
└── template.php
└── readme.txt
/.ci-ignore:
--------------------------------------------------------------------------------
1 | .github/workflows
--------------------------------------------------------------------------------
/.distignore:
--------------------------------------------------------------------------------
1 | /docs
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: ['emilpriver']
4 | custom: ['https://paypal.me/privann', 'https://twitter.com/emil_priver']
5 |
--------------------------------------------------------------------------------
/.github/workflows/deploy.yml:
--------------------------------------------------------------------------------
1 | name: Deploy to WordPress.org
2 | on:
3 | release:
4 | types: [published]
5 | jobs:
6 | tag:
7 | name: New release
8 | runs-on: ubuntu-latest
9 | steps:
10 | - name: Checkout code
11 | uses: actions/checkout@v2
12 | - name: WordPress Plugin Deploy
13 | id: deploy
14 | uses: 10up/action-wordpress-plugin-deploy@stable
15 | with:
16 | generate-zip: true
17 | env:
18 | SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
19 | SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
20 | SLUG: jamstack-preview-and-deployments
21 | - name: Upload release asset
22 | uses: actions/upload-release-asset@v1
23 | env:
24 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 | with:
26 | upload_url: ${{ github.event.release.upload_url }}
27 | asset_path: ${{github.workspace}}/${{ github.event.repository.name }}.zip
28 | asset_name: ${{ github.event.repository.name }}.zip
29 | asset_content_type: application/zip
30 |
--------------------------------------------------------------------------------
/.github/workflows/linting.yml:
--------------------------------------------------------------------------------
1 | name: Linting code
2 | on: [push]
3 |
4 | jobs:
5 | check-quality:
6 | runs-on: ubuntu-latest
7 | name: A job to check quality of the code
8 | steps:
9 | - name: Check code meets quality standards
10 | id: code-inspector
11 | uses: codeinspectorio/github-action@master
12 | with:
13 | repo_token: ${{ secrets.GITHUB_TOKEN }}
14 | code_inspector_access_key: ${{ secrets.CODE_INSPECTOR_ACCESS_KEY }}
15 | code_inspector_secret_key: ${{ secrets.CODE_INSPECTOR_SECRET_KEY }}
16 | min_quality_grade: 'NEUTRAL'
17 | min_quality_score: '50'
18 | max_defects_rate: '0.2'
19 | max_complex_functions_rate: '0.2'
20 | max_long_functions_rate: '0.2'
21 | project_name: 'Jamstack Preview and Deployments Wordpress Plugin'
22 | max_timeout_sec: '600'
--------------------------------------------------------------------------------
/.wordpress-org/icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
15 |
16 |
17 |
19 |
20 |
21 |
23 |
24 |
25 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
39 |
40 |
41 |
42 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/.wordpress-org/screenshot-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emilpriver/jamstack-preview-and-deployments/96ca3cfabc9fc70872319fa4701c0e455bfc725a/.wordpress-org/screenshot-1.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 | 
3 | 
4 | 
5 |
6 | Code inspector: https://frontend.code-inspector.com/public/project/13311/jamstack-preview-and-deployments/dashboard
7 |
8 | # Jamstack Preview and Deploy
9 | This plugins makes it possible to preview content from the Wordpress Admin.
10 | Also supports to auto deploy website on change on selected post types.
11 |
12 | ## How to setup NextJS with preview:
13 | https://github.com/vercel/next.js/tree/canary/examples/cms-wordpress
14 |
15 |
16 | ## Docs
17 | https://emilpriver.github.io/jamstack-preview-and-deployments
18 |
--------------------------------------------------------------------------------
/actions.php:
--------------------------------------------------------------------------------
1 | add_node(
14 | array(
15 | 'id' => 'jamstack-preview-deployments-deploy-button',
16 | 'parent' => 'top-secondary',
17 | 'href' => 'javascript:void(0)',
18 | 'title' => 'Deploy Website',
19 | 'href' => '',
20 | 'meta' => [
21 | 'class' => 'jamstack-preview-deployments-deploy-button'
22 | ]
23 | )
24 | );
25 | }
26 |
27 | add_action('admin_bar_menu', 'JamstackPreviewAndDeploymentsTriggerDeployButton', 50);
28 |
--------------------------------------------------------------------------------
/admin/admin-html.php:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
This plugin is used to be able to send a user to a preview of your Jamstack website to show preview data.
17 |
This plugin does not automatically make your jamstack web app work with preview data. You still need to make your web app be able to handle the data.
18 |
19 | More information here:
20 |
21 |
22 | How to setup Next.JS with preview:
23 | https://github.com/vercel/next.js/tree/canary/examples/cms-wordpress
24 |
25 |
26 |
27 |
34 |
35 | "{$key}[webhook_url]",
27 | 'value' => jamstackPreviewAndDeploymentsGetWebhookUrl(),
28 | 'description' => sprintf(
29 | __(
30 | 'Your Build Hook URL. This url is used to start a build when needed, ex on a post change. You have more information at your providers website. Vercel Docs Netlify Docs ',
31 | JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN
32 | ),
33 | 'https://vercel.com/docs/more/deploy-hooks',
34 | 'https://docs.netlify.com/site-deploys/create-deploys/#build-hooks'
35 | ),
36 | ]
37 | );
38 |
39 | add_settings_field(
40 | 'webhook_method',
41 | __('Hook Method', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
42 | 'jamstackPreviewAndDeploymentsFieldSelect',
43 | $key,
44 | 'general', [
45 | 'name' => "{$key}[webhook_method]",
46 | 'value' => jamstackPreviewAndDeploymentsGetWebhookMethod(),
47 | 'choices' => [
48 | 'post' => 'POST',
49 | 'get' => 'GET',
50 | ],
51 | 'default' => 'post',
52 | 'description' => __('The way the plugin send the request ', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
53 | ]
54 | );
55 |
56 | add_settings_field(
57 | 'deployment_badge_url',
58 | __('Deployment Status Badge Image URL', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
59 | 'jamstackPreviewAndDeploymentsFieldUrl',
60 | $key,
61 | 'general', [
62 | 'name' => "{$key}[deployment_badge_url]",
63 | 'value' => jamstackPreviewAndDeploymentsStatusBadgeUrl(),
64 | 'description' => __('Your projects status image url. This image will be shown in admin top bar.', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
65 | ]
66 | );
67 |
68 | add_settings_field(
69 | 'JamstackPreviewAndDeploymentsDivider1',
70 | '',
71 | 'jamstackPreviewAndDeploymentsLineDivider',
72 | $key,
73 | 'general', [
74 | 'name' => "{$key}[JamstackPreviewAndDeploymentsDivider1]",
75 | 'value' => '',
76 | 'description' => null,
77 | ]
78 | );
79 |
80 | add_settings_field(
81 | 'jamstack_preview_endpoint',
82 | __('Preview URL', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
83 | 'jamstackPreviewAndDeploymentsFieldUrl',
84 | $key,
85 | 'preview', [
86 | 'name' => "{$key}[jamstack_preview_endpoint]",
87 | 'value' => jamstackPreviewAndDeploymentsPreviewEndpointUrl(),
88 | 'description' => sprintf(
89 | __(
90 | 'URL to your jamstack endpoint that show preview data. ex: https://domain.ltd/api/preview/ This plugin will add id, secret and postType to the url. ex: https://domain.ltd/api/preview?id=x&secret=x&postType=post',
91 | JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN
92 | )
93 | ),
94 | ]
95 | );
96 |
97 | add_settings_field(
98 | 'jamstack_preview_endpoint_secret',
99 | __('Preview Secret', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
100 | 'jamstackPreviewAndDeploymentsFieldText',
101 | $key,
102 | 'preview', [
103 | 'name' => "{$key}[jamstack_preview_endpoint_secret]",
104 | 'value' => jamstackPreviewAndDeploymentsEndpointSecret(),
105 | 'description' => __('Preview secret', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN ),
106 | ]
107 | );
108 |
109 | add_settings_field(
110 | 'jamstack_preview_method',
111 | __('Preview method', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
112 | 'jamstackPreviewAndDeploymentsFieldSelect',
113 | $key,
114 | 'general', [
115 | 'name' => "{$key}[jamstack_preview_method]",
116 | 'value' => jamstackPreviewAndDeploymentsPreviewMethod(),
117 | 'choices' => [
118 | 'redirect' => 'Redirect',
119 | 'iframe' => 'Iframe',
120 | ],
121 | 'default' => 'redirect',
122 | 'description' => __('The way to show the website for the user. Either redirect the user to the preview page or show the preview page inside of an iframe', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
123 | ]
124 | );
125 |
126 | add_settings_field(
127 | 'JamstackPreviewAndDeploymentsDivider2',
128 | '',
129 | 'jamstackPreviewAndDeploymentsLineDivider',
130 | $key,
131 | 'preview', [
132 | 'name' => "{$key}[JamstackPreviewAndDeploymentsDivider2]",
133 | 'value' => '',
134 | 'description' => null,
135 | ]
136 | );
137 |
138 | add_settings_field(
139 | 'webhook_post_types_selected',
140 | __('Post Types with changed preview url', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
141 | 'jamstackPreviewAndDeploymentsFieldCheckboxes',
142 | $key,
143 | 'postTypes', [
144 | 'name' => "{$key}[webhook_post_types_selected]",
145 | 'value' => isset($option['webhook_post_types_selected']) ? $option['webhook_post_types_selected'] : [],
146 | 'choices' => jamstackPreviewAndDeploymentsPostTypes(),
147 | 'description' => __('Select post types that will use the preview url', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
148 | 'legend' => 'Post Types',
149 | ]
150 | );
151 |
152 | add_settings_field(
153 | 'webhook_post_types',
154 | __('Automatic Deploy Post Types', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
155 | 'jamstackPreviewAndDeploymentsFieldCheckboxes',
156 | $key,
157 | 'postTypes', [
158 | 'name' => "{$key}[webhook_post_types]",
159 | 'value' => isset($option['webhook_post_types']) ? $option['webhook_post_types'] : [],
160 | 'choices' => jamstackPreviewAndDeploymentsPostTypes(),
161 | 'description' => __('Select post types that will trigger a deploy on deleted, edited or added.', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
162 | 'legend' => 'Post Types',
163 | ]
164 | );
165 | });
166 |
--------------------------------------------------------------------------------
/admin/css/admin.css:
--------------------------------------------------------------------------------
1 | .jamstack-preview-deployments-deploy-button {
2 | background: rgba(255, 255, 255, .15) !important;
3 | color: #fff;
4 | cursor: pointer;
5 | }
6 | .jamstack-preview-deployments-deploy-button .ab-item {
7 | cursor: pointer !important;
8 | }
--------------------------------------------------------------------------------
/admin/fields.php:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 | {$args['description']}" : '';?>
17 |
18 |
29 |
30 |
31 | {$args['description']}" : '';?>
32 |
33 |
44 |
45 | $v): ?>
46 | >
47 |
48 |
49 | {$args['description']}" : '';?>
50 |
61 |
62 |
63 | $v): ?>
64 |
65 | "
67 | value=""
68 |
69 | />
70 | , the key/name is {$k}
"; ?>
71 |
72 |
73 | {$args['description']}" : '';?>
74 |
75 |
86 |
87 | name] = $choice->labels->name;
70 | }
71 | return $return;
72 | }
73 |
74 | /**
75 | * Get active post types which is using auto deploy
76 | *
77 | * @return Array
78 | */
79 | function jamstackPreviewAndDeploymentsActivePostTypes()
80 | {
81 | $options = jamstackPreviewAndDeploymentsGetOptions();
82 | return !empty($options['webhook_post_types']) ? $options['webhook_post_types'] : [];
83 | }
84 |
85 | /**
86 | * Get post types which is using preview method
87 | *
88 | * @return Array
89 | */
90 | function jamstackPreviewAndDeploymentsSelectedPostTypes() {
91 | $options = jamstackPreviewAndDeploymentsGetOptions();
92 | return !empty($options['webhook_post_types_selected']) ? $options['webhook_post_types_selected'] : [];
93 | }
94 |
95 | /**
96 | * Get preview endpoint
97 | *
98 | * @return String
99 | */
100 | function jamstackPreviewAndDeploymentsPreviewEndpointUrl()
101 | {
102 | $options = jamstackPreviewAndDeploymentsGetOptions();
103 | return !empty($options['jamstack_preview_endpoint']) ? $options['jamstack_preview_endpoint'] : null;
104 | }
105 |
106 | /**
107 | * Get preview secret
108 | *
109 | * @return String
110 | */
111 | function jamstackPreviewAndDeploymentsEndpointSecret()
112 | {
113 | $options = jamstackPreviewAndDeploymentsGetOptions();
114 | return !empty($options['jamstack_preview_endpoint_secret']) ? $options['jamstack_preview_endpoint_secret'] : null;
115 | }
116 |
--------------------------------------------------------------------------------
/admin/js/admin.js:
--------------------------------------------------------------------------------
1 | window.onload = function () {
2 | document.querySelectorAll('.jamstack-preview-deployments-deploy-button').forEach(item => {
3 | item.addEventListener("click", function () {
4 | let formData = new FormData();
5 | formData.append('action', 'jamstack_deploy_website');
6 |
7 | item.innerHTML = 'Sending Deploy
';
8 | fetch(ajaxurl, {
9 | method: 'POST',
10 | body: formData
11 | })
12 | .then(() => {
13 | item.innerHTML = 'Deployment sent
';
14 | })
15 | .catch(() => {
16 | item.innerHTML = 'Error sending deploy
';
17 | });
18 | });
19 | });
20 | };
--------------------------------------------------------------------------------
/docs/ _sidebar.md:
--------------------------------------------------------------------------------
1 |
2 | # hello
3 | * [Home](/)
4 | * [Installation](installation.md "Installation")
--------------------------------------------------------------------------------
/docs/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emilpriver/jamstack-preview-and-deployments/96ca3cfabc9fc70872319fa4701c0e455bfc725a/docs/.nojekyll
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Jamstack preview and deployments - documentation
6 |
7 |
8 |
9 |
10 |
11 |
12 | Please wait...
13 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | 
2 | 
3 | 
4 |
5 | Code inspector: https://frontend.code-inspector.com/public/project/13311/jamstack-preview-and-deployments/dashboard
6 |
7 | # Jamstack Preview and Deploy
8 | This plugins makes it possible to preview content from the Wordpress Admin.
9 | Also supports to auto deploy website on change on selected post types.
10 |
11 | ## How to setup NextJS with preview:
12 | https://github.com/vercel/next.js/tree/canary/examples/cms-wordpress
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/installation.md:
--------------------------------------------------------------------------------
1 | # installation
--------------------------------------------------------------------------------
/docs/readme.md:
--------------------------------------------------------------------------------
1 | 
2 | 
3 | 
4 |
5 | Code inspector: https://frontend.code-inspector.com/public/project/13311/jamstack-preview-and-deployments/dashboard
6 |
7 | # Jamstack Preview and Deploy
8 | This plugins makes it possible to preview content from the Wordpress Admin.
9 | Also supports to auto deploy website on change on selected post types.
10 |
11 | ## How to setup NextJS with preview:
12 | https://github.com/vercel/next.js/tree/canary/examples/cms-wordpress
13 |
14 |
15 |
--------------------------------------------------------------------------------
/jamstack-preview-and-deployments.php:
--------------------------------------------------------------------------------
1 |
16 | * @license https://www.gnu.org/licenses/gpl-2.0.html GPL v2 or later
17 | * @link https://priver.dev
18 | */
19 |
20 | define('JAMSTACK_PREVIEW_AND_DEPLYOMENTS_PLUGIN_DIRECTORY', plugin_dir_path(__FILE__));
21 | define('JAMSTACK_PREVIEW_AND_DEPLOYMENTS_URL_DIRECTORY', plugin_dir_url(__FILE__));
22 | define('JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN', 'JamstackPreviewAndDEeloymentsTextDomain');
23 | define('JAMSTACK_PREVIEW_AND_DEPLOYMENTS_SETTINGS_KEY', 'JamstackPreviewAndDeploymentsSettings');
24 | define('JAMSTACK_PREVIEW_AND_DEPLOYMENTS_OPTIONS_KEY', 'JamstackPreviewAndDeploymentsOptionsKey');
25 |
26 | /**
27 | * Needed includes
28 | */
29 | require_once JAMSTACK_PREVIEW_AND_DEPLYOMENTS_PLUGIN_DIRECTORY . 'admin/admin.php';
30 | require_once JAMSTACK_PREVIEW_AND_DEPLYOMENTS_PLUGIN_DIRECTORY . 'admin/functions.php';
31 | require_once JAMSTACK_PREVIEW_AND_DEPLYOMENTS_PLUGIN_DIRECTORY . 'preview/preview.php';
32 | require_once JAMSTACK_PREVIEW_AND_DEPLYOMENTS_PLUGIN_DIRECTORY . 'actions.php';
33 | require_once JAMSTACK_PREVIEW_AND_DEPLYOMENTS_PLUGIN_DIRECTORY . 'admin-bar.php';
34 |
35 | /**
36 | * Include scripts and styles
37 | */
38 | add_action('admin_enqueue_scripts', function () {
39 | wp_enqueue_script('jamstackPreviewDeploymentsScripts', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_URL_DIRECTORY . 'admin/js/admin.js', array(), false, true);
40 | wp_enqueue_style('jamstackPreviewDeploymentsStyles', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_URL_DIRECTORY . 'admin/css/admin.css');
41 | });
42 |
43 | /**
44 | * Create Admin interface
45 | */
46 |
47 | add_action('admin_menu', function () {
48 | add_options_page(
49 | __('Jamstack preview and deployments', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
50 | __('Jamstack preview and deployments', JAMSTACK_PREVIEW_AND_DEPLOYMENTS_TEXT_DOMAIN),
51 | 'manage_options',
52 | 'jamstack-preview-and-deployments',
53 | 'jamstackPreviewAndDeployments'
54 | );
55 | });
56 |
57 | /**
58 | * Ajax function that trigger a deploy only if user is loggedin
59 | *
60 | * @return Number
61 | */
62 | add_action('wp_ajax_jamstack_deploy_website', 'jamstackPreviewAndDeploymentsTriggerDeploy');
63 | function jamstackPreviewAndDeploymentsTriggerDeploy()
64 | {
65 | do_action('jamstack_preview_deployments_deploy_webhook');
66 | echo 1;
67 | wp_die();
68 | }
69 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jamstack-preview-and-deployments",
3 | "version": "1.0.0",
4 | "description": "Wordpress preview jamstack and deployments"
5 | }
6 |
--------------------------------------------------------------------------------
/preview/preview.php:
--------------------------------------------------------------------------------
1 | taxonomy;
12 | } else {
13 | $type = 'postType';
14 | $typeValue = $getQueriedObject->post_type;
15 | }
16 |
17 | $id = get_the_ID();
18 | $postType = get_post_type($id);
19 | $previewURL = jamstackPreviewAndDeploymentsPreviewEndpointUrl();
20 | $previewURLSecret = jamstackPreviewAndDeploymentsEndpointSecret();
21 | $url = str_replace(' ', '', "$previewURL?id=$id&secret=$previewURLSecret&type=$type&typeValue=$typeValue");
22 | $method = jamstackPreviewAndDeploymentsPreviewMethod();
23 | ?>
24 |
25 |
26 |
27 |
28 |
29 |
30 | Jamstack Preview
31 |
71 |
72 |
92 |
93 |
94 |
95 |
97 |
102 |
103 |
108 |
110 |
111 |
112 |
Preview broken
113 |
The Preview webhook set on the settings
115 | page isn't working properly.
116 |
117 | Please ensure your URL is correct.
118 |
119 |
120 |
121 |
122 |
--------------------------------------------------------------------------------
/readme.txt:
--------------------------------------------------------------------------------
1 | === Jamstack Preview and Deployments ===
2 | Contributors: emilpriver
3 | Tags: next.js, preview, jamstack, deployments
4 | Stable tag: 1.1.1
5 | License: GPL v2 or later
6 | Tested up to: 5.5.1
7 | Requires PHP: 5.6
8 | License URI: https://www.gnu.org/licenses/gpl-2.0.html
9 |
10 | Make your wordpress work with JAMstack webapplications with previews and automatic deployments.
11 |
12 | == Description ==
13 | This plugin makes it possible to preview JAMstack websites from wordpress admin and start a build from the Wordpress admin.
14 |
15 | OBS: This plugin does not automatic make your web app work with preview. You still need do stuffs on your own end.
16 |
17 | For guidence and instructions please refer to the Github repositority [emilpriver/jamstack-preview-and-deployments](https://github.com/emilpriver/jamstack-preview-and-deployments)
18 |
19 | == Screenshots ==
20 | 1. Admin page
21 |
--------------------------------------------------------------------------------