Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #16 from Codeinwp/development
Browse files Browse the repository at this point in the history
!!! Leave us a review + new documentation link + upgrade to pro butto…
  • Loading branch information
rodica-andronache committed Apr 11, 2016
2 parents 23ef4cd + 97fd892 commit 1cc43c8
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 7 deletions.
23 changes: 23 additions & 0 deletions css/customizer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.oblique-upgrade-to-pro-button {
padding: 3px 6px !important;
line-height: 1.5 !important;
font-size: 9px !important;
color: #ffffff !important;
background-color: #EA6F60;
letter-spacing: 1px;
text-transform: uppercase;
}
.customizer-review-link {
padding-top: 10px;
text-align: center;
}

.customizer-review-link p {
font-size: 12px;
margin-bottom: 0;
}

.customizer-review-link span {
font-size: 12px;
width: 12px;
}
8 changes: 8 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,11 @@ function oblique_html5shiv() {
* Styles
*/
require get_template_directory() . '/inc/styles.php';

/**
* Customizer styles
*/
function oblique_customizer_styles() {
wp_enqueue_style( 'oblique-customizer-styles', get_template_directory_uri() . '/css/customizer.css' );
}
add_action( 'customize_controls_print_styles', 'oblique_customizer_styles' );
34 changes: 31 additions & 3 deletions inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -881,9 +881,37 @@ function oblique_registers() {
wp_enqueue_script( 'oblique_customizer_script', get_template_directory_uri() . '/js/oblique_customizer.js', array("jquery"), '20120206', true );

wp_localize_script( 'oblique_customizer_script', 'obliqueCustomizerObject', array(
'github' => __('GitHub','oblique'),
'review' => __('Leave a Review', 'oblique'),
'documentation' => __('Documentation', 'oblique')
'documentation' => __('Documentation', 'oblique'),
'pro' => __('View PRO version', 'oblique')
) );
}
add_action( 'customize_controls_enqueue_scripts', 'oblique_registers' );

/* ajax callback for dismissable Asking for reviews */
add_action( 'wp_ajax_oblique_dismiss_asking_for_reviews','oblique_dismiss_asking_for_reviews_callback' );
add_action( 'wp_ajax_nopriv_oblique_dismiss_asking_for_reviews','oblique_dismiss_asking_for_reviews_callback' );
/**
* Dismiss asking for reviews
*/
function oblique_dismiss_asking_for_reviews_callback() {

if( !empty($_POST['ask']) ) {
set_theme_mod('oblique_ask_for_review',esc_attr($_POST['ask']));
}
die();
}
add_action( 'customize_controls_enqueue_scripts', 'oblique_asking_for_reviews_script' );
function oblique_asking_for_reviews_script() {

$oblique_review = 'yes';

$oblique_ask_for_review = get_theme_mod('oblique_ask_for_review');
if( !empty($oblique_ask_for_review) ) {
$oblique_review = $oblique_ask_for_review;
}
wp_enqueue_script( 'oblique-asking-for-reviews-js', get_template_directory_uri() . '/js/oblique_reviews.js', array('jquery') );
wp_localize_script( 'oblique-asking-for-reviews-js', 'obliqueAskingForReviewsObject', array(
'ask' => $oblique_review,
'ajaxurl' => admin_url( 'admin-ajax.php' ),
) );
}
6 changes: 3 additions & 3 deletions js/oblique_customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jQuery(document).ready(function() {

if( jQuery( ".oblique-upsells" ).length ) {

jQuery('.oblique-upsells').append('<a style="width: 80%; margin: 5px auto 5px auto; display: block; text-align: center;" href="http://flyfreemedia.com/documentation/oblique/" class="button" target="_blank">{documentation}</a>'.replace('{documentation}', obliqueCustomizerObject.documentation));
jQuery('.oblique-upsells').append('<a style="width: 80%; margin: 5px auto 5px auto; display: block; text-align: center;" href="https://github.com/Codeinwp/oblique" class="button" target="_blank">{github}</a>'.replace('{github}', obliqueCustomizerObject.github));
jQuery('.oblique-upsells').append('<a style="width: 80%; margin: 5px auto 5px auto; display: block; text-align: center;" href="https://wordpress.org/support/view/theme-reviews/oblique#postform" class="button" target="_blank">{review}</a>'.replace('{review}', obliqueCustomizerObject.review));
jQuery('.oblique-upsells').append('<a style="width: 80%; margin: 5px auto 5px auto; display: block; text-align: center;" href="http://docs.themeisle.com/article/271-oblique-documentation" class="button" target="_blank">{documentation}</a>'.replace('{documentation}', obliqueCustomizerObject.documentation));

}

if ( !jQuery( ".oblique-upsells" ).length ) {
jQuery('#customize-theme-controls > ul').prepend('</li>');
}

jQuery('.preview-notice').append('<a class="oblique-upgrade-to-pro-button" href="http://themeisle.com/themes/oblique-pro/" class="button" target="_blank">{pro}</a>'.replace('{pro}',obliqueCustomizerObject.pro));
});
41 changes: 41 additions & 0 deletions js/oblique_reviews.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
jQuery(document).ready(function($) {

var load_ask_for_reviews = function(){
$.ajax({
type : "POST",
data : {action: 'oblique_dismiss_asking_for_reviews'},
dataType : "html",
url : obliqueAskingForReviewsObject.ajaxurl,
success : function(data){
if( obliqueAskingForReviewsObject.ask == 'no') {
jQuery('.customizer-review-link').remove();
} else {
jQuery('#customize-theme-controls').append('<div class="customizer-review-link"><p>Star this theme on <a href="https://wordpress.org/support/view/theme-reviews/oblique" target="_blank">WordPress.org</a>!</p><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></div>');
}
},
error : function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR + " :: " + textStatus + " :: " + errorThrown);
}
});
}

var dismiss_ask_for_reviews = function(){
$.ajax({
type : "POST",
data : {action: 'oblique_dismiss_asking_for_reviews', ask: 'no'},
dataType : "html",
url : obliqueAskingForReviewsObject.ajaxurl,
success : function(data){
jQuery('.customizer-review-link').remove();
},
error : function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR + " :: " + textStatus + " :: " + errorThrown);
}
});
}

$('.customizer-review-link a').die("click").live("click",function() {
dismiss_ask_for_reviews();
});
load_ask_for_reviews();
});
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Theme URI: http://themeisle.com/themes/oblique
Author: Themeisle
Author URI: http://themeisle.com/
Description: Oblique is a creative masonry theme that works great for fashion or general bloggers. Amongst the features you will find a a parallax header image, full color control with unlimited color variations, easy access to all Google Fonts, responsive design etc.
Version: 1.09
Version: 1.10
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: oblique
Expand Down

0 comments on commit 1cc43c8

Please sign in to comment.