Esempio n. 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;
}
?>

<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();
?>
Esempio n. 2
0
 public function meta()
 {
     echo '<div class="typerocket-container">';
     $buffer = new \TypeRocket\Utility\Buffer();
     // field settings
     $title = ['label' => 'Page Title'];
     $desc = ['label' => 'Search Result Description'];
     $og_title = ['label' => 'Title', 'help' => 'The open graph protocol is used by social networks like FB, Google+ and Pinterest. Set the title used when sharing.'];
     $og_desc = ['label' => 'Description', 'help' => 'Set the open graph description to override "Search Result Description". Will be used by FB, Google+ and Pinterest.'];
     $img = ['label' => 'Image', 'help' => "The image is shown when sharing socially using the open graph protocol. Will be used by FB, Google+ and Pinterest. Need help? Try the Facebook <a href=\"https://developers.facebook.com/tools/debug/og/object/\" target=\"_blank\">open graph object debugger</a> and <a href=\"https://developers.facebook.com/docs/sharing/best-practices\" target=\"_blank\">best practices</a>."];
     $tw_img = ['label' => 'Image', 'help' => "Images for a 'summary_large_image' card should be at least 280px in width, and at least 150px in height. Image must be less than 1MB in size. Do not use a generic image such as your website logo, author photo, or other image that spans multiple pages."];
     $canon = ['label' => 'Canonical URL', 'help' => 'The canonical URL that this page should point to, leave empty to default to permalink.'];
     $redirect = ['label' => '301 Redirect', 'help' => 'Move this page permanently to a new URL. <a href="#tr_redirect" id="tr_redirect_lock">Unlock 301 Redirect</a>', 'readonly' => true];
     $follow = ['label' => 'Robots Follow?', 'desc' => "Don't Follow", 'help' => 'This instructs search engines not to follow links on this page. This only applies to links on this page. It\'s entirely likely that a robot might find the same links on some other page and still arrive at your undesired page.'];
     $help = ['label' => 'Robots Index?', 'desc' => "Don't Index", 'help' => 'This instructs search engines not to show this page in its web search results.'];
     $tw_help = "Need help? Try the Twitter <a href=\"https://cards-dev.twitter.com/validator/\" target=\"_blank\">card validator</a> and <a href=\"https://dev.twitter.com/cards/getting-started\" target=\"_blank\">getting started guide</a>.";
     // select options
     $follow_opts = ['Not Set' => 'none', 'Follow' => 'follow', "Don't Follow" => 'nofollow'];
     $index_opts = ['Not Set' => 'none', 'Index' => 'index', "Don't Index" => 'noindex'];
     $card_opts = ['Summary' => 'summary', 'Summary large image' => 'summary_large_image'];
     // build form
     $form = new \TypeRocket\Elements\Form();
     $form->setDebugStatus(false);
     $form->setGroup('seo.meta');
     $buffer->startBuffer();
     echo $form->text('title', ['id' => 'tr_title'], $title);
     echo $form->textarea('description', ['id' => 'tr_description'], $desc);
     $buffer->indexBuffer('general');
     // index buffer
     $buffer->startBuffer();
     echo $form->text('og_title', [], $og_title);
     echo $form->textarea('og_desc', [], $og_desc);
     echo $form->image('meta_img', [], $img);
     $buffer->indexBuffer('social');
     // index buffer
     $buffer->startBuffer();
     echo $form->text('tw_site')->setLabel('Twitter account')->setAttribute('placeholder', '@username');
     echo $form->select('tw_card')->setOptions($card_opts)->setLabel('Card Type')->setSetting('help', $tw_help);
     echo $form->image('tw_img', [], $tw_img);
     echo $form->text('tw_title')->setLabel('Title')->setAttribute('maxlength', 70);
     echo $form->textarea('tw_desc')->setLabel('Description')->setAttribute('maxlength', 200);
     $buffer->indexBuffer('twitter');
     // index buffer
     $buffer->startBuffer();
     echo $form->text('canonical', [], $canon);
     echo $form->text('redirect', ['readonly' => 'readonly', 'id' => 'tr_redirect'], $redirect);
     echo $form->select('follow', [], $follow)->setOptions($follow_opts);
     echo $form->select('index', [], $help)->setOptions($index_opts);
     $buffer->indexBuffer('advanced');
     // index buffer
     $tabs = new \TypeRocket\Elements\Tabs();
     $tabs->addTab(['id' => 'seo-general', 'title' => "Basic", 'content' => $buffer->getBuffer('general'), 'callback' => [$this, 'general']])->addTab(['id' => 'seo-social', 'title' => "Social", 'content' => $buffer->getBuffer('social')])->addTab(['id' => 'seo-twitter', 'title' => "Twitter Cards", 'content' => $buffer->getBuffer('twitter')])->addTab(['id' => 'seo-advanced', 'title' => "Advanced", 'content' => $buffer->getBuffer('advanced')])->render();
     echo '</div>';
 }