Exemplo n.º 1
0
    public function form($instance)
    {
        set_default_values($instance);
        extract($instance);
        ?>

        <p>
        <label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        echo 'Title';
        ?>
</label>
        <input id="<?php 
        echo $this->get_field_id('title');
        ?>
"
               name="<?php 
        echo $this->get_field_name('title');
        ?>
"
               value="<?php 
        echo esc_attr($title);
        ?>
"
               type="text" class="widefat" />
        </p>

        <p>
        <label for="<?php 
        echo $this->get_field_id('comment_limit');
        ?>
"><?php 
        echo 'Comments shown in the widget';
        ?>
</label>
        <input id="<?php 
        echo $this->get_field_id('comment_limit');
        ?>
"
               name="<?php 
        echo $this->get_field_name('comment_limit');
        ?>
"
               value="<?php 
        echo esc_attr($comment_limit);
        ?>
"
               type="number" min="1" max="100" class="widefat"/>
        </p>

        <p>
        <label for="<?php 
        echo $this->get_field_id('comment_length');
        ?>
"><?php 
        echo 'Maximum comment length <small>0 to show the entire comment</small>';
        ?>
</label>
        <input id="<?php 
        echo $this->get_field_id('comment_length');
        ?>
"
               name="<?php 
        echo $this->get_field_name('comment_length');
        ?>
"
               value="<?php 
        echo esc_attr($comment_length);
        ?>
"
               type="number" min="1" class="widefat" />
        </p>
        <p>
        <label for="<?php 
        echo $this->get_field_id('comments_per_thread');
        ?>
"><?php 
        echo 'Comments from the same thread <small>0 to disable the restriction</small>';
        ?>
</label>
        <input id="<?php 
        echo $this->get_field_id('comments_per_thread');
        ?>
"
               name="<?php 
        echo $this->get_field_name('comments_per_thread');
        ?>
"
               value="<?php 
        echo esc_attr($comments_per_thread);
        ?>
"
               type="number" min="0" class="widefat" />
        </p>

        <p>
        <label for="<?php 
        echo $this->get_field_id('cache_timeout');
        ?>
"><?php 
        echo 'Cache timeout <small>in seconds, 0 to disable caching</small>';
        ?>
</label>
        <input id="<?php 
        echo $this->get_field_id('cache_timeout');
        ?>
"
               name="<?php 
        echo $this->get_field_name('cache_timeout');
        ?>
"
               value="<?php 
        echo esc_attr($cache_timeout);
        ?>
"
               type="number" min="0" class="widefat" />
        </p>

        <p>
        <label for="<?php 
        echo $this->get_field_id('livestamp_timeout');
        ?>
"><?php 
        echo 'Livestamp timeout <small>in seconds, 0 to disable livestamp</small>';
        ?>
</label>
        <input id="<?php 
        echo $this->get_field_id('livestamp_timeout');
        ?>
"
               name="<?php 
        echo $this->get_field_name('livestamp_timeout');
        ?>
"
               value="<?php 
        echo esc_attr($livestamp_timeout);
        ?>
"
               type="number" min="0" class="widefat" />
        </p>

        <p>
        <input id="<?php 
        echo $this->get_field_id('ajax_enabled');
        ?>
"
               name="<?php 
        echo $this->get_field_name('ajax_enabled');
        ?>
"
                <?php 
        checked($instance['ajax_enabled']);
        ?>
               value="true" type="checkbox" />
        <label for="<?php 
        echo $this->get_field_id('ajax_enabled');
        ?>
"><?php 
        echo 'Asyncronous loading';
        ?>
</label>
        </p>

        <p>
        <input id="<?php 
        echo $this->get_field_id('show_update_button');
        ?>
"
               name="<?php 
        echo $this->get_field_name('show_update_button');
        ?>
"
                <?php 
        checked($instance['show_update_button']);
        ?>
               value="true" type="checkbox" />
        <label for="<?php 
        echo $this->get_field_id('show_update_button');
        ?>
"><?php 
        echo 'Show update button';
        ?>
</label>
        </p>

        <p>
        <input id="<?php 
        echo $this->get_field_id('css_enabled');
        ?>
"
               name="<?php 
        echo $this->get_field_name('css_enabled');
        ?>
"
                <?php 
        checked($instance['css_enabled']);
        ?>
               value="true" type="checkbox" />
        <label for="<?php 
        echo $this->get_field_id('css_enabled');
        ?>
"><?php 
        echo 'Use widget CSS';
        ?>
</label>
        </p>

        <p>
        <label for="<?php 
        echo $this->get_field_id('api_key');
        ?>
"><?php 
        echo 'Api key:';
        ?>
</label>
        <input id="<?php 
        echo $this->get_field_id('api_key');
        ?>
"
               name="<?php 
        echo $this->get_field_name('api_key');
        ?>
"
               value="<?php 
        echo esc_attr($api_key);
        ?>
"
               type="text" class="widefat" />
        </p>
        <p>
        <label for="<?php 
        echo $this->get_field_id('forum_name');
        ?>
"><?php 
        echo 'Forum name:';
        ?>
</label>
        <input id="<?php 
        echo $this->get_field_id('forum_name');
        ?>
"
               name="<?php 
        echo $this->get_field_name('forum_name');
        ?>
"
               value="<?php 
        echo esc_attr($forum_name);
        ?>
"
               type="text" class="widefat" />
        </p>
        <p>
        <label for="<?php 
        echo $this->get_field_id('request_comment_limit');
        ?>
"><?php 
        echo 'Comments retrieved from disqus <small>[1, 100]</small>';
        ?>
</label>
        <input id="<?php 
        echo $this->get_field_id('request_comment_limit');
        ?>
"
               name="<?php 
        echo $this->get_field_name('request_comment_limit');
        ?>
"
               value="<?php 
        echo esc_attr($request_comment_limit);
        ?>
"
               type="number" min="1" max="100" class="widefat" />
        </p>

    <?php 
    }
Exemplo n.º 2
0
//
// also check out  doc/devtools/securitycheck.php to see in which files are
// used each pref (and permission name too)
//
$ourFileName = "dump/prefreport.txt";
require_once 'tiki-setup.php';
require_once 'lib/prefslib.php';
$defaultValues = get_default_prefs();
$fields = array('preference' => '', 'name' => '', 'description' => '', 'default' => '', 'help' => '', 'hard_to_search' => false, 'duplicate_name' => 0, 'duplicate_description' => 0, 'word_count' => 0, 'filter' => '', 'locations' => '', 'dependencies' => '', 'type' => '', 'options' => '', 'admin' => '', 'module' => '', 'view' => '', 'permission' => '', 'plugin' => '', 'extensions' => '', 'tags' => '', 'parameters' => '', 'detail' => '', 'warning' => '', 'hint' => '', 'shorthint' => '', 'perspective' => '', 'separator' => '');
$stopWords = array('', 'in', 'and', 'a', 'to', 'be', 'of', 'on', 'the', 'for', 'as', 'it', 'or', 'with', 'by', 'is', 'an');
$data = array();
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$data = collect_raw_data($fields);
remove_fake_descriptions($data);
set_default_values($data, $defaultValues);
collect_locations($data);
$index = array('name' => index_data($data, 'name'), 'description' => index_data($data, 'description'));
update_search_flag($data, $index, $stopWords);
$ourFileHandle = fopen($ourFileName, 'w+') or die("can't open file");
// Output results
fputcsv($ourFileHandle, array_keys($fields), '|');
foreach ($data as $values) {
    fputcsv($ourFileHandle, array_values($values), '|');
}
fclose($ourFileHandle);
/**
 * @param $fields
 * @return array
 */
function collect_raw_data($fields)