Jump to content

Zeka

Members
  • Content Count

    670
  • Joined

  • Last visited

  • Days Won

    6

Zeka last won the day on December 11 2018

Zeka had the most liked content!

Community Reputation

717 Excellent

About Zeka

  • Rank
    Hero Member
  • Birthday 04/12/1989

Profile Information

  • Gender
    Male
  • Location
    Kiev, Ukraine

Recent Profile Visitors

2,517 profile views
  1. @pwFoo Maybe you can hook before ProcessPageView::execute?
  2. I have the same issue. @theoretic Could you please open an issue on the repo https://github.com/noelboss/AdminThemeBoss
  3. Not tested content/{path}/some-url[-{num}]
  4. These regex expressions don't not match Cyrillic characters https://gitlab.com/rockettpw/seo/jumplinks-one/blob/master/ProcessJumplinks.module.php#L94 https://gitlab.com/rockettpw/seo/jumplinks-one/blob/master/ProcessJumplinks.module.php#L95 https://gitlab.com/rockettpw/seo/jumplinks-one/blob/master/ProcessJumplinks.module.php#L98 https://gitlab.com/rockettpw/seo/jumplinks-one/blob/master/ProcessJumplinks.module.php#L99 They should be changed to something like [\wа-я]+/ig
  5. Hi. Just dumb question. How to prevent sending of a request from hook if some condition is met? $this->wire()->addHookBefore('WireHttp::send', $this, 'checkIfHostExist'); public function modifyPayloadData($event) { ... do some check and prevent sending request exit(); /// ??? } Thanks.
  6. @wbmnfktr, @Valery, @pwired Thanks for suggestions. I managed to get the desired result with HTML Purifier. $dirty = pages(11896)->archive_wysiwyg; $purifier = $sanitizer->purifier(); $purifier->set('AutoFormat.RemoveEmpty', true); $purifier->set('AutoFormat.AutoParagraph', true); $purifier->set('AutoFormat.RemoveEmpty.RemoveNbsp', true); $purifier->set('CSS.AllowedProperties', array()); $purifier->set('HTML.ForbiddenAttributes', array('*@class', 'img@width', 'img@height')); $purifier->set('HTML.ForbiddenElements', array('span', 'strong')); $settings = $purifier->getConfig(); $def = $settings->getHTMLDefinition(); $def->info_tag_transform['h1'] = new HTMLPurifier_TagTransform_Simple('p'); $def->info_tag_transform['h2'] = new HTMLPurifier_TagTransform_Simple('p'); $def->info_tag_transform['h3'] = new HTMLPurifier_TagTransform_Simple('p'); $def->info_tag_transform['h4'] = new HTMLPurifier_TagTransform_Simple('p'); $def->info_tag_transform['h5'] = new HTMLPurifier_TagTransform_Simple('p'); $def->info_tag_transform['h6'] = new HTMLPurifier_TagTransform_Simple('p'); $clean = $purifier->purify($dirty); // do something
  7. Hi. I'm migrating WP site to PW. There are several thousand of posts with very "dirty" HTML. I'm looking for a good way how automatically remove all unwanted styles and replace all H1-H4 tags with P tag. Is there is something that can help in PW? Thanks in advance. ------------- It seems that HTML Purifier can do it with some additional configuration.
  8. @wbmnfktr @Mike Rockett Thanks, but I'm not sure that you understand me correctly. On PW site I don't want to use UTF8 name, but I have such URLs on the old site and I want to make a redirect from URLs like '2018/11/16/обухівських-школярів-навчать-писати/' to some destination page. Currently, I tracked down that it's relative to urldecode/urlencode. For example, I have such jumplink Here is the output of Jumplink debug mode As you can see "request" is not urldecoded, but we are trying match decoded string. If I change this code on line 204 https://gitlab.com/rockettpw/seo/jumplinks-one/blob/master/ProcessJumplinks.module.php#L204 $this->request = ltrim(@$_SERVER['REQUEST_URI'], '/'); to $this->request = urldecode(ltrim(@$_SERVER['REQUEST_URI'], '/')); I get such output ------------- The next issue is that I can't get wildcards to work with Cyrillic characters
  9. Hi @Mike Rockett I'm moving WP site to PW where I have such URLs with Cyrillic characters 2018/11/16/обухівських-школярів-навчать-писати/ and actualy it doesn't work. I have turned on debug mode and it says that there is no match. Also, I have tried to use Wildcards like Source {year:num}/{month:num}/{date}/{title:segment} Destination [template=archive-item,archive_url=/{year}/{month}/{date}/{title}/]] In the archive-item template, I have field archive_url that contain full URL in the format '/2018/11/16/обухівських-школярів-навчать-писати/'. Have I missed something? Thanks.
  10. @jsilmarovi Or you can use URLSegments if you want to reduce the number of pages but still output different markup.
  11. @Noel Boss Not sure that it's going to help, but you can play with the priority of your hooks. Language support is also added via hooks in LanguageSupport.module. So make sure your hook is going after.
  12. @elabx https://github.com/processwire/processwire-issues/issues/793
  13. Yes, I can't move it to ready as I need to change the output depending on an incoming request. Basically, I have to return {'code': 0} if I have a valid incoming request and on ready stage, I already have rendered 404 page. Maybe there is a better place for a hook? I have changed ProcessPageView::execute to ProcessPageView::ready and now everything works. Thank for the help, TracyDebugger and Logger panel!
  14. @bernhard @adrian Wow, tracy's Request Logger Panel is what I was looking for and it works great with standard pages. But I have difficulties in getting it to work in my case. As you could see I hooking into 'before' ProcessPageView::execute in 'init' stage and I don't have any page or template for this URL, so there is no page object available and I can't use $this->wire('page')->logRequests(); That's all that I have from Tracy. Am I missing something?
  15. I have a module that listening for webhook notification on specific URL: <?php namespace ProcessWire; class ProcessPayments extends WireData implements Module, ConfigurableModule { public function init() { $this->addHookBefore('ProcessPageView::execute', $this, 'runPayments'); } public function ready() { } public function runPayments($event) { $it = isset($_GET['it']) ? $_GET['it'] : ""; if (substr($it, 0, 1) === '/') $it = ltrim($it, "/"); if (strpos($it, "webhooks/") !== false) { $this->checkRequest(); } else { return; } switch ($it) { case 'webhooks/pay': $this->handlePayRequest(); exit(); break; } } private function checkRequest() { $this->checkRequestHMAC(); return true; } ... } Currently, for debugging real request from a remote server I use logs, but this is so inconvenient and slow after using dumps from TracyDebugger ( @adrian is there something in TracyDebugger that can help? ). So looking for advice about how to debug such request, are there some tools for it?
×
×
  • Create New...