Jump to content

AndZyk

Members
  • Content Count

    460
  • Joined

  • Last visited

  • Days Won

    4

AndZyk last won the day on February 13 2019

AndZyk had the most liked content!

Community Reputation

663 Excellent

About AndZyk

  • Rank
    Sr. Member
  • Birthday 09/12/1987

Profile Information

  • Gender
    Male
  • Location
    Furtwangen, Germany

Recent Profile Visitors

3,561 profile views
  1. My solution for textareas with CKEditor is now a simple Textformatter module. πŸ˜‰ <?php class TextformatterReplaceLinks extends Textformatter implements Module { public static function getModuleInfo() { return array( "title" => "Replace Links", "version" => "1.0.0", "summary" => "Find and replace links of domain.", "author" => "AndZyk", "singular" => true, "requires" => "ProcessWire>=2.6", "icon" => "link" ); } /** * Find and replace the input string * * @param string $str The block of text to parse * * The incoming string is replaced with the formatted version of itself. * */ public function format(&$str) { $str = preg_replace("/(http|https):\/\/example.com/", "file://example.com", $str); } } Regards, Andreas
  2. Thank you @ryan. I did not know how to just modify the comment text. πŸ˜€ Personally I like markdown, but in my case I just want to replace links, so I modified this snippet to just replace links with html links: $wire->addHookBefore("CommentList::renderItem", function($event) { $comment = $event->arguments(0); /** @var Comment $comment */ $text = $comment->getFormatted("text"); $textOriginal = $text; // look for link $regex = '@(http)?(s)?(://)?(([a-zA-Z])([-\w]+\.)+([^\s\.]+[^\s]*)+[^,.\s])@'; $link = '<a href="$0" rel="noopener noreferrer nofollow" target="_blank">$0</a>'; $text = preg_replace($regex, $link, $text); // populate changed comment text if ($text !== $textOriginal) { $comment->set("textFormatted", $text); } }); Regards, Andreas Edit: The regex I copied from Stack Overflow else doesn't seem to be that correct. Regex is always a big question mark for me. I have to look further. πŸ˜€
  3. Hello, I don't want to hijack this topic, but since this topic is about the comments field I just wanted to ask this short question, because a client just asked me about this: Is there an easy way to convert links inside comments to clickable HTML-links? I know that HTML tags aren't allowed in the comments field and for a good reason, because that would be unsafe. But our client has a blog and wants to link to an internal blog post inside a comment. I could use preg_replace with a pattern to find links and add markup to them, but this way I would have to recreate the whole markup of: $comments->render() I would appreciate some help and I can create a new topic if this is not the right place. πŸ˜‰ Regards, Andreas
  4. Just wanted to add, that if you want to create a real newsletter, services like MailChimp or Campaign Monitor offer more tools for editing, sending and statistics. πŸ˜‰ In my case I used this module for an automatically daily newsletter of job offers from a pages, which was enough for this module.
  5. Thank you @louisstephens for the hint. I tried it out, but the link still gets stripped out, even with disabled ACF. Do you have configured extra allowed content? Maybe a RewriteRule in the .htaccess file would be the easiest solution. πŸ€”
  6. Hello, I am currently building a intranet which will be hosted on the local network of a company. This intranet has many links to files on their fileserver with the protocol file://. So for example the links look like this file://domain.tld/filename.ext When I try to insert such a link into a URL field, I get the error, that only the protocol http:// is allowed. When I try to insert such a link into a CKEeditor link, it gets stripped out. Is it possible to insert such links into the FieldType URL and CKEditor. I know that I could use a FieldType Text or insert a RewriteRule in the .htaccess file, but I am looking for a more elegant solution. πŸ˜‰ Regards, Andreas
  7. Thank you for your answers. My understanding is, that you don't need a cookie banner for a session cookie, because there is no personal information in that cookie. If that would be case, every website with a CMS would need a cookie banner. I can understand that you would maybe need a banner if you track analytics of users. But even for that there is no clear requirement that I know of. I hope this trend goes away again soon, because there is no real benefit in my opinion. Regards, Andreas
  8. I also had the same trouble with strategy 2. So I switched to strategy 3, wich is a little more effort but better in my opinion. πŸ˜‰ Regards, Andreas
  9. Hello @MilenKo, I have used this module in one project and had no issues. πŸ˜‰ Regards, Andreas
  10. Hello all, sorry for getting off-topic, but I am curious: I have read about those new regulations but my understanding was, that this was just about a special case (a gambling website), so that nothing would change for normal websites. But now everybody seems to jump on the train just to be safe, even though it is not necessary. Could somebody please explain to me, why you have to add this new cookie banner to your website? Are you saving personal informations of users in cookies? Or could somebody please point me to a reliable source, that explains or states that you have to add this new cookie banner? I only have cookies from ProcessWire and Google Analytics (with anonymized IPs). I have never read a clear statement, that I have to add a cookie banner and never has somebody complaint that I don't have a banner. In my opinion, everybody adds those banners because they are not sure and jump on the bandwagon. But I am no lawyer, so maybe I am completely wrong. But those new banners are really worse. I saw some that covered the whole website before you could get to the content. Its like we are back in the 90s, where you have a start page for the homepage. πŸ˜€ Thank god there a browser extensions like I don't care about cookies. Regards, Andreas
  11. AndZyk

    Aaron Copland

    Sorry for being off-topic, but I have noticed this on the ProcessWire Sites directory too, but not on my UIkit based websites. I donβ€˜t know what causes this, but the Chrome task manager shows a high CPU percentage although nothing happens. @Macrura Great website. πŸ˜€
  12. Of course I believe you. Thank you for this method, I will try it out tomorrow. πŸ˜‰ Thank you for mentioning this module. I haven't heard about it until now, but this could also be a solution. πŸ˜€ Yes, this would be a great enhancement for the page reference fields. I hope @ryan will consider adding this into the core. Thank you all for your help. Regards, Andreas
  13. Here I made a little example with a simple CSS transition: https://jsfiddle.net/x8gwrbys/ I have Autoprefixer in CodeKit for all those prefixes, so I don't have to write any prefix again. I can really recommend it. But for example transform is now a few years old and well supported, so you don't have to write prefixes for transform anymore. JavaScript for animating is not bad. But CSS animations have in general a better performance. For small animations there is not much of a difference, but on heavy animations you can really slow down a computer with JavaScript animations in my experience. πŸ˜‰
  14. Currently I am using has() and a selector on the page reference field readByUsers: if (!$post->readByUsers->has(user())) { // Do something } if (count($child->find("template=post, readByUsers!={$user}")) { // Do something } Probably that is not do difficult to write as SQL query, but I have not much experience with writing SQL. πŸ˜€ I would be happy about an example. Thank you for the hint. Do the pages get loaded in the admin even if the field is hidden completely (with the field setting) in the edit-page? In that case, this could be an issue.
  15. Ok, so in this case the jQuery slideToggle function would be easier, because if you want to animate the height of a div with CSS transitions, you have to know the height first: https://jsfiddle.net/qc3drkuz/ Rotating something with a CSS transition on the other hand is easy. However, I just wanted to show, that you can add custom animations to the toggle component. But you could also do this via JavaScript. I prefer to animate with CSS. πŸ˜‰
Γ—
Γ—
  • Create New...