Plugin Directory

Changeset 1364383


Ignore:
Timestamp:
03/04/2016 11:50:17 PM (10 years ago)
Author:
pagefrog
Message:

better post enabling, remove duplicate header images

Location:
pagefrog/trunk
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • pagefrog/trunk/README.txt

    r1361838 r1364383  
    224224
    225225== Changelog ==
     226= 1.0.8 =
     227*Release Date - March 5, 2016*
     228
     229* Solve header image duplication
     230* Enable posts by default, rather than forcing people to do it themselves
     231
    226232= 1.0.7.2 =
    227233*Release Date - February 29, 2016*
  • pagefrog/trunk/admin/class-pagefrog-admin.php

    r1361838 r1364383  
    132132        }
    133133        if ($hook === 'edit.php') {
    134             wp_enqueue_style( 'jquery_ui' );
     134            wp_enqueue_style( 'jquery_ui' );
    135135            wp_enqueue_style( 'thickbox' );
    136136            wp_enqueue_style( 'admin_css' );
     
    424424
    425425    /**
    426      * Add the sanitizer to amp ads.
     426     * Add the sanitizer for amp ads.
    427427     *
    428428     * @since 1.0.6
     
    433433        $sanitizer_classes['PageFrog_Amp_Ad_Injection_Sanitizer'] = array(
    434434            'ads' => $ads
     435        );
     436        return $sanitizer_classes;
     437    }
     438
     439    /**
     440     * Add the sanitizer for header images.
     441     *
     442     * @since 1.0.8
     443     */
     444    public function add_amp_header_image_sanitizer( $sanitizer_classes, $post ) {
     445        require_once( dirname( dirname( __FILE__ ) ) . '/public/class-amp-header-image-sanitizer.php' );
     446        $new_posts = new PageFrog_NewPostSettings_Storage();
     447        $sanitizer_classes['PageFrog_Amp_Header_Image_Sanitizer'] = array(
     448            'new_posts' => $new_posts,
     449            'post' => $post
    435450        );
    436451        return $sanitizer_classes;
     
    769784            }
    770785            $post_title = get_the_title( $post );
    771             echo "<span title='View PageFrog Format Settings' class='pagefrog-status-circle pagefrog-show-preview' data-post-id='$post' data-post-title='$post_title'><span class='pagefrog-status-circle-inner $fill $color'></span></span>";
     786            echo "<span pagefrog-title='View PageFrog Format Settings' class='pagefrog-status-circle pagefrog-show-preview' data-post-id='$post' data-post-title='$post_title'><span class='pagefrog-status-circle-inner $fill $color'></span></span>";
    772787        }
    773788    }
     
    925940
    926941            // we only need this temporarily, until AMP WP 0.4
    927             add_rewrite_endpoint( AMP_QUERY_VAR, EP_PERMALINK | EP_PAGES );
     942            add_rewrite_endpoint( AMP_QUERY_VAR, EP_ALL );
    928943            // end temp need
    929944
     
    11771192    }
    11781193
    1179     public function set_new_post_metadata( $post_id, $post, $update ) {
    1180         if ( ! $update ) {
     1194    public function set_new_post_metadata( $post_id ) {
     1195        $post = get_post( $post_id );
     1196        if ( $post->post_modified_gmt == $post->post_date_gmt && $post->post_type !== 'revision' ) {
    11811197            $new_post = new PageFrog_NewPostSettings_Storage();
    11821198            $status = new PageFrog_PostStatus( $post_id );
  • pagefrog/trunk/admin/class-pagefrog-analytics-storage.php

    r1349446 r1364383  
    257257        if ( isset( $data['other_amp_analytics_code'] ) && PageFrog_Utils::string_isnt_empty( $data['other_amp_analytics_code'] ) ) {
    258258            if (
    259                     PageFrog_Utils::starts_with( trim( $data['other_amp_analytics_code'] ), "<amp-analytics>" ) &&
     259                    PageFrog_Utils::starts_with( trim( $data['other_amp_analytics_code'] ), "<amp-analytics" ) &&
    260260                    PageFrog_Utils::ends_with( trim( $data['other_amp_analytics_code'] ), "</amp-analytics>" )
    261261                ) {
  • pagefrog/trunk/admin/class-pagefrog-new-post-settings-storage.php

    r1361838 r1364383  
    120120    public function get_fbia_disable_other_plugins_string() {
    121121        return $this->get_fbia_disable_other_plugins_bool() ? 'true' : 'false';
     122    }
     123
     124    public function get_amp_show_header_images_bool() {
     125        return $this->settings['amp_show_header_images'] ? true : false;
     126    }
     127
     128    public function get_amp_show_header_images_string() {
     129        return $this->get_amp_show_header_images_bool() ? 'true' : 'false';
     130    }
     131
     132    public function get_fbia_show_header_images_bool() {
     133        return $this->settings['fbia_show_header_images'] ? true : false;
     134    }
     135
     136    public function get_fbia_show_header_images_string() {
     137        return $this->get_fbia_show_header_images_bool() ? 'true' : 'false';
    122138    }
    123139
     
    171187        }
    172188
     189        if ( isset( $data['amp_show_header_images'] ) && PageFrog_Utils::string_isnt_empty( $data['amp_show_header_images'] ) ) {
     190            if ( $data['amp_show_header_images'] === 'true' || $data['amp_show_header_images'] === true ) {
     191                $clean_data['amp_show_header_images'] = 1;
     192            } else {
     193                $clean_data['amp_show_header_images'] = 0;
     194            }
     195        }
     196
     197        if ( isset( $data['fbia_show_header_images'] ) && PageFrog_Utils::string_isnt_empty( $data['fbia_show_header_images'] ) ) {
     198            if ( $data['fbia_show_header_images'] === 'true' || $data['fbia_show_header_images'] === true ) {
     199                $clean_data['fbia_show_header_images'] = 1;
     200            } else {
     201                $clean_data['fbia_show_header_images'] = 0;
     202            }
     203        }
     204
    173205        return $clean_data;
    174206    }
     
    195227    'fbia_enable_new_post' => 1,
    196228    'amp_disable_other_plugins' => 0,
    197     'fbia_disable_other_plugins' => 0
     229    'fbia_disable_other_plugins' => 0,
     230    'amp_show_header_images' => 1,
     231    'fbia_show_header_images' => 1
    198232);
    199233?>
  • pagefrog/trunk/admin/js/pagefrog-previews.js

    r1349446 r1364383  
    123123
    124124    // show tooltips
    125     jQuery( document ).tooltip();
    126 
     125    jQuery(document).tooltip({
     126        items: "[pagefrog-title]",
     127        content: function () {
     128            return jQuery(this).attr('pagefrog-title');
     129        }
     130    });
    127131
    128132    // mobile preview links
  • pagefrog/trunk/admin/js/pagefrog-settings.js

    r1359856 r1364383  
    2020            old_html = jQuery(this).html();
    2121            jQuery(this).html("<img style='float:left;position:relative;top:2px;width:22px' src='" + jQuery(this).attr('data-loading-icon') + "'><span>&nbsp;" + text + "</span>");
    22             var checkboxes = jQuery('.published-posts-checkbox[data-platform=' + jQuery(this).attr('data-platform'));
     22            var checkboxes = jQuery('.published-posts-checkbox[data-platform=' + jQuery(this).attr('data-platform') + "]");
    2323            for (var i = 0; i < checkboxes.length; i++) {
    2424                if (checkboxes[i].checked) {
  • pagefrog/trunk/admin/pagefrog-post-metadata.php

    r1359856 r1364383  
    101101    public function get_fbia_status() {
    102102        $stored_status = get_post_meta( $this->post_id, self::FBIA_STATUS_KEY, true);
    103         if ($stored_status === null) {
     103        if ( $stored_status === null || $stored_status === '' ) {
     104            $stored_status = true;
     105        } else if ( $stored_status === '1' || $stored_status === 1 ) {
     106            $stored_status = true;
     107        } else if ( $stored_status === '0' || $stored_status === 0) {
    104108            $stored_status = false;
    105         } else if ($stored_status == '1' || $stored_status == 1) {
    106             $stored_status = true;
    107109        }
    108110        return $stored_status;
     
    116118    public function get_amp_status() {
    117119        $stored_status = get_post_meta( $this->post_id, self::AMP_STATUS_KEY, true);
    118         if ($stored_status === null) {
     120        if ( $stored_status === null || $stored_status === '' ) {
     121            $stored_status = true;
     122        } else if ( $stored_status === '1' || $stored_status === 1 ) {
     123            $stored_status = true;
     124        } else if ( $stored_status === '0' || $stored_status === 0 ) {
    119125            $stored_status = false;
    120         } else if ($stored_status == '1' || $stored_status == 1) {
    121             $stored_status = true;
    122126        }
    123127        return $stored_status;
     
    140144        }
    141145
    142         add_post_meta( $this->post_id, self::FBIA_STATUS_KEY, $status, true ) or
    143             update_post_meta( $this->post_id, self::FBIA_STATUS_KEY, $status );
     146        $to_write = $status ? 1 : 0;
     147
     148        add_post_meta( $this->post_id, self::FBIA_STATUS_KEY, $to_write, true ) or
     149            update_post_meta( $this->post_id, self::FBIA_STATUS_KEY, $to_write );
    144150        return true;
    145151    }
     
    161167        }
    162168
    163         $enabled = $status && wp_amp_plugin_is_installed() && wp_amp_plugin_is_active();
    164         add_post_meta( $this->post_id, self::AMP_STATUS_KEY, $status, true ) or
    165             update_post_meta( $this->post_id, self::AMP_STATUS_KEY, $status );
     169        $to_write = $status && wp_amp_plugin_is_installed() && wp_amp_plugin_is_active() ? 1 : 0;
     170
     171        add_post_meta( $this->post_id, self::AMP_STATUS_KEY, $to_write, true ) or
     172            update_post_meta( $this->post_id, self::AMP_STATUS_KEY, $to_write );
    166173        return true;
    167174    }
     
    201208     */
    202209    public static function get_amp_enabled_post_count( $post_type ) {
     210        $meta_query = array(
     211            'relation' => 'OR',
     212            array(
     213                'key' => PageFrog_PostStatus::AMP_STATUS_KEY,
     214                'value' => 1,
     215            ),
     216            array(
     217                'key' => PageFrog_PostStatus::AMP_STATUS_KEY,
     218                'compare' => 'NOT EXISTS',
     219                'value' => '' // to fix a wp bug: https://core.trac.wordpress.org/ticket/23268
     220            ),
     221            array(
     222                'key' => PageFrog_PostStatus::AMP_STATUS_KEY,
     223                'value' => '',
     224            )
     225        );
    203226        $args = array(
    204             'meta_key' => PageFrog_PostStatus::AMP_STATUS_KEY,
    205             'meta_value' => 1,
     227            'meta_query' => $meta_query,
    206228            'post_status' => 'publish'
    207229        );
     
    220242    */
    221243    public static function get_fbia_enabled_post_count( $post_type ) {
     244        $meta_query = array(
     245            'relation' => 'OR',
     246            array(
     247                'key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
     248                'value' => 1,
     249            ),
     250            array(
     251                'key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
     252                'compare' => 'NOT EXISTS',
     253                'value' => '' // to fix a wp bug: https://core.trac.wordpress.org/ticket/23268
     254            ),
     255            array(
     256                'key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
     257                'value' => '',
     258            )
     259        );
    222260        $args = array(
    223             'meta_key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
    224             'meta_value' => 1,
     261            'meta_query' => $meta_query,
    225262            'post_status' => 'publish'
    226263        );
     
    240277    public static function amp_set_all_published_posts( $enabled, $post_type ) {
    241278        $meta_query = array(
    242             array(
    243                 'key' => PageFrog_PostStatus::AMP_STATUS_KEY,
    244                 'value' => 1,
    245                 'compare' => '='
     279            'relation' => 'OR',
     280            array(
     281                'key' => PageFrog_PostStatus::AMP_STATUS_KEY,
     282                'value' => 1
     283            ),
     284            array(
     285                'key' => PageFrog_PostStatus::AMP_STATUS_KEY,
     286                'compare' => 'NOT EXISTS',
     287                'value' => '' // to fix a wp bug: https://core.trac.wordpress.org/ticket/23268
     288            ),
     289            array(
     290                'key' => PageFrog_PostStatus::AMP_STATUS_KEY,
     291                'value' => '',
    246292            )
    247293        );
     
    250296            // we are actually enabling the posts, so we need to select all the disabled ones to change
    251297            $meta_query = array(
    252                 'relation' => 'OR',
    253298                array(
    254299                    'key' => PageFrog_PostStatus::AMP_STATUS_KEY,
    255                     'value' => false,
    256                 ),
    257                 array(
    258                     'key' => PageFrog_PostStatus::AMP_STATUS_KEY,
    259                     'compare' => 'NOT EXISTS',
    260                     'value' => '' // to fix a wp bug: https://core.trac.wordpress.org/ticket/23268
     300                    'value' => 0,
    261301                )
    262302            );
     
    287327    public static function fbia_set_all_published_posts( $enabled, $post_type ) {
    288328        $meta_query = array(
    289             array(
    290                 'key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
    291                 'value' => 1,
    292                 'compare' => '='
     329            'relation' => 'OR',
     330            array(
     331                'key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
     332                'value' => 1
     333            ),
     334            array(
     335                'key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
     336                'compare' => 'NOT EXISTS',
     337                'value' => '' // to fix a wp bug: https://core.trac.wordpress.org/ticket/23268
     338            ),
     339            array(
     340                'key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
     341                'value' => '',
    293342            )
    294343        );
     
    299348                array(
    300349                    'key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
    301                     'value' => false
    302                 ),
    303                 array(
    304                     'key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
    305                     'compare' => 'NOT EXISTS',
    306                     'value' => '' // to fix a wp bug: https://core.trac.wordpress.org/ticket/23268
    307                 ),
     350                    'value' => 0
     351                )
    308352            );
    309353        }
  • pagefrog/trunk/admin/pagefrog-preview.php

    r1359856 r1364383  
    2626                        <div class="col-xs-6 col-sm-7">
    2727                            <label for="pagefrog-fbia-status" style="font-size:12px">
    28                                 <input type="checkbox" id="pagefrog-fbia-status" class="pagefrog-status-toggle" <?php echo $fbia_status_string; ?> name="fbia_status" >&nbsp;Instant Articles <span class="dashicons dashicons-editor-help" title="When enabled, this post will be served in Instant Articles format for mobile visitors from the Facebook app. Access to Facebook Instant Articles is required." style="line-height:0.5;font-size:15px"></span>
     28                                <input type="checkbox" id="pagefrog-fbia-status" class="pagefrog-status-toggle" <?php echo $fbia_status_string; ?> name="fbia_status" >&nbsp;Instant Articles <span class="dashicons dashicons-editor-help" pagefrog-title="When enabled, this post will be served in Instant Articles format for mobile visitors from the Facebook app. Access to Facebook Instant Articles is required." style="line-height:0.5;font-size:15px"></span>
    2929                            </label>
    3030                        </div>
    3131                        <div class="col-sm-5">
    3232                            <label for="pagefrog-amp-status"  style="font-size:12px" class="<?php echo $amp_enabled_string ?>">
    33                                 <input type="checkbox" id="pagefrog-amp-status" class="pagefrog-status-toggle" <?php echo $amp_status_string . ' ' . $amp_enabled_string; ?> name="amp_status" >&nbsp;AMP HTML <span class="dashicons dashicons-editor-help" title="When enabled, this post will be served in AMP HTML format for mobile visitors from Google, Twitter, LinkedIn, and Pinterest apps upon the official release of AMP." style="line-height:0.5;font-size:15px"></span>
     33                                <input type="checkbox" id="pagefrog-amp-status" class="pagefrog-status-toggle" <?php echo $amp_status_string . ' ' . $amp_enabled_string; ?> name="amp_status" >&nbsp;AMP HTML <span class="dashicons dashicons-editor-help" pagefrog-title="When enabled, this post will be served in AMP HTML format for mobile visitors from Google, Twitter, LinkedIn, and Pinterest apps upon the official release of AMP." style="line-height:0.5;font-size:15px"></span>
    3434                            </label>
    3535                        </div>
  • pagefrog/trunk/admin/pagefrog-settings.php

    r1361838 r1364383  
    3636        '',
    3737        'render_fbia_disable_other_plugins',
     38        $GLOBALS['PAGEFROG_SETTINGS_PAGE_SLUG'],
     39        PageFrog_NewPostSettings_Storage::OPTIONS_KEY,
     40        array( 'new_post' => $new_post )
     41    );
     42
     43    add_settings_field(
     44        'amp_show_header_images',
     45        '',
     46        'render_amp_show_header_images',
     47        $GLOBALS['PAGEFROG_SETTINGS_PAGE_SLUG'],
     48        PageFrog_NewPostSettings_Storage::OPTIONS_KEY,
     49        array( 'new_post' => $new_post )
     50    );
     51
     52    add_settings_field(
     53        'fbia_show_header_images',
     54        '',
     55        'render_fbia_show_header_images',
    3856        $GLOBALS['PAGEFROG_SETTINGS_PAGE_SLUG'],
    3957        PageFrog_NewPostSettings_Storage::OPTIONS_KEY,
     
    8199    ?><input type="hidden" name="<?php echo PageFrog_NewPostSettings_Storage::OPTIONS_KEY; ?>[fbia_disable_other_plugins]" value="<?php echo $args['new_post']->get_fbia_disable_other_plugins_string(); ?>"><?php
    82100}
     101function render_amp_show_header_images( $args ) {
     102    ?><input type="hidden" name="<?php echo PageFrog_NewPostSettings_Storage::OPTIONS_KEY; ?>[amp_show_header_images]" value="<?php echo $args['new_post']->get_amp_show_header_images_string(); ?>"><?php
     103}
     104function render_fbia_show_header_images( $args ) {
     105    ?><input type="hidden" name="<?php echo PageFrog_NewPostSettings_Storage::OPTIONS_KEY; ?>[fbia_show_header_images]" value="<?php echo $args['new_post']->get_fbia_show_header_images_string(); ?>"><?php
     106}
    83107
    84108
     
    119143                                            <p class="required">To enable Instant Articles on published posts on your site, select the post types that you'd like to be converted then click "Enable FBIA".</p>
    120144                                        </div>
    121                                         <div class="col-sm-9">
     145                                        <div class="col-sm-9 col-lg-7">
    122146                                            <div class="row">
    123                                                 <div class="col-sm-12">
     147                                                <div class="col-sm-12 big-margin-bottom">
    124148                                                    <div class="well">
    125149                                                        <div class="row">
     
    143167                                                        </div>
    144168                                                        <?php endforeach; ?>
    145                                                     </div>
    146                                                 </div>
    147                                             </div>
    148                                             <div class="row">
    149                                                 <div class="col-sm-12 margin-top-bottom big-margin-bottom">
    150                                                     <div class="row">
    151                                                         <div class="col-sm-6"><a href="#" class="button block bulk-enable-button" data-enable="1" data-platform="fbia" data-loading-icon="<?php echo plugin_dir_url( __FILE__ ) . 'images/loading.svg'; ?>">Enable FBIA</a></div>
    152                                                         <div class="col-sm-6"><a href="#" class="button block bulk-enable-button" data-enable="0" data-platform="fbia" data-loading-icon="<?php echo plugin_dir_url( __FILE__ ) . 'images/loading.svg'; ?>">Disable FBIA</a></div>
     169                                                        <div class="row">
     170                                                            <div class="col-sm-6"><a href="#" class="button block bulk-enable-button" data-enable="1" data-platform="fbia" data-loading-icon="<?php echo plugin_dir_url( __FILE__ ) . 'images/loading.svg'; ?>">Enable FBIA</a></div>
     171                                                            <div class="col-sm-6"><a href="#" class="button block bulk-enable-button" data-enable="0" data-platform="fbia" data-loading-icon="<?php echo plugin_dir_url( __FILE__ ) . 'images/loading.svg'; ?>">Disable FBIA</a></div>
     172                                                        </div> 
    153173                                                    </div>
    154174                                                </div>
     
    217237                                        <div class="col-sm-9">
    218238                                            <div class="row">
    219                                                 <div class="col-sm-12">
     239                                                <div class="col-sm-12 big-margin-bottom">
    220240                                                    <div class="well">
    221241                                                        <div class="row">
     
    239259                                                        </div>
    240260                                                        <?php endforeach; ?>
    241                                                     </div>
    242                                                 </div>
    243                                             </div>
    244                                             <div class="row">
    245                                                 <div class="col-sm-12 margin-top-bottom big-margin-bottom">
    246                                                     <div class="row">
     261                                                        <div class="row">
    247262                                                        <div class="col-sm-6"><a href="#" class="button block bulk-enable-button" data-enable="1" data-platform="amp" data-loading-icon="<?php echo plugin_dir_url( __FILE__ ) . 'images/loading.svg'; ?>">Enable AMP</a></div>
    248263                                                        <div class="col-sm-6"><a href="#" class="button block bulk-enable-button" data-enable="0" data-platform="amp" data-loading-icon="<?php echo plugin_dir_url( __FILE__ ) . 'images/loading.svg'; ?>">Disable AMP</a></div>
     264                                                    </div>
    249265                                                    </div>
    250266                                                </div>
     
    310326                                                        </div>
    311327                                                    </div>
     328                                                    <div class="row">
     329                                                        <div class="col-sm-12 margin-top-bottom">
     330                                                            <label for="amp-show-header-images">
     331                                                                <input id="amp-show-header-images" type="checkbox" class="sync-form" name="<?php echo PageFrog_NewPostSettings_Storage::OPTIONS_KEY; ?>[amp_show_header_images]" <?php if ( $new_post->get_amp_show_header_images_bool() ) echo 'checked="checked"' ?>>&nbsp;Display Featured Image
     332                                                            </label>
     333                                                        </div>
     334                                                    </div>
    312335                                                </div>
    313336                                            </div>
  • pagefrog/trunk/admin/pagefrog-setup.php

    r1355936 r1364383  
    5858                                } else if ( ! wp_amp_plugin_is_active() ) { ?>
    5959                                    <h1 class="text-center"><a href="#" data-href="<?php echo get_activate_wp_amp_plugin_url() ?>" class="button green button-lg" id="activate-amp-button">Activate AMP Plugin</a></h1>
    60                                     <h1 class="text-center margin-top-bottom hidden" id="pagefrog-amp-ready" style="margin-top:20px;line-height:1;"><strong>READY&nbsp;<span class="circled green">&#x2713;</span></strong></h1>
     60                                    <h1 class="text-center margin-top-bottom hidden" id="pagefrog-amp-ready" style="margin-top:20px;line-height:1;"><button class="button greenoutline button-lg" disabled><strong>&nbsp;&nbsp;&nbsp;Ready&nbsp;<span class="green">&#x2713;&nbsp;&nbsp;&nbsp;</span></strong></button></h1>
    6161                                    <?php
    6262                                } else { ?>
  • pagefrog/trunk/admin/partials/pagefrog-amp-template-meta-author.php

    r1355936 r1364383  
    88  <?php endif; ?>
    99  -->
    10   <span class="author">BY&nbsp;<?php echo esc_html( $post_author->display_name ); ?></span>
     10  <span class="author"><?php echo esc_html( $post_author->display_name ); ?></span>
    1111</li>
    1212<br/>
  • pagefrog/trunk/admin/partials/pagefrog-amp-template-single.php

    r1357722 r1364383  
    1717
    1818  <?php
    19       if ( has_post_thumbnail( $this->get( 'post' )->ID ) ) :
     19      $possible_imgs = PageFrog_Amp_Header_Image_Sanitizer::get_header_img_srcs_possible( $this->get( 'post' )->ID );
     20      $header_img_in_content = false;
     21      foreach ( $possible_imgs as $img ) {
     22        if ( PageFrog_Utils::contains( $this->get( 'post_amp_content' ), $img ) ) {
     23          $header_img_in_content = true;
     24          break;
     25        }
     26      }
     27      $new_post = new PageFrog_NewPostSettings_Storage();
     28
     29      $show_header_img = ! $header_img_in_content && $new_post->get_amp_show_header_images_bool() && has_post_thumbnail( $this->get( 'post' )->ID );
     30      if ( $show_header_img ) :
    2031        $thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $this->get( 'post' )->ID ), 'full' );
    2132        $thumb_url = $thumb[0];
     
    3748        $width = $this->get( 'site_icon_width' );
    3849        if ( ! $width ) {
    39           $width = 32;
     50          $width = 24;
    4051        }
    4152        $height = $this->get( 'site_icon_height' );
    4253        if ( ! $height ) {
    43           $height = 32;
     54          $height = 24;
    4455        }
    4556        ?>
     
    5667</nav>
    5768<div class="content">
    58   <h1 class="title"><?php echo esc_html( $this->get( 'post_title' ) ); ?></h1>
     69  <h1 class="title"><?php echo $this->get( 'post_title' ); ?></h1>
    5970  <ul class="meta">
    6071    <?php $this->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-author', 'meta-time', 'meta-taxonomy' ) ) ); ?>
  • pagefrog/trunk/admin/partials/pagefrog-amp-template-styles.php

    r1355936 r1364383  
    44  amp-img.alignleft { float: left; margin: 0 1em 1em 0; }
    55  amp-img.aligncenter { display: block; margin-left: auto; margin-right: auto; }
     6  .content amp-img { max-width: 100%; }
    67  .alignright { float: right; }
    78  .alignleft { float: left; }
     
    142143  blockquote {
    143144    padding: 16px;
     145    padding-top: 0px;
     146    padding-bottom: 0px;
    144147    margin: 8px 0 24px 0;
    145148    border-left: 2px solid <?php echo $styles->get_quotes_font_color(); ?>;
  • pagefrog/trunk/includes/class-pagefrog.php

    r1361838 r1364383  
    7070
    7171        $this->plugin_name = 'pagefrog';
    72         $this->version = '1.0.7.2';
     72        $this->version = '1.0.8';
    7373
    7474        $this->load_dependencies();
     
    203203        $this->loader->add_action( 'amp_post_template_body_begin', $plugin_admin, 'add_analytics_to_amp' );
    204204        $this->loader->add_filter( 'amp_content_sanitizers', $plugin_admin, 'add_amp_ads_sanitizer', 10, 2 );
     205        $this->loader->add_filter( 'amp_content_sanitizers', $plugin_admin, 'add_amp_header_image_sanitizer', 10, 2 );
    205206        $this->loader->add_filter( 'amp_post_template_metadata', $plugin_admin, 'add_logo_to_schema_org', 10, 2 );
    206207
     
    217218
    218219        // adding meta data to new posts
    219         $this->loader->add_action( 'wp_insert_post', $plugin_admin, 'set_new_post_metadata', 10, 3 );
     220        $this->loader->add_action( 'save_post', $plugin_admin, 'set_new_post_metadata', 10, 3 );
    220221    }
    221222
  • pagefrog/trunk/pagefrog.php

    r1361838 r1364383  
    1616 * Plugin URI:        http://pagefrog.com/
    1717 * Description:       The PageFrog plugin allows you to easily publish and manage your content directly from WordPress for Facebook Instant Articles (FBIA) and Google Accelerated Mobile Pages (AMP) with full support for ads and analytics.
    18  * Version:           1.0.7.2
     18 * Version:           1.0.8
    1919 * Author:            PageFrog Team
    2020 * Author URI:        http://pagefrog.com/
  • pagefrog/trunk/templates/pagefrog-feed.php

    r1355936 r1364383  
    2525
    2626<channel>
    27     <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
     27    <title><?php bloginfo_rss('name'); ?></title>
    2828    <link><?php bloginfo_rss('url') ?></link>
    2929    <description><?php bloginfo_rss("description") ?></description>
     
    3232
    3333    <?php
    34         // fetch all published posts (render up to 50 valid posts)
    35         $query = new WP_Query( array(
    36             'post_status' => 'publish',
    37             'nopaging' => true
    38         ) );
     34        // fetch all published posts marked for FBIA publishing (render up to 50 valid posts)
     35        $meta_query = array(
     36            'relation' => 'OR',
     37            array(
     38                'key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
     39                'value' => 1,
     40            ),
     41            array(
     42                'key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
     43                'compare' => 'NOT EXISTS',
     44                'value' => '' // to fix a wp bug: https://core.trac.wordpress.org/ticket/23268
     45            ),
     46            array(
     47                'key' => PageFrog_PostStatus::FBIA_STATUS_KEY,
     48                'value' => '',
     49            )
     50        );
     51        $args = array(
     52            'meta_query' => $meta_query,
     53            'post_status' => 'publish'
     54        );
     55        $query = new WP_Query( $args );
    3956        $rendered_posts = 0;
    4057
     
    4360            $query->the_post();
    4461
    45             // don't show unless marked to publish in feed
    46             $post_status = new PageFrog_PostStatus( get_the_ID() );
    47             if ( $post_status->get_fbia_status() == false ) {
    48                 continue;
    49             }
    50 
     62            // only show up to 50 rendered posts
    5163            $rendered_posts += 1;
    52 
    53             // only show up to 50 rendered posts
    5464            if ( $rendered_posts > 50 ) {
    5565                break;
Note: See TracChangeset for help on using the changeset viewer.