Eric P
Forum Replies Created
-
Forum: Themes and Templates
In reply to: get name of page template on a pageI cooked this up … It may be useful as a plugin? Any interest as a plugin, give me a shout … eric pecoraro _at_ shepard dot com
It involves some overhead, so it would obviously be used for development only. Not tested thoroughly, but it works on my system.
<?php // this can live in /themes/mytheme/functions.php, or maybe as a dev plugin? function get_template_name () { foreach ( debug_backtrace() as $called_file ) { foreach ( $called_file as $index ) { if ( !is_array($index[0]) AND strstr($index[0],'/themes/') AND !strstr($index[0],'footer.php') ) { $template_file = $index[0] ; } } } $template_contents = file_get_contents($template_file) ; preg_match_all("(Template Name:(.*)\n)siU",$template_contents,$template_name); $template_name = trim($template_name[1][0]); if ( !$template_name ) { $template_name = '(default)' ; } $template_file = array_pop(explode('/themes/', basename($template_file))); return $template_file . ' > '. $template_name ; } ?>Useage (in /themes/mytheme/footer.php would work)
<?php if (is_user_logged_in()) { echo ' | '. get_template_name() ; } ?>Forum: Themes and Templates
In reply to: get name of page template on a pageprint_r( debug_backtrace() )will return an array of all physical files called by the script. Could write a plugin, or a function to show just the template files based on a condition of “/themes/” of the found files…
Good catch! What was I thinking! I was all thunked out at the time ;).
Forum: Plugins
In reply to: [Plugin: My FTP] MyFTP- Can be very dangerous on shared hosting accounts“It’s worse than that, he’s dead Jim, DEAD.”
“Danger, danger, danger Will Robinson!!”
WordPress Red Alert!
PHP Shared Server Red Alert!
“The sky is falling!”This situation is not unique to your host. It is a *nix security issue that is ongoing.
The real danger with MyFTP is that you don’t have to be a PHP hack to hack other sites on your server.
Also, and I won’t go into details here, but you can bring a whole server down with this plugin without being a stellar hacker. I love the concept, but the author should build in some php safeguards to MyFTP, which would be easy enough to do.
That being said, there are things that your host can do:
- http://shiflett.org/articles/shared-hosting
- http://www.php-editors.com/apache_manual/misc/security_tips.html
- http://www.webhostingtalk.com/archive/index.php/t-218775.html
Also, probably the best quick fix is to set the permissions to 711 on the parent directory of all the WordPress installs.
Forum: Themes and Templates
In reply to: Get child theme directory pathGood stuff. Thanks.
I put:
define(‘child_template_directory’, dirname( get_bloginfo(‘stylesheet_url’)) );
in a my child theme functions.php. Seems to make sense there…
Forum: Requests and Feedback
In reply to: [Plugin: Search and Replace] Great plugin!Absoposalutely a great plugin! Saved me hours & hours! Thanks!!!
Okay, I’ve been racking my brain on this and I almost gave up on cf7. I even made a copy of an exact site that was working and moved it to a new URL (on the same server) and it broke. Then I reinstalled PHP. Then I, then I, then I, then I <insert senseless straw grabbing here>. Nothing but the spinning arrow.
It’s obviously an AJAX issue, maybe related to a URL/domain setting?
In any case, my ugly fix (that actually works) is as follows:
in /wp-content/plugins/contact-form-7/contact-form-7.js,
comment out the document ready function as follows (starting with the top line):
/* jQuery(document).ready(function() { */ try { jQuery('div.wpcf7 > form').ajaxForm({ beforeSubmit: wpcf7BeforeSubmit, dataType: 'json', success: wpcf7ProcessJson }); } catch (e) { } try { jQuery('div.wpcf7 > form').each(function(i, n) { wpcf7ToggleSubmit(jQuery(n)); }); } catch (e) { } /* }); */This essentially breaks the background functionality of the AJAX, and forces the form to reload with the appended string like #wpcf7-f5-p523-o1, but at least it works until something better comes along!
cf7 is hands down the best form plugin out there, else I wouldn’t put so much effort into keeping it installed!
Forum: Plugins
In reply to: [Plugin: Search Unleashed] problem after 2.7 upgradeNice catch tomchen1989. I used your fix interim.
The author has since fixed this issue in version Version: 0.2.27. I was having the same problem and this version works for me.