$tagValue ) { if ( $tagIndex !== 0 ) { $attributeText .= $comma; } $attributeText .= esc_attr( $tagValue ); } $attributeText .= '" '; return $attributeText; } /** * composes interaction tag with given id. * @param $interactionId * @return string */ public function composeInteractionTag($interactionId) { qmerce_add_sdk_for_shortcode(); return '
'; } /** * composes automation tag (with userId taken by token) * @param string $channelToken * @return string */ public function composeAutomationTag($channelToken = '') { $qmerceSettings = get_option( 'qmerce-settings-admin' ); $tags = $this->composeTagsAttribute($qmerceSettings); // if no token is passed use the first token we have $channelTokenToRefer = $channelToken != '' ? $channelToken : $this->getAuthToken(); // only insert playlist tag if a token was returned if ( isset($channelTokenToRefer) ) { qmerce_add_sdk_for_shortcode(); return '
composeSimpleAttribute($qmerceSettings, 'context') . $this->composeSimpleAttribute($qmerceSettings, 'fallback') . '>
'; } } /** * Returns the publisher token from the DB. * @return string */ private function getAuthToken() { $selectedToken = ''; $qmerceSettings = get_option( 'qmerce-settings-admin' ); $allTokens = $qmerceSettings['apester_tokens']; $playlistEnabledTokens = array_filter($allTokens, function($value) { return $value['isPlaylistEnabled'] == '1'; }); if ( isset($playlistEnabledTokens) ) { $selectedToken = array_rand($playlistEnabledTokens); } return $selectedToken; } }