Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 109 lines (82 sloc) 3.337 kb
<?php
function esp_git_portfolio_load_widget()
{
register_widget('ProjectPortfolio');
}
class ProjectPortfolio extends WP_Widget
{
function ProjectPortfolio()
{
$widget_ops = array('classname' => 'projectportfolio', 'description' => __('Project prtfolio settings', 'projectportfolio'));
$control_ops = array('width' => 300, 'height' => 350, 'id_base' => 'project-portfolio-widget');
$this->WP_Widget('project-portfolio-widget', __('Git portfolio', 'projectportfolio'), $widget_ops, $control_ops);
}
function widget($args, $instance)
{
global $wpdb;
$portfolioRefTable = $wpdb->prefix ."project_portfolio" ;
$data = $wpdb->get_results("SELECT * FROM {$portfolioRefTable}");
extract($args);
$portfolioTitle = apply_filters('project_portfolio_widget_title', $instance['project_portfolio_widget_title']);
echo $before_widget;
echo $before_title . $portfolioTitle . $after_title;
?>
<table border="0" style="clear: both;">
<?php
for($cnt = 0; $cnt < 5; $cnt++)
{
if((!empty($data[$cnt]->project_name)) AND (!empty($data[$cnt]->project_link))){
?>
<tr>
<td>
<div >
<?php if (!empty($data[$cnt]->project_image)){ ?>
<a href="<?php echo (!empty($data[$cnt]->project_link)) ? $data[$cnt]->project_link : ''; ?>"><img src="<?php echo $data[$cnt]->project_image ; ?>" width="220px" height="150px"/></a>
<?php }else{ ?>
<a href="<?php echo (!empty($data[$cnt]->project_link)) ? $data[$cnt]->project_link : ''; ?>"><img src="<?php echo site_url(); ?>/wp-content/plugins/Git-Portfolio/images/github.jpg" /></a>
<?php } ?>
</div>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><b><?php echo (!empty($data[$cnt]->project_name)) ? $data[$cnt]->project_name : ''; ?></b></td>
</tr>
<tr>
<td>Source:&nbsp;<a href="<?php echo (!empty($data[$cnt]->project_link)) ? $data[$cnt]->project_link : ''; ?>" class=""><?php echo (!empty($data[$cnt]->project_link)) ? $data[$cnt]->project_link : ''; ?></a></td>
</tr>
<tr>
<td ><hr width="100%"/></td>
</tr>
<?php
}
}
?>
</table>
<?php
echo $after_widget;
}
function update($new_instance, $old_instance)
{
$instance = $old_instance;
$instance['project_portfolio_widget_title'] = $new_instance['project_portfolio_widget_title'];
return $instance;
}
function form($instance)
{
$defaults = array('project_portfolio_widget_title' => __('', 'projectportfolio'));
$instance = wp_parse_args((array)$instance, $defaults);?>
<p>
<label for="<?php echo $this->get_field_id('project_portfolio_widget_title'); ?>">
<?php _e('Enter Widget Title', 'hybrid'); ?>
</label>
<input type="text" id="<?php echo $this->get_field_id('project_portfolio_widget_title'); ?>"
name="<?php echo $this->get_field_name('project_portfolio_widget_title'); ?>" style="width:100%;"
value="<?php echo $instance['project_portfolio_widget_title']; ?>"/>
</p>
<?php
}
}
?>
Jump to Line
Something went wrong with that request. Please try again.