[MMO] Hide Bb-Code Content System

xF2 Add-on [MMO] Hide Bb-Code Content System 2.2.8

No permission to download
Add support math functions ceil and floor
Fix Grammar mistakes
Refactoring add-on
Change permission group for ignoring all content
Now for a specific forum node, you can select permissions or a group to ignore the option in the forum node
If the user is now a moderator of only a certain node and he has the right to edit or delete messages, then now he will not see the hide in other nodes
Delete duplicate code
Rename permissions
bb codes for reactions or groups in the modal window are now again displayed in 2 columns
On new installations of the add-on, the permission to use the tag will be enabled by default
Using Data container object for hide tags
Update callback in code event
Add new option: Hide Expiration Enable. This setting allows you to specify how long a hide "expires" and becomes available to all users. Ignoring tags: 'club', 'groups', 'users', 'usersid', 'usersexc', 'usersidexc'
In the future, it may be possible to add the ability to set permissions to use the tag in nodes
Min version Core Lib 2.2.5
Delete option: "The hide tag will work as a reply tag" added in 2.2.0
Add new option to match the tag of a hide with another
Hide tag completely redesigned. Now if the user specifies an option for the tag that starts and ends with (). For example [HIDE=(option)], will now handle conditions. If the user has not specified options and the tag does not match other tags, then it will work as before for output to registered users.
Tag [HIDE] is used for hidden content. If [HIDE=(condition)] is specified, the condition will be applied to the hidden content. Note: After the = sign, you must enclose the conditions in parentheses to indicate the start and end of condition processing. Inside, you can use any condition grouping.
Allowed expressions (tags):
  • posts: Number of user posts.
  • likes: User reaction count.
  • reactions: User reaction count (same as likes).
  • trophies: Number of user trophies.
  • days: Number of days since user registration.
  • isMemberOf(id): User group, for multiple groups you can use comma-separated values.
  • username: User's username.
  • user_id: User's identifier.
  • user_state: User's state.
  • is_staff: Flag indicating whether the user is a staff member.
  • is_admin: Flag indicating whether the user is an administrator.
  • is_moderator: Flag indicating whether the user is a moderator.
Allowed operators:
  • Arithmetic operators:
    Arithmetic operators are used for performing mathematical calculations:
    • +
    • -
    • *
    • /
    • % (modulus)
    • ** (exponentiation)
  • Comparison operators:
    Comparison operators are used for comparing values and returning a boolean result:
    • == (equal to)
    • === (strictly equal to)
    • != (not equal to)
    • !== (strictly not equal to)
    • < (less than)
    • > (greater than)
    • <= (less than or equal to)
    • >= (greater than or equal to)
  • Logical operators:
    Logical operators are used for performing logical operations and returning a boolean result:
    • and or && (logical AND)
    • or or || (logical OR)
    • not or ! (logical NOT)
  • Bitwise operators:
    Bitwise operators are performed on binary representations of numbers:
    • & (bitwise AND)
    • | (bitwise OR)
    • ^ (bitwise XOR)
  • String operators:
    The ~ operator is used for string concatenation:
    • ~ (string concatenation)
  • Array operators:
    Array operators are used for checking element membership in an array:
    • in (element present in array)
    • not in (element not present in array)
  • Numeric operators:
    The .. operator is used to create a range of numbers:
    • .. (number range)
  • Ternary operator:
    The ?: operator is used to perform conditional operations in a single line:
    • ?: (ternary operator)
Examples:
[HIDE]Hello World![/HIDE] - only registered users see the hidden text
[HIDE=(posts > 1 or likes > 1)]Hello world![/HIDE] - The hidden text "Hello world!" will be displayed if the number of user posts is greater than 1 OR the number of likes is greater than 1.
[HIDE=(posts > 1 and likes > 1)]Hello world![/HIDE] - The hidden text "Hello world!" will be displayed if the number of user posts is greater than 1 AND the number of likes is greater than 1.
[HIDE=(days > 1 or user_state == "valid")]Hello World![/HIDE] - The hidden text "Hello World!" will be displayed if the number of days since user registration is greater than 1 OR the user state is "valid".
[HIDE=(isMemberOf(2) or trophies >= 0)]Hello World![/HIDE] - The hidden text "Hello World!" will be displayed if the user is a member of group 2 OR the number of user trophies is greater than or equal to 0.
[HIDE=(is_staff)]Hello World![/HIDE] - The hidden text "Hello World!" will be displayed if the user is a staff member.

Security and how safe is the use of such a wide range? Yes, it is completely safe, and for expression interpretation, the addon does not use eval.
This is important from a security perspective because the use of eval() can pose a risk, especially if the input data is not properly validated. The eval() function allows for the execution of arbitrary code, including potentially dangerous operations, and can be used for injecting malicious code or performing unwanted operations.
So how does it work then if eval() is not used?
When an expression is passed, it is first parsed into tokens such as identifiers, operators, numbers, and strings. Then, the expression is analyzed using grammar and syntax rules.
The analyzer constructs a syntax tree (AST) that represents the structure of the expression.
After the AST is built, the expression is interpreted by traversing the AST and executing the corresponding operations and functions defined in the context.
This approach, based on parsing and interpreting expressions using a context, provides safe execution of expressions as it does not require the use of the eval() function and allows for control over available operations and functions, minimizing potential vulnerabilities.
Selecting text in the editor and selecting a hide now inserts text into the modal without having to type it again
Add option for disable dialog for hide. If the hide has an option, by default a value of one will be inserted into the editor.
Add new permissions for ignoring tag content conditions, if less by group
Added a setting that does not allow you to specify a value in tags greater than that of the author
Min ver [MMO] Core Lib 2.2.4
  • Like
Reactions: Darkness
Min [MMO] Core Library 2.2.3
Added style settings for the required amount and what the user currently has
Update plural phrases
When using a tag in the resource manager that requires a response from the user, if a thread is created for this resource, it is now supported in the resource manager.
  • Like
Reactions: ritikraj
Added support for event after showing popup
Refactoring add-on
For the add-on to work, the add-on is required [MMO] Core Library
Declension is now used for tags
Add new style properties
Updated design
Fixed a bug if you turn off the receipt of the caching list of reactions when using the preview
Force global namespace for functions which are known to be optimizable to bytecode in php, or known global functions to avoid a current namespace lookup for the function.
  • Like
Reactions: milenko1983
Add option 'Use caching field reactions on tag thanks?'
Minimum version XF 2.2.0
Add new option: The hide tag will work as a reply tag
  • Like
Reactions: ritikraj
Drop support XF 2.1
Support XF 2.2
Support for new XF 2.2 features
Disallow the use of the tag in the signature [thanks]
When the user clicks the reaction and the message contains a tag code or something, the tag stopped being processed.
Added event mh_hide_auth_tag_codes if you need to display information that the guest needs to log in or register to view hidden content
Can select all reactions in dialog
Added a style property that allows you to hide the title from hidden content which is able to view
Change phrases
Minor changes in tags