本文整理汇总了PHP中WPBakeryVisualComposerSettings类的典型用法代码示例。如果您正苦于以下问题:PHP WPBakeryVisualComposerSettings类的具体用法?PHP WPBakeryVisualComposerSettings怎么用?PHP WPBakeryVisualComposerSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WPBakeryVisualComposerSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDownloadUrl
protected function getDownloadUrl()
{
global $wp_filesystem;
$this->skin->feedback('download_envato');
$package_filename = 'js_composer.zip';
$res = $this->fs_connect(array(WP_CONTENT_DIR));
if (!$res) {
return new WP_Error('no_credentials', __("Error! Can't connect to filesystem", 'js_composer'));
}
$username = WPBakeryVisualComposerSettings::get('envato_username');
$api_key = WPBakeryVisualComposerSettings::get('envato_api_key');
$purchase_code = WPBakeryVisualComposerSettings::get('js_composer_purchase_code');
if (empty($username) || empty($api_key) || empty($purchase_code)) {
return new WP_Error('no_credentials', __('Error! Envato username, api key and your purchase code are required for downloading updates from Envato marketplace for the Visual Composer. Visit <a href="' . admin_url('options-general.php?page=wpb_vc_settings&tab=updater') . '' . '">Settings</a> to fix.', 'js_composer'));
}
$json = wp_remote_get($this->envatoDownloadPurchaseUrl($username, $api_key, $purchase_code));
$result = json_decode($json['body'], true);
if (!isset($result['download-purchase']['download_url'])) {
return new WP_Error('no_credentials', __('Error! Envato API error' . (isset($result['error']) ? ': ' . $result['error'] : '.'), 'js_composer'));
}
$result['download-purchase']['download_url'];
$download_file = download_url($result['download-purchase']['download_url']);
if (is_wp_error($download_file)) {
return $download_file;
}
$upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade_tmp/js_composer_envato_package';
if (is_dir($upgrade_folder)) {
$wp_filesystem->delete($upgrade_folder);
}
$result = unzip_file($download_file, $upgrade_folder);
if ($result && is_file($upgrade_folder . '/' . $package_filename)) {
return $upgrade_folder . '/' . $package_filename;
}
return new WP_Error('no_credentials', __('Error on unzipping package', 'js_composer'));
}
示例2: getSettings
public static function getSettings()
{
global $current_user;
if (self::$settings === null) {
if (function_exists('get_currentuserinfo')) {
get_currentuserinfo();
/** @var $settings - get use group access rules */
if (!empty($current_user->roles)) {
self::$user_role = $current_user->roles[0];
} else {
self::$user_role = 'author';
}
} else {
self::$user_role = 'author';
}
self::$settings = WPBakeryVisualComposerSettings::get('groups_access_rules');
}
return self::$settings;
}
示例3: output
public function output($post = null)
{
global $current_user;
get_currentuserinfo();
/** @var $settings - get use group access rules */
$settings = WPBakeryVisualComposerSettings::get('groups_access_rules');
$role = $current_user->roles[0];
$show_role = isset($settings[$role]['show']) ? $settings[$role]['show'] : '';
$buttons = $this->buildButtons();
$output = '
<div id="wpb_visual_composer-elements" class="vc_navbar">
<input type="hidden" name="wpb_js_composer_group_access_show_rule" class="wpb_js_composer_group_access_show_rule" value="' . $show_role . '" />
<div class="vc_navbar-inner clearfix">
<!--<div class="container">-->
<ul class="vc_nav">
<li>
<a title="' . __('Visual Composer for WordPress', LANGUAGE_ZONE) . '" href="http://vc.wpbakery.com/" class="vc_logo" target="_blank"></a>
</li>
</ul>
' . $buttons . '
<!--</div>-->
</div>
</div>';
return $output;
}
示例4: get_custom_column_class
function get_custom_column_class($class)
{
$custom_array = (array) WPBakeryVisualComposerSettings::get('column_css_classes');
return !empty($custom_array[$class]) ? $custom_array[$class] : '';
}
示例5: elementBackendHtml
/**
* Create shortcode's string.
*
* @since 3.0
* @access public
* @deprecated
*/
public function elementBackendHtml() {
global $current_user;
get_currentuserinfo();
$data_element = vc_post_param( 'data_element' );
/** @xvar $settings - get use group access rules */
$settings = WPBakeryVisualComposerSettings::get( 'groups_access_rules' );
$role = $current_user->roles[0];
if ( $data_element == 'vc_column' && vc_post_param( 'data_width' ) !== null ) {
$output = do_shortcode( '[vc_column width="' . vc_post_param( 'data_width' ) . '"]' );
echo $output;
} elseif ( $data_element == 'vc_row' || $data_element == 'vc_row_inner' ) {
$output = do_shortcode( '[' . $data_element . ']' );
echo $output;
} elseif ( ! isset( $settings[$role]['shortcodes'] ) || ( isset( $settings[$role]['shortcodes'][$data_element] ) && (int)$settings[$role]['shortcodes'][$data_element] == 1 ) ) {
$output = do_shortcode( '[' . $data_element . ']' );
echo $output;
}
die();
}
示例6: elementBackendHtml
/**
* Create shortcode's string.
*
* @since 3.0
* @access public
* @deprecated
*/
public function elementBackendHtml()
{
global $current_user;
get_currentuserinfo();
if (!vc_verify_admin_nonce() || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
wp_send_json(array('success' => false));
}
$data_element = vc_post_param('data_element');
/** @var $settings - get use group access rules */
$settings = WPBakeryVisualComposerSettings::get('groups_access_rules');
$role = $current_user->roles[0];
if ($data_element === 'vc_column' && vc_post_param('data_width') !== null) {
$output = do_shortcode('[vc_column width="' . vc_post_param('data_width') . '"]');
echo $output;
} elseif ($data_element == 'vc_row' || $data_element == 'vc_row_inner' || $data_element == 'mk_page_section') {
$output = do_shortcode('[' . $data_element . ']');
echo $output;
} elseif (!isset($settings[$role]['shortcodes']) || isset($settings[$role]['shortcodes'][$data_element]) && (int) $settings[$role]['shortcodes'][$data_element] === 1) {
$output = do_shortcode('[' . $data_element . ']');
echo $output;
}
die;
}
示例7: removeSettingsNotificationJavascript_callback
public function removeSettingsNotificationJavascript_callback()
{
WPBakeryVisualComposerSettings::removeNotification();
}
示例8: output
public function output($post = null)
{
global $current_user;
get_currentuserinfo();
/** @var $settings - get use group access rules */
$settings = WPBakeryVisualComposerSettings::get('groups_access_rules');
$role = $current_user->roles[0];
$show_role = isset($settings[$role]['show']) ? $settings[$role]['show'] : '';
$output = '
<div id="wpb_visual_composer-elements" class="navbar">
<input type="hidden" name="wpb_js_composer_group_access_show_rule" class="wpb_js_composer_group_access_show_rule" value="' . $show_role . '" />
<div class="navbar-inner">
<div class="container">
<a title="' . __('Visual Composer for WordPress', 'js_composer') . '" href="http://wpbakery.com/vc/" class="brand" target="_blank"></a>
<div class="nav-collapse">
<ul class="nav">
<li class="dropdown wpb_deprecated_element">
<a data-toggle="dropdown" class="dropdown-toggle wpb_popular_layouts" href="#">' . __("Popular Layouts", "js_composer") . ' <b class="caret"></b></a>
<ul class="dropdown-menu">
' . $this->getColumnLayouts() . '
</ul>
</li>
<li class="dropdown wpb_deprecated_element">
<a data-toggle="dropdown" class="dropdown-toggle wpb_content_elements" href="#">' . __("Content Elements", "js_composer") . ' <b class="caret"></b></a>
<ul class="dropdown-menu wpb-content-layouts-container">
' . $this->getContentCategoriesLayouts() . '
' . $this->getContentLayouts() . '
</ul>
</li>
<li>
<a class="wpb_add_new_element dropable_el button" id="wpb-add-new-element"><i class="icon"></i>' . __('Add element', 'js_composer') . '</a>
</li>
</ul>
<ul class="nav"><li>
<a class="wpb_add_new_row dropable_row button" id="wpb-add-new-row" data-element="vc_row"><i class="icon"></i>' . __('Add row', 'js_composer') . '</a>
</li></ul>
<ul class="nav">
<li class="dropdown">
<a data-toggle="dropdown" class="wpb_templates button" href="#"><i class="icon"></i>' . __('Templates', 'js_composer') . ' <b class="caret"></b></a>
<ul class="dropdown-menu wpb_templates_ul">
' . $this->getTemplateMenu() . '
</ul>
</li>
</ul>
<ul class="nav pull-right wpb-update-button">
<li><a class="button" id="wpb-save-post">' . __('Update', 'jscomposer') . '</a></li>
</ul>
</div><!-- /.nav-collapse -->
</div>
</div>
</div>
<style type="text/css">#wpb_visual_composer {display: none;}</style>';
return $output;
}
示例9: addThemeBodyClass
/**
* Adds themes css class to body tag.
* @param $classes
* @return array
*/
public function addThemeBodyClass($classes)
{
if (!class_exists('WPBakeryVisualComposerSettings')) {
return $classes;
}
$theme = ($theme = get_option(WPBakeryVisualComposerSettings::getFieldPrefix() . 'themes')) ? $theme : '';
if (!empty($theme)) {
$classes[] = 'vct_' . preg_replace('/\\.css$/', '', $theme);
}
return $classes;
}
示例10: showButton
function showButton($post_id = null)
{
global $current_user;
get_currentuserinfo();
$show = true;
if (!self::inlineEnabled() || !current_user_can('edit_post', $post_id)) {
return false;
}
/** @var $settings - get use group access rules */
$settings = WPBakeryVisualComposerSettings::get('groups_access_rules');
foreach ($current_user->roles as $role) {
if (isset($settings[$role]['show']) && $settings[$role]['show'] === 'no') {
$show = false;
break;
}
}
return $show && in_array(get_post_type(), $this->composer->getPostTypes());
}
示例11: setUpPlugin
public function setUpPlugin()
{
global $current_user;
get_currentuserinfo();
/** @var $settings - get use group access rules */
$settings = WPBakeryVisualComposerSettings::get('groups_access_rules');
parent::setUpPlugin();
$show = true;
foreach ($current_user->roles as $role) {
if (isset($settings[$role]['show']) && $settings[$role]['show'] === 'no') {
$show = false;
break;
}
}
if ($show) {
$this->composer->addAction('edit_post', 'saveMetaBoxes');
$this->composer->addAction('wp_ajax_wpb_get_element_backend_html', 'elementBackendHtmlJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_get_convert_elements_backend_html', 'Convert2NewVersionJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_get_row_element_backend_html', 'elementRowBackendHtmlJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_shortcodes_to_visualComposer', 'shortCodesVisualComposerJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_show_edit_form', 'showEditFormJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_save_template', 'saveTemplateJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_load_template', 'loadTemplateJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_delete_template', 'deleteTemplateJavascript_callback');
$this->addAction('admin_init', 'jsComposerEditPage', 5);
}
// Add specific CSS class by filter
$this->addFilter('body_class', 'jsComposerBodyClass');
$this->addFilter('get_media_item_args', 'jsForceSend');
$this->addAction('admin_init', 'composerRedirect');
$this->addAction('admin_init', 'registerCss');
$this->addAction('admin_init', 'registerJavascript');
$this->addAction('admin_menu', 'composerSettings');
$this->addAction('admin_print_scripts-post.php', 'editScreen_js');
$this->addAction('admin_print_scripts-post-new.php', 'editScreen_js');
/* Create Media tab for images */
$this->composer->createImagesMediaTab();
}
示例12: esc_attr_e
<ul class="nav navbar-nav navbar-right">
<li class="line"></li>
<li><a id="vc-post-settings-button" class="vc_post_settings" title="<?php
esc_attr_e('Page settings', LANGUAGE_ZONE);
?>
"><i class="icon"></i></a></li>
<li class="line"></li>
<li><button id="vc-guides-toggle-button" class="btn-primary btn navbar-btn btn-sm vc_guides_toggle" title="<?php
esc_attr_e("Toggle editor's guides", LANGUAGE_ZONE);
?>
"><?php
_e('Guides ON', LANGUAGE_ZONE);
?>
</button></li>
<?php
$disable_responsive = WPBakeryVisualComposerSettings::get('not_responsive_css');
if ($disable_responsive !== '1') {
?>
<li class="line"></li>
<li>
<div class="vc-dropdown" id="vc-screen-size-control">
<a href="#" class="vc-dropdown-toggle" title="<?php
_e("Responsive preview", LANGUAGE_ZONE);
?>
"><i class="icon default" id="vc-screen-size-current"></i><b class="caret"></b></a>
<ul class="vc-dropdown-list">
<li><a href="#" title="<?php
esc_attr_e('Desktop', LANGUAGE_ZONE);
?>
" class="vc-screen-width active default" data-size="100%"></a></li>
<li><a href="#" title="<?php
示例13: elementRowBackendHtmlJavascript_callback
public function elementRowBackendHtmlJavascript_callback()
{
global $current_user;
get_currentuserinfo();
$data_element = $this->post('data_element');
$data_width = $this->post('data_width');
/** @var $settings - get use group access rules */
$settings = WPBakeryVisualComposerSettings::get('groups_access_rules');
$role = $current_user->roles[0];
if ($data_element == 'vc_column') {
$output = do_shortcode('[vc_row][vc_column width="' . ($data_width ? $data_width : '1/1') . '"][/vc_row]');
echo $output;
} elseif (!isset($settings[$role]['shortcodes']) || isset($settings[$role]['shortcodes'][$data_element]) && (int) $settings[$role]['shortcodes'][$data_element] == 1) {
$output = do_shortcode('[vc_row][vc_column width="1/1"][' . $data_element . '][/vc_column][/vc_row]');
echo $output;
}
die;
}
示例14: activateLicense
public function activateLicense()
{
$params = array();
$params['username'] = $this->post('username');
$params['key'] = $this->post('key');
$params['api_key'] = $this->post('api_key');
$params['url'] = get_site_url();
$params['ip'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
$params['dkey'] = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
$string = 'activatelicense?';
$request_url = self::getWpbControlUrl(array($string, http_build_query($params, '', '&')));
$response = wp_remote_get($request_url, array('timeout' => 300));
if (is_wp_error($response)) {
echo json_encode(array('result' => false));
die;
}
$result = json_decode($response['body']);
if (!is_object($result)) {
echo json_encode(array('result' => false));
die;
}
if ((bool) $result->result === true || (int) $result->code === 401 && isset($result->deactivation_key)) {
$this->setDeactivationLicense(isset($result->code) && (int) $result->code === 401 ? $result->deactivation_key : $params['dkey']);
update_option(WPBakeryVisualComposerSettings::getFieldPrefix() . 'envato_username', $params['username']);
update_option(WPBakeryVisualComposerSettings::getFieldPrefix() . 'envato_api_key', $params['api_key']);
update_option(WPBakeryVisualComposerSettings::getFieldPrefix() . 'js_composer_purchase_code', $params['key']);
echo json_encode(array('result' => true));
die;
}
echo $response['body'];
die;
}
示例15: setUpPlugin
public function setUpPlugin()
{
global $current_user;
get_currentuserinfo();
/** @var $settings - get use group access rules */
$settings = WPBakeryVisualComposerSettings::get('groups_access_rules');
parent::setUpPlugin();
$show = true;
foreach ($current_user->roles as $role) {
if (isset($settings[$role]['show']) && $settings[$role]['show'] === 'no') {
$show = false;
break;
}
}
if ($show) {
$this->composer->addAction('edit_post', 'saveMetaBoxes');
$this->composer->addAction('wp_ajax_wpb_get_element_backend_html', 'elementBackendHtmlJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_get_convert_elements_backend_html', 'Convert2NewVersionJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_get_row_element_backend_html', 'elementRowBackendHtmlJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_shortcodes_to_visualComposer', 'shortCodesVisualComposerJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_single_image_src', 'singleImageSrcJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_gallery_html', 'galleryHTMLJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_get_loop_suggestion', 'getLoopSuggestionJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_remove_settings_notification_element_css_class', 'removeSettingsNotificationJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_image_url', 'getImageUrlByIdJavascript_callback');
/*
* Create edit form html
* @deprecated
*/
$this->composer->addAction('wp_ajax_wpb_show_edit_form', 'showEditFormJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_get_edit_form', 'getEditFormJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_save_template', 'saveTemplateJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_load_template', 'loadTemplateJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_load_template_shortcodes', 'loadTemplateShortcodesJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_delete_template', 'deleteTemplateJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_get_loop_settings', 'getLoopSettingsJavascript_callback');
$this->composer->addAction('wp_ajax_wpb_activate_license', 'activateLicense');
$this->composer->addAction('wp_ajax_wpb_deactivate_license', 'deactivateLicense');
$this->addAction('admin_init', 'jsComposerEditPage', 5);
}
// Add specific CSS class by filter
$this->addFilter('body_class', 'jsComposerBodyClass');
$this->addFilter('get_media_item_args', 'jsForceSend');
$this->addAction('admin_init', 'composerRedirect');
$this->addAction('admin_init', 'registerCss');
$this->addAction('admin_init', 'registerJavascript');
if ($this->composer->isNetworkPlugin() && is_network_admin()) {
$this->addAction('network_admin_menu', 'composerSettings');
}
$this->addAction('admin_menu', 'composerSettings');
$this->addAction('admin_print_scripts-post.php', 'editScreen_js');
$this->addAction('admin_print_scripts-post-new.php', 'editScreen_js');
// Upgrade message in plugins list.
if ($this->composer->updaterDisabled()) {
return $this;
}
$plugin_file_name = 'js_composer/js_composer.php';
new WpbAutoUpdate(WPB_VC_VERSION, 'http://wpbakery.com/version/?' . time(), $plugin_file_name);
$this->addAction('in_plugin_update_message-' . $plugin_file_name, 'addUpgradeMessageLink');
}