Thread: Auto-Fill
View Single Post
  #12 (permalink)  
Old 04-16-2008, 11:58 PM
knight01 knight01 is offline
New Pligger
 
Join Date: Jul 2007
Posts: 6
Thanks: 1
Thanked 1 Time in 1 Post
Ok, I think I've got it.

Many thanks to Geoserv who did all the hard work by coming up with the basis of this.

Find this line in the ./lib/link.php
PHP Code:
if(preg_match("'<title>([^<]*?)</title>'"$this->html$matches)) {
            
$this->url_title=trim($matches[1]);
        } 
Add his modified code shown below just after that line.

PHP Code:
if ( preg_match '~<meta(.+?)name="description"(.+?)>~i'$this->html$matches ) ){
$description preg_replace'~^(.+?)content="([^"]+?)"(.+?)$~i''$2'$matches[1].$matches[2] );
$descriptionstr_replace("content=\""" "trim($description));
$descriptionstr_replace("\""" "trim($description));
$this->content=$description;

Since my regex is weak, I did a string replace to get rid of the 'content="' and the final quote mark he was having trouble with. I took that and made a smarty variable out of it.

Save your ./lib/link.php

Now open the ./submit.php
find this line (around line #167 / 168 depending on other modifications)

PHP Code:
$main_smarty->assign('submit_url_title'$linkres->url_title); 
Under it add...

PHP Code:
$main_smarty->assign('submit_content'$linkres->content); 
Save your submit.php

Now if the site being submitted has a meta description tag, it should show by default in the description box on step two of submit. If the user wants to add or change it, the updated description will be saved and not the meta description.

Hope this helps someone out there!
Reply With Quote
The Following User Says Thank You to knight01 For This Useful Post: