) ->joinLeft( ['c' => Db_Table_Broker::get('clients')->info(Db_Table_Broker_Clients::NAME)], 'd.cl_id = c.id', []) ->where('c.type = ?', $type) ->order('d.displayName'); return $this->fetchAll($select); } /** * @param int $certificateId * @return Db_Table_Rowset */ public function getDomainsByCertificateId($certificateId) { $select = $this->select() ->setIntegrityCheck(false) ->from(['d' => $this->_name]) ->joinLeft( ['h' => 'hosting'], 'd.id = h.dom_id', null ) ->joinLeft( ['f' => 'forwarding'], 'd.id = f.dom_id', null ) ->where('h.certificate_id = ?', $certificateId) ->orWhere('f.certificate_id = ?', $certificateId); return $this->fetchAll($select); } /** * @param int $certificateId * @return Db_Table_Rowset */ public function getMailDomainsByCertificateId($certificateId) { $select = $this->select() ->setIntegrityCheck(false) ->from(['d' => $this->_name]) ->join( ['dp' => 'dom_param'], "d.id = dp.dom_id AND dp.param = 'webmail_certificate_id'", null )->where('dp.val = ?', $certificateId); return $this->fetchAll($select); } /** * @param $clientId * @param $limit * @return Db_Table_Rowset */ public function getLastVisitWebspacesForClient($clientId, $limit) { $select = $this->select() ->setIntegrityCheck(false) ->from(['d' => $this->_name]) ->joinLeft(['dp' => 'dom_param'], "d.id = dp.dom_id AND dp.param = 'lastVisitTime'", ['lastVisitTime' => 'dp.val']) ->where('d.cl_id = ?', (int)$clientId) ->where('d.webspace_id = ?', 0) ->order('lastVisitTime DESC') ->limit((int)$limit); return $this->fetchAll($select); } public function getCurrentUserMainDomains(\Plesk\Session\Context $session): Db_Table_Rowset { $select = $this->select() ->setIntegrityCheck(false) ->from($this->getTableName()); $select = $this->currentUserMainDomainsParameters($select, $session); return $this->fetchAll($select); } public function countCurrentUserMainDomains(\Plesk\Session\Context $session): int { $select = (new \Zend_Db_Table_Select($this)) ->setIntegrityCheck(false) ->from($this->getTableName(), ['c' => 'COUNT(*)']); $select = $this->currentUserMainDomainsParameters($select, $session); return (int)$select->query(\Zend_db::FETCH_NUM)->fetchColumn(); } /** * @param int $ipId * @param string $cols * @return Db_Table_Rowset */ public function getDomainsByIpId($ipId, $cols = '*') { $select = $this->select() ->setIntegrityCheck(false) ->distinct() ->from(['d' => $this->_name], $cols) ->joinInner( ['ds' => 'DomainServices'], 'd.id = ds.dom_id', null ) ->joinInner( ['ipc' => 'IpAddressesCollections'], 'ipc.ipCollectionId = ds.ipCollectionId', null ) ->where('ipc.ipAddressId = ?', $ipId); return $this->fetchAll($select); } /** * Return primary domain of subscription by system user id * * @param $id * * @return null|Db_Table_Row_Domain */ public function getSubscriptionDomainBySysUserId($id) { $select = $this->select() ->setIntegrityCheck(false) ->from(['d' => $this->_name]) ->joinInner(['s' => 'Subscriptions'], 's.object_id = d.id', null) ->joinInner(['h' => 'hosting'], 'h.dom_id = d.id',is changed. * * @param int $old_post_id The old post id. * @param int $new_post_id The new post id. */ public function disable_timestamp_for_previous_legal_page( $old_post_id, $new_post_id ) { if ( $old_post_id !== $new_post_id ) { \delete_post_meta( $old_post_id, '_yoast_wpseo_wordproof_timestamp' ); } } /** * Return the Yoast post meta key for the SDK to determine if the post should be timestamped. * * @param array $meta_keys The array containing meta keys that should be used. * @return array */ public function add_post_meta_key( $meta_keys ) { return [ $this->post_meta_key ]; } /** * Return an empty array to disable automatically timestamping selected post types. * * @param array $post_types The array containing post types that should be automatically timestamped. * @return array */ public function wordproof_timestamp_post_types( $post_types ) { return []; } /** * This filters hides the certificate if the Yoast post meta key is not set to true. * * @param bool $value If the certificate should be shown. * @param WP_Post $post The post object of the post for which to determine the certificate should be shown. * @return bool|null */ public function show_certificate( $value, $post ) { if ( ! $value ) { return $value; } if ( ! $this->wordproof->integration_is_active() ) { return false; } return \boolval( PostMetaHelper::get( $post->ID, $this->post_meta_key ) ); } /** * Adds the WordProof integration toggle to the array. * * @param array $fields The currently registered meta fields. * * @return array A new array with meta fields. */ public function add_meta_field( $fields ) { $fields['advanced']['wordproof_timestamp'] = [ 'type' => 'hidden', 'title' => '', 'default_value' => '', 'description' => '0', ]; return $fields; } /** * Enqueue the uikit script. * * @return void */ public function enqueue_assets() { if ( CertificateHelper::show() ) { $flat_version = $this->asset_manager->flatten_version( \WPSEO_VERSION ); /** * We are using the Admin asset manager to register and enqueue a file served for all visitors, * authenticated and unauthenticated users. */ $script = new WPSEO_Admin_Asset( [ 'name' => 'wordproof-uikit', 'src' => 'wordproof-uikit.js', 'version' => $flat_version, ] ); $this->asset_manager->register_script( $script ); $this->asset_manager->enqueue_script( 'wordproof-uikit' ); } } /** * Adds async to the wordproof-uikit script. * * @param string $tag The script tag for the enqueued script. * @param string $handle The script's registered handle. * @param string $src The script's source URL. * * @return string The script's tag. * * @phpcs:disable WordPress.WP.EnqueuedResources.NonEnqueuedScript */ public function add_async_to_script( $tag, $handle, $src ) { if ( $handle !== WPSEO_Admin_Asset_Manager::PREFIX . 'wordproof-uikit' ) { return $tag; } return ""; } }