Skip to content

Commit

Permalink
Merge pull request #9 from ahmedkaludi/master
Browse files Browse the repository at this point in the history
Update to 0.9.58
  • Loading branch information
Nicholas Griffin authored Aug 9, 2017
2 parents a31dc44 + 1b72178 commit 6469d1a
Show file tree
Hide file tree
Showing 78 changed files with 6,050 additions and 335 deletions.
361 changes: 340 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

110 changes: 102 additions & 8 deletions accelerated-moblie-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Accelerated Mobile Pages
Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
Description: AMP for WP - Accelerated Mobile Pages for WordPress
Version: 0.9.57.3
Version: 0.9.58
Author: Ahmed Kaludi, Mohammed Kaludi
Author URI: https://ampforwp.com/
Donate link: https://www.paypal.me/Kaludi/25
Expand All @@ -18,7 +18,7 @@
define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
define('AMPFORWP_VERSION','0.9.57.3');
define('AMPFORWP_VERSION','0.9.58');
// any changes to AMP_QUERY_VAR should be refelected here
define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );

Expand Down Expand Up @@ -165,8 +165,18 @@ function ampforwp_add_custom_rewrite_rules() {
register_activation_hook( __FILE__, 'ampforwp_rewrite_activation', 20 );
function ampforwp_rewrite_activation() {

// Run AMP deactivation code while activation
ampforwp_deactivate_amp_plugin();

if ( ! did_action( 'ampforwp_init' ) ) {
ampforwp_init();
}

flush_rewrite_rules();

ampforwp_add_custom_post_support();
ampforwp_add_custom_rewrite_rules();

// Flushing rewrite urls ONLY on activation
global $wp_rewrite;
$wp_rewrite->flush_rules();
Expand All @@ -180,6 +190,16 @@ function ampforwp_rewrite_activation() {
function ampforwp_rewrite_deactivate() {
// Flushing rewrite urls ONLY on deactivation
global $wp_rewrite;

foreach ( $wp_rewrite->endpoints as $index => $endpoint ) {
if ( AMP_QUERY_VAR === $endpoint[1] ) {
unset( $wp_rewrite->endpoints[ $index ] );
break;
}
}

flush_rewrite_rules();

$wp_rewrite->flush_rules();

// Remove transient for Welcome page
Expand Down Expand Up @@ -220,8 +240,6 @@ function ampforwp_add_module_files() {
}
}



/*
* Load Files only in the backend
* As we don't need plugin activation code to run everytime the site loads
Expand All @@ -231,7 +249,8 @@ function ampforwp_add_module_files() {
// Include Welcome page only on Admin pages
require AMPFORWP_PLUGIN_DIR .'/includes/welcome.php';

add_action('init','ampforwp_plugin_notice');
// Deactivate Parent Plugin notice
// add_action('init','ampforwp_plugin_notice');
function ampforwp_plugin_notice() {

if ( ! defined( 'AMP__FILE__' ) ) {
Expand Down Expand Up @@ -309,8 +328,9 @@ function ampforwp_required_plugin_styling() {

// Add Settings Button in Plugin backend
if ( ! function_exists( 'ampforwp_plugin_settings_link' ) ) {

add_filter( 'plugin_action_links', 'ampforwp_plugin_settings_link', 10, 5 );

// Deactivate Parent Plugin notice
// add_filter( 'plugin_action_links', 'ampforwp_plugin_settings_link', 10, 5 );

function ampforwp_plugin_settings_link( $actions, $plugin_file ) {
static $plugin;
Expand Down Expand Up @@ -365,6 +385,7 @@ public function __construct(){
* Gentlemen start your engines
*/
function ampforwp_plugin_init() {

if ( defined( 'AMP__FILE__' ) && defined('AMPFORWP_PLUGIN_DIR') ) {
new Ampforwp_Init;
}
Expand All @@ -376,4 +397,77 @@ function ampforwp_plugin_init() {
* to be used be used in before or after Loop
*/
require AMPFORWP_PLUGIN_DIR.'/templates/category-widget.php';
require AMPFORWP_PLUGIN_DIR.'/templates/woo-widget.php';
require AMPFORWP_PLUGIN_DIR.'/templates/woo-widget.php';


/*
* Including core AMP plugin files and removing any other things if necessary
*/
function ampforwp_bundle_core_amp_files(){
// Bundling Default plugin
require_once AMPFORWP_PLUGIN_DIR .'/includes/vendor/amp/amp.php';

define( 'AMP__FILE__', __FILE__ );
define( 'AMP__DIR__', plugin_dir_path(__FILE__) . 'includes/vendor/amp/' );
define( 'AMP__VERSION', '0.4.2' );

require_once( AMP__DIR__ . '/back-compat/back-compat.php' );
require_once( AMP__DIR__ . '/includes/amp-helper-functions.php' );
require_once( AMP__DIR__ . '/includes/admin/functions.php' );
require_once( AMP__DIR__ . '/includes/settings/class-amp-customizer-settings.php' );
require_once( AMP__DIR__ . '/includes/settings/class-amp-customizer-design-settings.php' );
}
add_action('plugins_loaded','ampforwp_bundle_core_amp_files', 8);

function ampforwp_deactivate_amp_plugin() {

if ( version_compare( floatval( get_bloginfo( 'version' ) ), '3.5', '>=' ) ) {

if ( current_user_can( 'activate_plugins' ) ) {

add_action( 'admin_init', 'ampforwp_deactivate_amp' );

function ampforwp_deactivate_amp() {
deactivate_plugins( AMPFORWP_MAIN_PLUGIN_DIR . 'amp/amp.php' );
}
}
}
}
add_action( 'plugins_loaded', 'ampforwp_deactivate_amp_plugin' );

function ampforwp_modify_amp_activatation_link( $actions, $plugin_file ) {
$plugin = '';

$plugin = 'amp/amp.php';
if ( $plugin == $plugin_file ) {
unset($actions['activate']);
}
return $actions;
}
add_filter( 'plugin_action_links', 'ampforwp_modify_amp_activatation_link', 10, 2 );


if ( ! function_exists('ampforwp_init') ) {
add_action( 'init', 'ampforwp_init' );
function ampforwp_init() {
if ( false === apply_filters( 'amp_is_enabled', true ) ) {
return;
}

define( 'AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );

do_action( 'amp_init' );

load_plugin_textdomain( 'amp', false, plugin_basename( AMP__DIR__ ) . '/languages' );

add_rewrite_endpoint( AMP_QUERY_VAR, EP_PERMALINK );
add_post_type_support( 'post', AMP_QUERY_VAR );

add_filter( 'request', 'amp_force_query_var_value' );
add_action( 'wp', 'amp_maybe_add_actions' );

if ( class_exists( 'Jetpack' ) && ! ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ) {
require_once( AMP__DIR__ . '/jetpack-helper.php' );
}
}
}
5 changes: 2 additions & 3 deletions classes/class-ampforwp-youtube-embed.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php #971
require_once AMP__DIR__ . '/includes/embeds/class-amp-base-embed-handler.php' ;
<?php require_once AMP__DIR__ . '/includes/embeds/class-amp-base-embed-handler.php';

// Much of this class is borrowed from Jetpack embeds
class AMPforWP_YouTube_Embed_Handler extends AMP_Base_Embed_Handler {
Expand Down Expand Up @@ -129,4 +128,4 @@ private function sanitize_v_arg( $value ) {

return $value;
}
}
}
5 changes: 2 additions & 3 deletions feeds/instant-article-feed.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
<?php header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
$more = 1;

echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
Expand Down Expand Up @@ -52,4 +51,4 @@

<?php endwhile; ?>
</channel>
</rss>
</rss>
1 change: 0 additions & 1 deletion includes/includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,4 @@ function ampforwp_add_admin_styling(){
wp_register_style( 'ampforwp_admin_css', untrailingslashit(AMPFORWP_PLUGIN_DIR_URI) . '/includes/admin-style.css', false, '1.0.0' );
wp_enqueue_style( 'ampforwp_admin_css' );
}

?>
5 changes: 1 addition & 4 deletions includes/modules/ampforwp-blurb.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<?php

class AMPFORWP_Blurb_Widget extends WP_Widget {

<?php class AMPFORWP_Blurb_Widget extends WP_Widget {
/*--------------------------------------------------*/
/* Constructor
/*--------------------------------------------------*/
Expand Down
4 changes: 1 addition & 3 deletions includes/modules/ampforwp-button.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

class AMPFORWP_Button_Widget extends WP_Widget {
<?php class AMPFORWP_Button_Widget extends WP_Widget {

/*--------------------------------------------------*/
/* Constructor
Expand Down
5 changes: 2 additions & 3 deletions includes/newsletter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
class ampforwp_pointers {
<?php class ampforwp_pointers {
const DISPLAY_VERSION = 'v1.0';
function __construct () {
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
Expand Down Expand Up @@ -130,4 +129,4 @@ function ampforwp_pointer_script ($id, $options, $button1, $button2=false, $func
}
}
$ampforwp_pointers = new ampforwp_pointers();
?>
?>
4 changes: 1 addition & 3 deletions includes/options/admin-config.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<?php
// Admin Panel Options

if ( ! class_exists( 'Redux' ) ) {
return;
}

// Option name where all the Redux data is stored.
$opt_name = "redux_builder_amp";
$comment_AD_URL = "http://ampforwp.com/amp-comments/#utm_source=options-panel&utm_medium=comments-tab&utm_campaign=AMP%20Plugin";
Expand Down Expand Up @@ -2573,4 +2571,4 @@ function fb_instant_article(){
) );
/*
* <--- END SECTIONS
*/
*/
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,7 @@
<a href="javascript:void(0);" class="expand_options<?php echo esc_attr(( $this->parent->args['open_expanded'] ) ? ' expanded' : ''); ?>"<?php echo $this->parent->args['hide_expand'] ? ' style="display: none;"' : '' ?>>
<?php esc_attr_e( 'Expand', 'redux-framework' ); ?>
</a>

<?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_inactive( 'amp/amp.php' ) ) {?>

<p style=" text-align: left;
margin-left: 50px;
margin-top: 7px;">
<a style="color: #e91e63;text-decoration: none;font-size: 15px;line-height: 1;" href="index.php?page=ampforwp-welcome-page">Action Required
<span style="box-shadow: 0px 1px 13px rgba(0, 0, 0, 0.2);border-radius: 40px;padding: 6px 18px 8px 20px;margin-left: 12px;color: #fff;background: #e91e63;font-size: 13px;">Finish Installation</span>
</a>
</p>
<?php } ?>


<div class="redux-action_bar">
<span class="spinner"></span>
<?php if ( false === $this->parent->args['hide_save'] ) { ?>
Expand Down
3 changes: 1 addition & 2 deletions includes/redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ function ampforwp_page_template_redirect_archive() {
}
}
}

// Redirection code is not working properly. Need fix
//add_action( 'template_redirect', 'ampforwp_page_template_redirect_non_amp', 10 );
// function ampforwp_page_template_redirect_non_amp() {
Expand All @@ -134,4 +133,4 @@ function ampforwp_page_template_redirect_archive() {
// wp_redirect( esc_url( $current_view_nonamp_url) , 301 );
// exit();
// }
// }
// }
Loading

0 comments on commit 6469d1a

Please sign in to comment.