Example #1
0
<?php

if (!function_exists('add_action')) {
    echo 'Hi there!  I\'m just a plugin, not much I can do when called directly.';
    exit;
}
function tr_dev_icons()
{
    $icons = new TypeRocket\Elements\Icons();
    $generator = new \TypeRocket\Html\Generator();
    echo '<h3><i class="tr-icon-tools"></i> Icons</h3><p>These can be used with custom post types and admin pages.</p><ol>';
    foreach ($icons as $k => $v) {
        echo $generator->newElement('li', ['class' => 'tr-icon-' . $k], ' ' . $k . ' ( .tr-icon-' . $k . ' )')->getString();
    }
    echo '</ol>';
}
function tr_dev_stats()
{
    ?>
    <h3>Run Time</h3>
    <p>If you are using xDebug profiling or tracking times will be slower.</p>
    <p><b>TR Run Time</b>: <?php 
    echo TR_END - TR_START;
    ?>
</p>
    <p>Also noted in the footer at every page load when debug mode is on.</p>
<?php 
}
$tabs = tr_tabs();
$tabs->addTab(['id' => 'stats', 'title' => 'Stats', 'content' => '', 'callback' => 'tr_dev_stats'])->addTab(['id' => 'icons', 'title' => 'Icon Names', 'content' => '', 'callback' => 'tr_dev_icons'])->render('box');
Example #2
0
if (!function_exists('add_action')) {
    echo 'Hi there!  I\'m just a plugin, not much I can do when called directly.';
    exit;
}
?>

<h1>Theme Options</h1>

<?php 
$form = new \TypeRocket\Elements\Form();
$form->useJson();
$form->setGroup($this->getName());
?>

<div class="typerocket-container">
    <?php 
echo $form->open();
// about
$contact = [$form->text('Company Name'), $form->text('Company Email'), $form->text('Company Phone'), $form->search('Terms Page')->setPostType('page'), $form->checkbox('Company Open')->setText('Company open for business')->setLabel(false)];
$about = $form->getFromFieldsString($contact);
// api
$help = '<a target="blank" href="https://developers.google.com/maps/documentation/embed/guide#api_key">Get Your Google Maps API</a> to activate maps in the theme.';
$api = $form->password('Google Maps API Key')->setHelp($help)->setAttribute('autocomplete', 'new-password');
// save
$save = $form->submit('Save');
// layout
tr_tabs()->setSidebar($save)->addTab('About', $about)->addTab('APIs', $api)->render('box');
echo $form->close();
?>

</div>
if (!function_exists('add_action')) {
    echo 'Heei... O que está fazendo?';
    exit;
}
?>

<h2>Opções gerais</h2>

<?php 
$form = new \TypeRocket\Form();
$form->setGroup($this->getName());
?>

<div id="tr-dev-content" class="typerocket-container">
    <?php 
echo $form->open();
// about
$contact = array($form->text('Nome da Empresa'), $form->text('Endereço'), $form->text('Cidade'), $form->text('CEP'), $form->text('Telefone'), $form->text('E-mail'));
$about = $form->getFromFieldsString($contact);
// api
$help = '<a target="blank" href="https://developers.google.com/maps/documentation/embed/guide#api_key">Get Your Google Maps API</a> to activate maps in the theme.';
$api = $form->password('Google Maps API Key')->setSetting('help', $help)->setAttribute('autocomplete', 'new-password');
// save
$form->setDebugStatus(false);
$save = $form->submit('Salvar');
// layout
tr_tabs()->setSidebar($save)->addTab('Dados de contato', $about)->addTab('APIs', $api)->render('box');
echo $form->close();
?>

</div>