Skip to content

Commit 7703be6

Browse files
author
shin
committed
conflict fixes
2 parents ea33a7c + 38c0574 commit 7703be6

File tree

9 files changed

+69
-168
lines changed

9 files changed

+69
-168
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Cherry Testimonials
22
A testimonials management plugin for WordPress.
3+
__Сompatibility: *Cherry Framewokr v.4+*__
34

45
## Features
56
* CPT Testimonials

admin/includes/class-cherry-update/class-cherry-base-update.php

Lines changed: 34 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Class for the base update
44
*
55
* @package Cherry_Base_Update
6-
* @subpackage Bace_Update
6+
* @subpackage Base_Update
77
* @author Cherry Team <[email protected]>
88
* @copyright Copyright (c) 2012 - 2015, Cherry Team
99
* @link http://www.cherryframework.com/
@@ -25,70 +25,53 @@ class Cherry_Base_Update {
2525
protected $api = array(
2626
'version' => '',
2727
'slug' => '',
28-
'hub_url' => 'https://github.com/',
29-
'api_url' => 'https://api.github.com/repos/',
28+
'cloud_url' => 'https://cloud.cherryframework.com/cherry-update/',
3029
'product_name' => 'CherryFramework',
31-
'repository_name' => '',
32-
'brunch_name' => 'master',
33-
'important_release' => '-imp',
34-
'alpha_release' => '-alpha', //To alpha update need constant CHERRY_ALPHA_UPDATE - true
35-
'beta_release' => '-beta', //To beta update need constant CHERRY_BETA_UPDATE - true
36-
'sslverify' => true
30+
'repository_name' => ''
3731
);
3832

3933
protected function base_init( $attr = array() ){
40-
$this ->api = array_merge( $this ->api, $attr );
4134

42-
add_filter( 'upgrader_source_selection', array( $this, 'rename_github_folder' ), 11, 3 );
35+
$this->api = array_merge( $this->api, $attr );
36+
4337
}
4438

4539
protected function check_update() {
46-
$query = $this -> api[ 'api_url' ] . $this -> api[ 'product_name' ] . '/' . $this -> api[ 'repository_name' ] . '/tags';
47-
$response = $this -> remote_query( $query );
48-
$new_version = false;
49-
$url = '';
50-
$package = '';
51-
52-
if( $response ){
53-
54-
$response = array_reverse( $response );
55-
$last_update = count( $response )-1;
56-
$current_version = $this -> api[ 'version' ];
57-
58-
foreach ($response as $key => $update) {
59-
60-
$get_new_version = strtolower( $update->name );
61-
$update_label = preg_replace( '/[v]?[\d\.]+[v]?/', '', $get_new_version );
62-
$get_new_version = preg_replace( '/[^\d\.]/', '', $get_new_version );
63-
64-
$this -> api[ 'details_url' ] = 'https://github.com/' . $this -> api[ 'product_name' ] . '/' . $this -> api[ 'slug' ] . '/releases/tag/' . $update->name;
65-
$package = $update->zipball_url;
66-
67-
if( version_compare ( $get_new_version, $current_version ) > 0 && strpos( $update_label, $this -> api[ 'important_release' ] ) !== false ){
68-
69-
$new_version = $get_new_version;
70-
break;
71-
}
40+
$args = array(
41+
'user-agent' => 'WordPress',
42+
'github_repository' => $this->api[ 'product_name' ] . '/' . $this->api[ 'repository_name' ],
43+
'current_version' => $this->api[ 'version' ],
44+
'up_query_limit' => false,
45+
'get_alpha' => false,
46+
'get_beta' => false
47+
);
7248

73-
if( version_compare ( $get_new_version, $current_version ) > 0 && $key === $last_update ){
49+
if( defined ( 'CHERRY_ALPHA_UPDATE' ) ){
50+
$args[ 'get_alpha' ] = true;
51+
}
7452

75-
if($update_label !== $this -> api[ 'alpha_release' ] && $update_label !== $this -> api[ 'beta_release' ]
76-
|| $update_label === $this -> api[ 'alpha_release' ] && @constant ( 'CHERRY_ALPHA_UPDATE' ) == true
77-
|| $update_label === $this -> api[ 'beta_release' ] && @constant ( 'CHERRY_BETA_UPDATE' ) == true ){
53+
if( defined ( 'CHERRY_BETA_UPDATE' ) ){
54+
$args[ 'get_beta' ] = true;
55+
}
7856

79-
$new_version = $get_new_version;
57+
if( defined ( 'CHERRY_UP_QUERY_LIMIT' ) ){
58+
$args[ 'up_query_limit' ] = true;
59+
}
8060

81-
}
82-
break;
83-
}
84-
}
61+
$response = $this -> remote_query( $args );
8562

86-
return array( 'version' => $new_version, 'package' => $package );
63+
if( $response && $response !=='not_update' ){
64+
$this->api[ 'details_url' ] = $response->details_url;
65+
return array( 'version' => $response->new_version, 'package' => $response->package );
8766
}
67+
68+
return array( 'version' => false);
8869
}
8970

90-
protected function remote_query( $query ) {
91-
$response = wp_remote_get( $query , array( 'sslverify' => $this -> api[ 'sslverify' ] , 'user-agent' => $this -> api[ 'product_name' ] ) );
71+
protected function remote_query( $args ) {
72+
$query = add_query_arg( $args, $this->api['cloud_url'] );
73+
74+
$response = wp_remote_get( $query );
9275

9376
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) != '200') {
9477
return false;
@@ -100,12 +83,9 @@ protected function remote_query( $query ) {
10083
}
10184

10285
public function rename_github_folder( $upgrate_dir, $remote_dir, $skin_upgrader ){
103-
$skin_theme = isset($skin_upgrader ->skin ->theme) ? $skin_upgrader ->skin ->theme : '' ;
104-
$skin_plugin = isset($skin_upgrader ->skin ->plugin) ? $skin_upgrader ->skin ->plugin : '' ;
105-
106-
if( $skin_theme === $this -> api[ 'slug' ] || $skin_plugin === $this -> api[ 'slug' ] ){
86+
if( strpos( $upgrate_dir, $this->api[ 'slug' ] ) !== false){
10787
$upgrate_dir_path = pathinfo( $upgrate_dir );
108-
$new_upgrate_dir = trailingslashit( $upgrate_dir_path[ 'dirname' ] ) . trailingslashit( $this -> api[ 'slug' ] );
88+
$new_upgrate_dir = trailingslashit( $upgrate_dir_path[ 'dirname' ] ) . trailingslashit( $this->api[ 'slug' ] );
10989

11090
rename( $upgrate_dir, $new_upgrate_dir );
11191

admin/includes/class-cherry-update/class-cherry-plugin-update.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function init( $attr = array() ){
2828
//set_site_transient('update_plugins', null);
2929

3030
add_action( 'pre_set_site_transient_update_plugins', array( $this, 'update' ) );
31+
add_filter( 'upgrader_source_selection', array( $this, 'rename_github_folder' ), 11, 3 );
3132
add_action( 'admin_footer', array( $this, 'change_details_url' ) );
3233
}
3334
}
@@ -36,17 +37,18 @@ public function update( $data ) {
3637
$new_update = $this -> check_update();
3738

3839
if( $new_update[ 'version' ] ){
39-
$this -> api[ 'plugin' ] = $this -> api[ 'slug' ] . '/' . $this -> api[ 'slug' ] . '.php';
40+
$this->api[ 'plugin' ] = $this->api[ 'slug' ] . '/' . $this->api[ 'slug' ] . '.php';
4041

4142
$update = new stdClass();
4243

43-
$update -> slug = $this -> api[ 'slug' ];
44-
$update -> plugin = $this -> api[ 'plugin' ];
44+
$update -> slug = $this->api[ 'slug' ];
45+
$update -> plugin = $this->api[ 'plugin' ];
4546
$update -> new_version = $new_update[ 'version' ];
46-
$update -> url = $this -> api[ 'details_url' ];
47+
$update -> url = $this->api[ 'details_url' ];
4748
$update -> package = $new_update[ 'package' ];
4849

49-
$data -> response[ $this -> api[ 'plugin' ] ] = $update;
50+
$data -> response[ $this->api[ 'plugin' ] ] = $update;
51+
5052
}
5153

5254
return $data;

admin/includes/class-cherry-update/class-cherry-theme-update.php

Lines changed: 0 additions & 78 deletions
This file was deleted.

cherry-portfolio.php

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Cherry Portfolio
44
* Plugin URI: http://www.cherryframework.com/
55
* Description: A testimonials management plugin for WordPress.
6-
* Version: 1.0.0 beta1
6+
* Version: 1.0.0 beta
77
* Author: Cherry Team
88
* Author URI: http://www.cherryframework.com/
99
* Text Domain: cherry-portfolio
@@ -58,7 +58,9 @@ public function __construct() {
5858
add_action( 'plugins_loaded', array( $this, 'admin' ), 4 );
5959

6060
// Load public-facing style sheet.
61-
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
61+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
62+
add_filter( 'cherry_compiler_static_css', array( $this, 'add_style_to_compiler' ) );
63+
6264
// Load public-facing JavaScript.
6365
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
6466

@@ -165,10 +167,26 @@ function admin() {
165167
* @since 1.0.0
166168
*/
167169
public function enqueue_styles() {
168-
wp_enqueue_style( 'magnific-popup-style', plugins_url( 'public/assets/css/magnific-popup.css', __FILE__ ), array(), CHERRY_PORTFOLIO_VERSION );
170+
wp_enqueue_style( 'magnific-popup', plugins_url( 'public/assets/css/magnific-popup.css', __FILE__ ), array(), CHERRY_PORTFOLIO_VERSION );
169171
//wp_enqueue_style( 'justified-gallery', plugins_url( 'public/assets/css/justified-gallery.css', __FILE__ ), array(), CHERRY_PORTFOLIO_VERSION );
170172
wp_enqueue_style( 'swiper', plugins_url( 'public/assets/css/swiper.css', __FILE__ ), array(), CHERRY_PORTFOLIO_VERSION );
171-
wp_enqueue_style( 'cherry-portfolio-style', plugins_url( 'public/assets/css/style.css', __FILE__ ), array(), CHERRY_PORTFOLIO_VERSION );
173+
wp_enqueue_style( 'cherry-portfolio', plugins_url( 'public/assets/css/style.css', __FILE__ ), array(), CHERRY_PORTFOLIO_VERSION );
174+
}
175+
176+
/**
177+
* Pass style handle to CSS compiler.
178+
*
179+
* @since 1.0.0
180+
*
181+
* @param array $handles CSS handles to compile.
182+
*/
183+
public function add_style_to_compiler( $handles ) {
184+
$handles = array_merge(
185+
array( 'cherry-portfolio' => plugins_url( 'public/assets/css/style.css', __FILE__ ) ),
186+
$handles
187+
);
188+
189+
return $handles;
172190
}
173191

174192
/**
@@ -177,12 +195,12 @@ public function enqueue_styles() {
177195
* @since 1.0.0
178196
*/
179197
public function enqueue_scripts() {
180-
wp_enqueue_script( 'magnific-popup-min-js', trailingslashit( CHERRY_PORTFOLIO_URI ) . 'public/assets/js/jquery.magnific-popup.min.js', array( 'jquery' ), CHERRY_PORTFOLIO_VERSION, true);
198+
wp_enqueue_script( 'magnific-popup', trailingslashit( CHERRY_PORTFOLIO_URI ) . 'public/assets/js/jquery.magnific-popup.min.js', array( 'jquery' ), CHERRY_PORTFOLIO_VERSION, true);
181199
wp_enqueue_script( 'imagesloaded', trailingslashit( CHERRY_PORTFOLIO_URI ) . 'public/assets/js/imagesloaded.pkgd.js', array( 'jquery' ), CHERRY_PORTFOLIO_VERSION, true);
182200
//wp_enqueue_script( 'justified-gallery', trailingslashit( CHERRY_PORTFOLIO_URI ) . 'public/assets/js/justified-gallery.js', array( 'jquery' ), CHERRY_PORTFOLIO_VERSION, true);
183201
wp_enqueue_script( 'isotope', trailingslashit( CHERRY_PORTFOLIO_URI ) . 'public/assets/js/isotope.pkgd.min.js', array( 'jquery' ), CHERRY_PORTFOLIO_VERSION, true);
184202
wp_enqueue_script( 'cherry-portfolio-layout-plugin', trailingslashit( CHERRY_PORTFOLIO_URI ) . 'public/assets/js/cherry-portfolio-layout-plugin.js', array( 'jquery' ), CHERRY_PORTFOLIO_VERSION, true);
185-
wp_enqueue_script( 'swiper-jquery', trailingslashit( CHERRY_PORTFOLIO_URI ) . 'public/assets/js/swiper.js', array( 'jquery' ), CHERRY_PORTFOLIO_VERSION, true);
203+
wp_enqueue_script( 'swiper', trailingslashit( CHERRY_PORTFOLIO_URI ) . 'public/assets/js/swiper.js', array( 'jquery' ), CHERRY_PORTFOLIO_VERSION, true);
186204
wp_enqueue_script( 'cherry-portfolio-script', trailingslashit( CHERRY_PORTFOLIO_URI ) . 'public/assets/js/cherry-portfolio-scripts.js', array( 'jquery' ), CHERRY_PORTFOLIO_VERSION, true);
187205

188206
//ajax js object portfolio_type_ajax

public/includes/classes/class-cherry-portfolio-page-template.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ public function __construct() {
5353
// Add a filter to load a custom template for a given post.
5454
add_filter( 'single_template', array( $this, 'get_single_template' ) );
5555

56-
add_filter( 'cherry_display_sidebar', array( $this, 'display_sidebar' ), 10, 2 );
57-
5856
// Add your templates to this array.
5957
$this->templates = array(
6058
'template-portfolio.php' => __( 'Portfolio', 'cherry-portfolio' ),
@@ -152,26 +150,6 @@ public function get_single_template( $template ) {
152150
return $template;
153151
}
154152

155-
/**
156-
* Hide a `sidebar-main` on the page template `template-testimonials.php`.
157-
*
158-
* @since 1.0.0
159-
* @param bool $display
160-
* @param string $id
161-
* @return bool
162-
*/
163-
public function display_sidebar( $display, $id ) {
164-
$template = get_page_template_slug( get_the_ID() );
165-
166-
if ( 'template-portfolio.php' != $template ) {
167-
return $display;
168-
}
169-
170-
if ( 'sidebar-main' == $id ) {
171-
return false;
172-
}
173-
return $display;
174-
}
175153
/**
176154
* Returns the instance.
177155
*

templates/archive-portfolio.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @since 1.0.0
99
*/
1010
?>
11-
<article <?php cherry_attr( 'post' ); ?>>
11+
<article <?php if ( function_exists( 'cherry_attr' ) ) cherry_attr( 'post' ); ?>>
1212

1313
<?php
1414
$data = new Cherry_Portfolio_Data;

templates/single-portfolio.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
the_post(); ?>
1010

11-
<article <?php cherry_attr( 'post' ); ?>>
11+
<article <?php if ( function_exists( 'cherry_attr' ) ) cherry_attr( 'post' ); ?>>
1212

1313
<?php
1414

templates/template-portfolio.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
the_post(); ?>
1616

17-
<article <?php cherry_attr( 'post' ); ?>>
17+
<article <?php if ( function_exists( 'cherry_attr' ) ) cherry_attr( 'post' ); ?>>
1818

1919
<?php
2020
the_content();

0 commit comments

Comments
 (0)