HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.34
System: Linux atalantini.com 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23 15:46:38 UTC 2020 x86_64
User: root (0)
PHP: 7.2.34
Disabled: NONE
Upload Files
File: //opt/plugins/cbxwpbookmark/includes/cbxwpbookmark-functions.php
<?php

	/**
	 * The file that defines the cutom fucntions of the plugin
	 *
	 *
	 *
	 * @link       codeboxr.com
	 * @since      1.4.6
	 *
	 * @package    Cbxwpbookmark
	 * @subpackage Cbxwpbookmark/includes
	 */

	if ( ! function_exists( 'cbxwpbookmark_object_types' ) ) {

		/**
		 * Return post types list, if plain is true then send as plain array , else array as post type groups
		 *
		 * @param bool|false $plain
		 *
		 * @return array
		 */
		function cbxwpbookmark_object_types( $plain = false ) {
			return CBXWPBookmarkHelper::post_types( $plain );
		}//end cbxwpbookmark_object_types
	}


	if ( ! function_exists( 'show_cbxbookmark_btn' ) ):

		/**
		 * Returns bookmark button html markup
		 *
		 * @param int    $object_id        post id
		 * @param null   $object_type      post type
		 * @param int    $show_count       if show bookmark counts
		 * @param string $extra_wrap_class style css class
		 * @param string $skip_ids         post ids to skip
		 * @param string $skip_roles       user roles
		 *
		 * @return string
		 */
		function show_cbxbookmark_btn( $object_id = 0, $object_type = null, $show_count = 1, $extra_wrap_class = '', $skip_ids = '', $skip_roles = '' ) {
			return CBXWPBookmarkHelper::show_cbxbookmark_btn( $object_id, $object_type, $show_count, $extra_wrap_class, $skip_ids, $skip_roles );
		}
	endif;


	if ( ! function_exists( 'cbxbookmarkmypost_html' ) ) {
		/**
		 * Returns bookmarks as per $instance attribues
		 *
		 * @param array $instance
		 * @param bool  $echo
		 *
		 * @return false|string
		 */
		function cbxbookmarkmypost_html( $instance, $echo = false ) {
			$output = CBXWPBookmarkHelper::cbxbookmarkmypost_html( $instance );

			if ( $echo ) {
				echo '<ul class="cbxwpbookmark-mylist">' . $output . '</ul>';
			} else {
				return $output;
			}
		}//end function cbxbookmarkmypost_html
	}


	if ( ! function_exists( 'cbxbookmarkmycat_html' ) ) {
		/**
		 * Return users bookmark categories
		 *
		 * @param array $instance
		 * @param bool  $echo
		 *
		 * @return false|string
		 */
		function cbxbookmarkmycat_html( $instance, $echo = false ) {

			$settings_api  = new CBXWPBookmark_Settings_API();
			$bookmark_mode = $settings_api->get_option( 'bookmark_mode', 'cbxwpbookmark_basics', 'user_cat' );

			if ( $bookmark_mode == 'user_cat' || $bookmark_mode == 'global_cat' ) {
				$output = CBXWPBookmarkHelper::cbxbookmarkmycat_html( $instance );
			} else {
				$output = '<li>' . __( '<strong>Sorry, User categories or global categories can not be shown if bookmark mode is not "No Category"', 'cbxwpbookmark' ) . '</strong></li>';
			}

			if ( $echo ) {
				echo '<ul class="cbxbookmark-category-list cbxbookmark-category-list-' . $bookmark_mode . '">' . $output . '</ul>';
			} else {
				return $output;
			}
		}//end function  cbxbookmarkmycat_html
	}

	if ( ! function_exists( 'cbxbookmarkmost_html' ) ) {
		/**
		 * Returns most bookmarked posts
		 *
		 * @param array $instance
		 * @param array $attr
		 * @param bool  $echo
		 *
		 * @return false|string
		 */
		function cbxbookmarkmost_html( $instance, $attr = array(), $echo = false ) {
			$output = CBXWPBookmarkHelper::cbxbookmarkmost_html( $instance, $attr );

			if ( $echo ) {
				echo $output;
			} else {
				return $output;
			}
		}//end cbxbookmarkmost_html
	}//end exists cbxbookmarkmost_html


	if ( ! function_exists( 'get_author_cbxwpbookmarks_url' ) ) {
		function get_author_cbxwpbookmarks_url( $author_id = 0 ) {
			return CBXWPBookmarkHelper::get_author_cbxwpbookmarks_url( $author_id );
		}

	}//end exists get_author_cbxwpbookmarks_url

	if ( ! function_exists( 'cbxwpbookmarks_mybookmark_page_url' ) ) {
		/**
		 * Get mybookmark page url
		 *
		 * @return false|string
		 */
		function cbxwpbookmarks_mybookmark_page_url() {
			return CBXWPBookmarkHelper::cbxwpbookmarks_mybookmark_page_url();
		}//end cbxwpbookmarks_mybookmark_page_url
	}//end exists cbxwpbookmarks_mybookmark_page_url

	/**
	 * Get the template path.
	 *
	 * @return string
	 */
	function cbxwpbookmark_template_path() {
		return apply_filters( 'cbxwpbookmark_template_path', 'cbxwpbookmark/' );
	}//end cbxwpbookmark_template_path

	/**
	 * Locate a template and return the path for inclusion.
	 *
	 * This is the load order:
	 *
	 * yourtheme/$template_path/$template_name
	 * yourtheme/$template_name
	 * $default_path/$template_name
	 *
	 * @param string $template_name Template name.
	 * @param string $template_path Template path. (default: '').
	 * @param string $default_path  Default path. (default: '').
	 *
	 * @return string
	 */
	function cbxwpbookmark_locate_template( $template_name, $template_path = '', $default_path = '' ) {
		if ( ! $template_path ) {
			$template_path = cbxwpbookmark_template_path();
		}

		if ( ! $default_path ) {
			$default_path = CBXWPBOOKMARK_ROOT_PATH . 'templates/';
		}

		// Look within passed path within the theme - this is priority.
		$template = locate_template(
			array(
				trailingslashit( $template_path ) . $template_name,
				$template_name,
			)
		);

		// Get default template/.
		if ( ! $template ) {
			$template = $default_path . $template_name;
		}

		// Return what we found.
		return apply_filters( 'cbxwpbookmark_locate_template', $template, $template_name, $template_path );
	}//end function cbxwpbookmark_locate_template

	/**
	 * Like wc_get_template, but returns the HTML instead of outputting.
	 *
	 * @param string $template_name Template name.
	 * @param array  $args          Arguments. (default: array).
	 * @param string $template_path Template path. (default: '').
	 * @param string $default_path  Default path. (default: '').
	 *
	 * @return string
	 * @since 2.5.0
	 *
	 * @see   wc_get_template
	 */
	function cbxwpbookmark_get_template_html( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
		ob_start();
		cbxwpbookmark_get_template( $template_name, $args, $template_path, $default_path );

		return ob_get_clean();
	}//end function cbxwpbookmark_get_template_html

	/**
	 * Get other templates (e.g. product attributes) passing attributes and including the file.
	 *
	 * @param string $template_name Template name.
	 * @param array  $args          Arguments. (default: array).
	 * @param string $template_path Template path. (default: '').
	 * @param string $default_path  Default path. (default: '').
	 */
	function cbxwpbookmark_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
		if ( ! empty( $args ) && is_array( $args ) ) {
			extract( $args ); // @codingStandardsIgnoreLine
		}

		$located = cbxwpbookmark_locate_template( $template_name, $template_path, $default_path );

		if ( ! file_exists( $located ) ) {
			/* translators: %s template */
			wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%s does not exist.', 'cbxwpbookmark' ), '<code>' . $located . '</code>' ), '1.0.0' );

			return;
		}

		// Allow 3rd party plugin filter template file from their plugin.
		$located = apply_filters( 'cbxwpbookmark_get_template', $located, $template_name, $args, $template_path, $default_path );

		do_action( 'cbxwpbookmark_before_template_part', $template_name, $template_path, $located, $args );

		include $located;

		do_action( 'cbxwpbookmark_after_template_part', $template_name, $template_path, $located, $args );
	}//end function cbxwpbookmark_get_template