Example #1
0
function appthemes_update_redirect()
{
    if (!current_user_can('manage_options') || defined('DOING_AJAX')) {
        return;
    }
    // numeric array, contains multiple sets of arguments
    // first item contains preferable set
    $args_sets = get_theme_support('app-versions');
    $redirect = false;
    foreach ($args_sets as $args) {
        if ($args['current_version'] == get_option($args['option_key'])) {
            continue;
        }
        if ($args['current_version'] == get_transient(APP_UPDATE_TRANSIENT . '_' . $args['option_key'])) {
            continue;
        }
        set_transient(APP_UPDATE_TRANSIENT . '_' . $args['option_key'], $args['current_version']);
        // set redirect only for the first available arg set
        if (!$redirect) {
            $redirect = $args['update_page'];
        }
    }
    // no any redirect in all arg sets
    if (!$redirect) {
        return;
    }
    // prevents infinite redirect
    if (scbUtil::get_current_url() == admin_url($redirect)) {
        return;
    }
    wp_redirect(admin_url($redirect));
    exit;
}
 function page_content()
 {
     if (isset($_GET['firstrun'])) {
         do_action('appthemes_first_run');
     }
     $active_tab = isset($_GET['tab']) ? $_GET['tab'] : '';
     if (!isset($this->tabs[$active_tab])) {
         $active_tab = key($this->tabs);
     }
     $current_url = scbUtil::get_current_url();
     echo '<h3 class="nav-tab-wrapper">';
     foreach ($this->tabs as $tab_id => $tab_title) {
         $class = 'nav-tab';
         if ($tab_id == $active_tab) {
             $class .= ' nav-tab-active';
         }
         $href = add_query_arg('tab', $tab_id, $current_url);
         echo ' ' . html('a', compact('class', 'href'), $tab_title);
     }
     echo '</h3>';
     echo '<form method="post" action="">';
     echo '<input type="hidden" name="action" value="' . $active_tab . '" />';
     wp_nonce_field($this->nonce);
     foreach ($this->tab_sections[$active_tab] as $section) {
         echo $this->render_section($section['title'], $section['fields']);
     }
     echo '<p class="submit"><input type="submit" class="button-primary" value="' . esc_attr__('Save Changes', APP_TD) . '" /></p>';
     echo '</form>';
 }
Example #3
0
 /**
 * Create a new cron job
 *
 * @param string Reference to main plugin file
 * @param array List of args:
 		string $action OR callback $callback
 			string $schedule OR number $interval
 			array $callback_args (optional)
 */
 function __construct($file = false, $args)
 {
     extract($args, EXTR_SKIP);
     // Set time & schedule
     if (isset($time)) {
         $this->time = $time;
     }
     if (isset($interval)) {
         $this->schedule = $interval . 'secs';
         $this->interval = $interval;
     } elseif (isset($schedule)) {
         $this->schedule = $schedule;
     }
     // Set hook
     if (isset($action)) {
         $this->hook = $action;
     } elseif (isset($callback)) {
         $this->hook = self::_callback_to_string($callback);
         add_action($this->hook, $callback);
     } elseif (method_exists($this, 'callback')) {
         $this->hook = self::_callback_to_string(array($this, 'callback'));
         add_action($this->hook, array($this, 'callback'));
     } else {
         trigger_error('$action OR $callback not set', E_USER_WARNING);
     }
     if (isset($callback_args)) {
         $this->callback_args = (array) $callback_args;
     }
     if ($file && $this->schedule) {
         scbUtil::add_activation_hook($file, array($this, 'reset'));
         register_deactivation_hook($file, array($this, 'unschedule'));
     }
     add_filter('cron_schedules', array($this, '_add_timing'));
 }
Example #4
0
 /**
  * Create a new cron job
  *
  * @param string|bool $file Reference to main plugin file
  * @param array       $args List of args:
  *                          string $action OR callback $callback
  *                          string $schedule OR number $interval
  *                          array $callback_args (optional)
  */
 function __construct($file = false, $args)
 {
     // Set time & schedule
     if (isset($args['time'])) {
         $this->time = $args['time'];
     }
     if (isset($args['interval'])) {
         $this->schedule = $args['interval'] . 'secs';
         $this->interval = $args['interval'];
     } elseif (isset($args['schedule'])) {
         $this->schedule = $args['schedule'];
     }
     // Set hook
     if (isset($args['action'])) {
         $this->hook = $args['action'];
     } elseif (isset($args['callback'])) {
         $this->hook = self::_callback_to_string($args['callback']);
         add_action($this->hook, $args['callback']);
     } elseif (method_exists($this, 'callback')) {
         $this->hook = self::_callback_to_string(array($this, 'callback'));
         add_action($this->hook, $args['callback']);
     } else {
         trigger_error('$action OR $callback not set', E_USER_WARNING);
     }
     if (isset($args['callback_args'])) {
         $this->callback_args = (array) $args['callback_args'];
     }
     if ($file && $this->schedule) {
         scbUtil::add_activation_hook($file, array($this, 'reset'));
         register_deactivation_hook($file, array($this, 'unschedule'));
     }
     add_filter('cron_schedules', array($this, '_add_timing'));
 }
Example #5
0
 /**
  * Create a new set of options
  *
  * @param string $key Option name
  * @param string $file Reference to main plugin file
  * @param array $defaults An associative array of default values ( optional )
  */
 public function __construct($key, $file, $defaults = '')
 {
     $this->key = $key;
     $this->defaults = $defaults;
     scbUtil::add_activation_hook($file, array($this, '_update_reset'));
     scbUtil::add_uninstall_hook($file, array($this, 'delete'));
 }
Example #6
0
/**
 * Checks if a user is logged in, if not redirect them to the login page.
 */
function appthemes_auth_redirect_login()
{
    if (!is_user_logged_in()) {
        nocache_headers();
        wp_redirect(wp_login_url(scbUtil::get_current_url()));
        exit;
    }
}
Example #7
0
	private function scb_get_field_name( $name ) {
		if ( $split = scbUtil::split_at( '[', $name ) )
			list( $basename, $extra ) = $split;
		else
			return $this->get_field_name( $name );

		return str_replace( '[]', '', $this->get_field_name( $basename ) ) . $extra;
	}
Example #8
0
 function __construct($name, $file, $columns, $upgrade_method = 'dbDelta')
 {
     global $wpdb;
     $this->name = $wpdb->{$name} = $wpdb->prefix . $name;
     $this->columns = $columns;
     $this->upgrade_method = $upgrade_method;
     scbUtil::add_activation_hook($file, array($this, 'install'));
     scbUtil::add_uninstall_hook($file, array($this, 'uninstall'));
 }
Example #9
0
 /**
  * Create a new set of options
  *
  * @param string $key Option name
  * @param string $file Reference to main plugin file
  * @param array $defaults An associative array of default values (optional)
  */
 public function __construct($key, $file, $defaults = array())
 {
     $this->key = $key;
     $this->defaults = $defaults;
     if ($file) {
         scbUtil::add_activation_hook($file, array($this, '_activation'));
         scbUtil::add_uninstall_hook($file, array($this, 'delete'));
     }
 }
Example #10
0
 /**
 * Create a new cron job
 *
 * @param string Reference to main plugin file
 * @param array List of args:
 		string $action OR callback $callback
 			string $schedule OR number $interval
 			array $callback_args ( optional )
 * @param bool Debug mode
 */
 function __construct($file, $args, $debug = false)
 {
     $this->_set_args($args);
     scbUtil::add_activation_hook($file, array($this, 'reset'));
     register_deactivation_hook($file, array($this, 'unschedule'));
     add_filter('cron_schedules', array($this, '_add_timing'));
     if ($debug) {
         self::debug();
     }
 }
Example #11
0
 static function scripts()
 {
     if (!self::$add_script) {
         return;
     }
     $js_dev = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
     wp_enqueue_script('wp-useronline', plugins_url("useronline{$js_dev}.js", __FILE__), array('jquery'), '2.80', true);
     wp_localize_script('wp-useronline', 'useronlineL10n', array('ajax_url' => admin_url('admin-ajax.php'), 'timeout' => self::$options->timeout * 1000));
     scbUtil::do_scripts('wp-useronline');
 }
Example #12
0
 /**
  * Create a new set of options
  *
  * @param string $key Option name
  * @param string $file Reference to main plugin file
  * @param array $defaults An associative array of default values (optional)
  */
 public function __construct($key, $file, $defaults = '')
 {
     $this->key = $key;
     $this->defaults = $defaults;
     $this->data = get_option($this->key);
     if (is_array($this->defaults)) {
         $this->data = (array) $this->data;
         register_activation_hook($file, array($this, '_update_reset'));
     }
     scbUtil::add_uninstall_hook($file, array($this, 'delete'));
 }
Example #13
0
 /**
  * Sets up table.
  *
  * @param string $name Table name.
  * @param string $file Reference to main plugin file.
  * @param string $columns The SQL columns for the CREATE TABLE statement.
  * @param array $upgrade_method (optional)
  *
  * @return void
  */
 public function __construct($name, $file, $columns, $upgrade_method = 'dbDelta')
 {
     $this->name = $name;
     $this->columns = $columns;
     $this->upgrade_method = $upgrade_method;
     scb_register_table($name);
     if ($file) {
         scbUtil::add_activation_hook($file, array($this, 'install'));
         scbUtil::add_uninstall_hook($file, array($this, 'uninstall'));
     }
 }
Example #14
0
 public function admin_tools()
 {
     global $wpdb;
     if (!empty($_POST['search_index']['delete_index'])) {
         foreach (APP_Search_Index::get_registered_post_types() as $post_type) {
             $wpdb->update($wpdb->posts, array('post_content_filtered' => ''), array('post_type' => $post_type));
         }
         update_option(APP_SEARCH_INDEX_OPTION, 0);
         wp_redirect(scbUtil::get_current_url());
         exit;
     }
 }
Example #15
0
 function wrap($content = null, $data = null, $params = null)
 {
     if (!$this->check()) {
         return $params;
     }
     $p =& $params[0];
     // Text widgets are handled differently
     if (0 === strpos($p['widget_id'], 'text-')) {
         return $params;
     }
     $wrap = parent::wrap('', array('widget_id' => $p['widget_id'], 'sidebar_id' => $p['id']));
     list($before, $after) = scbUtil::split_at('</', $wrap);
     $p['before_widget'] = $p['before_widget'] . $before;
     $p['after_widget'] = $after . $p['after_widget'];
     return $params;
 }
Example #16
0
 function page_content()
 {
     do_action('tabs_' . $this->pagehook . '_page_content', $this);
     if (isset($_GET['firstrun'])) {
         do_action('appthemes_first_run');
     }
     $active_tab = isset($_GET['tab']) ? $_GET['tab'] : '';
     $tabs = $this->tabs->get_all();
     if (!isset($tabs[$active_tab])) {
         $active_tab = key($tabs);
     }
     $current_url = scbUtil::get_current_url();
     echo '<h2 class="nav-tab-wrapper">';
     foreach ($tabs as $tab_id => $tab_title) {
         $class = 'nav-tab';
         if ($tab_id == $active_tab) {
             $class .= ' nav-tab-active';
         }
         $href = esc_url(add_query_arg('tab', $tab_id, $current_url));
         echo ' ' . html('a', compact('class', 'href'), $tab_title);
     }
     echo '</h2>';
     echo '<form method="post" action="">';
     echo '<input type="hidden" name="action" value="' . $active_tab . '" />';
     wp_nonce_field($this->nonce);
     foreach ($this->tab_sections[$active_tab] as $section_id => $section) {
         if (isset($section['title'])) {
             echo html('h3 class="title"', $section['title']);
         }
         if (isset($section['desc'])) {
             echo html('p', $section['desc']);
         }
         if (isset($section['renderer'])) {
             call_user_func($section['renderer'], $section, $section_id);
         } else {
             if (isset($section['options']) && is_a($section['options'], 'scbOptions')) {
                 $formdata = $section['options'];
             } else {
                 $formdata = $this->options;
             }
             $this->render_section($section['fields'], $formdata->get());
         }
     }
     echo '<p class="submit"><input type="submit" class="button-primary" value="' . esc_attr__('Save Changes', APP_TD) . '" /></p>';
     echo '</form>';
 }
/**
 * @param array $args:
 * - 'key' (string) The option key
 * - 'theme_option' (bool) Wether it's arbitrary theme text, or a core site option like 'description' or 'time_format'
 * - 'default' (mixed) The default value
 * - 'type' (string|array) The type of UI.
 * - 'echo' (bool) Wether to echo or return the result
 */
function editable_option($args)
{
    if (!is_array($args)) {
        _deprecated_argument(__FUNCTION__, '1.9.5', 'Passing individual arguments is deprecated. Use an associative array of arguments instead.');
        $argv = func_get_args();
        $args = scbUtil::numeric_to_assoc($argv, array('key', 'theme_option', 'type', 'echo'));
    }
    extract(wp_parse_args($args, array('key' => '', 'theme_option' => true, 'default' => false, 'type' => 'input', 'values' => array(), 'echo' => true)));
    if (empty($key)) {
        return false;
    }
    if ($theme_option) {
        $key = "editable_option_{$key}";
    }
    $output = apply_filters('editable_option', get_option($key, $default), $key, compact('type', 'values'));
    if ($echo) {
        echo $output;
    }
    return $output;
}
Example #18
0
/**
 * Register frontend/backend scripts and styles for later enqueue.
 */
function _appthemes_register_scripts()
{
    require_once APP_FRAMEWORK_DIR . '/js/localization.php';
    wp_register_style('jquery-ui-style', APP_FRAMEWORK_URI . '/styles/jquery-ui/jquery-ui.min.css', false, '1.11.2');
    wp_register_script('colorbox', APP_FRAMEWORK_URI . '/js/colorbox/jquery.colorbox.min.js', array('jquery'), '1.6.1');
    wp_register_style('colorbox', APP_FRAMEWORK_URI . '/js/colorbox/colorbox.css', false, '1.6.1');
    wp_register_style('font-awesome', APP_FRAMEWORK_URI . '/styles/font-awesome.min.css', false, '4.2.0');
    wp_register_style('appthemes-icons', APP_FRAMEWORK_URI . '/styles/font-appthemes.css', false, '1.0.0');
    wp_register_script('validate', APP_FRAMEWORK_URI . '/js/validate/jquery.validate.min.js', array('jquery'), '1.13.0');
    wp_register_script('footable', APP_FRAMEWORK_URI . '/js/footable/jquery.footable.min.js', array('jquery'), '2.0.3');
    wp_register_script('footable-grid', APP_FRAMEWORK_URI . '/js/footable/jquery.footable.grid.min.js', array('footable'), '2.0.3');
    wp_register_script('footable-sort', APP_FRAMEWORK_URI . '/js/footable/jquery.footable.sort.min.js', array('footable'), '2.0.3');
    wp_register_script('footable-filter', APP_FRAMEWORK_URI . '/js/footable/jquery.footable.filter.min.js', array('footable'), '2.0.3');
    wp_register_script('footable-striping', APP_FRAMEWORK_URI . '/js/footable/jquery.footable.striping.min.js', array('footable'), '2.0.3');
    wp_register_script('footable-paginate', APP_FRAMEWORK_URI . '/js/footable/jquery.footable.paginate.min.js', array('footable'), '2.0.3');
    wp_register_script('footable-bookmarkable', APP_FRAMEWORK_URI . '/js/footable/jquery.footable.bookmarkable.min.js', array('footable'), '2.0.3');
    // Generic JS data.
    wp_localize_script('jquery', 'AppThemes', array('ajaxurl' => admin_url('admin-ajax.php'), 'current_url' => scbUtil::get_current_url()));
    _appthemes_localize_scripts();
}
 /**
  * Import a user.
  *
  * @param string $subscriber The subscriber's email address
  * @param object|\Prompt_Post Post subscribe object for current post.
  */
 protected function import($subscriber, $object)
 {
     $existing_user = get_user_by('email', $subscriber);
     if ($existing_user and $object->is_subscribed($existing_user->ID)) {
         $this->already_subscribed_count++;
         return;
     }
     if (!$existing_user) {
         $subscriber_id = Prompt_User_Handling::create_from_email($subscriber);
     } else {
         $subscriber_id = $existing_user->ID;
     }
     $subscribed = $object->subscribe($subscriber_id);
     $prompt_user = new Prompt_User($subscriber_id);
     $origin = new Prompt_Subscriber_Origin(array('source_label' => 'Subscribe 2 Comments Reloaded Import', 'source_url' => scbUtil::get_current_url()));
     $prompt_user->set_subscriber_origin($origin);
     $this->imported_count++;
 }
Example #20
0
    static function add_scripts()
    {
        $add_css = apply_filters('smart_archives_load_default_styles', self::$css);
        if (!self::$fancy && !$add_css) {
            return;
        }
        $plugin_url = plugin_dir_url(__FILE__) . 'inc/';
        if (self::$fancy) {
            wp_register_script('tools-tabs', $plugin_url . 'tools.tabs.min.js', array('jquery'), '1.1.2', true);
            scbUtil::do_scripts('tools-tabs');
        }
        if ($add_css) {
            $css_dev = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
            wp_register_style('smart-archives', $plugin_url . "styles{$css_dev}.css", array(), SAR_VERSION);
            scbUtil::do_styles('smart-archives');
        }
        if (self::$fancy) {
            ?>
<script type="text/javascript">
jQuery( document ).ready( function( $ ) {
	$( '.tabs' ).tabs( '> .pane' );
	$( '#smart-archives-fancy .year-list' )
		.find( 'a' ).click( function( ev ) {
			$( '.pane .tabs:visible a:last' ).click();
		} ).end()
		.find( 'a:last' ).click();
} );
</script>
<?php 
        }
    }
Example #21
0
 static function ajax_response()
 {
     // Is user trusted?
     check_ajax_referer(self::$nonce, 'nonce');
     extract(scbUtil::array_extract($_POST, array('callback', 'data')));
     $filter = $data['filter'];
     self::make_instances();
     // Is the current field defined?
     if (!($instance = self::$instances[$filter])) {
         die(-1);
     }
     // Does the user have the right to do this?
     if (!$instance->check($data) || !$instance->allow($data)) {
         die(-1);
     }
     $args = self::get_args($filter);
     try {
         if ('save' == $callback) {
             $content = stripslashes_deep($_POST['content']);
             $result = $instance->save($data, $content);
             $result = @apply_filters($filter, $result);
         } elseif ('get' == $callback) {
             $result = (string) $instance->get($data);
             if ('rich' == $data['type']) {
                 $result = wpautop($result);
             }
         }
         $result = array('content' => $result);
     } catch (Exception $e) {
         $result = array('error' => $e->getMessage());
     }
     die(json_encode($result));
 }
Example #22
0
function appthemes_require_login($args = array())
{
    if (is_user_logged_in()) {
        return;
    }
    $page_url = scbUtil::get_current_url();
    $args = wp_parse_args($args, array('login_text' => __('You must first login.', APP_TD), 'login_register_text' => __('You must first login or <a href="%s">register</a>.', APP_TD)));
    if (get_option('users_can_register')) {
        $register_url = appthemes_get_registration_url();
        $register_url = add_query_arg('redirect_to', $page_url, $register_url);
        $message = sprintf($args['login_register_text'], $register_url);
    } else {
        $message = $args['login_text'];
    }
    set_transient('login_notice', array('error', $message), 300);
    appthemes_auth_redirect_login();
    exit;
}
Example #23
0
 function form_handler()
 {
     if (empty($_POST['action'])) {
         return false;
     }
     check_admin_referer($this->nonce);
     if (!isset($this->options)) {
         trigger_error('options handler not set', E_USER_WARNING);
         return false;
     }
     $new_data = scbUtil::array_extract($_POST, array_keys($this->options->get_defaults()));
     $new_data = stripslashes_deep($new_data);
     $new_data = $this->validate($new_data, $this->options->get());
     $this->options->set($new_data);
     $this->admin_msg();
 }
Example #24
0
 protected function import($subscriber)
 {
     $existing_user = get_user_by('email', $subscriber['email_address']);
     $prompt_site = new Prompt_Site();
     if ($existing_user and $prompt_site->is_subscribed($existing_user->ID)) {
         $this->already_subscribed_count++;
         return;
     }
     if ($existing_user) {
         $subscriber_id = $existing_user->ID;
     } else {
         $subscriber_id = Prompt_User_Handling::create_from_email($subscriber['email_address']);
     }
     $prompt_site->subscribe($subscriber_id);
     $prompt_user = new Prompt_User($subscriber_id);
     $origin = new Prompt_Subscriber_Origin(array('source_label' => 'Jetpack Import', 'source_url' => scbUtil::get_current_url()));
     $prompt_user->set_subscriber_origin($origin);
     $this->imported_count++;
 }
Example #25
0
 function wrap($params)
 {
     if (!$this->check()) {
         return $params;
     }
     $p =& $params[0];
     $data = array('widget_id' => $p['widget_id'], 'sidebar_id' => $p['id']);
     list($before, $after) = scbUtil::split_at('</', parent::wrap('', $data));
     $p['before_widget'] = $p['before_widget'] . $before;
     $p['after_widget'] = $after . $p['after_widget'];
     return $params;
 }
Example #26
0
 /**
  * Constructor.
  *
  * @param string|bool $file (optional)
  * @param object $options (optional) A scbOptions object.
  *
  * @return void
  */
 public function __construct($file = false, $options = null)
 {
     parent::__construct($file, $options);
     scbUtil::add_uninstall_hook($this->file, array($this, 'uninstall'));
 }
Example #27
0
 /**
  * Import a MailPoet subscriber.
  *
  * @since 1.0.0
  * @param array $subscriber
  */
 protected function import($subscriber)
 {
     $existing_user = get_user_by('email', $subscriber['email']);
     if ($existing_user and $this->target_list->is_subscribed($existing_user->ID)) {
         $this->already_subscribed_count++;
         return;
     }
     if (!$existing_user) {
         $subscriber_id = Prompt_User_Handling::create_from_email($subscriber['email']);
         wp_update_user(array('ID' => $subscriber_id, 'first_name' => $subscriber['firstname'], 'last_name' => $subscriber['lastname']));
     } else {
         $subscriber_id = $existing_user->ID;
     }
     $this->target_list->subscribe($subscriber_id);
     $prompt_user = new Prompt_User($subscriber_id);
     $origin = new Prompt_Subscriber_Origin(array('source_label' => 'Mailpoet Import', 'source_url' => scbUtil::get_current_url()));
     $prompt_user->set_subscriber_origin($origin);
     $this->imported_count++;
 }
Example #28
0
    static function scripts()
    {
        $wrapped = array_keys(FEE_Field_Base::get_wrapped());
        // No point loading all that JavaScript if there aren't any editable elements
        if (empty($wrapped)) {
            return;
        }
        // Prepare data
        $data = array('edit_text' => __('Edit', 'front-end-editor'), 'save_text' => __('Save', 'front-end-editor'), 'cancel_text' => __('Cancel', 'front-end-editor'), 'spinner' => admin_url('images/loading.gif'), 'ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce(self::NONCE));
        $css_dependencies = array();
        // Autosuggest
        if (in_array('terminput', $wrapped)) {
            self::$js_dependencies[] = 'suggest';
        }
        if (in_array('rich', $wrapped)) {
            wp_register_style('aloha-editor', plugins_url('lib/aloha-editor/css/aloha.css', FEE_MAIN_FILE), array(), ALOHA_VERSION);
            $css_dependencies[] = 'aloha-editor';
        }
        // Thickbox
        if (count(array_intersect(array('image', 'thumbnail', 'rich'), $wrapped))) {
            $data['image'] = array('url' => admin_url('media-upload.php?post_id=0&editable_image=1&TB_iframe=true&width=640'), 'change' => __('Change Image', 'front-end-editor'), 'insert' => __('Insert Image', 'front-end-editor'), 'revert' => '(' . __('Clear', 'front-end-editor') . ')', 'tb_close' => get_bloginfo('wpurl') . '/wp-includes/js/thickbox/tb-close.png');
            $css_dependencies[] = 'thickbox';
            self::$js_dependencies[] = 'thickbox';
        }
        // Core script
        if (defined('FEE_DEBUG')) {
            foreach (array('core', 'hover', 'init') as $handle) {
                self::register_script("fee-{$handle}", "js/{$handle}.js");
            }
            foreach (glob(dirname(FEE_MAIN_FILE) . '/js/fields/*.js') as $file) {
                $file = basename($file);
                self::register_script("fee-fields-{$file}", "js/fields/{$file}", array('fee-core'));
            }
        } else {
            $min = defined('SCRIPT_DEBUG') ? '' : '.min';
            self::register_script('fee-editor', "build/editor{$min}.js");
        }
        // Core style
        wp_register_style('fee-editor', plugins_url('css/core.css', FEE_MAIN_FILE), $css_dependencies, FEE_VERSION);
        scbUtil::do_styles('fee-editor');
        ?>
<script type='text/javascript'>
var FrontEndEditor = {};
FrontEndEditor.data = <?php 
        echo json_encode($data);
        ?>
;
</script>

<?php 
        if (in_array('rich', $wrapped)) {
            ?>
<script type='text/javascript'>
var Aloha = {};
Aloha.settings = {
	logLevels: { 'error': true, 'warn': true, 'info': true, 'debug': false, 'deprecated': true },
	bundles: {
		fee: '../../../aloha-plugins'
	},
	floatingmenu: {
		width: 410
	},
	sidebar: {
		disabled: true
	},
	plugins: {
		format: {
			config: ['b', 'i', 'del', 'sub', 'sup', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre', 'removeFormat'],
		}
	}
};
</script>
<?php 
            $plugins = array('common/format', 'common/align', 'common/list', 'common/link', 'common/table', 'common/undo', 'common/paste', 'common/block', 'extra/cite', 'fee/wpImage');
            echo html('script', array('src' => plugins_url('lib/aloha-editor/lib/aloha.js', FEE_MAIN_FILE), 'data-aloha-plugins' => implode(',', $plugins))) . "\n";
        }
        scbUtil::do_scripts(self::$js_dependencies);
        do_action('front_end_editor_loaded', $wrapped);
    }
Example #29
0
	function __construct( $file, $options = null ) {
		parent::__construct( $file, $options );

		// too late
		scbUtil::add_uninstall_hook( $this->file, array( $this, 'uninstall' ) );
	}
Example #30
0
/** @internal */
function _p2p_get_connections($p2p_type, $args = array())
{
    global $wpdb;
    extract($args, EXTR_SKIP);
    $where = $wpdb->prepare('WHERE p2p_type = %s', $p2p_type);
    foreach (array('from', 'to') as $key) {
        if ('any' == ${$key}) {
            continue;
        }
        if (empty(${$key})) {
            return array();
        }
        $value = scbUtil::array_to_sql(_p2p_normalize(${$key}));
        $where .= " AND p2p_{$key} IN ({$value})";
    }
    switch ($fields) {
        case 'p2p_id':
        case 'p2p_from':
        case 'p2p_to':
            $sql_field = $fields;
            break;
        case 'count':
            $sql_field = 'COUNT(*)';
            break;
        default:
            $sql_field = '*';
    }
    $query = "SELECT {$sql_field} FROM {$wpdb->p2p} {$where}";
    if ('*' == $sql_field) {
        return $wpdb->get_results($query);
    } else {
        return $wpdb->get_col($query);
    }
}