function uploaderScripts() { wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); wp_register_script('yopressUploaderScript', YoPressBase::instance()->getComponentUrl() . '/uploader/yopressUploader.js', array('jquery', 'media-upload', 'thickbox')); wp_enqueue_script('yopressUploaderScript'); }
public function registerAdminSettings() { parent::registerAdminSettings(); $settings = array(array('name' => 'yopress_fancybox_open_effect', 'type' => 'dropdown', 'label' => 'Open effect', 'default' => $this->defaultSettings['yopress_fancybox_open_effect'], 'htmlOptions' => array()), array('name' => 'yopress_fancybox_close_effect', 'type' => 'dropdown', 'label' => 'Close effect', 'default' => $this->defaultSettings['yopress_fancybox_close_effect'], 'htmlOptions' => array())); foreach ($settings as $setting) { YoPressBase::instance()->registerAdminSettings($this->config['tab'], $this->config['section'], $this->config['priority'], 0, $setting); } }
public function registerAdminSettings() { parent::registerAdminSettings(); $settings = array(array('name' => 'yopress_colorbox_transition', 'type' => 'dropdown', 'label' => 'Transition effect', 'default' => $this->defaultSettings['yopress_colorbox_transition'], 'htmlOptions' => array()), array('name' => 'yopress_colorbox_speed', 'type' => 'input', 'label' => 'Animation speed (ms)', 'default' => $this->defaultSettings['yopress_colorbox_speed'], 'htmlOptions' => array()), array('name' => 'yopress_colorbox_slideshow', 'type' => 'checkbox', 'label' => 'Enable Slideshow', 'default' => $this->defaultSettings['yopress_colorbox_slideshow'], 'htmlOptions' => array())); foreach ($settings as $setting) { YoPressBase::instance()->registerAdminSettings($this->config['tab'], $this->config['section'], $this->config['priority'], 0, $setting); } }
public function adminPage() { require_once get_template_directory() . '/admin/admin.php'; YoPressBase::instance()->webView->renderPath('admin/views/adminWrapper', array('pages' => YoPressBase::instance()->getAdminPages(), 'settings' => YoPressBase::instance()->getAdminPageSettings())); wp_enqueue_script('yopress_admin_script', YoPressBase::instance()->getCoreUrl() . '/admin/js/yopressAdmin.js', array('jquery')); wp_register_style('yopress_admin_style', YoPressBase::instance()->getCoreUrl() . '/admin/css/yopress_admin.css', array(), '', ''); wp_enqueue_style('yopress_admin_style'); }
public function registerAdminSettings() { parent::registerAdminSettings(); $settings = array(array('name' => 'yopress_gallery_clean_link', 'type' => 'dropdown', 'label' => 'Image link leads to ...', 'default' => $this->defaultSettings['yopress_gallery_clean_link'], 'htmlOptions' => array())); foreach ($settings as $setting) { YoPressBase::instance()->registerAdminSettings($this->config['tab'], $this->config['section'], $this->config['priority'], 0, $setting); } }
public function renderOgTags() { global $post; $url; if (!have_posts()) { $url = ''; } else { $url = get_page_link(); } $type = 'article'; $title = ''; $image = ''; $appId = ''; $admins = ''; if (is_single()) { $type = get_post_format($post->ID); $type = $type == 'video' ? $type : 'article'; if (has_post_thumbnail()) { $imgs = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail'); $image = $imgs[0]; } else { $image = get_option('theme_og_default_image'); } } else { $image = get_option('theme_og_default_image'); } $title = get_option('theme_og_title'); if (isset($post) && !empty($post)) { $title = str_replace('%post_title%', $post->post_title, $title); $title = str_replace('%permalink%', get_permalink(), $title); } else { $title = str_replace('%post_title%', '', $title); $title = str_replace('%permalink%', '', $title); } $title = str_replace('%blog_name%', get_bloginfo('name'), $title); if ($title == '') { if (isset($post)) { $title = $post->post_title . ' | ' . get_bloginfo('name'); } else { $title = get_bloginfo('name'); } } $appId = get_option('theme_og_app_id'); $admins = get_option('theme_og_admins'); YoPressBase::instance()->webView->renderPath('components/ogtags/views/ogtags', array('url' => $url, 'type' => $type, 'title' => $title, 'image' => $image, 'admins' => $admins, 'appId' => $appId)); }
/** * Render view from web folder */ public function render($viewName, $vars = array(), $htmlOptions = array(), $path = false) { extract($vars); $opts = ''; if (is_array($htmlOptions) && count($htmlOptions) >= 1) { foreach ($htmlOptions as $key => $val) { $opts .= ' ' . $key . '="' . $val . '" '; } } $basePath = YoPressBase::instance()->getCorePath(); if ($path) { $viewPath = $basePath . $viewName . '.php'; } else { $viewPath = $basePath . '/web/views/' . $viewName . '.php'; } if (file_exists($viewPath)) { require $viewPath; } }
public function registerAdminSettings() { parent::registerAdminSettings(); $settings = array('name' => 'dynamic_sidebar_count', 'type' => 'input', 'label' => 'number of sidebars', 'default' => $this->defaultSettings['dynamic_sidebar_count'], 'htmlOptions' => array()); YoPressBase::instance()->registerAdminSettings('Sidebars', 'General', 'Some excerpt settings', 0, $settings); // $numberOfSidebars = get_option('dynamic_sidebar_count'); // if($numberOfSidebars == null || $numberOfSidebars == '') $numberOf = $this->defaultSettings['dynamic_sidebar_count']; // for($i = 1; $i <= $numberOfSidebars; $i++){ // $settings = array( // 'name'=>'dynamic_sidebar_no_'.$i, // 'type' => 'input', // 'label' => 'number of sidebars', // 'default' => '', // 'htmlOptions' => array( // // ) // ); // // YoPressBase::instance()->registerAdminSettings('Sidebars','Sidebars','Some excerpt settings', 0, $settings); // } }
<?php YoPressBase::instance()->addDependency('YoPressUploader'); class YoPressUserProfileExtender extends YoPressComponent { static $instanceId; public function __construct() { parent::__construct(); if (!self::$instanceId) { self::$instanceId = 1; } else { self::$instanceId++; } } function registerHooks($action, $avaiableActions = array()) { // Additional fields for user profile add_filter('user_contactmethods', array($this, 'additionalProfileFields'), 10, 1); // Additional actions for edit/show user profile add_action('show_user_profile', array($this, 'userProfileImageField')); add_action('edit_user_profile', array($this, 'userProfileImageField')); // Save/edit user profile image add_action('personal_options_update', array($this, 'saveUserProfileImageField')); add_action('edit_user_profile_update', array($this, 'saveUserProfileImageField')); } function additionalProfileFields($contactmethods) { $contactmethods['twitter'] = 'YoPress Twitter'; $contactmethods['facebook'] = 'YoPress Facebook'; $contactmethods['googleplus'] = 'YoPress Google+';
/** * Return translated text in theme text domain * * @param string $text * @return string */ function __t($text) { return __($text, YoPressBase::instance()->getTextDomain()); }
function form($instance) { $defaults = array('title' => 'Gallery Title', 'cat_id' => 0); $instance = wp_parse_args((array) $instance, $defaults); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> ">Title:</label> <input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo $instance['title']; ?> " /> </p> <p> <label for="">Category</label> <?php YoPressBase::instance()->webView->categorySelect($this->get_field_name('cat_id'), $instance['cat_id']); ?> </p> <?php }
public function registerAdminSettings() { parent::registerAdminSettings(); YoPressBase::instance()->registerAdminPage('General', 'general-settings', 1); YoPressBase::instance()->registerAdminPageSettings('general-settings', array($this, 'settings'), __t('Twitter Feed Settings'), __t('Description'), 4); }
YoPressBase::instance()->registerAdminPageSettings('blogsettings', 'blogSettings', __('Blog settings', THEME_NAME), '', 1); YoPressBase::instance()->registerAdminPage(__('Posts', THEME_NAME), 'postssettings', 11); YoPressBase::instance()->registerAdminPageSettings('postssettings', 'postsSettings', __('Posts settings', THEME_NAME), '', 1); YoPressBase::instance()->registerAdminPageSettings('postssettings', 'postsAppearance', __('Posts appearance', THEME_NAME), '', 1); YoPressBase::instance()->registerAdminPage(__('Footer', THEME_NAME), 'footersettings', 12); YoPressBase::instance()->registerAdminPageSettings('footersettings', 'footerSettings', __('Footer settings', THEME_NAME), '', 1); YoPressBase::instance()->registerAdminPage(__('Navigation', THEME_NAME), 'navigationsettings', 13); YoPressBase::instance()->registerAdminPageSettings('navigationsettings', 'navigationSettings', __('Menu settings', THEME_NAME), '', 1); YoPressBase::instance()->registerAdminPage(__('Intro section', THEME_NAME), 'introsettings', 14); YoPressBase::instance()->registerAdminPageSettings('introsettings', 'introSettings', __('Intro settings', THEME_NAME), '', 1); YoPressBase::instance()->registerAdminPage(__('Portfolio', THEME_NAME), 'portfoliosettings', 15); YoPressBase::instance()->registerAdminPageSettings('portfoliosettings', 'portfolioSettings', __('Portfolio settings', THEME_NAME), '', 1); YoPressBase::instance()->registerAdminPage(__('Theme update', THEME_NAME), 'themeupdate', 20); YoPressBase::instance()->registerAdminPageSettings('themeupdate', 'themeUpdateSettings', __('Theme Update', THEME_NAME), __('Description', THEME_NAME), 1); YoPressBase::instance()->registerAdminPage(__('System info', THEME_NAME), 'systeminfo', 20); YoPressBase::instance()->registerAdminPageSettings('systeminfo', 'themeSystemInfo', __('System Info', THEME_NAME), __('Description', THEME_NAME), 1); function drawDemoImport() { ?> demo import! <?php barnelli_setYoPressSettings(); } function demoImporter() { return array(array('name' => 'demo_import', 'type' => 'custom', 'content' => 'drawDemoImport')); } function themeSystemInfo() { return array(array('name' => 'system_info', 'type' => 'custom', 'content' => 'drawSystemInfo')); }
public function registerAdminSettings() { parent::registerAdminSettings(); $settings = array(array('name' => 'yopress_flex_slider_number_of_slides', 'type' => 'input', 'label' => 'Number of slides displayed in slider', 'default' => $this->defaultSettings['yopress_flex_slider_number_of_slides'], 'htmlOptions' => array()), array('name' => 'yopress_flex_slider_display_category', 'type' => 'categorySelect', 'label' => 'Category which will be displayed in slider', 'default' => '', 'htmlOptions' => array())); foreach ($settings as $setting) { YoPressBase::instance()->registerAdminSettings($this->config['tab'], $this->config['section'], $this->config['priority'], 0, $setting); } }
function form($instance) { $defaults = array('title' => '', 'maxItems' => 5, 'vidtitleline1' => '', 'vidtitleline2' => '', 'cat_ID' => ''); $instance = wp_parse_args((array) $instance, $defaults); ?> <p> <label for="<?php echo $this->get_field_id('vidtitleline1'); ?> ">Title</label> <input class="widefat" type="text" name="<?php echo $this->get_field_name('vidtitleline1'); ?> " id="<?php echo $this->get_field_id('vidtitleline1'); ?> " value="<?php echo $instance['vidtitleline1']; ?> "/> </p> <p> <label for="<?php echo $this->get_field_id('vidtitleline2'); ?> ">Subtitle</label> <input class="widefat" type="text" name="<?php echo $this->get_field_name('vidtitleline2'); ?> " id="<?php echo $this->get_field_id('vidtitleline2'); ?> " value="<?php echo $instance['vidtitleline2']; ?> "/> </p> <p> <label for="">Category</label> <?php YoPressBase::instance()->webView->categorySelect($this->get_field_name('cat_ID'), $instance['cat_ID']); ?> <br/> <small>with post format video</small> </p> <p> <label for="<?php echo $this->get_field_id('maxItems'); ?> ">Max items in list</label> <input class="widefat" type="text" name="<?php echo $this->get_field_name('maxItems'); ?> " id="<?php echo $this->get_field_id('maxItems'); ?> " value="<?php echo $instance['maxItems']; ?> "/> </p> <p> <small>Tip: You can add duration of item by adding custom field called : duration;</small> </p> <?php }
/** * Load single dependency(component,widget, etc) and run registerHooks * and registerAdminPage on it * * @param type $dep name of dependency * @param type $config config * @param type $action name of current page */ private function loadDependency($dep, $config, $action) { $depObj = new $dep($config); if ($depObj instanceof IDependencyObject) { if ($depObj) { /* call this only once per component */ if (!$depObj->registered()) { $depObj->registerHooks($action); } if (is_admin() && $action == YoPressBase::instance()->getAdminPageId()) { $depObj->registerAdminSettings(); } } } else { echo 'This class (' . $dep . ') do not implements IDependencyObject'; } }
private function renderCategorySelect($name, $options, $raw) { $value = $this->model->fieldValue($name, $options['default']); $htmlOptions = $this->makeHtmlOptions($options); $htmlOptions['id'] = $options['id']; if (!$raw) { echo '<tr valign="top"> <th> <label for="' . $options['id'] . '">' . $options['label'] . '</label> </th> <td>'; } $prepend = isset($options['prepend']) ? $options['prepend'] : array(); YoPressBase::instance()->webView->categorySelect($this->model->fieldName($name), $value, $htmlOptions, $prepend); if (!$raw) { echo '</td></tr>'; } }
public function nivoSliderStyles() { wp_register_style('nivoSlider', YoPressBase::instance()->getCoreUrl() . '/components/nivoslider/css/nivoslider.css'); }
function add_plugin($plugin_array) { $plugin_array['yopress'] = YoPressBase::instance()->getBaseUrl() . '/tinymc/shortcodes.js'; return $plugin_array; }
} define("THEME_NAME", 'BERG'); define("THEME_DIR", get_template_directory()); define("THEME_DIR_URI", get_template_directory_uri()); define("THEME_STYLES", THEME_DIR_URI . "/css"); define("THEME_POST_TYPES", THEME_DIR . "/inc/post-types"); define("THEME_PLUGINS", THEME_DIR . "/plugins"); define("THEME_INCLUDES", THEME_DIR . "/inc"); define("THEME_INCLUDES_URI", THEME_DIR_URI . "/inc"); if (!defined("THEME_PROTOCOL")) { define("THEME_PROTOCOL", is_ssl() ? 'https' : 'http'); } /* YoPressBase */ include_once THEME_DIR . '/yopress/core/YoPressBase.php'; $config = (include_once 'YoPressConfig.php'); YoPressBase::init($config); /** * Include the TGM_Plugin_Activation class. */ require_once dirname(__FILE__) . '/inc/class-tgm-plugin-activation.php'; /* ** includes */ include_once THEME_INCLUDES . '/functions_def.php'; include_once THEME_POST_TYPES . '/post-type-berg-menu.php'; include_once THEME_POST_TYPES . '/post-type-berg-restaurant.php'; include_once THEME_POST_TYPES . '/post-type-berg-portfolio.php'; include_once THEME_POST_TYPES . '/post-type-berg-footer.php'; include_once THEME_INCLUDES . '/custom-menu.php'; include_once THEME_INCLUDES . '/shortcodes.php'; include_once THEME_INCLUDES . '/activation.php';
<?php require_once '../../../../wp-config.php'; ?> <html> <head> <script type="text/javascript" src="<?php echo YoPressBase::instance()->getHomeUrl(); ?> /wp-includes/js/tinymce/tiny_mce_popup.js"></script> <link rel="stylesheet" href="<?php echo YoPressBase::instance()->getCoreUrl(); ?> /admin/css/popups.css"> </head> <body> <div class="custm-tab"> <table class="form-table"> <tbody> <tr valign="top"> <td colspan="2"> <h3>Embed video</h3> <p><strong>Note:</strong> <i>You can embed various content while using the Iframe embed method.</i></p> </td> </tr> <tr valign="top"> <th scope="row"><label for="button_link">Link (YT/Vimeo)</label></th> <td><input type="text" name="link" id="button_link"/></td> </tr>
</div> <div class="yopress-adminmenuback"></div> <div class="yopress-adminmenuwrap"> <ul class="yopress-admin-menu"> <?php if (!isset($_GET['tab'])) { $_GET['tab'] = 'general-settings'; } foreach ($pages as $page) { foreach ($page as $p) { $current = ''; if ($_GET['tab'] == $p['id']) { $current = 'current'; } echo '<li class="menu-top ' . $current . '"><a class="menu-top" href="' . get_admin_url() . 'themes.php?page=' . YoPressBase::instance()->getAdminPageId() . '&tab=' . $p['id'] . '"><div class="wp-menu-name">' . $p['name'] . '</div></a></li>'; } } ?> </ul> </div> <div id="wpcontent"> <div id="wpbody"> <div id="wpbody-content" tabindex="0"> <div class="wrap"> <div class="yopress-navbar"> <ul> <li> <small id="yopress-saved" style="margin-right:10px;font-size:14px;float:right; color: rgb(68, 197, 0); display: none"><?php _t('Settings saved');