Пример #1
8
/**
 * This function outputs a 404 "Not Found" error message
 *
 * @since 1.6
 */
function genesis_404()
{
    echo genesis_html5() ? '<article class="entry">' : '<div class="post hentry">';
    printf('<h1 class="entry-title">%s</h1>', apply_filters('genesis_404_entry_title', __('Not found, error 404', 'genesis')));
    echo '<div class="entry-content">';
    if (genesis_html5()) {
        echo apply_filters('genesis_404_entry_content', '<p>' . sprintf(__('The page you are looking for no longer exists. Perhaps you can return back to the site\'s <a href="%s">homepage</a> and see if you can find what you are looking for. Or, you can try finding it by using the search form below.', 'genesis'), trailingslashit(home_url())) . '</p>');
        get_search_form();
    } else {
        ?>

			<p><?php 
        printf(__('The page you are looking for no longer exists. Perhaps you can return back to the site\'s <a href="%s">homepage</a> and see if you can find what you are looking for. Or, you can try finding it with the information below.', 'genesis'), trailingslashit(home_url()));
        ?>
</p>



	<?php 
    }
    if (!genesis_html5()) {
        genesis_sitemap('h4');
    } elseif (genesis_a11y('404-page')) {
        echo '<h2>' . __('Sitemap', 'genesis') . '</h2>';
        genesis_sitemap('h3');
    }
    echo '</div>';
    echo genesis_html5() ? '</article>' : '</div>';
}
Пример #2
2
/**
 * Echo message about minimum WordPress Version
 */
function _pb_minimum_wp()
{
    global $pb_minimum_wp;
    echo '<div id="message" class="error fade"><p>';
    printf(__('Pressbooks will not work with your version of WordPress. Pressbooks requires a dedicated install of WordPress Multi-Site, version %s or greater. Please upgrade WordPress if you would like to use Pressbooks.', 'pressbooks'), $pb_minimum_wp);
    echo '</p></div>';
}
Пример #3
1
 public function run()
 {
     if ($this->footerWrapper) {
         echo Html::beginTag('div', ['class' => 'form-group panel-footer']);
     }
     $submit_options = [];
     if ($this->form) {
         $submit_options['form'] = $this->form;
     }
     $extra = '';
     if ($this->extraBtns) {
         $extra = '&nbsp;' . implode(' ', (array) $this->extraBtns);
     }
     if (isset($this->model->isNewRecord) && $this->model->isNewRecord) {
         if ($this->saveLink) {
             $submit_options['class'] = 'btn btn-success';
             echo Html::submitButton(__('Create'), $submit_options);
         }
         echo $extra;
     } else {
         if ($this->saveLink) {
             $submit_options['class'] = 'btn btn-primary';
             echo Html::submitButton(__('Update'), $submit_options);
         }
         echo $extra;
         if ($this->removeLink) {
             echo ' ';
             echo Html::a(__('Delete'), ['delete', 'id' => $this->model->id], ['class' => 'btn btn-danger', 'data-confirm' => __('Are you sure you want to delete this item?'), 'data-method' => 'post']);
         }
     }
     if ($this->footerWrapper) {
         echo Html::endTag('div');
     }
 }
Пример #4
1
 /**
  * Generate RSS XML with sales rules data
  *
  * @return string
  */
 protected function _toHtml()
 {
     $storeId = $this->_getStoreId();
     $storeModel = $this->_storeManager->getStore($storeId);
     $websiteId = $storeModel->getWebsiteId();
     $customerGroup = $this->_getCustomerGroupId();
     $now = date('Y-m-d');
     $url = $this->_urlBuilder->getUrl('');
     $newUrl = $this->_urlBuilder->getUrl('rss/catalog/salesrule');
     $title = __('%1 - Discounts and Coupons', $storeModel->getName());
     $lang = $this->_scopeConfig->getValue('general/locale/code', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeModel);
     /** @var $rssObject \Magento\Rss\Model\Rss */
     $rssObject = $this->_rssFactory->create();
     $rssObject->_addHeader(array('title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8', 'language' => $lang));
     /** @var $collection \Magento\SalesRule\Model\Resource\Rule\Collection */
     $collection = $this->_collectionFactory->create();
     $collection->addWebsiteGroupDateFilter($websiteId, $customerGroup, $now)->addFieldToFilter('is_rss', 1)->setOrder('from_date', 'desc');
     $collection->load();
     /** @var $ruleModel \Magento\SalesRule\Model\Rule */
     foreach ($collection as $ruleModel) {
         $description = '<table><tr>' . '<td style="text-decoration:none;">' . $ruleModel->getDescription() . '<br/>Discount Start Date: ' . $this->formatDate($ruleModel->getFromDate(), 'medium');
         if ($ruleModel->getToDate()) {
             $description .= '<br/>Discount End Date: ' . $this->formatDate($ruleModel->getToDate(), 'medium');
         }
         if ($ruleModel->getCouponCode()) {
             $description .= '<br/> Coupon Code: ' . $ruleModel->getCouponCode();
         }
         $description .= '</td></tr></table>';
         $rssObject->_addEntry(array('title' => $ruleModel->getName(), 'description' => $description, 'link' => $url));
     }
     return $rssObject->createRssXml();
 }
Пример #5
1
 /**
  * Save action
  *
  * @return \Magento\Framework\Controller\ResultInterface
  */
 public function execute()
 {
     $data = $this->getRequest()->getPostValue();
     /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
     $resultRedirect = $this->resultRedirectFactory->create();
     if ($data) {
         $model = $this->_objectManager->create('OsmanSorkar\\Blog\\Model\\Category');
         $id = $this->getRequest()->getParam('cat_id');
         if ($id) {
             $model->load($id);
         }
         $model->setData($data);
         $this->_eventManager->dispatch('blog_category_prepare_save', ['post' => $model, 'request' => $this->getRequest()]);
         try {
             $model->save();
             $this->messageManager->addSuccess(__('You saved this Category.'));
             $this->_objectManager->get('Magento\\Backend\\Model\\Session')->setFormData(false);
             if ($this->getRequest()->getParam('back')) {
                 return $resultRedirect->setPath('*/*/edit', ['cat_id' => $model->getId(), '_current' => true]);
             }
             return $resultRedirect->setPath('*/*/');
         } catch (\Magento\Framework\Exception\LocalizedException $e) {
             $this->messageManager->addError($e->getMessage());
         } catch (\RuntimeException $e) {
             $this->messageManager->addError($e->getMessage());
         } catch (\Exception $e) {
             $this->messageManager->addException($e, __('Something went wrong while saving the page.'));
         }
         $this->_getSession()->setFormData($data);
         return $resultRedirect->setPath('*/*/edit', ['cat_id' => $this->getRequest()->getParam('cat_id')]);
     }
     return $resultRedirect->setPath('*/*/');
 }
 function destroy($id)
 {
     $param = array('conditions' => array('id' => $id));
     $enumeration = $this->Enumeration->find('first', $param);
     $this->set('options', $this->Enumeration->OPTIONS);
     $this->set('enumeration', $enumeration);
     $count = $this->Enumeration->objects_count($enumeration);
     $this->set('objects_count', $count);
     if ($count == 0) {
         # No associated objects
         if ($this->Enumeration->del($id)) {
             $this->Session->setFlash(__('Successful update.', true), 'default', array('class' => 'flash flash_notice'));
             $this->redirect('index');
         }
     } else {
         if (isset($this->data['Enumeration']['reassign_to_id'])) {
             #      if reassign_to = Enumeration.find_by_opt_and_id(@enumeration.opt, params[:reassign_to_id])
             $this->Enumeration->destroy($enumeration, $this->data['Enumeration']['reassign_to_id']);
             $this->redirect('index');
             #      end
         }
     }
     $this->set('enumerations', $this->Enumeration->get_values($enumeration['Enumeration']['opt']));
     #  #rescue
     #  #  flash[:error] = 'Unable to delete enumeration'
     #  #  redirect_to :action => 'index'
 }
Пример #7
1
 /**
  * Add default value for 'taxonomy' field
  *
  * @param $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $default_args = array('hide_empty' => false);
     // Set default args
     $field['options']['args'] = !isset($field['options']['args']) ? $default_args : wp_parse_args($field['options']['args'], $default_args);
     $tax = get_taxonomy($field['options']['taxonomy']);
     $field['placeholder'] = empty($field['placeholder']) ? sprintf(__('Select a %s', 'framework'), $tax->labels->singular_name) : $field['placeholder'];
     switch ($field['options']['type']) {
         case 'select_advanced':
             $field = RWMB_Select_Advanced_Field::normalize_field($field);
             break;
         case 'checkbox_list':
         case 'checkbox_tree':
             $field = RWMB_Checkbox_List_Field::normalize_field($field);
             break;
         case 'select':
         case 'select_tree':
             $field = RWMB_Select_Field::normalize_field($field);
             break;
         default:
             $field['options']['type'] = 'select';
             $field = RWMB_Select_Field::normalize_field($field);
     }
     if (in_array($field['options']['type'], array('checkbox_tree', 'select_tree'))) {
         if (isset($field['options']['args']['parent'])) {
             $field['options']['parent'] = $field['options']['args']['parent'];
             unset($field['options']['args']['parent']);
         } else {
             $field['options']['parent'] = 0;
         }
     }
     $field['field_name'] = "{$field['id']}[]";
     return $field;
 }
Пример #8
0
 /**
  * @param AbstractElement $element
  * @return string
  */
 public function render(AbstractElement $element)
 {
     $html = $this->_getHeaderHtml($element);
     foreach ($this->_imageTypes as $key => $attribute) {
         /**
          * Watermark size field
          */
         /** @var \Magento\Framework\Data\Form\Element\Text $field */
         $field = $this->_elementFactory->create('text');
         $field->setName("groups[watermark][fields][{$key}_size][value]")->setForm($this->getForm())->setLabel(__('Size for %1', $attribute['title']))->setRenderer($this->_formField);
         $html .= $field->toHtml();
         /**
          * Watermark upload field
          */
         /** @var \Magento\Framework\Data\Form\Element\Imagefile $field */
         $field = $this->_elementFactory->create('imagefile');
         $field->setName("groups[watermark][fields][{$key}_image][value]")->setForm($this->getForm())->setLabel(__('Watermark File for %1', $attribute['title']))->setRenderer($this->_formField);
         $html .= $field->toHtml();
         /**
          * Watermark position field
          */
         /** @var \Magento\Framework\Data\Form\Element\Select $field */
         $field = $this->_elementFactory->create('select');
         $field->setName("groups[watermark][fields][{$key}_position][value]")->setForm($this->getForm())->setLabel(__('Position of Watermark for %1', $attribute['title']))->setRenderer($this->_formField)->setValues($this->_watermarkPosition->toOptionArray());
         $html .= $field->toHtml();
     }
     $html .= $this->_getFooterHtml($element);
     return $html;
 }
Пример #9
0
 /**
  * Adds 'used_in_recommender' form field
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function addUsedInRecommender(\Magento\Framework\Event\Observer $observer)
 {
     /** @var \Magento\Framework\Data\Form $form */
     $form = $observer->getEvent()->getForm();
     $fieldset = $form->getElement('advanced_fieldset');
     $fieldset->addField('used_in_recommender', 'select', ['name' => 'used_in_recommender', 'label' => __('Used in Recommender'), 'title' => __('Used in Recommender (Exported to the recommender system)'), 'note' => __('Exported to the recommender system'), 'values' => $this->_yesNo->toOptionArray()]);
 }
Пример #10
0
 /**
  * Sets the export MediaWiki properties
  *
  * @return void
  */
 protected function setProperties()
 {
     $exportPluginProperties = new ExportPluginProperties();
     $exportPluginProperties->setText('MediaWiki Table');
     $exportPluginProperties->setExtension('mediawiki');
     $exportPluginProperties->setMimeType('text/plain');
     $exportPluginProperties->setOptionsText(__('Options'));
     // create the root group that will be the options field for
     // $exportPluginProperties
     // this will be shown as "Format specific options"
     $exportSpecificOptions = new OptionsPropertyRootGroup("Format Specific Options");
     // general options main group
     $generalOptions = new OptionsPropertyMainGroup("general_opts", __('Dump table'));
     // what to dump (structure/data/both)
     $subgroup = new OptionsPropertySubgroup("dump_table", __("Dump table"));
     $leaf = new RadioPropertyItem('structure_or_data');
     $leaf->setValues(array('structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')));
     $subgroup->setSubgroupHeader($leaf);
     $generalOptions->addProperty($subgroup);
     // export table name
     $leaf = new BoolPropertyItem("caption", __('Export table names'));
     $generalOptions->addProperty($leaf);
     // export table headers
     $leaf = new BoolPropertyItem("headers", __('Export table headers'));
     $generalOptions->addProperty($leaf);
     //add the main group to the root group
     $exportSpecificOptions->addProperty($generalOptions);
     // set the options for the export plugin property item
     $exportPluginProperties->setOptions($exportSpecificOptions);
     $this->properties = $exportPluginProperties;
 }
 /**
  * Display or return HTML-formatted team.
  *
  * @since  1.0.0
  * @param  string|array $args Arguments.
  * @return string
  */
 public function the_mailer($args = '')
 {
     /**
      * Filter the array of default arguments.
      *
      * @since 1.0.0
      * @param array Default arguments.
      * @param array The 'the_team' function argument.
      */
     $defaults = apply_filters('cherry_the_team_default_args', array('button_text' => __('Subscribe', 'cherry-mailer'), 'placeholder' => __('enter your email', 'cherry-mailer'), 'success_message' => __('Successfully', 'cherry-mailer'), 'fail_message' => __('Failed', 'cherry-mailer'), 'warning_message' => __('Warning', 'cherry-mailer'), 'is_popup' => __('true', 'cherry-mailer'), 'template' => 'default.tmpl', 'col_xs' => '12', 'col_sm' => '6', 'col_md' => '3', 'col_lg' => 'none', 'class' => ''), $args);
     $args = wp_parse_args($args, $defaults);
     $output = '';
     // The Display.
     if ('true' == $args['popup_is']) {
         // if popup
         $output .= '<a class="subscribe-popup-link" href="#cherry-mailer-form">';
         $output .= $args['button_text'];
         $output .= '</a>';
         $output .= '<div class="cherry-mailer-container">';
     }
     $output .= '<form id="cherry-mailer-form">';
     $output .= '<input type="hidden" name="action" value="mailersubscribe">';
     $output .= $this->get_mailer_loop($args);
     $output .= '</form>';
     if ('true' == $args['popup_is']) {
         // if popup
         $output .= '</div>';
     }
     return $output;
 }
Пример #12
0
 function validate($data = null)
 {
     $this->errors = array();
     if (!empty($data)) {
         $data = empty($data[$this->model]) ? $data : $data[$this->model];
         foreach ($data as $dkey => $dval) {
             $this->data->{$dkey} = stripslashes($dval);
         }
         extract($data, EXTR_SKIP);
         if (empty($gallery_id)) {
             $this->errors['title'] = __('No gallery was specified', $this->plugin_name);
         }
         if (empty($slide_id)) {
             $this->errors['title'] = __('No slide was specified', $this->plugin_name);
         }
         if (empty($this->errors)) {
             if ($galleryslide = $this->find(array('gallery_id' => $gallery_id, 'slide_id' => $slide_id))) {
                 $this->data->id = $galleryslide->id;
             }
         }
     } else {
         $this->errors[] = __('No data was posted', $this->plugin_name);
     }
     return $this->errors;
 }
 /**
  * Check if users need to set the file permissions in order to support the theme, and if not, displays warnings messages in admin option page.
  */
 function wt_warnings()
 {
     global $wp_version;
     $warnings = array();
     if (!wt_check_wp_version()) {
         $warnings[] = 'Wordpress version(<b>' . $wp_version . '</b>) is too low. Please upgrade to the latest version.';
     }
     if (!function_exists("imagecreatetruecolor")) {
         $warnings[] = 'GD Library Error: <b>imagecreatetruecolor does not exist</b>. Please contact your host provider and ask them to install the GD library, otherwise this theme won\'t work properly.';
     }
     if (!is_writeable(THEME_CACHE_DIR)) {
         $warnings[] = 'The cache folder (<b>' . str_replace(WP_CONTENT_DIR, '', THEME_CACHE_DIR) . '</b>) is not writeable. Please set the correct file permissions (<b>\'777\' or \'755\'</b>), otherwise this theme won\'t work properly.';
     }
     if (!file_exists(THEME_CACHE_DIR . DIRECTORY_SEPARATOR . 'skin.css')) {
         $warnings[] = 'The skin style file (<b>' . str_replace(WP_CONTENT_DIR, '', THEME_CACHE_DIR) . '/skin.css' . '</b>) doesn\'t exists or it was deleted. Please manually create this file or click on \'Save changes\' and it will be automatically created.';
     }
     if (!is_writeable(THEME_CACHE_DIR . DIRECTORY_SEPARATOR . 'skin.css')) {
         $warnings[] = 'The skin style file (<b>' . str_replace(WP_CONTENT_DIR, '', THEME_CACHE_DIR) . '/skin.css' . '</b>) is not writeable. Please set the correct permissions (<b>\'777\' or \'755\'</b>), otherwise this theme won\'t work properly.';
     }
     $str = '';
     if (!empty($warnings)) {
         $str = '<ul>';
         foreach ($warnings as $warning) {
             $str .= '<li>' . $warning . '</li>';
         }
         $str .= '</ul>';
         echo "\r\n\t\t\t\t<div id='theme-warning' class='error fade'><p><strong>" . sprintf(__('%1$s Error Messages', 'wt_admin'), THEME_NAME) . "</strong><br/>" . $str . "</p></div>\r\n\t\t\t";
     }
 }
Пример #14
0
    function widget($args, $instance)
    {
        extract($args);
        $title = isset($instance['title']) && $instance['title'] ? $instance['title'] : __('Recent tags', 'p2');
        $num_to_show = isset($instance['num_to_show']) && (int) $instance['num_to_show'] ? (int) $instance['num_to_show'] : $this->default_num_to_show;
        $recent_tags = $this->recent_tags($num_to_show);
        echo $before_widget . $before_title . esc_html($title) . $after_title;
        echo "\t<ul>\n";
        foreach ($recent_tags as $recent) {
            ?>
		<li>
			<a href="<?php 
            echo esc_url($recent['link']);
            ?>
"><?php 
            echo esc_html($recent['tag']->name);
            ?>
</a>&nbsp;
			(&nbsp;<?php 
            echo number_format_i18n($recent['tag']->count);
            ?>
&nbsp;)
		</li>
	<?php 
        }
        ?>
	</ul>
	<?php 
        echo $after_widget;
    }
Пример #15
0
 public function Services_meta()
 {
     $Services_meta = array('id' => 'Services_section', 'title' => __('Home Page Additional Information', 'SimThemes'), 'desc' => '', 'pages' => array('Service'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('id' => 'service_icon', 'label' => __('Service Icon', 'SimThemes'), 'desc' => sprintf(__('Please select the icon', 'SimThemes')), 'std' => '', 'type' => 'font-awesome', 'section' => 'option_types', 'rows' => '', 'post_type' => '', 'taxonomy' => '', 'min_max_step' => '', 'class' => ''), array('id' => 'client_Email', 'label' => __('Clint Email', 'SimThemes'), 'desc' => '', 'std' => '', 'type' => 'text', 'section' => 'option_types', 'rows' => '', 'post_type' => '', 'taxonomy' => '', 'min_max_step' => '', 'class' => '', 'operator' => 'and'), array('id' => 'client_Designation', 'label' => __('Clint Designation', 'SimThemes'), 'desc' => '', 'std' => '', 'type' => 'text', 'section' => 'option_types', 'rows' => '', 'post_type' => '', 'taxonomy' => '', 'min_max_step' => '', 'class' => '', 'operator' => 'and')));
     if (function_exists('ot_register_meta_box')) {
         ot_register_meta_box($Services_meta);
     }
 }
Пример #16
0
 /**
  * @return void
  */
 protected function _construct()
 {
     parent::_construct();
     $this->setId('page_tabs');
     $this->setDestElementId('edit_form');
     $this->setTitle(__('Page Information'));
 }
Пример #17
0
 public function setUp()
 {
     /**
      * Adds setting fields in the meta box.
      */
     $this->addSettingFields(array('field_id' => '_dgx_donate_fund_show', 'title' => __('Display on donation form', 'seamless-donations'), 'type' => 'radio', 'label' => array('Yes' => 'Yes', 'No' => 'No'), 'default' => 'Yes', 'description' => __('If you select Yes, this fund will be shown on the front-end donation form.' . '<br>If you select No, this fund will not be shown on the donation form.', 'seamless-donations')));
 }
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Pages') : $instance['title']);
        $sortby = empty($instance['sortby']) ? 'menu_order' : $instance['sortby'];
        $exclude = empty($instance['exclude']) ? '' : $instance['exclude'];
        if ($sortby == 'post_date') {
            $showdate = "created";
        }
        if ($sortby == 'menu_order') {
            $sortby = 'menu_order, post_title, post_date';
        }
        $out = wp_list_pages(apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude, 'show_date' => $showdate)));
        if (!empty($out)) {
            echo $before_widget;
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>

		<ul>

			<?php 
            echo $out;
            ?>

		</ul>

		<?php 
            echo $after_widget;
        }
    }
Пример #19
0
/**
 * Set up the placeholder metaboxes for Pitch's slide
 */
function pitch_add_slide_metabox()
{
    if (defined('SITEORIGIN_IS_PREMIUM')) {
        return;
    }
    add_meta_box('pitch_slide_destination', __('Destination', 'pitch'), 'pitch_slide_destination_metabox', 'slide', 'side');
}
Пример #20
0
function sp_init_bp_special_tags()
{
    global $special_tags;
    /*
     * Buddypress components
     */
    $special_tags->add_tag('%%component_name%%', 'sp_get_bp_current_component', __('Shows the component name', 'seopress'));
    $special_tags->add_set('bp_component', array('%%component_name%%'));
    /*
     * Buddypress activities
     */
    $special_tags->add_tag('%%activity_content%%', 'sp_get_bp_activity_content', __('Shows the content of the activity', 'seopress'));
    $special_tags->add_tag('%%activity_author%%', 'sp_get_bp_activity_author', __('Shows the author of the activity', 'seopress'));
    $special_tags->add_set('bp_activity', array('%%activity_content%%', '%%activity_author%%'));
    /*
     * Buddypress groups
     */
    $special_tags->add_tag('%%group%%', 'sp_get_bp_group_name', __('Shows the group name', 'seopress'));
    $special_tags->add_tag('%%group_description%%', 'sp_get_bp_group_description', __('Shows the group description', 'seopress'));
    $special_tags->add_set('bp_group', array('%%group%%', '%%group_description%%'));
    /*
     * Buddypress users
     */
    $special_tags->add_tag('%%user_name%%', 'sp_get_bp_user_display_name', __('Shows name of the user', 'seopress'));
    $special_tags->add_set('bp_user', array('%%user_name%%'));
    /*
     * Buddypress forums
     */
    // sp_add_special_tag( 'bp_forum' , '%%forumname%%', 'sp_get_bp_group_name', __( 'Shows the forum name' , 'seopress') ); // Has it a name ???
    $special_tags->add_tag('%%forum_topic_title%%', 'sp_get_bp_forum_topic_title', __('Shows the forum topic title', 'seopress'));
    $special_tags->add_tag('%%forum_topic_text%%', 'sp_get_bp_forum_post_text', __('Shows the forum topic text', 'seopress'));
    $special_tags->add_tag('%%forum_topic_author%%', 'sp_get_bp_forum_topic_poster_name', __('Shows the forum topic poster name', 'seopress'));
    $special_tags->add_set('bp_forum_topic', array('%%forum_topic_title%%', '%%forum_topic_text%%', '%%forum_topic_author%%'));
}
Пример #21
0
 /**
  * @see CPAC_Column::init()
  * @since 2.2.1
  */
 public function init()
 {
     parent::init();
     // Properties
     $this->properties['type'] = 'column-mediaid';
     $this->properties['label'] = __('ID', 'codepress-admin-columns');
 }
 /**
  * execute function
  * @param <type> $request
  */
 public function execute($request)
 {
     $this->setForm(new LocalizationForm());
     $languages = $this->getRequest()->getLanguages();
     $this->browserLanguage = $languages[0];
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter($this->form->getName()));
         if ($this->form->isValid()) {
             // For reloading main menu (index.php)
             $_SESSION['load.admin.localization'] = true;
             $formValues = $this->form->getFormValues();
             $defaultLanguage = $formValues['defaultLanguage'];
             $setBrowserLanguage = !empty($formValues['setBrowserLanguage']) ? "Yes" : "No";
             $supprotedLanguages = $this->form->getLanguages();
             if ($setBrowserLanguage == "Yes" && in_array($languages[0], $supprotedLanguages)) {
                 $defaultLanguage = $languages[0];
             }
             $this->getUser()->setCulture($defaultLanguage);
             $this->getConfigService()->setAdminLocalizationDefaultLanguage($formValues['defaultLanguage']);
             $this->getConfigService()->setAdminLocalizationUseBrowserLanguage($setBrowserLanguage);
             $this->getUser()->setDateFormat($formValues['defaultDateFormat']);
             $this->getConfigService()->setAdminLocalizationDefaultDateFormat($formValues['defaultDateFormat']);
             $this->getUser()->setFlash('success', __(TopLevelMessages::SAVE_SUCCESS));
         }
         $this->redirect("admin/localization");
     }
 }
Пример #23
0
function custom_post_type_maxcom()
{
    register_post_type('sucursal', array('labels' => array('name' => __('Sucursal', 'bonestheme'), 'singular_name' => __('Sucursal', 'bonestheme'), 'all_items' => __('All sucursals', 'bonestheme'), 'add_new' => __('Add New', 'bonestheme'), 'add_new_item' => __('Add New Sucursal', 'bonestheme'), 'edit' => __('Edit', 'bonestheme'), 'edit_item' => __('Edit Post Types', 'bonestheme'), 'new_item' => __('New Post Type', 'bonestheme'), 'view_item' => __('View Post Type', 'bonestheme'), 'search_items' => __('Search Post Type', 'bonestheme'), 'not_found' => __('Nothing found in the Database.', 'bonestheme'), 'not_found_in_trash' => __('Nothing found in Trash', 'bonestheme'), 'parent_item_colon' => ''), 'description' => __('This is the example sucursal type', 'bonestheme'), 'public' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'show_ui' => true, 'query_var' => true, 'menu_position' => 8, 'rewrite' => array('slug' => 'sucursal', 'with_front' => false), 'has_archive' => 'sucursal', 'capability_type' => 'post', 'hierarchical' => false, 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'revisions')));
    /* end of register post type */
    register_taxonomy('region', array('sucursal'), array('hierarchical' => true, 'labels' => array('name' => __('Regiónes', 'bonestheme'), 'singular_name' => __('Región', 'bonestheme'), 'search_items' => __('Search Regiónes', 'bonestheme'), 'all_items' => __('All Regiónes', 'bonestheme'), 'parent_item' => __('Parent Región', 'bonestheme'), 'parent_item_colon' => __('Parent Región:', 'bonestheme'), 'edit_item' => __('Edit Región', 'bonestheme'), 'update_item' => __('Update Región', 'bonestheme'), 'add_new_item' => __('Add New Región', 'bonestheme'), 'new_item_name' => __('New Región Name', 'bonestheme')), 'show_admin_column' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => 'region')));
    register_taxonomy('tipo', array('sucursal'), array('hierarchical' => true, 'labels' => array('name' => __('Tipo Sucursales', 'bonestheme'), 'singular_name' => __('Tipo Sucursal', 'bonestheme'), 'search_items' => __('Search Tipo Sucursales', 'bonestheme'), 'all_items' => __('All Tipo Sucursales', 'bonestheme'), 'parent_item' => __('Parent Tipo Sucursal', 'bonestheme'), 'parent_item_colon' => __('Parent Tipo Sucursal:', 'bonestheme'), 'edit_item' => __('Edit Tipo Sucursal', 'bonestheme'), 'update_item' => __('Update Tipo Sucursal', 'bonestheme'), 'add_new_item' => __('Add New Tipo Sucursal', 'bonestheme'), 'new_item_name' => __('New Tipo Sucursal Name', 'bonestheme')), 'show_admin_column' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => 'tipo')));
}
Пример #24
0
function wpcf7_submit_shortcode_handler($tag)
{
    if (!is_array($tag)) {
        return '';
    }
    $options = (array) $tag['options'];
    $values = (array) $tag['values'];
    $atts = '';
    $id_att = '';
    $class_att = '';
    foreach ($options as $option) {
        if (preg_match('%^id:([-0-9a-zA-Z_]+)$%', $option, $matches)) {
            $id_att = $matches[1];
        } elseif (preg_match('%^class:([-0-9a-zA-Z_]+)$%', $option, $matches)) {
            $class_att .= ' ' . $matches[1];
        }
    }
    if ($id_att) {
        $atts .= ' id="' . trim($id_att) . '"';
    }
    if ($class_att) {
        $atts .= ' class="' . trim($class_att) . '"';
    }
    $value = $values[0];
    if (empty($value)) {
        $value = __('Send', 'wpcf7');
    }
    $ajax_loader_image_url = wpcf7_plugin_url('images/ajax-loader.gif');
    $html = '<input type="submit" value="' . esc_attr($value) . '"' . $atts . ' />';
    $html .= ' <img class="ajax-loader" style="visibility: hidden;" alt="ajax loader" src="' . $ajax_loader_image_url . '" />';
    return $html;
}
Пример #25
0
 function facility_post_type($post_types)
 {
     $labels = array('name' => _x('Facility', 'Post Type General Name', 'sage'), 'singular_name' => _x('Facility', 'Post Type Singular Name', 'sage'), 'menu_name' => __('Facilities', 'sage'), 'name_admin_bar' => __('Facilities', 'sage'), 'parent_item_colon' => __('Parent Facility:', 'sage'), 'all_items' => __('All Facilities', 'sage'), 'add_new_item' => __('Add New Facility', 'sage'), 'add_new' => __('Add New', 'sage'), 'new_item' => __('New Facility', 'sage'), 'edit_item' => __('Edit Facility', 'sage'), 'update_item' => __('Update Facility', 'sage'), 'view_item' => __('View Facility', 'sage'), 'search_items' => __('Search Facility', 'sage'), 'not_found' => __('Not found', 'sage'), 'not_found_in_trash' => __('Not found in Trash', 'sage'), 'items_list' => __('Facility list', 'sage'), 'items_list_navigation' => __('Facility list navigation', 'sage'), 'filter_items_list' => __('Filter Facility list', 'sage'));
     $rewrite = array('slug' => 'facility', 'with_front' => true, 'pages' => true, 'feeds' => true);
     $post_types['facility'] = array('label' => __('Facilities', 'sage'), 'description' => __('List of facilities in the establishment', 'sage'), 'labels' => $labels, 'supports' => array('title', 'thumbnail', 'excerpt', 'revisions'), 'taxonomies' => array('facility-type', 'category', 'post_tag'), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 7, 'menu_icon' => 'dashicons-welcome-view-site', 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'show_in_rest' => true, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'rewrite' => $rewrite, 'capability_type' => 'page');
     return $post_types;
 }
Пример #26
0
 public function init()
 {
     $this->settings = get_option('ninja_forms_settings');
     if (!extension_loaded('curl')) {
         throw new Exception(sprintf(__('The cURL extension is not loaded. %sPlease ensure its installed and activated.%s', 'ninja-forms-upload'), '<a href="http://php.net/manual/en/curl.installation.php">', '</a>'));
     }
     $this->oauth = new Dropbox_OAuth_Consumer_Curl(self::CONSUMER_KEY, self::CONSUMER_SECRET);
     $this->oauth_state = $this->get_option('dropbox_oauth_state');
     $this->request_token = $this->get_token('request');
     $this->access_token = $this->get_token('access');
     if ($this->oauth_state == 'request') {
         //If we have not got an access token then we need to grab one
         try {
             $this->oauth->setToken($this->request_token);
             $this->access_token = $this->oauth->getAccessToken();
             $this->oauth_state = 'access';
             $this->oauth->setToken($this->access_token);
             $this->save_tokens();
             //Supress the error because unlink, then init should be called
         } catch (Exception $e) {
         }
     } elseif ($this->oauth_state == 'access') {
         $this->oauth->setToken($this->access_token);
     } else {
         //If we don't have an acess token then lets setup a new request
         $this->request_token = $this->oauth->getRequestToken();
         $this->oauth->setToken($this->request_token);
         $this->oauth_state = 'request';
         $this->save_tokens();
     }
     $this->dropbox = new Dropbox_API($this->oauth);
 }
Пример #27
0
 function admin_index()
 {
     $this->City->recursive = 0;
     $filters = $this->AlaxosFilter->get_filter();
     $data_city = array();
     if (empty($this->params['named']['export_excel'])) {
         $this->set('cities', $this->paginate($this->City, $filters));
     } else {
         Configure::write('debug', 0);
         $options = array();
         $this->set('export_to_excel', 1);
         $i = 0;
         $cities = $this->City->find('all', array_merge_recursive($options, array('conditions' => $filters)));
         foreach ($cities as $city) {
             foreach ($city as $indx => $module) {
                 foreach ($module as $k => $v) {
                     $arr_fields_in_xls = array();
                     if (!empty($arr_fields_in_xls) && in_array($k, $arr_fields_in_xls[$indx])) {
                         $data_city[$i][__($indx, true) . ' ' . __($k, true)] = $module[$k];
                     } else {
                         $data_city[$i][__($indx, true) . ' ' . __($k, true)] = $module[$k];
                     }
                 }
             }
             $i++;
         }
         $this->set('cities', $data_city);
     }
     $districts = $this->City->District->find('list');
     $this->City->bindModel(array('belongsTo' => array('State' => array('className' => 'State', 'foreignKey' => '', 'conditions' => 'State.id = District.state_id', 'fields' => '', 'order' => ''))));
     $states = $this->City->State->find('list');
     $this->set(compact('districts', 'states'));
 }
    /** 
     *	Create the necessary form to customize the widget.
     *
     *	@uses		title	@since 0.1
     *
     *	@author		Nate Jacobs
     *	@since		0.1
     *
     *	@param		array
     */
    public function form($instance)
    {
        $instance = wp_parse_args((array) $instance, array('title' => __('Brickset Themes', 'bs_api')));
        $title = esc_attr($instance['title']);
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title', 'bs_api');
        ?>
:</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo $title;
        ?>
">
		</p>
		<?php 
    }
Пример #29
0
 /**
  * Saving edited user information
  *
  * @return void
  */
 public function execute()
 {
     $userId = $this->_objectManager->get('Magento\\Backend\\Model\\Auth\\Session')->getUser()->getId();
     $password = (string) $this->getRequest()->getParam('password');
     $passwordConfirmation = (string) $this->getRequest()->getParam('password_confirmation');
     $interfaceLocale = (string) $this->getRequest()->getParam('interface_locale', false);
     /** @var $user \Magento\User\Model\User */
     $user = $this->_objectManager->create('Magento\\User\\Model\\User')->load($userId);
     $user->setId($userId)->setUsername($this->getRequest()->getParam('username', false))->setFirstname($this->getRequest()->getParam('firstname', false))->setLastname($this->getRequest()->getParam('lastname', false))->setEmail(strtolower($this->getRequest()->getParam('email', false)));
     if ($password !== '') {
         $user->setPassword($password);
         $user->setPasswordConfirmation($passwordConfirmation);
     }
     if ($this->_objectManager->get('Magento\\Framework\\Locale\\Validator')->isValid($interfaceLocale)) {
         $user->setInterfaceLocale($interfaceLocale);
         $this->_objectManager->get('Magento\\Backend\\Model\\Locale\\Manager')->switchBackendInterfaceLocale($interfaceLocale);
     }
     try {
         $user->save();
         $user->sendPasswordResetNotificationEmail();
         $this->messageManager->addSuccess(__('The account has been saved.'));
     } catch (\Magento\Framework\Model\Exception $e) {
         $this->messageManager->addMessages($e->getMessages());
     } catch (\Exception $e) {
         $this->messageManager->addError(__('An error occurred while saving account.'));
     }
     $this->getResponse()->setRedirect($this->getUrl("*/*/"));
 }
Пример #30
-1
 public function processAction()
 {
     $authAdapter = new Zend_Auth_Adapter_DbTable(Zend_Registry::get('dbAdapter'));
     $authAdapter->setTableName('user')->setIdentityColumn('username')->setCredentialColumn('password')->setIdentity($_POST['username'])->setCredential($_POST['password']);
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate($authAdapter);
     $data = array();
     if ($result->isValid()) {
         unset($this->_session->messages);
         $identity = $auth->getIdentity();
         $user = new User();
         $user->username = $identity;
         $user->populateWithUsername();
         Zend_Auth::getInstance()->getStorage()->write($user);
         //$this->_redirect('login/complete');
         //$this->_forward('index','main');
         $data['msg'] = __("Login successful.");
         $data['code'] = 200;
     } else {
         $auth->clearIdentity();
         $this->_session->messages = $result->getMessages();
         //$this->_redirect('login');
         $data['err'] = __("Invalid username/password.");
         $data['code'] = 404;
     }
     header('Content-Type: application/xml;');
     $this->view->data = $data;
     $this->completeAction();
     //$this->render();
 }