ID;
$title = $page->post_title;
$pages[$id] = $title;
}
return $pages;
}
protected $widget = array(
'description' => 'Displays the most recently modified pages under a certain parent page',
'do_wrapper' => true,
'view' => false,
'fields' => array(
array(
'name' => 'Title',
'desc' => '',
'id' => 'title',
'type' => 'text',
'std' => 'Widget Title'
),
array(
'name' => 'Parent Page',
'desc' => '',
'id' => 'parentpagetitle',
'type' => 'select',
'options' => array('test'=>'test')//$this->get_page_option_array()
)
)
);
/**
* Widget HTML
*
* If you want to have an all inclusive single widget file, you can do so by
* dumping your css styles with base_encoded images along with all of your
* html string, right into this method.
*
* @param array $widget
* @param array $params
* @param array $sidebar
*/
function html($widget, $params, $sidebar)
{
echo '
';
$i++;
}
}
function Recent_Docs()
{
//Initializing
$classname = str_replace('_',' ', get_class($this));
// widget actual processes
parent::WP_Widget(
$id = $classname,
$name = (isset($this->widget['name'])?$this->widget['name']:$classname),
$options = array( 'description'=>$this->widget['description'] )
);
}
/*
* Widget View
*
* @param array $sidebar
* @param array $params
*/
function widget($sidebar, $params)
{
//initializing variables
$this->widget['number'] = $this->number;
$title = apply_filters( 'Empty_Widget_title', $params['title'] );
$do_wrapper = (!isset($this->widget['do_wrapper']) || $this->widget['do_wrapper']);
if ( $do_wrapper )
echo $sidebar['before_widget'];
//loading a file that is isolated from other variables
if (file_exists($this->widget['view']))
$this->getViewFile($widget, $params, $sidebar);
if ($this->widget['view'])
echo $this->widget['view'];
else $this->html($this->widget, $params, $sidebar);
if ( $do_wrapper )
echo $sidebar['after_widget'];
}
/*
* Administration Form
*
* This method is called from within the wp-admin/widgets area when this
* widget is placed into a sidebar. The resulting is a widget options form
* that allows the administration to modify how the widget operates.
*
* You do not need to adjust this method what-so-ever, it will parse the array
* parameters given to it from the protected widget property of this class.
*
* @param array $instance
* @return boolean
*/
function form($instance)
{
//reasons to fail
if (empty($this->widget['fields'])) return false;
$defaults = array(
'id' => '',
'name' => '',
'desc' => '',
'type' => '',
'options' => '',
'std' => '',
);
do_action('Empty_Widget_before');
foreach ($this->widget['fields'] as $field)
{
//making sure we don't throw strict errors
$field = wp_parse_args($field, $defaults);
$meta = false;
if (isset($field['id']) && array_key_exists($field['id'], $instance))
@$meta = attribute_escape($instance[$field['id']]);
if ($field['type'] != 'custom' && $field['type'] != 'metabox')
{
echo '';
}
}
do_action('Empty_Widget_after');
return true;
}
/**
* Update the Administrative parameters
*
* This function will merge any posted parameters with that of the saved
* parameters. This ensures that the widget options never get lost. This
* method does not need to be changed.
*
* @param array $new_instance
* @param array $old_instance
* @return array
*/
function update($new_instance, $old_instance)
{
// processes widget options to be saved
$instance = wp_parse_args($new_instance, $old_instance);
return $instance;
}
}