Leaderboard
Popular Content
Showing content with the highest reputation on 12/21/2016 in all areas
-
3 points
-
3 points
-
the best blog-post i found so far: https://megalytic.com/blog/how-to-filter-out-fake-referrals-and-other-google-analytics-spam i found out that segments are REALLY helpful! you can define filters and apply them also to your historical data. it's also very few clicking if you use REGEX like this (taken from https://github.com/piwik/referrer-spam-blacklist/blob/master/spammers.txt): 4webmasters.org|7makemoneyonline.com|acads.net|anal-acrobats.hol.es|anticrawler.org|best-seo-offer.com|best-seo-solution.com|bestwebsitesawards.com|blackhatworth.com|brakehawk.com|buttons-for-website.com|buttons-for-your-website.com|buy-cheap-online.info|darodar.com|econom.co|forum69.info|forum20.smailik.org|free-share-buttons.com|get-free-traffic-now.com|googlsucks.com|hulfingtonpost.com|humanorightswatch.org|ilovevitaly.com|iminent.com|kabbalah-red-bracelets.com|kambasoft.com|makemoneyonline.com|masterseek.com|o-o-6-o-o.com|ok.ru|priceg.com|ranksonic.info|ranksonic.org|savetubevideo.com|semalt.com|sexyteens.hol.es|social-buttons.com|theguardlan.com|webmaster-traffic.com you can then analyze what all the spam-bots are doing on your site: and you can easily switch your filter to EXCLUDE all spam-bots and compare your data: i've not found out how to deal with segments via ga-api. maybe some day i find the time. as a note for myself: https://developers.google.com/analytics/solutions/articles/hello-analytics-api i'll give a more detailed insight on my blog, when it is finished EDIT: it get's even better!! you can share segments and have it available in ALL your properties for ALL your data (also historical)! here is my segment: https://www.google.com/analytics/web/template?uid=ns25vIZpSj2NpRFk371g3Q just visit the link and enjoy spam-free analytics does it work for you?3 points
-
Solved it!!!! It isn't namespaces, thanks for the suggestion! It was the freaking cache!!!! It gets me everytime! Emptied the cache and it's working2 points
-
Ah, ok, 8bit transparent pngs are not handled correctly by the GD-library! There is no chance. Only solution is to use 24bit PNGs with transparency.2 points
-
Nice catch! See it too. I guess that is Putin's personal hacker squad making itself known to all web-traffic concerned .2 points
-
@workdreamer There is a way to override core modules, but it is certainly not the best way to handle the situation here in my opinion. But still an option. And welcome to the forums, man! You've found a thing to work on you could only dream of!2 points
-
2 points
-
You have probably a typo in field migration example https://lostkobrakai.github.io/Migrations/examples/#field-migration $this->insertIntoTemplate('event', 'date', $f->name); should be $this->insertIntoTemplate('event', $f->name, 'date');2 points
-
Depending on whether the last row needs to have a complete set of elements (not sure if bootstrap's css requires that), you could also use PHP's builtin array_chunk function to make the logic clearer. $out = ""; foreach(array_chunk($page->children->getArray(), 3) as $row) { $out .= "<div class='col-xs-4'>"; foreach($row as $p) { $out .= "<img src='{$p->images->first->url}' class='img-responsive'>"; $out .= $p->title; } $out .= "</div>"; }2 points
-
1 point
-
Just wanted to add, that an image has also an width, height and description property. So you could output it like this: $thumbnail = $page->image->size(600,480); echo "<img class='entry-thumbnail' src='{$thumbnail->url}' width='{$thumbnail->width}' height='{$thumbnail->height}' alt='{$thumbnail->description}'>"; So you don't have to change the width and height attribute manually.1 point
-
For those wanting to delete source images, you can find my script in this Gist. Make sure you have successfully converted the images to the CI3 standard before you run it to delete the source images.1 point
-
This is not the right way to get the url of a single image. When using image fields you want to select the "Formatted value" setting that suits the number of images your field is allowed to hold. I recommend you stick to two of these options: Array of items - select this when "Maximum files allowed" is set to either 0 (no limit) or greater than 1 Single item - select this when "Maximum files allowed" is set to 1 Next you need to understand what is going to be returned when you use $page->image (assuming your image field is named 'image'). If you chose "single item" then $page->image will be a single image object. If you chose "array of items" then $page->image will be an array of image objects. You don't want to ever echo an object itself (it may return some value but it's generally not good practice), but you might echo some property of the object (e.g. description) or call some method on the object (e.g. url or size). When dealing with an array of image objects you will either loop over them with foreach or you can get a single object from the array with a method such as first() or eq(). So take this code example from above: You want to get the URL of a single image in the field. If your image field is formatted as "single item" then you would do this: $image = $page->image->url; If your image field is formatted as "array of items" then you would do this: $image = $page->image->first()->url; One more thing... You are setting width and height attributes on the img tag so you should use the size() method to make sure the image is cropped to the same dimensions (or same ratio of dimensions if you are wanting a HiDPI image). $page->image->size(600,480)->url Otherwise you wont get the desired result if someone uploads an image with a different aspect ratio.1 point
-
I've seen that too, hand in hand with a near doubling of new sessions in GA with arbitrary pages/view rate for last month, so this really messes up the stats. I've found some reports saying that these entries all come from Accept-Language headers (not Measurement Protocol) so it should be possible to block these requests at server level with a regex on Accept-Language that throws away anything that doesn't match the required format given in rfc7231. I'm going to take a look after Christmas hols if Akamai lets me add that such a filter in DSA. It should be relatively easy to do in Apache and NGINX, something like RewriteCond %{HTTP:Accept-Language} !^$|\*$|([a-z]{2,3}(-[a-z]{2,3})?)(\s*,\s*[a-z]{2,3}(-[a-z]{2,3})?)*($|;) [NC] RewriteRule ^.*$ "-" [F] The regex isn't a complete validity check and untested yet, but it should get the job done. Might even work for a GA filter too.1 point
-
1 point
-
1 point
-
Is this getting saved anywhere btw? $page->recurring = 0; Managed to duplicate the error you are getting. Working on it; will get back to you.1 point
-
I'm glad you brought this up. One of my sites visibility on Google tanked a few days / weeks ago and I finally tracked it down to this. Since upgrading to 3.0.45 the following no longer outputs any META Tags <?php echo $page->seo->render;?> Keen to hear other ideas etc I'd consider this critical1 point
-
You will need to put every thing of your tree pages under access control, what may not be very hard, as you can select / use the inheritance from parents to children. (Starting at HOME, you have to set it only once for the homepage in the simplest setup) Then you can create a role and user that has edit rights, but is not included in your given access control settings.1 point
-
I think the admin UI could be re-arranged into a table layout: first column: action names second column: description/notes third column: applied roles + and Edit button, that opens a modal or perhaps only unhides the role asmSelector. Alternatively you can set the asmSelect to operate in "inline" mode, I've experimented with that and it worked. I know it would take some time, but sooner or later this has to be done1 point
-
1 point
-
Hi @mel47 and @Klenkes - sorry for the delay in dealing with your issues. I have implemented some fixes, but things are not well tested yet, so I am just going to attach the updated version to this post. @mel47 - can you please test the attached version and let me know if it fixes it. I inadvertently deleted my line ending fix in a recent commit. It has been reinstated so hopefully that will take care of this for you. @Klenkes - I am not against this idea because I can understand the problems you are having. Unfortunately I think that would be a huge change to the module. I'll definitely think about it, but I can't promise a timely resolution for this I'm afraid - hope you understand! Yeah you were right - I never implemented the multiple values separator logic for files/images. The attached version should take care of this. I have tested with field pairings, but not without at the moment. Please let me know how it goes for you.1 point
-
New version now supports running actions via the API. Here's an example of copying content of a field from one page to another. Simply load the module, and call the action class name as a method while passing the required options as an array: $options = array( 'field' => 99, 'sourcePage' => 1131, 'destinationPage' => 1132 ); $modules->get("ProcessAdminActions")->CopyFieldContentToOtherPage($options); Hopefully you'll find a use for this in your hooks or template files.1 point
-
If you're keen, I'd love a PR! I think that adding it to that existing action would be the best approach, so I think I need to revisit the "Author" column so that everyone gets credit if there are multiple authors for an action.1 point
-
You are not the only one, who noticed that. If you are already using delayed output, you should check out the new region function, if you haven't already. It comes in really handy.1 point
-
This sounds like a handy AdminAction Not specifically from the parent to child page, but a general one for copying/moving from one page to another. Not sure if it would be best as a new action, or incorporated into the logic of the "Copy Field Content To Other Page" action which currently only handles basic text based fields. I would like to extend this to support all field types.1 point
-
Thanks again everything is working fine. I'm just fine tuning the form output. I'm pasting my code so someone with same problems can quickly view how to customize it based on your initial answer I had to add $childFinish since my child output was in UL tag: <?php function getComments($comments, $page, $parentID = 0, $reply = true, $child = null, $childFinish = null) { $out = ""; foreach($comments as $comment) { if($comment->parent_id == $parentID) { $reply = ($reply == true) ? "<a class='comment__reply js-comment-reply CommentActionReply comment-reply-link' data-comment-id='{$comment->id}' href='#Comment{$comment->id}'>Reply</a>" : ""; if($comment->status < 1) continue; $cite = htmlentities($comment->cite); $text = htmlentities($comment->text); $userID = $comment->created_users_id; $u = wire("pages")->get($userID); $name = ($u->displayName) ? $u->displayName : $u->name; $date = date('m/d/y g:ia', $comment->created); $out .= $child . " <li class='comment__item'> <div class='comment__item-body js-comment-item'> <div class='comment__avatar'><img src=" . wire('config')->urls->templates . "rs-template/assets/media-demo/avatars/01.jpg alt=''></div> <div class='comment__item-right'> <button class='comment__item-btn'>Edit</button> <button class='comment__item-btn'>Delete</button> </div> <div class='comment__info'><span class='comment__author'>" . $cite . "</span><span class='comment__date'>" . $date . "</span> <div class='comment__content'> <p>" . $text ."</p> </div> " . $reply ."</div> </div> <!-- end of block .comment__item-body--> "; $out .= "</li>" . $childFinish; $out .= getComments($comments, $page, $comment->id, false, "<ul class='comment__children'>", "</ul>"); } } return $out; } echo getComments($page->blog_comments, $page); ?>1 point
-
Hi @workdreamer. Welcome to ProcessWire and the forums . You are right. Very bad practice to add/remove from the core . To override any core methods you use Hooks (as long as the method you want to override is hookable). There is an example here regarding Templates: And all about Hooks:1 point
-
$out = strip_tags($page->body); echo $out; strip_tags is one way to do it. I'm not sure about performance on a large body of text though. Maybe regex would be faster, I don't know1 point
-
I'm not sure if comparing database dumps is really something to draw conclusions from for someone not so confident with the api. @Richard Jedlička The letters stand for the different types of migrations. https://lostkobrakai.github.io/Migrations/examples/#specialized-migration-types1 point
-
Hi, You might also want to compare the before and after state of the database, at least before you feel confident you are doing what you intend to do. I've already shared a simple but useful BASH 4 script to compare databases, you might also find it useful:1 point
-
There's no way to test a migration beyond just using it. That's why I feel the downgrade functionality is so important. It enables you to quickly iterate on things missing. Also keep migrations small and focused on a single concern. Personally I don't even worry about backing up my database just for running a single migration. I'm using CronjobDatabaseBackup, which does a backup every day or so and I've not restored once of of them by now. There's not really to much, where you would destroy something not quickly fixable via the admin backend. For more involved changes, where lot's of pages are affected I also like to split things up in multiple migrations, which I can run manually – checking things after each migration. After a few initial migrations written the potential of bugs will also considerably drop for everything "standard". E.g. creating a field with a FieldMigrations is essentially just setting some properties. The hard stuff is already taken care for. If you make errors there it's a matter of deleting the field and rerunning the migration and everythings fine again.1 point
-
1 point
-
In recent PW3 versions you can prepend "http" and get absolute urls like this: $config->urls->httpTemplates1 point
-
Hello folks, I experienced the same issue. Once on a fresh installation with 3.0.45 and on an updated page from 3.0.44 to 3.0.45. Both lacked the seo output support! Thanks, Martin1 point
-
<?php /** * Add "Siblings" tab to page editor. * */ class PageEditSiblings extends WireData implements Module { public static function getModuleInfo() { return array( "title" => "Page Edit Siblings", "summary" => _("Add siblings tab to page edtior"), "version" => "0.0.1", "autoload" => true ); } public function init() { $this->addHookAfter("ProcessPageEdit::buildForm", $this, "addSiblingsTab"); } public function addSiblingsTab(HookEvent $event) { $edit = $event->object; $form = $event->return; $master = $edit->getMasterPage(); $page = $master ? $master : $edit->getPage(); $wrap = $this->buildFormSiblings($edit, $form, $master, $page); $form->insertAfter($wrap, $form->get("ProcessPageEditChildren")); } public function ___buildFormSiblings($edit, $form, $master, $page) { $wrapper = $this->wire(new InputfieldWrapper()); $id = $this->className(); $wrapper->attr('id+name', $id); if(!empty($settings['ajaxChildren'])) $wrapper->collapsed = Inputfield::collapsedYesAjax; $defaultTitle = $this->_('Siblings'); // Tab Label: Siblings $title = $this->page->template->getTabLabel('siblings'); if(!$title) $title = $defaultTitle; if($page->parent->numChildren > 1) $wrapper->attr('title', "<em>$title</em>"); else $wrapper->attr('title', $title); $this->addTab($edit, $id, $title); if(!$edit->isPost) { $pageListParent = $page->parent; /** @var InputfieldMarkup $field */ $field = $this->modules->get("InputfieldMarkup"); $field->label = $title == $defaultTitle ? $this->_("Sibling Pages") : $title; // Siblings field label if($pageListParent->numChildren > 1) { $field->value = $this->renderPages($pageListParent->children(), $page); } else { $field->description = $this->_("There are currently no siblings of this page."); } if($page->addable()) { /** @var InputfieldButton $button */ $button = $this->modules->get("InputfieldButton"); $button->attr('id+name', 'AddPageBtn'); $button->attr('value', $this->_('Add New Page Under Parent')); // Button: add new child page $button->icon = 'plus-circle'; $button->attr('href', "../add/?parent_id={$page->parent->id}" . ($this->input->get('modal') ? "&modal=1" : '')); $field->append($button); } $wrapper->append($field); } return $wrapper; } public function ___renderPages($list, $cur) { $out = '<div class="PageList" style="display: block;">' . "\n"; foreach($list as $p) { $out .= ($p == $cur) ? "<div class='PageListItem'>{$p->title}</div>\n" : "<div class='PageListItem'><a href='{$this->page->url}?id={$p->id}' title='{$p->name}' class='PageListPage label'>{$p->title}</a></div>\n" ; } $out .= "</div>"; return $out; } protected function addTab($edit, $siblingid, $siblingtitle) { $tabs = $edit->getTabs(); $removed = array(); foreach(array_reverse($tabs) as $id => $title) { if($id == "ProcessPageEditChildren") { break; } $removed[$id] = $title; $edit->removeTab($id); } $edit->addTab($siblingid, $siblingtitle); foreach(array_reverse($removed) as $id => $title) { $edit->addTab($id, $title); } } } Only tested on PW 3.0.34 but should (I hope) work on any 2.7.x / 2.8.x / 3.0.x install. Large parts stolen from ProcessPageEdit::___buildFormChildren.1 point
-
Hi I installed this module and it worked fine. But yesterday I upgraded the Processwire in version 3.0.44 (older was 3.0.42). Since this action I had this error on page rendering : Notice: Trying to get property of non-object in /processwire/site/assets/cache/FileCompiler/site/modules/MarkupSEO/MarkupSEO.module on line 127 On line 127 : $dataRendered = $this->page->seo->render; I lost $this->page->seo ! Any Idea ? Thx1 point
-
@mel47 and @Klenkes - not ignoring you guys - I will try to take a look at your issues/requests in a next few days.1 point
-
Hi @godmok. Some time ago I had almost the same questions as you and I came to this solution: $input->whitelist('q', $q); $qs = explode(" ", $q); foreach($qs as $key => $q){ $qs[$key] = $sanitizer->selectorValue($q); } $selector = "template=product, product_cache%=". implode("|", $qs) .""; $matches = $pages->find($selector) And it looks like it covers1 point
-
@szabesz you'll need to remove the line that I added to block attempts to scan Wordpress, or you won't be able to login: RedirectMatch 403 (?i)(wp-admin|wp-content|wp-login) But you can basically copy and paste from from the code from the original site: https://perishablepress.com/6g/1 point
-
Not saying that multiple branch support wouldn't be a cool feature for Admin Restrict Branch, but in case visibility is not an issue and you're looking into ways to restrict permissions per branch, I would also suggest taking a look at UserGroups and Dynamic Roles. The approaches are slightly different, but both modules already provide support for this.1 point
-
Hi Bernhard, In its current state, the Google Analytics module does display a uesful subset of the available analytics data. In my opinion, it's not the job of the module to filter out data. I would suggest to create another module which does this job. Or maybe I'm misunderstanding something? Can we filter out those spam entries when querying data with the API?1 point