The _config.php file is no longer needed since version 0.4. Since there are no write permissions on this file or the plugin directory, delete the file manually or assign the appropriate rights!
Settings › Author Progress Bar
Progress Bar Design :
settings = get_option($this->optionName);
if(is_null($this->settings) || empty($this->settings)) {
$this->loadDefaults();
}
}
public function save()
{
update_option($this->optionName, $this->settings);
}
public function loadDefaults()
{
$settings['width'] = '100%';
$settings['height'] = '12px';
$settings['bg_color'] = '#f3f3f3';
$settings['author_progress_bar_color'] = '#247102';
$settings['border_color'] = '#000000';
$settings['precision'] = 0;
// legacy (<= 0.4): load all _config settings if the file is existing.
$configFile = plugin_dir_path(__FILE__) . '_config.php';
if(is_readable($configFile))
{
include($configFile);
$settings['width'] = $width;
$settings['height'] = $height;
$settings['bg_color'] = $bg_color;
$settings['border_color'] = $border_color;
$settings['author_progress_bar_color'] = $author_progress_bar_color;
if(is_writable($configFile) && is_writable(plugin_dir_path(__FILE__)))
{
unlink($configFile);
}
}
$this->settings = $settings;
}
}
/*******************************************************************************
====================== Progress Bar Management =================================
********************************************************************************/
class Author_Progress_BarWidgetManager
{
public function __construct()
{
add_action('widgets_init',create_function('','register_widget("Author_Progress_BarWidget");'));
}
}
/*******************************************************************************
======================== Progress Bar Widget ===================================
********************************************************************************/
class Author_Progress_BarWidget extends WP_Widget
{
public $id_base = 'author_progress_bar';
public $name = 'Author Progress Bar';
public $description = 'Author Progress Bar displays the progress of your book in a sidebar widget. Allowing for greater audience engagement & to motivate you the writer.';
public $progressTitle = array('No words', 'One word', ' words');
public $progressLabel = 'word';
public $widgetTitle = 'I am writing';
public $progressTitleAudio = array('No minute', 'One Minute', ' Minutes');
public $progressLabelAudio = 'Minute';
public $widgetTitleAudio = 'I am working on';
function singularPlural($amount, $list)
{
if($amount > 1)
{
return $amount . ' ' . $list[2];
}
elseif($amount == 1)
{
return $list[1];
}
return $list[0];
}
function __construct()
{
parent::WP_Widget($this->id_base, $this->name, array('description' => $this->description));
}
function widget($args,$instance)
{
global $author_progress_bar_settings;
extract($args);
$title = apply_filters('widget_title', $instance['title'] );
$author = apply_filters('widget_author',$instance['author']);
$book = apply_filters('widget_book',$instance['book']);
$progress = apply_filters('widget_progress',$instance['progress']);
$max = apply_filters('widget_max',$instance['max']);
$progress_bar_type = apply_filters('widget_progress_bar_type',$instance['progress_bar_type']);
$cover = apply_filters('widget_cover',$instance['cover']);
$info = apply_filters('widget_info',$instance['info']);
if(strcmp($progress_bar_type,"book")==0){
$before_title = '