Пример #1
0
 /**
  * Retrieves APM pointers for the current admin screen. Use the 'apm_admin_pointers' hook to add your own pointers.
  * @return array Current screen APM pointers
  */
 private static function get_current_screen_apm_pointers()
 {
     $pointers = '';
     $screen = get_current_screen();
     $screen_id = $screen->id;
     $default_pointers = self::get_default_pointers();
     if (array_key_exists($screen_id, $default_pointers)) {
         $pointers = $default_pointers[$screen_id];
     }
     if (!empty($pointers)) {
         foreach ($pointers as $pointer_id => $pointer) {
             if (!empty($pointer['context']) && $pointer['context'] == 'apm_fresh_install') {
                 //Retrieve APM user tree state meta data to know if he already used APM :
                 if (ApmTreeState::current_user_has_tree_state()) {
                     //APM tree state not empty >> this is not a fresh APM install >> don't display pointer :
                     unset($pointers[$pointer_id]);
                 }
             }
         }
     }
     $pointers = apply_filters('apm_admin_pointers', $pointers, $screen_id);
     return $pointers;
 }
Пример #2
0
 /**
  * Debug function : to display tree nodes fold/unfold states
  */
 public static function get_tree_state()
 {
     $tree_state = new ApmTreeState();
     $tree_state->load();
     return $tree_state->get_tree_state();
 }
Пример #3
0
 public function get_visible_nodes_number()
 {
     return count($this->apm_tree->get_visible_nodes(self::root_id, $this->tree_state->get_unfolded_nodes()));
 }