Пример #1
0
 /**
  * Test setup modules
  * 
  * @since 2.1
  */
 public function testSetupModules()
 {
     ep_register_module('test', array('title' => 'Test'));
     ep_activate_module('test');
     $module = ep_get_registered_module('test');
     $this->assertTrue(!empty($module));
     $this->assertTrue(!$module->is_active());
     EP_Modules::factory()->setup_modules();
     $this->assertTrue($module->is_active());
 }
Пример #2
0
    ?>
	<p><?php 
    esc_html_e('Running eCommerce stores is hard enough already. You should not have to worry about slow load times. ElasticPress WooCommerce supercharges all product queries, product sorts, and filters both on the front end and the admin. No matter how many products or filters you have, your site will load fast.', 'elasticpress');
    ?>
</p>

	<p><?php 
    esc_html_e('In the admin, order management and fulfillment is supercharged. Finding orders is much easier with more relevant searches. View order lists is easier since they load faster.', 'elasticpress');
    ?>
</p>
	<?php 
}
/**
 * Make sure WC is activated
 *
 * @since  2.1
 * @return bool|WP_Error
 */
function wc_dependencies_met_cb()
{
    if (class_exists('WooCommerce')) {
        return true;
    } else {
        return new WP_Error('ep-no-woocommerce', esc_html__('WooCommerce must be active to use this module.', 'elasticpress'));
    }
}
/**
 * Register the module
 */
ep_register_module('woocommerce', array('title' => 'WooCommerce', 'setup_cb' => 'ep_wc_setup', 'module_box_summary_cb' => 'ep_wc_module_box_summary', 'module_box_long_cb' => 'ep_wc_module_box_long', 'requires_install_reindex' => true, 'dependencies_met_cb' => 'wc_dependencies_met_cb'));
Пример #3
0
</p>

	<p><?php 
    _e('ElasticPress admin will make your admin curation experience much faster and easier. No longer will you have to wait 60 seconds to do things that should be easy such as viewing 200 posts at once.', 'elasticpress');
    ?>
</p>

	<p><?php 
    _e('Using the search module in conjunction with this module will supercharge your admin search.', 'elasticpress');
    ?>
</p>
	<?php 
}
/**
 * Fetches all post statuses we need to index
 *
 * @since  2.1
 * @param  array $statuses
 * @return array
 */
function ep_admin_get_statuses($statuses)
{
    $post_statuses = get_post_stati();
    unset($post_statuses['auto-draft']);
    return array_unique(array_merge($statuses, array_values($post_statuses)));
}
/**
 * Register the module
 */
ep_register_module('admin', array('title' => 'Admin', 'setup_cb' => 'ep_admin_setup', 'module_box_summary_cb' => 'ep_admin_module_box_summary', 'module_box_long_cb' => 'ep_admin_module_box_long', 'requires_install_reindex' => true));
Пример #4
0
    ?>
	<p><?php 
    esc_html_e('Help users easily find related content by adding related posts to the end of each post.', 'elasticpress');
    ?>
</p>
	<?php 
}
/**
 * Output module box long
 * 
 * @since 2.1
 */
function ep_related_posts_module_box_long()
{
    ?>
	<p><?php 
    esc_html_e('Showing users related content is a quick way to improve readership and loyalty. There a number of plugins that show related content, most of which are ineffective and slow.', 'elasticpress');
    ?>
</p>

	<p><?php 
    esc_html_e('ElasticPress has a powerful content matching algorithm that lets it find related content very effectively. This module will show three related posts after the post content.', 'elasticpress');
    ?>
</p>
	<?php 
}
/**
 * Register the module
 */
ep_register_module('related_posts', array('title' => 'Related Posts', 'setup_cb' => 'ep_related_posts_setup', 'module_box_summary_cb' => 'ep_related_posts_module_box_summary', 'module_box_long_cb' => 'ep_related_posts_module_box_long', 'requires_install_reindex' => false));
Пример #5
0
            $post_types[] = $type;
        }
        // These are now the only post types we will search
        $post_type = $post_types;
    }
    return $post_type;
}
/**
 * Enable integration on search queries
 * 
 * @param  bool $enabled
 * @param  WP_Query $query
 * @since  2.1
 * @return bool
 */
function ep_integrate_search_queries($enabled, $query)
{
    if (isset($query->query_vars['ep_integrate']) && false === $query->query_vars['ep_integrate']) {
        $enabled = false;
    } else {
        if (method_exists($query, 'is_search') && $query->is_search() && !empty($query->query_vars['s'])) {
            $enabled = true;
        }
    }
    return $enabled;
}
/**
 * Register the module
 */
ep_register_module('search', array('title' => 'Search', 'setup_cb' => 'ep_search_setup', 'module_box_summary_cb' => 'ep_search_module_box_summary', 'module_box_long_cb' => 'ep_search_module_box_long', 'requires_install_reindex' => false));