• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
    • Help
      • Online help
      • Learn Git
      • Welcome to Bitbucket
      • Keyboard shortcuts
    • Log In
    Blackrock
    1. Blackrock

    main

    Public
    Actions
    • Clone

    Learn more about cloning repositories

    You have read-only access

    Navigation
    • Source
    • Commits
    • Branches
    • All Branches Graph
    • Graphs
    • Forks
    1. Blackrock
    2. main

    Source

    main/wp-content/plugins/wpml-translation-management/classes/user/Hooks.php
    Артем ШиряевАртем Ширяев committed 554847ddcb906 Apr 2021
    Raw file
    Source viewDiff to previous
    ​x
     
    1
    <?php
    2
    ​
    3
    namespace WPML\TM\User;
    4
    ​
    5
    class Hooks implements \IWPML_Backend_Action {
    6
    ​
    7
        public function add_hooks() {
    8
            add_action( 'clean_user_cache', [ $this, 'cleanUserCacheAction' ] );
    9
            add_action( 'updated_user_meta', [ $this, 'updatedUserMetaAction' ] );
    10
    ​
    11
            add_filter( 'wpml_show_hidden_languages_options', [ $this, 'filter_show_hidden_languages_options' ] );
    12
        }
    13
    ​
    14
        public function cleanUserCacheAction() {
    15
            $this->flushCache();
    16
        }
    17
    ​
    18
        public function updatedUserMetaAction() {
    19
            $this->flushCache();
    20
        }
    21
    ​
    22
        public function filter_show_hidden_languages_options( $show_hidden_languages_options ) {
    23
            if (
    24
                current_user_can( \WPML_Manage_Translations_Role::CAPABILITY )
    25
                || current_user_can( \WPML_Translator_Role::CAPABILITY )
    26
            ) {
    27
                return true;
    28
            }
    29
    ​
    30
            return $show_hidden_languages_options;
    31
        }
    32
    ​
    33
        private function flushCache() {
    34
            wpml_get_cache( \WPML_Translation_Roles_Records::CACHE_GROUP )->flush_group_cache();
    35
        }
    36
    }
    • Git repository management for enterprise teams powered by Atlassian Bitbucket
    • Atlassian Bitbucket v5.10.1
    • Documentation
    • Contact Support
    • Request a feature
    • About
    • Contact Atlassian
    Atlassian

    Everything looks good. Well let you know here if theres anything you should know about.