Jump to content

JacobSeated

Members
  • Content Count

    22
  • Joined

  • Last visited

Community Reputation

1 Neutral

About JacobSeated

  • Rank
    Member

Profile Information

  • Gender
    Male
  1. That makes sense, thanks. I am now wondering if I should use preg_replace_callback or if it is safe to use addslashes. Guess I have to read up on those.
  2. I recently fixed a bug in my own website involving preg_replace, the thing is, each time I was editing an article in the front-end, preg_replace would be called on the HTML to replace certain HTML elements. What I suspect is that preg_replace has a bug that causes it to remove certain characters from the replacement string, leading to corruption of the output. Obviously only the HTML (haystack) should be modified, and the replacement string dropped in place of the needle, without modifying it in any way. This is not what happens if the replacement string contains backslashes. I have tr
  3. Hallo again, it turns out I was on a completely wrong track. If the Theme is object orientated, then it may have something like this as the top of each PHP class: if ( ! class_exists( 'TravShortcodes' ) ) : If that is the case, then it will only apply the parent class if it has not already been included. This means that you should just copy the file over to the child theme folder, and then include it from your functions.php: include_once get_stylesheet_directory_uri() . 'shortcodes.php'; This way you can easily modify any aspect of the parent that you want. It is imp
  4. I am making some progress in debugging this. Of course I did not mean "filter", as I am trying to override an existing shortcode. Anyway, I managed to verify that the shortcode has been added. I noticed the parent theme is using the init hook to add shortcodes. Then I tried print_r($shortcode_tags) again after using the init hook in my child theme, with a priority of 20, and I was finally able to verify that the shortcode is loaded. I.e.: add_action('init', 'replace_parent_theme_features', 20); function replace_parent_theme_features() { global $shortcode_tags; print_r($shortcode
  5. Hallo PHP geeks I need to override a parent-theme shortcode in Travelo from a child theme; I can edit the parent theme files just fine, but when I try to override the shortcode function from the child theme, nothing seems to happen, regardless of which hook I use to do so. I can tell that my filter function (add_new_child_shortcodes) is called, because when I echo directly from the filter, I do get my output. This fact indicates that the remove_shortcode function is called at the wrong time, and the parent function is never removed. From experimenting I know that the child-theme func
  6. On second look, this pre-configured box is not usable to me, since I need to learn to use Bitnami as well, and the paths are also non-standard, so I have no idea where to find the files I need to edit. An old fashioned LAMP install is just so much easier to work with for me. I wasted a lot of time trying to just get it to work with a domain name instead of the bare IP address. Guess that settles my doubts.. Will go for the latest version, with a manually installed Elasticsearch. Strange that I find this much easier than all this auto-installer stuff...
  7. Hallo people, this forum has been a help and inspiration before, so lets see about this one.. I am in the situation that I promised my boss to try and learn Magento, possibly with the aim to help out with development in the future. Now I just depleted my mental energy from trying to get the Elasticsearch Service, as offered by AWS, to work. I was unable to connect from my EC2 instance (even with the WAN IP approved in the security group). Then I noticed today that AWS has a pre-configured 2.3 Magento option for Lightsail — which is really tempting for me at this point — but th
  8. I own a website/blog where I write about different technical subjects, mainly web-development and coding. No reason to post it here, since I am not trying to advertise. Over the years I have observed some really weird and interesting things that people will do relating to my site. One time, someone took my entire website and placed it in an iframe. The site that did this was total spam. Never found out why or what they wished to accomplish by doing it. Luckily I have not had major problems with plagiarism yet, but I do have scrapers stealing my content and posting it together with spa
  9. I used h1's in my section elements for a while a few years back, on my tutorial site, without noticing any negative effect on my traffic. I changed back to h2-h6+section when it was made known that some assistive tech did not support it yet, and also the document outline go messed up since browsers also did not support it. I still hope that it is implemented, but I guess I have no real use for it right now. Interesting you actually tried doing that and it resulted in a 400 error. I was wondering about how to test that.
  10. I think those SEO plugins tend to cause more confusion than they add value. I have personally never used them, and I do not care if some of my title tags are too long, duplicated, or if my descriptions are too short. If some of my descriptions are short, then it is probably intentionally, and I do not want notifications about it. Having said that, chances are that you can enter in: https://example.com./ With a "dot" in front of the slash, this is also a useful trick to circumvent certain cookie-walls on websites. I think very few websites seem to normalize such requests, since develo
  11. Ahh, it seems PHP is using "**" instead of "^" for some reason. https://www.php.net/manual/en/language.operators.arithmetic.php Somehow that slipped past me. Thanks anyway though 🙂
  12. Hey, Strange issue here with basic math. It works on my calculator, but not in PHP. 1000*1.1^1 should result in 1100, but instead gives me 1101. I.e: echo 1000*1.1^1; // 1101 What am I missing? What is with the tiny inaccuracy?
  13. Thanks, this is much appreciated. It actually looks like you are right, and this is the default behavior. Maybe this is better documented here, at least for PHPMailer: https://packagist.org/packages/phpmailer/phpmailer Use statements also seem to work. It looks like the vendor/project part is what is listed in composer.json, in the "require" section. I wonder if there is a "standard" way to include this in my index.php file, so I do not have to write all those use statements? I read somewhere else that the vendor/composer/autoload_namespaces.php is supposed to update an array automatical
  14. Hallo, I have a strange problem with a freshly installed composer project that is not loading the dependencies as the documentation states it should. I just made a new directory (www/site/test/), which has a index.php file, and I want to be able to use composer-installed dependencies from within the index.php file, inside the test folder; is this the wrong way to do it? Do I need to place my project root somewhere else for it to work? Dependencies are installed like this: composer require phpmailer/phpmailer For some strange reason, the autoloader is not loading the dependen
  15. You do not have to redirect the user after submitting a form (handling a POST request). An easier, and often better, way to show the user whether the data was accepted would be to tell them on the submit location itself. You could also add a back button to allow the user to safely return to the previous page after reading the status message. I know this is probably just a basic example, but you should also remember to validate your POST fields.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.