Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /home/nandedex/www/s.nandedexpress.com/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : /home/nandedex/www/s.nandedexpress.com/better-disqus-comments.tar
better-disqus-comments.php000064400000022776151213254270011713 0ustar00<?php
/*
Plugin Name: Better Disqus Comments
Plugin URI: http://betterstudio.com
Description: Take advantage of powerful and unique features by integrating Disqus comments on your website instead of the standard WordPress commenting system.
Version: 1.3.0
Author: BetterStudio
Author URI: http://betterstudio.com
License: GPL2
*/


/**
 * Better_Disqus_Comments class wrapper for make changes safe in future
 *
 * @return Better_Disqus_Comments
 */
function Better_Disqus_Comments() {

	return Better_Disqus_Comments::self();
}


// Initialize Better Disqus Comments
Better_Disqus_Comments();


/**
 * Class Better_Disqus_Comments
 */
class Better_Disqus_Comments {


	/**
	 * Contains Better_Disqus_Comments version number that used for assets for preventing cache mechanism
	 *
	 * @var string
	 */
	private static $version = '1.3.0';


	/**
	 * Contains plugin option panel ID
	 *
	 * @var string
	 */
	private static $panel_id = 'better_disqus_comments';

	/**
	 * Comments loading type: ajaxified|plain
	 *
	 * @var string
	 */
	private $comments_type;

	/**
	 * Inner array of instances
	 *
	 * @var array
	 */
	protected static $instances = array();


	function __construct() {

		include self::dir_path( 'includes/options/panel.php' );

		// Initialize
		add_action( 'better-framework/after_setup', array( $this, 'bf_init' ) );

		load_plugin_textdomain( 'better-studio', FALSE, 'better-disqus-comments/languages' );

	}


	/**
	 * Used for accessing plugin directory URL
	 *
	 * @param string $address
	 *
	 * @return string
	 */
	public static function dir_url( $address = '' ) {

		return plugin_dir_url( __FILE__ ) . $address;

	}


	/**
	 * Used for accessing plugin directory path
	 *
	 * @param string $address
	 *
	 * @return string
	 */
	public static function dir_path( $address = '' ) {

		return plugin_dir_path( __FILE__ ) . $address;

	}


	/**
	 * Returns plugin current Version
	 *
	 * @return string
	 */
	public static function get_version() {

		return self::$version;

	}


	/**
	 * Build the required object instance
	 *
	 * @param   string $object
	 * @param   bool   $fresh
	 * @param   bool   $just_include
	 *
	 * @return  Better_Disqus_Comments|null
	 */
	public static function factory( $object = 'self', $fresh = FALSE, $just_include = FALSE ) {

		if ( isset( self::$instances[ $object ] ) && ! $fresh ) {
			return self::$instances[ $object ];
		}

		switch ( $object ) {

			/**
			 * Main Better_Disqus_Comments Class
			 */
			case 'self':
				$class = 'Better_Disqus_Comments';
				break;

			default:
				return NULL;
		}


		// Just prepare/includes files
		if ( $just_include ) {
			return;
		}

		// don't cache fresh objects
		if ( $fresh ) {
			return new $class;
		}

		self::$instances[ $object ] = new $class;

		return self::$instances[ $object ];
	}


	/**
	 * Used for accessing alive instance of Better_Disqus_Comments
	 *
	 * @since 1.0
	 *
	 * @return Better_Disqus_Comments
	 */
	public static function self() {

		return self::factory();

	}


	/**
	 * Used for retrieving options simply and safely for next versions
	 *
	 * @param $option_key
	 *
	 * @return mixed|null
	 */
	public static function get_option( $option_key ) {

		return bf_get_option( $option_key, self::$panel_id );

	}


	/**
	 *  Init the plugin
	 */
	function bf_init() {

		if ( is_admin() && ! apply_filters( 'better-disqus-comments/allow-multiple', FALSE ) ) {

			if ( $this->get_option( 'shortname' ) && function_exists( 'Better_Facebook_Comments' ) && Better_Facebook_Comments()->get_option( 'app_id' ) ) {
				Better_Framework()->admin_notices()->add_notice( array(
					'id'  => 'facebook-and-disqus-same-time',
					'msg' => __( 'You activated both <strong>Facebook Comments</strong> and <strong>Disqus Comments</strong>. Please ensure that only one comment plugin is active at a time.', 'better-studio' )
				) );
			} else {
				Better_Framework()->admin_notices()->remove_notice( 'facebook-and-disqus-same-time' );
			}
		}


		if ( apply_filters( 'better-disqus-comments/override-template', $this->get_option( 'shortname' ) != '' ) ) {
			// Change default template
			add_filter( 'comments_template', array( $this, 'custom_comments_template' ) );
		}


		if ( ! is_admin() ) {

			// Update comments link
			add_filter( 'better-studio/theme/meta/comments/link', array(
				$this,
				'better_studio_themes_comment_link'
			), 10, 2 );

			// Clear themes comments count text in meta
			add_filter( 'better-studio/themes/meta/comments/text', array(
				$this,
				'better_studio_themes_comment_text'
			) );

		}

		// Add disqus count js
		Better_Framework()->assets_manager()->add_js( " var disqus_shortname = '" . $this->get_option( 'shortname' ) . "';
            (function () {
                var s = document.createElement('script'); s.async = true;
                s.type = 'text/javascript';
                s.src = '//' + disqus_shortname + '.disqus.com/count.js';
                (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
            }());" );

		add_action( 'wp_footer', array( $this, 'wp_footer' ) );

	}


	public function get_script() {

		ob_start();
		?>
		//<script>

		(function(){
		var disqus_shortname = '<?php echo esc_attr( $this->get_option( 'shortname' ) ) ?>';


		function beforeLoad(e,$wrapper, $this) {

             var $prevEl = jQuery('#disqus_thread');

             if($prevEl.length === 0) {
                 return;
             }

            $prevEl.removeAttr('id');

            $prevEl.addClass('disqus_thread_prev');
		}

		function appendDisqusScript(e,$wrapper, res) {

		if( typeof DISQUS === 'object' && DISQUS.reset ) {

        var info = res && res.info ? res.info : {};


		jQuery(".disqus_thread_prev").each(function(){

		    var $prevEl = jQuery(this),
		        $respond = $prevEl.closest('.comments-template'),
		     $link = $respond.parent().find('.ajaxified-comments-container');

            $link.show();
			$link.children().show();

			$respond.remove();

		});

		DISQUS.reset({
		reload: true,
		config: function () {
		this.page.identifier = info.post_id;
		this.page.url = info.permalink;
		this.page.title = info.title;
		}
		});



		} else {

		var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
		dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
		(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
		}

		};

		<?php if ( $this->comments_type === 'ajaxified' ) { ?>
			jQuery(document).on("ajaxified-comments-before-load",beforeLoad)
						    .on("ajaxified-comments-loaded",appendDisqusScript);

        <?php } else { ?>
        appendDisqusScript();
		<?php }?>

		})();
		<?php

		return ob_get_clean();
	}


	public function output() {

		ob_start();
		?>
		<script><?php echo $this->get_script() ?></script>

		<?php

		return ob_get_clean();
	}


	/**
	 *  Init the plugin
	 */
	function wp_footer() {

		// Add Disqus main js file
		if ( is_singular() && ! ( is_front_page() || is_home() ) ) {

			Better_Framework()->assets_manager()->add_js( $this->get_script() );
		}

	}


	/**
	 * Finds appropriate template file and return path
	 * This make option to change template in themes
	 *
	 * @return string
	 */
	function get_template() {

		if ( is_child_theme() ) {
			// Use child theme specified template for Disqus comments
			if ( file_exists( get_stylesheet_directory() . '/better-disqus-comments.php' ) ) {
				return get_stylesheet_directory() . '/better-disqus-comments.php';
			}
		}

		// Use theme specified template for search page
		if ( file_exists( get_template_directory() . '/better-disqus-comments.php' ) ) {
			return get_template_directory() . '/better-disqus-comments.php';
		}

		return $this->dir_path( 'templates/better-disqus-comments.php' );

	}


	/**
	 * Changes WP comments template with diqus template
	 *
	 * @param string $template absolute path to comment template file
	 *
	 * @return string
	 */
	function custom_comments_template( $template ) {

		// Automatic AMP
		if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
			return $template;
		}

		// Better AMP
		if ( function_exists( 'is_better_amp' ) && is_better_amp() ) {
			return $template;
		}

		if ( ! apply_filters( 'better-disqus-comments/override-template', $this->get_option( 'shortname' ) != '' ) ) {
			return $template;
		}

		$is_ajaxified = basename( $template ) === 'comments-ajaxified.php';

		$this->comments_type = $is_ajaxified ? 'ajaxified' : 'plain';
		if ( $is_ajaxified ) {
			return $template;
		}

		return $this->get_template();

	}


	/**
	 * Callback: Used to clear themes meta text to better style in front-end
	 *
	 * Filter: better-studio/themes/meta/comments/text
	 *
	 * @param $text
	 *
	 * @return string
	 */
	function better_studio_themes_comment_text( $text ) {

		if ( apply_filters( 'better-disqus-comments/disable-aggregate', FALSE ) ) {
			return $text;
		}

		if ( is_single( get_the_ID() ) && is_main_query() && ! apply_filters( 'better-disqus-comments/allow-multiple', TRUE ) ) {
			return $text;
		} else {
			return '';
		}

	}


	/**
	 * Callback: Used to change themes meta link to support disqus count
	 *
	 * Filter: better-studio/themes/meta/comments/link
	 *
	 * @param $link string
	 *
	 * @return string
	 */
	function better_studio_themes_comment_link( $link ) {

		if ( apply_filters( 'better-disqus-comments/disable-aggregate', FALSE ) ) {
			return $link;
		}

		if ( is_single( get_the_ID() ) && is_main_query() && apply_filters( 'better-disqus-comments/allow-multiple', FALSE ) ) {
			return $link;
		} else {
			return get_permalink() . '#disqus_thread';
		}

	}

}
templates/better-disqus-comments.php000064400000000755151213254270013702 0ustar00<?php

/**
 * Custom Template For Better Disqus Comments Plugin
 *
 * Copy this to your site theme and make it more compatible with your site layout
 */

?>

<div id="comments" class="better-comments-area better-disqus-comments-area">

	<div id="disqus_thread" data-post-id="<?php the_ID() ?>"></div>

	<noscript><?php _e( 'Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>', 'better-studio' ); ?></noscript>

</div>includes/options/panel-config.php000064400000003624151213254270013127 0ustar00<?php

// Language  name for smart admin texts
$lang = bf_get_current_lang_raw();
if ( $lang != 'none' ) {
	$lang = bf_get_language_name( $lang );
} else {
	$lang = '';
}

$panel = array(
	'config'     => array(
		'parent'              => 'better-studio',
		'slug'                => 'better-studio/better-disqus-comments',
		'name'                => __( 'Better Disqus Comments', 'better-studio' ),
		'page_title'          => __( 'Better Disqus Comments', 'better-studio' ),
		'menu_title'          => __( 'Disqus Comments', 'better-studio' ),
		'capability'          => 'manage_options',
		'icon_url'            => NULL,
		'position'            => 80.07,
		'exclude_from_export' => FALSE,
	),
	'texts'      => array(

		'panel-desc-lang'     => '<p>' . __( '%s Language Options.', 'better-studio' ) . '</p>',
		'panel-desc-lang-all' => '<p>' . __( 'All Languages Options.', 'better-studio' ) . '</p>',

		'reset-button'     => ! empty( $lang ) ? sprintf( __( 'Reset %s Options', 'better-studio' ), $lang ) : __( 'Reset Options', 'better-studio' ),
		'reset-button-all' => __( 'Reset All Options', 'better-studio' ),

		'reset-confirm'     => ! empty( $lang ) ? sprintf( __( 'Are you sure to reset %s options?', 'better-studio' ), $lang ) : __( 'Are you sure to reset options?', 'better-studio' ),
		'reset-confirm-all' => __( 'Are you sure to reset all options?', 'better-studio' ),

		'save-button'     => ! empty( $lang ) ? sprintf( __( 'Save %s Options', 'better-studio' ), $lang ) : __( 'Save Options', 'better-studio' ),
		'save-button-all' => __( 'Save All Options', 'better-studio' ),

		'save-confirm-all' => __( 'Are you sure to save all options? this will override specified options per languages', 'better-studio' )

	),
	'panel-name' => _x( 'Better Disqus Comments', 'Panel title', 'better-studio' ),
	'panel-desc' => '<p>' . __( 'Take advantage of integrating Disqus comments on your website.', 'better-studio' ) . '</p>',
);
includes/options/panel.php000064400000003773151213254270011671 0ustar00<?php

add_filter( 'better-framework/panel/add', 'better_disqus_comments_panel_add', 10 );

if ( ! function_exists( 'better_disqus_comments_panel_add' ) ) {
	/**
	 * Callback: Ads panel
	 *
	 * Filter: better-framework/panel/options
	 *
	 * @param $panels
	 *
	 * @return array
	 */
	function better_disqus_comments_panel_add( $panels ) {

		$panels['better_disqus_comments'] = array(
			'id' => 'better_disqus_comments',
		);

		return $panels;
	}
}


add_filter( 'better-framework/panel/better_disqus_comments/config', 'better_disqus_comments_panel_config', 10 );

if ( ! function_exists( 'better_disqus_comments_panel_config' ) ) {
	/**
	 * Callback: Init's BF options
	 *
	 * @param $panel
	 *
	 * @return array
	 */
	function better_disqus_comments_panel_config( $panel ) {

		include Better_Disqus_Comments::dir_path( 'includes/options/panel-config.php' );

		return $panel;
	} // better_disqus_comments_panel_config
}


add_filter( 'better-framework/panel/better_disqus_comments/std', 'better_disqus_comments_panel_std', 10 );

if ( ! function_exists( 'better_disqus_comments_panel_std' ) ) {
	/**
	 * Callback: Init's BF options
	 *
	 * Filter: better-framework/panel/options
	 *
	 * @param $fields
	 *
	 * @return array
	 */
	function better_disqus_comments_panel_std( $fields ) {

		$field['shortname'] = array(
			'std' => '',
		);

		return $fields;
	}
}


add_filter( 'better-framework/panel/better_disqus_comments/fields', 'better_disqus_comments_panel_fields', 10 );

if ( ! function_exists( 'better_disqus_comments_panel_fields' ) ) {
	/**
	 * Callback: Init's BF options
	 *
	 * Filter: better-framework/panel/options
	 *
	 * @param $fields
	 *
	 * @return array
	 */
	function better_disqus_comments_panel_fields( $fields ) {

		$fields['shortname'] = array(
			'name' => __( 'Site Shortname', 'better-studio' ),
			'id'   => 'shortname',
			'desc' => __( 'Enter the shortname for your website. This is generated in your Disqus account.', 'better-studio' ),
			'type' => 'text',
			'std'  => '',
		);

		return $fields;
	}
}

F1le Man4ger