Jump to content
horst

WireMailSmtp

Recommended Posts

ok, this way it could be that some different mails has to be sent parallel, right?
 
You can go this way: (simplified)
 
    - sentLogReset isn't needed in your case, because you collect all recipients in the field $message->recipients.
   
    - you need to hook into sentLogGet, here you read all recipients from $message->recipients.
 
    - for each successfull sent message you should drop the recipient from the $message->recipients field in the hooked method sentLogAdd
      (don't forget to save the page)
      here you also can add a message to a textarea field
 
      Edit: striked the above, - see this post, it has a more correct solution
 
This way it should be possible to add some hundred recipients to the initial collection and if a script execution got interrupted, it could be resumed with the next cron run.
 
The only thing that you have to take care for is to determine if a page is allready sending. (no simultaneous sending of the same page!)
 
Hhm, maybe also it should not send different pages simultaneous?! Only one page after each other?
 
 
The used php libs allready provide personalized emailmessages in a faster way than to create and encode a new mail for each recipient. So, to use it in its meant fashion, it is needed to extend the current module. If you like and if it is possible that you can send me (only) the basic template code for the emailpages we can achieve that together.
 
 
Edit:
Oh, hasn't read your gists before.
 
Some questions:
- Is it possible to setup the cron to only start a new instance if the previous started one (5 minutes before) has allready finished? (but skip it if the previous one is still running)
 
- What would be the max number of recipients you can think of you will be collect for a mail (in the next 2 years) using this approach?

Edited by horst

Share this post


Link to post
Share on other sites

Hi Horst -

regarding the cron - since the cron just executes the page with this template (only way i could do it for the moment), i guess the thing would be to have some logic at the top of the template file to check is wiremail is still running? would that be possible? i definitely see your concern as far as scalability and different use cases; In my case i know for sure that i wouldn't have 2 messages scheduled 5 min apart with enough recipients to consume more that 5 min of sending time; but it is definitely something that should be accounted for...

When i first started this i was initially only thinking of sending to maybe 1-5 recipients at a time; now i figure that i could possibly need to send out to as many as 150; I was sort of figuring that when/if i get to the point of needing to send to a larger # that i would use a different system;

Another thing that i might play with is the Mandrill web hooks - it lets you enable posting back to a URL the json response for different events, like mail sent, mail opened, bounced etc; could be cool to have some fields in processwire to show the results of the send without having to go and look at the mandrill interface each time... I'll let you know how this goes.. should have some progress on it in a few days; the other good thing about reading back the mandrill responses is that they don't store that data for very long, so would be good to keep those records in PW...

Share this post


Link to post
Share on other sites

@Macrura: I think with a peak of 150 recipients you can go like in your second gist with the replacements (regarding personalization) and send them one after the other. But you need to use sendBulk(true) !!

Has you tried to use gmdate? Did it solve the issue?

// LOGGING:

you need to add a field to the messages template / pages that can collect the successful used recipients emailadresses!

(I use a textfield or simple textareafield named $message->recipientsSuccess in the following example)

// at the top of the template add the hooks

    // the sentLogReset isn't needed to hook into.
    // If you want to reset it, just delete the value of the $message->recipientsSuccess field!

    // this hook read in all successful used recipients
    wire()->addHook("wireMail::sentLogGet", function(HookEvent $event) {    
        $p = wire('page')->tmpMessagePage;  // get the current processed message-page
        // read the emailadresses from the recipientsSuccess field
        $emailaddresses = unserialize(trim($p->recipientsSuccess));  // you may also use json instead of serialized code or any other solution
        if(!is_array($emailaddresses)) $emailaddresses = array();    // should return an array !!  
        $event->replace = true;
        $event->return = $emailaddresses;
        return $emailaddresses;
    });

    // this hook add recipients to the successful collection and log the success
    wire()->addHook("wireMail::sentLogAdd", function(HookEvent $event) {    
        $p = wire('page')->tmpMessagePage;  // get the current processed message-page
        $emailaddress = $event->arguments[0];
        $logentry = "From: {$p->tmpFrom}; To: {$emailaddress}; Subject: {$p->tmpSubject}\n";
        // here you need to add the recipient to the successfull recipients collection
        $tmp = unserialize(trim($p->recipientsSuccess));  // you may also use json instead of serialized code or any other solution
        if(!is_array($tmp)) $tmp = array();               // should return an array !!
        $newRecipientsCollection = array_merge($tmp, array("{$emailaddress}"=>"{$emailaddress}"));
        $p->of(false);
        $p->recipientsSuccess = serialize($newRecipientsCollection);
        $p->email_log = $p->email_log . $logentry;
        $p->save();
        $event->replace = true;
        $event->return = true;
    });

When starting the wiremail instance, you need to setup it to use the sentLog functionality:

$mail = wireMail()->useSentLog(true)->sendBulk(true);  // don't forgett this !!!

At the end of your $messages loop you need something like this:

// Send

    // add some temporary vars to the current page, so it simply can be read within the hooked functions
    $page->of(false);
    $page->tmpFrom = $message->identity_select->email;
    $page->tmpSubject = $title;
    $page->tmpMessagePage = $message;
    $page->save();
    $page->of(true);

    // send the mails
    $numSent = $mail->useSentLog(true)->sendBulk(true)->send();  // useSentLog: you also can set it here !

    // ready with this $message page 

I haven't tested it but something like this should work & you get the idea I think. :)

Share this post


Link to post
Share on other sites

@Horst - a zillion thanks for this, looks awesome - i will delve in to deep study on this tonight (NY time) and respond then... gotta go and work for $ now...!

Share this post


Link to post
Share on other sites

Hey, Can anyone help with me this?

I'm trying to send mail with this module, however I keep getting this in error log "No unauthenticated relaying permitted".

How can I resolve this?

Note:

I'm using ipage shared hosting environment. Ipage told me i don't need to log in to their mail server to send mail. So i'm not sure what I am doing wrong.

Code I'm using is this...

$mail = wireMail(); // calling an empty wireMail() returns a wireMail object
 
$numSent = wireMail($to, '', $subject, $textBody); // or with a default sender emailaddress on config page 
  • Like 1

Share this post


Link to post
Share on other sites

@JasonS: this module lets you connect and send messages through an SMTP server.

Do you have filled in the needed credentials in the config screen of this module?

Does the connection test succeed or fail?

Share this post


Link to post
Share on other sites

The connection-test uses your credentials and try to establish a connection to the server you has entered in the configscreen together with your credentials.

If the connection-test always succeed, there is no reason why the connection when trying to send a mail shouldn't do so too. (Because it is 100% the same code used in both cases, and the same credentials, empty or not.)

The error you are getting tells another story: "No unauthenticated relaying permitted"

- Do you have a personal SMTP account at ipage?

- Have you asked them if you need credentials for sending through your personal SMTP-Account and they have answered to you that you do not need those?

- Or do you have asked them if you need credentials for sending emails via php, and they think you mean simply using the php mail() function through your webhost?

The wiremailSmtp module cannot use php's native mail() function. This can be used with the base class wiremail and without credentials.

  • Like 2

Share this post


Link to post
Share on other sites

I contacted iPage again, and indeed you were right, I did need the credentials for the SMTP-account to work.

Before they told me I didn't, maybe as you said, they may have been thinking i was using the mail() function.

Once I added the credentials for my account, it worked beautifully.

Thank you very much Horst!!! :)

  • Like 1

Share this post


Link to post
Share on other sites
If the connection-test always succeed, there is no reason why the connection when trying to send a mail shouldn't do so too. (Because it is 100% the same code used in both cases, and the same credentials, empty or not.)

I had a similar situation the other day with a gmail smtp setup. The test connection worked fine, but the email didn't send. Turns out the test worked with a few different config setups, but the email only sent with one specific setup. So I think a successful test connection is not always a guarantee that everything is set up correctly. Not sure that your module can do anything about that though.

Share this post


Link to post
Share on other sites

I had a similar situation the other day with a gmail smtp setup. The test connection worked fine, but the email didn't send. Turns out the test worked with a few different config setups, but the email only sent with one specific setup. So I think a successful test connection is not always a guarantee that everything is set up correctly. Not sure that your module can do anything about that though.

Ok Adrian that may be right, but I think you have entered your credentials for the SMTP account(?). In this special case JasonS hasn't entered any credentials and got everytime a "No unauthenticated relaying permitted" in the error-log. Also he said that the test-connection works everytime! Hhm? Finally he has found that he need credentials for using the SMTP server, (not a big surprise at all, :lol: isn't it?). The times when you could use a mail relay without authentication are gone for a decade or two! :) We have 2014.

Share this post


Link to post
Share on other sites

Hey horst - I am not really up on the latest with this, but just to give you an idea, I can get a successful test with gmail with only:

smtp.gmail.com 

587

use START_TLS

with no credentials entered at all. Not sure if this is unique to gmail. I agree though, I thought most SMTP servers required authentication these days. It seems that gmail doesn't actually send a message, but the test is still successful without.

BTW, the settings that actually do send an email via gmail for me are:

smtp.gmail.com

465

use SSL

email and password as credentials

NB: I actually need to turn off use START_TLS

  • Like 1

Share this post


Link to post
Share on other sites

Sure?

This would make the testconnection nearly useless. The only reason for it is to test if one has no typos in the server settings and credentials.

I will try this gmail and with other servers and report back.

Share this post


Link to post
Share on other sites

Wow! I have found out that in the Connect() method of the base SMTP class it comes to a point after trying to start a TLS connection that a variable $success is set to true if the smtp-server simply supports TLS.

After that a if condition checks if there are settings available for user, if not it passes through to the end of the method with $success set to true! A Bummer!

If there is given a username, it trys to authenticate that user and the variable $success is set to that result.

So, at least this is not a bug, because in the past or in private networks SMTP servers could be configured to work without authentication, that is what this class does.

What should I do with this situation? I tend to ignore a usage without user authentication. This way it tries everytime to establish a connection via authentication, what will fail with an empty user or pass.

Good to know that typos would be detected in the past but only empty usernames raised this behave.

Now the class gives two errors:

WireMailSmtpConfig: ERROR: SMTP settings did not work.
WireMailSmtpConfig: 535 5.7.8 Error: authentication failed
Edited by horst
  • Like 3

Share this post


Link to post
Share on other sites

I have updated the Github repo and the entry in the modules directory to version 0.1.9

@JasonS: sorry that I tend not to believe that a server says success on testconnection and then returns a "No unauthenticated relaying permitted" error. Together with the confusion that the hoster has said it needs no credentials, it sounded too unlikely for me. But it was real. I have liked all posts of you here in the thread trying to say appologize. (If you post one more I will like it too) :-[

  • Like 1

Share this post


Link to post
Share on other sites

@horst lol, It's ok :) I understand. I was confused as well for a long time about the test connection but i'm glad we were able to get it resolved.

  • Like 1

Share this post


Link to post
Share on other sites
I posted 2 times in another topic about the SMTP settings for Google.  Here is the consolidated information from those posts:

If you use a Google email address, this will work:

 
post-756-0-39162500-1413431424_thumb.png
post-756-0-38911900-1413431441_thumb.png
 

Other major providers are setup similar (you just need to check what their SMTP requirements are - this information is easily found, otherwise ask your hosting provider for correct setup and ports)

-------------  Second Post -----------------

I will & here is additional information regarding Gmail.  There are specific variations that will work and sometimes people don't understand why an option is needed.  These links should educate anyone on why certain settings work and others don't.

  • Like 8

Share this post


Link to post
Share on other sites

I don't know why but when I use my work email address which is managed by Gmail, but is not a @gmail address, I need to use:

post-985-0-83709400-1413492743_thumb.png

Nothing else seems to work for me except this.

Hopefully that might be a useful addition to @cstevensjr's excellent post.

  • Like 4

Share this post


Link to post
Share on other sites

Adrian, that's a valid sequence when using SSL (Port 465 is required).  Port 587 requires TLS.  The first link I posted explains what normally works, according to Gmail themselves.  I host with Dreamhost and when I was using ActiveCollab, I could use either or both within that application.  Gmail has other relay addresses that also work.

Here's Dreamhost's take on SMTP/SSL/TLS

http://wiki.dreamhost.com/Secure_E-mail

I'm no Gmail or SMTP expert, so I usually just play around with the settings until I get one that reliably works.

I don't think there is a default right answer to getting your mail to send reliably, because we are dealing with different email vendors, Operating Systems, Webhosts and other factors we don't even know about.

  • Like 6

Share this post


Link to post
Share on other sites

Hi Horst: When testing the connection and 'use SSL' is checked these 2 notices appear. (2.5.17 dev)

Notice: Undefined property: smtp_class::$result_code in /Users/martijn/Sites/domains/newsletters/htdocs/site/modules/WireMailSmtp/smtp_classes/smtp.php on line 1032

Notice: Undefined offset: 0 in /Users/martijn/Sites/domains/newsletters/htdocs/site/modules/WireMailSmtp/smtp_classes/smtp.php on line 1042
  • Like 1

Share this post


Link to post
Share on other sites

@Martijn: I cannot replicate this. I have no errors in the logs and I have no error outputs. Error display is set to strict all. I'm on PW 2.5.11

Which version of WiremailSMTP do you use?

Do you have set a smtp- hostname, user and pass? Or do you have left one / some fields empty?

Share this post


Link to post
Share on other sites

Few Qs:

1. How to change authentication (SMTP host, user/pass/etc) from API?

2. How to set "Reply-To" (different from "from" one) from API?

Share this post


Link to post
Share on other sites

Regarding No. 1:

$data = $modules->getModuleConfigData('WireMailSmtp');
$data[$key] = $value;
$modules->saveModuleConfigData('WireMailSmtp', $data);  

Fill in key and value yourself. It's the same for any other modules settings.

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-11-15 2019-10-18 2019-08-08 2019-06-15 2019-06-02 2019-05-25 If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      (please have a look at the screenshots to get an idea what I'm talking about)
       




    • By Robin S
      I have had this module sitting in a 95% complete state for a while now and have finally made the push to get it out there. Thanks to @teppo for his Hanna Code Helper module which I referred to and borrowed from during development.
      http://modules.processwire.com/modules/hanna-code-dialog/
      https://github.com/Toutouwai/HannaCodeDialog
      HannaCodeDialog
      Provides a number of enhancements for working with Hanna Code tags in CKEditor. The main enhancement is that Hanna tags in a CKEditor field may be double-clicked to edit their attributes using core ProcessWire inputfields in a modal dialog.
      Requires the Hanna Code module and >= ProcessWire v3.0.0.
      Installation
      Install the HannaCodeDialog module using any of the normal methods.
      For any CKEditor field where you want the "Insert Hanna tag" dropdown menu to appear in the CKEditor toolbar, visit the field settings and add "HannaDropdown" to the "CKEditor Toolbar" settings field.
      Module configuration
      Visit the module configuration screen to set any of the following:
      Exclude prefix: Hanna tags named with this prefix will not appear in the CKEditor toolbar dropdown menu for Hanna tag insertion. Exclude Hanna tags: Hanna tags selected here will not appear in the CKEditor toolbar dropdown menu for Hanna tag insertion. Background colour of tag widgets: you can customise the background colour used for Hanna tags in CKEditor if you like. Dialog width: in pixels Dialog height: in pixels Features
      Insert tag from toolbar dropdown menu
      Place the cursor in the CKEditor window where you want to insert your Hanna tag, then select the tag from the "Insert Hanna tag" dropdown.

      Advanced: if you want to control which tags appear in the dropdown on particular pages or templates you can hook HannaCodeDialog::getDropdownTags. See the forum support thread for examples .
      Edit tag attributes in modal dialog
      Insert a tag using the dropdown or double-click an existing tag in the CKEditor window to edit the tag attributes in a modal dialog.

      Tags are widgets
      Hanna tags that have been inserted in a CKEditor window are "widgets" - they have a background colour for easy identification, are protected from accidental editing, and can be moved within the text by drag-and-drop.

      Options for tag attributes may be defined
      You can define options for a tag attribute so that editors must choose an option rather than type text. This is useful for when only certain strings are valid for an attribute and also has the benefit of avoiding typos.
      Add a new attribute for the Hanna tag, named the same as the existing attribute you want to add options for, followed by "__options". The options themselves are defined as a string, using a pipe character as a delimiter between options. Example for an existing attribute named "vegetables":
      vegetables__options=Spinach|Pumpkin|Celery|Tomato|Brussels Sprout|Potato You can define a default for an attribute as normal. Use a pipe delimiter if defining multiple options as the default, for example:
      vegetables=Tomato|Potato Dynamic options
      Besides defining static options as above, you can use one Hanna tag to dynamically generate options for another. For instance, you could create a Hanna tag that generates options based on images that have been uploaded to the page, or the titles of children of the page.
      Your Hanna tag that generates the options should echo a string of options delimited by pipe characters (i.e. the same format as a static options string).
      You will probably want to name the Hanna tag that generates the options so that it starts with an underscore (or whatever prefix you have configured as the "exclude" prefix in the module config), to avoid it appearing as an insertable tag in the HannaCodeDialog dropdown menu.
      Example for an existing attribute named "image":
      image__options=[[_images_on_page]] And the code for the _images_on_page tag:
      <?php $image_names = array(); $image_fields = $page->fields->find('type=FieldtypeImage')->explode('name'); foreach($image_fields as $image_field) { $image_names = array_unique( array_merge($image_names, $page->$image_field->explode('name') ) ); } echo implode('|', $image_names); Choice of inputfield for attribute
      You can choose the inputfield that is used for an attribute in the dialog.
      For text attributes the supported inputfields are text (this is the default inputfield for text attributes so it isn't necessary to specify it if you want it) and textarea. Note: any manual line breaks inside a textarea are removed because these will break the CKEditor tag widget.
      Inputfields that support the selection of a single option are select (this is the default inputfield for attributes with options so it isn't necessary to specify it if you want it) and radios.
      Inputfields that support the selection of multiple options are selectmultiple, asmselect and checkboxes.
      You can also specify a checkbox inputfield - this is not for attributes with defined options but will limit an attribute to an integer value of 1 or 0.
      The names of the inputfield types are case-insensitive.
      Example for an existing attribute named "vegetables":
      vegetables__type=asmselect Descriptions and notes for inputfields
      You can add a description or notes to an attribute and these will be displayed in the dialog.
      Example for an existing attribute named "vegetables":
      vegetables__description=Please select vegetables for your soup. vegetables__notes=Pumpkin and celery is a delicious combination. Notes
      When creating or editing a Hanna tag you can view a basic cheatsheet outlining the HannaCodeDialog features relating to attributes below the "Attributes" config inputfield.
      Advanced
      Define or manipulate options in a hook
      You can hook HannaCodeDialog::prepareOptions to define or manipulate options for a Hanna tag attribute. Your Hanna tag must include a someattribute__options attribute in order for the hook to fire. The prepareOptions method receives the following arguments that can be used in your hook:
      options_string Any existing string of options you have set for the attribute attribute_name The name of the attribute the options are for tag_name The name of the Hanna tag page The page being edited If you hook after HannaCodeDialog::prepareOptions then your hook should set $event->return to an array of option values, or an associative array in the form of $value => $label.
      Build entire dialog form in a hook
      You can hook after HannaCodeDialog::buildForm to add inputfields to the dialog form. You can define options for the inputfields when you add them. Using a hook like this can be useful if you prefer to configure inputfield type/options/descriptions/notes in your IDE rather than as extra attributes in the Hanna tag settings. It's also useful if you want to use inputfield settings such as showIf.
      When you add the inputfields you must set both the name and the id of the inputfield to match the attribute name.
      You only need to set an inputfield value in the hook if you want to force the value - otherwise the current values from the tag are automatically applied.
      To use this hook you only have to define the essential attributes (the "fields" for the tag) in the Hanna Code settings and then all the other inputfield settings can be set in the hook.
      Example buildForm() hook
      The Hanna Code attributes defined for tag "meal" (a default value is defined for "vegetables"):
      vegetables=Carrot meat cooking_style comments The hook code in /site/ready.php:
      $wire->addHookAfter('HannaCodeDialog::buildForm', function(HookEvent $event) { // The Hanna tag that is being opened in the dialog $tag_name = $event->arguments(0); // Other arguments if you need them /* @var Page $edited_page */ $edited_page = $event->arguments(1); // The page open in Page Edit $current_attributes = $event->arguments(2); // The current attribute values $default_attributes = $event->arguments(3); // The default attribute values // The form rendered in the dialog /* @var InputfieldForm $form */ $form = $event->return; if($tag_name === 'meal') { $modules = $event->wire('modules'); /* @var InputfieldCheckboxes $f */ $f = $modules->InputfieldCheckboxes; $f->name = 'vegetables'; // Set name to match attribute $f->id = 'vegetables'; // Set id to match attribute $f->label = 'Vegetables'; $f->description = 'Please select some vegetables.'; $f->notes = "If you don't eat your vegetables you can't have any pudding."; $f->addOptions(['Carrot', 'Cabbage', 'Celery'], false); $form->add($f); /* @var InputfieldRadios $f */ $f = $modules->InputfieldRadios; $f->name = 'meat'; $f->id = 'meat'; $f->label = 'Meat'; $f->addOptions(['Pork', 'Beef', 'Chicken', 'Lamb'], false); $form->add($f); /* @var InputfieldSelect $f */ $f = $modules->InputfieldSelect; $f->name = 'cooking_style'; $f->id = 'cooking_style'; $f->label = 'How would you like it cooked?'; $f->addOptions(['Fried', 'Boiled', 'Baked'], false); $form->add($f); /* @var InputfieldText $f */ $f = $modules->InputfieldText; $f->name = 'comments'; $f->id = 'comments'; $f->label = 'Comments for the chef'; $f->showIf = 'cooking_style=Fried'; $form->add($f); } }); Troubleshooting
      HannaCodeDialog includes and automatically loads the third-party CKEditor plugins Line Utilities and Widget. If you have added these plugins to your CKEditor field already for some purpose and experience problems with HannaCodeDialog try deactivating those plugins from the CKEditor field settings.
    • By Robin S
      Sanitizer EasySlugger
      Allows the use of the EasySlugger library as Sanitizer methods.
      Installation
      Install the Sanitizer EasySlugger module.
      Usage
      The module adds four new sanitizer methods.
      slugger($string, $options)
      Similar to $sanitizer->pageName() - I'm not sure if there are any advantages over that method. Included because it is one of the methods offered by EasySlugger.
      $slug = $sanitizer->slugger('Lorem Ipsum'); // Result: lorem-ipsum utf8Slugger($string, $options)
      Creates slugs from non-latin alphabets.
      $slug = $sanitizer->utf8Slugger('这个用汉语怎么说'); // Result: zhe-ge-yong-han-yu-zen-me-shuo seoSlugger($string, $options)
      Augments the string before turning it into a slug. The conversions are related to numbers, currencies, email addresses and other common symbols.
      $slug = $sanitizer->seoSlugger('The price is $5.99'); // Result: the-price-is-5-dollars-99-cents See the EasySlugger readme for some more examples.
      seoUtf8Slugger($string, $options)
      A combination of utf8Slugger() and seoSlugger().
      $slug = $sanitizer->seoUtf8Slugger('价钱是 $5.99'); // Result: jia-qian-shi-5-dollars-99-cents $options argument
      Each of the methods can take an $options array as a second argument.
      separator (string): the character that separates words in the slug. Default: - unique (bool): Determines whether a random suffix is added at the end of the slug. Default: false $slug = $sanitizer->utf8Slugger('这个用汉语怎么说', ['separator' => '_', 'unique' => true]); // Result: zhe_ge_yong_han_yu_zen_me_shuo_3ad66c4  
      https://github.com/Toutouwai/SanitizerEasySlugger
      https://modules.processwire.com/modules/sanitizer-easy-slugger/
    • By Robin S
      If you've ever needed to insert links to a large number of files within CKEditor you may have found that the standard PW link modal is a somewhat slow way to do it.
      This module provides a quicker way to insert links to files on the page being edited. You can insert a link to an individual file, or insert an unordered list of links to all files on the page with a single click.
      CKEditor Link Files
      Adds a menu to CKEditor to allow the quick insertion of links to files on the page being edited.

      Features
      Hover a menu item to see the "Description" of the corresponding file (if present). Click a menu item to insert a link to the corresponding file at the current cursor position. The filename is used as the link text. If you Alt-click a menu item the file description is used as the link text (with fallback to filename if no description entered). If text is currently selected in the editor then the selected text is used as the link text. Click "* Insert links to all files *" to insert an unordered list of links to all files on the page. Also works with the Alt-click option. Menu is built via AJAX so newly uploaded files are included in the menu without the page needing to be saved. However, descriptions are not available for newly uploaded files until the page is saved. There is an option in the module config to include files from Repeater fields in the edited page. Nested Repeater fields (files inside a Repeater inside another Repeater) are not supported. Installation
      Install the CKEditor Link Files module.
      For any CKEditor field where you want the "Insert link to file" dropdown menu to appear in the CKEditor toolbar, visit the field settings and add "LinkFilesMenu" to the "CKEditor Toolbar" settings field.
       
      http://modules.processwire.com/modules/cke-link-files/
      https://github.com/Toutouwai/CkeLinkFiles
    • By David Karich
      ProcessWire InputfieldRepeaterMatrixDuplicate
      Thanks to the great ProModule "RepeaterMatrix" I have the possibility to create complex repeater items. With it I have created a quite powerful page builder. Many different content modules, with many more possible design options. The RepeaterMatrix module supports the cloning of items, but only within the same page. Now I often have the case that very design-intensive pages and items are created. If you want to use a content module on a different page (e.g. in the same design), you have to rebuild each item manually every time.
      This module extends the commercial ProModule "RepeaterMatrix" by the function to duplicate repeater items from one page to another page. The condition is that the target field is the same matrix field from which the item is duplicated. This module is currently understood as proof of concept. There are a few limitations that need to be considered. The intention of the module is that this functionality is integrated into the core of RepeaterMatrix and does not require an extra module.
      Check out the screencast
      What the module can do
      Duplicate a repeater item from one page to another No matter how complex the item is Full support for file and image fields Multilingual support Support of Min and Max settings Live synchronization of clipboard between multiple browser tabs. Copy an item and simply switch the browser tab to the target page and you will immediately see the past button Support of multiple RepeaterMatrix fields on one page Configurable which roles and fields are excluded Duplicated items are automatically pasted to the end of the target field and set to hidden status so that changes are not directly published Automatic clipboard update when other items are picked Automatically removes old clipboard data if it is not pasted within 6 hours Delete clipboard itself by clicking the selected item again Benefit: unbelievably fast workflow and content replication What the module can't do
      Before an item can be duplicated in its current version, the source page must be saved. This means that if you make changes to an item and copy this, the old saved state will be duplicated Dynamic loading is currently not possible. Means no AJAX. When pasting, the target page is saved completely No support for nested repeater items. Currently only first level items can be duplicated. Means a repeater field in a repeater field cannot be duplicated. Workaround: simply duplicate the parent item Dynamic reloading and adding of repeater items cannot be registered. Several interfaces and events from the core are missing. The initialization occurs only once after the page load event Changelog
      1.0.4
      Bug fix: Various bug fixes and improvements in live synchronization Bug fix: Items are no longer inserted when the normal save button is clicked. Only when the past button is explicitly clicked Feature: Support of multiple repeater fields in one page Feature: Support of repeater Min/Max settings Feature: Configurable roles and fields Enhancement: Improved clipboard management Enhancement: Documentation improvement Enhancement: Corrected few typos #1 1.0.3
      Feature: Live synchronization Enhancement: Load the module only in the backend Enhancement: Documentation improvement 1.0.2
      Bug fix: Various bug fixes and improvements in JS functions Enhancement: Documentation improvement Enhancement: Corrected few typos 1.0.1
      Bug fix: Various bug fixes and improvements in the duplication process 1.0.0
      Initial release Support this module
      If this module is useful for you, I am very thankful for your small donation: Donate 5,- Euro (via PayPal – or an amount of your choice. Thank you!)
      Download this module
      > Github: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDuplicate
      > PW module directory: https://modules.processwire.com/modules/inputfield-repeater-matrix-duplicate/
×
×
  • Create New...