'.esc_html(acym_translation($buttonText)).''; } else { if (empty($identifier)) { $identifier = 'identifier_'.acym_rand(1000, 9000); } return ' '.esc_html( acym_translation($buttonText) ).''; } } function acym_CMSArticleTitle(int $id): string { $title = acym_loadResult('SELECT post_title FROM #__posts WHERE ID = '.intval($id)); return empty($title) ? '' : $title; } function acym_getArticleURL(int $id, bool $popup, string $text): string { if (empty($id)) { return ''; } $url = get_permalink($id); if ($popup) { $url .= (strpos($url, '?') ? '&' : '?').acym_noTemplate(); $url = acym_frontModal($url, $text, false); } else { $url = ''.acym_translation($text).''; } return $url; } function acym_articleSelectionPage(): string { return admin_url('admin-ajax.php').'?action=acymailing_router&page=acymailing_configuration&ctrl=configuration&task=getarticles&'.acym_getFormToken(); } function acym_getPageOverride(string $ctrl, string $view, bool $forceBackend = false): string { return ACYM_OVERRIDES.$ctrl.DS.$view.'.php'; } function acym_cmsCleanHtml(string $html): string { if (strpos($html, '#Uis' => '{vimeo}$1{/vimeo}', '##Uis' => '{youtube}$1{/youtube}', '##Uis' => '{vimeo}$1{/vimeo}', '##Uis' => '{youtube}$1{/youtube}', '#]*wp-block-file__button[^>]*>[^<]*#Uis' => '', ]; foreach ($elementsToRemove as $oneElement) { $replacements['#.*#Uis'] = ''; } $cleanText = preg_replace(array_keys($replacements), $replacements, $html); if (!empty($cleanText)) $html = $cleanText; // Display the WP content correctly $html .= ''; return $html; } function acym_getAlias(string $name): string { return sanitize_title_with_dashes(remove_accents($name)); } function acym_getAllPages(): array { $allPges = get_pages(); if (empty($allPges)) return []; $return = []; foreach ($allPges as $page) { $return[$page->ID] = $page->post_title; } return $return; } function acym_getArticles(string $search): array { $return = []; $search_results = new WP_Query( [ 's' => $search, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'post_type' => ['page', 'post'], 'posts_per_page' => 20, ] ); if ($search_results->have_posts()) { while ($search_results->have_posts()) { $search_results->the_post(); $return[] = [$search_results->post->ID, $search_results->post->post_title]; } } return $return; } function acym_getArticleById(int $id): array { $post = get_post($id); if (empty($post)) return []; return [ 'id' => $post->ID, 'title' => $post->post_title, ]; }