function __construct() { if (is_admin()) { // common things to run upon init here if (isset($_GET['page']) && ($_GET['page'] == WPDDL_LAYOUTS_POST_TYPE || $_GET['page'] == 'dd_layouts_edit')) { do_action('ddl-wpml-switcher-scripts'); } $this->layouts_settings = WPDDL_Settings::getInstance(); // init gui for settings $this->layouts_settings->init(); // Include "Settings" admin menu add_action('admin_menu', array($this, 'add_layouts_settings_admin_menu'), 11); } }
die(WPDD_Utils::ajax_caps_fail(__METHOD__)); } if ($_POST && wp_verify_nonce($_POST['ddl_max-posts-num_nonce'], 'ddl_max-posts-num_nonce')) { $update = false; $amount = isset($_POST['amount_posts']) ? $_POST['amount_posts'] : self::$max_posts_num_option; if ($amount !== self::$max_posts_num_option) { self::$max_posts_num_option = $amount; $update = self::set_option_max_num_posts($amount); } if ($update) { $send = wp_json_encode(array('Data' => array('message' => __('Updated option', 'ddl-layouts'), 'amount' => $amount))); } else { $send = wp_json_encode(array('Data' => array('error' => __('Option not updated', 'ddl-layouts'), 'amount' => $amount))); } } else { $send = wp_json_encode(array('error' => __(sprintf('Nonce problem: apparently we do not know where the request comes from. %s', __METHOD__), 'ddl-layouts'))); } die($send); } public static function ddl_featured_cells() { return apply_filters('ddl_default_featured_cells', array('child-layout', 'cell-widget-area', 'widget-cell', 'post-loop-views-cell', 'cell-content-template', 'views-content-grid-cell', 'video-cell', 'cell-text', 'slider-cell', 'post-loop-cell', 'menu-cell', 'imagebox-cell', 'cred-user-cell', 'cred-cell', 'comments-cell', 'grid-cell', 'ddl_missing_cell_type', 'ddl-container')); } public function add_supported_featured_cells($features) { $cells = self::ddl_featured_cells(); return array_merge($features, $cells); } } WPDDL_Settings::getInstance();