Plugin Directory

Changeset 2830207


Ignore:
Timestamp:
12/07/2022 06:06:14 PM (3 years ago)
Author:
rockcontentplatform
Message:

Correção do endpoint do Rock Analytics.

Location:
rock-content
Files:
85 added
5 edited

Legend:

Unmodified
Added
Removed
  • rock-content/trunk/README.txt

    r2807937 r2830207  
    55Requires at least: 3.5.0
    66Tested up to: 6.0.3
    7 Stable tag: 3.0.0
     7Stable tag: 3.0.1
    88
    99Este fantástico plugin permite integrar o seu blog Wordpress com as plataformas de marketing de conteúdo da [Rock Content](https://rockcontent.com/).
     
    7979* Inserção da aba de notificações que será utilizada para comunicação com clientes do Stage.
    8080
     81= 3.0.1 =
     82* Correção do endpoint do Rock Analytics.
     83
    8184== Upgrade Notice ==
    8285
  • rock-content/trunk/RockContent.php

    r2807937 r2830207  
    1616 * Plugin URI:        https://rockcontent.com/
    1717 * Description:       Este fantástico plugin permite integrar o seu blog WordPress com a plataforma Rock Content.
    18  * Version:           3.0.0
     18 * Version:           3.0.1
    1919 * Author:            Rock Content
    2020 * Author URI:        https://rockcontent.com/
     
    3434define( 'RCP_NAME', 'rock-content' );
    3535
    36 define( 'RCP_VERSION', '3.0.0' );
     36define( 'RCP_VERSION', '3.0.1' );
    3737
    3838define( 'RCP_NAME_DIR', plugin_dir_path( __FILE__ ) );
  • rock-content/trunk/inc/Admin/PluginAdmin.php

    r2807937 r2830207  
    271271                'nonce'    => wp_create_nonce( 'rock_content_notification_nonce' ),
    272272            )
     273        );
     274    }
     275
     276    /**
     277     * Queue the css and js which will execute in front pages
     278     *
     279     * @return void
     280     *
     281     * @since 3.0.0
     282     */
     283    public function enqueue_front_scripts() {
     284        wp_enqueue_script(
     285            'rcp_rock_analytics_script',
     286            plugin_dir_url( __FILE__ ) . '../../assets/admin/scripts/rockAnalytics.js',
     287            array( 'jquery' ),
     288            RCP_VERSION
    273289        );
    274290    }
  • rock-content/trunk/inc/Core/PluginInit.php

    r2807937 r2830207  
    136136        $this->loader->add_action( 'admin_init', $plugin_integration, 'rcp_initialize_layout_options' );
    137137        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_integration, 'enqueue_admin_scripts' );
     138        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_integration, 'enqueue_front_scripts' );
    138139        $this->loader->add_action( 'wp_ajax_hide_notification', $model_notification, 'hide_notification_callback' );
    139140        $this->loader->add_action( 'wp_ajax_nopriv_hide_notification', $model_notification, 'hide_notification_callback' );
  • rock-content/trunk/inc/Integrations/RockAnalytics.php

    r2807937 r2830207  
    181181     */
    182182    public static function inject_analytics_default() {
     183        $data = array();
    183184
    184185        if ( ! get_option( 'rcp_rock_analytics_enabled' ) ) {
     
    190191        }
    191192
    192         $blog_name = esc_js( get_bloginfo( 'name' ) );
    193         echo esc_js(
    194             "
    195             <script type='text/javascript'>
    196             window.chorusAnalytics_blogName = '$blog_name';
    197             </script>
    198         "
    199         );
     193        $blog_name = get_bloginfo( 'name' );
    200194
    201195        if ( is_single() ) {
    202196            $post = get_post();
    203197            $data = self::get_post_analytics_data( $post );
    204 
    205             $script_tag = "
    206             <script type='text/javascript'>
    207                 window.chorusAnalytics_postType              = '{$data['post_type']}';
    208                 window.chorusAnalytics_postDate              =  {$data['post_date']};
    209                 window.chorusAnalytics_postAuthor            = '{$data['post_author']}';
    210                 window.chorusAnalytics_postCategories        = '{$data['categories_json']}';
    211                 window.chorusAnalytics_postTags              = '{$data['tags_json']}';
    212                 window.chorusAnalytics_postWordCount         =  {$data['word_count']};
    213                 window.chorusAnalytics_postPublishedByStudio =  {$data['published_by_studio']};
    214             </script>
    215             ";
    216 
    217             echo esc_js( $script_tag );
    218         }
    219 
    220         echo esc_js(
    221             "
    222             <script type='text/javascript'>
    223             window.onload = function () {
    224                 if (!window.chorusAnalytics_isLoaded) {
    225                 var rockAnalyticsScript = document.createElement('script');
    226                 rockAnalyticsScript.type = 'text/javascript';
    227                 rockAnalyticsScript.src = '" . ROCK_ANALYTICS_SCRIPT . "';
    228                 rockAnalyticsScript.async = true;
    229                 document.body.appendChild(rockAnalyticsScript);
    230                 }
    231             };
    232             </script>
    233         "
     198        }
     199
     200        wp_localize_script(
     201            'rcp_rock_analytics_script',
     202            'ajax_object',
     203            array(
     204                'blog_name'             => $blog_name,
     205                'data'                  => $data,
     206                'rock_analytics_script' => ROCK_ANALYTICS_SCRIPT,
     207            )
    234208        );
    235209
Note: See TracChangeset for help on using the changeset viewer.