/**
  * Image editor notice notice.
  */
 public function admin_notice()
 {
     if (!beans_post('beans_flush_edited_images')) {
         return;
     }
     echo '<div id="message" class="updated"><p>' . __('Images flushed successfully!', 'tm-beans') . '</p></div>' . "\n";
 }
 /**
  * Cache cleaner notice.
  */
 public function admin_notice()
 {
     if (!beans_post('beans_flush_compiler_cache')) {
         return;
     }
     echo '<div id="message" class="updated"><p>' . __('Cache flushed successfully!', 'tm-beans') . '</p></div>' . "\n";
 }
Esempio n. 3
0
/**
 * Check if the current screen is a given post type.
 *
 * @ignore
 */
function _beans_is_admin_post_type($post_types)
{
    // Check if it is a new post and treat it as such.
    if (stripos($_SERVER['REQUEST_URI'], 'post-new.php') !== false) {
        if (!($current_post_type = beans_get('post_type'))) {
            return false;
        }
    } else {
        // Try to get id from $_GET.
        if ($id = beans_get('post')) {
            $post_id = $id;
        } elseif ($id = beans_post('post_ID')) {
            $post_id = $id;
        }
        if (!isset($post_id)) {
            return false;
        }
        $current_post_type = get_post_type($post_id);
    }
    if ($post_types === true) {
        return true;
    }
    if (in_array($current_post_type, (array) $post_types)) {
        return true;
    }
    // Support post ids.
    if (isset($post_id) && in_array($post_id, (array) $post_types)) {
        return true;
    }
    return false;
}
Esempio n. 4
0
    /**
     * Image editor notice notice.
     */
    public function admin_notice()
    {
        if (!beans_post('beans_flush_edited_images')) {
            return;
        }
        ?>
		<div id="message" class="updated"><p><?php 
        _e('Images flushed successfully!', 'tm-beans');
        ?>
</p></div>
		<?php 
    }
Esempio n. 5
0
    /**
     * Cache cleaner notice.
     */
    public function admin_notice()
    {
        if (!beans_post('beans_flush_compiler_cache')) {
            return;
        }
        ?>
		<div id="message" class="updated"><p><?php 
        _e('Cache flushed successfully!', 'tm-beans');
        ?>
</p></div>
		<?php 
    }
Esempio n. 6
0
 /**
  * Save Term Meta.
  */
 public function save($term_id)
 {
     if (defined('DOING_AJAX') && DOING_AJAX) {
         return $term_id;
     }
     if (!wp_verify_nonce(beans_post('beans_term_meta_nonce'), 'beans_term_meta_nonce')) {
         return $term_id;
     }
     if (!($fields = beans_post('beans_fields'))) {
         return $term_id;
     }
     foreach ($fields as $field => $value) {
         update_option("beans_term_{$term_id}_{$field}", stripslashes_deep($value));
     }
 }
Esempio n. 7
0
 /**
  * Save Post Meta for attachment.
  */
 public function save_attachment($attachment)
 {
     if (!wp_verify_nonce(beans_post('beans_post_meta_nonce'), 'beans_post_meta_nonce')) {
         return $post_id;
     }
     if (!current_user_can('edit_post', $attachment['ID'])) {
         return $attachment;
     }
     if (!($fields = beans_post('beans_fields'))) {
         return $attachment;
     }
     foreach ($fields as $field => $value) {
         update_post_meta($attachment['ID'], $field, $value);
     }
     return $attachment;
 }
Esempio n. 8
0
/**
 * Fires the options form actions.
 *
 * @ignore
 */
function _beans_options_page_actions()
{
    if (!beans_post('beans_options_nonce')) {
        return;
    }
    // Load the class only if this function is called to prevent unnecessary memory usage.
    require_once BEANS_API_COMPONENTS_PATH . 'options/class.php';
    $class = new _Beans_Options();
    $class->actions();
}
Esempio n. 9
0
/**
 * Check the current screen conditions.
 *
 * @ignore
 */
function _beans_is_post_meta_conditions($conditions)
{
    // Check if it is a new post and treat it as such.
    if (false !== stripos($_SERVER['REQUEST_URI'], 'post-new.php')) {
        if (!($current_post_type = beans_get('post_type'))) {
            if (in_array('post', (array) $conditions)) {
                return true;
            } else {
                return false;
            }
        }
    } else {
        // Try to get id from $_GET.
        if ($id = beans_get('post')) {
            $post_id = $id;
        } elseif ($id = beans_post('post_ID')) {
            // Try to get id from $_POST.
            $post_id = $id;
        }
        if (!isset($post_id)) {
            return false;
        }
        $current_post_type = get_post_type($post_id);
    }
    $statements = array(true === $conditions, in_array($current_post_type, (array) $conditions), isset($post_id) && in_array($post_id, (array) $conditions), isset($post_id) && in_array(get_post_meta($post_id, '_wp_page_template', true), (array) $conditions));
    // Return true if any condition is met, otherwise false.
    return in_array(true, $statements);
}
Esempio n. 10
0
/**
 * Get value from $_GET or $_POST superglobals.
 *
 * @since 1.0.0
 *
 * @param string $needle  Name of the searched key.
 * @param mixed  $default Optional. Value returned if the searched key isn't found.
 *
 * @return string Value if found, $default otherwise.
 */
function beans_get_or_post($needle, $default = null)
{
    if ($get = beans_get($needle)) {
        return $get;
    }
    if ($post = beans_post($needle)) {
        return $post;
    }
    return $default;
}
Esempio n. 11
0
      <div class="uk-margin-bottom">
        <label class="uk-form-label" for="tbr_website">Website (optional)</label>
        <input class="uk-width-1-1 tm-field" type="text" value="<?php 
    echo beans_post('tbr_website');
    ?>
" placeholder="Eg, http://yourwebsite.com" name="tbr_website" tabindex="4">
      </div>
      <div class="uk-width-1-1 uk-form-row tm-form-actions uk-margin-top">
        <label class="uk-form-label" for="tbr_message">Message <span>*</span></label>
        <textarea class="uk-form-large uk-width-1-1 tm-field<?php 
    if ($message = beans_get('tbr_message', $errors)) {
        echo ' tm-field-error';
    }
    ?>
" cols="13" rows="10" placeholder="What is this concerning?" name="tbr_message" tabindex="5"><?php 
    echo beans_post('tbr_message');
    ?>
</textarea>
        <?php 
    if ($message = beans_get('tbr_message', $errors)) {
        echo '<p class="uk-form-danger">' . $message . '</p>';
    }
    ?>
      </div>
      <div class="uk-width-1-1 uk-form-row tm-form-actions uk-margin-top uk-text-center">
        <input type="hidden" name="tbr_contact" value="1"/>
        <button class="uk-button uk-button-primary uk-button-large uk-margin-top" name="tbr_submit" tabindex="6"><?php 
    _e('Send your message', 'themebutler');
    ?>
</button>
      </div>
Esempio n. 12
0
        <div class="uk-margin-bottom">
          <label class="uk-form-label" for="dfh_website">Website</label>
          <input class="uk-width-1-1 tm-field" type="text" value="<?php 
echo beans_post('dfh_website');
?>
" placeholder="http://doggydog.yo" name="dfh_website" tabindex="4">
        </div>
        <div class="uk-width-1-1 uk-form-row tm-form-actions uk-margin-top">
          <label class="uk-form-label" for="dfh_message">Message</label>
          <textarea class="uk-form-large uk-width-1-1 tm-field<?php 
if ($message = beans_get('dfh_message', $errors)) {
    echo ' tm-field-error';
}
?>
" cols="13" rows="10" placeholder="Yo C-dog, lovin the new crib! Super tight, yo! High times we be chattin bout doggydogdog.me, homey. Got me some mad ideas for da new site! Hit me up on da Skype, so we can chat my nizzle. Snoop out!" name="dfh_message" autofocus tabindex="5"><?php 
echo beans_post('dfh_message');
?>
</textarea>
          <?php 
if ($message = beans_get('dfh_message', $errors)) {
    echo '<p class="tm-error">' . $message . '</p>';
}
?>
        </div>
        <div class="uk-width-1-1 uk-form-row tm-form-actions uk-margin-top">
          <input type="hidden" name="action" value="dfh_contact" />
          <button class="uk-button uk-button-primary uk-button-large uk-margin-top" name="dfh_register" tabindex="6"><?php 
_e('Send it, papi', 'dfh');
?>
</button>
        </div>
Esempio n. 13
0
 /**
  * Reset options.
  */
 private function reset()
 {
     if (!wp_verify_nonce(beans_post('beans_options_nonce'), 'beans_options_nonce')) {
         return false;
     }
     if (!($fields = beans_post('beans_fields'))) {
         return false;
     }
     foreach ($fields as $field => $value) {
         delete_option($field);
     }
     $this->success = true;
 }