Skip to content

Commit

Permalink
Merge branch 'GavernWP-1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
dziudek committed Aug 29, 2013
2 parents a164f13 + 11c1cb7 commit b461ba1
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 66 deletions.
4 changes: 2 additions & 2 deletions MeetGavernWP/gavern/config/en_US/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"template": {
"name": "MeetGavernWP",
"update_name": "gk_meetgavern_wp",
"date": "05/08/2013",
"version": "1.8",
"date": "29/08/2013",
"version": "1.8.1",
"description": "Free GavickPro Wordpress theme based on the GavernWP framework"
},
"developer_config": {
Expand Down
47 changes: 34 additions & 13 deletions MeetGavernWP/gavern/helpers/helpers.features.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ function gavern_widget_update($instance, $new_instance, $old_instance, $widget)
if( !is_array($styles) ) {
$styles = array();
}
// if this styles is set at first time
if( !is_array($styles_css) ) {
$styles_css = array();
}
// if this responsive is set at first time
if( !is_array($responsive) ) {
$responsive = array();
Expand Down Expand Up @@ -380,17 +384,34 @@ function gavern_widget_update($instance, $new_instance, $old_instance, $widget)
// get the widget names from the exisitng settings
$widget_names = array_keys($options_type);
// check for the unexisting widgets
foreach($widget_names as $widget_name) {
// if widget doesn't exist - remove it from the options
if(in_array($widget_name, $all_widgets) !== TRUE) {
unset($options_type[$widget_name]);
unset($options[$widget_name]);
unset($styles[$widget_name]);
unset($styles_css[$widget_name]);
unset($responsive[$widget_name]);
unset($users[$widget_name]);
}
}
foreach($widget_names as $widget_name) {
// if widget doesn't exist - remove it from the options
if(in_array($widget_name, $all_widgets) !== TRUE) {
if(isset($options_type) && is_array($options_type) && isset($options_type[$widget_name])) {
unset($options_type[$widget_name]);
}

if(isset($options) && is_array($options) && isset($options[$widget_name])) {
unset($options[$widget_name]);
}

if(isset($styles) && is_array($styles) && isset($styles[$widget_name])) {
unset($styles[$widget_name]);
}

if(isset($styles_css) && is_array($styles_css) && isset($styles_css[$widget_name])) {
unset($styles_css[$widget_name]);
}

if(isset($responsive) && is_array($responsive) && isset($responsive[$widget_name])) {
unset($responsive[$widget_name]);
}

if(isset($users) && is_array($users) && isset($users[$widget_name])) {
unset($users[$widget_name]);
}
}
}
// update the settings
update_option($tpl->name . '_widget_rules_type', $options_type);
update_option($tpl->name . '_widget_rules', $options);
Expand Down Expand Up @@ -464,8 +485,8 @@ function gavern_widget_control() {
<label for="' . $tpl->name . '_widget_rules_'.$id.'">'.__('Visible at: ', GKTPLNAME).'</label>
<select name="' . $tpl->name . '_widget_rules_type_'.$id.'" id="' . $tpl->name . '_widget_rules_type_'.$id.'" class="gk_widget_rules_select">
<option value="all"'.(($value_type != "include" && $value_type != 'exclude') ? " selected=\"selected\"":"").'>'.__('All pages', GKTPLNAME).'</option>
<option value="exclude"'.selected($value_type, "exclude", false).'>'.__('All pages expecting:', GKTPLNAME).'</option>
<option value="include"'.selected($value_type, "include", false).'>'.__('No pages expecting:', GKTPLNAME).'</option>
<option value="exclude"'.selected($value_type, "exclude", false).'>'.__('All pages except:', GKTPLNAME).'</option>
<option value="include"'.selected($value_type, "include", false).'>'.__('No pages except:', GKTPLNAME).'</option>
</select>
</p>
<fieldset class="gk_widget_rules_form" id="gk_widget_rules_form_'.$unique_id.'" data-id="gk_widget_rules_form_'.$id.'">
Expand Down
2 changes: 1 addition & 1 deletion MeetGavernWP/gavern/helpers/helpers.layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ function gk_condition($mode, $input, $users) {
}
}

if($output == '') {
if($output == '' || trim($output) == '()' || trim($output) == '!()') {
$output = ' TRUE';
}

Expand Down
2 changes: 1 addition & 1 deletion MeetGavernWP/gavern/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function gavernwp_metatags_hook() {

// only for IE
if(preg_match('/MSIE/i',$_SERVER['HTTP_USER_AGENT'])) {
echo '<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />' . "\n";
echo '<meta http-equiv="X-UA-Compatible" content="IE=Edge" />' . "\n";
}
echo '<meta charset="'.get_bloginfo('charset').'" />' . "\n";
echo '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />' . "\n";
Expand Down
2 changes: 1 addition & 1 deletion MeetGavernWP/gavern/layouts/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div id="gkSocial">
<span><?php _e('Follow us on the social media: ', GKTPLNAME); ?></span>

<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Ffacebook.com%2Fgavickpro&amp;send=false&amp;layout=button_count&amp;width=150&amp;show_faces=false&amp;font=arial&amp;colorscheme=light&amp;action=like&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Ffacebook.com%2Fgavickpro&amp;send=false&amp;layout=button_count&amp;width=150&amp;show_faces=false&amp;font=arial&amp;colorscheme=light&amp;action=like&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:122px; height:20px;" allowTransparency="true"></iframe>

<a href="https://twitter.com/gavickpro" class="twitter-follow-button" data-show-count="false">Follow @Dziudek</a>

Expand Down
74 changes: 29 additions & 45 deletions MeetGavernWP/gavern/widgets.nsp.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ function widget($args, $instance) {
// let's save the global $post variable
global $post;
$tmp_post = $post;

if(is_multisite() && $config['data_source_blog'] != '' && is_numeric($config['data_source_blog'])) {
switch_to_blog($config['data_source_blog']);
}
//
// other options for the query
//
Expand All @@ -100,77 +104,41 @@ function widget($args, $instance) {
$results = array();
// data source
if($config['data_source_type'] == 'latest') {
if(is_multisite() && $config['data_source_blog'] != '' && is_numeric($config['data_source_blog'])) {
switch_to_blog($config['data_source_blog']);
}

$results = get_posts(array(
'posts_per_page' => $amount_of_posts,
'offset' => $config['offset'],
'orderby' => $config['orderby'],
'order' => $config['order']
));

if(is_multisite()) {
restore_current_blog();
}
} else if($config['data_source_type'] == 'category') {
if(is_multisite() && $config['data_source_blog'] != '' && is_numeric($config['data_source_blog'])) {
switch_to_blog($config['data_source_blog']);
}

$results = get_posts(array(
'category_name' => $config['data_source'],
'posts_per_page' => $amount_of_posts,
'offset' => $config['offset'],
'orderby' => $config['orderby'],
'order' => $config['order']
));

if(is_multisite()) {
restore_current_blog();
}
} else if($config['data_source_type'] == 'tag') {
if(is_multisite() && $config['data_source_blog'] != '' && is_numeric($config['data_source_blog'])) {
switch_to_blog($config['data_source_blog']);
}

$results = get_posts(array(
'tag' => $config['data_source'],
'posts_per_page' => $amount_of_posts,
'offset' => $config['offset'],
'orderby' => $config['orderby'],
'order' => $config['order']
));

if(is_multisite()) {
restore_current_blog();
}
} else if($config['data_source_type'] == 'post') {
if(is_multisite() && $config['data_source_blog'] != '' && is_numeric($config['data_source_blog'])) {
switch_to_blog($config['data_source_blog']);
}

} else if($config['data_source_type'] == 'post') {
$post_slugs = explode(',', $config['data_source']);
foreach($post_slugs as $slug) {
$res = get_posts(array('name' => $slug));
array_push($results, $res[0]);
}

if(is_multisite()) {
restore_current_blog();
}
} else if($config['data_source_type'] == 'custom') {
if(is_multisite() && $config['data_source_blog'] != '' && is_numeric($config['data_source_blog'])) {
switch_to_blog($config['data_source_blog']);
}

$post_type = explode(',', $config['data_source']);
array_push($results, get_posts(array('post_type' => $post_type, 'numberposts' => $amount_of_posts)));
if(is_multisite()) {
restore_current_blog();
}
}

if(is_multisite()) {
restore_current_blog();
}
// restore the global $post variable
$post = $tmp_post;
Expand Down Expand Up @@ -199,6 +167,14 @@ function widget($args, $instance) {
// iterate
$this->wdgt_config = $config;
$this->wdgt_results = $results;
$cache_uri = get_stylesheet_directory_uri() . '/gavern/cache_nsp/';

$tmp_post = $post;
// change the source blog
if(is_multisite() && $this->wdgt_config['data_source_blog'] != '' && is_numeric($this->wdgt_config['data_source_blog'])) {
switch_to_blog($this->wdgt_config['data_source_blog']);
}


// wrap articles
echo '<div class="gk-nsp-arts">';
Expand Down Expand Up @@ -226,7 +202,7 @@ function widget($args, $instance) {
}

if($config['article_image_state'] == 'on') {
$art_image = $this->generate_art_image($i);
$art_image = $this->generate_art_image($i, $cache_uri);
}

if($config['article_info_state'] == 'on') {
Expand Down Expand Up @@ -352,6 +328,14 @@ function widget($args, $instance) {
}
// closing the widget wrapper
echo '</div>';

// back to the current blog
if(is_multisite()) {
restore_current_blog();
}
// restore the global $post variable
$post = $tmp_post;

// save the cache results
$cache_output = ob_get_flush();
$cache_time = ($this->wdgt_config['cache_time'] == '' || !is_numeric($this->wdgt_config['cache_time'])) ? 60 : (int) $this->wdgt_config['cache_time'];
Expand Down Expand Up @@ -966,7 +950,7 @@ function generate_art_text($i) {
return apply_filters('gk_nsp_art_text', $output);
}

function generate_art_image($i) {
function generate_art_image($i, $cache_uri) {
$art_ID = '';

if($this->wdgt_config['data_source_type'] == 'custom') {
Expand All @@ -979,6 +963,7 @@ function generate_art_image($i) {

$image = wp_get_attachment_image_src( get_post_thumbnail_id( $art_ID ), 'single-post-thumbnail' );
$image_path = $image[0];

$upload_dir = wp_upload_dir();
$image_path = str_replace($upload_dir['baseurl'] . '/', '', $image_path);

Expand All @@ -990,8 +975,7 @@ function generate_art_image($i) {
$img_filename = $img_editor->generate_filename( $this->id, dirname(__FILE__) . '/' . 'cache_nsp');
$img_editor->save($img_filename);

$new_path = basename($img_filename);
$cache_uri = get_stylesheet_directory_uri() . '/gavern/cache_nsp/';
$new_path = basename($img_filename);

if(is_string($new_path)) {
$new_path = $cache_uri . $new_path;
Expand Down
2 changes: 1 addition & 1 deletion MeetGavernWP/js/back-end/widget.rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function gk_widget_control_init_events(id, inner) {
//
if (text.indexOf(':') === text.length - 1) {
var startlen = output.val().length;
output.val(output.val().replace("," + text + ",", ""));
output.val(output.val().replace("," + text, ""));
// if previous regexp didn't changed the value
if (startlen === output.val().length) {
var regex = new RegExp(',' + text + '$', 'gmi');
Expand Down
2 changes: 1 addition & 1 deletion MeetGavernWP/js/templates/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
jQuery(window).load(function() {
if(jQuery('#gallery')) {
gkGalleryTimer = setTimeout(function() {
gkGalleryAutoanimation('next');
gkGalleryAutoanimation('next', null);
}, 5000);
// pagination
jQuery('#gallery').children('ol').find('li').each(function(i, btn) {
Expand Down
2 changes: 1 addition & 1 deletion MeetGavernWP/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Theme URI: http://gavick.com
Description: Responsive, GavernWP-based, free Wordpress theme. We are happy to announce the availability of a free Wordpress 3.5 theme called Meet GavernWP. Based upon a brand-new version of our GavernWP Framework, this theme has a few interesting features you should check out. This wonderful no-cost theme was built with support for Responsive Web Design, which means it is more flexible and powerful. This is surely a must-have theme for WordPress users!
License: GNU GPL v.2.0
License URI: LICENSE.txt
Version: 1.8
Version: 1.8.1
Author: GavickPro
Author URI: http://gavick.com
Tags: gray, two-columns, flexible-width
Expand Down

0 comments on commit b461ba1

Please sign in to comment.