static function text_block($atts, $content = '') { extract(shortcode_atts(array('style' => '1', 'align' => 'left', 'top_padding' => '', 'bottom_padding' => '', 'left_padding' => '', 'right_padding' => '', 'top_margin' => '', 'bottom_margin' => '', 'width' => '', 'line_height' => ''), $atts)); $style = 'text-align:' . $align . ';' . ($top_margin == '' ? '' : 'margin-top:' . $top_margin . 'px;') . ($bottom_margin == '' ? '' : 'margin-bottom:' . $bottom_margin . 'px;') . ($width == '' ? '' : 'width:' . $width . 'px;') . ($line_height == '' ? '' : 'line-height:' . $line_height . 'px;'); $style = ($top_margin == '' ? '' : 'margin-top:' . $top_margin . 'px;') . ($bottom_margin == '' ? '' : 'margin-bottom:' . $bottom_margin . 'px;') . ($width == '' ? 'width:100%;' : 'width:' . $width . 'px;') . ($line_height == '' ? '' : 'line-height:' . $line_height . 'px;') . ($align == 'center' ? 'margin: 0 auto;text-align:center;' : 'text-align: ' . $align . ';'); $chks = array('top', 'bottom', 'left', 'right'); foreach ($chks as $chk) { $var = $chk . '_padding'; $style .= ${$var} == '' ? '' : 'padding-' . $chk . ':' . ${$var} . 'px;'; } $font = op_asset_font_style($atts) . ($line_height == '' ? '' : 'line-height:' . $line_height . 'px;'); $original_font_str = $GLOBALS['OP_LIVEEDITOR_FONT_STR']; if ($font != '') { $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = array('elements' => array('p', 'li'), 'style_str' => $font); } $processed = op_process_asset_content(op_clean_shortcode_content(apply_filters('the_content', wpautop($content)))); $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = $original_font_str; return '<div class="op-text-block" style="' . $style . '">' . $processed . '</div>'; }
/** * shortcode parsing of membership file downloads element * @param array $atts * @param string $content * @return String */ static function membership_download($atts, $content) { // Decode encoded chars $atts = op_urldecode($atts); extract(shortcode_atts(array('style' => 1), $atts)); //</editor-fold> // some preliminary checks // creating member dir if it does not exist if (!is_dir($files_dir = $GLOBALS['WS_PLUGIN__']['optimizemember']['c']['files_dir'])) { if (is_writable(dirname(c_ws_plugin__optimizemember_utils_dirs::strip_dir_app_data($files_dir)))) { mkdir($files_dir, 0777, true); } } // creating .htaccess file if it does not exist! if (is_dir($files_dir) && is_writable($files_dir)) { if (!file_exists($htaccess = $files_dir . '/.htaccess') || !apply_filters('ws_plugin__s2member_preserve_files_dir_htaccess', false, get_defined_vars())) { file_put_contents($htaccess, trim(c_ws_plugin__optimizemember_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['optimizemember']['c']['files_dir_htaccess'])))); } } $content = do_shortcode(op_clean_shortcode_content($content)); $content = op_process_asset_content($content); if (!empty($content)) { $html = '<ul class="downloadlist-' . $style . ' border">' . $content . '</ul>'; } else { $html = ''; } return $html; }