option() public static method

Get option from wp_options table.
public static option ( $key ) : mixed | void
$key
return mixed | void
<?php

/*
 * This file is part of Elasticsearch Indexer.
 *
 * (c) Wallmander & Co <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Wallmander\ElasticsearchIndexer\Model\Config;
return ['index' => ['number_of_shards' => (int) Config::option('shards'), 'number_of_replicas' => (int) Config::option('replicas')], 'analysis' => ['analyzer' => ['esi_search_analyzer' => ['type' => 'custom', 'tokenizer' => 'standard', 'filter' => ['standard', 'lowercase', 'stop', 'esi_ngram', 'esi_snowball'], 'language' => apply_filters('esi_analyzer_language', 'English')], 'esi_index_analyzer' => ['type' => 'custom', 'tokenizer' => 'keyword', 'filter' => ['standard', 'lowercase']], 'esi_simple_analyzer' => ['type' => 'custom', 'tokenizer' => 'standard', 'filter' => ['standard', 'lowercase', 'keyword_repeat', 'porter_stem']]], 'filter' => ['esi_ngram' => ['type' => 'nGram', 'min_gram' => 3, 'max_gram' => 20], 'esi_snowball' => ['type' => 'snowball', 'language' => apply_filters('esi_analyzer_language', 'English')]]]];
示例#2
0
 private static function getStatusText()
 {
     if (!Elasticsearch::isAvailable()) {
         return ['Unable to connect', '#e14d43'];
     }
     if (Config::option('user_index_version') < Config::option('plugin_index_version')) {
         return ['Reindex required', '#e14d43'];
     }
     if ($time = Config::option('is_indexing')) {
         if ($time + 20 < time()) {
             return ['Indexing process interrupted', '#e14d43'];
         }
         return ['Indexing...', '#ccaf0b'];
     }
     if (!Config::option('enable_integration')) {
         return ['Disabled Integration', '#999'];
     }
     return ['Enabled', '#a3b745'];
 }
 /**
  * Setup WooCommerceAdmin hooks.
  */
 public static function setupWooCommerceAdmin()
 {
     if (!class_exists('WooCommerce') || !Config::option('index_private_post_types')) {
         return;
     }
     $class = __NAMESPACE__ . '\\Controller\\WooCommerceAdmin';
     $class = apply_filters('esi_controller_woocommerceadmin', $class);
     add_filter('esi_post_sync_args', [$class, 'filterPostSyncArgs'], 10, 2);
     if (Config::enabledFullIntegration()) {
         static::forceRemoveAction('parse_query', 'shop_order_search_custom_fields');
         add_action('esi_after_format_args', [$class, 'actionOrderSearch']);
     }
 }
示例#4
0
 /**
  * @return array
  */
 public static function getIndexablePostStati()
 {
     if (Config::option('index_private_post_types')) {
         return get_post_stati();
     }
     return get_post_stati(['exclude_from_search' => false]);
 }
示例#5
0
                </td>
            </tr>
            <tr valign="top">
                <th>Enable Profiler Admin</th>
                <td>
                    <input type="hidden" name="<?php 
echo Config::optionKey('profile_admin');
?>
"
                           value="0"/>
                    <input type="checkbox" name="<?php 
echo Config::optionKey('profile_admin');
?>
"
                           value="1" <?php 
echo Config::option('profile_admin') ? 'checked="checked"' : '';
?>
/>

                    <p class="description"></p>
                </td>
            </tr>
        </table>

        <?php 
submit_button();
?>

    </form>
</div>