本文整理汇总了PHP中siteorigin_panels_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP siteorigin_panels_setting函数的具体用法?PHP siteorigin_panels_setting怎么用?PHP siteorigin_panels_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了siteorigin_panels_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pp_page_builder_pootle_text_widget_admin_enqueue
/**
* Enqueue all the admin scripts for Black Studio TinyMCE compatibility with Page Builder.
*
* @param $page
*/
function pp_page_builder_pootle_text_widget_admin_enqueue($page)
{
$screen = get_current_screen();
if ($screen->base == 'post' && in_array($screen->id, siteorigin_panels_setting('post-types')) || $screen->base == 'appearance_page_so_panels_home_page') {
global $pootle_text_widget_version;
if (!isset($pootle_text_widget_version)) {
// if ( function_exists( 'black_studio_tinymce_get_version' ) ) {
// $pootle_text_widget_version = black_studio_tinymce_get_version();
//}
$pootle_text_widget_version = '1.0.0';
}
// if ( version_compare( $pootle_text_widget_version, '1.3.3', '<=' ) ) {
// // Use the old compatibility file.
// pootle-text-widget is based on black-studio 1.3.3
wp_enqueue_script('pootle-text-widget-pp-page-builder', plugin_dir_url(POOTLEPAGE_BASE_FILE) . 'widgets/compat/pootle-text-widget/pootle-text-widget-pp-page-builder.old.js', array('jquery'), POOTLEPAGE_VERSION);
// }
// else {
// Use the new compatibility file
// wp_enqueue_script( 'pootle-text-widget-pp-page-builder', plugin_dir_url( POOTLEPAGE_BASE_FILE ) . 'widgets/compat/pootle-text-widget/pootle-text-widget-pp-page-builder.min.js', array( 'jquery' ), POOTLEPAGE_VERSION );
// }
wp_enqueue_style('pootle-text-widget-pp-page-builder', plugin_dir_url(POOTLEPAGE_BASE_FILE) . 'widgets/compat/pootle-text-widget/pootle-text-widget-pp-page-builder.css', array(), POOTLEPAGE_VERSION);
// if ( version_compare( $pootle_text_widget_version, '1.2.0', '<=' ) ) {
// // We also need a modified javascript for older versions of Black Studio TinyMCE
// wp_enqueue_script( 'black-studio-tinymce-widget', plugin_dir_url( POOTLEPAGE_BASE_FILE ) . 'widgets/compat/pootle-text-widget/pootle-text-widget.min.js', array( 'jquery' ), POOTLEPAGE_VERSION );
// }
}
}
示例2: siteorigin_panels_black_studio_tinymce_admin_enqueue
/**
* Enqueue all the admin scripts for Black Studio TinyMCE compatibility with Page Builder.
*
* @param $page
*/
function siteorigin_panels_black_studio_tinymce_admin_enqueue($page)
{
$screen = get_current_screen();
if ($screen->base == 'post' && in_array($screen->id, siteorigin_panels_setting('post-types')) || $screen->base == 'appearance_page_so_panels_home_page') {
wp_enqueue_script('black-studio-tinymce-widget-siteorigin-panels', plugin_dir_url(SITEORIGIN_PANELS_BASE_FILE) . 'widgets/compat/black-studio-tinymce/black-studio-tinymce-widget-siteorigin-panels.min.js', array('jquery'), SITEORIGIN_PANELS_VERSION);
wp_enqueue_style('black-studio-tinymce-widget-siteorigin-panels', plugin_dir_url(SITEORIGIN_PANELS_BASE_FILE) . 'widgets/compat/black-studio-tinymce/black-studio-tinymce-widget-siteorigin-panels.css', array(), SITEORIGIN_PANELS_VERSION);
global $black_studio_tinymce_widget_version;
if (version_compare($black_studio_tinymce_widget_version, '1.2.0', '<=')) {
// We also need a modified javascript for older versions of Black Studio TinyMCE
wp_enqueue_script('black-studio-tinymce-widget', plugin_dir_url(SITEORIGIN_PANELS_BASE_FILE) . 'widgets/compat/black-studio-tinymce/black-studio-tinymce-widget.min.js', array('jquery'), SITEORIGIN_PANELS_VERSION);
}
}
}
示例3: siteorigin_panels_default_styles_register_scripts
/**
* Register the custom styles scripts
*/
function siteorigin_panels_default_styles_register_scripts()
{
wp_register_script('siteorigin-panels-front-styles', plugin_dir_url(SITEORIGIN_PANELS_BASE_FILE) . 'js/styling' . SITEORIGIN_PANELS_JS_SUFFIX . '.js', array('jquery'), SITEORIGIN_PANELS_VERSION);
wp_localize_script('siteorigin-panels-front-styles', 'panelsStyles', array('fullContainer' => apply_filters('siteorigin_panels_full_width_container', siteorigin_panels_setting('full-width-container'))));
// Check if we need to enqueue the front styles
if (is_singular() && get_post_meta(get_the_ID(), 'panels_data', true) != '') {
$panels_data = get_post_meta(get_the_ID(), 'panels_data', true);
if (!empty($panels_data['grids'])) {
foreach ($panels_data['grids'] as $grid) {
if (empty($grid['style']['row_stretch'])) {
continue;
}
wp_enqueue_script('siteorigin-panels-front-styles');
break;
}
}
}
}
示例4: siteorigin_panels_add_recommended_widgets
/**
* Add some default recommended widgets.
*
* @param $widgets
*
* @return array
*/
function siteorigin_panels_add_recommended_widgets($widgets)
{
if (empty($widgets['WP_Widget_Black_Studio_TinyMCE'])) {
if (siteorigin_panels_setting('recommended-widgets')) {
$widgets['WP_Widget_Black_Studio_TinyMCE'] = array('class' => 'WP_Widget_Black_Studio_TinyMCE', 'title' => __('Visual Editor', 'siteorigin-panels'), 'description' => __('Arbitrary text or HTML with visual editor', 'siteorigin-panels'), 'installed' => false, 'plugin' => array('name' => __('Black Studio TinyMCE', 'siteorigin-panels'), 'slug' => 'black-studio-tinymce-widget'), 'groups' => array('recommended'), 'icon' => 'dashicons dashicons-edit');
}
} else {
$widgets['WP_Widget_Black_Studio_TinyMCE']['groups'] = array('recommended');
$widgets['WP_Widget_Black_Studio_TinyMCE']['icon'] = 'dashicons dashicons-edit';
}
if (siteorigin_panels_setting('recommended-widgets')) {
// Add in all the widgets bundle widgets
$widgets = wp_parse_args($widgets, include plugin_dir_path(__FILE__) . '/widgets-bundle.php');
}
foreach ($widgets as $class => $data) {
if (strpos($class, 'SiteOrigin_Panels_Widgets_') === 0 || strpos($class, 'SiteOrigin_Panels_Widget_') === 0) {
$widgets[$class]['groups'] = array('panels');
}
}
$widgets['SiteOrigin_Panels_Widgets_Layout']['icon'] = 'dashicons dashicons-analytics';
$wordpress_widgets = array('WP_Widget_Pages', 'WP_Widget_Links', 'WP_Widget_Search', 'WP_Widget_Archives', 'WP_Widget_Meta', 'WP_Widget_Calendar', 'WP_Widget_Text', 'WP_Widget_Categories', 'WP_Widget_Recent_Posts', 'WP_Widget_Recent_Comments', 'WP_Widget_RSS', 'WP_Widget_Tag_Cloud', 'WP_Nav_Menu_Widget');
foreach ($wordpress_widgets as $wordpress_widget) {
if (isset($widgets[$wordpress_widget])) {
$widgets[$wordpress_widget]['groups'] = array('wordpress');
$widgets[$wordpress_widget]['icon'] = 'dashicons dashicons-wordpress';
}
}
// Third-party plugins dettection.
foreach ($widgets as $widget_id => &$widget) {
if (strpos($widget_id, 'WC_') === 0 || strpos($widget_id, 'WooCommerce') !== FALSE) {
$widget['groups'][] = 'woocommerce';
}
if (strpos($widget_id, 'BBP_') === 0 || strpos($widget_id, 'BBPress') !== FALSE) {
$widget['groups'][] = 'bbpress';
}
if (strpos($widget_id, 'Jetpack') !== FALSE || strpos($widget['title'], 'Jetpack') !== FALSE) {
$widget['groups'][] = 'jetpack';
}
}
return $widgets;
}
示例5: siteorigin_panels_content_save_pre
/**
* Filter content before we save it.
*
* @param $content
* @return array|mixed|string
* @filter content_save_pre
*/
function siteorigin_panels_content_save_pre($content)
{
global $post;
if (!siteorigin_panels_setting('copy-content')) {
return $content;
}
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $content;
}
if (empty($_POST['_sopanels_nonce']) || !wp_verify_nonce($_POST['_sopanels_nonce'], 'save')) {
return $content;
}
if (empty($_POST['panels_js_complete'])) {
return $content;
}
if (empty($post) || !current_user_can('edit_post', $post->ID)) {
return $content;
}
if (empty($_POST['grids']) || empty($_POST['grid_cells']) || empty($_POST['widgets']) || empty($_POST['panel_order'])) {
return $content;
}
$data['grids'] = $_POST['grids'];
$data['grid_cells'] = $_POST['grid_cells'];
$data['widgets'] = $_POST['widgets'];
$data['panel_order'] = $_POST['panel_order'];
$data['action'] = 'siteorigin_panels_get_post_content';
$data['post_id'] = (string) $post->ID;
$data['widgets'] = array_map('stripslashes_deep', $data['widgets']);
$data['_signature'] = sha1(NONCE_SALT . serialize($data));
// This can cause a fatal error, so handle in a separate request.
$request = wp_remote_post(admin_url('admin-ajax.php?action=siteorigin_panels_get_post_content'), array('method' => 'POST', 'timeout' => 5, 'redirection' => 0, 'body' => $data));
if (!is_wp_error($request) && $request['response']['code'] == 200 && !empty($request['body'])) {
$content = $request['body'];
}
return $content;
}
示例6: siteorigin_panels_transfer_home_page
/**
* Transfer theme data into new settings
*/
function siteorigin_panels_transfer_home_page()
{
if (get_option('siteorigin_panels_home_page', false) === false && get_theme_mod('panels_home_page', false) !== false) {
// Transfer settings from theme mods into settings
update_option('siteorigin_panels_home_page', get_theme_mod('panels_home_page', false));
update_option('siteorigin_panels_home_page_enabled', get_theme_mod('panels_home_page_enabled', false));
// Remove the theme mod data
remove_theme_mod('panels_home_page');
remove_theme_mod('panels_home_page_enabled');
}
// Transfer the home page setting to a page
if (!get_option('siteorigin_panels_home_page_id') && get_option('siteorigin_panels_home_page') && siteorigin_panels_setting('home-page')) {
// Lets create a new page
$page_id = wp_insert_post(array('post_title' => __('Home', 'siteorigin-panels'), 'post_status' => get_option('siteorigin_panels_home_page_enabled') ? 'publish' : 'draft', 'post_type' => 'page', 'comment_status' => 'closed'));
update_post_meta($page_id, 'panels_data', get_option('siteorigin_panels_home_page'));
update_post_meta($page_id, '_wp_page_template', siteorigin_panels_setting('home-template'));
update_option('siteorigin_panels_home_page_id', $page_id);
if (get_option('siteorigin_panels_home_page_enabled')) {
// Lets make this page the home page
update_option('show_on_front', 'page');
update_option('page_on_front', $page_id);
}
}
}
示例7: siteorigin_panels_black_studio_tinymce_admin_enqueue
/**
* Enqueue all the admin scripts for Black Studio TinyMCE compatibility with Page Builder.
*
* @param $page
*/
function siteorigin_panels_black_studio_tinymce_admin_enqueue($page)
{
$screen = get_current_screen();
if ($screen->base == 'post' && in_array($screen->id, siteorigin_panels_setting('post-types')) || $screen->base == 'appearance_page_so_panels_home_page') {
global $black_studio_tinymce_widget_version;
if (!isset($black_studio_tinymce_widget_version)) {
if (function_exists('black_studio_tinymce_get_version')) {
$black_studio_tinymce_widget_version = black_studio_tinymce_get_version();
}
}
if (version_compare($black_studio_tinymce_widget_version, '1.3.3', '<=')) {
// Use the old compatibility file.
wp_enqueue_script('black-studio-tinymce-widget-siteorigin-panels', plugin_dir_url(POOTLEPAGE_BASE_FILE) . 'widgets/compat/black-studio-tinymce/black-studio-tinymce-widget-siteorigin-panels.old.min.js', array('jquery'), POOTLEPAGE_VERSION);
} else {
// Use the new compatibility file
wp_enqueue_script('black-studio-tinymce-widget-siteorigin-panels', plugin_dir_url(POOTLEPAGE_BASE_FILE) . 'widgets/compat/black-studio-tinymce/black-studio-tinymce-widget-siteorigin-panels.min.js', array('jquery'), POOTLEPAGE_VERSION);
}
wp_enqueue_style('black-studio-tinymce-widget-siteorigin-panels', plugin_dir_url(POOTLEPAGE_BASE_FILE) . 'widgets/compat/black-studio-tinymce/black-studio-tinymce-widget-siteorigin-panels.css', array(), POOTLEPAGE_VERSION);
if (version_compare($black_studio_tinymce_widget_version, '1.2.0', '<=')) {
// We also need a modified javascript for older versions of Black Studio TinyMCE
wp_enqueue_script('black-studio-tinymce-widget', plugin_dir_url(POOTLEPAGE_BASE_FILE) . 'widgets/compat/black-studio-tinymce/black-studio-tinymce-widget.min.js', array('jquery'), POOTLEPAGE_VERSION);
}
}
}
示例8: _e
?>
</a></li>
<?php
}
?>
<li><a href="#directory"><?php
_e('Layouts Directory', 'siteorigin-panels');
?>
</a></li>
<li><a href="#import"><?php
_e('Import/Export', 'siteorigin-panels');
?>
</a></li>
<?php
$post_types = siteorigin_panels_setting('post-types');
foreach ($post_types as $post_type) {
$type = get_post_type_object($post_type);
if (empty($type)) {
continue;
}
?>
<li><a href="#<?php
echo 'clone_' . $post_type;
?>
"><?php
printf(__('Clone: %s', 'siteorigin-panels'), $type->labels->name);
?>
</a></li><?php
}
?>
示例9: apply_filters
<?php
global $wp_widget_factory;
$layouts = apply_filters('siteorigin_panels_prebuilt_layouts', array());
?>
<div id="panels" data-animations="<?php
echo siteorigin_panels_setting('animations') ? 'true' : 'false';
?>
">
<?php
do_action('siteorigin_panels_before_interface');
?>
<div id="panels-container">
</div>
<div id="add-to-panels">
<button class="panels-add" data-tooltip="<?php
esc_attr_e('Add Widget', 'siteorigin-panels');
?>
"><?php
_e('Add Widget', 'siteorigin-panels');
?>
</button>
<button class="grid-add" data-tooltip="<?php
esc_attr_e('Add Row', 'siteorigin-panels');
?>
"><?php
_e('Add Row', 'siteorigin-panels');
示例10: siteorigin_panels_display_premium_teaser
/**
* Display one of the premium or contribution teasers
*/
function siteorigin_panels_display_premium_teaser()
{
if (siteorigin_panels_setting('display-teaser') && apply_filters('siteorigin_premium_upgrade_teaser', true) && !defined('SITEORIGIN_PREMIUM_VERSION')) {
$links = array(array(__('Page Builder Addons', 'siteorigin-panels'), __('Addons', 'siteorigin-panels'), siteorigin_panels_premium_url()), array(__('Contribute to Page Builder', 'siteorigin-panels'), __('Contribute', 'siteorigin-panels'), 'http://siteorigin.com/downloads/contribution/'));
$i = floor(time() / (30 * 60)) % count($links);
if (!empty($links[$i])) {
?>
<a class="so-tool-button so-siteorigin-premium" title="<?php
echo esc_attr($links[$i][0]);
?>
" href="<?php
echo esc_url($links[$i][2]);
?>
" target="_blank">
<span class="so-panels-icon so-panels-icon-plus"></span>
<span class="so-button-text"><?php
echo esc_html($links[$i][1]);
?>
</span>
</a>
<?php
}
}
}
示例11: siteorigin_panels_live_edit_link
function siteorigin_panels_live_edit_link($wp_admin_bar)
{
// Add a Live Edit link if this is a Page Builder page that the user can edit
if (siteorigin_panels_setting('live-editor-quick-link') && is_singular() && current_user_can('edit_post', get_the_ID()) && get_post_meta(get_the_ID(), 'panels_data', true)) {
$wp_admin_bar->add_node(array('id' => 'so_live_editor', 'title' => __('Live Editor', 'siteorigin-panels'), 'href' => add_query_arg('so_live_editor', 1, get_edit_post_link(get_the_ID())), 'meta' => array('class' => 'live-edit-page')));
}
}
示例12: siteorigin_panels_admin_bar_menu
/**
* Add the Edit Home Page item to the admin bar.
*
* @param WP_Admin_Bar $admin_bar
* @return WP_Admin_Bar
*/
function siteorigin_panels_admin_bar_menu($admin_bar)
{
// Ignore this unless the theme is using the home page feature.
if (!siteorigin_panels_setting('home-page')) {
return $admin_bar;
}
if (!current_user_can('edit_theme_options')) {
return $admin_bar;
}
if (is_home() || is_front_page()) {
if (is_page() && get_post_meta(get_the_ID(), 'panels_data', true) !== '' || !is_page()) {
$admin_bar->add_node(array('id' => 'edit-home-page', 'title' => __('Edit Home Page', 'siteorigin-panels'), 'href' => admin_url('themes.php?page=so_panels_home_page')));
if (is_page()) {
// Remove the standard edit button
$admin_bar->remove_node('edit');
}
}
}
return $admin_bar;
}
示例13: display_field
/**
* Display a settings field
*
* @param $field_id
* @param $field
*/
function display_field($field_id, $field)
{
$value = siteorigin_panels_setting($field_id);
$field_name = 'panels_setting[' . $field_id . ']';
switch ($field['type']) {
case 'text':
?>
<input name="<?php
echo esc_attr($field_name);
?>
" class="panels-setting-<?php
echo esc_attr($field['type']);
?>
" type="text" value="<?php
echo esc_attr($value);
?>
" /> <?php
break;
case 'number':
?>
<input name="<?php
echo esc_attr($field_name);
?>
" type="number" class="panels-setting-<?php
echo esc_attr($field['type']);
?>
" value="<?php
echo esc_attr($value);
?>
" />
<?php
if (!empty($field['unit'])) {
echo esc_html($field['unit']);
}
break;
case 'html':
?>
<textarea name="<?php
echo esc_attr($field_name);
?>
" class="panels-setting-<?php
echo esc_attr($field['type']);
?>
widefat" rows="<?php
echo !empty($field['rows']) ? intval($field['rows']) : 2;
?>
"><?php
echo esc_textarea($value);
?>
</textarea> <?php
break;
case 'checkbox':
?>
<label class="widefat">
<input name="<?php
echo esc_attr($field_name);
?>
" type="checkbox" <?php
checked(!empty($value));
?>
/>
<?php
echo !empty($field['checkbox_text']) ? esc_html($field['checkbox_text']) : __('Enabled', 'siteorigin-panels');
?>
</label>
<?php
break;
case 'select':
?>
<select name="<?php
echo esc_attr($field_name);
?>
">
<?php
foreach ($field['options'] as $option_id => $option) {
?>
<option value="<?php
echo esc_attr($option_id);
?>
" <?php
selected($option_id, $value);
?>
><?php
echo esc_html($option);
?>
</option>
<?php
}
?>
</select>
<?php
break;
case 'select_multi':
foreach ($field['options'] as $option_id => $option) {
//.........这里部分代码省略.........
示例14: so_panels_bootstrap_css_object
function so_panels_bootstrap_css_object($css, $panels_data = null, $post_id = null)
{
$settings = siteorigin_panels_setting();
$panels_mobile_width = $settings['mobile-width'];
$panels_margin_bottom = $settings['margin-bottom'];
$css = new SiteOrigin_Panels_Css_Builder();
foreach ($panels_data['grids'] as $gi => $grid) {
$cell_count = intval($grid['cells']);
if ($gi != count($panels_data['grids']) - 1) {
// Filter the bottom margin for this row with the arguments
$css->add_row_css($post_id, $gi, '', array('margin-bottom' => apply_filters('siteorigin_panels_css_row_margin_bottom', $panels_margin_bottom . 'px', $grid, $gi, $panels_data, $post_id)));
}
if ($cell_count > 1) {
$css->add_cell_css($post_id, $gi, false, '', array('float' => !is_rtl() ? 'left' : 'right'));
}
if ($settings['responsive']) {
for ($i = 0; $i < $cell_count; $i++) {
if ($i != $cell_count - 1) {
$css->add_cell_css($post_id, $gi, $i, '', array('margin-bottom' => $panels_margin_bottom . 'px'), $panels_mobile_width);
}
}
}
}
// Add the bottom margins
$css->add_cell_css($post_id, false, false, '.so-panel', array('margin-bottom' => apply_filters('siteorigin_panels_css_cell_margin_bottom', $panels_margin_bottom . 'px', $grid, $gi, $panels_data, $post_id)));
$css->add_cell_css($post_id, false, false, '.so-panel:last-child', array('margin-bottom' => apply_filters('siteorigin_panels_css_cell_last_margin_bottom', '0px', $grid, $gi, $panels_data, $post_id)));
foreach ($panels_data['grids'] as $gi => $grid) {
// Rows with only one cell don't need gutters
if ($grid['cells'] <= 1) {
continue;
}
// Let other themes and plugins change the gutter.
$gutter = apply_filters('siteorigin_panels_css_row_gutter', $settings['margin-sides'] . 'px', $grid, $gi, $panels_data);
if (!empty($gutter)) {
// We actually need to find half the gutter.
preg_match('/([0-9\\.,]+)(.*)/', $gutter, $match);
if (!empty($match[1])) {
$margin_half = floatval($match[1]) / 2 . $match[2];
$css->add_row_css($post_id, $gi, '', array('margin-left' => '-' . $margin_half, 'margin-right' => '-' . $margin_half));
$css->add_cell_css($post_id, $gi, false, '', array('padding-left' => $margin_half, 'padding-right' => $margin_half));
}
}
}
// Let other plugins and components filter the CSS object.
$css = apply_filters('so_panels_bootstrap_css_object', $css, $panels_data, $post_id);
return $css;
}
示例15: siteorigin_premium_display_teaser
function siteorigin_premium_display_teaser()
{
return siteorigin_panels_setting('display-teaser') && apply_filters('siteorigin_premium_upgrade_teaser', true) && !defined('SITEORIGIN_PREMIUM_VERSION');
}