Changeset 3064100
- Timestamp:
- 04/03/2024 08:00:07 PM (2 years ago)
- Location:
- punchlist/trunk
- Files:
-
- 3 edited
-
bootstrap.php (modified) (4 diffs)
-
js/plCreateProject.js (modified) (1 diff)
-
src/Api.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
punchlist/trunk/bootstrap.php
r2846365 r3064100 6 6 Description: Harness the magic of Punchlist from the WP Dashboard 7 7 Author: Punchlist Labs 8 Version: 1.4. 48 Version: 1.4.5 9 9 Author URI: https://punchlist.com 10 10 Credits: This plugin borrows heavily from Public Post Preview plugin but Dominik Schilling. WP won't allow … … 12 12 License: GPLv2 13 13 14 Copyright (C) 202 3 Punchlist Labs Inc.14 Copyright (C) 2024 Marketwake. 15 15 16 16 This program is free software; you can redistribute it and/or … … 148 148 $newProject = $api->createProject($preview->link, $projectName); 149 149 150 if ($newProject[' data']['share_link']) {151 wp_send_json(['message' => 'success', 'data' => ['url' => $newProject[' data']['share_link']]]);150 if ($newProject['share_link']) { 151 wp_send_json(['message' => 'success', 'data' => ['url' => $newProject['share_link']]]); 152 152 } else { 153 153 wp_send_json_error(['message' => 'Error creating project'], 400); … … 177 177 178 178 $pageTitle = sanitize_text_field($_POST['name']) ?: bloginfo('name') . ' ' . date('m-d-Y'); 179 $projectId = is_numeric($_POST['project_id']) ? (int) $_POST['project_id'] : null;179 $projectId = $_POST['project_id']; 180 180 $newPage = $api->addPageToProject($preview->link, $projectId, $pageTitle); 181 181 -
punchlist/trunk/js/plCreateProject.js
r2825597 r3064100 58 58 } 59 59 ).fail((err) => { 60 alert(err.responseJSON.data.message); 60 console.log(err); 61 // alert(err.responseJSON.data.message); 61 62 }); 62 63 } -
punchlist/trunk/src/Api.php
r2825597 r3064100 33 33 public function createProject($url, $name) 34 34 { 35 return $this->post ('/projects', ['form_params' => ['domain' => $url, 'name' => $name, 'type' => 'web', 'no_proxy' => false]]);35 return $this->postJson('/projects', ['domain' => $url, 'name' => $name, 'type' => 'web']); 36 36 } 37 37 … … 71 71 72 72 $url = getenv('PUNCHLIST_URL') . $path; 73 74 73 $res = $this->client->request( 75 74 'POST', … … 77 76 $postArgs 78 77 ); 79 78 80 79 $res = json_decode($res->getBody()->getContents(), true); 81 80 return $this->sanitizeResponse($res['data']);
Note: See TracChangeset
for help on using the changeset viewer.