Resolves #71661: [!!!] Refactor, streamline and cleanup all scripts: all API changed
authorstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Wed, 18 Nov 2015 16:54:54 +0000 (16:54 +0000)
committerstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Wed, 18 Nov 2015 16:54:54 +0000 (16:54 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/sr_email_subscribe/trunk@90237 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
Classes/Controller/SubscribePluginController.php
Resources/Private/Language/locallang.xlf
Resources/Private/Templates/SubscribeHtmlTemplate.html
composer.json [new file with mode: 0644]
ext_conf_template.txt
ext_emconf.php
ext_localconf.php

index ba0edcb..a3545eb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2015-11-18 Stanislas Rolland  <typo3(arobas)sjbr.ca>
+       * Resolves #71661: [!!!] Refactor, streamline and cleanup all scripts: all API changed
+
 2015-10-24 Stanislas Rolland  <typo3(arobas)sjbr.ca>
        * Use configuration check utility
 
index e8324f2..bbb3d79 100644 (file)
@@ -23,23 +23,19 @@ namespace SJBR\SrEmailSubscribe\Controller;
  *  This copyright notice MUST APPEAR in all copies of the script!
  */
 
-use SJBR\SrFeuserRegister\Utility\ConfigurationCheckUtility;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Frontend\Plugin\AbstractPlugin;
+use SJBR\SrFeuserRegister\Controller\RegisterPluginController;
 
 /**
  * Front End creating/editing/deleting records authenticated by email address, also called subscriptions.
  */
-class SubscribePluginController extends AbstractPlugin
+class SubscribePluginController extends RegisterPluginController
 {
-
-       public $cObj;
-
        /**
-        * @var string Extension name
+        * Extension key
+        *
+        * @var string
         */
-       protected $extensionName = 'SrEmailSubscribe';
+       public $extKey = 'sr_email_subscribe';
        
        /**
         * Used for CSS classes, variables
@@ -47,40 +43,34 @@ class SubscribePluginController extends AbstractPlugin
         * @var string
         */
        public $prefixId = 'tx_sremailsubscribe_pi1';
-       
+
        /**
-        * Used only by pi_loadLL
+        * The table in used
         *
         * @var string
         */
-       public $scriptRelPath = 'Resources/Private/Language/locallang.xlf';
+       protected $theTable = 'tt_address';
 
        /**
-        * Extension key
+        * List of fields reserved as administration fields
         *
         * @var string
         */
-       public $extKey = 'sr_email_subscribe';
-
-       public function main($content, $conf)
-       {
-               $this->conf = &$conf;
-               $this->pi_setPiVarDefaults();
+       protected $adminFieldList = 'name,hidden';
 
-               $content = ConfigurationCheckUtility::checkRequirements($this->extKey);
+       /**
+        * A list of button label names
+        *
+        * @var string
+        */
+       protected $buttonLabelsList = 'register,confirm_register,send_invitation,send_invitation_now,send_link,back_to_form,update,confirm_update,enter,confirm_delete,cancel_delete';
 
-               if (!$content) {
-                       $adminFieldList = 'name,hidden';
-                       // Honour Address List (tt_address) configuration settings
-                       if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['addressTable'] == 'tt_address') {
-                               $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['tt_address']);
-                               if ($extConf['disableCombinedNameField'] == '1') {
-                                       // Remove name from adminFieldList
-                                       $adminFieldList = 'hidden';
-                               }
-                       }
-                       $buttonLabelsList = 'register,confirm_register,send_invitation,send_invitation_now,send_link,back_to_form,update,confirm_update,enter,confirm_delete,cancel_delete';
-                       $otherLabelsList = 'yes,no,click_here_to_register,tooltip_click_here_to_register,v_already_subscribed,click_here_to_edit,tooltip_click_here_to_edit,
+       /**
+        * A list of other label names
+        *
+        * @var string
+        */
+       protected $otherLabelsList = 'yes,no,click_here_to_register,tooltip_click_here_to_register,v_already_subscribed,click_here_to_edit,tooltip_click_here_to_edit,
                        v_wish_to_update_or_delete,v_enter_subscribed_email,click_here_to_delete,tooltip_click_here_to_delete,
                        copy_paste_link,enter_account_info,enter_invitation_account_info,required_info_notice,excuse_us,excuse_us_invitation,
                        registration_problem,registration_sorry,registration_clicked_twice,registration_help,kind_regards,
@@ -97,20 +87,18 @@ class SubscribePluginController extends AbstractPlugin
                        v_sending_infomail,v_sending_infomail_message1,v_sending_infomail_message2,v_infomail_subject,v_infomail_reason,v_infomail_message1,v_infomail_message2,
                        v_infomail_norecord_subject,v_infomail_norecord_message1,v_infomail_norecord_message2';
 
-                       $mainObj = GeneralUtility::makeInstance('tx_srfeuserregister_control_main');
-                       $mainObj->cObj = $this->cObj;
-                       $mainObj->extensionName = $this->extensionName;
-                       $content =
-                               $mainObj->main(
-                                       $content,
-                                       $conf,
-                                       $this,
-                                       $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['addressTable'],
-                                       $adminFieldList,
-                                       $buttonLabelsList,
-                                       $otherLabelsList
-                               );
+       /**
+        * Plugin entry script
+        *
+        * @param string $content: rendered content (not used)
+        * @param array $conf: the plugin TS configuration
+        * @return string the rendered content
+        */
+       public function main($content, $conf)
+       {
+               if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['addressTable'])) {
+                               $this->theTable = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['addressTable'];
                }
-               return $content;
+               return parent::main($content, $conf);
        }
 }
\ No newline at end of file
index ac864eb..affa371 100644 (file)
                        <trans-unit id="v_registration_created_message1_informal" xml:space="preserve">
                                <source>Your subscription has been created.</source>
                        </trans-unit>
+                       <trans-unit id="v_registration_created" xml:space="preserve">
+                               <source>%2$s subscribed to %1$s.</source>
+                       </trans-unit>
                        <trans-unit id="v_registration_created_informal" xml:space="preserve">
                                <source>%2$s subscribed to %1$s.</source>
                        </trans-unit>
                        <trans-unit id="v_registration_updated_subject" xml:space="preserve">
                                <source>Your subscription to &lt;b&gt;%1$s&lt;/b&gt; has been updated.</source>
                        </trans-unit>
+                       <trans-unit id="v_registration_updated" xml:space="preserve">
+                               <source>%2$s updated its subscription to %1$s.</source>
+                       </trans-unit>
+                       <trans-unit id="v_registration_updated_informal" xml:space="preserve">
+                               <source>%2$s updated its subscription to %1$s.</source>
+                       </trans-unit>
                        <trans-unit id="v_invitation_account_was_created" xml:space="preserve">
                                <source>The subscription was created. An invitation to confirm his subscription to &lt;b&gt;%1$s&lt;/b&gt; was sent to &lt;b&gt;%2$s&lt;/b&gt; at the email address &lt;b&gt;%4$s&lt;/b&gt;.</source>
                        </trans-unit>
@@ -645,6 +654,18 @@ If you wish to accept our invitation and confirm your subscription to &lt;b&gt;%
                        <trans-unit id="internal_check_requirements_frontend" xml:space="preserve">
                                <source>&lt;p&gt;&lt;big&gt;&lt;b&gt;Email Address Subscription (sr_email_subscribe): %1$s.&lt;/b&gt;&lt;/big&gt;&lt;/p&gt;</source>
                        </trans-unit>
+                       <trans-unit id="internal_infomail_option" xml:space="preserve">
+                               <source>The infomail option is not correctly configured</source>
+                       </trans-unit>
+                       <trans-unit id="table_not_defined_in_TCA" xml:space="preserve">
+                               <source>The table "%s" is not defined in TCA.</source>
+                       </trans-unit>
+                       <trans-unit id="invalidToken" xml:space="preserve">
+                               <source>Apparently, this link has expired.</source>
+                       </trans-unit>
+                       <trans-unit id="internal_no_subtemplate" xml:space="preserve">
+                               <source>The subpart %s was not found in the template file.</source>
+                       </trans-unit>
                </body>
        </file>
 </xliff>
\ No newline at end of file
index bf4af88..6a5b1e7 100644 (file)
@@ -1355,6 +1355,21 @@ The user is informed that a message has been sent to the email address and that
        </dd>
        <!-- ###SUB_INCLUDED_FIELD_comments### -->
 
+       <!--###SUB_INCLUDED_FIELD_captcha_response###-->
+       <dt>
+               <label for="tx-sremailsubscribe-pi1-captcha-response">###SR_FREECAP_NOTICE###</label>
+               ###SR_FREECAP_CANT_READ###
+       </dt>
+       <dd>
+               <!-- ###SUB_ERROR_FIELD_captcha_response### -->
+               <p class="tx-sremailsubscribe-pi1-error">###EVAL_ERROR_FIELD_captcha_response###</p>
+               <!-- ###SUB_ERROR_FIELD_captcha_response### -->
+               <input type="text" size="15" id="tx-sremailsubscribe-pi1-captcha-response" name="###NAME_CAPTCHA_RESPONSE###" title="###SR_FREECAP_NOTICE###" value="">
+               ###SR_FREECAP_IMAGE######CAPTCHA_IMAGE###
+               ###SR_FREECAP_ACCESSIBLE###
+       </dd>
+       <!--###SUB_INCLUDED_FIELD_captcha_response###-->
+
        <dt>&nbsp;</dt>
        <dd>
                ###HIDDENFIELDS###
@@ -1721,9 +1736,7 @@ The user is informed that a message has been sent to the email address and that
 <p style="margin-top: 20px"><em>This is the template used for the administrator notification email upon creation of an email address subscription and no confirmation is required.</em></p>
 <!-- ###EMAIL_TEMPLATE_CREATE_SAVED_ADMIN### begin -->
 <!-- ###SUB_RECORD### -->###LABEL_V_REGISTRATION_CREATED###
-###LABEL_V_NOTIFICATION###:
-
-###LABEL_V_REGISTRATION_CREATED###
+###LABEL_V_NOTIFICATION###: ###LABEL_V_REGISTRATION_CREATED###
 
 ###LABEL_FIRST_NAME###: ###FIELD_first_name###
 ###LABEL_MIDDLE_NAME###: ###FIELD_middle_name###
@@ -1787,9 +1800,7 @@ The user is informed that a message has been sent to the email address and that
 <p style="margin-top: 20px"><em>This is the template used for the administrator notification email upon update of an email address subscription.</em></p>
 <!-- ###EMAIL_TEMPLATE_EDIT_SAVED_ADMIN### begin -->
 <!-- ###SUB_RECORD### -->###LABEL_V_REGISTRATION_UPDATED###
-###LABEL_V_NOTIFICATION###:
-
-###LABEL_V_REGISTRATION_UPDATED###
+###LABEL_V_NOTIFICATION###: ###LABEL_V_REGISTRATION_UPDATED###
 
 ###LABEL_FIRST_NAME###: ###FIELD_first_name###
 ###LABEL_MIDDLE_NAME###: ###FIELD_middle_name###
@@ -1863,9 +1874,7 @@ The user is informed that a message has been sent to the email address and that
 <p style="margin-top: 20px"><em>This is the template used for the administrator notification email upon a new user registration, but confirmation is required.</em></p>
 <!-- ###EMAIL_TEMPLATE_SETFIXED_CREATE_ADMIN### begin -->
 <!-- ###SUB_RECORD### -->###LABEL_V_REGISTRATION_INITIATED###
-###LABEL_V_NOTIFICATION###:
-
-###LABEL_V_REGISTRATION_INITIATED###
+###LABEL_V_NOTIFICATION###: ###LABEL_V_REGISTRATION_INITIATED###
 
 ###LABEL_FIRST_NAME###: ###FIELD_first_name###
 ###LABEL_MIDDLE_NAME###: ###FIELD_middle_name###
@@ -2107,9 +2116,7 @@ The user is informed that a message has been sent to the email address and that
 <p style="margin-top: 20px"><em>This is the template used for the administrator notification email upon user refusal to confirm his email address subscription.</em></p>
 <!-- ###EMAIL_TEMPLATE_SETFIXED_DELETE_ADMIN### begin -->
 <!-- ###SUB_RECORD### -->###LABEL_V_REGISTRATION_CANCELLED###
-###LABEL_V_NOTIFICATION###:
-
-###LABEL_V_REGISTRATION_CANCELLED###
+###LABEL_V_NOTIFICATION###: ###LABEL_V_REGISTRATION_CANCELLED###
 
 ###LABEL_FIRST_NAME###: ###FIELD_first_name###
 ###LABEL_MIDDLE_NAME###: ###FIELD_middle_name###
diff --git a/composer.json b/composer.json
new file mode 100644 (file)
index 0000000..e87e4e7
--- /dev/null
@@ -0,0 +1,27 @@
+{
+  "name": "sjbr/sr_email_subscribe",
+  "description": "An email newsletter and address subscription variant of the Front End User Registration.",
+  "version": "4.0.0",
+  "type": "typo3-cms-extension",
+  "license": "GPL-2.0+",
+  "authors": [
+    {
+      "name": "Stanislas Rolland",
+      "role": "Developer"
+    }
+  ],
+  "replace": {
+    "sr_email_subscribe": "*"
+  },
+  "require": {
+         "typo3/cms-core": "6.2.4 - 7.99.99",
+         "sr_feuser_register" => "~4.0.0',
+         "tt_address" => "3.0.0-",
+         "sjbr/static_info_tables": "~6.3.1"
+  },
+  "autoload": {
+    "psr-4": {
+      "SJBR\\SrEmailSubscribe\\": "Classes/"
+    }
+  }
+}
index e27b099..e6f5690 100644 (file)
@@ -1,7 +1,6 @@
-
   # cat=basic/enable; type=string; label=Image upload folder: This is the place where the images are stored.
 imageFolder = uploads/tx_sremailsubscribe
   # cat=basic/enable; type=boolean; label=Use image folder: Enable the usage of imageFolder for the upload of images.
 useImageFolder = 0
-  # cat=basic/enable; type=string; label=Address table: Name of the address table to be used in the backend.
-addressTable = tt_address
+  # cat=basic/enable; type=string; label=Address table: Name of the address table to be used
+addressTable = tt_address
\ No newline at end of file
index 3ecc937..bbe3280 100644 (file)
@@ -19,7 +19,6 @@ $EM_CONF[$_EXTKEY] = array(
        'constraints' => 
        array(
                'depends' => array(
-                       'php' => '5.3.0-0.0.0',
                        'typo3' => '6.2.0-6.2.99',
                        'sr_feuser_register' => '4.0.0-4.99.99',
                        'tt_address' => '2.2.0-',
index fcdcfe2..78cbe19 100644 (file)
@@ -1,28 +1,6 @@
 <?php
 defined('TYPO3_MODE') or die();
 
-if (!defined ('SR_EMAIL_SUBSCRIBE_EXTkey')) {
-       define('SR_EMAIL_SUBSCRIBE_EXTkey', $_EXTKEY);
-}
-
-if (!defined ('PATH_BE_sremailsubscribe')) {
-       define('PATH_BE_sremailsubscribe', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(SR_EMAIL_SUBSCRIBE_EXTkey));
-}
-
-if (!defined ('PATH_BE_sremailsubscribe_rel')) {
-       define('PATH_BE_sremailsubscribe_rel', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath(SR_EMAIL_SUBSCRIBE_EXTkey));
-}
-
-if (!defined ('PATH_FE_sremailsubscribe_rel')) {
-       define('PATH_FE_sremailsubscribe_rel', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath(SR_EMAIL_SUBSCRIBE_EXTkey));
-}
-
-if (!defined ('SR_FEUSER_REGISTER_EXTkey')) {
-       define('SR_FEUSER_REGISTER_EXTkey','sr_feuser_register');
-}
-
-
-
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43($_EXTKEY, 'Classes/Controller/SubscribePluginController.php', '_pi1', 'list_type', 0);
 
 $_EXTCONF = unserialize($_EXTCONF);    // unserializing the configuration so we can use it here: