Run tests only upon activation http://codex.wordpress.org/Function_Reference/register_activation_hook */ require_once 'includes/CCTM.php'; require_once 'includes/constants.php'; require_once 'includes/SummarizePosts.php'; require_once 'includes/GetPostsQuery.php'; require_once 'includes/SummarizePosts_Widget.php'; require_once 'includes/CCTM_Post_Widget.php'; require_once 'includes/StandardizedCustomFields.php'; require_once 'includes/CCTM_FormElement.php'; require_once 'includes/CCTM_Ajax.php'; require_once 'includes/functions.php'; CCTM::$Ajax = new CCTM_Ajax(); // Load up the textdomain(s) for translations CCTM::load_file('/config/lang/dictionaries.php'); // Get admin ready, print any CCTMtests::$errors in the admin dashboard add_action('admin_notices', 'CCTM::print_notices'); if (empty(CCTM::$errors)) { // Load up the CCTM data from wp_options, populates CCTM::$data CCTM::load_data(); // Shortcodes add_shortcode('summarize-posts', 'SummarizePosts::get_posts'); add_shortcode('summarize_posts', 'SummarizePosts::get_posts'); add_shortcode('custom_field', 'CCTM::custom_field'); add_shortcode('cctm_post_form', 'CCTM::cctm_post_form'); // Summarize Posts Tiny MCE button if (CCTM::get_setting('summarizeposts_tinymce')) { add_filter('mce_external_plugins', 'SummarizePosts::tinyplugin_register'); add_filter('mce_buttons', 'SummarizePosts::tinyplugin_add_button', 0); }
if (isset(self::$data['custom_field_defs'][$cf])) { $hide_from_templates = self::get_value(self::$data['custom_field_defs'][$cf], 'hide_from_templates'); if ($hide_from_templates) { continue; } $filter = ''; if (isset(self::$data['custom_field_defs'][$cf]['output_filter'])) { $filter = self::$data['custom_field_defs'][$cf]['output_filter']; } $filter_included = false; // until proven otherwise $filter_class = ''; if (!empty($filter)) { $filter_class = CCTM::filter_prefix . $filter; if (!class_exists($filter_class)) { $filter_included = CCTM::load_file("/filters/{$filter}.php"); } } // Show an example of the Output Filter if ($filter_included && $filter != 'raw') { $OutputFilter = new $filter_class(); $is_repeatable = false; if (isset(self::$data['custom_field_defs'][$cf]['is_repeatable'])) { $is_repeatable = self::$data['custom_field_defs'][$cf]['is_repeatable']; } $custom_fields_str .= sprintf("\t\t<strong>%s:</strong> %s<br />\n", self::$data['custom_field_defs'][$cf]['label'], $OutputFilter->get_example(self::$data['custom_field_defs'][$cf]['name'], self::$data['custom_field_defs'][$cf]['type'], $is_repeatable)); } else { $custom_fields_str .= sprintf("\t\t<strong>%s</strong> <?php print_custom_field('%s'); ?><br />\n", self::$data['custom_field_defs'][$cf]['label'], self::$data['custom_field_defs'][$cf]['name']); } } }
return; } // Set up search boundaries (i.e. the parameters used when nothing else is specified). // Load up the config... $possible_configs = array(); $possible_configs[] = '/config/post_selector/' . $fieldname . '.php'; // e.g. my_field.php $possible_configs[] = '/config/post_selector/_' . $def['type'] . '.php'; // e.g. _image.php $possible_configs[] = '/config/post_selector/_relation.php'; // default //print '<pre>'.print_r($possible_configs,true).'</pre>'; exit; CCTM::$post_selector = array(); CCTM::$search_by = true; // all options available if the tpl passes them if (!CCTM::load_file($possible_configs)) { print '<p>' . __('Post Selector configuration file not found.', CCTM_TXTDOMAIN) . '</p>'; } // This gets subsequent search data that gets passed when the user refines the search. $args = array(); // Do not set defaults here! It causes any values set in the config/post_selector/ files // to be ignored. See https://code.google.com/p/wordpress-custom-content-type-manager/issues/detail?id=537 //$args['orderby'] = 'ID'; //$args['order'] = 'ASC'; if (isset($_POST['search_parameters'])) { // e.g. fieldname=movie_clip&fieldtype=media&page_number=0&orderby=ID&order=ASC parse_str($_POST['search_parameters'], $args); //print '<pre>'.print_r($args,true).'</pre>'; exit; // Pass the "view" parameters to the view $d['page_number'] = CCTM::get_value($args, 'page_number', 0); $d['orderby'] = CCTM::get_value($args, 'orderby', 'ID');