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 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
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. |
<?php /** * Backward compatibility functions. * * @package ContentControl */ namespace ContentControl; defined( 'ABSPATH' ) || exit; /** * Get v1 restrictions from wp_options. * * @return array<string,string|bool|int|array<mixed>>[]|false */ function get_v1_restrictions() { $settings = \get_option( 'jp_cc_settings', [] ); if ( ! isset( $settings['restrictions'] ) || empty( $settings['restrictions'] ) ) { return false; } return $settings['restrictions']; } /** * Remap old conditions to new rules. * * @param array<array<string,mixed>> $old_conditions Array of old conditions. * * @return array{logicalOperator:string,items:array<array<string,mixed>>} */ function remap_conditions_to_query( $old_conditions ) { $query = [ 'logicalOperator' => 'and', 'items' => [], ]; // Old conditions were in a group[rules[]] format. foreach ( $old_conditions as $conditions ) { $group = [ 'id' => uniqid(), 'type' => 'group', 'query' => [ 'logicalOperator' => 'or', 'items' => [], ], ]; // Loop over all old condtions in this group and map them to new rules. foreach ( $conditions as $condition ) { $group['query']['items'][] = remap_condition_to_rule( $condition ); } $query['items'][] = $group; } return $query; } /** * Remap old condition to new rule. * * @param array<string,mixed> $condition Old condition. * * @return array<string,mixed> */ function remap_condition_to_rule( $condition ) { $target = $condition['target']; // Handles 95% of the work except the name remap. $rule = [ 'id' => uniqid(), 'type' => 'rule', // custom rules will pass through. 'name' => $target, 'notOperand' => isset( $condition['not_operand'] ) && $condition['not_operand'] ? true : false, 'options' => isset( $condition['settings'] ) && is_array( $condition['settings'] ) ? $condition['settings'] : [], ]; // Start from simplest to match to most complex. if ( 'is_front_page' === $target ) { $rule['name'] = 'content_is_front_page'; } elseif ( 'is_home' === $target ) { $rule['name'] = 'content_is_blog_index'; } elseif ( 'is_search' === $target ) { $rule['name'] = 'content_is_search_results'; } elseif ( 'is_404' === $target ) { $rule['name'] = 'content_is_404_page'; } elseif ( strpos( $target, 'tax_' ) === 0 ) { // Split the target into post type and modifier. $tax_target = explode( '_', $target ); // Remove the tax_ prefix. array_shift( $tax_target ); // Modifier should be the last key. $modifier = array_pop( $tax_target ); // Post type is the remaining keys combined. $taxnomy = implode( '_', $tax_target ); // Using a switch for readability. switch ( $modifier ) { case 'all': $rule['name'] = "content_is_{$taxnomy}_archive"; break; case 'selected': $rule['name'] = "content_is_selected_tax_{$taxnomy}"; break; case 'ID': $rule['name'] = "content_is_tax_{$taxnomy}_with_id"; break; } } elseif ( strpos( $target, '_w_' ) > 0 ) { $pt_target = explode( '_w_', $target ); // First key is the post type. $post_type = array_shift( $pt_target ); // Last Key is the taxonomy. $taxonomy = array_pop( $pt_target ); $rule['name'] = "content_is_{$post_type}_with_{$taxonomy}"; } else { // Split the target into post type and modifier. $pt_target = explode( '_', $target ); // Modifier should be the last key. $modifier = array_pop( $pt_target ); // Post type is the remaining keys combined. $post_type = implode( '_', $pt_target ); if ( post_type_exists( $post_type ) && ! empty( $modifier ) ) { switch ( $modifier ) { case 'index': $rule['name'] = "content_is_{$post_type}_archive"; break; case 'all': $rule['name'] = "content_is_{$post_type}"; break; case 'selected': $rule['name'] = "content_is_selected_{$post_type}"; break; case 'ID': $rule['name'] = "content_is_{$post_type}_with_id"; break; case 'children': $rule['name'] = "content_is_child_of_{$post_type}"; break; case 'ancestors': $rule['name'] = "content_is_ancestor_of_{$post_type}"; break; case 'template': $rule['name'] = "content_is_{$post_type}_with_template"; break; } } } return $rule; }
SILENT KILLER Tool