Jump to content
#StayAtHome ×

valandor

Members
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

0 Neutral

About valandor

  • Rank
    Member
  1. Hello all, Thought I'd take a moment to introduce myself. I've been developing with PHP off and on for about 16 years now. I have also learned the basics of C, C++, Java and C#. Most of my experience with PHP is procedural as I work on a lot of smaller projects that don't require much scale-ability. I've started developing for WordPress recently and I'm spending time to learn how to do things the "WordPress Way". I look forward to being part of this community and helping where I can as well as learning new concepts and techniques from reading through all the different tutorials and reading others responses.
  2. Thank you for your response. I really appreciate you taking the time to answer me. I'll check out the boilerplate and creating a custom plugin, or plugins is a great idea. Once I have more than the basic template up and running I'll be sharing it to so people can use it.
  3. You're getting an undefined constant error because php assumes exciting would be a constant. If you want to check if $red is equal to the sting of exciting you can either wrap it in single or double quotes. <?php $red = exciting; do { echo "<p>It's $red to be red.</p>"; } while ($red == "exciting"); ?>
  4. So I really haven't done much as far as WordPress development and I'm currently creating my first basic template. I've been looking through their examples in their documentation, and I have everything loading correctly so far. I have my walker class working for my Foundation menus etc. However, before I get to far along I'd like to get someones opinion on the best practices on creating WordPress templates. While I can create a huge functions.php file I would like to be able to split the template apart into easier to understand bits of code. I would want to create an auto-loading using psr-4 principals and create custom classes separated out into different files. So if it would be to retrieve the template css directory I could use something like $template->get->cssDir(). I would use the built in features of WordPress but build it all into different classes. So really I am wondering if this is a waste of time, or is it worth it to make the code easier to read or understand for other developers later on? Thanks, Valandor
  5. Better is a pretty broad term. While many will say that a VPS is better than shared hosting, there are a lot of things to consider. The first being what the site is being used for, and the amount of traffic you're generating to your site. While it's true that shared hosting has its limitations, if you never reach those limitations then it's they're not an issue. Second to consider is are you going to use a managed VPS or un-managed VPS? Managed VPS usually are set up decently secure and include firewall protection alongside intrusion detection software. While un-managed usually means this is all up to you to accomplish. The reason I say usually is because there is always exceptions to everything, and I don't like blanket statements. So if you have the experience or the money to hire someone to keep your server secure an un-managed VPS could be what you're looking for, if not may want to look into the managed VPS option. Of course if you can find a host who offers all of these options you can always allow yourself to grow as needed. So you can start off on a shared hosting account and upgrade as needed. Many hosts will transfer your files and help you get things set up and going from one account type to another. While others won't... So it's important to know what your hosting service offers to help keep you up and running as your business progresses forward if you decide to go with this option.
  6. Hello, I took a look at the API and it's response to a query of /explore?near=houston&query=donuts&limit=10&[OATHKEY] What I found is individual vendor information is stored at $json['response']['groups'][0]['items'] So my code is as follows (feel free to make it pretty) $json_response = file_get_contents("https://api.foursquare.com/v2/venues/explore?near=houston&query=donuts&limit=10&oauth_token=TOKEN HERE"); $json =json_decode($json_response,1); if(shuffle($json['response']['groups'][0]['items'])){ foreach ($json['response']['groups'][0]['items'] as $item){ print_r($item); } }
  7. You can try using chunck_split() something like $string = chunk_split($string, '128', '<br />'); This worked on a large string I randomly generated. The reason that the nl2br() method doesn't work for you is because there are no new lines (\r\n) in your string. nl2br() converts those new line characters to <br /> tags. If there are going to be new lines in your text you can use the nl2br(). You can use the word-wrap function as well. If it's going to be one long word like all of your a's you would want to set the optional Boolean at the end to true to cut a word at the breaking point, otherwise it's going to wait till the end of the word to add the <br /> character into it... So in your case of all the A's it'll add it in after the last "a" doing a whole lot of nothing for you.
  8. Email can be a tricky matter. Sometimes things don't make it to a mailbox because it makes spam filters go off, which is an issue I've had. I contacted my host and they ran a test on the emails I previously sent. They rated the emails on their spam filter and gave me excellent advice to fix my issues. So I would suggest starting there if your host is willing.
  9. Try this below. $str = nl2br($_POST['email']); $re = "/(?:\sF\d+.*?\n\n)(\n)/"; $subst = ">>CUT HERE>>"; $result = preg_replace($re, $subst, $str); echo $result; nl2br()
  10. For the registration form I would var_dump() $pass1, $pass0, and $passr in all the browsers and check to ensure they are all the same. I would also var_dump $passl for the login page in all the browsers and ensure they are all the same. I'm unsure of what the function $project->createUser() does, but it is possible that it's hashing the password as well which would make it to where the passwords wouldn't match in the database, if of course $project->viewProtectedArea() doesn't do the same. If it's possible to see these two methods I think it'll help as they seem to be the backbone of the registration and login process.
  11. I was thinking of HTTP_POST_VARS ... Never answer questions on a heavy dose of meds is a good side note of this. I usually create helper classes to sanitize and validate my data depending on what I'm doing with it. I usually suggest to use the filter_input methods if a question is vague. This will at least get someone on a path of sanitizing and validating their data prior to doing anything with it. To many times I've seen people who take form data and save it right to a database because they followed some basic online tutorial that doesn't give any kind of security advice along side the basic how to. Thank you all who pointed out my mistake, and I'll try to remember my meds alter the state of my mind and I shouldn't try to answer questions shortly after taking them again
  12. I would suggest looking at filter input and the types of filters it has out of the box. Remember to never retrieve data from $_POST or $_GET as they are deprecated. Always validate and sanitize your data.
×
×
  • 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.