本文整理汇总了PHP中Kirki_Toolkit类的典型用法代码示例。如果您正苦于以下问题:PHP Kirki_Toolkit类的具体用法?PHP Kirki_Toolkit怎么用?PHP Kirki_Toolkit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Kirki_Toolkit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: to_json
public function to_json()
{
parent::to_json();
$this->json['choices'] = array();
if (is_array($this->choices)) {
if (isset($this->choices['top']) && true == $this->choices['top']) {
$this->json['choices']['top'] = true;
}
if (isset($this->choices['bottom']) && true == $this->choices['bottom']) {
$this->json['choices']['bottom'] = true;
}
if (isset($this->choices['left']) && true == $this->choices['left']) {
$this->json['choices']['left'] = true;
}
if (isset($this->choices['right']) && true == $this->choices['right']) {
$this->json['choices']['right'] = true;
}
}
$i18n = Kirki_Toolkit::i18n();
$this->json['l10n'] = array('top' => $i18n['top'], 'bottom' => $i18n['bottom'], 'left' => $i18n['left'], 'right' => $i18n['right']);
if (isset($this->json['choices']['top']) && !isset($this->json['value']['top'])) {
$this->json['value']['top'] = $this->json['default']['top'];
}
if (isset($this->json['choices']['bottom']) && !isset($this->json['value']['bottom'])) {
$this->json['value']['bottom'] = $this->json['default']['bottom'];
}
if (isset($this->json['choices']['left']) && !isset($this->json['value']['left'])) {
$this->json['value']['left'] = $this->json['default']['left'];
}
if (isset($this->json['choices']['right']) && !isset($this->json['value']['top'])) {
$this->json['value']['right'] = $this->json['default']['right'];
}
}
示例2: get_instance
/**
* Access the single instance of this class
* @return Kirki
*/
public static function get_instance()
{
if (null == self::$instance) {
self::$instance = new Kirki_Toolkit();
}
return self::$instance;
}
示例3: get_instance
/**
* Access the single instance of this class.
*
* @static
* @access public
* @return object Kirki_Toolkit.
*/
public static function get_instance()
{
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
示例4: to_json
public function to_json()
{
parent::to_json();
$this->json['choices'] = is_array($this->choices) ? array('top' => in_array('top', $this->choices) ? true : false, 'bottom' => in_array('bottom', $this->choices) ? true : false, 'left' => in_array('left', $this->choices) ? true : false, 'right' => in_array('right', $this->choices) ? true : false, 'units' => isset($this->choices['units']) ? $this->choices['units'] : false) : array();
$i18n = Kirki_Toolkit::i18n();
$this->json['l10n'] = array('top' => $i18n['top'], 'bottom' => $i18n['bottom'], 'left' => $i18n['left'], 'right' => $i18n['right']);
}
示例5: Kirki
/**
* Returns the Kirki object
*/
function Kirki()
{
// Make sure the class is instanciated
$kirki = Kirki_Toolkit::get_instance();
// The path of the current Kirki instance
Kirki::$path = dirname(__FILE__);
return $kirki;
}
示例6: to_json
public function to_json()
{
parent::to_json();
$i18n = Kirki_Toolkit::i18n();
$this->json['choices'] = empty($this->choices) || !is_array($this->choices) ? array() : $this->choices;
$this->json['choices']['on'] = isset($this->choices['on']) ? $this->choices['on'] : $i18n['on'];
$this->json['choices']['off'] = isset($this->choices['off']) ? $this->choices['off'] : $i18n['off'];
$this->json['choices']['round'] = isset($this->choices['round']) ? $this->choices['round'] : false;
}
示例7: to_json
public function to_json()
{
parent::to_json();
$i18n = Kirki_Toolkit::i18n();
$this->json['fonts'] = $this->get_all_fonts();
$value = $this->value();
$this->json['value'] = array('bold' => isset($value['bold']) ? $value['bold'] : false, 'italic' => isset($value['italic']) ? $value['italic'] : false, 'underline' => isset($value['underline']) ? $value['underline'] : false, 'strikethrough' => isset($value['strikethrough']) ? $value['strikethrough'] : false, 'font-family' => isset($value['font-family']) ? $value['font-family'] : '', 'font-size' => isset($value['font-size']) ? $value['font-size'] : '', 'font-weight' => isset($value['font-weight']) ? $value['font-weight'] : '', 'line-height' => isset($value['line-height']) ? $value['line-height'] : '', 'letter-spacing' => isset($value['letter-spacing']) ? $value['letter-spacing'] : '', 'color' => isset($value['color']) ? $value['color'] : '');
$this->json['l10n'] = array('font-family' => $i18n['font-family'], 'font-size' => $i18n['font-size'], 'font-weight' => $i18n['font-weight'], 'line-height' => $i18n['line-height'], 'letter-spacing' => $i18n['letter-spacing'], 'color' => $i18n['color']);
}
示例8: Kirki
/**
* Returns the Kirki object
*/
function Kirki()
{
// Make sure the class is instanciated
$kirki = Kirki_Toolkit::get_instance();
$kirki->font_registry = new Kirki_Fonts_Font_Registry();
$kirki->scripts = new Kirki_Scripts_Registry();
$kirki->api = new Kirki();
$kirki->styles = array('back' => new Kirki_Styles_Customizer(), 'front' => new Kirki_Styles_Frontend());
return $kirki;
}
示例9: enqueue_customizer_control_script
/**
* Helper that enqueues a script for a control.
*
* Every Kirki Control should use this function to enqueue
* its main JS file (not dependencies like jQuery or jQuery UI).
*
* These files are only enqueued when debugging Kirki
*
* @param string $handle
* @param string $file
* @param array $deps
*/
public static function enqueue_customizer_control_script($handle, $file = null, $deps = array(), $in_footer = false)
{
if (false !== strpos($file, 'controls/') && Kirki_Toolkit::kirki_debug() || false === strpos($file, 'controls/')) {
$file = trailingslashit(Kirki::$url) . 'assets/js/' . $file . '.js';
foreach ($deps as $dep) {
wp_enqueue_script($dep);
}
// We are debugging, no need of version or suffix
wp_enqueue_script($handle, $file, $deps, '', $in_footer);
}
}
示例10: to_json
public function to_json()
{
parent::to_json();
$i18n = Kirki_Toolkit::i18n();
$this->choices = empty($this->choices) || !is_array($this->choices) ? array() : $this->choices;
$this->choices['on'] = isset($this->choices['on']) ? $this->choices['on'] : $i18n['on'];
$this->choices['off'] = isset($this->choices['off']) ? $this->choices['off'] : $i18n['off'];
$this->json['id'] = $this->id;
$this->json['value'] = $this->value();
$this->json['choices'] = $this->choices;
$this->json['link'] = $this->get_link();
}
示例11: test_kirki_fonts
public function test_kirki_fonts()
{
$this->assertEquals(Kirki_Fonts::get_all_fonts(), Kirki_Toolkit::fonts()->get_all_fonts());
$this->assertEquals(Kirki_Fonts::get_font_choices(), Kirki_Toolkit::fonts()->get_font_choices());
$this->assertEquals(Kirki_Fonts::is_google_font('Open Sans'), Kirki_Toolkit::fonts()->is_google_font('Open Sans'));
$this->assertEquals(Kirki_Fonts::get_google_font_uri(array('Roboto')), Kirki_Toolkit::fonts()->get_google_font_uri(array('Roboto')));
$this->assertEquals(Kirki_Fonts::get_google_font_subsets(), Kirki_Toolkit::fonts()->get_google_font_subsets());
$this->assertEquals(Kirki_Fonts::choose_google_font_variants('Roboto'), Kirki_Toolkit::fonts()->choose_google_font_variants('Roboto'));
$this->assertEquals(Kirki_Fonts::get_standard_fonts(), Kirki_Toolkit::fonts()->get_standard_fonts());
$this->assertEquals(Kirki_Fonts::get_font_stack(''), Kirki_Toolkit::fonts()->get_font_stack(''));
$this->assertEquals(Kirki_Fonts::sanitize_font_choice(''), Kirki_Toolkit::fonts()->sanitize_font_choice(''));
$this->assertEquals(Kirki_Fonts::get_google_fonts(), Kirki_Toolkit::fonts()->get_google_fonts());
}
示例12: to_json
public function to_json()
{
parent::to_json();
$fields = $this->fields;
$i18n = Kirki_Toolkit::i18n();
$default_image_button_labels = array('default' => $i18n['add-image'], 'remove' => $i18n['remove'], 'change' => $i18n['change-image'], 'placeholder' => $i18n['no-image-selected']);
foreach ($fields as $key => $field) {
if ($field['type'] != 'image') {
continue;
}
$fields[$key]['buttonLabels'] = $default_image_button_labels;
}
$this->json['fields'] = $fields;
}
示例13: Kirki
/**
* Returns the Kirki object
*/
function Kirki()
{
// Make sure the class is instanciated
$kirki = Kirki_Toolkit::get_instance();
$kirki->font_registry = new Kirki_Google_Fonts_Registry();
$kirki->api = new Kirki();
$kirki->scripts = new Kirki_Scripts_Registry();
$kirki->styles = array('back' => new Kirki_Styles_Customizer(), 'front' => new Kirki_Styles_Frontend());
/**
* The path of the current Kirki instance
*/
Kirki::$path = dirname(__FILE__);
return $kirki;
}
示例14: render_content
/**
* Render the control's content.
*/
protected function render_content()
{
?>
<?php
$i18n = Kirki_Toolkit::i18n();
?>
<label for="toggle_<?php
echo $this->id;
?>
">
<span class="customize-control-title">
<?php
echo esc_attr($this->label);
?>
<?php
if (!empty($this->description)) {
?>
<?php
// The description has already been sanitized in the Fields class, no need to re-sanitize it.
?>
<span class="description customize-control-description"><?php
echo $this->description;
?>
</span>
<?php
}
?>
</span>
</label>
<input name="toggle_<?php
echo $this->id;
?>
" id="toggle_<?php
echo $this->id;
?>
" type="checkbox" value="<?php
echo esc_attr($this->value());
?>
" <?php
$this->link();
checked($this->value());
?>
/>
<script>jQuery(document).ready(function($){$('[id="toggle_<?php
echo $this->id;
?>
"]').checkbox({toggle:true});});</script>
<?php
}
示例15: set_url
/**
* Properly set the Kirki URL for assets
* Determines if Kirki is installed as a plugin, in a child theme, or a parent theme
* and then does some calculations to get the proper URL for its CSS & JS assets
*
* @return string
*/
public function set_url()
{
/**
* Are we on a parent theme?
*/
if (Kirki_Toolkit::is_parent_theme(__FILE__)) {
$relative_url = str_replace(Kirki_Toolkit::clean_file_path(get_template_directory()), '', dirname(dirname(__FILE__)));
Kirki::$url = trailingslashit(get_template_directory_uri() . $relative_url);
} elseif (Kirki_Toolkit::is_child_theme(__FILE__)) {
$relative_url = str_replace(Kirki_Toolkit::clean_file_path(get_stylesheet_directory()), '', dirname(dirname(__FILE__)));
Kirki::$url = trailingslashit(get_stylesheet_directory_uri() . $relative_url);
} else {
Kirki::$url = plugin_dir_url(dirname(__FILE__) . 'kirki.php');
}
}