Changeset 2587510
- Timestamp:
- 08/24/2021 06:40:02 AM (5 years ago)
- Location:
- juvo-mail-editor
- Files:
-
- 10 added
- 6 deleted
- 28 edited
- 1 copied
-
tags/2.0.4 (copied) (copied from juvo-mail-editor/trunk)
-
tags/2.0.4/admin/Admin.php (modified) (2 diffs)
-
tags/2.0.4/admin/css (added)
-
tags/2.0.4/admin/css/options-page.css (added)
-
tags/2.0.4/admin/js (added)
-
tags/2.0.4/admin/js/ajax.js (added)
-
tags/2.0.4/juvo-mail-editor.php (modified) (1 diff)
-
tags/2.0.4/readme.md (deleted)
-
tags/2.0.4/readme.txt (modified) (1 diff)
-
tags/2.0.4/src/Mail_Editor.php (modified) (2 diffs)
-
tags/2.0.4/src/Mail_Trigger_TAX.php (modified) (3 diffs)
-
tags/2.0.4/src/Mails/Password_Reset.php (modified) (1 diff)
-
tags/2.0.4/src/Mails_PT.php (modified) (2 diffs)
-
tags/2.0.4/src/Options_Page.php (added)
-
tags/2.0.4/src/Relay.php (modified) (3 diffs)
-
tags/2.0.4/vendor/autoload.php (modified) (1 diff)
-
tags/2.0.4/vendor/composer/autoload_psr4.php (modified) (1 diff)
-
tags/2.0.4/vendor/composer/autoload_real.php (modified) (5 diffs)
-
tags/2.0.4/vendor/composer/autoload_static.php (modified) (4 diffs)
-
tags/2.0.4/vendor/composer/installed.json (modified) (2 diffs)
-
tags/2.0.4/vendor/composer/installed.php (modified) (3 diffs)
-
tags/2.0.4/vendor/juvo (deleted)
-
tags/2.0.4/vendor/wptrt (deleted)
-
trunk/admin/Admin.php (modified) (2 diffs)
-
trunk/admin/css (added)
-
trunk/admin/css/options-page.css (added)
-
trunk/admin/js (added)
-
trunk/admin/js/ajax.js (added)
-
trunk/juvo-mail-editor.php (modified) (1 diff)
-
trunk/readme.md (deleted)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/src/Mail_Editor.php (modified) (2 diffs)
-
trunk/src/Mail_Trigger_TAX.php (modified) (3 diffs)
-
trunk/src/Mails/Password_Reset.php (modified) (1 diff)
-
trunk/src/Mails_PT.php (modified) (2 diffs)
-
trunk/src/Options_Page.php (added)
-
trunk/src/Relay.php (modified) (3 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_psr4.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (5 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (4 diffs)
-
trunk/vendor/composer/installed.json (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (3 diffs)
-
trunk/vendor/juvo (deleted)
-
trunk/vendor/wptrt (deleted)
Legend:
- Unmodified
- Added
- Removed
-
juvo-mail-editor/tags/2.0.4/admin/Admin.php
r2578743 r2587510 54 54 */ 55 55 56 //wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/mail-preview.css', array(), $this->version, 'all' );56 wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/options-page.css', array(), null, 'all' ); 57 57 58 58 } … … 77 77 */ 78 78 79 //wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/mail-preview.js', array( 'jquery' ), $this->version, true );79 wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/ajax.js', array( 'jquery' ), null, true ); 80 80 81 81 } -
juvo-mail-editor/tags/2.0.4/juvo-mail-editor.php
r2578743 r2587510 8 8 * Text Domain: juvo-mail-editor 9 9 * Domain Path: /languages 10 * Version: 2.0. 310 * Version: 2.0.4 11 11 */ 12 12 -
juvo-mail-editor/tags/2.0.4/readme.txt
r2578743 r2587510 4 4 License: GPLv2 or later 5 5 Tested up to: 5.8 6 Stable tag: 2.0. 36 Stable tag: 2.0.4 7 7 8 8 JUVO Mail Editor helps to modify the standard WordPress Mailings and allows adding dynamic mail triggers. -
juvo-mail-editor/tags/2.0.4/src/Mail_Editor.php
r2578743 r2587510 96 96 97 97 /** 98 * Options 99 */ 100 $options = new Options_Page(); 101 $this->loader->add_action( 'cmb2_admin_init', $options, 'yourprefix_register_options_submenu_for_page_post_type' ); 102 $this->loader->add_action( 'wp_ajax_juvo-mail-editor-sync-triggers', $options, "ajax_sync_triggers" ); 103 104 /** 98 105 * Post Type 99 106 */ … … 108 115 $tax = new Mail_Trigger_TAX(); 109 116 $this->loader->add_action( 'init', $tax, 'registerTaxonomy' ); 110 $this->loader->add_action( 'juvo_mail_editor_trigger_init', $tax, 'registerTrigger' ); 111 $this->loader->add_action( 'admin_init', $tax, 'registerTrigger' ); 117 $this->loader->add_action( 'juvo_mail_editor_trigger_init', $tax, 'registerTrigger' ); // Called by trigger 112 118 $this->loader->add_action( 'cmb2_admin_init', $tax, 'addMetaboxes' ); 113 114 119 115 120 /** -
juvo-mail-editor/tags/2.0.4/src/Mail_Trigger_TAX.php
r2578743 r2587510 4 4 namespace JUVO_MailEditor; 5 5 6 7 use WP_Error; 6 8 7 9 class Mail_Trigger_TAX { … … 88 90 } 89 91 92 /** 93 * @return void|WP_Error 94 */ 90 95 public function registerTrigger() { 91 96 92 97 $triggers = []; 98 $errors = new WP_Error(); 93 99 94 100 $triggers = apply_filters( "juvo_mail_editor_trigger", $triggers ); … … 97 103 98 104 if ( ! $trigger instanceof Trigger ) { 99 error_log( "[juvo_mail_editor]:Provided trigger is no instance of JUVO_MailEditor\Trigger and therefore skipped" );105 $errors->add( "juvo_mail_editor_invalid_trigger", "Provided trigger is no instance of JUVO_MailEditor\Trigger and therefore skipped" ); 100 106 continue; 101 107 } 102 108 109 // Create or Update Term 103 110 $term = get_term_by( 'slug', $trigger->getSlug(), self::TAXONOMY_NAME ); 104 105 $term_id = null;106 111 if ( ! $term ) { 107 $term_id = wp_insert_term( $trigger->getName(), self::TAXONOMY_NAME, [ "slug" => $trigger->getSlug() ] )["term_id"]; 112 $term = wp_insert_term( 113 $trigger->getName(), 114 self::TAXONOMY_NAME, 115 [ "slug" => $trigger->getSlug() ] 116 ); 108 117 } else { 109 $term_id = $term->term_id; 118 $term = wp_update_term( $term->term_id, self::TAXONOMY_NAME, array( 119 'name' => $trigger->getName(), 120 'slug' => $trigger->getSlug() 121 ) ); 110 122 } 111 112 // Verify Slug or mail 113 if ( empty( $trigger->getName() ) || empty( $trigger->getSlug() ) ) { 114 error_log( "[juvo_mail_editor]: Slug or Name are empty" ); 123 if ( is_wp_error( $term ) ) { 124 $errors->add( "juvo_mail_editor_term_error", $term->get_error_message() ); 115 125 continue; 116 126 } 117 127 118 $term_id = wp_update_term( $term_id, self::TAXONOMY_NAME, array( 119 'name' => $trigger->getName(), 120 'slug' => $trigger->getSlug() 121 ) )["term_id"]; 128 // wp_insert_term returns an error while wp_update_term return an instance of WP_Term... thanks for nothing 129 // normalize $term to be the term_id 130 if ( is_array( $term ) ) { 131 $term = $term["term_id"]; 132 } else { // @phpstan-ignore-line 133 $term = $term->term_id; 134 } 122 135 123 update_term_meta( $term_id, self::TAXONOMY_NAME . "_always_send", $trigger->isAlwaysSent() ); 124 update_term_meta( $term_id, self::TAXONOMY_NAME . "_default_recipients", $trigger->getRecipients() ); 125 update_term_meta( $term_id, self::TAXONOMY_NAME . "_default_subject", $trigger->getSubject() ); 126 update_term_meta( $term_id, self::TAXONOMY_NAME . "_default_content", $trigger->getContent() ); 127 update_term_meta( $term_id, self::TAXONOMY_NAME . "_placeholders", $trigger->getPlaceholders() ); 136 // Update meta and log errors 137 update_term_meta( $term, self::TAXONOMY_NAME . "_always_send", $trigger->isAlwaysSent() ); 138 update_term_meta( $term, self::TAXONOMY_NAME . "_default_recipients", $trigger->getRecipients() ); 139 update_term_meta( $term, self::TAXONOMY_NAME . "_default_subject", $trigger->getSubject() ); 140 update_term_meta( $term, self::TAXONOMY_NAME . "_default_content", $trigger->getContent() ); 141 update_term_meta( $term, self::TAXONOMY_NAME . "_placeholders", $trigger->getPlaceholders() ); 142 } 128 143 144 foreach ( $errors->get_error_messages() as $error ) { 145 error_log( "[juvo_mail_editor]: {$error}" ); 129 146 } 147 148 return $errors; 130 149 131 150 } -
juvo-mail-editor/tags/2.0.4/src/Mails/Password_Reset.php
r2578743 r2587510 20 20 21 21 function password_reset_email_message( string $message, string $key, string $user_login, WP_User $user ): string { 22 23 $this->setPlaceholderValues($user, ["key"=>$key]); 22 24 23 25 $relay = new Relay( $this->getTrigger(), $this->placeholders, $user ); -
juvo-mail-editor/tags/2.0.4/src/Mails_PT.php
r2578743 r2587510 41 41 'hierarchical' => false, 42 42 'menu_position' => null, 43 'supports' => array( 'title', 'editor', 'author', 'revisions', 'custom-fields' ), 44 'show_in_rest' => true 43 'supports' => array( 'title', 'editor', 'author', 'revisions' ), 44 'show_in_rest' => true, 45 'menu_icon' => 'dashicons-email' 45 46 ); 46 47 … … 77 78 ) ); 78 79 79 // Same way the post_status works80 // $cmb->add_field( array(81 // 'name' => __( 'Active', 'juvo-mail-editor' ),82 // 'desc' => __( 'Determines if this mail template should be used for the trigger', 'juvo-mail-editor' ),83 // 'id' => self::POST_TYPE_NAME . '_active',84 // 'type' => 'checkbox',85 // 'default' => true,86 // 'column' => true,87 // ) );88 89 80 $cmb->add_field( array( 90 'name' => __( 'Recipients', 'juvo-mail-editor' ), 91 'desc' => __( 'Comma seperated list of mail addresses<br><code>{{CONTEXT}}</code><code>{{ADMIN_EMAIL}}</code>', 'juvo-mail-editor' ), 92 'id' => self::POST_TYPE_NAME . '_recipients', 93 'type' => 'text', 81 'name' => __( 'Recipients', 'juvo-mail-editor' ), 82 'desc' => __( 'Comma seperated list of mail addresses<br><code>{{CONTEXT}}</code><code>{{ADMIN_EMAIL}}</code>', 'juvo-mail-editor' ), 83 'id' => self::POST_TYPE_NAME . '_recipients', 84 'type' => 'text', 85 'column' => true, 94 86 ) ); 95 87 96 88 $cmb->add_field( array( 97 'name' => __( 'Subject', 'juvo-mail-editor' ), 98 'desc' => __( 'E-Mail subject', 'juvo-mail-editor' ), 99 'id' => self::POST_TYPE_NAME . '_subject', 100 'type' => 'text', 89 'name' => __( 'Subject', 'juvo-mail-editor' ), 90 'desc' => __( 'E-Mail subject', 'juvo-mail-editor' ), 91 'id' => self::POST_TYPE_NAME . '_subject', 92 'type' => 'text', 93 'column' => true, 101 94 ) ); 102 95 -
juvo-mail-editor/tags/2.0.4/src/Relay.php
r2578743 r2587510 39 39 * @param string $trigger 40 40 * @param array $placeholders 41 * @param mixed $context 41 42 */ 42 43 public function __construct( string $trigger, array $placeholders, $context = null ) { … … 178 179 $subject = apply_filters( "juvo_mail_editor_before_subject_placeholder", $subject, $this->trigger, $this->context ); 179 180 $subject = Placeholder::replacePlaceholder( $this->placeholders, $subject, $this->context ); 180 $subject = apply_filters( "juvo_mail_editor_after_subject_placeholder", $subject, $this->trigger, $this->context ); 181 182 return $subject; 181 182 return apply_filters( "juvo_mail_editor_after_subject_placeholder", $subject, $this->trigger, $this->context ); 183 183 } 184 184 … … 200 200 } 201 201 $recipients = Placeholder::replacePlaceholder( $placeholders, $recipients, $this->context ); 202 $recipients = apply_filters( "juvo_mail_editor_after_recipient_placeholder", $recipients, $this->trigger, $this->context ); 203 204 return $recipients; 202 203 return apply_filters( "juvo_mail_editor_after_recipient_placeholder", $recipients, $this->trigger, $this->context ); 205 204 } 206 205 -
juvo-mail-editor/tags/2.0.4/vendor/autoload.php
r2578760 r2587510 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit d81e8c0431ed8f64bf4ad6a36464f4ef::getLoader();7 return ComposerAutoloaderInitf63f9541b6a428f4859c2a7f96e49e21::getLoader(); -
juvo-mail-editor/tags/2.0.4/vendor/composer/autoload_psr4.php
r2578760 r2587510 7 7 8 8 return array( 9 'juvo\\WordPressAdminNotices\\' => array($vendorDir . '/juvo/wp-admin-notices/src'),10 'WPTRT\\AdminNotices\\' => array($vendorDir . '/wptrt/admin-notices/src'),11 9 'SzepeViktor\\PHPStan\\WordPress\\' => array($vendorDir . '/szepeviktor/phpstan-wordpress/src'), 12 10 'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'), -
juvo-mail-editor/tags/2.0.4/vendor/composer/autoload_real.php
r2578760 r2587510 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit d81e8c0431ed8f64bf4ad6a36464f4ef5 class ComposerAutoloaderInitf63f9541b6a428f4859c2a7f96e49e21 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit d81e8c0431ed8f64bf4ad6a36464f4ef', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitf63f9541b6a428f4859c2a7f96e49e21', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInit d81e8c0431ed8f64bf4ad6a36464f4ef', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitf63f9541b6a428f4859c2a7f96e49e21', 'loadClassLoader')); 30 30 31 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 33 33 require __DIR__ . '/autoload_static.php'; 34 34 35 call_user_func(\Composer\Autoload\ComposerStaticInit d81e8c0431ed8f64bf4ad6a36464f4ef::getInitializer($loader));35 call_user_func(\Composer\Autoload\ComposerStaticInitf63f9541b6a428f4859c2a7f96e49e21::getInitializer($loader)); 36 36 } else { 37 37 $map = require __DIR__ . '/autoload_namespaces.php'; … … 54 54 55 55 if ($useStaticLoader) { 56 $includeFiles = Composer\Autoload\ComposerStaticInit d81e8c0431ed8f64bf4ad6a36464f4ef::$files;56 $includeFiles = Composer\Autoload\ComposerStaticInitf63f9541b6a428f4859c2a7f96e49e21::$files; 57 57 } else { 58 58 $includeFiles = require __DIR__ . '/autoload_files.php'; 59 59 } 60 60 foreach ($includeFiles as $fileIdentifier => $file) { 61 composerRequire d81e8c0431ed8f64bf4ad6a36464f4ef($fileIdentifier, $file);61 composerRequiref63f9541b6a428f4859c2a7f96e49e21($fileIdentifier, $file); 62 62 } 63 63 … … 66 66 } 67 67 68 function composerRequire d81e8c0431ed8f64bf4ad6a36464f4ef($fileIdentifier, $file)68 function composerRequiref63f9541b6a428f4859c2a7f96e49e21($fileIdentifier, $file) 69 69 { 70 70 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
juvo-mail-editor/tags/2.0.4/vendor/composer/autoload_static.php
r2578760 r2587510 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit d81e8c0431ed8f64bf4ad6a36464f4ef7 class ComposerStaticInitf63f9541b6a428f4859c2a7f96e49e21 8 8 { 9 9 public static $files = array ( … … 14 14 15 15 public static $prefixLengthsPsr4 = array ( 16 'j' =>17 array (18 'juvo\\WordPressAdminNotices\\' => 27,19 ),20 'W' =>21 array (22 'WPTRT\\AdminNotices\\' => 19,23 ),24 16 'S' => 25 17 array ( … … 43 35 44 36 public static $prefixDirsPsr4 = array ( 45 'juvo\\WordPressAdminNotices\\' =>46 array (47 0 => __DIR__ . '/..' . '/juvo/wp-admin-notices/src',48 ),49 'WPTRT\\AdminNotices\\' =>50 array (51 0 => __DIR__ . '/..' . '/wptrt/admin-notices/src',52 ),53 37 'SzepeViktor\\PHPStan\\WordPress\\' => 54 38 array ( … … 85 69 { 86 70 return \Closure::bind(function () use ($loader) { 87 $loader->prefixLengthsPsr4 = ComposerStaticInit d81e8c0431ed8f64bf4ad6a36464f4ef::$prefixLengthsPsr4;88 $loader->prefixDirsPsr4 = ComposerStaticInit d81e8c0431ed8f64bf4ad6a36464f4ef::$prefixDirsPsr4;89 $loader->classMap = ComposerStaticInit d81e8c0431ed8f64bf4ad6a36464f4ef::$classMap;71 $loader->prefixLengthsPsr4 = ComposerStaticInitf63f9541b6a428f4859c2a7f96e49e21::$prefixLengthsPsr4; 72 $loader->prefixDirsPsr4 = ComposerStaticInitf63f9541b6a428f4859c2a7f96e49e21::$prefixDirsPsr4; 73 $loader->classMap = ComposerStaticInitf63f9541b6a428f4859c2a7f96e49e21::$classMap; 90 74 91 75 }, null, ClassLoader::class); -
juvo-mail-editor/tags/2.0.4/vendor/composer/installed.json
r2578760 r2587510 61 61 }, 62 62 "install-path": "../cmb2/cmb2" 63 },64 {65 "name": "juvo/wp-admin-notices",66 "version": "v1.0.2",67 "version_normalized": "1.0.2.0",68 "source": {69 "type": "git",70 "url": "https://github.com/JUVOJustin/wp-admin-notices.git",71 "reference": "53129ec20d2bef9aac6291638d924a44fa7781c4"72 },73 "dist": {74 "type": "zip",75 "url": "https://api.github.com/repos/JUVOJustin/wp-admin-notices/zipball/53129ec20d2bef9aac6291638d924a44fa7781c4",76 "reference": "53129ec20d2bef9aac6291638d924a44fa7781c4",77 "shasum": ""78 },79 "require": {80 "php": ">=7.0.0",81 "wptrt/admin-notices": "^1.0"82 },83 "time": "2020-11-23T09:36:17+00:00",84 "type": "library",85 "installation-source": "dist",86 "autoload": {87 "psr-4": {88 "juvo\\WordPressAdminNotices\\": "src/"89 }90 },91 "notification-url": "https://packagist.org/downloads/",92 "authors": [93 {94 "name": "Justin Vogt",95 "email": "[email protected]",96 "homepage": "https://juvo-design.de"97 }98 ],99 "description": "Adds a wrapper layer to store notices for wptrt/admin-notices",100 "keywords": [101 "notices",102 "wordpress",103 "wptrt"104 ],105 "support": {106 "issues": "https://github.com/JUVOJustin/wp-admin-notices/issues",107 "source": "https://github.com/JUVOJustin/wp-admin-notices/tree/v1.0.2"108 },109 "install-path": "../juvo/wp-admin-notices"110 63 }, 111 64 { … … 573 526 ], 574 527 "install-path": "../szepeviktor/phpstan-wordpress" 575 },576 {577 "name": "wptrt/admin-notices",578 "version": "v1.0.3",579 "version_normalized": "1.0.3.0",580 "source": {581 "type": "git",582 "url": "https://github.com/WPTT/admin-notices.git",583 "reference": "3904e0dc087b48289056a77eea3d1dab4ef0dde1"584 },585 "dist": {586 "type": "zip",587 "url": "https://api.github.com/repos/WPTT/admin-notices/zipball/3904e0dc087b48289056a77eea3d1dab4ef0dde1",588 "reference": "3904e0dc087b48289056a77eea3d1dab4ef0dde1",589 "shasum": ""590 },591 "require": {592 "php": ">=5.6"593 },594 "time": "2020-02-15T10:34:51+00:00",595 "type": "library",596 "installation-source": "dist",597 "autoload": {598 "psr-4": {599 "WPTRT\\AdminNotices\\": "src/"600 }601 },602 "notification-url": "https://packagist.org/downloads/",603 "license": [604 "GPL-2.0-or-later"605 ],606 "authors": [607 {608 "name": "WordPress.org Theme Review Team",609 "email": "[email protected]",610 "homepage": "https://make.wordpress.org/themes",611 "role": "Developer"612 }613 ],614 "description": "A class to create admin-notices for the WordPress dashboard.",615 "homepage": "https://github.com/WPTRT/admin-notices",616 "keywords": [617 "wordpress"618 ],619 "support": {620 "issues": "https://github.com/WPTRT/admin-notices/issues",621 "source": "https://github.com/WPTT/admin-notices/tree/v1.0.3"622 },623 "install-path": "../wptrt/admin-notices"624 528 } 625 529 ], -
juvo-mail-editor/tags/2.0.4/vendor/composer/installed.php
r2578760 r2587510 6 6 'install_path' => __DIR__ . '/../../', 7 7 'aliases' => array(), 8 'reference' => ' c80c30d81787c927c36cb4f6ef4e6cc1ead4587a',8 'reference' => 'ec729b7b920038180c08b479a32b1c43f785e26c', 9 9 'name' => 'juvo/mail-editor', 10 10 'dev' => true, … … 32 32 'install_path' => __DIR__ . '/../../', 33 33 'aliases' => array(), 34 'reference' => 'c80c30d81787c927c36cb4f6ef4e6cc1ead4587a', 35 'dev_requirement' => false, 36 ), 37 'juvo/wp-admin-notices' => array( 38 'pretty_version' => 'v1.0.2', 39 'version' => '1.0.2.0', 40 'type' => 'library', 41 'install_path' => __DIR__ . '/../juvo/wp-admin-notices', 42 'aliases' => array(), 43 'reference' => '53129ec20d2bef9aac6291638d924a44fa7781c4', 34 'reference' => 'ec729b7b920038180c08b479a32b1c43f785e26c', 44 35 'dev_requirement' => false, 45 36 ), … … 116 107 'dev_requirement' => true, 117 108 ), 118 'wptrt/admin-notices' => array(119 'pretty_version' => 'v1.0.3',120 'version' => '1.0.3.0',121 'type' => 'library',122 'install_path' => __DIR__ . '/../wptrt/admin-notices',123 'aliases' => array(),124 'reference' => '3904e0dc087b48289056a77eea3d1dab4ef0dde1',125 'dev_requirement' => false,126 ),127 109 ), 128 110 ); -
juvo-mail-editor/trunk/admin/Admin.php
r2578743 r2587510 54 54 */ 55 55 56 //wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/mail-preview.css', array(), $this->version, 'all' );56 wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/options-page.css', array(), null, 'all' ); 57 57 58 58 } … … 77 77 */ 78 78 79 //wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/mail-preview.js', array( 'jquery' ), $this->version, true );79 wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/ajax.js', array( 'jquery' ), null, true ); 80 80 81 81 } -
juvo-mail-editor/trunk/juvo-mail-editor.php
r2578743 r2587510 8 8 * Text Domain: juvo-mail-editor 9 9 * Domain Path: /languages 10 * Version: 2.0. 310 * Version: 2.0.4 11 11 */ 12 12 -
juvo-mail-editor/trunk/readme.txt
r2578743 r2587510 4 4 License: GPLv2 or later 5 5 Tested up to: 5.8 6 Stable tag: 2.0. 36 Stable tag: 2.0.4 7 7 8 8 JUVO Mail Editor helps to modify the standard WordPress Mailings and allows adding dynamic mail triggers. -
juvo-mail-editor/trunk/src/Mail_Editor.php
r2578743 r2587510 96 96 97 97 /** 98 * Options 99 */ 100 $options = new Options_Page(); 101 $this->loader->add_action( 'cmb2_admin_init', $options, 'yourprefix_register_options_submenu_for_page_post_type' ); 102 $this->loader->add_action( 'wp_ajax_juvo-mail-editor-sync-triggers', $options, "ajax_sync_triggers" ); 103 104 /** 98 105 * Post Type 99 106 */ … … 108 115 $tax = new Mail_Trigger_TAX(); 109 116 $this->loader->add_action( 'init', $tax, 'registerTaxonomy' ); 110 $this->loader->add_action( 'juvo_mail_editor_trigger_init', $tax, 'registerTrigger' ); 111 $this->loader->add_action( 'admin_init', $tax, 'registerTrigger' ); 117 $this->loader->add_action( 'juvo_mail_editor_trigger_init', $tax, 'registerTrigger' ); // Called by trigger 112 118 $this->loader->add_action( 'cmb2_admin_init', $tax, 'addMetaboxes' ); 113 114 119 115 120 /** -
juvo-mail-editor/trunk/src/Mail_Trigger_TAX.php
r2578743 r2587510 4 4 namespace JUVO_MailEditor; 5 5 6 7 use WP_Error; 6 8 7 9 class Mail_Trigger_TAX { … … 88 90 } 89 91 92 /** 93 * @return void|WP_Error 94 */ 90 95 public function registerTrigger() { 91 96 92 97 $triggers = []; 98 $errors = new WP_Error(); 93 99 94 100 $triggers = apply_filters( "juvo_mail_editor_trigger", $triggers ); … … 97 103 98 104 if ( ! $trigger instanceof Trigger ) { 99 error_log( "[juvo_mail_editor]:Provided trigger is no instance of JUVO_MailEditor\Trigger and therefore skipped" );105 $errors->add( "juvo_mail_editor_invalid_trigger", "Provided trigger is no instance of JUVO_MailEditor\Trigger and therefore skipped" ); 100 106 continue; 101 107 } 102 108 109 // Create or Update Term 103 110 $term = get_term_by( 'slug', $trigger->getSlug(), self::TAXONOMY_NAME ); 104 105 $term_id = null;106 111 if ( ! $term ) { 107 $term_id = wp_insert_term( $trigger->getName(), self::TAXONOMY_NAME, [ "slug" => $trigger->getSlug() ] )["term_id"]; 112 $term = wp_insert_term( 113 $trigger->getName(), 114 self::TAXONOMY_NAME, 115 [ "slug" => $trigger->getSlug() ] 116 ); 108 117 } else { 109 $term_id = $term->term_id; 118 $term = wp_update_term( $term->term_id, self::TAXONOMY_NAME, array( 119 'name' => $trigger->getName(), 120 'slug' => $trigger->getSlug() 121 ) ); 110 122 } 111 112 // Verify Slug or mail 113 if ( empty( $trigger->getName() ) || empty( $trigger->getSlug() ) ) { 114 error_log( "[juvo_mail_editor]: Slug or Name are empty" ); 123 if ( is_wp_error( $term ) ) { 124 $errors->add( "juvo_mail_editor_term_error", $term->get_error_message() ); 115 125 continue; 116 126 } 117 127 118 $term_id = wp_update_term( $term_id, self::TAXONOMY_NAME, array( 119 'name' => $trigger->getName(), 120 'slug' => $trigger->getSlug() 121 ) )["term_id"]; 128 // wp_insert_term returns an error while wp_update_term return an instance of WP_Term... thanks for nothing 129 // normalize $term to be the term_id 130 if ( is_array( $term ) ) { 131 $term = $term["term_id"]; 132 } else { // @phpstan-ignore-line 133 $term = $term->term_id; 134 } 122 135 123 update_term_meta( $term_id, self::TAXONOMY_NAME . "_always_send", $trigger->isAlwaysSent() ); 124 update_term_meta( $term_id, self::TAXONOMY_NAME . "_default_recipients", $trigger->getRecipients() ); 125 update_term_meta( $term_id, self::TAXONOMY_NAME . "_default_subject", $trigger->getSubject() ); 126 update_term_meta( $term_id, self::TAXONOMY_NAME . "_default_content", $trigger->getContent() ); 127 update_term_meta( $term_id, self::TAXONOMY_NAME . "_placeholders", $trigger->getPlaceholders() ); 136 // Update meta and log errors 137 update_term_meta( $term, self::TAXONOMY_NAME . "_always_send", $trigger->isAlwaysSent() ); 138 update_term_meta( $term, self::TAXONOMY_NAME . "_default_recipients", $trigger->getRecipients() ); 139 update_term_meta( $term, self::TAXONOMY_NAME . "_default_subject", $trigger->getSubject() ); 140 update_term_meta( $term, self::TAXONOMY_NAME . "_default_content", $trigger->getContent() ); 141 update_term_meta( $term, self::TAXONOMY_NAME . "_placeholders", $trigger->getPlaceholders() ); 142 } 128 143 144 foreach ( $errors->get_error_messages() as $error ) { 145 error_log( "[juvo_mail_editor]: {$error}" ); 129 146 } 147 148 return $errors; 130 149 131 150 } -
juvo-mail-editor/trunk/src/Mails/Password_Reset.php
r2578743 r2587510 20 20 21 21 function password_reset_email_message( string $message, string $key, string $user_login, WP_User $user ): string { 22 23 $this->setPlaceholderValues($user, ["key"=>$key]); 22 24 23 25 $relay = new Relay( $this->getTrigger(), $this->placeholders, $user ); -
juvo-mail-editor/trunk/src/Mails_PT.php
r2578743 r2587510 41 41 'hierarchical' => false, 42 42 'menu_position' => null, 43 'supports' => array( 'title', 'editor', 'author', 'revisions', 'custom-fields' ), 44 'show_in_rest' => true 43 'supports' => array( 'title', 'editor', 'author', 'revisions' ), 44 'show_in_rest' => true, 45 'menu_icon' => 'dashicons-email' 45 46 ); 46 47 … … 77 78 ) ); 78 79 79 // Same way the post_status works80 // $cmb->add_field( array(81 // 'name' => __( 'Active', 'juvo-mail-editor' ),82 // 'desc' => __( 'Determines if this mail template should be used for the trigger', 'juvo-mail-editor' ),83 // 'id' => self::POST_TYPE_NAME . '_active',84 // 'type' => 'checkbox',85 // 'default' => true,86 // 'column' => true,87 // ) );88 89 80 $cmb->add_field( array( 90 'name' => __( 'Recipients', 'juvo-mail-editor' ), 91 'desc' => __( 'Comma seperated list of mail addresses<br><code>{{CONTEXT}}</code><code>{{ADMIN_EMAIL}}</code>', 'juvo-mail-editor' ), 92 'id' => self::POST_TYPE_NAME . '_recipients', 93 'type' => 'text', 81 'name' => __( 'Recipients', 'juvo-mail-editor' ), 82 'desc' => __( 'Comma seperated list of mail addresses<br><code>{{CONTEXT}}</code><code>{{ADMIN_EMAIL}}</code>', 'juvo-mail-editor' ), 83 'id' => self::POST_TYPE_NAME . '_recipients', 84 'type' => 'text', 85 'column' => true, 94 86 ) ); 95 87 96 88 $cmb->add_field( array( 97 'name' => __( 'Subject', 'juvo-mail-editor' ), 98 'desc' => __( 'E-Mail subject', 'juvo-mail-editor' ), 99 'id' => self::POST_TYPE_NAME . '_subject', 100 'type' => 'text', 89 'name' => __( 'Subject', 'juvo-mail-editor' ), 90 'desc' => __( 'E-Mail subject', 'juvo-mail-editor' ), 91 'id' => self::POST_TYPE_NAME . '_subject', 92 'type' => 'text', 93 'column' => true, 101 94 ) ); 102 95 -
juvo-mail-editor/trunk/src/Relay.php
r2578743 r2587510 39 39 * @param string $trigger 40 40 * @param array $placeholders 41 * @param mixed $context 41 42 */ 42 43 public function __construct( string $trigger, array $placeholders, $context = null ) { … … 178 179 $subject = apply_filters( "juvo_mail_editor_before_subject_placeholder", $subject, $this->trigger, $this->context ); 179 180 $subject = Placeholder::replacePlaceholder( $this->placeholders, $subject, $this->context ); 180 $subject = apply_filters( "juvo_mail_editor_after_subject_placeholder", $subject, $this->trigger, $this->context ); 181 182 return $subject; 181 182 return apply_filters( "juvo_mail_editor_after_subject_placeholder", $subject, $this->trigger, $this->context ); 183 183 } 184 184 … … 200 200 } 201 201 $recipients = Placeholder::replacePlaceholder( $placeholders, $recipients, $this->context ); 202 $recipients = apply_filters( "juvo_mail_editor_after_recipient_placeholder", $recipients, $this->trigger, $this->context ); 203 204 return $recipients; 202 203 return apply_filters( "juvo_mail_editor_after_recipient_placeholder", $recipients, $this->trigger, $this->context ); 205 204 } 206 205 -
juvo-mail-editor/trunk/vendor/autoload.php
r2578760 r2587510 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit d81e8c0431ed8f64bf4ad6a36464f4ef::getLoader();7 return ComposerAutoloaderInitf63f9541b6a428f4859c2a7f96e49e21::getLoader(); -
juvo-mail-editor/trunk/vendor/composer/autoload_psr4.php
r2578760 r2587510 7 7 8 8 return array( 9 'juvo\\WordPressAdminNotices\\' => array($vendorDir . '/juvo/wp-admin-notices/src'),10 'WPTRT\\AdminNotices\\' => array($vendorDir . '/wptrt/admin-notices/src'),11 9 'SzepeViktor\\PHPStan\\WordPress\\' => array($vendorDir . '/szepeviktor/phpstan-wordpress/src'), 12 10 'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'), -
juvo-mail-editor/trunk/vendor/composer/autoload_real.php
r2578760 r2587510 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit d81e8c0431ed8f64bf4ad6a36464f4ef5 class ComposerAutoloaderInitf63f9541b6a428f4859c2a7f96e49e21 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit d81e8c0431ed8f64bf4ad6a36464f4ef', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitf63f9541b6a428f4859c2a7f96e49e21', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInit d81e8c0431ed8f64bf4ad6a36464f4ef', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitf63f9541b6a428f4859c2a7f96e49e21', 'loadClassLoader')); 30 30 31 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 33 33 require __DIR__ . '/autoload_static.php'; 34 34 35 call_user_func(\Composer\Autoload\ComposerStaticInit d81e8c0431ed8f64bf4ad6a36464f4ef::getInitializer($loader));35 call_user_func(\Composer\Autoload\ComposerStaticInitf63f9541b6a428f4859c2a7f96e49e21::getInitializer($loader)); 36 36 } else { 37 37 $map = require __DIR__ . '/autoload_namespaces.php'; … … 54 54 55 55 if ($useStaticLoader) { 56 $includeFiles = Composer\Autoload\ComposerStaticInit d81e8c0431ed8f64bf4ad6a36464f4ef::$files;56 $includeFiles = Composer\Autoload\ComposerStaticInitf63f9541b6a428f4859c2a7f96e49e21::$files; 57 57 } else { 58 58 $includeFiles = require __DIR__ . '/autoload_files.php'; 59 59 } 60 60 foreach ($includeFiles as $fileIdentifier => $file) { 61 composerRequire d81e8c0431ed8f64bf4ad6a36464f4ef($fileIdentifier, $file);61 composerRequiref63f9541b6a428f4859c2a7f96e49e21($fileIdentifier, $file); 62 62 } 63 63 … … 66 66 } 67 67 68 function composerRequire d81e8c0431ed8f64bf4ad6a36464f4ef($fileIdentifier, $file)68 function composerRequiref63f9541b6a428f4859c2a7f96e49e21($fileIdentifier, $file) 69 69 { 70 70 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
juvo-mail-editor/trunk/vendor/composer/autoload_static.php
r2578760 r2587510 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit d81e8c0431ed8f64bf4ad6a36464f4ef7 class ComposerStaticInitf63f9541b6a428f4859c2a7f96e49e21 8 8 { 9 9 public static $files = array ( … … 14 14 15 15 public static $prefixLengthsPsr4 = array ( 16 'j' =>17 array (18 'juvo\\WordPressAdminNotices\\' => 27,19 ),20 'W' =>21 array (22 'WPTRT\\AdminNotices\\' => 19,23 ),24 16 'S' => 25 17 array ( … … 43 35 44 36 public static $prefixDirsPsr4 = array ( 45 'juvo\\WordPressAdminNotices\\' =>46 array (47 0 => __DIR__ . '/..' . '/juvo/wp-admin-notices/src',48 ),49 'WPTRT\\AdminNotices\\' =>50 array (51 0 => __DIR__ . '/..' . '/wptrt/admin-notices/src',52 ),53 37 'SzepeViktor\\PHPStan\\WordPress\\' => 54 38 array ( … … 85 69 { 86 70 return \Closure::bind(function () use ($loader) { 87 $loader->prefixLengthsPsr4 = ComposerStaticInit d81e8c0431ed8f64bf4ad6a36464f4ef::$prefixLengthsPsr4;88 $loader->prefixDirsPsr4 = ComposerStaticInit d81e8c0431ed8f64bf4ad6a36464f4ef::$prefixDirsPsr4;89 $loader->classMap = ComposerStaticInit d81e8c0431ed8f64bf4ad6a36464f4ef::$classMap;71 $loader->prefixLengthsPsr4 = ComposerStaticInitf63f9541b6a428f4859c2a7f96e49e21::$prefixLengthsPsr4; 72 $loader->prefixDirsPsr4 = ComposerStaticInitf63f9541b6a428f4859c2a7f96e49e21::$prefixDirsPsr4; 73 $loader->classMap = ComposerStaticInitf63f9541b6a428f4859c2a7f96e49e21::$classMap; 90 74 91 75 }, null, ClassLoader::class); -
juvo-mail-editor/trunk/vendor/composer/installed.json
r2578760 r2587510 61 61 }, 62 62 "install-path": "../cmb2/cmb2" 63 },64 {65 "name": "juvo/wp-admin-notices",66 "version": "v1.0.2",67 "version_normalized": "1.0.2.0",68 "source": {69 "type": "git",70 "url": "https://github.com/JUVOJustin/wp-admin-notices.git",71 "reference": "53129ec20d2bef9aac6291638d924a44fa7781c4"72 },73 "dist": {74 "type": "zip",75 "url": "https://api.github.com/repos/JUVOJustin/wp-admin-notices/zipball/53129ec20d2bef9aac6291638d924a44fa7781c4",76 "reference": "53129ec20d2bef9aac6291638d924a44fa7781c4",77 "shasum": ""78 },79 "require": {80 "php": ">=7.0.0",81 "wptrt/admin-notices": "^1.0"82 },83 "time": "2020-11-23T09:36:17+00:00",84 "type": "library",85 "installation-source": "dist",86 "autoload": {87 "psr-4": {88 "juvo\\WordPressAdminNotices\\": "src/"89 }90 },91 "notification-url": "https://packagist.org/downloads/",92 "authors": [93 {94 "name": "Justin Vogt",95 "email": "[email protected]",96 "homepage": "https://juvo-design.de"97 }98 ],99 "description": "Adds a wrapper layer to store notices for wptrt/admin-notices",100 "keywords": [101 "notices",102 "wordpress",103 "wptrt"104 ],105 "support": {106 "issues": "https://github.com/JUVOJustin/wp-admin-notices/issues",107 "source": "https://github.com/JUVOJustin/wp-admin-notices/tree/v1.0.2"108 },109 "install-path": "../juvo/wp-admin-notices"110 63 }, 111 64 { … … 573 526 ], 574 527 "install-path": "../szepeviktor/phpstan-wordpress" 575 },576 {577 "name": "wptrt/admin-notices",578 "version": "v1.0.3",579 "version_normalized": "1.0.3.0",580 "source": {581 "type": "git",582 "url": "https://github.com/WPTT/admin-notices.git",583 "reference": "3904e0dc087b48289056a77eea3d1dab4ef0dde1"584 },585 "dist": {586 "type": "zip",587 "url": "https://api.github.com/repos/WPTT/admin-notices/zipball/3904e0dc087b48289056a77eea3d1dab4ef0dde1",588 "reference": "3904e0dc087b48289056a77eea3d1dab4ef0dde1",589 "shasum": ""590 },591 "require": {592 "php": ">=5.6"593 },594 "time": "2020-02-15T10:34:51+00:00",595 "type": "library",596 "installation-source": "dist",597 "autoload": {598 "psr-4": {599 "WPTRT\\AdminNotices\\": "src/"600 }601 },602 "notification-url": "https://packagist.org/downloads/",603 "license": [604 "GPL-2.0-or-later"605 ],606 "authors": [607 {608 "name": "WordPress.org Theme Review Team",609 "email": "[email protected]",610 "homepage": "https://make.wordpress.org/themes",611 "role": "Developer"612 }613 ],614 "description": "A class to create admin-notices for the WordPress dashboard.",615 "homepage": "https://github.com/WPTRT/admin-notices",616 "keywords": [617 "wordpress"618 ],619 "support": {620 "issues": "https://github.com/WPTRT/admin-notices/issues",621 "source": "https://github.com/WPTT/admin-notices/tree/v1.0.3"622 },623 "install-path": "../wptrt/admin-notices"624 528 } 625 529 ], -
juvo-mail-editor/trunk/vendor/composer/installed.php
r2578760 r2587510 6 6 'install_path' => __DIR__ . '/../../', 7 7 'aliases' => array(), 8 'reference' => ' c80c30d81787c927c36cb4f6ef4e6cc1ead4587a',8 'reference' => 'ec729b7b920038180c08b479a32b1c43f785e26c', 9 9 'name' => 'juvo/mail-editor', 10 10 'dev' => true, … … 32 32 'install_path' => __DIR__ . '/../../', 33 33 'aliases' => array(), 34 'reference' => 'c80c30d81787c927c36cb4f6ef4e6cc1ead4587a', 35 'dev_requirement' => false, 36 ), 37 'juvo/wp-admin-notices' => array( 38 'pretty_version' => 'v1.0.2', 39 'version' => '1.0.2.0', 40 'type' => 'library', 41 'install_path' => __DIR__ . '/../juvo/wp-admin-notices', 42 'aliases' => array(), 43 'reference' => '53129ec20d2bef9aac6291638d924a44fa7781c4', 34 'reference' => 'ec729b7b920038180c08b479a32b1c43f785e26c', 44 35 'dev_requirement' => false, 45 36 ), … … 116 107 'dev_requirement' => true, 117 108 ), 118 'wptrt/admin-notices' => array(119 'pretty_version' => 'v1.0.3',120 'version' => '1.0.3.0',121 'type' => 'library',122 'install_path' => __DIR__ . '/../wptrt/admin-notices',123 'aliases' => array(),124 'reference' => '3904e0dc087b48289056a77eea3d1dab4ef0dde1',125 'dev_requirement' => false,126 ),127 109 ), 128 110 );
Note: See TracChangeset
for help on using the changeset viewer.