symfony crawler access nested div - symfony

I'm desperately trying to access content in a nested div :
<tr>
<th class="monthCellContent" style="vertical-align : top">
<div class="monthEventWrapper">
<div class="monthEvent">
<a class="event"
href="/event/1"
title="test title updated - test place - 09:00-10:00">
09:00
<span class="showForMediumInline">
test title updated test place
</span>
</a>
</div>
</div>
</th>
</tr>
I'm trying to access "09:00" and "test title updated test place" in the link.
I'm somehow stuck at
<div class="monthEventWrapper">
which I can access with
$items = $crawler->filter('div[class="monthEventWrapper"]');
print "\n found " . count($items) . " monthEventWrapper divs\n";
found 35 monthEventWrapper divs
but I cannot access
<div class="monthEvent">
with
$items = $crawler->filter('div[class="monthEvent"]');
print "\n found " . count($items) . " monthEvent divs\n";
found 0 monthEvent divs
I tried all variations around
foreach ($items as $item) {
foreach ($item->childNodes as $child) {
$value .= $paragraph->ownerDocument->saveHTML($child);
}
}
and
$crawler->filterXPath('//div[#class="monthEvent"]')
with no luck.
The html passes validations and there's no js.
Thanks !

This a workaround type of code:
<?php
use Symfony\Component\DomCrawler\Crawler;
require_once(__DIR__ . '/../vendor/autoload.php');
$html = <<<'HTML'
<!DOCTYPE html>
<html>
<body>
<tr>
<th class="monthCellContent" style="vertical-align : top">
<div class="monthEventWrapper">
<div class="monthEvent">
<a class="event"
href="/event/1"
title="test title updated - test place - 09:00-10:00">
09:00
<span class="showForMediumInline">
test title updated test place
</span>
</a>
</div>
</div>
</th>
</tr>
</body>
</html>
HTML;
$crawler = new Crawler($html);
$crawlerFiltered = $crawler->filter('div[class="monthEventWrapper"] a');
$results = [];
$childResults = [];
for ($i=0; $i<count($crawlerFiltered); $i++) {
$results[] = removeLeadingAndTrailingWhiteCharsAndNewLine($crawlerFiltered->eq($i)->text());
$children = $crawlerFiltered->eq($i)->children();
if (count($children)) {
for ($j=0; $j<count($children); $j++) {
$childResults[] = removeLeadingAndTrailingWhiteCharsAndNewLine($children->eq($j)->text());
}
}
}
$results[0] = substractSpan($results[0], $childResults[0]);
function removeLeadingAndTrailingWhiteCharsAndNewLine(string $text) : string
{
$pattern = '/(?:\r\n[\s]+|\n[\s]+)/s';
return preg_replace($pattern, '', $text);
}
function substractSpan($text, $textToSubstract) : string
{
$length = strlen($text) - strlen($textToSubstract);
return substr($text, 0, $length);
}
echo 'Parent Nodes:' . PHP_EOL;
var_export($results);
echo PHP_EOL;
echo 'Child Nodes:' . PHP_EOL;
var_export($childResults);
echo PHP_EOL;
echo 'Time: ';
echo $results[0];
echo PHP_EOL;
echo 'Text: ';
echo $childResults[0];
but gives this result:
Parent Nodes:
array (
0 => '09:00',
)
Child Nodes:
array (
0 => 'test title updated test place',
)
Time: 09:00
Text: test title updated test placee
Note I used for loop with ->eq(<node-number>) that gives Crawler instance instead of DOMNode that you get by using foreach
Note the code assumes the wanted text part 9:00 is at the beginning.

Related

Having issues getting the post tags to display in archive page - wordpress

I am using jnews as a theme and a "block" template feeds the look of my page located here
https://theseeker.ca/category/lifestyle/
where the category displays, on the picture, I want to display the tags instead and I tried everything I could possibly think of, to no avail. This is the code and in bold, what I want to replace with tags.
<?php
/**
* #author : Jegtheme
*/
namespace JNews\Module\Block;
class Block_37_View extends BlockViewAbstract {
public function render_block_type_1( $post, $image_size ) {
$post_id = $post->ID;
$box_shadow_flag = isset( $this->attribute['box_shadow'] ) && $this->attribute['box_shadow'] ? 'box_shadow' : '';
$permalink = get_the_permalink( $post );
return '<article ' . jnews_post_class( 'jeg_post ' . $box_shadow_flag, $post_id ) . ">
<div class='box_wrap'>
<div class=\"jeg_thumb\">
" . jnews_edit_post( $post_id ) . "
{$this->get_thumbnail($post_id, $image_size)}
**# <div class=\"jeg_post_category\">
# <span>{$this->get_primary_category($post_id)}</span>
# </div>**
</div>
<div class=\"jeg_postblock_content\">
<h3 class=\"jeg_post_title\">
" . get_the_title( $post ) . "
</h3>
{$this->post_meta_1($post)}
</div>
</div>
</article>";
}
How am I supposed to achieve that?
get_the_tags function triggers a critical error
Which critical error do you get?
Have you passed Post Id or Object to the get_the_tags function?
$posttags = get_the_tags($post_id);
if ($posttags) {
foreach($posttags as $tag) {
echo $tag->name . ' ';
}
}

WordPress - Overwriting a template plugin Shortcode

I'm new to php and wordpress.
When I edit an icon box from the theme in the admin panel, i have a few fields, like "title" and "content". The title is inside <h4> </h4> and content is inside <p>
</p>
I need to add another <p style='iconbox_price'></p> after the content, so i can edit it in the admin panel.
This is the code for the iconbox. How can i add this to it, so it would work out.
<?php
function easyweb_webnus_iconbox( $attributes, $content = null ) {
extract(shortcode_atts(array(
"type"=>'',
'icon_title'=>'',
'icon_link_url'=>'',
'icon_link_text'=>'',
"icon_name"=>'',
"iconbox_content"=>'',
"icon_size"=>'',
"icon_color"=>'',
"title_color"=>'',
"content_color"=>'',
"link_color"=>'',
"icon_image"=>'',
"featured"=>'',
"border_left"=>'',
"border_right"=>'',
), $attributes));
ob_start();
$type = ( $type == 0 ) ? '' : $type ;
$iconbox_style = $type17_start_wrap = $type17_end_wrap = '';
if ( $type==17 ) {
$iconbox_style = ( !empty($icon_color) ) ? ' style="color: ' . esc_attr($icon_color) . '"' : '' ;
$type17_start_wrap = '<div class="icon-wrap" style="background-color:' . esc_attr($icon_color) . '">';
$type17_end_wrap = '</div>';
}
$iconbox22_class = '';
if ( $type == 22 ) {
$iconbox22_class .= $featured ? ' ' . $featured : '';
$iconbox22_class .= $border_left ? ' ' . $border_left : '';
$iconbox22_class .= $border_right ? ' ' . $border_right : '';
}
echo '<article class="icon-box' . $type . $iconbox22_class . '" ' . $iconbox_style . '>';
if(!empty($icon_name) && $icon_name != 'none') :
if(!empty($icon_link_url))
echo '' . $type17_start_wrap . '' . do_shortcode( "[icon name='$icon_name' size='$icon_size' color='$icon_color']" ).'' . $type17_end_wrap . '';
else
echo $type17_start_wrap . do_shortcode( "[icon name='$icon_name' size='$icon_size' color='$icon_color']" ) . $type17_end_wrap;
elseif(!empty($icon_image)) :
if(is_numeric($icon_image)){
$icon_image = wp_get_attachment_url( $icon_image );
}
if(!empty($icon_link_url))
echo "<a href='$icon_link_url'>" . '<img src="'.$icon_image.'" alt="" />' . '</a>' ;
else
echo '<img src="'.$icon_image.'" alt="" />';
endif;
$title_style = !empty($title_color)?' style="color:'.$title_color.'"':'';
echo '<h4'.$title_style.'>' . $icon_title . '</h4>';
$content_style = !empty($content_color)?' style="color:'.$content_color.'"':'';
echo '<p'.$content_style.'>'.$iconbox_content .'</p>' ;
$link_style = !empty($link_color)?' style="color:'.$link_color.'"':'';
echo (!empty($icon_link_url) && (!empty($icon_link_text)) )?"<a".$link_style." class=\"magicmore\" href=\"{$icon_link_url}\">{$icon_link_text}</a>":'';
echo '</article>';
$out = ob_get_contents();
ob_end_clean();
$out = str_replace('<p></p>','',$out);
return $out;
}
add_shortcode('iconbox', 'easyweb_webnus_iconbox');
In html this is the code, that is generated:
<article class="icon-box14">
<a href="/razrabotka-saitov/">
<i class="sl-screen-desktop" style=" font-size:42px;"></i>
</a>
<h4 style="height: 22px;">Title</h4>
<p style="height: 116px;">Content<br></p>
<a class="magicmore" href="#">More</a>
</article>
You see the line there:
echo '<p'.$content_style.'>'.$iconbox_content .'</p>' ;
You can add your custom paragraph to that line:
echo '<p'.$content_style.'>'.$iconbox_content .'</p>
<p style='iconbox_price'></p>' ;
I found the solution in my case. Maybe it will help somebody else. I had to edit two files. In my case this is where the first file was located.
wp-content/plugins/'theme'-shortcodes/shortcodes/iconbox.php
I tried to look for where comes the variable $iconbox_content and found it in getting extracted in the code above from an array at this point:
extract(shortcode_atts(array(
"type"=>'',
'icon_title'=>'',
'icon_link_url'=>'',
'icon_link_text'=>'',
"icon_name"=>'',
"iconbox_content"=>'',
"icon_size"=>'',
"icon_color"=>'',
"title_color"=>'',
"content_color"=>'',
"link_color"=>'',
"icon_image"=>'',
"featured"=>'',
"border_left"=>'',
"border_right"=>'',
), $attributes));
So i searched through all the wordpress directory files, because i did not even have an idea where can i find it.
And found it in the themes => 'my theme' => 'my theme' => visualcomposer => shortcodes directory as 03-iconbox.php
I had there different arrays such as this:
array(
"type"=>'textarea',
"heading"=>esc_html__('Content', 'ew'),
"param_name"=> "iconbox_content",
"value"=>"",
"description" => esc_html__( "IconBox Content Goes Here", 'ew')
),
So i guess, the other half of what i did is very logical already, but here it is anyway:
I added an array in this file:
array(
"type"=>'textarea',
"heading"=>esc_html__('Price', 'ew'),
"param_name"=> "iconbox_price",
"value"=>"",
"description" => esc_html__( "Price goes here", 'ew')
),
And in the first file:
To extract "iconbox_price" =>'',
And lower: echo '<p class="iconbox_price">'.$iconbox_price .'</p>' ;
Wish that this helps someone!

Wordpress - Nested shortcodes rendering

first of all I know which my problem is not at all related to the sage project but I know that your advanced wordpress knowledge can help me to get through that.
p.s. I've been creating my shortcodes upon sage scaffolding.
I built two shortcodes for nested using:
[outdoor]
[outdoor_item title="My title 1" color="orange"]<strong>The</strong> 1st Content[/outdoor]
[outdoor_item title="My title 2" color="blue"]<strong>The</strong> 2nd Content[/outdoor]
[outdoor_item title="My title 3" color="green"]<strong>The</strong> 3rd Content[/outdoor]
[outdoor_item title="My title 4" color="red"]<strong>The</strong> 4th Content[/outdoor]
[/outdoor]
After lots of hours searching something in stackoverflow and google I figured it out that I had to apply do_shortcode() in my RAW outdoor shortcontent content... something like this:
add_shortcode('outdoor', function($atts, $content, $tag) {
return '<div class="outdoor">' . do_shortcode($content) . '</div>';
});
and then my problem comes out... the function do_shortcode() renders ONLY my first outdoor_item and ignores every outdoor_item else. It outputs something like this:
<div class="outdoor">
<div class="outdoor-item" style="background-color: orange">
<h1>My title 1</h1>
<div class="outdoor-item-content">
<strong>The</strong> 1st Content
</div>
</div>
</div>
p.s. I've tried do_shortcode(), apply_filters('the_content', $content) and even call wp_reset_postdata() after each outdoor_item. What else could I try?
Recently I had similar issue.
I needed to wrap elements into the bootstrap table so the shortcode should be the following:
[table]
[fb_review href="" name="" date=""][/fb_review]
[fb_review href="" name="" date=""][/fb_review]
[fb_review href="" name="" date=""][/fb_review]
[fb_review href="" name="" date=""][/fb_review]
[fb_review href="" name="" date=""][/fb_review]
[/table]
and this should produce the following html:
<div class="row">
<div class="col-md-6"><div class="fb-review">Some content</div></div>
<div class="col-md-6"><div class="fb-review">Some content</div></div>
</div>
<div class="row">
<div class="col-md-6"><div class="fb-review">Some content</div></div>
<div class="col-md-6"><div class="fb-review">Some content</div></div>
</div>
<div class="row">
<div class="col-md-6"><div class="fb-review">Some content</div></div>
</div>
I looked for different ways how to handle this but then decided to parse the $content string by myself
here is the part of functions.php:
//this function just wraps the compiled nested shortcode elements
function responsive_table($attrs, $items = []) {
if (count($items) > 0) {
$result = '';
$counter = 0;
foreach ($items as $item) {
if (!($counter % 2)) {
$result .= '<div class="row">';
}
$result .= '<div class="col-md-6">' . $item . '</div>';
if ($counter % 2) {
$result .= '</div>';
}
$counter++;
}
if ($counter % 2) {
$result .= '</div>';
}
return $result;
} else {
return '';
}
}
// this function parses the content, fetches internal shortcodes, compiles them and passes to responsive_table
function responsive_table_for($attrs, $content=null) {
if ($content != null && $content != '') {
$content_matches = [];
preg_match_all('/\[.+?\[.+?\]/', $content, $content_matches); // TODO: this doesn't support nested shortcodes
$content_array = [];
foreach ($content_matches[0] as $item) {
$content_array[] = do_shortcode($item);
}
return responsive_table($attrs, $content_array);
} else {
return '';
}
}
add_shortcode('table', 'responsive_table_for');
Maybe this way is not the best but it works for me.

Wordpress Category image display

I am using a script found at http://wpdevsnippets.com/add-category-tag-taxonomy-picture/. However, I cannot get the writer to answer a usage question, so here it is:
How do I use this script with a custom taxonomy on a page.php or archive.php template?
add_action('admin_head', 'wpds_admin_head');
add_action('edit_term', 'wpds_save_tax_pic');
add_action('create_term', 'wpds_save_tax_pic');
function wpds_admin_head() {
$taxonomies = get_taxonomies();
//$taxonomies = array('category'); // uncomment and specify particular taxonomies you want to add image feature.
if (is_array($taxonomies)) {
foreach ($taxonomies as $z_taxonomy) {
add_action($z_taxonomy . '_add_form_fields', 'wpds_tax_field');
add_action($z_taxonomy . '_edit_form_fields', 'wpds_tax_field');
}
}
}
// add image field in add form
function wpds_tax_field($taxonomy) {
wp_enqueue_style('thickbox');
wp_enqueue_script('thickbox');
if(empty($taxonomy)) {
echo '<div class="form-field">
<label for="wpds_tax_pic">Picture</label>
<input type="text" name="wpds_tax_pic" id="wpds_tax_pic" value="" />
</div>';
}
else{
$wpds_tax_pic_url = get_option('wpds_tax_pic' . $taxonomy->term_id);
echo '<tr class="form-field">
<th scope="row" valign="top"><label for="wpds_tax_pic">Picture</label></th>
<td><input type="text" name="wpds_tax_pic" id="wpds_tax_pic" value="' . $wpds_tax_pic_url . '" /><br />';
if(!empty($wpds_tax_pic_url))
echo '<img src="'.$wpds_tax_pic_url.'" style="max-width:200px;border: 1px solid #ccc;padding: 5px;box-shadow: 5px 5px 10px #ccc;margin-top: 10px;" >';
echo '</td></tr>';
}
echo '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#wpds_tax_pic").click(function() {
tb_show("", "media-upload.php?type=image&TB_iframe=true");
return false;
});
window.send_to_editor = function(html) {
jQuery("#wpds_tax_pic").val( jQuery("img",html).attr("src") );
tb_remove();
}
});
</script>';
}
// save our taxonomy image while edit or save term
function wpds_save_tax_pic($term_id) {
if (isset($_POST['wpds_tax_pic']))
update_option('wpds_tax_pic' . $term_id, $_POST['wpds_tax_pic']);
}
// output taxonomy image url for the given term_id (NULL by default)
function wpds_tax_pic_url($term_id = NULL) {
if ($term_id)
return get_option('wpds_tax_pic' . $term_id);
elseif (is_category())
return get_option('wpds_tax_pic' . get_query_var('cat')) ;
elseif (is_tax()) {
$current_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
return get_option('wpds_tax_pic' . $current_term->term_id);
}
}
And here is the function that is used to call this:
wpds_tax_pic_url();
or
wpds_tax_pic_url($category->cat_ID);
How do I use this script with a custom taxonomy on a page.php or archive.php template?
On archive.php, you can use the wpds_tax_pic_url(); without any parameters it should display the URL of the attached image.
if(wpds_tax_pic_url()){
echo '<img src="'.wpds_tax_pic_url().'" />';
}else{
// other image or nothing.
}
On page.php or post.php, something following would work
$terms = wp_get_post_terms($post_id, 'custom_taxonomy');
foreach ($terms as $t) {
if(wpds_tax_pic_url($t->term_id))
echo '<img src="'.wpds_tax_pic_url($t->term_id).'" />';
}

Decode a wordpress theme [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
PHP decode starting with $OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63
This wordpress theme can get a big 10 on evil scale. The functions.php file is fully encoded so as you can't get rid of the footer link. But it also prevent us to improve the theme and that's a shame.
So, anyone can decode this ? I tried with online decoders, can't get it right.
Thanks a lot !
<?php /* */$OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64');$OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5};$OOO0000O0.=$OOO000000{2}.$OOO000000{10}.$OOO000000{13}.$OOO000000{16};$OOO0000O0.=$OOO0000O0{3}.$OOO000000{11}.$OOO000000{12}.$OOO0000O0{7}.$OOO000000{5};$OOO000O00=$OOO000000{0}.$OOO000000{12}.$OOO000000{7}.$OOO000000{5}.$OOO000000{15};$O0O000O00=$OOO000000{0}.$OOO000000{1}.$OOO000000{5}.$OOO000000{14};$O0O000O0O=$O0O000O00.$OOO000000{11};$O0O000O00=$O0O000O00.$OOO000000{3};$O0O00OO00=$OOO000000{0}.$OOO000000{8}.$OOO000000{5}.$OOO000000{9}.$OOO000000{16};$OOO00000O=$OOO000000{3}.$OOO000000{14}.$OOO000000{8}.$OOO000000{14}.$OOO000000{8};$OOO0O0O00=__FILE__;$OO00O0000=0x908;eval($OOO0000O0('JE8wMDBPME8wMD0kT09PMDAwTzAwKCRPT08wTzBPMDAsJ3JiJyk7JE8wTzAwT08wMCgkTzAwME8wTzAwLDB4NDgxKTskT08wME8wME8wPSRPT08wMDAwTzAoJE9PTzAwMDAwTygkTzBPMDBPTzAwKCRPMDAwTzBPMDAsMHgxN2MpLCdzME1PZzRjbGRIMXVtRUtxL1lRb3hiQlpTOHlGMkphUmpQTDUzcjlBeitlQzdV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yB6AYBV31TgXMLY5FcbPF3SjqQ0TJlHhFNmzHcrUSBJrBIYGJB6JuMJT29mwdL2+1TxXMLY5FcbPF3djqQ0TJlHhFNmzHcrUSBJrBIYGJB6JuM2LHIh3StprSBVc1Qn3StprSBVcKhz3yB6AbcP6FBdjqQ0TJBHTJldzHcrUSBJrBIYGJB6JuMY5FcbPF3S7HcE78B4G/L3XMAn1yBSz2NYIyZEn2Lj3yB6P8tbFHcV6Fbn7HTp+FB2A1Q3jatb5ycDjHcrU86YzJB6LKNn1Hc6v29xjqQshKh+wM986F9EnyBwGdcEPJlERFBbvJIj38tp68Q3jahz3SNbI29bGJ4w5SZ/jqQ0TyBVAFcbRSt4nZNY+Jcpr1MsAHIp9SBpT8Qs+Khz32tbhSZHPJcwIdOnjdrpGd571HcEPJlmjqQ0ral07FtYr1Ms32tbhSZHPJcwIucJrJ4wnycbRSt4n8BJv2ArRFcrTJMj32tbhSZHPJcwI1Qs+Kh+9FNHrSBEzdMjjHcEPJlmjSZmjHc3jqof32NYIdM3jah++8LszdlEn2AEn2LjjHlEn2LhLqLY5JZHI8BVnZtEPJOhL1Qs+dl71JBVT8Z/zHcEPJlEFHcrJ1o71SAHrSB7XMAn1R/++8LszdcbU2lYV1MY5SZYT1Qs+MAHrJlbIFL09SBpT8o7129bnJZHGdlYIyBnzy9w+FLjjHcJ7JBx7HcEPJlmj1Q3XMAn1BWhylSK
Examine this line:
$OOO000000 = urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64');
Decode that here
$OOO000000 = 'fg6sbehpra4co_tnd';
Then take the next line:
$OOO0000O0 = $OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5};
Which basically says take character 4, 9, 3, 5 from that string (index starting from 0), so we get...
$OOO0000O0 = 'base';
Now try the rest yourself.
Start by make the code a little more readable:
<?php
$OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64');
$OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5};
$OOO0000O0.=$OOO000000{2}.$OOO000000{10}.$OOO000000{13}.$OOO000000{16};
$OOO0000O0.=$OOO0000O0{3}.$OOO000000{11}.$OOO000000{12}.$OOO0000O0{7}.$OOO000000{5};
$OOO000O00=$OOO000000{0}.$OOO000000{12}.$OOO000000{7}.$OOO000000{5}.$OOO000000{15};
$O0O000O00=$OOO000000{0}.$OOO000000{1}.$OOO000000{5}.$OOO000000{14};
$O0O000O0O=$O0O000O00.$OOO000000{11};
$O0O000O00=$O0O000O00.$OOO000000{3};
$O0O00OO00=$OOO000000{0}.$OOO000000{8}.$OOO000000{5}.$OOO000000{9}.$OOO000000{16};
$OOO00000O=$OOO000000{3}.$OOO000000{14}.$OOO000000{8}.$OOO000000{14}.$OOO000000{8};
$OOO0O0O00=__FILE__;
$OO00O0000=0x908;
eval($OOO0000O0('JE8wMDBPME8wMD0kT09PMDAwTzAwKCRPT08wTzBPMDAsJ3JiJyk7JE8wTzAwT08wMCgkTzAwME8wTzAwLDB4NDgxKTskT08wME8wME8wPSRPT08wMDAwTzAoJE9PTzAwMDAwTygkTzBPMDBPTzAwKCRPMDAwTzBPMDAsMHgxN2MpLCdzME1PZzRjbGRIMXVtRUtxL1lRb3hiQlpTOHlGMkphUmpQTDUzcjlBeitlQzdVR3ZocElUbjZ0TmZWaVhEd2tXPScsJ0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky8nKSk7ZXZhbCgkT08wME8wME8wKTs='));
return;
?>
f]pDOJwHgwqmO0qmO0qmO6TJlHR29bhFc458QjAZ6wcQxp4Z6DAuMdAdLf3onwqmgDhoTshuLdAdLh3onwqmOshmgDh1MYqonDhmOshmgDzHgDhoTshonDhmMj3oTshmgDhoTshuMYqoTshoTshmOs+uMJTmg6q8TY5FcYdmZbUYxUpu6rYFNPL/r+oKlrcm3+Px9+/oOxT25r0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0TyBVAFcbRSt4nZNY+Jcpr1MsAHIp9SBpT8Qs+Khz32tbhSZHPJcwIdOnjdrpGd571HcEPJlmjqQ0ral07FtYr1Ms32tbhSZHPJcwIucJrJ4wnycbRSt4n8BJv2ArRFcrTJMj32tbhSZHPJcwI1Qs+Kh+9FNHrSBEzdMjjHcEPJlmjSZmjHc3jqof32NYIdM3jah++8LszdlEn2AEn2LjjHlEn2LhLqLY5JZHI8BVnZtEPJOhL1Qs+dl71JBVT8Z/zHcEPJlEFHcrJ1o71SAHrSB7XMAn1R/++8LszdcbU2lYV1MY5SZYT1Qs+MAHrJlbIFL09SBpT8o7129bnJZHGdlYIyBnzy9w+FLjjHcJ7JBx7HcEPJlmj1Q3XMAn1BWhylSK
Then change eval to echo eval. I think that should at least get you started.
<?php
if (function_exists('register_sidebar'))
register_sidebar(array(
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '',
'after_title' => '<br />',
));
function widget_yes_search() {
;
echo '
';
_e('Search');
;
echo ' <form id="searchform" method="get" action="';
echo $_SERVER['PHP_SELF'];
;
echo '">
<div>
<input type="text" name="s" id="s" size="15" /><br />
';
;
echo ' </div>
</form>
';
}
if (function_exists('register_sidebar_widget'))
register_sidebar_widget(__('Search'), 'widget_yes_search');
function GET_F0OTER() {
;
echo '
<div id="credit">
© ';
echo date('Y');
;
echo ' ';
bloginfo('name');
;
echo '. All right reserved.<br />
Designed by Duncan Cox
</div>
</div>
</body>
</html>
';
}
function getImage($num) {
global $more;
$more = 1;
$content = get_the_content();
$count = substr_count($content, '<img');
$start = 0;
for ($i = 1; $i <= $count; $i++) {
$imgBeg = strpos($content, '<img', $start);
$post = substr($content, $imgBeg);
$imgEnd = strpos($post, '>');
$postOutput = substr($post, 0, $imgEnd + 1);
$image[$i] = $postOutput;
$start = $imgEnd + 1;
$cleanF = strpos($image[$num], 'src="') + 5;
$cleanB = strpos($image[$num], '"', $cleanF) - $cleanF;
$imgThumb = substr($image[$num], $cleanF, $cleanB);
}
if (stristr($image[$num], '<img')) {
echo $imgThumb;
}
$more = 0;
}
function cats_meow($glue) {
$current_cat = single_cat_title('', false);
$separator = "\n";
$cats = explode($separator, get_the_category_list($separator));
foreach ($cats as $i => $str) {
if (strstr($str, ">$current_cat<")) {
unset($cats[$i]);
break;
}
}
if (empty($cats))
return false;
return trim(join($glue, $cats));
}

Resources