SILENT KILLERPanel

Current Path: > home > codekrsu > > ameliagraphics.com > wp-content > plugins > content-control > > inc > functions


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//ameliagraphics.com/wp-content/plugins/content-control//inc/functions

NameTypeSizeLast ModifiedActions
back-compat.php File 4300 bytes October 01 2023 13:39:02.
compatibility.php File 6294 bytes June 21 2024 13:00:36.
content.php File 3218 bytes October 26 2023 13:40:28.
developers.php File 10976 bytes June 21 2024 13:00:36.
globals.php File 1889 bytes June 21 2024 13:00:36.
install.php File 2216 bytes March 11 2025 14:19:36.
options.php File 4105 bytes August 18 2024 09:36:48.
post-restrictions.php File 900 bytes June 21 2024 13:00:36.
protections.php File 2250 bytes September 18 2023 05:47:10.
query.php File 13898 bytes March 15 2025 12:03:42.
restrictions.php File 6168 bytes June 21 2024 13:00:36.
rule-callbacks.php File 20563 bytes May 09 2025 02:30:24.
rules.php File 2539 bytes May 09 2025 02:30:24.
term-restrictions.php File 905 bytes June 21 2024 13:00:36.
upgrades.php File 4835 bytes December 08 2023 15:26:30.
utils.php File 584 bytes March 18 2024 03:33:26.
widgets.php File 1454 bytes December 08 2023 15:26:30.

Reading File: /home/codekrsu//ameliagraphics.com/wp-content/plugins/content-control//inc/functions/rules.php

<?php
/**
 * Rule callback functions.
 *
 * @package ContentControl
 */

namespace ContentControl\Rules;

use ContentControl\Models\RuleEngine\Rule;
use function ContentControl\plugin;

defined( 'ABSPATH' ) || exit;

/**
 * Get or set the current rule (globaly accessible).
 *
 * @param Rule|null|false $rule Rule object.
 * @return Rule|null
 */
function current_rule( $rule = false ) {
	return plugin( 'rules' )->current_rule( $rule );
}

/**
 * Get the current rule ID.
 *
 * @return string
 */
function get_rule_id() {
	$rule = current_rule();

	return $rule ? $rule->id : '';
}

/**
 * Get the current rule name.
 *
 * @return string
 */
function get_rule_name() {
	$rule = current_rule();

	return $rule ? $rule->name : '';
}

/**
 * Get the current rule options.
 *
 * @param array<string,mixed> $defaults Default options.
 *
 * @return array<string,mixed>
 */
function get_rule_options( $defaults = [] ) {
	$rule = current_rule();

	$options = $rule ? $rule->options : [];

	return wp_parse_args( $options, $defaults );
}

/**
 * Get the current rule extras.
 *
 * @return array<string,mixed>
 */
function get_rule_extras() {
	$rule = current_rule();

	return $rule ? $rule->extras : [];
}

/**
 * Get the current rule option.
 *
 * @param string $key Option key.
 * @param mixed  $default_value Default value.
 * @return mixed
 */
function get_rule_option( $key, $default_value = false ) {
	$options = get_rule_options();

	return isset( $options[ $key ] ) ? $options[ $key ] : $default_value;
}

/**
 * Get the current rule extra.
 *
 * @param string $key Extra key.
 * @param mixed  $default_value Default value.
 * @return mixed
 */
function get_rule_extra( $key, $default_value = false ) {
	$extras = get_rule_extras();

	return isset( $extras[ $key ] ) ? $extras[ $key ] : $default_value;
}

/**
 * Gets a filterable array of the allowed user roles.
 *
 * @return array|mixed
 */
function allowed_user_roles() {
	static $roles;

	if ( ! isset( $roles ) ) {
		/**
		 * Filter the allowed user roles.
		 *
		 * @param array $roles
		 *
		 * @return array
		 */
		$roles = (array) apply_filters( 'content_control/user_roles', wp_roles()->get_names() );

		if ( empty( $roles ) ) {
			$roles = [];
		}
	}

	return $roles;
}

/**
 * Checks if the current post is a post type.
 *
 * @param string $post_type Post type slug.
 * @return boolean
 */
function is_post_type( $post_type ) {
	global $post;

	if ( ! is_a( $post, '\WP_Post' ) ) {
		return false;
	}

	return is_singular( $post_type ) || $post->post_type === $post_type;
}

SILENT KILLER Tool