本文整理汇总了PHP中Fac函数的典型用法代码示例。如果您正苦于以下问题:PHP Fac函数的具体用法?PHP Fac怎么用?PHP Fac使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Fac函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getVersion
public function getVersion()
{
ob_start();
include_once Fac()->getBaseDir() . '/vendor/components/font-awesome/component.json';
$components = ob_get_clean();
$components = json_decode($components);
return $components->version;
}
示例2: viewNameMetabox
public function viewNameMetabox()
{
global $post;
// Noncename needed to verify where the data originated
echo '<input type="hidden" name="fac_shortcodes_noncename" id="fac_shortcodes_noncename" value="' . wp_create_nonce(basename(Fac()->getBaseDir())) . '" />';
// Get the location data if its already been entered
$name = get_post_meta($post->ID, '_name', true);
$name = !empty($name) ? $name : 'fac_shortcode_' . $post->ID;
// Echo out the field
echo '<input type="text" name="_name" value="' . $name . '" class="widefat" />';
}
示例3: getPreview
public function getPreview($data)
{
$result = array();
if (isset($data['key'])) {
$atts = !empty($data['params']) ? $data['params'] : array();
$preview = Fac()->doPreview($atts, '', $data['key']);
if (!empty($preview)) {
$result['preview'] = '<p>' . $preview . '</p>';
}
}
return $result;
}
示例4: fac_activate_plugin
function fac_activate_plugin()
{
if (class_exists('Agp\\FontAwesomeCollection\\Core\\Agp_Autoloader') && !function_exists('Fac')) {
$autoloader = Agp_Autoloader::instance();
$autoloader->setClassMap(array(__DIR__ => array('classes'), 'namespaces' => array('Agp\\FontAwesomeCollection\\Core' => array(__DIR__ => array('agp-core')))));
function Fac()
{
return Fac::instance();
}
Fac();
}
}
示例5: saveMetaboxes
public function saveMetaboxes($post_id, $post)
{
if (empty($_POST['fac_slider_noncename']) || !wp_verify_nonce($_POST['fac_slider_noncename'], basename(Fac()->getBaseDir())) || !current_user_can('edit_post', $post->ID)) {
return $post->ID;
}
$data = $_POST[$this->getId() . '_data'];
if (isset($data[0])) {
unset($data[0]);
}
//$meta[$this->getId() . '_data'] = serialize($data);
$meta[$this->getId() . '_data'] = $data;
foreach ($meta as $key => $value) {
if ($post->post_type == 'revision') {
return;
}
if (!$value) {
delete_post_meta($post->ID, $key);
} else {
update_post_meta($post->ID, $key, $value);
}
}
}
示例6: createForm
public function createForm()
{
echo Fac()->getTemplate('admin/constructor/constructor', array('key' => 'fac_blank'));
}
示例7: start_el
//.........这里部分代码省略.........
echo esc_attr($item->xfn);
?>
" />
</label>
</p>
<p class="field-description description description-wide">
<label for="edit-menu-item-description-<?php
echo $item_id;
?>
">
<?php
_e('Description');
?>
<br />
<textarea id="edit-menu-item-description-<?php
echo $item_id;
?>
" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php
echo $item_id;
?>
]"><?php
echo esc_html($item->description);
// textarea_escaped
?>
</textarea>
<span class="description"><?php
_e('The description will be displayed in the menu if the current theme supports it.');
?>
</span>
</label>
</p>
<?php
echo Fac()->getMenuIcons()->renderCustomNavFields($item_id, $item);
?>
<p class="field-move hide-if-no-js description description-wide">
<label>
<span><?php
_e('Move');
?>
</span>
<a href="#" class="menus-move menus-move-up" data-dir="up"><?php
_e('Up one');
?>
</a>
<a href="#" class="menus-move menus-move-down" data-dir="down"><?php
_e('Down one');
?>
</a>
<a href="#" class="menus-move menus-move-left" data-dir="left"></a>
<a href="#" class="menus-move menus-move-right" data-dir="right"></a>
<a href="#" class="menus-move menus-move-top" data-dir="top"><?php
_e('To the top');
?>
</a>
</label>
</p>
<div class="menu-item-actions description-wide submitbox">
<?php
if ('custom' != $item->type && $original_title !== false) {
?>
<p class="link-to-original">
<?php
printf(__('Original: %s'), '<a href="' . esc_attr($item->url) . '">' . esc_html($original_title) . '</a>');
示例8: Fac
$args->settings = $obj;
$args->fieldSet = Fac()->getSettings()->getRecursiveCallable(!empty($obj->getConfig()->fieldSet) ? $obj->objectToArray($obj->getConfig()->fieldSet) : NULL);
$args->fields = !empty($args->settings->getConfig()->shortcodes->elements->{$key}->fields) ? $obj->objectToArray($args->settings->getConfig()->shortcodes->elements->{$key}->fields) : NULL;
?>
<h1>Font Awesome Constructor</h1>
<div class="fac-constructor-wrapper">
<div class="faccw-column">
<?php
echo Fac()->getTemplate('admin/constructor/form/element-list', $args);
?>
<?php
echo Fac()->getTemplate('admin/constructor/form/element-params', $args);
?>
</div>
<div class="faccw-column faccw-preview">
<div class="faccw-preview-area">
<?php
echo Fac()->getTemplate('admin/constructor/form/element-preview', $args);
?>
<div class="fac-constructor-controls">
<a class="fac-constructor-apply button button-primary" href="javascript:void(0);" >Insert</a>
<a class="fac-constructor-preview-button button button-primary" href="javascript:void(0);" >Preview</a>
</div>
</div>
</div>
</div>
示例9: viewTaxIconMetabox
public function viewTaxIconMetabox($tag)
{
if (!empty($tag->term_id)) {
$data = $this->getTaxIcon($tag->term_id);
$atts = array('icon' => !empty($data['icon']) ? $data['icon'] : '', 'position' => !empty($data['position']) ? $data['position'] : 'left');
$template = 'icons-edit';
} else {
$atts = array();
$template = 'icons-add';
}
echo Fac()->getTemplate("taxonomies/{$template}", $atts);
}
示例10: Fac
<?php
$args = $params;
$elementList = Fac()->getSettings()->getElementList();
$customElementList = Fac()->getCustomElements();
$sliderElementList = Fac()->getSliderElements();
?>
<div class="fac-constructor-type">
<h2>Elements</h2>
<select class="fac-constructor-type-select widefat">
<option value="0"></option>
<optgroup label="Basic">
<?php
foreach ($elementList as $k => $v) {
if ($k != 'fac_blank') {
$selected = $args->key == $k || empty($args->key) && empty($k);
?>
<option value="<?php
echo $k;
?>
"<?php
selected($selected);
?>
><?php
echo $v;
?>
</option>
<?php
}
}
?>
示例11: Fac
<?php
$version = Fac()->getIconRepository()->getVersion();
?>
<div class="fac fac-version-template">
Font Awesome Version <span><?php
echo $version;
?>
</span>
</div>
示例12: stdClass
$args = new stdClass();
$args->settings = $params;
$args->key = isset($_GET['tab']) ? $_GET['tab'] : 'fac-global-settings';
$args->tabs = $args->settings->getTabs();
$args->fieldSet = $args->settings->getFieldSet();
$args->data = $args->settings->getSettings($args->key);
$args->fields = $args->settings->getFields($args->key);
$title = !empty($args->settings->getConfig()->admin->options->title) ? $args->settings->getConfig()->admin->options->title : '';
if (!empty($title)) {
?>
<div style="width: 100%; padding: 20px 0 0;">
<table>
<tr style="vertical-align: middle;">
<td style="padding: 0 20px 0 0;">
<img src="<?php
echo Fac()->getAssetUrl('images/icon-128x128.png');
?>
" width="100" height="100" />
</td>
<td>
<h1 style="margin: 0px; padding: 0 0 10px;"><?php
echo $title;
?>
</h1>
<p style="margin: 0px; padding: 0 0 5px;">How to use those features you can find on the <a href="https://wordpress.org/plugins/agp-font-awesome-collection/" target="_blank"><strong>Plugin Page</strong></a> in the <a href="https://wordpress.org/plugins/agp-font-awesome-collection/faq/" target="_blank"><strong>FAQ</strong></a> and <a href="https://wordpress.org/plugins/agp-font-awesome-collection/screenshots/" target="_blank"><strong>Screenshots</strong></a> sections.</p>
<p style="margin: 0px; padding: 0;">Also You can find <a href="http://www.profosbox.com/" target="_blank"><strong>Live Demo</strong></a> on the plugin site.</p>
</td>
</tr>
</table>
</div>
<?php
示例13: array
<?php
if (!empty($params['post'])) {
$post = $params['post'];
$name = !empty($params['name']) ? $params['name'] : 'fac_slider_' . $post->ID;
$type = !empty($params['type']) ? $params['type'] : 'default';
$sliderTypes = !empty($params['sliderTypes']) ? $params['sliderTypes'] : array();
$nonce = wp_create_nonce(basename(Fac()->getBaseDir()));
?>
<input type="hidden" name="fac_slider_noncename" id="fac_slider_noncename" value="<?php
echo $nonce;
?>
" />
<table class="widefat" width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td>
<label for="fac_slider_parameters_name"><strong>Shortcode Name</strong></label>
<input type="text" id="fac_slider_parameters_name" name="_name" value="<?php
echo $name;
?>
" class="widefat" />
</td>
</tr>
<tr>
<td>
<label for="fac_slider_parameters_type"><strong>Slider Type</strong></label>
<select class="widefat" id="fac_slider_parameters_type" name="_type" >
<?php
foreach ($sliderTypes as $k => $v) {
$selected = !empty($type) && $type == $k;
示例14: doSliderShortcode
public function doSliderShortcode($atts, $content, $tag)
{
global $post;
$content = '';
$args = array('post_type' => 'fac-sliders', 'posts_per_page' => -1, 'meta_query' => array(array('key' => '_name', 'value' => array($tag), 'compare' => 'IN')));
$query = new WP_Query($args);
while ($query->have_posts()) {
$query->the_post();
$post_id = get_the_ID();
$template = 'sliders/' . Fac()->getSlider()->getSliderType($post_id) . '/layout';
$data = $this->slider->getData($post_id);
$content .= $this->getTemplate($template, array('data' => $data, 'post_id' => $post_id));
}
wp_reset_query();
return $content;
}
示例15: renderCustomNavFields
/**
* Render custom nav fields
*
* @param type $item_id
* @param type $item
* @return type
*/
public function renderCustomNavFields($item_id, $item)
{
ob_start();
$categories = Fac()->getIconRepository()->getAllCategories();
$selected = !empty($item->menuIcon) ? esc_attr($item->menuIcon) : '';
?>
<p class="field-custom description description-wide">
<label for="edit-menu-item-menuIcon-<?php
echo $item_id;
?>
">
<?php
_e('Menu Icon');
?>
<br />
<select style="font-family:FontAwesome, Arial;" id="edit-menu-item-menuIcon-<?php
echo $item_id;
?>
" class="widefat code edit-menu-item-custom" name="menu-item-menuIcon[<?php
echo $item_id;
?>
]">
<option value=""></option>
<?php
foreach ($categories as $category) {
?>
<optgroup label="<?php
echo $category;
?>
">
<?php
$icons = Fac()->getIconRepository()->getAllByCategory($category);
foreach ($icons as $icon) {
?>
<option style="font-family:FontAwesome, Arial;" data-icon="fa-<?php
echo $icon->getId();
?>
" value="<?php
echo $icon->getId();
?>
"<?php
selected($icon->getId(), $selected);
?>
>
&#x<?php
echo $icon->getUnicode();
?>
; <?php
echo $icon->getName();
?>
</option>
<?php
}
?>
</optgroup>
<?php
}
?>
</select>
</label>
</p>
<?php
return ob_get_clean();
}