-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from nliautaud/1.1
1.1
- Loading branch information
Showing
50 changed files
with
3,272 additions
and
2,031 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
/** | ||
* p01-contact for Pico CMS - Simply add contact forms in your pages | ||
* | ||
* This plugin let you add contact forms in your pages by writing simple tags. | ||
* You can also define recipients or create your own complex forms. | ||
* | ||
* This file is the handle of p01-contact for Pico CMS. | ||
* | ||
* @link https://github.com/nliautaud/p01contact | ||
* @author Nicolas Liautaud | ||
* @package p01contact | ||
* @version 1.1 | ||
*/ | ||
|
||
require_once 'src/P01contact.php'; | ||
|
||
class P01contact_pico extends AbstractPicoPlugin | ||
{ | ||
private $P01contact; | ||
|
||
/** | ||
* Initialize P01contact and set the default language from Pico settings | ||
* | ||
* Triggered after Pico has read its configuration | ||
* | ||
* @see Pico::getConfig() | ||
* @param array &$config array of config variables | ||
* @return void | ||
*/ | ||
public function onConfigLoaded(array &$config) | ||
{ | ||
$this->P01contact = new P01C\P01contact(); | ||
|
||
if(!empty($config['default_language'])) { | ||
$this->P01contact->default_lang = $config['default_language']; | ||
} | ||
} | ||
/** | ||
* Replace (% contact %) tags and contact_admin tags in pages content | ||
* | ||
* Triggered after Pico has prepared the raw file contents for parsing | ||
* | ||
* @see Pico::parseFileContent() | ||
* @see DummyPlugin::onContentParsed() | ||
* @param string &$content prepared file contents for parsing | ||
* @return void | ||
*/ | ||
public function onContentPrepared(&$content) | ||
{ | ||
// replace config panel (% contact_admin_config %) | ||
$content = preg_replace_callback('`\(%\s*contact_admin_config\s*%\)`', function () { | ||
return $this->P01contact->panel(); | ||
}, $content, 1); | ||
|
||
// replace debug report (% contact_admin_debug %) | ||
$content = preg_replace_callback('`\(%\s*contact_admin_debug\s*%\)`', function () { | ||
return $this->P01contact->config('debug') ? $this->P01contact->debugReport() : ''; | ||
}, $content, 1); | ||
|
||
// replace forms (% contact ... %) | ||
$content = $this->P01contact->parse($content); | ||
} | ||
/** | ||
* Add {{ contact() }} and {{ contact_admin() }} twig functions | ||
* For outputing forms and admin panels from themes templates | ||
* | ||
* Triggered before Pico renders the page | ||
* | ||
* @see Pico::getTwig() | ||
* @see DummyPlugin::onPageRendered() | ||
* @param Twig_Environment &$twig twig template engine | ||
* @param array &$twigVariables template variables | ||
* @param string &$templateName file name of the template | ||
* @return void | ||
*/ | ||
public function onPageRendering(Twig_Environment &$twig, array &$twigVariables, &$templateName) | ||
{ | ||
// {{ contact() }} output the default form | ||
// {{ contact('parameters') }} custom parameters | ||
// {{ contact('fr', 'parameters') }} custom parameters and form-specific language | ||
// {{ contact('fr', null) }} default form with form-specific language | ||
$twig->addFunction(new Twig_SimpleFunction('contact', function ($a, $b) { | ||
if (isset($b)) return $this->P01contact->newForm($b, $a); | ||
return $this->P01contact->newForm($a); | ||
})); | ||
|
||
// {{ contact_admin('debug') }} output the debug report | ||
// {{ contact_admin('config') }} output the config panel | ||
$twig->addFunction(new Twig_SimpleFunction('contact_admin', function ($type) { | ||
if ($type == 'debug' && $this->P01contact->config('debug')) | ||
return $this->P01contact->debugReport(); | ||
if ($type == 'config') | ||
return $this->P01contact->panel(); | ||
})); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
# Bulgarian language file for p01-contact | ||
key: bg | ||
name: Bulgarian | ||
english_name: Bulgarian | ||
authors: Panayot Kuyvliev | ||
date: "2011-10-22" | ||
compatibility: 1.1 | ||
strings: | ||
# fields | ||
name: Име | ||
email: Email | ||
address: Адрес | ||
tel: Телефон | ||
url: Уебсайт | ||
subject: Относно | ||
message: Съобщение | ||
file: Прикачи | ||
captcha: Captcha | ||
reload: Презареди | ||
fieldcaptcha: Грешен код | ||
askcopy: Прати ми копие на това съобщение | ||
send: Прати | ||
|
||
# email words | ||
askedcopy: Поискано е копие на това съобщение | ||
anonymous: Анонимен | ||
nosubject: (Няма тема) | ||
email_title: Съобщението е изпратено от | ||
|
||
# status messages | ||
sent: Съобщението е изпратено. | ||
error: "Грешка : съобщението не е изпратено." | ||
disable: Контактната форма е недостъпна. | ||
error_notarget: Тази контактна форма няма получател. | ||
token: Съобщението вече е изпратено. | ||
|
||
# fields errors | ||
field_required: Това поле е задължително | ||
field_email: Моля използвайте валиден имейл адрес | ||
field_tel: Моля използвайте валиден телефонен номер | ||
field_url: Моля напишете валиден уеб адрес | ||
field_message: Моля напишете по дълго съобщение | ||
field_captcha: Моля копирайте следния текст | ||
field_fieldcaptcha: Моля не попълвайте това поле | ||
field_password: Грешна парола | ||
|
||
# configuration panel | ||
|
||
config_title: p01contact Настройки | ||
|
||
# messages | ||
config_updated: Твоите промени са запазени успешно. | ||
|
||
config_error_open: "<b>Конфигуриращият файл не може да бъде отворен.</b> Проверете дали файла съществува и неговата достъпност :" | ||
|
||
# New release alert | ||
new_release: Има нова версия! | ||
download: Свали последната версия | ||
|
||
# Links | ||
doc: Документация | ||
forum: Форум | ||
|
||
# Parameters | ||
enable: Пусни | ||
enable_sub: Пускане и спиране изпращането на съобщения (без да се скрива контактната форма). | ||
|
||
default_email: Емейл по подразбиране | ||
default_email_sub: Оставете празно, за да го настроите да | ||
|
||
lang: Език | ||
lang_sub: Езикът по подразбиране е | ||
|
||
default_params: Параметри по подразбиране | ||
|
||
message_len: Минимална големина на съобщението | ||
|
||
blacklist: Черен списък | ||
whitelist: Бял списък | ||
checklists_sub: "Черен списък: стойности, които не трябва да присъстват в областта за изпращане на имейл <br />. Бял списък: Възможните стойности от значение за областта, за да изпратите имейл <br />. Разделени със запетаи." | ||
|
||
general_fields: Общи полета | ||
special_fields: Специални полета | ||
|
||
debug_sub: Изключване на изпращането на съобщения, display p01-contact data structure, data sent by POST and the email that would have been sent. |
Oops, something went wrong.