Example #1
0
 /**
  * Returns class instance.
  *
  * @return tinyConfig
  * @since 0.3 beta
  */
 public static function getInstance()
 {
     if (!self::$_self) {
         self::$_self = new tinyConfig();
     }
     return self::$_self;
 }
Example #2
0
$config->parsePage = isset($_POST['parsePost']) ? true : false;
$config->parsePost = isset($_POST['parsePage']) ? true : false;
$config->parseHomePage = isset($_POST['parseHomePage']) ? true : false;
$config->parseSearch = isset($_POST['parseSearch']) ? true : false;
$config->parseFeed = isset($_POST['parseFeed']) ? true : false;
$config->parseCategoryArchive = isset($_POST['parseCategory']) ? true : false;
$config->parseDateArchive = isset($_POST['parseDate']) ? true : false;
$config->parseAnyArchive = isset($_POST['parseAnyArchive']) ? true : false;
$config->pageExclude = (array) $_POST['excludePages'];
$config->postExclude = (array) $_POST['excludePosts'];
$settings[] = $config;
$config = new stdClass();
$config->html = (string) $_POST['backToTopHtml'];
$config->css = (string) $_POST['backToTopCss'];
$settings[] = $config;
$config = new stdClass();
$config->startList = (string) $_POST['tocStartList'];
$config->endList = (string) $_POST['tocEndList'];
$config->startItem = (string) $_POST['tocStartItem'];
$config->endItem = (string) $_POST['tocEndItem'];
$config->css = (string) $_POST['tocCss'];
$settings[] = $config;
$config = new stdClass();
$config->useChapterLevelStyling = isset($_POST['useChapterLevelStyling']) ? true : false;
$config->stripExistingTags = isset($_POST['stripExistingTags']) ? true : false;
$config->levelStyleStart = $_POST['levelStyleStart'];
$config->levelStyleEnd = $_POST['levelStyleEnd'];
$settings[] = $config;
tinyConfig::getInstance()->update($keys, $settings);
?>
<div class="updated"><p><strong>Options updated.</strong></p></div>
Example #3
0
File: home.php Project: hewu/blogwp
<?php

/**
 * @author Marijan Šuflaj <*****@*****.**>
 * @link http://www.php4every1.com
 */
//Disable direct view.
if (!defined('IN_PLUGIN')) {
    die('You can not access this file directly.');
}
$config = tinyConfig::getInstance()->get('');
?>
<div class="wrap">
    <h3>Plugin summary</h3>

    <h4>Info</h4>
    <table class="widefat" style="width: 500px">
        <tbody>
            <tr>
                <td width="49%">
                    Name:
                </td>
                <td>
                    <a href="<?php 
echo $config->tinytoc_settings_info->home;
?>
"><?php 
echo $config->tinytoc_settings_info->name;
?>
</a>
                </td>
Example #4
0
$config->parseAnyArchive = true;
$config->pageExclude = array();
$config->postExclude = array();
$settings[] = $config;
$config = new stdClass();
$config->html = ' <small><a href="#tinyTOC">Top</a></small>';
$config->css = '';
$settings[] = $config;
$config = new stdClass();
$config->startList = '<ul>';
$config->endList = '</ul>';
$config->startItem = '<li>';
$config->endItem = '</li>';
$config->css = '';
$settings[] = $config;
$config = new stdClass();
$config->useChapterLevelStyling = false;
$config->stripExistingTags = false;
$config->levelStyleStart = array(1 => '', 2 => '', 3 => '');
$config->levelStyleEnd = array(1 => '', 2 => '', 3 => '');
$settings[] = $config;
$config = new stdClass();
$config->name = 'Tiny Table Of Content - TinyTOC';
$config->version = '0.12.31';
$config->home = 'http://php4every1.com/scripts/tiny-table-of-contents-wordpress-plugin/';
$config->author = 'Marijan Šuflaj';
$config->email = '*****@*****.**';
$config->authorHome = 'http://www.php4every1.com';
$settings[] = $config;
tinyConfig::getInstance()->create($keys, $settings, $autoload, 'no');
/**
 * Function that we use to check if we need to parse this request.
 *
 * @return bool True if we need to parse it, otherwise false
 */
function checkIfWeNeedToParse()
{
    global $post;
    //Get parsing config.
    $config = tinyConfig::getInstance()->get('tinytoc_settings_parse');
    //Check if we have enabled settings that we need to parse this request.
    if (is_home() && !$config->tinytoc_settings_parse->parseHomePage) {
        return false;
    }
    if (is_archive() && !$config->tinytoc_settings_parse->parseAnyArchive) {
        return false;
    }
    if (is_date() && !$config->tinytoc_settings_parse->parseDateArchive) {
        return false;
    }
    if (is_category() && !$config->tinytoc_settings_parse->parseCategoryArchive) {
        return false;
    }
    if (is_search() && !$config->tinytoc_settings_parse->parseSearch) {
        return false;
    }
    if (is_feed() && !$config->tinytoc_settings_parse->parseFeed) {
        return false;
    }
    if ($post->post_type === 'post' && !$config->tinytoc_settings_parse->parsePost) {
        return false;
    }
    if ($post->post_type === 'page' && !$config->tinytoc_settings_parse->parsePage) {
        return false;
    }
    if (in_array($post->ID, $config->tinytoc_settings_parse->postExclude) || in_array($post->ID, $config->tinytoc_settings_parse->pageExclude)) {
        return false;
    }
    //Yap, that's it. We need to parse it.
    return true;
}