ductions ) { // Bail when there are no introductions to show. return; } // Update user meta to have "seen" these introductions. $this->update_user_introductions( $user_id, $introductions ); $this->admin_asset_manager->enqueue_script( self::SCRIPT_HANDLE ); $this->admin_asset_manager->localize_script( self::SCRIPT_HANDLE, 'wpseoIntroductions', [ 'introductions' => $introductions, 'isPremium' => $this->product_helper->is_premium(), 'isRtl' => \is_rtl(), 'linkParams' => $this->short_link_helper->get_query_params(), 'pluginUrl' => \plugins_url( '', \WPSEO_FILE ), 'wistiaEmbedPermission' => $this->wistia_embed_permission_repository->get_value_for_user( $user_id ), 'isWooEnabled' => $this->woocommerce_conditional->is_met(), ], ); $this->admin_asset_manager->enqueue_style( 'introductions' ); } /** * Updates the user metadata to have "seen" the introductions. * * @param int $user_id The user ID. * @param array $introductions The introductions. * * @return void */ private function update_user_introductions( $user_id, $introductions ) { $metadata = $this->user_helper->get_meta( $user_id, Introductions_Seen_Repository::USER_META_KEY, true ); if ( ! \is_array( $metadata ) ) { $metadata = []; } if ( empty( $introductions ) || ! \is_array( $introductions ) ) { return; } // Find the introduction with the highest priority, because JS will only show that one. $highest_priority_intro = \array_reduce( $introductions, static function ( $carry, $item ) { return ( $carry === null || $item['priority'] < $carry['priority'] ) ? $item : $carry; }, null, ); if ( $highest_priority_intro === null ) { return; } // Mark the introduction with the highest priority as seen. $metadata[ $highest_priority_intro['id'] ]['is_seen'] = true; $metadata[ $highest_priority_intro['id'] ]['seen_on'] = \time(); $this->user_helper->update_meta( $user_id, Introductions_Seen_Repository::USER_META_KEY, $metadata ); } /** * Updates the introductions metadata format for the user * This is needed because we're introducing timestamps for introductions that have been seen, thus changing the format. * * @param int $user_id The user ID. * * @return void */ private function update_metadata_for( int $user_id ) { $metadata = $this->introductions_collector->get_metadata( $user_id ); foreach ( $metadata as $introduction_name => $introduction_data ) { if ( \is_bool( $introduction_data ) ) { $metadata[ $introduction_name ] = [ 'is_seen' => $introduction_data, 'seen_on' => ( $introduction_data === true ) ? \time() : 0, ]; } } $this->user_helper->update_meta( $user_id, Introductions_Seen_Repository::USER_META_KEY, $metadata ); } } Moto články, novinky, zajímavosti, rady, informace

MOTO články

Všichni milovníci moto světa zbystřete! Na našem internetovém magazínu Motoristika pro vás každý týden připravujeme nejžhavější novinky ze světa motorek. Baví nás totiž sledovat výrobní procesy jednotlivých strojů, chystané novinky od předních výrobců, ale také koncepty, které pro nás chystají nově vznikající společnosti. Články Moto jsou určeny pro všechny fanoušky i nadšence sportovních motorek, chopperů, silničních motorek i motocrossu. Na Motoristice se můžete dozvědět užitečné rady pro začínající jezdce, skvělé tipy na motorky pro profíky i připravované novinky od výrobců motorek i chystané novinky ze světa bezpečnosti. Pro motoristy sledujeme nejžhavější vychytávky nejen pro motorky, ale také pro samotné jezdce. Baví nás adrenalin, který přináší jízda na motorce, přesto však nedáme dopustit na bezpečí. Nenechte si proto upláchnout tipy na nové oblečení nebo doplňky, usnadňující jízdu na mašině!

Stránka 23 z 30 1 … 22 23 24 … 30

Oblíbená cestovatelská videa

Vítejte zpět!

Níže se přihlaste do vašeho účtu

Načtěte vaše heslo

Vložte prosím vaše uživatelské jméno nebo email pro reset hesla

Previous Next
Close
Test Caption
Test Description goes like this