1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8namespace Tiki\MailIn\Provider; 9 10use Tiki\MailIn\Action; 11 12class BasicWikiProvider implements ProviderInterface 13{ 14 private $type; 15 private $label; 16 private $class; 17 18 function __construct($type, $label, $class) 19 { 20 $this->type = $type; 21 $this->label = $label; 22 $this->class = $class; 23 } 24 25 function isEnabled() 26 { 27 global $prefs; 28 return $prefs['feature_wiki'] == 'y'; 29 } 30 31 function getType() 32 { 33 return $this->type; 34 } 35 36 function getLabel() 37 { 38 /* Catch strings 39 tr('Create or update wiki page') 40 tr('Send page to user') 41 tr('Append to wiki page') 42 tr('Prepend to wiki page') 43 */ 44 return tr($this->label); 45 } 46 47 function getActionFactory(array $acc) 48 { 49 $wikiParams = [ 50 'namespace' => $acc['namespace'], 51 'structure_routing' => $acc['routing'] == 'y', 52 ]; 53 54 return new Action\DirectFactory($this->class, $wikiParams); 55 } 56} 57