/** * Single Template Function * * @param $single_template * * @return string */ public function get_google_maps_template($single_template) { if (file_exists(get_stylesheet_directory() . '/google-maps/' . $single_template)) { $output = get_stylesheet_directory() . '/google-maps/' . $single_template; } else { $output = gmb_find_view('views/' . $single_template); } return $output; }
/** * Include a view * * NOTE: First this attempts to load from GMB_PLUGIN_PATH . '/includes/' then it trys GMP_CORE_PATH .'/includes', unless $full * NOTE: Uses include() not include_once() * * @since 2.1 * * @return string * * @param string $file File path relative to either core includes path or plugin includes path. Use full absolute path if $full param is true * @param bool $full Optional. If true, $file param should be a full absolute path. Default is false. * @param array $data Optional. An array of values to be used in the view via output buffering. Default is an empty array which skips output buffering. * * @return bool True if file was included, false if not. */ function gmb_include_view($file, $full = false, $data = array()) { $file = gmb_find_view($file, $full); /** * Filter file path for gmb_include_view * * @since 2.1 * * @param string $file File path -- should be a full absolute path * @param bool $full If this function is using full file path mode or not */ $file = apply_filters('gmb_gmb_include_view_file', $file, $full); if (file_exists($file)) { if (!empty($data)) { extract($data, EXTR_SKIP); ob_start(); } include $file; if (!empty($data)) { echo ob_get_clean(); } return true; } else { return false; } }