public function _admin_action_add_static()
 {
     $screen = array('only' => array(array('base' => 'post')));
     if (fw_current_screen_match($screen)) {
         wp_enqueue_style($this->get_name() . '-style', $this->locate_css_URI('style'));
     }
 }
 /**
  * @internal
  */
 public function _admin_action_register_styles()
 {
     $current_screen = array('only' => array(array('base' => 'options-general')));
     if (fw_current_screen_match($current_screen)) {
         wp_enqueue_style($this->get_name() . '-styles', $this->locate_css_URI('style'), array(), $this->manifest->get_version());
     }
 }
Example #3
0
 public function _filter_admin_footer_text($html)
 {
     if ((current_user_can('update_themes') || current_user_can('update_plugins')) && fw_current_screen_match(array('only' => array(array('parent_base' => fw()->extensions->manager->get_page_slug()))))) {
         return (empty($html) ? '' : $html . '<br/>') . '<em>' . str_replace(array('{wp_review_link}', '{facebook_share_link}', '{twitter_share_link}'), array(fw_html_tag('a', array('target' => '_blank', 'href' => 'https://wordpress.org/support/view/plugin-reviews/unyson?filter=5#postform'), __('leave a review', 'fw')), fw_html_tag('a', array('target' => '_blank', 'href' => 'https://www.facebook.com/sharer/sharer.php?' . http_build_query(array('u' => 'http://unyson.io')), 'onclick' => 'return !window.open(this.href, \'Facebook\', \'width=640,height=300\')'), __('Facebook', 'fw')), fw_html_tag('a', array('target' => '_blank', 'href' => 'https://twitter.com/home?' . http_build_query(array('status' => __('Unyson WordPress Framework is the fastest and easiest way to develop a premium theme. I highly recommend it', 'fw') . ' http://unyson.io/ #UnysonWP')), 'onclick' => 'return !window.open(this.href, \'Twitter\', \'width=640,height=430\')'), __('Twitter', 'fw'))), __('If you like Unyson, {wp_review_link}, share on {facebook_share_link} or {twitter_share_link}.', 'fw')) . '</em>';
     } else {
         return $html;
     }
 }
Example #4
0
    function _action_ssd_hide_extensions_from_the_list()
    {
        if (fw_current_screen_match(array('only' => array('id' => 'toplevel_page_fw-extensions')))) {
            echo '
			<style type="text/css">
			#fw-ext-analytics, #fw-ext-megamenu, #fw-ext-portfolio, #fw-ext-styling, #fw-ext-seo, #fw-ext-feedback, #fw-ext-events, #fw-ext-learning, #fw-ext-social, #fw-ext-translation, #fw-ext-slider, #fw-ext-sidebars, #fw-ext-backups { display: none !important; }
			</style>';
        }
    }
 /**
  * @internal
  */
 public function _action_admin_setup_sitemap()
 {
     if (!fw_current_screen_match(array('only' => array('id' => 'toplevel_page_fw-extensions')))) {
         return;
     }
     $this->set_parameters();
 }
 /**
  * @internal
  */
 public function _action_initial_nav_menu_meta_boxes()
 {
     $screen = array('only' => array('base' => 'nav-menus'));
     if (!fw_current_screen_match($screen)) {
         return;
     }
     $user_ID = get_current_user_id();
     $meta = fw_get_db_extension_user_data($user_ID, $this->get_name());
     if (isset($meta['metaboxhidden_nav-menus']) && $meta['metaboxhidden_nav-menus'] == true) {
         return;
     }
     $hidden_meta_boxes = get_user_meta($user_ID, 'metaboxhidden_nav-menus');
     if ($key = array_search('add-' . $this->taxonomy_name, $hidden_meta_boxes[0])) {
         unset($hidden_meta_boxes[0][$key]);
     }
     update_user_option($user_ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes[0], true);
     if (!is_array($meta)) {
         $meta = array();
     }
     if (!isset($meta['metaboxhidden_nav-menus'])) {
         $meta['metaboxhidden_nav-menus'] = true;
     }
     fw_set_db_extension_user_data($user_ID, $this->get_name(), $meta);
 }
 /**
  * @internal
  */
 public function _admin_action_enqueue_static()
 {
     $match_current_screen = fw_current_screen_match(array('only' => array(array('post_type' => $this->post_type))));
     if ($match_current_screen) {
         wp_enqueue_style('fw-extension-' . $this->get_name() . '-css', $this->get_declared_URI('/static/css/style.css'), array(), fw()->manifest->get_version());
         wp_enqueue_style('fw-selectize');
         wp_enqueue_script('fw-population-method-categories', $this->get_declared_URI('/static/js/population-method.js'), array('fw-selectize'), fw()->manifest->get_version());
     }
 }
 /**
  * @internal
  *
  * @param array $filters
  *
  * @return array
  */
 public function _filter_admin_remove_select_by_date_filter($filters)
 {
     $screen = array('only' => array('base' => 'edit', 'id' => 'edit-' . $this->post_type));
     if (!fw_current_screen_match($screen)) {
         return $filters;
     }
     return array();
 }
 /**
  * @internal
  */
 public function _admin_action_enqueue_static()
 {
     $match_current_screen = fw_current_screen_match(array('only' => array(array('post_type' => $this->post_type))));
     if ($match_current_screen) {
         wp_enqueue_style('fw-extension-' . $this->get_name() . '-css', $this->locate_css_URI('style'), array(), $this->manifest->get_version());
     }
 }
 /**
  * Activate extensions with $manifest['display'] = false; $manifest['standalone'] = true;
  * - First level extensions
  * - Child extensions of the active extensions
  */
 private function activate_hidden_standalone_extensions()
 {
     if (!is_admin()) {
         return;
     }
     if (!$this->can_activate()) {
         return;
     }
     $activate_extensions = array();
     foreach (array_diff_key($this->get_installed_extensions(), fw()->extensions->get_all()) as $ext_name => $ext_data) {
         if ($ext_data['parent'] && !fw_ext($ext_data['parent'])) {
             // child extensions of an inactive extension
             continue;
         }
         if (false !== fw_akg('display', $ext_data['manifest'], $this->manifest_default_values['display'])) {
             // is visible
             continue;
         }
         if (true !== fw_akg('standalone', $ext_data['manifest'], $this->manifest_default_values['standalone'])) {
             // not standalone
             continue;
         }
         $collected = $this->get_extensions_for_activation($ext_name);
         if (is_wp_error($collected)) {
             if (defined('WP_DEBUG') && WP_DEBUG) {
                 if (fw_current_screen_match(array('only' => array(array('parent_base' => $this->get_page_slug()))))) {
                     // display this warning only on Unyson extensions page
                     FW_Flash_Messages::add('fw_ext_auto_activate_hidden_standalone', sprintf(__('Cannot activate hidden standalone extension %s', 'fw'), fw_akg('name', $ext_data['manifest'], fw_id_to_title($ext_name))), 'error');
                 }
             }
             return;
         }
         $activate_extensions = array_merge($activate_extensions, $collected);
     }
     if (empty($activate_extensions)) {
         return;
     }
     $option_name = fw()->extensions->_get_active_extensions_db_option_name();
     $db_active_extensions = array_merge(get_option($option_name, array()), $activate_extensions);
     update_option($option_name, $db_active_extensions);
 }
 /** @internal */
 function _starry_action_hide_extensions_from_the_list()
 {
     //global $current_screen; fw_print($current_screen); // debug
     if (fw_current_screen_match(array('only' => array('id' => 'toplevel_page_fw-extensions')))) {
         echo '<style type="text/css"> #fw-ext-portfolio, #fw-ext-learning, #fw-ext-feedback, #fw-ext-styling { display: none; } </style>';
     }
 }
 /**
  * Printing global js variables on page
  */
 public function _action_admin_global_variables()
 {
     if (!fw_current_screen_match(array('only' => array('base' => 'post'))) || !$this->is_supported_post()) {
         return false;
     }
     echo "<script type='text/javascript'>\n";
     echo 'var fw_option_shortcode_globals=' . json_encode(array('plugin_name' => 'simple_builder_button', 'storage_selector' => '#' . $this->meta_key, 'shortcode_list' => $this->build_shortcodes_list()));
     echo "\n</script>";
 }
Example #13
0
<?php

if (!defined('FW')) {
    die('Forbidden');
}
$extension = fw()->extensions->get('update');
if (fw_current_screen_match(array('only' => array(array('id' => 'update-core'))))) {
    // Include only on update page
    wp_enqueue_style('fw-ext-' . $extension->get_name() . '-update-page', $extension->get_declared_URI('/static/css/admin-update-page.css'), array(), $extension->manifest->get_version());
}
 public function _admin_action_initial_nav_menu_meta_boxes()
 {
     $screen = array('only' => array('base' => 'nav-menus'));
     if (!fw_current_screen_match($screen)) {
         return;
     }
     if (get_user_option('fw-metaboxhidden_nav-menus') !== false) {
         return;
     }
     $user = wp_get_current_user();
     $hidden_meta_boxes = get_user_meta($user->ID, 'metaboxhidden_nav-menus');
     if ($key = array_search('add-' . $this->taxonomy_name, $hidden_meta_boxes[0])) {
         unset($hidden_meta_boxes[0][$key]);
     }
     update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes[0], true);
     update_user_option($user->ID, 'fw-metaboxhidden_nav-menus', 'updated', true);
 }
 private function add_admin_actions()
 {
     add_action('save_post', array($this, '_action_admin_ping_to_search_engines'), 10, 2);
     if (fw_current_screen_match(array('only' => array('id' => 'toplevel_page_fw-extensions')))) {
         add_action('admin_enqueue_scripts', array($this, '_action_admin_add_static'));
     }
 }