<?php if (!defined('CRYPTEX_INIT')) die('DIRECT ACCESS PROHIBITED'); ?>

    <!-- GENERAL SETTINGS -->
    <div class="postbox cryptex-postbox">
    <h3 class="hndle"><span><?php _e('General Settings', 'cryptex'); ?></span></h3>
    <div class="inside cryptex-setting-section">
    
        <h4><?php _e('CSS Options', 'cryptex'); ?></h4>
        <!-- css prefix -->
        <?php $this->_settingsUtility->displayInput(__('CSS Prefix', 'cryptex'), 'css-prefix', array(
            'label' => __('e.g. #content, .mycontentarea', 'cryptex'),
            'description' => __('An optional prefix added to the generated css classes to match your content-container and retain cryptex styles.', 'cryptex')
        )); ?>
        
        <!-- css classes -->
        <?php $this->_settingsUtility->displayInput(__('Additional Classes', 'cryptex'), 'css-classes', array(
            'label' => __('e.g. email mailicon', 'cryptex'),
            'description' => __('Additional css classes added to the outer span-tag - maybe used to add icons.', 'cryptex')
        )); ?>

        <h4><?php _e('Resources', 'cryptex'); ?></h4>
        <p><?php _e('Cryptex requires some css styles as well as small piece of javascript code to work. The content is added inline to your page (no external resources).', 'cryptex'); ?><br />
        <?php _e('The generated styles are', 'cryptex'); ?> <a href="<?php echo $this->_cacheManager->getCacheUrl().'Cryptex.css'; ?>"><?php _e('available here', 'cryptex'); ?></a> (&lt;cachedir&gt;/Cryptex.css).</p>
        
        <!-- embed css !-->
        <?php $this->_settingsUtility->displayCheckbox(__('Cryptex stylesheets', 'cryptex'), 'embed-css', array(
            'label' => 'Include',
            'description' => __('The styles are required to display the cryptex images.', 'cryptex')
        )) ?>
        
        <!-- embed JS !-->
        <?php $this->_settingsUtility->displayCheckbox(__('Cryptex javascript', 'cryptex'), 'embed-js', array(
            'label' => 'Include',
            'description' => __('The javascript files are only required for hyperlink-decoding - if disabled, no javascript files will be included!', 'cryptex')
        )); ?>
    
    <!-- // GENERAL SETTINGS -->
    </div></div>


    <!-- CACHE SETTINGS -->
    <div class="postbox cryptex-postbox">
    <h3 class="hndle"><span><?php _e('Cache Settings', 'cryptex'); ?></span></h3>
    <div class="inside cryptex-setting-section">

        <p><?php _e('You can define a custom cache-directory which should be used to store the generated images and css files. This directory has to be web-accessable!', 'cryptex'); ?></p>

        <!-- Enable Custom Path settings -->
        <?php $this->_settingsUtility->displayCheckbox(__('Custom cache', 'cryptex'), 'cache-custom', array(
            'label' => 'Enable'
        )); ?>

        <h4><?php _e('Current Settings', 'cryptex'); ?></h4>
        <p>
            <?php _e('Path: ', 'cryptex'); ?><code><?php echo $this->_cacheManager->getCachePath();?></code><br />
            <?php _e('Url: ', 'cryptex'); ?><code><?php echo $this->_cacheManager->getCacheURL();?></code>
        </p>
    
        <div class="cryptex-selective-section" data-trigger="#cryptex-cache-custom" data-condition="checked">
            <h4><?php _e('Custom cache path/url', 'cryptex'); ?></h4>
            <p class="cryptex-text-false"><strong><?php _e('Attention:', 'cryptex'); ?></strong> <?php _e('All files within the cache-path will be removed each time you update cryptex-settings!', 'cryptex'); ?>
            
            <!-- local cache directory !-->
            <?php 
                $customCachePath = $this->_settingsManager->getOption('cache-path');
                if (\Cryptex\skltn\CacheManager::isPathAccessible($customCachePath) != true){
                    echo '<p class="cryptex-text-false">', __('Warning: cache-path is not accessible! the default values will be used!', 'cryptex'), '</p>';
                }
            ?>
            <?php $this->_settingsUtility->displayInput(__('Store files in this directory', 'cryptex'), 'cache-path', array(
                'label' => __('e.g. /home/user/wordpress/cache/', 'cryptex'),
                'description' => __('Default: ', 'cryptex'). CRYPTEX_PLUGIN_PATH.'/cache/'
            )); ?>
        
            <!-- cache URL !-->
            <?php $this->_settingsUtility->displayInput(__('Full URL path to files', 'cryptex'), 'cache-url', array(
                'label' => __('e.g. http://cache.yourdomain.tld/i/', 'cryptex'),
                'description' => __('Default: ', 'cryptex'). plugins_url('/cryptex/cache/')
            )); ?>
        </div>
    <!-- // CACHE SETTINGS -->    
    </div></div>

