first commit
This commit is contained in:
9
plugins/api_webhooks/api_webhooks.yaml
Executable file
9
plugins/api_webhooks/api_webhooks.yaml
Executable file
@@ -0,0 +1,9 @@
|
||||
name: api_webhooks
|
||||
title: API Webhooks
|
||||
author: Montala Limited
|
||||
version: 1.0
|
||||
desc: Adds support for configurable action buttons that call remote scripts..
|
||||
icon: fa fa-plug
|
||||
icon-colour: #669944
|
||||
category: Integrations
|
||||
info_url: https://www.resourcespace.com/knowledge-base/plugins/api-webhooks
|
17
plugins/api_webhooks/config/config.example.php
Normal file
17
plugins/api_webhooks/config/config.example.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
// Copy to config.php in this folder, or the main ResourceSpace config.php file.
|
||||
|
||||
$api_webhooks_urls = [
|
||||
[
|
||||
"location" => "edit",
|
||||
"buttontext" => "Fetch object data from CMS",
|
||||
"url" => "https://www.resourcespace.com/some_script.abc?resource_id="
|
||||
]
|
||||
,
|
||||
[
|
||||
"location" => "edit",
|
||||
"buttontext" => "Push image to CMS",
|
||||
"url" => "https://www.resourcespace.com/another_script.abc?resource_id="
|
||||
]
|
||||
];
|
4
plugins/api_webhooks/css/style.css
Normal file
4
plugins/api_webhooks/css/style.css
Normal file
@@ -0,0 +1,4 @@
|
||||
.APIWebhooksEditButton
|
||||
{
|
||||
float:right;margin: 0 10px 0 10px !important;
|
||||
}
|
89
plugins/api_webhooks/hooks/edit.php
Normal file
89
plugins/api_webhooks/hooks/edit.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
function HookApi_webhooksEditExtra_edit_buttons()
|
||||
{
|
||||
// Add configured buttons as appropriate.
|
||||
global $api_webhooks_urls,$multiple;
|
||||
if (!isset($api_webhooks_urls)) {
|
||||
return false;
|
||||
}
|
||||
if ($multiple) {
|
||||
return false;
|
||||
} // Not for batch edit
|
||||
?>
|
||||
<input type="hidden" name="api_webhooks_submitted_button" id="api_webhooks_submitted_button" value="" />
|
||||
<?php
|
||||
$counter = 0;
|
||||
foreach ($api_webhooks_urls as $url) {
|
||||
?>
|
||||
<input name="save"
|
||||
class="editsave APIWebhooksEditButton"
|
||||
type="submit"
|
||||
value=" ↺ <?php echo escape(i18n_get_translated($url["buttontext"])); ?> "
|
||||
onclick="document.getElementById('api_webhooks_submitted_button').value=<?php echo $counter ?>;"
|
||||
/>
|
||||
<?php
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
|
||||
function HookApi_webhooksEditRedirectaftersave()
|
||||
{
|
||||
// Process the saved form and access the remote script.
|
||||
global $api_webhooks_urls,$ref;
|
||||
if (!isset($api_webhooks_urls)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Fetch appropriate button
|
||||
$button_index = getval("api_webhooks_submitted_button", "");
|
||||
if ($button_index === "") {
|
||||
return false;
|
||||
} // No button pressed? Redirect to view page as normal.
|
||||
$button = $api_webhooks_urls[$button_index];
|
||||
|
||||
// Perform API call.
|
||||
$url = $button["url"] . $ref;
|
||||
$options = array
|
||||
(
|
||||
'http' => array(
|
||||
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||
'method' => 'POST',
|
||||
'ignore_errors' => true
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, false, $context);
|
||||
global $api_webhooks_urls;
|
||||
|
||||
// Handle any errors.
|
||||
if (strpos($http_response_header[0], "200 OK") === false) {
|
||||
?>
|
||||
<script>alert('Error - POST to <?php echo escape($url) ?> returned <?php echo escape($http_response_header[0]) ?>');</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
// Clear posted values so user's changes don't overwrite the data coming back in.
|
||||
$_POST = array();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function HookApi_webhooksEditUploadreviewabortnext()
|
||||
{
|
||||
global $api_webhooks_urls;
|
||||
if (!isset($api_webhooks_urls)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't move to the next resource when an API button has been pressed.
|
||||
$button_index = getval("api_webhooks_submitted_button", "");
|
||||
if ($button_index !== "") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function HookApi_webhooksEditRedirectaftersavetemplate()
|
||||
{
|
||||
return HookApi_webhooksEditRedirectaftersave();
|
||||
}
|
4
plugins/api_webhooks/languages/ar.php
Normal file
4
plugins/api_webhooks/languages/ar.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'ويب هوكس API';
|
||||
$lang["plugin-api_webhooks-desc"] = 'يضيف دعمًا لأزرار الإجراءات القابلة للتكوين التي تستدعي البرامج النصية البعيدة.';
|
1
plugins/api_webhooks/languages/bn.php
Normal file
1
plugins/api_webhooks/languages/bn.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
4
plugins/api_webhooks/languages/ca.php
Normal file
4
plugins/api_webhooks/languages/ca.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhooks';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Afegeix suport per a botons d\'acció configurables que criden scripts remots.';
|
4
plugins/api_webhooks/languages/cs.php
Normal file
4
plugins/api_webhooks/languages/cs.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhooky';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Přidává podporu pro konfigurovatelná akční tlačítka, která volají vzdálené skripty.';
|
1
plugins/api_webhooks/languages/cy.php
Normal file
1
plugins/api_webhooks/languages/cy.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
4
plugins/api_webhooks/languages/da.php
Normal file
4
plugins/api_webhooks/languages/da.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhooks';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Tilføjer support til konfigurerbare handlingsknapper, der kalder eksterne scripts.';
|
4
plugins/api_webhooks/languages/de.php
Normal file
4
plugins/api_webhooks/languages/de.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API-Webhooks';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Fügt Unterstützung für konfigurierbare Aktionsschaltflächen hinzu, die entfernte Skripte aufrufen.';
|
4
plugins/api_webhooks/languages/el.php
Normal file
4
plugins/api_webhooks/languages/el.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhooks';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Προσθέτει υποστήριξη για διαμορφώσιμα κουμπιά ενεργειών που καλούν απομακρυσμένα σενάρια.';
|
1
plugins/api_webhooks/languages/en.php
Normal file
1
plugins/api_webhooks/languages/en.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
4
plugins/api_webhooks/languages/es-AR.php
Normal file
4
plugins/api_webhooks/languages/es-AR.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'Webhooks de API';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Agrega soporte para botones de acción configurables que llaman a scripts remotos.';
|
4
plugins/api_webhooks/languages/es.php
Normal file
4
plugins/api_webhooks/languages/es.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'Webhooks de API';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Añade soporte para botones de acción configurables que llaman a scripts remotos.';
|
1
plugins/api_webhooks/languages/fa.php
Normal file
1
plugins/api_webhooks/languages/fa.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
4
plugins/api_webhooks/languages/fi.php
Normal file
4
plugins/api_webhooks/languages/fi.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API-verkkokoukut';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Lisää tuen konfiguroitaville toimintopainikkeille, jotka kutsuvat etäskriptejä.';
|
4
plugins/api_webhooks/languages/fr.php
Normal file
4
plugins/api_webhooks/languages/fr.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhooks';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Ajoute la prise en charge des boutons d\'action configurables qui appellent des scripts distants.';
|
4
plugins/api_webhooks/languages/hi.php
Normal file
4
plugins/api_webhooks/languages/hi.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'एपीआई वेबहुक्स';
|
||||
$lang["plugin-api_webhooks-desc"] = 'रिमोट स्क्रिप्ट्स को कॉल करने वाले कॉन्फ़िगर करने योग्य एक्शन बटन के लिए समर्थन जोड़ता है।';
|
4
plugins/api_webhooks/languages/hr.php
Normal file
4
plugins/api_webhooks/languages/hr.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhookovi';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Dodaje podršku za konfigurabilne akcijske gumbe koji pozivaju udaljene skripte.';
|
2
plugins/api_webhooks/languages/hu.php
Normal file
2
plugins/api_webhooks/languages/hu.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
|
4
plugins/api_webhooks/languages/id.php
Normal file
4
plugins/api_webhooks/languages/id.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhooks';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Menambahkan dukungan untuk tombol tindakan yang dapat dikonfigurasi yang memanggil skrip jarak jauh.';
|
4
plugins/api_webhooks/languages/it.php
Normal file
4
plugins/api_webhooks/languages/it.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'Webhook API';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Aggiunge il supporto per pulsanti di azione configurabili che richiamano script remoti.';
|
4
plugins/api_webhooks/languages/jp.php
Normal file
4
plugins/api_webhooks/languages/jp.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'APIウェブフック';
|
||||
$lang["plugin-api_webhooks-desc"] = 'リモートスクリプトを呼び出すための設定可能なアクションボタンのサポートを追加します。';
|
4
plugins/api_webhooks/languages/ko.php
Normal file
4
plugins/api_webhooks/languages/ko.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API 웹훅';
|
||||
$lang["plugin-api_webhooks-desc"] = '원격 스크립트를 호출하는 구성 가능한 작업 버튼 지원 추가.';
|
4
plugins/api_webhooks/languages/nl.php
Normal file
4
plugins/api_webhooks/languages/nl.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhooks';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Voegt ondersteuning toe voor configureerbare actiekoppen die externe scripts aanroepen.';
|
4
plugins/api_webhooks/languages/no.php
Normal file
4
plugins/api_webhooks/languages/no.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhooks';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Legger til støtte for konfigurerbare handlingsknapper som kaller eksterne skript.';
|
1
plugins/api_webhooks/languages/pa.php
Normal file
1
plugins/api_webhooks/languages/pa.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
4
plugins/api_webhooks/languages/pl.php
Normal file
4
plugins/api_webhooks/languages/pl.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'Interfejs API Webhooki';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Dodaje wsparcie dla konfigurowalnych przycisków akcji, które wywołują zdalne skrypty.';
|
4
plugins/api_webhooks/languages/pt-BR.php
Normal file
4
plugins/api_webhooks/languages/pt-BR.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'Webhooks da API';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Adiciona suporte para botões de ação configuráveis que chamam scripts remotos.';
|
4
plugins/api_webhooks/languages/pt.php
Normal file
4
plugins/api_webhooks/languages/pt.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'Webhooks da API';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Adiciona suporte para botões de ação configuráveis que chamam scripts remotos.';
|
4
plugins/api_webhooks/languages/ro.php
Normal file
4
plugins/api_webhooks/languages/ro.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'Webhook-uri API';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Adaugă suport pentru butoane de acțiune configurabile care apelează scripturi la distanță.';
|
4
plugins/api_webhooks/languages/ru.php
Normal file
4
plugins/api_webhooks/languages/ru.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Вебхуки';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Добавляет поддержку настраиваемых кнопок действий, которые вызывают удаленные скрипты.';
|
4
plugins/api_webhooks/languages/sk.php
Normal file
4
plugins/api_webhooks/languages/sk.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhooki';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Dodaja podporo za nastavljive akcijske gumbe, ki kličejo oddaljene skripte.';
|
4
plugins/api_webhooks/languages/sv.php
Normal file
4
plugins/api_webhooks/languages/sv.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhooks';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Lägger till stöd för konfigurerbara åtgärdsknappar som anropar fjärrskript.';
|
1
plugins/api_webhooks/languages/sw.php
Normal file
1
plugins/api_webhooks/languages/sw.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
1
plugins/api_webhooks/languages/th.php
Normal file
1
plugins/api_webhooks/languages/th.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
4
plugins/api_webhooks/languages/tr.php
Normal file
4
plugins/api_webhooks/languages/tr.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhook\'ları';
|
||||
$lang["plugin-api_webhooks-desc"] = 'Uzaktan komut dosyalarını çağıran yapılandırılabilir eylem düğmeleri için destek ekler.';
|
1
plugins/api_webhooks/languages/uk.php
Normal file
1
plugins/api_webhooks/languages/uk.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
1
plugins/api_webhooks/languages/ur.php
Normal file
1
plugins/api_webhooks/languages/ur.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
2
plugins/api_webhooks/languages/vi.php
Normal file
2
plugins/api_webhooks/languages/vi.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
|
4
plugins/api_webhooks/languages/zh-CN.php
Normal file
4
plugins/api_webhooks/languages/zh-CN.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$lang["plugin-api_webhooks-title"] = 'API Webhooks';
|
||||
$lang["plugin-api_webhooks-desc"] = '添加对可配置操作按钮的支持,这些按钮调用远程脚本。';
|
Reference in New Issue
Block a user