Skip to content
This repository was archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiasghodsian committed Nov 24, 2016
1 parent 8bde201 commit 87a0e30
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 6 deletions.
9 changes: 7 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
**2.4.0**
+ Notification when a new update is available.
+ Minor CSS changes.
+ Tooltip for tabFields (Works only on input,toggle,select).

**2.3.9**
+ tab_container error fix.
+ css on h1 title.
+ CSS on h1 title.

**2.3.8**
+ WP Toolbar.
Expand Down Expand Up @@ -41,7 +46,7 @@
**2.1.2**
+ wpColorPicker added (Add wp_theme_settings_color_field class to input text).
+ FontAwesomeArray 4.6.3 added.
+ FontAwesome 4.6.3 css (Back End).
+ FontAwesome 4.6.3 CSS (Back End).

**2.1.0**
+ Style for input,select.
Expand Down
77 changes: 77 additions & 0 deletions wp_theme_settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,81 @@

.wpts-wrap h1{
padding-bottom: 10px;
}

.wpts-wrap .notice {
display: block!important;
width: 82%;
}

.wpts-wrap .about-text{
margin: 10px 200px 10px 0;
min-height: 40px;
font-size: 16.5px;
}

.wpts-tooltip {
position: relative;
display: inline-block;
border-radius: 50%;
width: 20px;
height: 20px;
color: #fff;
background: #555;
cursor: pointer;
text-align: center;
margin-left: 5px;
}

.wpts-tooltip .wpts-tooltiptext {
visibility: hidden;
text-align: center;
width: 130px;
background: #555;
color: #fff;
font-size: 13px;
padding: 3px 5px;
border-radius: 3px;
position: absolute;
z-index: 1;
opacity: 0;
transition: opacity 1s;
}
.wpts-tooltip:hover .wpts-tooltiptext {
visibility: visible;
opacity: 1;
transition: opacity 1s;
}

.wpts-tooltip .wpts-tooltiptext.wpts-tooltip-top {
bottom: 125%;
left: 50%;
margin-left: -60px;
}

.wpts-tooltip-top::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}

.wpts-tooltip .wpts-tooltiptext.wpts-tooltip-right {
top: -2px;
left: 130%;
}

.wpts-tooltip-right::after {
content: "";
position: absolute;
top: 6px;
left:0%;
margin-left: -5px;
border-width: 5px 5px 5px 0;
border-style: solid;
border-color: transparent #555 transparent transparent;
}
51 changes: 47 additions & 4 deletions wp_theme_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Class Name: wp_theme_settings
* GitHub URI: http://github.com/mattiasghodsian/wp_theme_settings
* Description: A custom WordPress class for creating theme settings page (Design looks identical to WP About page)
* Version: 2.3.8
* Version: 2.4.0
* Author: Mattias Ghodsian
* Author URI: http://www.nexxoz.com
* License: GPL-2.0+
Expand All @@ -14,12 +14,14 @@
class wp_theme_settings{

private $tabs;
private $currversion = "2.4.0";
private $theme;
private $general;
private $badge;
private $settingsID;
private $settingFields;
private $toolbar;
private $notice;

function __construct($args){
/*
Expand All @@ -37,9 +39,8 @@ function __construct($args){
$this->badge = (array_key_exists('badge', $args)) ? $args['badge'] : '';
$this->settingsID = (array_key_exists('settingsID', $args)) ? $this->keyEntity($args['settingsID']).'-settings-group' : '';
$this->settingFields = (array_key_exists('settingFields', $args)) ? $args['settingFields'] : array();

$this->toolbar = (array_key_exists('toolbar', $args['general'])) ? $args['general']['toolbar'] : array();

$this->notice = (array_key_exists('notice', $args['general'])) ? $args['general']['notice'] : true;
/*
* @ Add tabfields to settingsfield
*/
Expand Down Expand Up @@ -74,7 +75,20 @@ function __construct($args){
if (array_key_exists('toolbar', $args['general']) && $args['general']['toolbar'] != false) {
add_action('admin_bar_menu', array($this, 'wpts_toolbar'), 999);
}

/*
* @ call toolbar function
*/
if (array_key_exists('toolbar', $args['general']) && $args['general']['toolbar'] != false) {
add_action('admin_bar_menu', array($this, 'wpts_toolbar'), 999);
}
/*
* @ check update notice
*/
if ($this->notice !== false ) {
if ( $this->get_wpts_git_version() > $this->currversion ) {
add_action( 'admin_notices', array($this, 'wpts_update_admin_notice') );
}
}
}

/*
Expand Down Expand Up @@ -361,5 +375,34 @@ public function sanitize($input){
public function wpts_option($key){
return esc_attr( get_option($key) );
}

/*
* @ Update notice
*/
public function wpts_update_admin_notice() {
$class = 'notice notice-info is-dismissible';
$message = __( 'New version of WPTS is available ('.$this->get_wpts_git_version().'), click <a href="https://git.io/vi1Gr" target="_new">here</a> to learn more about it.');
printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
}

/*
* @ Get wpts github version
*/
private function get_wpts_git_version(){
try {
$url = "https://raw.githubusercontent.com/mattiasghodsian/wp_theme_settings/master/changelog.txt";
$data = file_get_contents($url);
$t = preg_split("#\n\s*\n#Uis", $data);
foreach ($t as $key => $value) {
$lines = explode('+', $value);
$version = str_replace("**", "", $lines[0]);
unset($lines[0]);
$new_data[] = array('version' => $version, 'data' => $lines);
}
return trim($new_data[0]['version']);
} catch (Exception $e) {
return $this->currversion;
}
}
}
?>

0 comments on commit 87a0e30

Please sign in to comment.