From 749595cc6e7c09cbe9ac4ec0378c7b7ce6521c70 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sun, 15 Sep 2019 14:58:48 -0400 Subject: [PATCH] APIExplorer - Load examples from *.ex.php --- CRM/Admin/Page/APIExplorer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CRM/Admin/Page/APIExplorer.php b/CRM/Admin/Page/APIExplorer.php index a1ade427f6..d0a220cd56 100644 --- a/CRM/Admin/Page/APIExplorer.php +++ b/CRM/Admin/Page/APIExplorer.php @@ -114,7 +114,7 @@ class CRM_Admin_Page_APIExplorer extends CRM_Core_Page { $dir = \CRM_Utils_File::addTrailingSlash($path) . 'api' . DIRECTORY_SEPARATOR . 'v3' . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $_GET['entity']; if (is_dir($dir)) { foreach (scandir($dir) as $item) { - $item = str_replace('.php', '', $item); + $item = str_replace('.ex.php', '', $item); if ($item && strpos($item, '.') === FALSE) { $examples[] = ['key' => $item, 'value' => $item]; } @@ -127,7 +127,7 @@ class CRM_Admin_Page_APIExplorer extends CRM_Core_Page { $paths = self::uniquePaths(); $fileFound = FALSE; foreach ($paths as $path) { - $fileName = \CRM_Utils_File::addTrailingSlash($path) . 'api' . DIRECTORY_SEPARATOR . 'v3' . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $_GET['file'] . '.php'; + $fileName = \CRM_Utils_File::addTrailingSlash($path) . 'api' . DIRECTORY_SEPARATOR . 'v3' . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $_GET['file'] . '.ex.php'; if (!$fileFound && file_exists($fileName)) { $fileFound = TRUE; echo file_get_contents($fileName); -- 2.25.1