product_event(); if ( Option::check( 'enable_pctag' ) && Option::check( 'pctag_id' ) ) { echo $this->pinterest( Option::get( 'pctag_id' ) ); } if ( Option::check( 'pctag_website' ) ) { echo "\n" . Option::get( 'pctag_website' ) . "\n"; } } protected function pinterest( $tag ) { return "\n \n\n"; } protected function search_event( $search_query, $tag ) { return "\n\n"; } protected function pinterest_event( string $type, string $tag, array $data = [] ) { $event_data = ""; $noscript_data = ""; if ( count( $data ) > 0 ) { $event_data = ", " . json_encode( $data ); foreach ( $data as $key => $value ) { $noscript_data .= "&ed[{$key}]={$value}"; } // Replace quotes around object keys with unquoted keys $event_data = preg_replace( '/"([\\w]+)":/i', '$1:', $event_data ); } return "\n\n\n"; } protected function product_event( string $type, string $tag ) { } protected function view_category( string $tag ) { return "\n \n"; } function flattenArray( array $multiArray ) : array { $flattenedArray = []; foreach ( $multiArray as $array ) { if ( !empty( $array['type'] ) && !empty( $array['value'] ) ) { $flattenedArray[$array['type']] = $array['value']; } } return $flattenedArray; } } $TrackingControllers = new TrackingController();