示例#1
0
 function prepare_items()
 {
     $search = isset($_REQUEST['s']) ? $_REQUEST['s'] : '';
     $per_page = 50;
     $paged = $this->get_pagenum();
     $this->items = array();
     if (($families = Genesis_Club_Fonts::get_option('families')) && is_array($families)) {
         foreach ($families as $key => $values) {
             $this->items[] = json_decode(json_encode(array('font_id' => $key) + $values), FALSE);
         }
     } else {
         $families = array();
     }
     $this->set_pagination_args(array('total_items' => count($families), 'per_page' => $per_page));
 }
示例#2
0
 function save_families()
 {
     check_admin_referer(__CLASS__);
     $all_fonts = Genesis_Club_Fonts::get_all_fonts();
     $new_fonts = array();
     foreach ($_POST as $key => $values) {
         if ('family-' == substr($key, 0, 7)) {
             $font_id = substr($key, 7);
             $new_fonts[$font_id] = array('family' => $all_fonts[$font_id]['family'], 'variants' => $values);
         }
     }
     $message = __(Genesis_Club_Fonts::save_families(array_merge(Genesis_Club_Fonts::get_families(), $new_fonts)) ? 'Font Families were updated successfully' : 'Font Families were not updated', GENESIS_CLUB_DOMAIN);
     $redir = wp_get_referer();
     //get the referer
     $redir = remove_query_arg(array('action', 'noheader', 'font_id'), $redir);
     //remove the action
     $redir = add_query_arg(array('message' => urlencode($message), 'lastaction' => 'fonts'), $redir);
     //update the URL
     wp_redirect($redir);
     exit;
 }