lineNumbers : true, matchBrackets : true, mode : "application/x-httpd-php", indentUnit : 4, indentWithTabs : false, lineWrapping : true, enterMode : "keep", tabMode : "shift" } ); codemirror_<?php echo esc_js(pods_js_name($attributes['id'])); ?> .on( 'blur', function() { var value = codemirror_<?php echo esc_js(pods_js_name($attributes['id'])); ?> .getValue(); $textarea_<?php echo esc_js(pods_js_name($attributes['id'])); ?> .val( value ); }); CodeMirror.autoLoadMode( codemirror_<?php echo esc_js(pods_js_name($attributes['id'])); ?> , 'php' ); } } ); </script>
/** * Get list of components available * * @since 2.0 */ public function get_components() { $components = pods_transient_get('pods_components'); if (1 == pods_var('pods_debug_components', 'get', 0) && pods_is_admin(array('pods'))) { $components = array(); } if (PodsInit::$version != PODS_VERSION || !is_array($components) || empty($components) || is_admin() && isset($_GET['page']) && 'pods-components' == $_GET['page'] && 1 !== pods_transient_get('pods_components_refresh')) { do_action('pods_components_get'); $component_dir = @opendir(untrailingslashit($this->components_dir)); $component_files = array(); if (false !== $component_dir) { while (false !== ($file = readdir($component_dir))) { if ('.' == substr($file, 0, 1)) { continue; } elseif (is_dir($this->components_dir . $file)) { $component_subdir = @opendir($this->components_dir . $file); if ($component_subdir) { while (false !== ($subfile = readdir($component_subdir))) { if ('.' == substr($subfile, 0, 1)) { continue; } elseif ('.php' == substr($subfile, -4)) { $component_files[] = str_replace('\\', '/', $file . '/' . $subfile); } } closedir($component_subdir); } } elseif ('.php' == substr($file, -4)) { $component_files[] = $file; } } closedir($component_dir); } $default_headers = array('ID' => 'ID', 'Name' => 'Name', 'ShortName' => 'Short Name', 'PluginName' => 'Plugin Name', 'ComponentName' => 'Component Name', 'URI' => 'URI', 'MenuName' => 'Menu Name', 'MenuPage' => 'Menu Page', 'MenuAddPage' => 'Menu Add Page', 'MustUse' => 'Must Use', 'Description' => 'Description', 'Version' => 'Version', 'Category' => 'Category', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'Class' => 'Class', 'Hide' => 'Hide', 'PluginDependency' => 'Plugin Dependency', 'ThemeDependency' => 'Theme Dependency', 'DeveloperMode' => 'Developer Mode', 'TablelessMode' => 'Tableless Mode', 'Capability' => 'Capability', 'Plugin' => 'Plugin'); $component_files = apply_filters('pods_components_register', $component_files); $components = array(); foreach ($component_files as $component_file) { $external = false; if (is_array($component_file) && isset($component_file['File'])) { $component = $component_file = $component_file['File']; $external = true; } else { $component = $this->components_dir . $component_file; } if (!is_readable($component)) { continue; } $component_data = get_file_data($component, $default_headers, 'pods_component'); if (empty($component_data['Name']) && empty($component_data['ComponentName']) && empty($component_data['PluginName']) || 'yes' == $component_data['Hide']) { continue; } if (isset($component_data['Plugin']) && pods_is_plugin_active($component_data['Plugin'])) { continue; } if (empty($component_data['Name'])) { if (!empty($component_data['ComponentName'])) { $component_data['Name'] = $component_data['ComponentName']; } elseif (!empty($component_data['PluginName'])) { $component_data['Name'] = $component_data['PluginName']; } } if (empty($component_data['ShortName'])) { $component_data['ShortName'] = $component_data['Name']; } if (empty($component_data['MenuName'])) { $component_data['MenuName'] = $component_data['Name']; } if (empty($component_data['Class'])) { $component_data['Class'] = 'Pods_' . pods_js_name(basename($component, '.php'), false); } if (empty($component_data['ID'])) { $component_data['ID'] = $component_data['Name']; } $component_data['ID'] = sanitize_title($component_data['ID']); if ('on' == strtolower($component_data['DeveloperMode']) || 1 == $component_data['DeveloperMode']) { $component_data['DeveloperMode'] = true; } else { $component_data['DeveloperMode'] = false; } if ('on' == strtolower($component_data['TablelessMode']) || 1 == $component_data['TablelessMode']) { $component_data['TablelessMode'] = true; } else { $component_data['TablelessMode'] = false; } $component_data['External'] = (bool) $external; if ('on' == strtolower($component_data['MustUse']) || '1' == $component_data['MustUse']) { $component_data['MustUse'] = true; } elseif ('off' == strtolower($component_data['MustUse']) || '0' == $component_data['MustUse']) { $component_data['MustUse'] = false; } else { $component_data['MustUse'] = $component_data['External']; } $component_data['File'] = $component_file; $components[$component_data['ID']] = $component_data; } ksort($components); pods_transient_set('pods_components_refresh', 1, 60 * 60 * 12); pods_transient_set('pods_components', $components); } if (1 == pods_var('pods_debug_components', 'get', 0) && pods_is_admin(array('pods'))) { pods_debug($components); } $this->components = $components; return $this->components; }